[AD] al_drain_audio_stream hangs when stream is not attached to mixer |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Something I discovered while playing with generating my own stream data.
Attached is a small example that consistently shows the problem.
A snippet that attaches the stream to a the default mixer is commented
out, if you uncomment it the program does not hang.
#include <stdio.h>
#include "allegro5/allegro5.h"
#include "allegro5/allegro_audio.h"
#define SAMPLES_PER_BUFFER 1024
int main(void)
{
ALLEGRO_AUDIO_STREAM *stream;
if (!al_init()) {
fprintf(stderr, "Could not init Allegro.\n");
return 1;
}
if (!al_install_audio(ALLEGRO_AUDIO_DRIVER_AUTODETECT)) {
fprintf(stderr, "Could not init sound.\n");
return 1;
}
al_reserve_samples(0);
stream = al_create_audio_stream(8, SAMPLES_PER_BUFFER, 22050,
ALLEGRO_AUDIO_DEPTH_UINT8, ALLEGRO_CHANNEL_CONF_1);
if (!stream) {
fprintf(stderr, "Could not create stream.\n");
return 1;
}
/* if (!al_attach_audio_stream_to_mixer(stream, al_get_default_mixer())) {
fprintf(stderr, "Could not attach stream to mixer.\n");
return 1;
}
*/
al_drain_audio_stream(stream);
al_destroy_audio_stream(stream);
al_uninstall_audio();
return 0;
}
END_OF_MAIN()
/* vim: set sts=3 sw=3 et: */