mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-06 14:25:24 +00:00
(svn r8691) -Cleanup: Some proper #endif comments for sound/music/video files, and a little elimination of magic numbers in Win32SoundStart
This commit is contained in:
parent
2817acb456
commit
4d4c1e0505
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
#ifdef WIN32_ENABLE_DIRECTMUSIC_SUPPORT
|
#ifdef WIN32_ENABLE_DIRECTMUSIC_SUPPORT
|
||||||
|
|
||||||
#include "../openttd.h"
|
|
||||||
#include "../debug.h"
|
#include "../debug.h"
|
||||||
#include "../win32.h"
|
#include "../win32.h"
|
||||||
#include "dmusic.h"
|
#include "dmusic.h"
|
||||||
@ -218,7 +217,7 @@ static void DMusicMidiSetVolume(byte vol)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extern "C" const HalMusicDriver _dmusic_midi_driver = {
|
const HalMusicDriver _dmusic_midi_driver = {
|
||||||
DMusicMidiStart,
|
DMusicMidiStart,
|
||||||
DMusicMidiStop,
|
DMusicMidiStop,
|
||||||
DMusicMidiPlaySong,
|
DMusicMidiPlaySong,
|
||||||
@ -227,4 +226,4 @@ extern "C" const HalMusicDriver _dmusic_midi_driver = {
|
|||||||
DMusicMidiSetVolume,
|
DMusicMidiSetVolume,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif /* WIN32_ENABLE_DIRECTMUSIC_SUPPORT */
|
||||||
|
@ -7,4 +7,4 @@
|
|||||||
|
|
||||||
extern const HalMusicDriver _dmusic_midi_driver;
|
extern const HalMusicDriver _dmusic_midi_driver;
|
||||||
|
|
||||||
#endif
|
#endif /* MUSIC_DMUSIC_H */
|
||||||
|
@ -7,4 +7,4 @@
|
|||||||
|
|
||||||
extern const HalMusicDriver _null_music_driver;
|
extern const HalMusicDriver _null_music_driver;
|
||||||
|
|
||||||
#endif
|
#endif /* MUSIC_NULL_H */
|
||||||
|
@ -7,4 +7,4 @@
|
|||||||
|
|
||||||
extern const HalMusicDriver _win32_music_driver;
|
extern const HalMusicDriver _win32_music_driver;
|
||||||
|
|
||||||
#endif
|
#endif /* MUSIC_WIN32_H */
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|
||||||
#include "../stdafx.h"
|
#include "../stdafx.h"
|
||||||
#include "../openttd.h"
|
|
||||||
#include "null_s.h"
|
#include "null_s.h"
|
||||||
|
|
||||||
static const char *NullSoundStart(const char * const *parm) { return NULL; }
|
static const char *NullSoundStart(const char * const *parm) { return NULL; }
|
||||||
|
@ -7,4 +7,4 @@
|
|||||||
|
|
||||||
extern const HalSoundDriver _null_sound_driver;
|
extern const HalSoundDriver _null_sound_driver;
|
||||||
|
|
||||||
#endif
|
#endif /* SOUND_NULL_H */
|
||||||
|
@ -44,4 +44,4 @@ const HalSoundDriver _sdl_sound_driver = {
|
|||||||
SdlSoundStop,
|
SdlSoundStop,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif /* WITH_SDL */
|
||||||
|
@ -7,4 +7,4 @@
|
|||||||
|
|
||||||
extern const HalSoundDriver _sdl_sound_driver;
|
extern const HalSoundDriver _sdl_sound_driver;
|
||||||
|
|
||||||
#endif
|
#endif /* SOUND_SDL_H */
|
||||||
|
@ -42,29 +42,27 @@ static void CALLBACK waveOutProc(HWAVEOUT hwo, UINT uMsg, DWORD_PTR dwInstance,
|
|||||||
{
|
{
|
||||||
switch (uMsg) {
|
switch (uMsg) {
|
||||||
case WOM_DONE:
|
case WOM_DONE:
|
||||||
if (_waveout) FillHeaders();
|
if (_waveout != NULL) FillHeaders();
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
break;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *Win32SoundStart(const char* const* parm)
|
static const char *Win32SoundStart(const char* const* parm)
|
||||||
{
|
{
|
||||||
WAVEFORMATEX wfex;
|
WAVEFORMATEX wfex;
|
||||||
int hz;
|
|
||||||
|
|
||||||
_bufsize = GetDriverParamInt(parm, "bufsize", 1024);
|
|
||||||
hz = GetDriverParamInt(parm, "hz", 11025);
|
|
||||||
wfex.wFormatTag = WAVE_FORMAT_PCM;
|
wfex.wFormatTag = WAVE_FORMAT_PCM;
|
||||||
wfex.nChannels = 2;
|
wfex.nChannels = 2;
|
||||||
wfex.nSamplesPerSec = hz;
|
|
||||||
wfex.nAvgBytesPerSec = hz * 2 * 2;
|
|
||||||
wfex.nBlockAlign = 4;
|
|
||||||
wfex.wBitsPerSample = 16;
|
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)
|
if (waveOutOpen(&_waveout, WAVE_MAPPER, &wfex, (DWORD_PTR)&waveOutProc, 0, CALLBACK_FUNCTION) != MMSYSERR_NOERROR)
|
||||||
return "waveOutOpen failed";
|
return "waveOutOpen failed";
|
||||||
|
|
||||||
PrepareHeader(&_wave_hdr[0]);
|
PrepareHeader(&_wave_hdr[0]);
|
||||||
PrepareHeader(&_wave_hdr[1]);
|
PrepareHeader(&_wave_hdr[1]);
|
||||||
FillHeaders();
|
FillHeaders();
|
||||||
|
@ -7,4 +7,4 @@
|
|||||||
|
|
||||||
extern const HalVideoDriver _dedicated_video_driver;
|
extern const HalVideoDriver _dedicated_video_driver;
|
||||||
|
|
||||||
#endif
|
#endif /* VIDEO_DEDICATED_H */
|
||||||
|
@ -7,4 +7,4 @@
|
|||||||
|
|
||||||
extern const HalVideoDriver _null_video_driver;
|
extern const HalVideoDriver _null_video_driver;
|
||||||
|
|
||||||
#endif
|
#endif /* VIDEO_NULL_H */
|
||||||
|
@ -510,4 +510,4 @@ const HalVideoDriver _sdl_video_driver = {
|
|||||||
SdlVideoFullScreen,
|
SdlVideoFullScreen,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif /* WITH_SDL */
|
||||||
|
@ -7,4 +7,4 @@
|
|||||||
|
|
||||||
extern const HalVideoDriver _sdl_video_driver;
|
extern const HalVideoDriver _sdl_video_driver;
|
||||||
|
|
||||||
#endif
|
#endif /* VIDEO_SDL_H */
|
||||||
|
@ -7,4 +7,4 @@
|
|||||||
|
|
||||||
extern const HalVideoDriver _win32_video_driver;
|
extern const HalVideoDriver _win32_video_driver;
|
||||||
|
|
||||||
#endif
|
#endif /* VIDEO_WIN32_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user