Changeset - r12350:654ff1f37bc4
[Not reviewed]
master
0 6 0
peter1138 - 15 years ago 2009-07-10 18:22:04
peter1138@openttd.org
(svn r16784) -Fix: Audio playback rate was fixed at 11025Hz regardless of the rate specified to the audio driver, resulting in incorrect playback speed. It is still preferable to use 11025Hz output rate if possible as OpenTTD's sample rate converter is very low quality.
6 files changed with 6 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/mixer.cpp
Show inline comments
 
@@ -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
src/openttd.cpp
Show inline comments
 
@@ -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 */
src/sound/allegro_s.cpp
Show inline comments
 
@@ -58,6 +58,7 @@ const char *SoundDriver_Allegro::Start(c
 
	}
 

	
 
	_stream = play_audio_stream(BUFFER_SIZE, 16, true, 11025, 255, 128);
 
	MxInitialize(11025);
 
	return NULL;
 
}
 

	
src/sound/cocoa_s.cpp
Show inline comments
 
@@ -69,6 +69,7 @@ const char *SoundDriver_Cocoa::Start(con
 
	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;
src/sound/sdl_s.cpp
Show inline comments
 
@@ -30,6 +30,7 @@ const char *SoundDriver_SDL::Start(const
 
	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;
src/sound/win32_s.cpp
Show inline comments
 
@@ -65,6 +65,8 @@ const char *SoundDriver_Win32::Start(con
 
	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();
0 comments (0 inline, 0 general)