Mercurial > hg > openttd
changeset 5988:067aeca4413d draft
(svn r8691) -Cleanup: Some proper #endif comments for sound/music/video files, and a little elimination of magic numbers in Win32SoundStart
author | Darkvater <Darkvater@openttd.org> |
---|---|
date | Mon, 12 Feb 2007 21:55:10 +0000 |
parents | 7622c33a48f8 |
children | 1574a7d8de14 |
files | src/music/dmusic.cpp src/music/dmusic.h src/music/null_m.h src/music/win32_m.h src/sound/null_s.cpp src/sound/null_s.h src/sound/sdl_s.cpp src/sound/sdl_s.h src/sound/win32_s.cpp src/video/dedicated_v.h src/video/null_v.h src/video/sdl_v.cpp src/video/sdl_v.h src/video/win32_v.h |
diffstat | 14 files changed, 22 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/src/music/dmusic.cpp +++ b/src/music/dmusic.cpp @@ -4,7 +4,6 @@ #ifdef WIN32_ENABLE_DIRECTMUSIC_SUPPORT -#include "../openttd.h" #include "../debug.h" #include "../win32.h" #include "dmusic.h" @@ -218,7 +217,7 @@ } -extern "C" const HalMusicDriver _dmusic_midi_driver = { +const HalMusicDriver _dmusic_midi_driver = { DMusicMidiStart, DMusicMidiStop, DMusicMidiPlaySong, @@ -227,4 +226,4 @@ DMusicMidiSetVolume, }; -#endif +#endif /* WIN32_ENABLE_DIRECTMUSIC_SUPPORT */
--- a/src/music/dmusic.h +++ b/src/music/dmusic.h @@ -7,4 +7,4 @@ extern const HalMusicDriver _dmusic_midi_driver; -#endif +#endif /* MUSIC_DMUSIC_H */
--- a/src/music/null_m.h +++ b/src/music/null_m.h @@ -7,4 +7,4 @@ extern const HalMusicDriver _null_music_driver; -#endif +#endif /* MUSIC_NULL_H */
--- a/src/music/win32_m.h +++ b/src/music/win32_m.h @@ -7,4 +7,4 @@ extern const HalMusicDriver _win32_music_driver; -#endif +#endif /* MUSIC_WIN32_H */
--- 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; }
--- 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 */
--- a/src/sound/sdl_s.cpp +++ b/src/sound/sdl_s.cpp @@ -44,4 +44,4 @@ SdlSoundStop, }; -#endif +#endif /* WITH_SDL */
--- 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 */
--- a/src/sound/win32_s.cpp +++ b/src/sound/win32_s.cpp @@ -42,29 +42,27 @@ { switch (uMsg) { case WOM_DONE: - if (_waveout) FillHeaders(); + if (_waveout != NULL) FillHeaders(); break; - - default: - 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();
--- a/src/video/dedicated_v.h +++ b/src/video/dedicated_v.h @@ -7,4 +7,4 @@ extern const HalVideoDriver _dedicated_video_driver; -#endif +#endif /* VIDEO_DEDICATED_H */
--- a/src/video/null_v.h +++ b/src/video/null_v.h @@ -7,4 +7,4 @@ extern const HalVideoDriver _null_video_driver; -#endif +#endif /* VIDEO_NULL_H */
--- a/src/video/sdl_v.cpp +++ b/src/video/sdl_v.cpp @@ -510,4 +510,4 @@ SdlVideoFullScreen, }; -#endif +#endif /* WITH_SDL */