summaryrefslogtreecommitdiff
path: root/src/sound
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2007-02-12 21:55:10 +0000
committerDarkvater <darkvater@openttd.org>2007-02-12 21:55:10 +0000
commit4d4c1e05053b18a4fe3f1645567abf947b5fee0d (patch)
tree0f33d24a48c6bc70726b21200657287d3e9ba408 /src/sound
parent2817acb4566ff30805990c4508c2e382b4745f35 (diff)
downloadopenttd-4d4c1e05053b18a4fe3f1645567abf947b5fee0d.tar.xz
(svn r8691) -Cleanup: Some proper #endif comments for sound/music/video files, and a little elimination of magic numbers in Win32SoundStart
Diffstat (limited to 'src/sound')
-rw-r--r--src/sound/null_s.cpp1
-rw-r--r--src/sound/null_s.h2
-rw-r--r--src/sound/sdl_s.cpp2
-rw-r--r--src/sound/sdl_s.h2
-rw-r--r--src/sound/win32_s.cpp20
5 files changed, 12 insertions, 15 deletions
diff --git a/src/sound/null_s.cpp b/src/sound/null_s.cpp
index f68c4b13a..e2c5ce2d8 100644
--- a/src/sound/null_s.cpp
+++ b/src/sound/null_s.cpp
@@ -1,7 +1,6 @@
/* $Id$ */
#include "../stdafx.h"
-#include "../openttd.h"
#include "null_s.h"
static const char *NullSoundStart(const char * const *parm) { return NULL; }
diff --git a/src/sound/null_s.h b/src/sound/null_s.h
index 6ccd19aed..204c58376 100644
--- a/src/sound/null_s.h
+++ b/src/sound/null_s.h
@@ -7,4 +7,4 @@
extern const HalSoundDriver _null_sound_driver;
-#endif
+#endif /* SOUND_NULL_H */
diff --git a/src/sound/sdl_s.cpp b/src/sound/sdl_s.cpp
index 4b1da52d6..8ec31e9fb 100644
--- a/src/sound/sdl_s.cpp
+++ b/src/sound/sdl_s.cpp
@@ -44,4 +44,4 @@ const HalSoundDriver _sdl_sound_driver = {
SdlSoundStop,
};
-#endif
+#endif /* WITH_SDL */
diff --git a/src/sound/sdl_s.h b/src/sound/sdl_s.h
index 6fc2b6dc0..a667e137a 100644
--- a/src/sound/sdl_s.h
+++ b/src/sound/sdl_s.h
@@ -7,4 +7,4 @@
extern const HalSoundDriver _sdl_sound_driver;
-#endif
+#endif /* SOUND_SDL_H */
diff --git a/src/sound/win32_s.cpp b/src/sound/win32_s.cpp
index 68194ad39..77d688eb4 100644
--- a/src/sound/win32_s.cpp
+++ b/src/sound/win32_s.cpp
@@ -42,29 +42,27 @@ static void CALLBACK waveOutProc(HWAVEOUT hwo, UINT uMsg, DWORD_PTR dwInstance,
{
switch (uMsg) {
case WOM_DONE:
- if (_waveout) FillHeaders();
- break;
-
- default:
+ if (_waveout != NULL) FillHeaders();
break;
+ default: break;
}
}
static const char *Win32SoundStart(const char* const* parm)
{
WAVEFORMATEX wfex;
- int hz;
-
- _bufsize = GetDriverParamInt(parm, "bufsize", 1024);
- hz = GetDriverParamInt(parm, "hz", 11025);
wfex.wFormatTag = WAVE_FORMAT_PCM;
wfex.nChannels = 2;
- wfex.nSamplesPerSec = hz;
- wfex.nAvgBytesPerSec = hz * 2 * 2;
- wfex.nBlockAlign = 4;
wfex.wBitsPerSample = 16;
+ wfex.nSamplesPerSec = GetDriverParamInt(parm, "hz", 11025);
+ wfex.nBlockAlign = (wfex.nChannels * wfex.wBitsPerSample) / 8;
+ wfex.nAvgBytesPerSec = wfex.nSamplesPerSec * wfex.nBlockAlign;
+
+ _bufsize = GetDriverParamInt(parm, "bufsize", 1024);
+
if (waveOutOpen(&_waveout, WAVE_MAPPER, &wfex, (DWORD_PTR)&waveOutProc, 0, CALLBACK_FUNCTION) != MMSYSERR_NOERROR)
return "waveOutOpen failed";
+
PrepareHeader(&_wave_hdr[0]);
PrepareHeader(&_wave_hdr[1]);
FillHeaders();