summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mixer.cpp2
-rw-r--r--src/openttd.cpp2
-rw-r--r--src/sound/allegro_s.cpp1
-rw-r--r--src/sound/cocoa_s.cpp1
-rw-r--r--src/sound/sdl_s.cpp1
-rw-r--r--src/sound/win32_s.cpp2
6 files changed, 6 insertions, 3 deletions
diff --git a/src/mixer.cpp b/src/mixer.cpp
index 3a55b7fad..c6c5776da 100644
--- a/src/mixer.cpp
+++ b/src/mixer.cpp
@@ -26,7 +26,7 @@ struct MixerChannel {
};
static MixerChannel _channels[8];
-static uint32 _play_rate;
+static uint32 _play_rate = 11025;
/**
* The theoretical maximum volume for a single sound sample. Multiple sound
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 6f2cc4814..962a05143 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -18,7 +18,6 @@
#include "fontcache.h"
#include "gfxinit.h"
#include "gui.h"
-#include "mixer.h"
#include "sound_func.h"
#include "window_func.h"
@@ -584,7 +583,6 @@ int ttd_main(int argc, char *argv[])
/* Sample catalogue */
DEBUG(misc, 1, "Loading sound effects...");
- MxInitialize(11025);
SoundInitialize("sample.cat");
/* Initialize FreeType */
diff --git a/src/sound/allegro_s.cpp b/src/sound/allegro_s.cpp
index 069e473e5..a94f6d238 100644
--- a/src/sound/allegro_s.cpp
+++ b/src/sound/allegro_s.cpp
@@ -58,6 +58,7 @@ const char *SoundDriver_Allegro::Start(const char * const *parm)
}
_stream = play_audio_stream(BUFFER_SIZE, 16, true, 11025, 255, 128);
+ MxInitialize(11025);
return NULL;
}
diff --git a/src/sound/cocoa_s.cpp b/src/sound/cocoa_s.cpp
index 7e315fb75..851136efa 100644
--- a/src/sound/cocoa_s.cpp
+++ b/src/sound/cocoa_s.cpp
@@ -69,6 +69,7 @@ const char *SoundDriver_Cocoa::Start(const char * const *parm)
requestedDesc.mBytesPerFrame = requestedDesc.mBitsPerChannel * requestedDesc.mChannelsPerFrame / 8;
requestedDesc.mBytesPerPacket = requestedDesc.mBytesPerFrame * requestedDesc.mFramesPerPacket;
+ MxInitialize(requestedDesc.mSampleRate);
/* Locate the default output audio unit */
desc.componentType = kAudioUnitType_Output;
diff --git a/src/sound/sdl_s.cpp b/src/sound/sdl_s.cpp
index d111ac8ed..7c89331f7 100644
--- a/src/sound/sdl_s.cpp
+++ b/src/sound/sdl_s.cpp
@@ -30,6 +30,7 @@ const char *SoundDriver_SDL::Start(const char * const *parm)
spec.channels = 2;
spec.samples = 512;
spec.callback = fill_sound_buffer;
+ MxInitialize(spec.freq);
SDL_CALL SDL_OpenAudio(&spec, &spec);
SDL_CALL SDL_PauseAudio(0);
return NULL;
diff --git a/src/sound/win32_s.cpp b/src/sound/win32_s.cpp
index 3a5419495..776158adf 100644
--- a/src/sound/win32_s.cpp
+++ b/src/sound/win32_s.cpp
@@ -65,6 +65,8 @@ const char *SoundDriver_Win32::Start(const char * const *parm)
if (waveOutOpen(&_waveout, WAVE_MAPPER, &wfex, (DWORD_PTR)&waveOutProc, 0, CALLBACK_FUNCTION) != MMSYSERR_NOERROR)
return "waveOutOpen failed";
+ MxInitialize(wfex.nSamplesPerSec);
+
PrepareHeader(&_wave_hdr[0]);
PrepareHeader(&_wave_hdr[1]);
FillHeaders();