Support and General Use > Plugins/Viewers
Sound/DSP from within plugins?
Adion:
Does anyone know if it's possible to play sound from within a plugin while music is playing, or if it is possible to alter the sound that is currently playing?
One of the things that I want to do with it is add a function to the stopwatch plugin to have it play a sound at regular intervals so that you don't have to look at the screen while jogging for example.
Other things that I can think of that may be interesting is that it would be easy of any kind of dsp functions could be done by creating a plugin that can alter the sound. (Compressors, equalizers, ... could all be written as plugins then)
It would be great if a plugin could get a callback from the audio system on each buffer to do this, but I haven't searched into the rockbox core yet to find out if this is possible, and if this could work for on all targets.
Maybe some developer with a bit more rockbox experience could point me in the right direction?
Adion:
Ok, I have been looking into this a bit more, and I managed to create a first test plugin that alters the sound :)
To do this, I added a function pointer to dsp.c:
--- Code: ---static void (*dsp_external)(int32_t* src[], int count);
--- End code ---
And I made dsp_process use this function if it is not NULL.
I also added a function to edit this pointer to dsp.h, and I then added this edit function to the plugin structure.
Finally I initialized the dsp callback function at the start of the plugin, and set it back to NULL when the plugin was finished.
For now I just tested a plugin that lowers the volume as a test, and this works, although there is a delay of a few seconds it seems between starting the plugin and hearing the volume drop (which is probably not that much of a problem for most plugins)
My suggestion if more people think this kind of functionality would be useful is to create an array of dsp function pointers, along with a function to add and remove dsp functions from that array.
That way you could even enable multiple sound plugins, and the current dsp functions (equalizer and crossfeed) could also be added by default to the same array.
xlarge:
Glorious!
I'm thinking normalizing compressor/limiter. All tracks at the same percepted volume.
Llorean:
Replaygain already pretty much does that... And since it's precalculated it'll be more battery efficient than trying to do it during playback.
xlarge:
--- Quote from: Llorean on August 25, 2006, 06:05:17 AM ---Replaygain already pretty much does that... And since it's precalculated it'll be more battery efficient than trying to do it during playback.
--- End quote ---
If i get my tracks tagged for it - true.
Navigation
[0] Message Index
[#] Next page
Go to full version