Commit graph

449 commits

Author SHA1 Message Date
Thomas Martitz
baa070cca6 GSoC/Buflib: Enable compaction in buflib.
This enables the ability to allocate (and free) memory dynamically
without fragmentation, through compaction. This means allocations can move
and fragmentation be reduced. Most changes are preparing Rockbox for this,
which many times means adding a move callback which can temporarily disable
movement when the corresponding code is in a critical section.

For now, the audio buffer allocation has a central role, because it's the one
having allocated most. This buffer is able to shrink itself, for which it
needs to stop playback for a very short moment. For this,
audio_buffer_available() returns the size of the audio buffer which can
possibly be used by other allocations because the audio buffer can shrink.

lastfm scrobbling and timestretch can now be toggled at runtime without
requiring a reboot.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30381 a1c6a512-1295-4272-9138-f99709370657
2011-08-30 14:01:45 +00:00
Thomas Martitz
d1322b7159 GSoC/Buflib: Replace all direct accesses to audiobuf with buffer API functions.
Namely, introduce buffer_get_buffer() and buffer_release_buffer().
buffer_get_buffer() aquires all available and grabs a lock, attempting to
call buffer_alloc() or buffer_get_buffer() while this lock is locked will cause
a panicf() (doesn't actually happen, but is for debugging purpose).
buffer_release_buffer() unlocks that lock and can additionally increment the
audiobuf buffer to make an allocation. Pass 0 to only unlock if buffer was
used temporarily only.
buffer_available() is a replacement function to query audiobuflen, i.e. what's
left in the buffer.
Buffer init is moved up in the init chain and handles ipodvideo64mb internally.

Further changes happened to mp3data.c and talk.c as to not call the above API
functions, but get the buffer from callers. The caller is the audio system
which has the buffer lock while mp3data.c and talk mess with the buffer.
mpeg.c now implements some buffer related functions of playback.h, especially
audio_get_buffer(), allowing to reduce #ifdef hell a tiny bit.

audiobuf and audiobufend are local to buffer.c now.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30308 a1c6a512-1295-4272-9138-f99709370657
2011-08-14 15:13:00 +00:00
Jonathan Gordon
32dfc0cdc1 Add a plugin activity which to the %cs screen option list
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30253 a1c6a512-1295-4272-9138-f99709370657
2011-08-04 13:40:24 +00:00
Thomas Martitz
589879bb3d Plugin API/ABI got incompatible r30242. Bump and sort.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30243 a1c6a512-1295-4272-9138-f99709370657
2011-08-03 09:52:23 +00:00
Michael Sevakis
5663e1cd0a Have mpegplayer use the mixer (the playback channel, since it's mutually exclusive to audio playback) so the clicks and skip beep can be used according to user settings. Introduce some system sound functions to make easier playing event sounds from various places and convert files calling 'beep_play' to use 'system_sound_play' and 'keyclick_click'. Event sound could be become themeable.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30130 a1c6a512-1295-4272-9138-f99709370657
2011-07-08 22:31:15 +00:00
Michael Sevakis
22b6def065 Use playback channel directly for peakmeters and plugins using peak calculation. Also, for now, don't allow mixer playback to overlap recording, even if full duplex works.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30119 a1c6a512-1295-4272-9138-f99709370657
2011-07-02 11:55:38 +00:00
Michael Sevakis
7996d6d3f9 Knock out at least some red/yellow from r30097.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30098 a1c6a512-1295-4272-9138-f99709370657
2011-06-29 07:06:10 +00:00
Michael Sevakis
a2b6703a36 Commit FS#12150 - Fully-functional audio mixer - and finally whip old limitations about playback of voice and other sounds when paused. Channels are independent in state and amplitude. Fade on stop/pause is handled by the channel's volume control rather than global volume which means it now works from anywhere. Opens up the possibility of plugin sounds during music playback by merely adding an additional channel enum. If any PCM drivers were not properly modified, see one of the last comments in the task for a description of the simple change that is expected. Some params are tunable in firmware/export/pcm-mixer.h as well.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30097 a1c6a512-1295-4272-9138-f99709370657
2011-06-29 06:37:04 +00:00
Michael Sevakis
5a8f5b8330 Provide a reasonable fix for FS#12093 - Playback hanging after codec/playback rework. Also, get rid of an impossible buffering case (BUF_USED is always less than buffer_len) and remove a buffering API that is not used anywhere and shouldn't be needed (plugin API has to be incompatible).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29849 a1c6a512-1295-4272-9138-f99709370657
2011-05-09 21:19:11 +00:00
Michael Sevakis
c537d5958e Commit FS#12069 - Playback rework - first stages. Gives as thorough as possible a treatment of codec management, track change and metadata logic as possible while maintaining fairly narrow focus and not rewriting everything all at once. Please see the rockbox-dev mail archive on 2011-04-25 (Playback engine rework) for a more thorough manifest of what was addressed. Plugins and codecs become incompatible.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29785 a1c6a512-1295-4272-9138-f99709370657
2011-04-27 03:08:23 +00:00
Michael Sevakis
56dd75d204 Purge buffer and codec APIs existing exclusively in support of mpa.codec and fix that to not require them: buf_get_offset and ci.advance_buffer_loc. Sort APIs; everything must become incompatible. :(
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29595 a1c6a512-1295-4272-9138-f99709370657
2011-03-16 05:38:37 +00:00
Thomas Martitz
cc889e9d60 Change the thread api a bit.
* Remove THREAD_ID_CURRENT macro in favor of a thread_self() function, this allows thread functions to be simpler.
* thread_self_entry() shortcut for kernel.c.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29521 a1c6a512-1295-4272-9138-f99709370657
2011-03-05 17:48:06 +00:00
Michael Sevakis
6510973223 Give playback engine better control over the codec. Codec simply follows commands and doesn't concern itself with audio state. Get track change notification in on the actual last buffer insert of the track because now audio simply waits for a track change notify from PCM on the last track and it must be sent reliably. This is still at an intermediate stage but works. Codecs and plugins become incompatible.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29387 a1c6a512-1295-4272-9138-f99709370657
2011-02-23 14:31:13 +00:00
Michael Sevakis
2da0f9bcfd Fuze v2: Do button reading more efficiently by mapping button codes directly to the GPIO pin states where possible (all but 'home' and hold). This makes plugins incompatible; up the min version and sort things.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29097 a1c6a512-1295-4272-9138-f99709370657
2011-01-20 17:11:23 +00:00
Teruaki Kawashima
1c14d29370 FS#11822: use rockbox_browse() in plugins to select file.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29069 a1c6a512-1295-4272-9138-f99709370657
2011-01-17 12:40:21 +00:00
Michael Sevakis
0dd74ca722 SA9200: Add YUV blitting, do full-screen updates more efficiently and properly clip partial updates. Plugin struct becomes incompatible for this target but leave version alone since it's still dev-only.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29028 a1c6a512-1295-4272-9138-f99709370657
2011-01-11 01:21:31 +00:00
Frank Gevaerts
42ad21ab53 Add some app_*() wrappers for file IO functions to make app_ work the same as sim_, thereby fixing application builds
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28993 a1c6a512-1295-4272-9138-f99709370657
2011-01-07 18:45:35 +00:00
Frank Gevaerts
1980fc3a61 Also PREFIX() other filesystem functions. I hope I got them all now...
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28929 a1c6a512-1295-4272-9138-f99709370657
2010-12-29 20:10:11 +00:00
Frank Gevaerts
6406e61e5c Properly prefix the creat function for sim builds, otherwise the system creat() is called, which doesn't do proper root-mangling to make the file end up in the right place. Fixes FS#11844
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28927 a1c6a512-1295-4272-9138-f99709370657
2010-12-29 19:40:02 +00:00
Mustapha Senhaji
39b3c9a612 git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28917 a1c6a512-1295-4272-9138-f99709370657 2010-12-28 14:18:37 +00:00
Thomas Martitz
2c2416094f Get rid of get_user_file_path and do the path handling in wrappers for open() and friends.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28752 a1c6a512-1295-4272-9138-f99709370657
2010-12-06 22:26:31 +00:00
Nils Wallménius
8123dffaea Remove some inconsistent guarding around cpucache_* functions to fix a test_codec crash on coldfire, breaks plugin api compatibility so sorted and bumped version numbers.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28287 a1c6a512-1295-4272-9138-f99709370657
2010-10-16 12:30:06 +00:00
Bertrik Sikken
8ad85ba291 Fix for FS #10097 - Sometimes keys do work after exiting plugins.
This removes the call to button_clear_queue which interfered with the mechanism in action.c to wait for a key
release event when the button context is changed.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28232 a1c6a512-1295-4272-9138-f99709370657
2010-10-10 14:07:56 +00:00
Teruaki Kawashima
55a63609ef use correct condition for #if for tagcache_fill_tags().
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28188 a1c6a512-1295-4272-9138-f99709370657
2010-09-30 13:09:50 +00:00
Frank Gevaerts
f366090562 Make disabling HAVE_PITCHSCREEN actually work without breaking the build
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28102 a1c6a512-1295-4272-9138-f99709370657
2010-09-17 20:28:47 +00:00
Thomas Martitz
0d4585b28f Extend lc_open() to also being able to load overlay plugins.
For this it needs to look at the plugin header. Since lc_open() doesn't know
it's a plugin, the header needs to be changed slightly to include the new lc_header (which needs to be the first element in plugin_header so it can be casted savely).

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28054 a1c6a512-1295-4272-9138-f99709370657
2010-09-09 16:17:21 +00:00
Thomas Martitz
6eaab4d004 Ged rid of uisimulator/common/io.c for android builds.
Use host's functions for file i/o directly (open(), close() ,etc.), not the sim_* variants.
Some dir functions need to be wrapped still because we need to cache the parents dir's path (host's dirent doesn't let us know).
For the same reason (incompatibility) with host's dirent) detach some members from Rockbox' dirent struct and put it into an extra one,
the values can be retrieved via the new dir_get_info().

Get rid of the sim_ prefix for sleep as well and change the signature to unix sleep().

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27968 a1c6a512-1295-4272-9138-f99709370657
2010-09-01 21:29:34 +00:00
Rafaël Carré
da16248e47 Plugins: modify IRAM copying code
Move to plugin_crt0.c, plugins don't need PLUGIN_IRAM_* macros anymore
IRAM is no longered zeroed before copying (as it is at the same address
than BSS) -> Fix FS#11581
Use cpucache_invalidate() (and not cpucache_flush), needed for self-modifying code on cached IRAM

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27948 a1c6a512-1295-4272-9138-f99709370657
2010-08-30 20:47:53 +00:00
Rafaël Carré
0f063b7d72 Implement lcd(_remote)_putsxyf() and export to plugins
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27921 a1c6a512-1295-4272-9138-f99709370657
2010-08-28 21:46:18 +00:00
Rafaël Carré
e09ebc4213 pitch_detector: cleanup
- cosmetics: remove trailing white space
- mark all functions and variables as static
- merge struct definition and declaration when possible
- rename tuner_settings -> settings (because it's shorter)
- remove unused enums
- don't give pointer to settings struct as argument since there is only
  one struct, same for the settings filename
- fix error cases in settings load:
    reset settings when loading failed
    close file when it hasn't the right size
- inline small load/save functions only used once
- remove unused print_char_xy
- inline print_str and print_int_xy, and use lcd_putsf (added to the
  plugin API)

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27918 a1c6a512-1295-4272-9138-f99709370657
2010-08-28 17:52:31 +00:00
Thomas Martitz
194174a371 2nd try: Introduce a small api for loading code (codecs,plugins) from disk/memory.
It's a used by codec/plugin loading and vastly reduces code duplication. It's also a step forward in getting rid of libuisimulator in the application ports.

Apparently sh needs linker symbols prefixed with _ even if they're referenced without from C code.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27902 a1c6a512-1295-4272-9138-f99709370657
2010-08-27 00:29:50 +00:00
Thomas Martitz
97d2a6ec5c Revert "Introduce a small api for loading code (codecs,plugins) from disk/memory."
I don't understand the build error at all, plugin_bss_start is clearly defined in plugin.lds

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27901 a1c6a512-1295-4272-9138-f99709370657
2010-08-27 00:16:26 +00:00
Thomas Martitz
73f057be6f Introduce a small api for loading code (codecs,plugins) from disk/memory.
It's a used by codec/plugin loading and vastly reduces code duplication. It's also a step forward in getting rid of libuisimulator in the application ports.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27900 a1c6a512-1295-4272-9138-f99709370657
2010-08-26 23:20:02 +00:00
Rafaël Carré
851be21f67 system-arm.c/__div0 are for ARM native builds only
Android can now be built with CPU_ARM defined
Needs investigation (and test_codec) to see if/how this helps

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27684 a1c6a512-1295-4272-9138-f99709370657
2010-08-03 19:00:29 +00:00
Thomas Martitz
9c0b2479f7 Rockbox as an application: add get_user_file_path().
For RaaA it evaluates user paths at runtime. For everything but codecs/plugins it will give the path under $HOME/.config/rockbox.org if write access is needed or if the file/folder in question exists there (otherwise it gives /usr/local/share/rockbox).
This allows for installing themes under $HOME as well as having config.cfg and other important files there while installing the application (and default themes) under /usr/local.

On the DAPs it's a no-op, returing /.rockbox directly.

Not converted to use get_user_file_path() are plugins themselves, because RaaA doesn't build plugins yet.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27656 a1c6a512-1295-4272-9138-f99709370657
2010-08-01 16:15:27 +00:00
Nils Wallménius
296ac7f716 Missed one.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27540 a1c6a512-1295-4272-9138-f99709370657
2010-07-24 10:53:58 +00:00
Teruaki Kawashima
a874f77e18 text_viewer: remove unneeded code.
viewportmanager_theme_enable() sets values to passed viewport by viewport_set_defaults(), so no need to call sb_skin_get_info_vp() or viewport_set_defaults().

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27399 a1c6a512-1295-4272-9138-f99709370657
2010-07-12 13:38:40 +00:00
Yoshihisa Uchida
bc46541bcd plugin api: delete sb_skin_update().
text viewer: use send_event() instead of sb_skin_update(). thanks to teru.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27348 a1c6a512-1295-4272-9138-f99709370657
2010-07-08 13:54:28 +00:00
Yoshihisa Uchida
3691435c25 plugin api: new functions set the end of the structure. thanks to Frank Gevaerts.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27335 a1c6a512-1295-4272-9138-f99709370657
2010-07-07 12:42:15 +00:00
Yoshihisa Uchida
e5a257607d plugin api: add the following functions.
- get the viewport of the current skin.
- update the current skin statusbar.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27333 a1c6a512-1295-4272-9138-f99709370657
2010-07-07 11:35:30 +00:00
Michael Sevakis
cf73340f1e Enable game sounds in PacBox. Sound is OFF by default but can be enabled from the menu. Enable a function for SWCODEC in the middle of the plugin API, so plugins must be made incompatible (full update).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27202 a1c6a512-1295-4272-9138-f99709370657
2010-07-01 00:26:01 +00:00
Thomas Martitz
35e8b1429a Rockbox as an application: Replace many occurences of #ifdef SIMULATOR with #if (CONFIG_PLATFORM & PLATFORM_HOSTED) (or equivalently).
The simulator defines PLATFORM_HOSTED, as RaaA will do (RaaA will not define SIMULATOR).
The new define is to (de-)select code to compile on hosted platforms generally.

Should be no functional change to targets or the simulator.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27019 a1c6a512-1295-4272-9138-f99709370657
2010-06-21 16:53:00 +00:00
Rafaël Carré
5d236b2bfd Generate C file / header for svn version string
It's now easier to force rebuild of files depending on the svn revision

version.c/version.h are generated once with new tools/genversion.sh
Changes in the VCS are still not auto detected, so you'll have to remove
builddir/version.* if you want to change the string in your binaries

APPSVERSION is now called RBVERSION and is defined in the generated
header instead of being defined by the Makefiles
appsversion is now called rbversion (the plugin api number didn't change
since old modules are still binary compatible)

Change some bootloaders to use knwon-at-buildtime RBVERSION instead of
"%s" + rbversion

You'll need to run make clean to regenerate dependencies after the
removal of apps/version.h

To build binaries with a different version string, hand-edit
tools/version.sh or tools/genversion.sh (which calls the former)

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26320 a1c6a512-1295-4272-9138-f99709370657
2010-05-27 09:41:46 +00:00
Michael Sevakis
d56999890f Make PCM->driver interface about as simple as it will get. Registered callback, zero data, alignment and stops are handled entirely inside pcm.c; driver merely calls fixed pcm.c callback. Remove pcm_record_more and do it just like playback; the original reason behind it isn't very practical in general. Everything checks out on supported targets. There wer some compat changes I can't check out on many unsupoorted but if there's a problem it will be a minor oops. Plugins become incompatible due to recording tweak-- full update. Sorted API.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26253 a1c6a512-1295-4272-9138-f99709370657
2010-05-24 16:42:32 +00:00
Michael Sevakis
fcf36dd4f9 Simplify mpegplayer a bit and use array-based lists rather than linked lists for stream management. Move a couple useful functions to handle pointer arrays from kernel.c into general.c; mpeglayer now makes use of them.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26101 a1c6a512-1295-4272-9138-f99709370657
2010-05-17 12:34:05 +00:00
Michael Sevakis
80d0d15ca9 Gigabeat S: Fully enable access to hardware tone controls and 3-D effect feature. Under the hood, it's designated a hardware equalizer since it is one. Implement code framework for hardware EQ in general. Menu aspect is well abstracted and so the UI and strings can be changed around if taste doesn't quite suit. So far the emphasis is distinction of the UI labelling from the software EQ so that it's clear the settings are for a different thing.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26051 a1c6a512-1295-4272-9138-f99709370657
2010-05-15 13:09:45 +00:00
Frank Gevaerts
530c25130f Make the sim buildable with mingw again
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26037 a1c6a512-1295-4272-9138-f99709370657
2010-05-14 22:57:52 +00:00
Thomas Martitz
3cca7e8650 Include host system's header files and don't compile our c library replacements in the sim.
This makes it possible to move the simulator code into the target tree (for Rockbox as an application).

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26019 a1c6a512-1295-4272-9138-f99709370657
2010-05-14 12:37:05 +00:00
Michael Sevakis
7250405c70 pitch_detector: Use continuous recording, even if the algorithm is too slow for that and record a whole buffer even if the min frequency is higher. Use the minimum samplerate that allows C-4186 to be detected (usually 11.025kHz, which can reduce computational load to 1/16 compared to 44.1kHz). Get rid of 64-bit multiplies when calculating input RMS value. Stop audio playback when entering plugin. Better backlight and CPU frequency handling. audio_sample_type->int16_t. simpler buffer size rounding.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26005 a1c6a512-1295-4272-9138-f99709370657
2010-05-14 06:25:40 +00:00
Thomas Martitz
e919b5d5b9 Fix disastrous variable shadowing, change casts to unsigned in (cygwin doesn't like mode_t there, and unsigned int should be equally correct) and check the correct bitmask in sim_open().
Should repair filesystem accesses on the sim.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25881 a1c6a512-1295-4272-9138-f99709370657
2010-05-07 16:56:40 +00:00