You can successfully create sound sample instance with NULL sample, but when you try to play it, Allegro will hang in endless loop.
ALLEGRO_SAMPLE_INSTANCE *pInstance = al_create_sample_instance( 0 );
al_attach_sample_instance_to_mixer( pInstance, pMixer );
al_set_sample_instance_playmode( pInstance, ALLEGRO_PLAYMODE_LOOP );
al_play_sample_instance( pInstance );
The culprit is the following code in Audio addon (addons/audio/kcm_mixer.c):
case ALLEGRO_PLAYMODE_LOOP:
if (spl->step > 0) {
while (spl->pos >= spl->loop_end) {
spl->pos -= (spl->loop_end - spl->loop_start);
}
}
else if (spl->step < 0) {
while (spl->pos < spl->loop_start) {
spl->pos += (spl->loop_end - spl->loop_start);
}
}
return true;
The trouble is, if ( spl->loop_end == spl->loop_start ) this loop will never end.
So, at least a check of ( spl->loop_end > 0 ) would be welcome here.
Fixed in 8c8ffc8710d8c4e7c51abb23d50c950f68d8b0f5.
Thanks!