]> git.proxmox.com Git - qemu.git/blobdiff - audio/fmodaudio.c
rng-egd: remove redundant free
[qemu.git] / audio / fmodaudio.c
index 11ad09bb29253bfb352517b3d7bed15977930249..fabf84dd3b89e2e30a7fac139a600e965fd4f9be 100644 (file)
@@ -47,7 +47,6 @@ static struct {
     int freq;
     int nb_channels;
     int bufsize;
-    int threshold;
     int broken_adc;
 } conf = {
     .nb_samples  = 2048 * 2,
@@ -225,24 +224,15 @@ static int fmod_lock_sample (
     return 0;
 }
 
-static int fmod_run_out (HWVoiceOut *hw)
+static int fmod_run_out (HWVoiceOut *hw, int live)
 {
     FMODVoiceOut *fmd = (FMODVoiceOut *) hw;
-    int live, decr;
+    int decr;
     void *p1 = 0, *p2 = 0;
     unsigned int blen1 = 0, blen2 = 0;
     unsigned int len1 = 0, len2 = 0;
-    int nb_live;
 
-    live = audio_pcm_hw_get_live_out2 (hw, &nb_live);
-    if (!live) {
-        return 0;
-    }
-
-    if (!hw->pending_disable
-        && nb_live
-        && (conf.threshold && live <= conf.threshold)) {
-        ldebug ("live=%d nb_live=%d\n", live, nb_live);
+    if (!hw->pending_disable) {
         return 0;
     }
 
@@ -353,7 +343,7 @@ static void fmod_fini_out (HWVoiceOut *hw)
 
 static int fmod_init_out (HWVoiceOut *hw, struct audsettings *as)
 {
-    int bits16, mode, channel;
+    int mode, channel;
     FMODVoiceOut *fmd = (FMODVoiceOut *) hw;
     struct audsettings obt_as = *as;
 
@@ -384,7 +374,6 @@ static int fmod_init_out (HWVoiceOut *hw, struct audsettings *as)
     /* FMOD always operates on little endian frames? */
     obt_as.endianness = 0;
     audio_pcm_init_info (&hw->info, &obt_as);
-    bits16 = (mode & FSOUND_16BITS) != 0;
     hw->samples = conf.nb_samples;
     return 0;
 }
@@ -415,7 +404,7 @@ static int fmod_ctl_out (HWVoiceOut *hw, int cmd, ...)
 
 static int fmod_init_in (HWVoiceIn *hw, struct audsettings *as)
 {
-    int bits16, mode;
+    int mode;
     FMODVoiceIn *fmd = (FMODVoiceIn *) hw;
     struct audsettings obt_as = *as;
 
@@ -442,7 +431,6 @@ static int fmod_init_in (HWVoiceIn *hw, struct audsettings *as)
     /* FMOD always operates on little endian frames? */
     obt_as.endianness = 0;
     audio_pcm_init_info (&hw->info, &obt_as);
-    bits16 = (mode & FSOUND_16BITS) != 0;
     hw->samples = conf.nb_samples;
     return 0;
 }
@@ -498,10 +486,10 @@ static int fmod_run_in (HWVoiceIn *hw)
     decr = len1 + len2;
 
     if (p1 && blen1) {
-        hw->conv (hw->conv_buf + hw->wpos, p1, len1, &nominal_volume);
+        hw->conv (hw->conv_buf + hw->wpos, p1, len1);
     }
     if (p2 && len2) {
-        hw->conv (hw->conv_buf, p2, len2, &nominal_volume);
+        hw->conv (hw->conv_buf, p2, len2);
     }
 
     fmod_unlock_sample (fmd->fmod_sample, p1, p2, blen1, blen2);
@@ -513,40 +501,27 @@ static struct {
     const char *name;
     int type;
 } drvtab[] = {
-    {.name = "none",
-     .type = FSOUND_OUTPUT_NOSOUND},
+    { .name = "none",   .type = FSOUND_OUTPUT_NOSOUND },
 #ifdef _WIN32
-    {.name = "winmm",
-     .type = FSOUND_OUTPUT_WINMM},
-    {.name = "dsound",
-     .type = FSOUND_OUTPUT_DSOUND},
-    {.name = "a3d",
-     .type = FSOUND_OUTPUT_A3D},
-    {.name = "asio",
-     .type = FSOUND_OUTPUT_ASIO},
+    { .name = "winmm",  .type = FSOUND_OUTPUT_WINMM   },
+    { .name = "dsound", .type = FSOUND_OUTPUT_DSOUND  },
+    { .name = "a3d",    .type = FSOUND_OUTPUT_A3D     },
+    { .name = "asio",   .type = FSOUND_OUTPUT_ASIO    },
 #endif
 #ifdef __linux__
-    {.name = "oss",
-     .type = FSOUND_OUTPUT_OSS},
-    {.name = "alsa",
-     .type =  FSOUND_OUTPUT_ALSA},
-    {.name = "esd",
-     .type = FSOUND_OUTPUT_ESD},
+    { .name = "oss",    .type = FSOUND_OUTPUT_OSS     },
+    { .name = "alsa",   .type = FSOUND_OUTPUT_ALSA    },
+    { .name = "esd",    .type = FSOUND_OUTPUT_ESD     },
 #endif
 #ifdef __APPLE__
-    {.name = "mac",
-     .type = FSOUND_OUTPUT_MAC},
+    { .name = "mac",    .type = FSOUND_OUTPUT_MAC     },
 #endif
 #if 0
-    {.name = "xbox",
-     .type = FSOUND_OUTPUT_XBOX},
-    {.name = "ps2",
-     .type = FSOUND_OUTPUT_PS2},
-    {.name = "gcube",
-     .type = FSOUND_OUTPUT_GC},
+    { .name = "xbox",   .type = FSOUND_OUTPUT_XBOX    },
+    { .name = "ps2",    .type = FSOUND_OUTPUT_PS2     },
+    { .name = "gcube",  .type = FSOUND_OUTPUT_GC      },
 #endif
-    {.name = "none-realtime",
-     .type = FSOUND_OUTPUT_NOSOUND_NONREALTIME}
+    { .name = "none-realtime", .type = FSOUND_OUTPUT_NOSOUND_NONREALTIME }
 };
 
 static void *fmod_audio_init (void)
@@ -648,32 +623,36 @@ static void fmod_audio_fini (void *opaque)
 }
 
 static struct audio_option fmod_options[] = {
-    {.name  = "DRV",
-     .tag   = AUD_OPT_STR,
-     .valp  = &conf.drvname,
-     .descr = "FMOD driver"},
-    {.name  = "FREQ",
-     .tag   = AUD_OPT_INT,
-     .valp  = &conf.freq,
-     .descr = "Default frequency"},
-    {.name  = "SAMPLES",
-     .tag   = AUD_OPT_INT,
-     .valp  = &conf.nb_samples,
-     .descr = "Buffer size in samples"},
-    {.name  = "CHANNELS",
-     .tag   = AUD_OPT_INT,
-     .valp  = &conf.nb_channels,
-     .descr = "Number of default channels (1 - mono, 2 - stereo)"},
-    {.name  = "BUFSIZE",
-     .tag   = AUD_OPT_INT,
-     .valp  = &conf.bufsize,
-     .descr = "(undocumented)"}
-#if 0
-    {.name  = "THRESHOLD",
-     .tag   = AUD_OPT_INT,
-     .valp  = &conf.threshold,
-     .descr = "(undocumented)"}
-#endif
+    {
+        .name  = "DRV",
+        .tag   = AUD_OPT_STR,
+        .valp  = &conf.drvname,
+        .descr = "FMOD driver"
+    },
+    {
+        .name  = "FREQ",
+        .tag   = AUD_OPT_INT,
+        .valp  = &conf.freq,
+        .descr = "Default frequency"
+    },
+    {
+        .name  = "SAMPLES",
+        .tag   = AUD_OPT_INT,
+        .valp  = &conf.nb_samples,
+        .descr = "Buffer size in samples"
+    },
+    {
+        .name  = "CHANNELS",
+        .tag   = AUD_OPT_INT,
+        .valp  = &conf.nb_channels,
+        .descr = "Number of default channels (1 - mono, 2 - stereo)"
+    },
+    {
+        .name  = "BUFSIZE",
+        .tag   = AUD_OPT_INT,
+        .valp  = &conf.bufsize,
+        .descr = "(undocumented)"
+    },
     { /* End of list */ }
 };
 
@@ -684,11 +663,11 @@ static struct audio_pcm_ops fmod_pcm_ops = {
     .write    = fmod_write,
     .ctl_out  = fmod_ctl_out,
 
-    .init_in = fmod_init_in,
-    .fini_in = fmod_fini_in,
-    .run_in  = fmod_run_in,
-    .read    = fmod_read,
-    .ctl_in  = fmod_ctl_in
+    .init_in  = fmod_init_in,
+    .fini_in  = fmod_fini_in,
+    .run_in   = fmod_run_in,
+    .read     = fmod_read,
+    .ctl_in   = fmod_ctl_in
 };
 
 struct audio_driver fmod_audio_driver = {