summary refs log tree commit diff stats
path: root/audio/sdlaudio.c
diff options
context:
space:
mode:
Diffstat (limited to 'audio/sdlaudio.c')
-rw-r--r--audio/sdlaudio.c30
1 files changed, 12 insertions, 18 deletions
diff --git a/audio/sdlaudio.c b/audio/sdlaudio.c
index e7179ff1d4..14b11f0335 100644
--- a/audio/sdlaudio.c
+++ b/audio/sdlaudio.c
@@ -41,8 +41,8 @@
 
 typedef struct SDLVoiceOut {
     HWVoiceOut hw;
-    int live;
-    int decr;
+    size_t live;
+    size_t decr;
 } SDLVoiceOut;
 
 static struct SDLAudioState {
@@ -184,22 +184,22 @@ static void sdl_callback (void *opaque, Uint8 *buf, int len)
     SDLVoiceOut *sdl = opaque;
     SDLAudioState *s = &glob_sdl;
     HWVoiceOut *hw = &sdl->hw;
-    int samples = len >> hw->info.shift;
-    int to_mix, decr;
+    size_t samples = len >> hw->info.shift;
+    size_t to_mix, decr;
 
     if (s->exit || !sdl->live) {
         return;
     }
 
-    /* dolog ("in callback samples=%d live=%d\n", samples, sdl->live); */
+    /* dolog ("in callback samples=%zu live=%zu\n", samples, sdl->live); */
 
-    to_mix = audio_MIN(samples, sdl->live);
+    to_mix = MIN(samples, sdl->live);
     decr = to_mix;
     while (to_mix) {
-        int chunk = audio_MIN(to_mix, hw->samples - hw->rpos);
+        size_t chunk = MIN(to_mix, hw->samples - hw->rpos);
         struct st_sample *src = hw->mix_buf + hw->rpos;
 
-        /* dolog ("in callback to_mix %d, chunk %d\n", to_mix, chunk); */
+        /* dolog ("in callback to_mix %zu, chunk %zu\n", to_mix, chunk); */
         hw->clip(buf, src, chunk);
         hw->rpos = (hw->rpos + chunk) % hw->samples;
         to_mix -= chunk;
@@ -209,7 +209,7 @@ static void sdl_callback (void *opaque, Uint8 *buf, int len)
     sdl->live -= decr;
     sdl->decr += decr;
 
-    /* dolog ("done len=%d\n", len); */
+    /* dolog ("done len=%zu\n", len); */
 
     /* SDL2 does not clear the remaining buffer for us, so do it on our own */
     if (samples) {
@@ -217,14 +217,9 @@ static void sdl_callback (void *opaque, Uint8 *buf, int len)
     }
 }
 
-static int sdl_write_out (SWVoiceOut *sw, void *buf, int len)
+static size_t sdl_run_out(HWVoiceOut *hw, size_t live)
 {
-    return audio_pcm_sw_write (sw, buf, len);
-}
-
-static int sdl_run_out (HWVoiceOut *hw, int live)
-{
-    int decr;
+    size_t decr;
     SDLVoiceOut *sdl = (SDLVoiceOut *) hw;
 
     SDL_LockAudio();
@@ -236,7 +231,7 @@ static int sdl_run_out (HWVoiceOut *hw, int live)
                 sdl->live);
     }
 
-    decr = audio_MIN (sdl->decr, live);
+    decr = MIN (sdl->decr, live);
     sdl->decr -= decr;
 
     sdl->live = live;
@@ -342,7 +337,6 @@ static struct audio_pcm_ops sdl_pcm_ops = {
     .init_out = sdl_init_out,
     .fini_out = sdl_fini_out,
     .run_out  = sdl_run_out,
-    .write    = sdl_write_out,
     .ctl_out  = sdl_ctl_out,
 };