path: root/firmware/pcm_mixer.c
AgeCommit message (Collapse)AuthorFilesLines
2020-10-24pcm_mixer: Fix an idle frame calculation bug introduced in 2e708c48c5Solomon Peachy1-1/+1
Resulted in playback sometimes hanging after switching tracks Change-Id: I3d7a3c131cf547206ec536d9818c5060113f2b11
2020-10-03pcm: Dynamically-size the mixer buffer at higher audio bitrates.Solomon Peachy1-10/+29
Basically, existing sizes apply for <= 48KHz audio. Up to 96K, we double the mix buffer. up to 192K, we double it again. Will help reduce the interrupt load and overall latency, keeping it roughtly constant as a function of time, regardless of bitrate. (It is acutally a fixed-size buffer, statically-allocated to handle the worst-case bitrate the player supports. However, at runtime if we are using a lower bitrate we will only use a portion of it in order to keep latancies down) Change-Id: I61ca23180a86502732b0903fe9691c1a8c2aeaea
2013-07-06Enable setting of global output samplerate on certain targets.Michael Sevakis1-3/+24
Replaces the NATIVE_FREQUENCY constant with a configurable frequency. The user may select 48000Hz if the hardware supports it. The default is still 44100Hz and the minimum is 44100Hz. The setting is located in the playback settings, under "Frequency". "Frequency" was duplicated in english.lang for now to avoid having to fix every .lang file for the moment and throwing everything out of sync because of the new play_frequency feature in features.txt. The next cleanup should combine it with the one included for recording and generalize the ID label. If the hardware doesn't support 48000Hz, no setting will be available. On particular hardware where very high rates are practical and desireable, the upper bound can be extended by patching. The PCM mixer can be configured to play at the full hardware frequency range. The DSP core can configure to the hardware minimum up to the maximum playback setting (some buffers must be reserved according to the maximum rate). If only 44100Hz is supported or possible on a given target for playback, using the DSP and mixer at other samperates is possible if the hardware offers them. Change-Id: I6023cf0c0baa8bc6292b6919b4dd3618a6a25622 Reviewed-on: Reviewed-by: Michael Sevakis <> Tested-by: Michael Sevakis <>
2012-12-05Add a true waveform display to the oscilloscope plugin.Michael Sevakis1-0/+22
* Adds some additional niftyness like a floating popup display that is implemented in an OSD library for use by other plugins. * Speed changes are now gradual for both views and follow a curve derived from some fiddling around to get a nice feel. * Refined a few behavioral things overall. It needs a bit of help from a direct PCM channel callback so it may capture PCM for waveform display. Also need a few other core routines to help out for the OSD. Messes with some keymaps. Some targets need keymaps to access the different views. Some devices can't support the additional view because it requires a large buffer ( > 1 s) for samples. If the plugin buffer is small, they can still use the popup display since the plugin is also much smaller in that case. Slow speed waveform needs some refining so it draws gradually like a real oscilloscope but I'll stick with what it is, for the moment. Change-Id: Ieb5b7922a2238264e9b19a58cb437739194eb036 Reviewed-on: Reviewed-by: Michael Sevakis <> Tested-by: Michael Sevakis <>
2012-05-02Clean up peak calculating code.Michael Sevakis1-13/+3
Mixer needn't keep peak data around that will never be used. Just pass pcm_peaks structure to it instead of allocating for every channel. Plugin API becomes incompatible. vu_meter digital mode was still using global peak calculation; switch it to playback channel like the rest. Remove some accumulated soil peaks inside pcm.c and make it more generic. Change-Id: Ib4d268d80b6a9d09915eea1c91eab483c1a2c009
2012-05-02Use buflib for the allocation of voice PCM resources.Michael Sevakis1-0/+10
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
2012-04-29Make rbcodec/dsp includes more specific.Michael Sevakis1-1/+1
Change-Id: Idb6af40df26f5b8499a40e8b98602261ef227044
2012-03-12Coldfire: Optimize emac context save/restore in mixer ISR.Michael Sevakis1-0/+3
Save only once if emac is used in ISR and restore only once per ISR call if already saved. Change-Id: I0e40db5d4aab2a8552480f76873f59ff6ccd9977 Reviewed-on: Tested-by: Michael Sevakis <> Reviewed-by: Michael Sevakis <>
2012-03-03Revise the PCM callback system after adding multichannel audio.Michael Sevakis1-15/+20
Additional status callback is added to pcm_play/rec_data instead of using a special function to set it. Status includes DMA error reporting to the status callback. Playback and recording callback become more alike except playback uses "const void **addr" (because the data should not be altered) and recording uses "void **addr". "const" is put in place throughout where appropriate. Most changes are fairly trivial. One that should be checked in particular because it isn't so much is telechips, if anyone cares to bother. PP5002 is not so trivial either but that tested as working. Change-Id: I4928d69b3b3be7fb93e259f81635232df9bd1df2 Reviewed-on: Reviewed-by: Michael Sevakis <> Tested-by: Michael Sevakis <>
2012-02-19beep/mixer code: Code police a bit.Michael Sevakis1-1/+3
/firmware is in the #include path with makes #include "asm/beep.c" sufficient. Add a comment to generic beep code and make another express intent better. Change-Id: I587cd704478b894785927bdfe2e647e28614df62
2012-02-17PCM mixer: Simplify mixer_channel_play_data.Michael Sevakis1-27/+16
Streamline it to do fewer PCM lock calls in the case of having a prepared buffer. Change-Id: I7fca2b95cc5da314ae257522bb6f1ad7aec6634a
2012-01-22Move pcm_mixer helper routines to firmware/asm.Thomas Martitz1-102/+2
2012-01-04PCM mixer: Get rid of an obsolete macro cruft.Michael Sevakis1-5/+0
git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-12-24Initial commit of the Samsung YP-R0 port.Thomas Martitz1-0/+5
This port is a hybrid native/RaaA port. It runs on a embedded linux system, but is the only application. It therefore can implement lots of stuff that native targets also implement, while leveraging the underlying linux kernel. The port is quite advanced. User interface, audio playback, plugins work mostly fine. Missing is e.g. power mangement and USB (see SamsungYPR0 wiki page). Included in utils/ypr0tools are scripts and programs required to generate a patched firmware. The patched firmware has the rootfs modified to load Rockbox. It includes a early/safe USB mode. This port needs a new toolchain, one that includes glibc headers and libraries. can generate it, but e.g. codesourcey and distro packages may also work. Most of the initial effort is done by Lorenzo Miori and others (on ABI), including reverse engineering and patching of the original firmware, initial drivers, and more. Big thanks to you. Flyspray: FS#12348 Author: Lorenzo Miori, myself Merry christmas to ypr0 owners! :) git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-12-05Use a macro for aligning PCM chunks instead of explictly coding it each time.Michael Sevakis1-8/+3
git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-12-04Collect the 16-bit signed range sample clipping routines scattered about, ↵Michael Sevakis1-7/+1
which can be optimized on armv6 and create firmware/export/dsp-util.h (for lack of better place right now). git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-07-02Use playback channel directly for peakmeters and plugins using peak ↵Michael Sevakis1-1/+27
calculation. Also, for now, don't allow mixer playback to overlap recording, even if full duplex works. git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-06-29Do some adjustments to alleviate IRAM congestion on some targets from ↵Michael Sevakis1-1/+1
r30097. Include removing pointless IRAM declarations in pcmbuf.c because that callback code runs at a fairly relaxed pace. M5 is still the biggest problem. git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-06-29Get android to build. Forgo optimized mixing code for app builds for the ↵Michael Sevakis1-0/+3
moment; work it out later. git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-06-29Commit FS#12150 - Fully-functional audio mixer - and finally whip old ↵Michael Sevakis1-0/+501
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:// a1c6a512-1295-4272-9138-f99709370657