From 2d9318065c2361c26ac139326e69d59f8810b5c3 Mon Sep 17 00:00:00 2001 From: avolkov Date: Thu, 30 Jan 2003 19:13:36 +0000 Subject: [PATCH] mixer abstraction layer improvements git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@609 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/src/sc2code/libs/sound/mixsdl/mixer.c | 10 +++++----- sc2/src/sc2code/libs/sound/mixsdl/mixer.h | 12 ++++++++---- sc2/src/sc2code/libs/sound/mixsdl/sound_mixsdl.h | 6 +++++- sc2/src/sc2code/libs/sound/openal/sound_openal.c | 2 +- sc2/src/sc2code/libs/sound/openal/sound_openal.h | 6 +++++- sc2/src/sc2code/libs/sound/sfx.c | 2 +- sc2/src/sc2code/libs/sound/sound.c | 2 +- sc2/src/sc2code/libs/sound/sound.h | 2 +- sc2/src/sc2code/libs/sound/stream.c | 8 ++++---- sc2/src/sc2code/libs/sound/trackplayer.c | 2 +- 10 files changed, 32 insertions(+), 20 deletions(-) diff --git a/sc2/src/sc2code/libs/sound/mixsdl/mixer.c b/sc2/src/sc2code/libs/sound/mixsdl/mixer.c index 507aca36f..e2a4a94ed 100644 --- a/sc2/src/sc2code/libs/sound/mixsdl/mixer.c +++ b/sc2/src/sc2code/libs/sound/mixsdl/mixer.c @@ -406,7 +406,7 @@ mixSDL_IsSource (mixSDL_Object srcobj) /* set source integer property */ void mixSDL_Sourcei (mixSDL_Object srcobj, mixSDL_SourceProp pname, - mixSDL_Object value) + mixSDL_IntVal value) { mixSDL_Source *src = (mixSDL_Source *) srcobj; @@ -504,7 +504,7 @@ mixSDL_Sourcef (mixSDL_Object srcobj, mixSDL_SourceProp pname, float value) /* get source integer property */ void mixSDL_GetSourcei (mixSDL_Object srcobj, mixSDL_SourceProp pname, - mixSDL_Object *value) + mixSDL_IntVal *value) { mixSDL_Source *src = (mixSDL_Source *) srcobj; @@ -534,7 +534,7 @@ mixSDL_GetSourcei (mixSDL_Object srcobj, mixSDL_SourceProp pname, *value = src->looping; break; case MIX_BUFFER: - *value = (mixSDL_Object) src->firstqueued; + *value = (mixSDL_IntVal) src->firstqueued; break; case MIX_SOURCE_STATE: *value = src->state; @@ -1292,7 +1292,7 @@ mixSDL_IsBuffer (mixSDL_Object bufobj) /* get buffer property */ void mixSDL_GetBufferi (mixSDL_Object bufobj, mixSDL_BufferProp pname, - mixSDL_Object *value) + mixSDL_IntVal *value) { mixSDL_Buffer *buf = (mixSDL_Buffer *) bufobj; @@ -1343,7 +1343,7 @@ mixSDL_GetBufferi (mixSDL_Object bufobj, mixSDL_BufferProp pname, *value = buf->orgsize; break; case MIX_DATA: - *value = (mixSDL_Object) buf->orgdata; + *value = (mixSDL_IntVal) buf->orgdata; break; default: mixSDL_SetError (MIX_INVALID_ENUM); diff --git a/sc2/src/sc2code/libs/sound/mixsdl/mixer.h b/sc2/src/sc2code/libs/sound/mixsdl/mixer.h index e8e156099..37ff9f294 100644 --- a/sc2/src/sc2code/libs/sound/mixsdl/mixer.h +++ b/sc2/src/sc2code/libs/sound/mixsdl/mixer.h @@ -134,8 +134,12 @@ typedef enum } mixSDL_Format; +/************************************************* + * Interface Types + */ -typedef int mixSDL_Object; +typedef unsigned int mixSDL_Object; +typedef int mixSDL_IntVal; typedef struct _mixSDL_Buffer { @@ -191,11 +195,11 @@ void mixSDL_GenSources (uint32 n, mixSDL_Object *psrcobj); void mixSDL_DeleteSources (uint32 n, mixSDL_Object *psrcobj); bool mixSDL_IsSource (mixSDL_Object srcobj); void mixSDL_Sourcei (mixSDL_Object srcobj, mixSDL_SourceProp pname, - mixSDL_Object value); + mixSDL_IntVal value); void mixSDL_Sourcef (mixSDL_Object srcobj, mixSDL_SourceProp pname, float value); void mixSDL_GetSourcei (mixSDL_Object srcobj, mixSDL_SourceProp pname, - mixSDL_Object *value); + mixSDL_IntVal *value); void mixSDL_GetSourcef (mixSDL_Object srcobj, mixSDL_SourceProp pname, float *value); void mixSDL_SourceRewind (mixSDL_Object srcobj); @@ -214,7 +218,7 @@ void mixSDL_GenBuffers (uint32 n, mixSDL_Object *pbufobj); void mixSDL_DeleteBuffers (uint32 n, mixSDL_Object *pbufobj); bool mixSDL_IsBuffer (mixSDL_Object bufobj); void mixSDL_GetBufferi (mixSDL_Object bufobj, mixSDL_BufferProp pname, - mixSDL_Object *value); + mixSDL_IntVal *value); void mixSDL_BufferData (mixSDL_Object bufobj, uint32 format, void* data, uint32 size, uint32 freq); diff --git a/sc2/src/sc2code/libs/sound/mixsdl/sound_mixsdl.h b/sc2/src/sc2code/libs/sound/mixsdl/sound_mixsdl.h index c9228fa3e..6e0b1aa80 100644 --- a/sc2/src/sc2code/libs/sound/mixsdl/sound_mixsdl.h +++ b/sc2/src/sc2code/libs/sound/mixsdl/sound_mixsdl.h @@ -14,11 +14,15 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* OpenAL specific code by Mika Kolehmainen, 2002-10-23 +/* Mixer abstraction layer for MixSDL */ #include "mixer.h" +/************************************************* + * Interface Types + */ #define TFBSound_Object mixSDL_Object +#define TFBSound_IntVal mixSDL_IntVal /************************************************* * General interface diff --git a/sc2/src/sc2code/libs/sound/openal/sound_openal.c b/sc2/src/sc2code/libs/sound/openal/sound_openal.c index f0f6e5574..f13e51800 100644 --- a/sc2/src/sc2code/libs/sound/openal/sound_openal.c +++ b/sc2/src/sc2code/libs/sound/openal/sound_openal.c @@ -99,7 +99,7 @@ TFB_InitSound (int driver, int flags) SetSFXVolume (sfxVolumeScale); SetSpeechVolume (speechVolumeScale); - SetMusicVolume (musicVolume); + SetMusicVolume ((COUNT) musicVolume); // NOTE: change this if implementing 3D sound stuff alDistanceModel (AL_NONE); diff --git a/sc2/src/sc2code/libs/sound/openal/sound_openal.h b/sc2/src/sc2code/libs/sound/openal/sound_openal.h index 4f746186e..72b0f1967 100644 --- a/sc2/src/sc2code/libs/sound/openal/sound_openal.h +++ b/sc2/src/sc2code/libs/sound/openal/sound_openal.h @@ -14,7 +14,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* OpenAL specific code by Mika Kolehmainen, 2002-10-23 +/* Mixer abstraction layer for OpenAL */ #ifdef WIN32 @@ -28,7 +28,11 @@ #include "mixer.h" +/************************************************* + * Interface Types + */ #define TFBSound_Object ALuint +#define TFBSound_IntVal ALint /************************************************* * General interface diff --git a/sc2/src/sc2code/libs/sound/sfx.c b/sc2/src/sc2code/libs/sound/sfx.c index bc9d0db67..b89e392ae 100644 --- a/sc2/src/sc2code/libs/sound/sfx.c +++ b/sc2/src/sc2code/libs/sound/sfx.c @@ -47,7 +47,7 @@ StopChannel(COUNT channel, unsigned char Priority) BOOLEAN ChannelPlaying (COUNT WhichChannel) { - TFBSound_Object state; + TFBSound_IntVal state; TFBSound_GetSourcei (soundSource[WhichChannel].handle, TFBSOUND_SOURCE_STATE, &state); if (state == TFBSOUND_PLAYING) diff --git a/sc2/src/sc2code/libs/sound/sound.c b/sc2/src/sc2code/libs/sound/sound.c index 430ddce6c..faacfbdc2 100644 --- a/sc2/src/sc2code/libs/sound/sound.c +++ b/sc2/src/sc2code/libs/sound/sound.c @@ -56,7 +56,7 @@ SoundPlaying (void) } else { - uint32 state; + TFBSound_IntVal state; TFBSound_GetSourcei (soundSource[i].handle, TFBSOUND_SOURCE_STATE, &state); if (state == TFBSOUND_PLAYING) return TRUE; diff --git a/sc2/src/sc2code/libs/sound/sound.h b/sc2/src/sc2code/libs/sound/sound.h index bc52a483c..a6991eb5b 100644 --- a/sc2/src/sc2code/libs/sound/sound.h +++ b/sc2/src/sc2code/libs/sound/sound.h @@ -27,7 +27,7 @@ #elif defined SOUNDMODULE_OPENAL #include "openal/sound_openal.h" #endif -#include "libs/sound/decoders/decoder.h" +#include "decoders/decoder.h" #define FIRST_SFX_SOURCE 0 diff --git a/sc2/src/sc2code/libs/sound/stream.c b/sc2/src/sc2code/libs/sound/stream.c index ae777fb99..a1715448e 100644 --- a/sc2/src/sc2code/libs/sound/stream.c +++ b/sc2/src/sc2code/libs/sound/stream.c @@ -119,7 +119,7 @@ PlayStream (TFB_SoundSample *sample, uint32 source, bool looping, bool scope, bo void StopStream (uint32 source) { - uint32 queued, processed; + TFBSound_IntVal queued, processed; uint32 *buffer; soundSource[source].stream_should_be_playing = FALSE; @@ -188,8 +188,8 @@ StreamDecoderTaskFunc (void *data) for (i = MUSIC_SOURCE; i < NUM_SOUNDSOURCES; ++i) { - uint32 processed, queued; - TFBSound_Object state; + TFBSound_IntVal processed, queued; + TFBSound_IntVal state; bool do_speech_advancetrack = false; LockMutex (soundSource[i].stream_mutex); @@ -268,7 +268,7 @@ StreamDecoderTaskFunc (void *data) } } { - uint32 buf_size; + TFBSound_IntVal buf_size; soundSource[i].sbuf_lasttime = GetTimeCounter (); TFBSound_GetBufferi(buffer, TFBSOUND_SIZE, &buf_size); soundSource[i].sbuf_offset += buf_size; diff --git a/sc2/src/sc2code/libs/sound/trackplayer.c b/sc2/src/sc2code/libs/sound/trackplayer.c index 49143162a..fc9dd9224 100644 --- a/sc2/src/sc2code/libs/sound/trackplayer.c +++ b/sc2/src/sc2code/libs/sound/trackplayer.c @@ -94,7 +94,7 @@ ResumeTrack () { if (sound_sample && sound_sample->read_chain_ptr) { - uint32 state; + TFBSound_IntVal state; LockMutex (soundSource[SPEECH_SOURCE].stream_mutex); TFBSound_GetSourcei (soundSource[SPEECH_SOURCE].handle, TFBSOUND_SOURCE_STATE, &state);