X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;ds=sidebyside;f=Source%2Fopenal_wrapper.cpp;h=5e832fb5bc6959099b292cc2eea29e4aeb22184b;hb=bbf8873b80baf3cb468ac12b3f62b0938320fef1;hp=bd4699069d3e39f8a2e328ee3efb12f03277944d;hpb=268b3df2ac5060f7e137edea425953b2a2d3d9ca;p=lugaru.git diff --git a/Source/openal_wrapper.cpp b/Source/openal_wrapper.cpp index bd46990..5e832fb 100644 --- a/Source/openal_wrapper.cpp +++ b/Source/openal_wrapper.cpp @@ -25,6 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include +#include "Quaternions.h" #include "openal_wrapper.h" #include "Sounds.h" @@ -186,6 +187,16 @@ AL_API signed char OPENAL_3D_SetAttributes(int channel, const float *pos, const return true; } +AL_API signed char OPENAL_3D_SetAttributes_(int channel, const XYZ &pos, const float *vel) +{ + if (!initialized) return false; + if ((channel < 0) || (channel >= num_channels)) return false; + + set_channel_position(channel, pos.x, pos.y, -pos.z); + + return true; +} + AL_API signed char OPENAL_Init(int mixrate, int maxsoftwarechannels, unsigned int flags) { if (initialized) return false; @@ -265,14 +276,14 @@ AL_API void OPENAL_Close() initialized = false; } -AL_API OPENAL_SAMPLE *OPENAL_GetCurrentSample(int channel) +static OPENAL_SAMPLE *OPENAL_GetCurrentSample(int channel) { if (!initialized) return NULL; if ((channel < 0) || (channel >= num_channels)) return NULL; return impl_channels[channel].sample; } -AL_API signed char OPENAL_GetPaused(int channel) +static signed char OPENAL_GetPaused(int channel) { if (!initialized) return false; if ((channel < 0) || (channel >= num_channels)) return false; @@ -284,7 +295,7 @@ AL_API signed char OPENAL_GetPaused(int channel) return((state == AL_PAUSED) ? true : false); } -AL_API unsigned int OPENAL_GetLoopMode(int channel) +static unsigned int OPENAL_GetLoopMode(int channel) { if (!initialized) return 0; if ((channel < 0) || (channel >= num_channels)) return 0; @@ -295,7 +306,7 @@ AL_API unsigned int OPENAL_GetLoopMode(int channel) return OPENAL_LOOP_OFF; } -AL_API signed char OPENAL_IsPlaying(int channel) +static signed char OPENAL_IsPlaying(int channel) { if (!initialized) return false; if ((channel < 0) || (channel >= num_channels)) return false; @@ -304,7 +315,7 @@ AL_API signed char OPENAL_IsPlaying(int channel) return((state == AL_PLAYING) ? true : false); } -AL_API int OPENAL_PlaySoundEx(int channel, OPENAL_SAMPLE *sptr, OPENAL_DSPUNIT *dsp, signed char startpaused) +static int OPENAL_PlaySoundEx(int channel, OPENAL_SAMPLE *sptr, OPENAL_DSPUNIT *dsp, signed char startpaused) { if (!initialized) return -1; if (sptr == NULL) return -1; @@ -487,7 +498,7 @@ AL_API void OPENAL_Sample_Free(OPENAL_SAMPLE *sptr) } } -AL_API signed char OPENAL_Sample_SetMode(OPENAL_SAMPLE *sptr, unsigned int mode) +static signed char OPENAL_Sample_SetMode(OPENAL_SAMPLE *sptr, unsigned int mode) { if (!initialized) return false; if ((mode != OPENAL_LOOP_NORMAL) && (mode != OPENAL_LOOP_OFF)) return false; @@ -592,18 +603,18 @@ AL_API void OPENAL_Stream_Close(OPENAL_STREAM *stream) OPENAL_Sample_Free((OPENAL_SAMPLE *) stream); } -AL_API OPENAL_SAMPLE *OPENAL_Stream_GetSample(OPENAL_STREAM *stream) +static OPENAL_SAMPLE *OPENAL_Stream_GetSample(OPENAL_STREAM *stream) { if (!initialized) return NULL; return (OPENAL_SAMPLE *) stream; } -AL_API int OPENAL_Stream_PlayEx(int channel, OPENAL_STREAM *stream, OPENAL_DSPUNIT *dsp, signed char startpaused) +static int OPENAL_Stream_PlayEx(int channel, OPENAL_STREAM *stream, OPENAL_DSPUNIT *dsp, signed char startpaused) { return OPENAL_PlaySoundEx(channel, (OPENAL_SAMPLE *) stream, dsp, startpaused); } -AL_API signed char OPENAL_Stream_Stop(OPENAL_STREAM *stream) +static signed char OPENAL_Stream_Stop(OPENAL_STREAM *stream) { if (!initialized) return false; for (int i = 0; i < num_channels; i++) @@ -633,8 +644,7 @@ AL_API signed char OPENAL_SetOutput(int outputtype) return true; } -extern int channels[100]; -extern OPENAL_STREAM * strm[20]; +extern int channels[]; extern "C" void PlaySoundEx(int chan, OPENAL_SAMPLE *sptr, OPENAL_DSPUNIT *dsp, signed char startpaused) {