--- np2/x11/soundmng.c 2008/04/02 13:03:34 1.12 +++ np2/x11/soundmng.c 2011/01/15 18:43:13 1.16 @@ -1,5 +1,3 @@ -/* $Id: soundmng.c,v 1.12 2008/04/02 13:03:34 monaka Exp $ */ - /* * Copyright (c) 2001-2003 NONAKA Kimihiro * All rights reserved. @@ -421,7 +419,7 @@ buffer_init(void) } sound_buffer[i] = (char *)_MALLOC(opna_frame, "sound buffer"); if (sound_buffer[i] == NULL) { - fprintf(stderr, "buffer_init: can't alloc memory\n"); + g_printerr("buffer_init: can't alloc memory\n"); sounddrv_unlock(); return FAILURE; } @@ -466,9 +464,6 @@ static BOOL nosound_drvinit(UINT rate, UINT bufmsec) { - UNUSED(rate); - UNUSED(bufmsec); - return SUCCESS; } @@ -511,9 +506,6 @@ static void * nosound_pcmload(UINT num, const char *path) { - UNUSED(num); - UNUSED(path); - return NULL; } @@ -521,9 +513,6 @@ static void nosound_pcmdestroy(void *chanp, UINT num) { - UNUSED(chanp); - UNUSED(num); - /* Nothing to do */ } @@ -531,10 +520,6 @@ static void nosound_pcmplay(void *chanp, UINT num, BOOL loop) { - UNUSED(chanp); - UNUSED(num); - UNUSED(loop); - /* Nothing to do */ } @@ -542,9 +527,6 @@ static void nosound_pcmstop(void *chanp, UINT num) { - UNUSED(chanp); - UNUSED(num); - /* Nothing to do */ } @@ -552,10 +534,6 @@ static void nosound_pcmvolume(void *chanp, UINT num, int volume) { - UNUSED(chanp); - UNUSED(num); - UNUSED(volume); - /* Nothing to do */ } @@ -807,13 +785,15 @@ sdlaudio_init(UINT rate, UINT samples) rv = SDL_InitSubSystem(SDL_INIT_AUDIO); if (rv < 0) { - fprintf(stderr, "sdlaudio_init: SDL_InitSubSystem\n"); + g_printerr("sdlmixer_init: SDL_InitSubSystem(): %s\n", + SDL_GetError()); return FAILURE; } audio_fd = SDL_OpenAudio(&fmt, NULL); if (audio_fd < 0) { - fprintf(stderr, "sdlaudio_init: SDL_OpenAudio\n"); + g_printerr("sdlaudio_init: SDL_OpenAudio(): %s\n", + SDL_GetError()); SDL_QuitSubSystem(SDL_INIT_AUDIO); return FAILURE; } @@ -861,21 +841,21 @@ sdlmixer_init(UINT rate, UINT samples) rv = SDL_InitSubSystem(SDL_INIT_AUDIO); if (rv < 0) { - fprintf(stderr, "sdlmixer_init: SDL_InitSubSystem(): %s\n", + g_printerr("sdlmixer_init: SDL_InitSubSystem(): %s\n", SDL_GetError()); goto failure; } rv = Mix_OpenAudio(rate, AUDIO_S16SYS, 2, samples); if (rv < 0) { - fprintf(stderr, "sdlmixer_init: Mix_OpenAudio(): %s\n", + g_printerr("sdlmixer_init: Mix_OpenAudio(): %s\n", Mix_GetError()); goto failure1; } rv = Mix_AllocateChannels(SOUND_MAXPCM); if (rv < 0) { - fprintf(stderr, "sdlmixer_init: Mix_AllocateChannels(): %s\n", + g_printerr("sdlmixer_init: Mix_AllocateChannels(): %s\n", Mix_GetError()); goto failure1; } @@ -905,8 +885,6 @@ sdlmixer_pcmload(UINT num, const char *p { Mix_Chunk *chunk; - UNUSED(num); - chunk = Mix_LoadWAV(path); return (void *)chunk; } @@ -932,8 +910,6 @@ static void sdlmixer_pcmstop(void *chanp, UINT num) { - UNUSED(chanp); - Mix_HaltChannel(num); } @@ -941,8 +917,6 @@ static void sdlmixer_pcmvolume(void *chanp, UINT num, int volume) { - UNUSED(chanp); - Mix_Volume(num, (MIX_MAX_VOLUME * volume) / 100); } @@ -1001,14 +975,12 @@ sdlaudio_callback(void *userdata, unsign UINT samples = (UINT)userdata; int nextbuf = sound_nextbuf; - UNUSED(len); - if (sound_event != NULL) memset(sound_event, 0, samples); sound_nextbuf = (sound_nextbuf + 1) % NSOUNDBUFFER; sound_event = sound_buffer[sound_nextbuf]; - SDL_MixAudio(stream, (const void *)sound_buffer[nextbuf], samples, + SDL_MixAudio(stream, (const void *)sound_buffer[nextbuf], len, SDL_MIX_MAXVOLUME); }