Hi Serge,

thanks for your contribution.  I have two questions about your patch:

On 2009/08/30 16:51, Serge Ziryukin <ftrvxm...@gmail.com> wrote:
> OpenAL output plugin
> 
> +static void *
> +openal_init(G_GNUC_UNUSED const struct audio_format *audio_format,
> +         const struct config_param *param,
> +         GError **error)
> +{
> +     const char *device_name = config_get_block_string(param, "device", 
> NULL);
> +     ALCdevice *device = alcOpenDevice(device_name);

Why does it open the device in the init() method?  This way, MPD
cannot start while another program locks the sound card.  Do that in
open().

> +static size_t
> +openal_play(void *data, const void *chunk, size_t size,
> +         G_GNUC_UNUSED GError **error)
> +{
> +     struct openal_data *od = data;
> +     ALuint buffer;
> +     ALint num;
> +
> +     if (alcGetCurrentContext() != od->context) {
> +             alcMakeContextCurrent(od->context);
> +     }
> +
> +     if (od->filled < NUM_BUFFERS) {
> +             /* fill all buffers */
> +             buffer = od->buffers[od->filled];
> +             od->filled++;
> +     } else {
> +             alGetSourcei(od->source, AL_BUFFERS_PROCESSED, &num);
> +
> +             /* wait for processed buffer */
> +             while (num < 1) {
> +                     if (!od->timer->started) {
> +                             timer_start(od->timer);
> +                     } else {
> +                             timer_sync(od->timer);
> +                     }
> +
> +                     timer_add(od->timer, size);

I don't know how openal works - why are you using the timer object
here?  Other plugins rely on the timing of the library (e.g. ALSA's
snd_pcm_writei() blocks until there is enough room in the buffer).

Max

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team

Reply via email to