--- np2/win9x/soundmng.cpp 2003/10/30 12:45:38 1.4 +++ np2/win9x/soundmng.cpp 2005/02/16 09:31:55 1.10 @@ -6,6 +6,7 @@ #include "soundmng.h" #include "extromio.h" #include "sound.h" +#include "juliet.h" #if defined(VERMOUTH_LIB) #include "vermouth.h" #endif @@ -36,7 +37,7 @@ void __fastcall satuation_s16mmx(SINT16 static LPDIRECTSOUND pDSound; static LPDIRECTSOUNDBUFFER pDSData3; static UINT dsstreambytes; -static BYTE dsstreamevent; +static UINT8 dsstreamevent; static LPDIRECTSOUNDBUFFER pDSwave3[SOUND_MAXPCM]; static UINT mute; static void (PARTSCALL *fnmix)(SINT16 *dst, @@ -49,7 +50,7 @@ static void (PARTSCALL *fnmix)(SINT16 // ---- directsound -static BOOL dsoundcreate(void) { +static BRESULT dsoundcreate(void) { // DirectSoundの初期化 if (FAILED(DirectSoundCreate(0, &pDSound, 0))) { @@ -74,23 +75,20 @@ UINT soundmng_create(UINT rate, UINT ms) UINT samples; DSBUFFERDESC dsbdesc; PCMWAVEFORMAT pcmwf; -#if defined(VERMOUTH_LIB) - UINT num; -#endif if ((pDSound == NULL) || (rate != 11025) && (rate != 22050) && (rate != 44100)) { goto stcre_err1; } - if (ms < 50) { - ms = 50; + if (ms < 40) { + ms = 40; } else if (ms > 1000) { ms = 1000; } // キーボード表示のディレイ設定 -// keydispr_delayinit((BYTE)((ms * 10 + 563) / 564)); +// keydispr_delayinit((UINT8)((ms * 10 + 563) / 564)); samples = (rate * ms) / 2000; samples = (samples + 3) & (~3); @@ -118,12 +116,9 @@ UINT soundmng_create(UINT rate, UINT ms) #if defined(VERMOUTH_LIB) vermouth_module = midimod_create(rate); - for (num=0; num<128; num++) { - midimod_loadprogram(vermouth_module, num); - midimod_loadrhythm(vermouth_module, num); - } + midimod_loadall(vermouth_module); #endif - dsstreamevent = (BYTE)-1; + dsstreamevent = (UINT8)-1; soundmng_reset(); return(samples); @@ -151,7 +146,7 @@ void soundmng_reset(void) { } pDSData3->Unlock(blockptr1, blocksize1, blockptr2, blocksize2); pDSData3->SetCurrentPosition(0); - dsstreamevent = (BYTE)-1; + dsstreamevent = (UINT8)-1; } } @@ -178,6 +173,7 @@ static void streamenable(BOOL play) { pDSData3->Stop(); } } + juliet_YMF288Enable(play); } void soundmng_play(void) { @@ -301,7 +297,7 @@ static void pcmstop(void) { } } -void soundmng_pcmload(UINT num, const char *filename, UINT type) { +void soundmng_pcmload(UINT num, const OEMCHAR *filename, UINT type) { EXTROMH erh; RIFF_HEADER riff; @@ -412,7 +408,7 @@ void soundmng_pcmvolume(UINT num, int vo } } -BOOL soundmng_pcmplay(UINT num, BOOL loop) { +BRESULT soundmng_pcmplay(UINT num, BOOL loop) { LPDIRECTSOUNDBUFFER dsbuf; @@ -442,7 +438,7 @@ void soundmng_pcmstop(UINT num) { // ---- -BOOL soundmng_initialize(void) { +BRESULT soundmng_initialize(void) { if (dsoundcreate() != SUCCESS) { goto smcre_err;