--- np2/x11/soundmng.c 2003/11/18 14:32:48 1.2 +++ np2/x11/soundmng.c 2004/05/22 16:35:08 1.5 @@ -94,7 +94,7 @@ static BOOL nosound_setup(void); static void PARTSCALL (*fnmix)(SINT16* dst, const SINT32* src, UINT size); -#if defined(__GNUC__) && (defined(i386) || defined(__i386__)) +#if defined(GCC_CPU_ARCH_IA32) void PARTSCALL _saturation_s16(SINT16 *dst, const SINT32 *src, UINT size); void PARTSCALL _saturation_s16x(SINT16 *dst, const SINT32 *src, UINT size); void PARTSCALL saturation_s16mmx(SINT16 *dst, const SINT32 *src, UINT size); @@ -224,9 +224,6 @@ UINT soundmng_create(UINT rate, UINT bufmsec) { UINT samples; -#if defined(VERMOUTH_LIB) - UINT num; -#endif if (opened || ((rate != 11025) && (rate != 22050) && (rate != 44100))) { return 0; @@ -252,10 +249,7 @@ soundmng_create(UINT rate, UINT bufmsec) #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 soundmng_setreverse(FALSE); @@ -355,7 +349,7 @@ void soundmng_setreverse(BOOL reverse) { -#if defined(__GNUC__) && (defined(i386) || defined(__i386__)) +#if defined(GCC_CPU_ARCH_IA32) if (!reverse) { if (mmxflag & (MMXFLAG_NOTSUPPORT|MMXFLAG_DISABLE)) { fnmix = _saturation_s16; @@ -606,23 +600,19 @@ buffer_play(void *arg) size_t len = opna_frame; size_t s; ssize_t r; + int nextbuf; UNUSED(arg); - buf = (char *)_MALLOC(len, "sound playing buf"); - if (buf == NULL) { - fprintf(stderr, "buffer_play: can't alloc memory\n"); - return NULL; - } - is_proc = TRUE; while (is_proc) { + nextbuf = sound_nextbuf; if (sound_event) memset(sound_event, 0, len); - memcpy(buf, sound_buffer[sound_nextbuf], len); sound_nextbuf = (sound_nextbuf + 1) % NSOUNDBUFFER; sound_event = sound_buffer[sound_nextbuf]; + buf = sound_buffer[nextbuf]; s = 0; for (;;) { r = write(audio_fd, buf + s, len - s); @@ -633,7 +623,6 @@ buffer_play(void *arg) } } } - _MFREE(buf); is_proc = FALSE; return NULL; @@ -657,7 +646,7 @@ snddrv_stop(void) #endif /* USE_NETBSDAUDIO || USE_OSSAUDIO || USE_ESDAUDIO */ -#if defined(__GNUC__) && (defined(i386) || defined(__i386__)) +#if defined(GCC_CPU_ARCH_IA32) void PARTSCALL _saturation_s16(SINT16 *dst, const SINT32 *src, UINT size) { @@ -757,6 +746,6 @@ saturation_s16mmx(SINT16 *dst, const SIN : /* output */ : "m" (dst), "m" (src), "m" (size)); } -#endif /* __GNUC__ && (i386 || __i386__) */ +#endif /* __GNUC__ && GCC_CPU_ARCH_IA32 */ #endif /* !NOSOUND */