]> Shamusworld >> Repos - stargem2/blobdiff - src/sound.cpp
Converted to SDL 2, added fullscreen support (F12 to toggle).
[stargem2] / src / sound.cpp
index 4191928b2c52584c87680ab6c8701ca7990fe0d6..4462e27eccae6c7dba34590c0598ef53eda3ac1b 100755 (executable)
@@ -23,8 +23,8 @@
 
 #include "sound.h"
 
-#include "SDL.h"
-#include "types.h"
+#include <SDL2/SDL.h>
+#include <stdint.h>
 #include "log.h"
 #include "v6808.h"
 #include "timing.h"
 
 static SDL_AudioSpec desired;
 static bool soundInitialized = false;
-static uint32 cyclesToExecuteWholePart;
+static uint32_t cyclesToExecuteWholePart;
 static double cyclesToExecuteFractionalPart;
 
 // Private function prototypes
 
 void SDLSoundCallback(void * userdata, Uint8 * buffer, int length);
 
+
 //
 // Initialize the SDL sound system
 //
@@ -67,7 +68,7 @@ void SoundInit(void)
        }
 
        // Setup clock cycles & etc.
-       cyclesToExecuteWholePart = (uint32)CYCLES_TO_EXECUTE;
+       cyclesToExecuteWholePart = (uint32_t)CYCLES_TO_EXECUTE;
        cyclesToExecuteFractionalPart = CYCLES_TO_EXECUTE - (double)cyclesToExecuteWholePart;
 #if 0
 printf("Cycles to execute: %lf; cycles W: %u; cycles F: %lf\n", CYCLES_TO_EXECUTE, cyclesToExecuteWholePart, cyclesToExecuteFractionalPart);
@@ -78,6 +79,7 @@ printf("Cycles to execute: %lf; cycles W: %u; cycles F: %lf\n", CYCLES_TO_EXECUT
        WriteLog("Sound: Successfully initialized.\n");
 }
 
+
 //
 // Close down the SDL sound subsystem
 //
@@ -91,17 +93,18 @@ void SoundDone(void)
        }
 }
 
+
 //
 // Sound card callback handler
 //
 void SDLSoundCallback(void * userdata, Uint8 * buffer, int length)
 {
        extern V6808REGS soundCPU;
-       extern uint8 sram[];
+       extern uint8_t sram[];
        int cnt = 0;
 
        static float overflow = 0.0;
-       static uint32 time = cyclesToExecuteWholePart;
+       static uint32_t time = cyclesToExecuteWholePart;
 
        while (cnt != length)
        {
@@ -118,3 +121,4 @@ void SDLSoundCallback(void * userdata, Uint8 * buffer, int length)
                }
        }
 }
+