--- np2/sound/sound.c 2004/03/26 05:51:40 1.16 +++ np2/sound/sound.c 2011/01/15 18:04:43 1.22 @@ -68,7 +68,7 @@ static void streamprepare(UINT samples) #if defined(SUPPORT_WAVEREC) // ---- wave rec -BOOL sound_recstart(const char *filename) { +BOOL sound_recstart(const OEMCHAR *filename) { WAVEWR rec; @@ -98,7 +98,7 @@ static void streamfilewrite(UINT samples CBTBL *cb; UINT count; SINT32 buf32[2*512]; - BYTE buf[2*2*512]; + UINT8 buf[2*2*512]; UINT r; UINT i; SINT32 samp; @@ -126,8 +126,8 @@ static void streamfilewrite(UINT samples samp = -32768; } // little endianなので satuation_s16は使えない - buf[i*2+0] = (BYTE)samp; - buf[i*2+1] = (BYTE)(samp >> 8); + buf[i*2+0] = (UINT8)samp; + buf[i*2+1] = (UINT8)(samp >> 8); } wavewr_write(sndstream.rec, buf, count * 4); samples -= count; @@ -242,7 +242,7 @@ void sound_reset(void) { void sound_changeclock(void) { - UINT32 clock; + UINT32 clk; UINT hz; UINT hzmax; @@ -251,18 +251,19 @@ void sound_changeclock(void) { } // とりあえず 25で割り切れる。 - clock = pccore.realclock / 25; + clk = pccore.realclock / 25; hz = soundcfg.rate / 25; // で、クロック数に合せて調整。(64bit演算しろよな的) - hzmax = (1 << (32 - 8)) / (clock >> 8); + hzmax = (1 << (32 - 8)) / (clk >> 8); while(hzmax < hz) { - clock = (clock + 1) >> 1; + clk = (clk + 1) >> 1; hz = (hz + 1) >> 1; } + TRACEOUT(("hzbase/clockbase = %d/%d", hz, clk)); soundcfg.hzbase = hz; - soundcfg.clockbase = clock; - soundcfg.minclock = 2 * clock / hz; + soundcfg.clockbase = clk; + soundcfg.minclock = 2 * clk / hz; soundcfg.lastclock = CPU_CLOCK; } @@ -304,7 +305,7 @@ void sound_sync(void) { } else #endif - streamprepare(length); + streamprepare(length); soundcfg.lastclock += length * soundcfg.clockbase / soundcfg.hzbase; beep_eventreset(); SNDCSEC_LEAVE; @@ -371,10 +372,10 @@ void sound_pcmunlock(const SINT32 *hdl) // ---- pcmmix -BOOL pcmmix_regist(PMIXDAT *dat, void *datptr, UINT datsize, UINT rate) { +BRESULT pcmmix_regist(PMIXDAT *dat, void *datptr, UINT datsize, UINT rate) { GETSND gs; - BYTE tmp[256]; + UINT8 tmp[256]; UINT size; UINT r; SINT16 *buf; @@ -420,12 +421,12 @@ pmr_err1: return(FAILURE); } -BOOL pcmmix_regfile(PMIXDAT *dat, const char *fname, UINT rate) { +BRESULT pcmmix_regfile(PMIXDAT *dat, const OEMCHAR *fname, UINT rate) { FILEH fh; UINT size; - BYTE *ptr; - BOOL r; + UINT8 *ptr; + BRESULT r; r = FAILURE; fh = file_open_rb(fname); @@ -436,7 +437,7 @@ BOOL pcmmix_regfile(PMIXDAT *dat, const if (size == 0) { goto pmrf_err2; } - ptr = (BYTE *)_MALLOC(size, fname); + ptr = (UINT8 *)_MALLOC(size, fname); if (ptr == NULL) { goto pmrf_err2; }