1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-18 12:33:17 +01:00
This commit is contained in:
zsilencer
2015-07-14 16:38:56 -06:00
parent 689f7c9f1d
commit ca6c3d68aa
7 changed files with 24 additions and 27 deletions

View File

@@ -39,6 +39,7 @@ rct_ride_music_params gRideMusicParamsList[AUDIO_MAX_RIDE_MUSIC];
rct_ride_music_params *gRideMusicParamsListEnd;
void *gCrowdSoundChannel = 0;
void *gTitleMusicChannel = 0;
bool gGameSoundsOff = false;
void audio_init(int i)
{
@@ -1423,7 +1424,7 @@ int get_dsound_devices()
int sound_play_panned(int sound_id, int ebx, sint16 x, sint16 y, sint16 z)
{
int result = 0;
if (RCT2_GLOBAL(0x009AF59D, uint8) & 1) {
if (gConfigSound.sound) {
RCT2_GLOBAL(0x00F438AD, uint8) = 0;
int volume = 0;
if (ebx == 0x8001) {
@@ -1557,7 +1558,7 @@ void start_title_music()
break;
}
if ((RCT2_GLOBAL(0x009AF284, uint32) & (1 << 0)) && RCT2_GLOBAL(0x009AF59D, uint8) & 1
if ((RCT2_GLOBAL(0x009AF284, uint32) & (1 << 0)) && gConfigSound.sound
&& RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TITLE_DEMO) {
if (!RCT2_GLOBAL(0x009AF600, uint8)) {
#ifdef USE_MIXER
@@ -1809,13 +1810,11 @@ void audio_close()
/* rct2: 0x006BAB8A */
void toggle_all_sounds(){
// When all sound code is reversed replace with gConfigSound.sound
RCT2_GLOBAL(0x009AF59D, uint8) ^= 1;
if (RCT2_GLOBAL(0x009AF59D, uint8) == 0) {
gConfigSound.sound = !gConfigSound.sound;
if (!gConfigSound.sound) {
stop_title_music();
pause_sounds();
}
else{
} else {
unpause_sounds();
}
}
@@ -1826,15 +1825,11 @@ void toggle_all_sounds(){
*/
void pause_sounds()
{
// When all sound code is reversed replace with gConfigSound.sound
RCT2_GLOBAL(0x009AF59C, uint8) = 1;
if (RCT2_GLOBAL(0x009AF59C, uint8) == 1) {
stop_other_sounds();
stop_vehicle_sounds();
stop_ride_music();
stop_crowd_sound();
}
gConfigSound.sound = 0;
gGameSoundsOff = 1;
stop_other_sounds();
stop_vehicle_sounds();
stop_ride_music();
stop_crowd_sound();
}
/**
@@ -1843,9 +1838,7 @@ void pause_sounds()
*/
void unpause_sounds()
{
// When all sound code is reversed replace with gConfigSound.sound
RCT2_GLOBAL(0x009AF59C, uint8) = 0;
gConfigSound.sound = 1;
gGameSoundsOff = 0;
}
/**

View File

@@ -156,6 +156,7 @@ extern rct_ride_music_params gRideMusicParamsList[AUDIO_MAX_RIDE_MUSIC];
extern rct_ride_music_params *gRideMusicParamsListEnd;
extern void *gCrowdSoundChannel;
extern void *gTitleMusicChannel;
extern bool gGameSoundsOff;
void audio_timefunc(UINT uTimerID, UINT uMsg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2, int channel);
int CALLBACK audio_timer_callback(UINT uTimerID, UINT uMsg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2);

View File

@@ -568,7 +568,7 @@ void SDLCALL Mixer::Callback(void* arg, uint8* stream, int length)
void Mixer::MixChannel(Channel& channel, uint8* data, int length)
{
if (channel.source && channel.source->Length() > 0 && !channel.done) {
if (channel.source && channel.source->Length() > 0 && !channel.done && gConfigSound.sound) {
AudioFormat streamformat = channel.source->Format();
int loaded = 0;
SDL_AudioCVT cvt;