|
|
| version 1.13, 2007/01/08 01:16:59 | version 1.17, 2011/03/07 09:54:11 |
|---|---|
| Line 1 | Line 1 |
| #include "compiler.h" | /** |
| #include <dsound.h> | * @file soundmng.cpp |
| #include "parts.h" | * @brief Sound Manager (DirectSound3) |
| #include "wavefile.h" | * |
| #include "np2.h" | * @author $Author$ |
| #include "soundmng.h" | * @date $Date$ |
| #include "extromio.h" | */ |
| #include "sound.h" | |
| #include "juliet.h" | #include "compiler.h" |
| #include <dsound.h> | |
| #include "parts.h" | |
| #include "wavefile.h" | |
| #include "np2.h" | |
| #include "soundmng.h" | |
| #include "extromio.h" | |
| #include "sound.h" | |
| #include "juliet.h" | |
| #if defined(VERMOUTH_LIB) | #if defined(VERMOUTH_LIB) |
| #include "vermouth.h" | #include "vermouth.h" |
| #endif | #endif |
| #if defined(MT32SOUND_DLL) | #if defined(MT32SOUND_DLL) |
| #include "mt32snd.h" | #include "mt32snd.h" |
| #endif | #endif |
| #if !defined(_WIN64) | #if !defined(__GNUC__) |
| #define SOUNDBUFFERALIGN (1 << 2) | #pragma comment(lib, "dsound.lib") |
| #else | #endif // !defined(__GNUC__) |
| #if defined(_M_IA64) || defined(_M_AMD64) | |
| #define SOUNDBUFFERALIGN (1 << 3) | #define SOUNDBUFFERALIGN (1 << 3) |
| #else | |
| #define SOUNDBUFFERALIGN (1 << 2) | |
| #endif | #endif |
| #if !defined(_WIN64) | #if !defined(_WIN64) |
| Line 61 static void (PARTSCALL *fnmix)(SINT16 | Line 73 static void (PARTSCALL *fnmix)(SINT16 |
| // ---- directsound | // ---- directsound |
| static BRESULT dsoundcreate(void) { | static BRESULT dsoundcreate(HWND hWnd) |
| { | |
| // DirectSoundの初期化 | // DirectSoundの初期化 |
| if (FAILED(DirectSoundCreate(0, &pDSound, 0))) { | if (FAILED(DirectSoundCreate(0, &pDSound, 0))) { |
| goto dscre_err; | goto dscre_err; |
| } | } |
| if (FAILED(pDSound->SetCooperativeLevel(hWndMain, DSSCL_PRIORITY))) { | if (FAILED(pDSound->SetCooperativeLevel(hWnd, DSSCL_PRIORITY))) |
| if (FAILED(pDSound->SetCooperativeLevel(hWndMain, DSSCL_NORMAL))) { | { |
| if (FAILED(pDSound->SetCooperativeLevel(hWnd, DSSCL_NORMAL))) | |
| { | |
| goto dscre_err; | goto dscre_err; |
| } | } |
| } | } |
| Line 92 UINT soundmng_create(UINT rate, UINT ms) | Line 106 UINT soundmng_create(UINT rate, UINT ms) |
| (rate != 11025) && (rate != 22050) && (rate != 44100)) { | (rate != 11025) && (rate != 22050) && (rate != 44100)) { |
| goto stcre_err1; | goto stcre_err1; |
| } | } |
| if (ms < 40) { | if (ms < 40) { |
| ms = 40; | ms = 40; |
| } | } |
| Line 135 UINT soundmng_create(UINT rate, UINT ms) | Line 150 UINT soundmng_create(UINT rate, UINT ms) |
| vermouth_module = midimod_create(rate); | vermouth_module = midimod_create(rate); |
| midimod_loadall(vermouth_module); | midimod_loadall(vermouth_module); |
| #endif | #endif |
| #if defined(MT32SOUND_DLL) | #if defined(MT32SOUND_DLL) |
| mt32sound_setrate(rate); | mt32sound_setrate(rate); |
| #endif | #endif |
| dsstreamevent = (UINT8)-1; | dsstreamevent = (UINT8)-1; |
| return(samples); | return(samples); |
| Line 466 void soundmng_pcmstop(UINT num) { | Line 483 void soundmng_pcmstop(UINT num) { |
| BRESULT soundmng_initialize(void) { | BRESULT soundmng_initialize(void) { |
| if (dsoundcreate() != SUCCESS) { | if (dsoundcreate(g_hWndMain) != SUCCESS) { |
| goto smcre_err; | goto smcre_err; |
| } | } |
| pcmcreate(); | pcmcreate(); |