]> git.jsancho.org Git - lugaru.git/commitdiff
Move playing stuff to the right wrapper :)
authorAlexander Monakov <amonakov@gmail.com>
Fri, 17 Dec 2010 23:39:47 +0000 (02:39 +0300)
committerAlexander Monakov <amonakov@gmail.com>
Fri, 17 Dec 2010 23:39:47 +0000 (02:39 +0300)
Source/OpenGL_Windows.cpp
Source/openal_wrapper.cpp

index 49e877e8838d3919351dc0c44f791882d5974408..5dbf5c4548616f93e4c6841e9029f28f6d776497 100644 (file)
@@ -771,61 +771,6 @@ int main(int argc, char **argv)
 
 // --------------------------------------------------------------------------
 
-extern int channels[100];
-extern OPENAL_STREAM * strm[20];
-
-extern "C" void PlaySoundEx(int chan, OPENAL_SAMPLE *sptr, OPENAL_DSPUNIT *dsp, signed char startpaused)
-{
-       const OPENAL_SAMPLE * currSample = OPENAL_GetCurrentSample(channels[chan]);
-       if (currSample && currSample == samp[chan])
-       {
-               if (OPENAL_GetPaused(channels[chan]))
-               {
-                       OPENAL_StopSound(channels[chan]);
-                       channels[chan] = OPENAL_FREE;
-               }
-               else if (OPENAL_IsPlaying(channels[chan]))
-               {
-                       int loop_mode = OPENAL_GetLoopMode(channels[chan]);
-                       if (loop_mode & OPENAL_LOOP_OFF)
-                       {
-                               channels[chan] = OPENAL_FREE;
-                       }
-               }
-       }
-       else
-       {
-               channels[chan] = OPENAL_FREE;
-       }
-
-       channels[chan] = OPENAL_PlaySoundEx(channels[chan], sptr, dsp, startpaused);
-       if (channels[chan] < 0)
-       {
-               channels[chan] = OPENAL_PlaySoundEx(OPENAL_FREE, sptr, dsp, startpaused);
-       }
-}
-
-extern "C" void PlayStreamEx(int chan, OPENAL_STREAM *sptr, OPENAL_DSPUNIT *dsp, signed char startpaused)
-{
-       const OPENAL_SAMPLE * currSample = OPENAL_GetCurrentSample(channels[chan]);
-       if (currSample && currSample == OPENAL_Stream_GetSample(sptr))
-       {
-                       OPENAL_StopSound(channels[chan]);
-                       OPENAL_Stream_Stop(sptr);
-       }
-       else
-       {
-               OPENAL_Stream_Stop(sptr);
-               channels[chan] = OPENAL_FREE;
-       }
-
-       channels[chan] = OPENAL_Stream_PlayEx(channels[chan], sptr, dsp, startpaused);
-       if (channels[chan] < 0)
-       {
-               channels[chan] = OPENAL_Stream_PlayEx(OPENAL_FREE, sptr, dsp, startpaused);
-       }
-}
-
 
 bool LoadImage(const char * fname, TGAImageRec & tex)
 {
index 82ba31f568696baa95b565da476ae56fa10d9b05..bd4699069d3e39f8a2e328ee3efb12f03277944d 100644 (file)
@@ -26,6 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #include <string.h>
 
 #include "openal_wrapper.h"
+#include "Sounds.h"
 
 // NOTE:
 // FMOD uses a Left Handed Coordinate system, OpenAL uses a Right Handed
@@ -632,5 +633,60 @@ AL_API signed char OPENAL_SetOutput(int outputtype)
     return true;
 }
 
+extern int channels[100];
+extern OPENAL_STREAM * strm[20];
+
+extern "C" void PlaySoundEx(int chan, OPENAL_SAMPLE *sptr, OPENAL_DSPUNIT *dsp, signed char startpaused)
+{
+       const OPENAL_SAMPLE * currSample = OPENAL_GetCurrentSample(channels[chan]);
+       if (currSample && currSample == samp[chan])
+       {
+               if (OPENAL_GetPaused(channels[chan]))
+               {
+                       OPENAL_StopSound(channels[chan]);
+                       channels[chan] = OPENAL_FREE;
+               }
+               else if (OPENAL_IsPlaying(channels[chan]))
+               {
+                       int loop_mode = OPENAL_GetLoopMode(channels[chan]);
+                       if (loop_mode & OPENAL_LOOP_OFF)
+                       {
+                               channels[chan] = OPENAL_FREE;
+                       }
+               }
+       }
+       else
+       {
+               channels[chan] = OPENAL_FREE;
+       }
+
+       channels[chan] = OPENAL_PlaySoundEx(channels[chan], sptr, dsp, startpaused);
+       if (channels[chan] < 0)
+       {
+               channels[chan] = OPENAL_PlaySoundEx(OPENAL_FREE, sptr, dsp, startpaused);
+       }
+}
+
+extern "C" void PlayStreamEx(int chan, OPENAL_STREAM *sptr, OPENAL_DSPUNIT *dsp, signed char startpaused)
+{
+       const OPENAL_SAMPLE * currSample = OPENAL_GetCurrentSample(channels[chan]);
+       if (currSample && currSample == OPENAL_Stream_GetSample(sptr))
+       {
+                       OPENAL_StopSound(channels[chan]);
+                       OPENAL_Stream_Stop(sptr);
+       }
+       else
+       {
+               OPENAL_Stream_Stop(sptr);
+               channels[chan] = OPENAL_FREE;
+       }
+
+       channels[chan] = OPENAL_Stream_PlayEx(channels[chan], sptr, dsp, startpaused);
+       if (channels[chan] < 0)
+       {
+               channels[chan] = OPENAL_Stream_PlayEx(OPENAL_FREE, sptr, dsp, startpaused);
+       }
+}
+
 #endif