summaryrefslogtreecommitdiff
path: root/apps/playback.c (follow)
Commit message (Collapse)AuthorAge
* More snafu fix. Need a couple more patchups for now.Michael Sevakis2012-05-24
| | | | | | | Must restore talk buffer explicitly when not taking it and promote the buffer state. Change-Id: Ia0341ede05837e6e94885a9ad62460c415ec6f00
* Fix some lockup caused by handles not being initialized to < 0...Michael Sevakis2012-05-21
| | | | | | | | | | | | | | ...by default where they would be interpreted as valid but not actually be which would cause calls to buffering while it was not initialized. Add BUFFER_EVENT_BUFFER_RESET to inform users of buffering that the buffer is being reinitialized. Basically, this wraps all the functionality being provided by three events (...START_PLAYBACK, RECORDING_EVENT_START, RECORDING_EVENT_STOP) into one for radioart.c, the only user of those events (perhaps remove them?) and closes some loopholes. Change-Id: I99ec46b9b5fb4e36605db5944c60ed986163db3a
* Use buflib for the allocation of voice PCM resources.Michael Sevakis2012-05-02
| | | | | | | | | | | | | Buffers are not allocated and thread is not created until the first call where voice is required. Adds a different callback (sync_callback) to buflib so that other sorts of synchonization are possible, such as briefly locking-out the PCM callback for a buffer move. It's sort of a messy addition but it is needed so voice decoding won't have to be stopped when its buffer is moved. Change-Id: I4d4d8c35eed5dd15fb7ee7df9323af3d036e92b3
* rbcodec refactoring: autoresumableSean Bartell2012-05-01
| | | | | | | | Moved to playback.c, since it doesn't use metadata from the music file. Change-Id: I5c3ad7750d94b36754f64eb302f96ec163785cb9 Reviewed-on: http://gerrit.rockbox.org/142 Reviewed-by: Nils Wallménius <nils@rockbox.org>
* rbcodec refactoring: get_audio_base_data_typeSean Bartell2012-04-28
| | | | | | | | | | This function has been changed to rbcodec_format_is_atomic, which doesn't require an enum from the kernel. Change-Id: I1d537605087fe130a9b545509d7b8a340806dbf2 Reviewed-on: http://gerrit.rockbox.org/141 Reviewed-by: Nils Wallménius <nils@rockbox.org> Tested-by: Nils Wallménius <nils@rockbox.org>
* buflib/shrink_callback: Resume playback only if it was playing (not paused).Thomas Martitz2012-03-25
| | | | Change-Id: Ie4884ec4554890f8bdb03f48bcf215ece00a5560
* Option to constrain get_next_dir() to directories below ↵Nick Peskett2012-03-19
| | | | | | | | | | | | | | global_settings.start_directory. When enabled, if the user has set "Start File Browser Here" (config.cfg: start directory) to anything other than root and "Auto-Change Directory" is set to "Yes" or "Random", the directory returned when an auto change is required will be constrained to the value of "start directory" or below. Change-Id: Iaab773868c4cab5a54f6ae67bdb22e84642a9e4b Reviewed-on: http://gerrit.rockbox.org/182 Reviewed-by: Nick Peskett <rockbox@peskett.co.uk> Tested-by: Nick Peskett <rockbox@peskett.co.uk>
* Rename 'mp3entry.embed_albumart' to 'mp3entry.has_embedded_albumart' ↵Alexander Levin2011-12-22
| | | | | | (FS#12470). No functional changes. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31405 a1c6a512-1295-4272-9138-f99709370657
* FS #12419 : Support for embedded cuesheets.Nick Peskett2011-12-16
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31321 a1c6a512-1295-4272-9138-f99709370657
* FS#12378 : Remove various unused code, and comment out some unused code and ↵Boris Gjenero2011-12-14
| | | | | | data for reference or future use. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31256 a1c6a512-1295-4272-9138-f99709370657
* Simulate usb plugging on the sim better using sim_tasks.Thomas Martitz2011-11-17
| | | | | | Now all threads need to ack the connection like on real target, dircache is unloaded and playback stops accordingly. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31009 a1c6a512-1295-4272-9138-f99709370657
* Buflib: Make shrinking and buflib_available() smarter.Thomas Martitz2011-11-17
| | | | | | | | | | | | | | | | | * shrinking now considers freespace just before the alloc-to-be-shrinked, that means less (or sometimes none at all) is taken from the audio buffer. * core_available() now searches for the best free space, instead of simply the end, i.e. it will not return 0 if the audio buffer is allocated and there's free space before it. It also runs a compaction to ensure maximum contiguous memory. audio_buffer_available() is also enhanced. It now considers the 256K reserve buffer, and returns free buflib space instead if the audio buffer is short. This all fixes the root problem of FS#12344 (Sansa Clip+: PANIC occurred when dircache is enabled), that alloced from the audio buffer, even if it was very short and buflib had many more available as free space before it. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31006 a1c6a512-1295-4272-9138-f99709370657
* Fix warning and typos.Thomas Martitz2011-11-06
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30912 a1c6a512-1295-4272-9138-f99709370657
* Fix FS#12279 - playback starts from the beginning when changing themes.Thomas Martitz2011-11-05
| | | | | | | | | | | Very frequent start-stop cycles (as caused by frequent core_alloc() calls) of audio makes the codecs lose the resume position, and this causes playback from the beginning. To work around, use queue_post() instead of queue_send() to delay the resume so that it only resumes once per core_alloc() set. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30900 a1c6a512-1295-4272-9138-f99709370657
* In the playback buflib shrink callback, ensure a minimum buffer remains forThomas Martitz2011-11-03
| | | | | | | | | audio playback. If it goes below 256K new buflib allocations fail. This prevents buffer underruns as the new buffer size wasn't actually checked at all. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30893 a1c6a512-1295-4272-9138-f99709370657
* Make a few local functions staticBertrik Sikken2011-10-12
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30744 a1c6a512-1295-4272-9138-f99709370657
* Revert r30480 "Buflib/swcodec: Improve playback stopping behavior on ↵Thomas Martitz2011-09-19
| | | | | | | | | allocation." The buflib metadata gets corrupted at the new loation between core_shrink() and actually applying, the new buffer boundaries (most probably due to yield()). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30574 a1c6a512-1295-4272-9138-f99709370657
* Buflib/swcodec: Improve playback stopping behavior on allocation.Thomas Martitz2011-09-08
| | | | | | | | Reuse playback's Q_AUDIO_REMAKE_AUDIO_BUFFER capabilities to set the new playback buffer, instead of stopping/restarting manual. This strongly reduces the visibility of the short audio stop. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30480 a1c6a512-1295-4272-9138-f99709370657
* Shuffle some functions around so that interfacing with playback.c in ↵Michael Sevakis2011-09-01
| | | | | | particular isn't required. Though playback does finish the audio init, pcm doesn't care who does it. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30403 a1c6a512-1295-4272-9138-f99709370657
* Remove obsolete init cruft from audio system because of diminished ↵Michael Sevakis2011-09-01
| | | | | | dependencies. All talk/voice dependency in playback.c should be imminently removable. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30401 a1c6a512-1295-4272-9138-f99709370657
* Fix red.Andree Buschmann2011-08-30
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30392 a1c6a512-1295-4272-9138-f99709370657
* GSoC/Buflib: Enable compaction in buflib.Thomas Martitz2011-08-30
| | | | | | | | | | | | | | | | | | | 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
* GSoC/Buflib: Add buflib memory alocator to the core.Thomas Martitz2011-08-30
| | | | | | | | | | | | | | | | | The buflib memory allocator is handle based and can free and compact, move or resize memory on demand. This allows to effeciently allocate memory dynamically without an MMU, by avoiding fragmentation through memory compaction. This patch adds the buflib library to the core, along with convinience wrappers to omit the context parameter. Compaction is not yet enabled, but will be in a later patch. Therefore, this acts as a replacement for buffer_alloc/buffer_get_buffer() with the benifit of a debug menu. See buflib.h for some API documentation. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30380 a1c6a512-1295-4272-9138-f99709370657
* Commit work started in FS#12153 to put timing/position information in PCMMichael Sevakis2011-08-28
| | | | | | | | | | | | | | | | | | | | | | | | | buffer chunks. * Samples and position indication is closely associated with audio data instead of compensating by a latency constant. Alleviates problems with using the elapsed as a track indicator where it could be off by several steps. * Timing is accurate throughout track even if resampling for pitch shift, whereas before it updated during transition latency at the normal 1:1 rate. * Simpler PCM buffer with a constant chunk size, no linked lists. In converting crossfade, a minor change was made to not change the WPS until the fade-in of the incoming track, whereas before it would change upon the start of the fade-out of the outgoing track possibly having the WPS change with far too much lead time. Codec changes are to set elapsed times *before* writing next PCM frame because time and position data last set are saved in the next committed PCM chunk. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30366 a1c6a512-1295-4272-9138-f99709370657
* Remove a slightly silly null dereference. (a.k.a. I'm playing with cppcheck ↵Steve Bavin2011-08-26
| | | | | | too.) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30357 a1c6a512-1295-4272-9138-f99709370657
* Fix FS#12238 - WPS delay on pause introduced by r30097 which was the excuse ↵Michael Sevakis2011-08-23
| | | | | | I wanted anyway to do a better PCM fade on stop/pause implementation. New fade is asynchronous tick-based. Restores skin update points in the WPS that were removed when fading mechanism was changed. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30340 a1c6a512-1295-4272-9138-f99709370657
* Fix FS#12234 - Simulator crashes when playing mp3 file with cuesheet. The ↵Michael Sevakis2011-08-22
| | | | | | cuesheet in a lookahead mp3entry should not be taken to be valid, since it won't be the cue for the current track. Be sure id3->cuesheet is set NULL if grabbing the info from the buffer. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30337 a1c6a512-1295-4272-9138-f99709370657
* GSoC/Buflib: Replace all direct accesses to audiobuf with buffer API functions.Thomas Martitz2011-08-14
| | | | | | | | | | | | | | | | | | | | | | | 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
* revert r30226, which is apparently broken.Frank Gevaerts2011-08-01
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30232 a1c6a512-1295-4272-9138-f99709370657
* Reload the current playlist after reboot even if it has ended. (FS#11644)Frank Gevaerts2011-07-31
| | | | | | | This is done to make reboot more transparent. If a playlist has ended, there should be no difference between the player doing nothing for ten minutes and the player shutting down after the idle timeout and being restarted. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30226 a1c6a512-1295-4272-9138-f99709370657
* The voice PCM buffer has nothing to do with the playback PCM buffer any ↵Michael Sevakis2011-07-09
| | | | | | longer. Allocate it independently from the playback engine's PCM buffer and only when voice is required. Additionally, allocate actual space for the crossfade buffer only when using crossfade. Will save 18.3KB when neither is needed (10.3KB for voice and 8.0KB for crossfade). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30133 a1c6a512-1295-4272-9138-f99709370657
* Have mpegplayer use the mixer (the playback channel, since it's mutually ↵Michael Sevakis2011-07-08
| | | | | | 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
* Commit FS#12150 - Fully-functional audio mixer - and finally whip old ↵Michael Sevakis2011-06-29
| | | | | | 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
* Workaround an occasional problem where album art or cuesheets might not be ↵Michael Sevakis2011-05-25
| | | | | | ready by the time the track change event is send which can result in the WPS not immediately being aware that the handles are ready. A better solution will be sought that hopefully doesn't require the additional event. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29923 a1c6a512-1295-4272-9138-f99709370657
* Fix FS#12118 - Voice UI has issues talking various issues in menus and in ↵Michael Sevakis2011-05-20
| | | | | | the file browswer. audio_pcmbuf_may_play should check play_status for !=PLAY_PAUSED, not ==PLAY_PLAYING so that PCM may auto-start when voicing out playback state. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29904 a1c6a512-1295-4272-9138-f99709370657
* Fix whitespace and some comment typosJeffrey Goode2011-05-09
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29850 a1c6a512-1295-4272-9138-f99709370657
* Hopefully fix red from r29785 - an #ifdef AB_REPEAT_ENABLE was left out.Michael Sevakis2011-04-27
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29786 a1c6a512-1295-4272-9138-f99709370657
* Commit FS#12069 - Playback rework - first stages. Gives as thorough as ↵Michael Sevakis2011-04-27
| | | | | | 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
* Fix red and yellow. Move resume_index from mp3entry to playlist_info struct. ↵Andree Buschmann2011-04-07
| | | | | | Bump codec api. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29691 a1c6a512-1295-4272-9138-f99709370657
* Fix regressions of r29682. Update playlist index resume position when ↵Andree Buschmann2011-04-07
| | | | | | playlist changes (e.g. shuffling, inserting, removing, ...). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29690 a1c6a512-1295-4272-9138-f99709370657
* Fix FS#12043. Next track was resumed when pausing and shutting down the ↵Andree Buschmann2011-04-06
| | | | | | player in the last seconds of a track. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29682 a1c6a512-1295-4272-9138-f99709370657
* Fixed a typo. (Thanks Jeff!)Björn Stenberg2011-03-14
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29587 a1c6a512-1295-4272-9138-f99709370657
* Listen to and follow external Android volume changes. (Based on FS#11914 by ↵Björn Stenberg2011-03-14
| | | | | | Maurus Cuelenaere) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29586 a1c6a512-1295-4272-9138-f99709370657
* Remove malloc_buf references from playback.c since it's no longer used for ↵Michael Sevakis2011-03-06
| | | | | | anything and align the codec slack space buffer that is now use as the malloc buffer. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29533 a1c6a512-1295-4272-9138-f99709370657
* autoresume: Optimize playlist resume (manual, bookmark, or after power-on)Michael Hohmuth2011-02-28
| | | | | | | | | The resume position coming from these sources takes precedence over autoresume. If we have such a resume offset, we don't have to wait for the database to produce a resume offset before we can start the codec. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29470 a1c6a512-1295-4272-9138-f99709370657
* Give playback engine better control over the codec. Codec simply follows ↵Michael Sevakis2011-02-23
| | | | | | 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
* FS#11933: Check for external album art if embedded album art fails to load.Magnus Holmgren2011-02-16
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29319 a1c6a512-1295-4272-9138-f99709370657
* Always do proper mp3entry copying instead of using bufread directly. Add ↵Michael Sevakis2011-02-10
| | | | | | bufreadid3() helper. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29279 a1c6a512-1295-4272-9138-f99709370657
* audio_peek_track should copy the struct mp3entry instead of pointing ↵Michael Sevakis2011-02-10
| | | | | | directly into the buffer. Despite the dire warning, caller does in fact yield/sleep and its usage is too nonlocalized to control that reliably. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29275 a1c6a512-1295-4272-9138-f99709370657
* Disable buffering codecs (and code generally) on RaaA.Thomas Martitz2011-02-09
| | | | | | | It's not useful to do it since you need to write back the code to disk to be able to load it from memory, it also requires writing to an executable directory. Keep it for the simulator for the sake of simulating. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29261 a1c6a512-1295-4272-9138-f99709370657