| version 1.9 | | version 1.10 |
|---|
| | |
| return 0; | | return 0; |
| } | | } |
| IDirectSoundBuffer_Release(SoundSlots[slot].lpsb); | | IDirectSoundBuffer_Release(SoundSlots[slot].lpsb); |
| SoundSlots[slot].playing = 0; | | |
| SoundSlots[slot].lpsb = NULL; | | SoundSlots[slot].lpsb = NULL; |
| return 1; | | |
| } | | } |
| return 0; | | SoundSlots[slot].playing = 0; |
| | | return 1; |
| } | | } |
| | | |
| static int get_free_slot() | | static int get_free_slot() |
| | |
| int i; | | int i; |
| for (i=0; i<MAX_SOUND_SLOTS; i++) | | for (i=0; i<MAX_SOUND_SLOTS; i++) |
| { | | { |
| if (!SoundSlots[i].playing) return i; | | |
| if (DS_release_slot(i,0)) | | if (DS_release_slot(i,0)) |
| return i; | | return i; |
| } | | } |
| | |
| goto TryNextChannel; | | goto TryNextChannel; |
| } | | } |
| //mprintf(( 0, "[SS:%d]", next_handle )); | | //mprintf(( 0, "[SS:%d]", next_handle )); |
| SoundSlots[SampleHandles[next_handle]].playing = 0; | | |
| DS_release_slot(SampleHandles[next_handle],1); | | DS_release_slot(SampleHandles[next_handle],1); |
| SampleHandles[next_handle] = -1; | | SampleHandles[next_handle] = -1; |
| } | | } |
| | |
| for (i=0; i < MAX_SOUND_SLOTS; i++) | | for (i=0; i < MAX_SOUND_SLOTS; i++) |
| if (SoundSlots[i].soundno == soundno) | | if (SoundSlots[i].soundno == soundno) |
| { | | { |
| SoundSlots[i].playing = 0; | | |
| DS_release_slot(i,1); | | DS_release_slot(i,1); |
| } | | } |
| | | |
| | |
| { | | { |
| if ( SoundObjects[i].flags & SOF_PLAYING ) | | if ( SoundObjects[i].flags & SOF_PLAYING ) |
| { | | { |
| SoundSlots[SoundObjects[i].handle].playing = 0; | | |
| DS_release_slot(SoundObjects[i].handle,1); | | DS_release_slot(SoundObjects[i].handle,1); |
| } | | } |
| SoundObjects[i].flags = 0; // Mark as dead, so some other sound can use this sound | | SoundObjects[i].flags = 0; // Mark as dead, so some other sound can use this sound |
| | |
| if ( (SoundObjects[i].flags & SOF_USED) && (SoundObjects[i].flags & SOF_LINK_TO_OBJ ) ) { | | if ( (SoundObjects[i].flags & SOF_USED) && (SoundObjects[i].flags & SOF_LINK_TO_OBJ ) ) { |
| if (SoundObjects[i].lo_objnum == objnum) { | | if (SoundObjects[i].lo_objnum == objnum) { |
| if ( SoundObjects[i].flags & SOF_PLAYING ) { | | if ( SoundObjects[i].flags & SOF_PLAYING ) { |
| SoundSlots[SoundObjects[i].handle].playing = 0; | | |
| DS_release_slot(SoundObjects[i].handle,1); | | DS_release_slot(SoundObjects[i].handle,1); |
| } | | } |
| SoundObjects[i].flags = 0; // Mark as dead, so some other sound can use this sound | | SoundObjects[i].flags = 0; // Mark as dead, so some other sound can use this sound |
| | |
| if ((objp->type==OBJ_NONE) || (objp->signature!=SoundObjects[i].lo_objsignature)) { | | if ((objp->type==OBJ_NONE) || (objp->signature!=SoundObjects[i].lo_objsignature)) { |
| // The object that this is linked to is dead, so just end this sound if it is looping. | | // The object that this is linked to is dead, so just end this sound if it is looping. |
| if ( (SoundObjects[i].flags & SOF_PLAYING) && (SoundObjects[i].flags & SOF_PLAY_FOREVER)) { | | if ( (SoundObjects[i].flags & SOF_PLAYING) && (SoundObjects[i].flags & SOF_PLAY_FOREVER)) { |
| SoundSlots[SoundObjects[i].handle].playing = 0; | | |
| DS_release_slot(SoundObjects[i].handle,1); | | DS_release_slot(SoundObjects[i].handle,1); |
| } | | } |
| SoundObjects[i].flags = 0; // Mark as dead, so some other sound can use this sound | | SoundObjects[i].flags = 0; // Mark as dead, so some other sound can use this sound |
| | |
| if ( SoundObjects[i].volume < MIN_VOLUME ) { | | if ( SoundObjects[i].volume < MIN_VOLUME ) { |
| // Sound is too far away, so stop it from playing. | | // Sound is too far away, so stop it from playing. |
| if ((SoundObjects[i].flags & SOF_PLAYING)&&(SoundObjects[i].flags & SOF_PLAY_FOREVER)) { | | if ((SoundObjects[i].flags & SOF_PLAYING)&&(SoundObjects[i].flags & SOF_PLAY_FOREVER)) { |
| SoundSlots[SoundObjects[i].handle].playing = 0; | | |
| DS_release_slot(SoundObjects[i].handle,1); | | DS_release_slot(SoundObjects[i].handle,1); |
| SoundObjects[i].flags &= ~SOF_PLAYING; // Mark sound as not playing | | SoundObjects[i].flags &= ~SOF_PLAYING; // Mark sound as not playing |
| } | | } |
| | |
| for (i=0; i<MAX_SOUND_OBJECTS; i++ ) { | | for (i=0; i<MAX_SOUND_OBJECTS; i++ ) { |
| if (digi_sounds_initialized) { | | if (digi_sounds_initialized) { |
| if ( SoundObjects[i].flags & SOF_PLAYING ) { | | if ( SoundObjects[i].flags & SOF_PLAYING ) { |
| SoundSlots[SoundObjects[i].handle].playing=0; | | |
| DS_release_slot(SoundObjects[i].handle,1); | | DS_release_slot(SoundObjects[i].handle,1); |
| } | | } |
| } | | } |
| | |
| int i; | | int i; |
| | | |
| for (i=0; i< MAX_SOUND_SLOTS; i++) { | | for (i=0; i< MAX_SOUND_SLOTS; i++) { |
| SoundSlots[i].playing=0; | | |
| DS_release_slot(i,1); | | DS_release_slot(i,1); |
| } | | } |
| | | |