# HG changeset patch # User Eric Wing # Date 1288529384 25200 # Node ID c808684660a760740fee6e9345ef05796b11d59f # Parent c8282222421c1a7e3dbf4bd7ee18bbc0ea898f47 Bug fix: Moved Invoke_Callback before CleanChannel because I was trying to get the ALmixer_Data pointer, but it was cleared: Behavior change: Decided to make finishedNaturally return false if ending was due to expired ticks. diff -r c8282222421c -r c808684660a7 ALmixer.c --- a/ALmixer.c Thu Oct 28 02:43:50 2010 -0700 +++ b/ALmixer.c Sun Oct 31 05:49:44 2010 -0700 @@ -1751,10 +1751,11 @@ ALmixer_Channel_List[channel].almixer_data->num_buffers_in_use = 0; + /* Launch callback for consistency? */ + Invoke_Channel_Done_Callback(channel, did_finish_naturally); + Clean_Channel(channel); Is_Playing_global--; - /* Launch callback for consistency? */ - Invoke_Channel_Done_Callback(channel, did_finish_naturally); counter++; } } @@ -1830,10 +1831,11 @@ ALmixer_Channel_List[i].almixer_data->num_buffers_in_use = 0; + /* Launch callback for consistency? */ + Invoke_Channel_Done_Callback(i, did_finish_naturally); + Clean_Channel(i); Is_Playing_global--; - /* Launch callback for consistency? */ - Invoke_Channel_Done_Callback(i, did_finish_naturally); /* Increment the counter */ counter++; @@ -3369,7 +3371,7 @@ */ if(0 == ticks) { - return Internal_HaltChannel(channel, AL_TRUE); + return Internal_HaltChannel(channel, AL_FALSE); } @@ -4208,7 +4210,7 @@ */ if(0 == ticks) { - return Internal_HaltChannel(channel, AL_TRUE); + return Internal_HaltChannel(channel, AL_FALSE); } if(ticks < -1) { @@ -4608,7 +4610,7 @@ && (state != AL_PAUSED) ) { /* Stop the playback */ - Internal_HaltChannel(i, AL_TRUE); + Internal_HaltChannel(i, AL_FALSE); if((error = alGetError()) != AL_NO_ERROR) { fprintf(stderr, "07Testing errpr before unqueue because getting stuff, for OS X this is expected: %s\n", @@ -4877,12 +4879,13 @@ } + /* Launch callback */ + Invoke_Channel_Done_Callback(i, AL_TRUE); + Clean_Channel(i); /* Subtract counter */ Is_Playing_global--; - /* Launch callback */ - Invoke_Channel_Done_Callback(i, AL_TRUE); /* We're done for this loop. * Go to next channel @@ -5809,13 +5812,16 @@ * Loop if necessary, or launch callback * and clear channel (or clear channel and * then launch callback?) + * Update: Need to do callback first because I reference the mixer_data and source */ + + /* Launch callback */ + Invoke_Channel_Done_Callback(i, AL_TRUE); + Clean_Channel(i); /* Subtract counter */ Is_Playing_global--; - /* Launch callback */ - Invoke_Channel_Done_Callback(i, AL_TRUE); /* We're done for this loop. * Go to next channel