|
Rockbox mail archiveSubject: Re: Getting a plugin to play soundRe: Getting a plugin to play sound
From: Michael Sevakis <jethead71_at_sbcglobal.net>
Date: Mon, 21 Jul 2008 19:45:37 -0400 What's the standard way to get a plugin to play a sound effect? I'm a bit confused from looking at sources -- some plugins store their sounds in multiple formats, and wavplay has all sorts of magic constants in it. I have two problems: 1) How do I convert a wav file into a format that rockbox will be willing to play? I wrote a python script that will convert any file into an unsigned short array, but all of my attempts to convert wav->pcm have failed. Maybe I'm not playing the pcm file correctly? I'm just feeding it into aplay, and I get random noise. What do people use under linux for playing them? 2) How do I then use rb->pcm_play_data? I guessed that I would just be able to do something like rb->pcm_play_data(mysound) where mysound is the unsigned short array, but it wants a function pointer called 'get_more'. Why is this necessary and what should this function be doing? ========================= 1) You should feed raw 16-16, interleaved PCM data to the output. 2) pcm_play_data may be used without the callback parameter by specifiying an address and size in order to play a single clip. If you wish to play sound continuously, then use the callback instead and return the buffer address and size to be played from that callback. Every time that a buffer is played out, the callback is asked for the next buffer to play but without stopping and starting playback. The playback engine, mplegplayer and doom for example use the callback whereas metronome uses the individual clip method. The callback is called asynchronously in interrupt context so what you may do in there is limited. Received on 2008-07-22 Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy |