void _HaltAllMusic(void) { int i; if ( mix_music_compat_channel.playing ) { Mix_HaltMusicCh(mix_music_compat_channel.music); } for ( i=0; i<num_channels; ++i ) { if ((mix_channel[i].is_music) && mix_channel[i].playing) Mix_HaltMusicCh(mix_channel[i].music); } }
/* Halt playing of a particular channel */ int Mix_HaltChannel(int which) { int i; if ( which == -1 ) { for ( i=0; i<num_channels; ++i ) { Mix_HaltChannel(i); } } else if ( which < num_channels ) { SDL_LockAudio(); if (mix_channel[which].playing) { if (mix_channel[which].is_music) Mix_HaltMusicCh(mix_channel[which].music); else _Mix_channel_done_playing(which); mix_channel[which].playing = 0; mix_channel[which].looping = 0; } mix_channel[which].expire = 0; if(mix_channel[which].fading != MIX_NO_FADING) /* Restore volume */ mix_channel[which].volume = mix_channel[which].fade_volume_reset; mix_channel[which].fading = MIX_NO_FADING; SDL_UnlockAudio(); } return(0); }
void ChannelInternalState::Halt() { if (IsStream()) { #ifdef PINDROP_MULTISTREAM Mix_HaltMusicCh(channel_id_); #else Mix_HaltMusic(); #endif // PINDROP_MULTISTREAM } else { Mix_HaltChannel(channel_id_); } }
void ChannelInternalState::RealChannelHalt() { assert(is_real()); // If this channel loops, we may want to resume it later. If this is a one // shot sound that does not loop, just halt it now. // TODO(amablue): What we really want is for one shot sounds to change to the // stopped state when the sound would have finished. However, SDL mixer does // not give good visibility into the length of loaded audio, which makes this // difficult. b/20697050 if (!SoundHandleLoops(handle_)) { channel_state_ = kChannelStateStopped; } if (IsStream()) { #ifdef PINDROP_MULTISTREAM Mix_HaltMusicCh(channel_id_); #else Mix_HaltMusic(); #endif // PINDROP_MULTISTREAM } else { Mix_HaltChannel(channel_id_); } }