Re: [AD] audio recording

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Sat, Jan 7, 2012 at 5:38 PM, Peter Wang <novalazy@xxxxxxxxxx> wrote:
> So I agree with using the casting functions.  You can add
> runtime assertions in debug modes, too.
>
I added al_get_audio_recorder_event(*event) and a specific event type.
There's a static assert to make sure it's no bigger than
sizeof(ALLEGRO_EVENT).

I use it like this when creating an event:

ALLEGRO_AUDIO_RECORDER_EVENT *e;
ALLEGRO_EVENT user_event;
user_event.user.type = ALLEGRO_EVENT_AUDIO_RECORDER_FRAGMENT;
e = al_get_audio_recorder_event(&user_event);
e->buffer = ...
e->samples = ...
al_emit_user_event(&r->source, &user_event, NULL);

And of course, user code can use it too.

Since it's a user event under the hood, does that mean it has to be
unref'ed by the user? Or is that only relevant if there's a dtor
associated with it?

Anyway, there are now two demos: ex_record.c and ex_record_name.c and
drivers for PulseAudio, ALSA, and DirectSound8. I am going to clean up
the drivers and ex_record.c a little bit, and then that's it. I'll
leave OS X implementation to somebody else (or nobody at all).

None of the drivers will be particularly high-performance, but I
suspect that anybody who cares will use more raw API calls anyway.

The API is missing device enumeration, but so is the audio playback,
so maybe those could be addressed together at some point.

--
Matthew Leverton




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/