Re: [AD] audio recording

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


On Sat, Jan 7, 2012 at 8:07 AM, Elias Pschernig <allefant@xxxxxxxxxx> wrote:
> keycode = ALLEGRO_KEYBOARD_EVENT(event).keycode;
>
That might be the best way. The main disadvantage that I see is it
gets a little confusing having:

ALLEGRO_EVENT_FOO (enum) and ALLEGRO_FOO_EVENT (struct)

Obviously the enumerations are going to be slightly more verbose than
the struct name, but the placement of the EVENT portion still feels
arbitrary.

It could just be written as a function:

ALLEGRO_AUDIO_EVENT *audio = al_get_audio_event(&e);
memcpy(foo, audio->buffer, audio->buffer_len);

Compilers should optimize it away to nothing, I would think. In debug
mode, it could assert that the type is correct.

The same sort of thing could be added for the first class events,
although I'd probably still just use event.keyboard.keycode out of
convenience.

--
Matthew Leverton




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