Sfoglia il codice sorgente

1. fix the normal5x bug
2. remove the audio_mixer
3. remove the assets\assets\sounds files

ZengGengSen 1 anno fa
parent
commit
7cbb9b4251
34 ha cambiato i file con 6 aggiunte e 2748 eliminazioni
  1. BIN
      app/src/main/assets/assets/sounds/BGM.wav
  2. BIN
      app/src/main/assets/assets/sounds/CANCEL.wav
  3. BIN
      app/src/main/assets/assets/sounds/CANCEL_R.wav
  4. BIN
      app/src/main/assets/assets/sounds/DOWN.wav
  5. BIN
      app/src/main/assets/assets/sounds/DOWN_R.wav
  6. BIN
      app/src/main/assets/assets/sounds/LAUNCH.wav
  7. 0 12
      app/src/main/assets/assets/sounds/Licence.txt
  8. BIN
      app/src/main/assets/assets/sounds/NOTICE.wav
  9. BIN
      app/src/main/assets/assets/sounds/NOTICE_BACK.wav
  10. BIN
      app/src/main/assets/assets/sounds/OK.wav
  11. BIN
      app/src/main/assets/assets/sounds/OK_R.wav
  12. 0 2
      app/src/main/assets/assets/sounds/README.md
  13. BIN
      app/src/main/assets/assets/sounds/SOMETHING.wav
  14. BIN
      app/src/main/assets/assets/sounds/SOMETHING_R.wav
  15. BIN
      app/src/main/assets/assets/sounds/UP.wav
  16. BIN
      app/src/main/assets/assets/sounds/UP_R.wav
  17. BIN
      app/src/main/assets/assets/sounds/bgm.ogg
  18. BIN
      app/src/main/assets/assets/sounds/cancel.ogg
  19. 0 14
      app/src/main/assets/assets/sounds/convert_ogg.sh
  20. BIN
      app/src/main/assets/assets/sounds/down.ogg
  21. BIN
      app/src/main/assets/assets/sounds/launch.ogg
  22. BIN
      app/src/main/assets/assets/sounds/notice.ogg
  23. BIN
      app/src/main/assets/assets/sounds/notice_back.ogg
  24. BIN
      app/src/main/assets/assets/sounds/ok.ogg
  25. BIN
      app/src/main/assets/assets/sounds/unlock.ogg
  26. BIN
      app/src/main/assets/assets/sounds/up.ogg
  27. 4 4
      app/src/main/cpp/CMakeLists.txt
  28. 2 2
      app/src/main/cpp/gfx/video_filters/normal5x.c
  29. 0 377
      app/src/main/cpp/libretro-common/audio/audio_mix.c
  30. 0 1400
      app/src/main/cpp/libretro-common/audio/audio_mixer.c
  31. 0 94
      app/src/main/cpp/libretro-common/include/audio/audio_mix.h
  32. 0 90
      app/src/main/cpp/libretro-common/include/audio/audio_mixer.h
  33. 0 702
      app/src/main/cpp/tasks/task_audio_mixer.c
  34. 0 51
      app/src/main/cpp/tasks/task_audio_mixer.h

BIN
app/src/main/assets/assets/sounds/BGM.wav


BIN
app/src/main/assets/assets/sounds/CANCEL.wav


BIN
app/src/main/assets/assets/sounds/CANCEL_R.wav


BIN
app/src/main/assets/assets/sounds/DOWN.wav


BIN
app/src/main/assets/assets/sounds/DOWN_R.wav


BIN
app/src/main/assets/assets/sounds/LAUNCH.wav


+ 0 - 12
app/src/main/assets/assets/sounds/Licence.txt

@@ -1,12 +0,0 @@
-The sounds included in this package are for use in RetroArch and can be used under the CC BY-NC 3.0 licence.
-More info on CC BY-NC 3.0 can be found here.
-https://creativecommons.org/licenses/by-nc/3.0/us/
-
-Credit the author as ViRiX Dreamcore
-
-Please contact the following email for any questions.
-
-davidm@virixcore.net
-
-Other contact:
-Discord: ViRiX_Dreamcore#1801

BIN
app/src/main/assets/assets/sounds/NOTICE.wav


BIN
app/src/main/assets/assets/sounds/NOTICE_BACK.wav


BIN
app/src/main/assets/assets/sounds/OK.wav


BIN
app/src/main/assets/assets/sounds/OK_R.wav


+ 0 - 2
app/src/main/assets/assets/sounds/README.md

@@ -1,2 +0,0 @@
-# Sounds
-Sounds were compiled from the /sounds/ and /src/sounds/ directories of the **retroarch-assets** repository.  Themes can be configured to use sounds using the configuration files in their respective icon directory.

BIN
app/src/main/assets/assets/sounds/SOMETHING.wav


BIN
app/src/main/assets/assets/sounds/SOMETHING_R.wav


BIN
app/src/main/assets/assets/sounds/UP.wav


BIN
app/src/main/assets/assets/sounds/UP_R.wav


BIN
app/src/main/assets/assets/sounds/bgm.ogg


BIN
app/src/main/assets/assets/sounds/cancel.ogg


+ 0 - 14
app/src/main/assets/assets/sounds/convert_ogg.sh

@@ -1,14 +0,0 @@
-# Script to convert to OGG, rename to lowercase and copy chosen sounds
-# requires ffmpeg and libvorbis/libogg
-SOUNDS="OK.wav CANCEL.wav BGM.wav UP.wav DOWN.wav LAUNCH.wav NOTICE.wav NOTICE_BACK.wav"
-
-mkdir -p ../../sounds
-for src in $SOUNDS; do
-        export dest=`echo $src | sed "s/.wav/.ogg/"`
-        export dest=`echo "$dest" | tr '[:upper:]' '[:lower:]'`
-        echo "$src -> $dest"
-        
-        ffmpeg -i $src -acodec libvorbis ../../sounds/$dest
-done
-        
-cp Licence.txt ../../sounds/Licence.txt

BIN
app/src/main/assets/assets/sounds/down.ogg


BIN
app/src/main/assets/assets/sounds/launch.ogg


BIN
app/src/main/assets/assets/sounds/notice.ogg


BIN
app/src/main/assets/assets/sounds/notice_back.ogg


BIN
app/src/main/assets/assets/sounds/ok.ogg


BIN
app/src/main/assets/assets/sounds/unlock.ogg


BIN
app/src/main/assets/assets/sounds/up.ogg


+ 4 - 4
app/src/main/cpp/CMakeLists.txt

@@ -111,15 +111,15 @@ target_compile_definitions(${PROJECT_NAME} PRIVATE
         HAVE_KEYMAPPER
         # HAVE_NETWORKGAMEPAD
         HAVE_FLAC
-        HAVE_DR_FLAC
-        HAVE_DR_MP3
+        # HAVE_DR_FLAC
+        # HAVE_DR_MP3
         HAVE_CHD
         WANT_SUBCODE
         WANT_RAW_DATA_SECTOR
         HAVE_RUNAHEAD
         ENABLE_HLSL
-        HAVE_AUDIOMIXER
-        HAVE_RWAV
+        # HAVE_AUDIOMIXER
+        # HAVE_RWAV
         # WANT_IFADDRS
         HAVE_CORE_INFO_CACHE)
 

+ 2 - 2
app/src/main/cpp/gfx/video_filters/normal5x.c

@@ -120,7 +120,7 @@ static void work_cb_xrgb8888(void *data, void *thread_data) {
 
         /* Row 1 */
         for (x = 0; x < thr->width; ++x) {
-            out_ptr[0] = out_ptr[1] = out_ptr[2] = out_ptr[4] = out_ptr[5] = *(input + x);
+            out_ptr[0] = out_ptr[1] = out_ptr[2] = out_ptr[3] = out_ptr[4] = *(input + x);
             out_ptr += 5;
         }
 
@@ -157,7 +157,7 @@ static void work_cb_rgb565(void *data, void *thread_data) {
 
         /* Row 1 */
         for (x = 0; x < thr->width; ++x) {
-            out_ptr[0] = out_ptr[1] = out_ptr[2] = out_ptr[4] = out_ptr[5] = *(input + x);
+            out_ptr[0] = out_ptr[1] = out_ptr[2] = out_ptr[3] = out_ptr[4] = *(input + x);
             out_ptr += 5;
         }
 

+ 0 - 377
app/src/main/cpp/libretro-common/audio/audio_mix.c

@@ -1,377 +0,0 @@
-/* Copyright  (C) 2010-2020 The RetroArch team
- *
- * ---------------------------------------------------------------------------------------
- * The following license statement only applies to this file (audio_mix.c).
- * ---------------------------------------------------------------------------------------
- *
- * Permission is hereby granted, free of charge,
- * to any person obtaining a copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
- * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <memalign.h>
-
-#include <retro_environment.h>
-
-#if defined(__SSE2__)
-#include <emmintrin.h>
-#elif defined(__ALTIVEC__)
-#include <altivec.h>
-#endif
-
-#include <retro_miscellaneous.h>
-#include <audio/audio_mix.h>
-#include <streams/file_stream.h>
-#include <audio/conversion/float_to_s16.h>
-#include <audio/conversion/s16_to_float.h>
-
-void audio_mix_volume_C(float *out, const float *in, float vol, size_t samples)
-{
-   size_t i;
-   for (i = 0; i < samples; i++)
-      out[i] += in[i] * vol;
-}
-
-#ifdef __SSE2__
-void audio_mix_volume_SSE2(float *out, const float *in, float vol, size_t samples)
-{
-   size_t i, remaining_samples;
-   __m128 volume = _mm_set1_ps(vol);
-
-   for (i = 0; i + 16 <= samples; i += 16, out += 16, in += 16)
-   {
-      unsigned j;
-      __m128 input[4];
-      __m128 additive[4];
-
-      input[0]    = _mm_loadu_ps(out +  0);
-      input[1]    = _mm_loadu_ps(out +  4);
-      input[2]    = _mm_loadu_ps(out +  8);
-      input[3]    = _mm_loadu_ps(out + 12);
-
-      additive[0] = _mm_mul_ps(volume, _mm_loadu_ps(in +  0));
-      additive[1] = _mm_mul_ps(volume, _mm_loadu_ps(in +  4));
-      additive[2] = _mm_mul_ps(volume, _mm_loadu_ps(in +  8));
-      additive[3] = _mm_mul_ps(volume, _mm_loadu_ps(in + 12));
-
-      for (j = 0; j < 4; j++)
-         _mm_storeu_ps(out + 4 * j, _mm_add_ps(input[j], additive[j]));
-   }
-
-   remaining_samples = samples - i;
-
-   for (i = 0; i < remaining_samples; i++)
-      out[i] += in[i] * vol;
-}
-#endif
-
-void audio_mix_free_chunk(audio_chunk_t *chunk)
-{
-   if (!chunk)
-      return;
-
-#ifdef HAVE_RWAV
-   if (chunk->rwav && chunk->rwav->samples)
-   {
-      /* rwav_free only frees the samples */
-      rwav_free(chunk->rwav);
-      free(chunk->rwav);
-   }
-#endif
-
-   if (chunk->buf)
-      free(chunk->buf);
-
-   if (chunk->upsample_buf)
-      memalign_free(chunk->upsample_buf);
-
-   if (chunk->float_buf)
-      memalign_free(chunk->float_buf);
-
-   if (chunk->float_resample_buf)
-      memalign_free(chunk->float_resample_buf);
-
-   if (chunk->resample_buf)
-      memalign_free(chunk->resample_buf);
-
-   if (chunk->resampler && chunk->resampler_data)
-      chunk->resampler->free(chunk->resampler_data);
-
-   free(chunk);
-}
-
-audio_chunk_t* audio_mix_load_wav_file(const char *path, int sample_rate,
-      const char *resampler_ident, enum resampler_quality quality)
-{
-#ifdef HAVE_RWAV
-   int sample_size;
-   int64_t len                = 0;
-   void *buf                  = NULL;
-   audio_chunk_t *chunk       = (audio_chunk_t*)malloc(sizeof(*chunk));
-
-   if (!chunk)
-      return NULL;
-
-   chunk->buf                 = NULL;
-   chunk->upsample_buf        = NULL;
-   chunk->float_buf           = NULL;
-   chunk->float_resample_buf  = NULL;
-   chunk->resample_buf        = NULL;
-   chunk->len                 = 0;
-   chunk->resample_len        = 0;
-   chunk->sample_rate         = sample_rate;
-   chunk->resample            = false;
-   chunk->resampler           = NULL;
-   chunk->resampler_data      = NULL;
-   chunk->ratio               = 0.00f;
-   chunk->rwav                = (rwav_t*)malloc(sizeof(rwav_t));
-
-   if (!chunk->rwav)
-      goto error;
-
-   chunk->rwav->bitspersample = 0;
-   chunk->rwav->numchannels   = 0;
-   chunk->rwav->samplerate    = 0;
-   chunk->rwav->numsamples    = 0;
-   chunk->rwav->subchunk2size = 0;
-   chunk->rwav->samples       = NULL;
-
-   if (!filestream_read_file(path, &buf, &len))
-      goto error;
-
-   chunk->buf                 = buf;
-   chunk->len                 = len;
-
-   if (rwav_load(chunk->rwav, chunk->buf, chunk->len) == RWAV_ITERATE_ERROR)
-      goto error;
-
-   /* numsamples does not know or care about
-    * multiple channels, but we need space for 2 */
-   chunk->upsample_buf        = (int16_t*)memalign_alloc(128,
-         chunk->rwav->numsamples * 2 * sizeof(int16_t));
-
-   sample_size                = chunk->rwav->bitspersample / 8;
-
-   if (sample_size == 1)
-   {
-      unsigned i;
-
-      if (chunk->rwav->numchannels == 1)
-      {
-         for (i = 0; i < chunk->rwav->numsamples; i++)
-         {
-            uint8_t *sample                  = (
-                  (uint8_t*)chunk->rwav->samples) + i;
-
-            chunk->upsample_buf[i * 2]       = 
-               (int16_t)((sample[0] - 128) << 8);
-            chunk->upsample_buf[(i * 2) + 1] = 
-               (int16_t)((sample[0] - 128) << 8);
-         }
-      }
-      else if (chunk->rwav->numchannels == 2)
-      {
-         for (i = 0; i < chunk->rwav->numsamples; i++)
-         {
-            uint8_t *sample                  = (
-                  (uint8_t*)chunk->rwav->samples) +
-               (i * 2);
-
-            chunk->upsample_buf[i * 2]       = 
-               (int16_t)((sample[0] - 128) << 8);
-            chunk->upsample_buf[(i * 2) + 1] = 
-               (int16_t)((sample[1] - 128) << 8);
-         }
-      }
-   }
-   else if (sample_size == 2)
-   {
-      if (chunk->rwav->numchannels == 1)
-      {
-         unsigned i;
-
-         for (i = 0; i < chunk->rwav->numsamples; i++)
-         {
-            int16_t sample                   = ((int16_t*)
-                  chunk->rwav->samples)[i];
-
-            chunk->upsample_buf[i * 2]       = sample;
-            chunk->upsample_buf[(i * 2) + 1] = sample;
-         }
-      }
-      else if (chunk->rwav->numchannels == 2)
-         memcpy(chunk->upsample_buf, chunk->rwav->samples,
-               chunk->rwav->subchunk2size);
-   }
-   else if (sample_size != 2)
-   {
-      /* we don't support any other sample size besides 8 and 16-bit yet */
-      goto error;
-   }
-
-   if (sample_rate != (int)chunk->rwav->samplerate)
-   {
-      chunk->resample = true;
-      chunk->ratio    = (double)sample_rate / chunk->rwav->samplerate;
-
-      retro_resampler_realloc(&chunk->resampler_data,
-            &chunk->resampler,
-            resampler_ident,
-            quality,
-            chunk->ratio);
-
-      if (chunk->resampler && chunk->resampler_data)
-      {
-         struct resampler_data info;
-
-         chunk->float_buf          = (float*)memalign_alloc(128,
-               chunk->rwav->numsamples * 2 * 
-               chunk->ratio * sizeof(float));
-
-         /* why is *3 needed instead of just *2? Does the 
-          * sinc driver require more space than we know about? */
-         chunk->float_resample_buf = (float*)memalign_alloc(128,
-               chunk->rwav->numsamples * 3 * 
-               chunk->ratio * sizeof(float));
-
-         convert_s16_to_float(chunk->float_buf,
-               chunk->upsample_buf, chunk->rwav->numsamples * 2, 1.0);
-
-         info.data_in       = (const float*)chunk->float_buf;
-         info.data_out      = chunk->float_resample_buf;
-         /* a 'frame' consists of two channels, so we set this
-          * to the number of samples irrespective of channel count */
-         info.input_frames  = chunk->rwav->numsamples;
-         info.output_frames = 0;
-         info.ratio         = chunk->ratio;
-
-         chunk->resampler->process(chunk->resampler_data, &info);
-
-         /* number of output_frames does not increase with 
-          * multiple channels, but assume we need space for 2 */
-         chunk->resample_buf = (int16_t*)memalign_alloc(128,
-               info.output_frames * 2 * sizeof(int16_t));
-         chunk->resample_len = info.output_frames;
-         convert_float_to_s16(chunk->resample_buf,
-               chunk->float_resample_buf, info.output_frames * 2);
-      }
-   }
-
-   return chunk;
-
-error:
-   audio_mix_free_chunk(chunk);
-#endif
-   return NULL;
-}
-
-size_t audio_mix_get_chunk_num_samples(audio_chunk_t *chunk)
-{
-   if (!chunk)
-      return 0;
-
-#ifdef HAVE_RWAV
-   if (chunk->rwav)
-   {
-      if (chunk->resample)
-         return chunk->resample_len;
-      return chunk->rwav->numsamples;
-   }
-#endif
-
-   /* no other filetypes supported yet */
-   return 0;
-}
-
-/**
- * audio_mix_get_chunk_sample:
- * @chunk              : audio chunk instance
- * @channel            : channel of the sample (0=left, 1=right)
- * @index              : index of the sample
- *
- * Get a sample from an audio chunk.
- *
- * Returns: A signed 16-bit audio sample.
- **/
-int16_t audio_mix_get_chunk_sample(audio_chunk_t *chunk,
-      unsigned channel, size_t index)
-{
-   if (!chunk)
-      return 0;
-
-#ifdef HAVE_RWAV
-   if (chunk->rwav)
-   {
-      int sample_size    = chunk->rwav->bitspersample / 8;
-      int16_t sample_out = 0;
-
-      /* 0 is the first/left channel */
-      uint8_t *sample    = NULL;
-
-      if (chunk->resample)
-         sample = (uint8_t*)chunk->resample_buf +
-            (sample_size * index * chunk->rwav->numchannels) 
-            + (channel * sample_size);
-      else
-         sample = (uint8_t*)chunk->upsample_buf +
-            (sample_size * index * chunk->rwav->numchannels) 
-            + (channel * sample_size);
-
-      sample_out = (int16_t)*sample;
-
-      return sample_out;
-   }
-#endif
-
-   /* no other filetypes supported yet */
-   return 0;
-}
-
-int16_t* audio_mix_get_chunk_samples(audio_chunk_t *chunk)
-{
-   if (!chunk)
-      return 0;
-
-#ifdef HAVE_RWAV
-   if (chunk->rwav)
-   {
-      int16_t *sample;
-
-      if (chunk->resample)
-         sample = chunk->resample_buf;
-      else
-         sample = chunk->upsample_buf;
-
-      return sample;
-   }
-#endif
-
-   return NULL;
-}
-
-int audio_mix_get_chunk_num_channels(audio_chunk_t *chunk)
-{
-   if (!chunk)
-      return 0;
-
-#ifdef HAVE_RWAV
-   if (chunk->rwav)
-      return chunk->rwav->numchannels;
-#endif
-
-   /* don't support other formats yet */
-   return 0;
-}

+ 0 - 1400
app/src/main/cpp/libretro-common/audio/audio_mixer.c

@@ -1,1400 +0,0 @@
-/* Copyright  (C) 2010-2020 The RetroArch team
- *
- * ---------------------------------------------------------------------------------------
- * The following license statement only applies to this file (audio_mixer.c).
- * ---------------------------------------------------------------------------------------
- *
- * Permission is hereby granted, free of charge,
- * to any person obtaining a copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
- * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "../../config.h"
-#endif
-
-#include <audio/audio_mixer.h>
-#include <audio/audio_resampler.h>
-
-#ifdef HAVE_RWAV
-#include <formats/rwav.h>
-#endif
-#include <memalign.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#ifdef HAVE_STB_VORBIS
-#define STB_VORBIS_NO_PUSHDATA_API
-#define STB_VORBIS_NO_STDIO
-#define STB_VORBIS_NO_CRT
-
-#include <stb/stb_vorbis.h>
-#endif
-
-#ifdef HAVE_DR_FLAC
-#define DR_FLAC_IMPLEMENTATION
-#include <dr/dr_flac.h>
-#endif
-
-#ifdef HAVE_DR_MP3
-#define DR_MP3_IMPLEMENTATION
-#include <retro_assert.h>
-#define DRMP3_ASSERT(expression) retro_assert(expression)
-#include <dr/dr_mp3.h>
-#endif
-
-#ifdef HAVE_IBXM
-#include <ibxm/ibxm.h>
-#endif
-
-#ifdef HAVE_THREADS
-#include <rthreads/rthreads.h>
-#define AUDIO_MIXER_LOCK(voice)   slock_lock(voice->lock)
-#define AUDIO_MIXER_UNLOCK(voice) slock_unlock(voice->lock)
-#else
-#define AUDIO_MIXER_LOCK(voice)   do {} while(0)
-#define AUDIO_MIXER_UNLOCK(voice) do {} while(0)
-#endif
-
-#define AUDIO_MIXER_MAX_VOICES      8
-#define AUDIO_MIXER_TEMP_BUFFER 8192
-
-struct audio_mixer_sound
-{
-   enum audio_mixer_type type;
-
-   union
-   {
-      struct
-      {
-         /* wav */
-         const float* pcm;
-         unsigned frames;
-      } wav;
-
-#ifdef HAVE_STB_VORBIS
-      struct
-      {
-         /* ogg */
-         const void* data;
-         unsigned size;
-      } ogg;
-#endif
-
-#ifdef HAVE_DR_FLAC
-      struct
-      {
-          /* flac */
-         const void* data;
-         unsigned size;
-      } flac;
-#endif
-
-#ifdef HAVE_DR_MP3
-      struct
-      {
-          /* mp */
-         const void* data;
-         unsigned size;
-      } mp3;
-#endif
-
-#ifdef HAVE_IBXM
-      struct
-      {
-         /* mod/s3m/xm */
-         const void* data;
-         unsigned size;
-      } mod;
-#endif
-   } types;
-};
-
-struct audio_mixer_voice
-{
-   struct
-   {
-      struct
-      {
-         unsigned position;
-      } wav;
-
-#ifdef HAVE_STB_VORBIS
-      struct
-      {
-         stb_vorbis *stream;
-         void       *resampler_data;
-         const retro_resampler_t *resampler;
-         float      *buffer;
-         unsigned    position;
-         unsigned    samples;
-         unsigned    buf_samples;
-         float       ratio;
-      } ogg;
-#endif
-
-#ifdef HAVE_DR_FLAC
-      struct
-      {
-         float*      buffer;
-         drflac      *stream;
-         void        *resampler_data;
-         const retro_resampler_t *resampler;
-         unsigned    position;
-         unsigned    samples;
-         unsigned    buf_samples;
-         float       ratio;
-      } flac;
-#endif
-
-#ifdef HAVE_DR_MP3
-      struct
-      {
-         drmp3       stream;
-         void        *resampler_data;
-         const retro_resampler_t *resampler;
-         float*      buffer;
-         unsigned    position;
-         unsigned    samples;
-         unsigned    buf_samples;
-         float       ratio;
-      } mp3;
-#endif
-
-#ifdef HAVE_IBXM
-      struct
-      {
-         int*              buffer;
-         struct replay*    stream;
-         struct module*    module;
-         unsigned          position;
-         unsigned          samples;
-         unsigned          buf_samples;
-      } mod;
-#endif
-   } types;
-   audio_mixer_sound_t *sound;
-   audio_mixer_stop_cb_t stop_cb;
-   unsigned type;
-   float    volume;
-   bool     repeat;
-#ifdef HAVE_THREADS
-   slock_t *lock;
-#endif
-};
-
-/* TODO/FIXME - static globals */
-static struct audio_mixer_voice s_voices[AUDIO_MIXER_MAX_VOICES] = {};
-static unsigned s_rate = 0;
-
-static void audio_mixer_release(audio_mixer_voice_t* voice);
-
-#ifdef HAVE_RWAV
-static bool wav_to_float(const rwav_t* wav, float** pcm, size_t samples_out)
-{
-   size_t i;
-   /* Allocate on a 16-byte boundary, and pad to a multiple of 16 bytes */
-   float *f           = (float*)memalign_alloc(16,
-         ((samples_out + 15) & ~15) * sizeof(float));
-
-   if (!f)
-      return false;
-
-   *pcm = f;
-
-   if (wav->bitspersample == 8)
-   {
-      float sample      = 0.0f;
-      const uint8_t *u8 = (const uint8_t*)wav->samples;
-
-      if (wav->numchannels == 1)
-      {
-         for (i = wav->numsamples; i != 0; i--)
-         {
-            sample = (float)*u8++ / 255.0f;
-            sample = sample * 2.0f - 1.0f;
-            *f++   = sample;
-            *f++   = sample;
-         }
-      }
-      else if (wav->numchannels == 2)
-      {
-         for (i = wav->numsamples; i != 0; i--)
-         {
-            sample = (float)*u8++ / 255.0f;
-            sample = sample * 2.0f - 1.0f;
-            *f++   = sample;
-            sample = (float)*u8++ / 255.0f;
-            sample = sample * 2.0f - 1.0f;
-            *f++   = sample;
-         }
-      }
-   }
-   else
-   {
-      /* TODO/FIXME note to leiradel - can we use audio/conversion/s16_to_float
-       * functions here? */
-
-      float sample       = 0.0f;
-      const int16_t *s16 = (const int16_t*)wav->samples;
-
-      if (wav->numchannels == 1)
-      {
-         for (i = wav->numsamples; i != 0; i--)
-         {
-            sample = (float)((int)*s16++ + 32768) / 65535.0f;
-            sample = sample * 2.0f - 1.0f;
-            *f++   = sample;
-            *f++   = sample;
-         }
-      }
-      else if (wav->numchannels == 2)
-      {
-         for (i = wav->numsamples; i != 0; i--)
-         {
-            sample = (float)((int)*s16++ + 32768) / 65535.0f;
-            sample = sample * 2.0f - 1.0f;
-            *f++   = sample;
-            sample = (float)((int)*s16++ + 32768) / 65535.0f;
-            sample = sample * 2.0f - 1.0f;
-            *f++   = sample;
-         }
-      }
-   }
-
-   return true;
-}
-
-static bool one_shot_resample(const float* in, size_t samples_in,
-      unsigned rate, const char *resampler_ident, enum resampler_quality quality,
-      float** out, size_t* samples_out)
-{
-   struct resampler_data info;
-   void* data                         = NULL;
-   const retro_resampler_t* resampler = NULL;
-   float ratio                        = (double)s_rate / (double)rate;
-
-   if (!retro_resampler_realloc(&data, &resampler,
-         resampler_ident, quality, ratio))
-      return false;
-
-   /* Allocate on a 16-byte boundary, and pad to a multiple of 16 bytes. We
-    * add 16 more samples in the formula below just as safeguard, because
-    * resampler->process sometimes reports more output samples than the
-    * formula below calculates. Ideally, audio resamplers should have a
-    * function to return the number of samples they will output given a
-    * count of input samples. */
-   *samples_out                       = (size_t)(samples_in * ratio);
-   *out                               = (float*)memalign_alloc(16,
-         (((*samples_out + 16) + 15) & ~15) * sizeof(float));
-
-   if (*out == NULL)
-      return false;
-
-   info.data_in                       = in;
-   info.data_out                      = *out;
-   info.input_frames                  = samples_in / 2;
-   info.output_frames                 = 0;
-   info.ratio                         = ratio;
-
-   resampler->process(data, &info);
-   resampler->free(data);
-   return true;
-}
-#endif
-
-void audio_mixer_init(unsigned rate)
-{
-   unsigned i;
-
-   s_rate = rate;
-
-   for (i = 0; i < AUDIO_MIXER_MAX_VOICES; i++)
-   {
-      audio_mixer_voice_t *voice = &s_voices[i];
-
-      voice->type = AUDIO_MIXER_TYPE_NONE;
-#ifdef HAVE_THREADS
-      if (!voice->lock)
-         voice->lock = slock_new();
-#endif
-   }
-}
-
-void audio_mixer_done(void)
-{
-   unsigned i;
-
-   for (i = 0; i < AUDIO_MIXER_MAX_VOICES; i++)
-   {
-      audio_mixer_voice_t *voice = &s_voices[i];
-
-      AUDIO_MIXER_LOCK(voice);
-      audio_mixer_release(voice);
-      AUDIO_MIXER_UNLOCK(voice);
-#ifdef HAVE_THREADS
-      slock_free(voice->lock);
-      voice->lock = NULL;
-#endif
-   }
-}
-
-audio_mixer_sound_t* audio_mixer_load_wav(void *buffer, int32_t size,
-      const char *resampler_ident, enum resampler_quality quality)
-{
-#ifdef HAVE_RWAV
-   /* WAV data */
-   rwav_t wav;
-   /* WAV samples converted to float */
-   float* pcm                 = NULL;
-   size_t samples             = 0;
-   /* Result */
-   audio_mixer_sound_t* sound = NULL;
-
-   wav.bitspersample          = 0;
-   wav.numchannels            = 0;
-   wav.samplerate             = 0;
-   wav.numsamples             = 0;
-   wav.subchunk2size          = 0;
-   wav.samples                = NULL;
-
-   if ((rwav_load(&wav, buffer, size)) != RWAV_ITERATE_DONE)
-      return NULL;
-
-   samples       = wav.numsamples * 2;
-
-   if (!wav_to_float(&wav, &pcm, samples))
-      return NULL;
-
-   if (wav.samplerate != s_rate)
-   {
-      float* resampled           = NULL;
-
-      if (!one_shot_resample(pcm, samples, wav.samplerate,
-            resampler_ident, quality,
-            &resampled, &samples))
-         return NULL;
-
-      memalign_free((void*)pcm);
-      pcm = resampled;
-   }
-
-   sound = (audio_mixer_sound_t*)calloc(1, sizeof(*sound));
-
-   if (!sound)
-   {
-      memalign_free((void*)pcm);
-      return NULL;
-   }
-
-   sound->type             = AUDIO_MIXER_TYPE_WAV;
-   sound->types.wav.frames = (unsigned)(samples / 2);
-   sound->types.wav.pcm    = pcm;
-
-   rwav_free(&wav);
-
-   return sound;
-#else
-   return NULL;
-#endif
-}
-
-audio_mixer_sound_t* audio_mixer_load_ogg(void *buffer, int32_t size)
-{
-#ifdef HAVE_STB_VORBIS
-   audio_mixer_sound_t* sound = (audio_mixer_sound_t*)calloc(1, sizeof(*sound));
-
-   if (!sound)
-      return NULL;
-
-   sound->type           = AUDIO_MIXER_TYPE_OGG;
-   sound->types.ogg.size = size;
-   sound->types.ogg.data = buffer;
-
-   return sound;
-#else
-   return NULL;
-#endif
-}
-
-audio_mixer_sound_t* audio_mixer_load_flac(void *buffer, int32_t size)
-{
-#ifdef HAVE_DR_FLAC
-   audio_mixer_sound_t* sound = (audio_mixer_sound_t*)calloc(1, sizeof(*sound));
-
-   if (!sound)
-      return NULL;
-
-   sound->type           = AUDIO_MIXER_TYPE_FLAC;
-   sound->types.flac.size = size;
-   sound->types.flac.data = buffer;
-
-   return sound;
-#else
-   return NULL;
-#endif
-}
-
-audio_mixer_sound_t* audio_mixer_load_mp3(void *buffer, int32_t size)
-{
-#ifdef HAVE_DR_MP3
-   audio_mixer_sound_t* sound = (audio_mixer_sound_t*)calloc(1, sizeof(*sound));
-
-   if (!sound)
-      return NULL;
-
-   sound->type           = AUDIO_MIXER_TYPE_MP3;
-   sound->types.mp3.size = size;
-   sound->types.mp3.data = buffer;
-
-   return sound;
-#else
-   return NULL;
-#endif
-}
-
-audio_mixer_sound_t* audio_mixer_load_mod(void *buffer, int32_t size)
-{
-#ifdef HAVE_IBXM
-   audio_mixer_sound_t* sound = (audio_mixer_sound_t*)calloc(1, sizeof(*sound));
-
-   if (!sound)
-      return NULL;
-
-   sound->type           = AUDIO_MIXER_TYPE_MOD;
-   sound->types.mod.size = size;
-   sound->types.mod.data = buffer;
-
-   return sound;
-#else
-   return NULL;
-#endif
-}
-
-void audio_mixer_destroy(audio_mixer_sound_t* sound)
-{
-   void *handle = NULL;
-   if (!sound)
-      return;
-
-   switch (sound->type)
-   {
-      case AUDIO_MIXER_TYPE_WAV:
-         handle = (void*)sound->types.wav.pcm;
-         if (handle)
-            memalign_free(handle);
-         break;
-      case AUDIO_MIXER_TYPE_OGG:
-#ifdef HAVE_STB_VORBIS
-         handle = (void*)sound->types.ogg.data;
-         if (handle)
-            free(handle);
-#endif
-         break;
-      case AUDIO_MIXER_TYPE_MOD:
-#ifdef HAVE_IBXM
-         handle = (void*)sound->types.mod.data;
-         if (handle)
-            free(handle);
-#endif
-         break;
-      case AUDIO_MIXER_TYPE_FLAC:
-#ifdef HAVE_DR_FLAC
-         handle = (void*)sound->types.flac.data;
-         if (handle)
-            free(handle);
-#endif
-         break;
-      case AUDIO_MIXER_TYPE_MP3:
-#ifdef HAVE_DR_MP3
-         handle = (void*)sound->types.mp3.data;
-         if (handle)
-            free(handle);
-#endif
-         break;
-      case AUDIO_MIXER_TYPE_NONE:
-         break;
-   }
-
-   free(sound);
-}
-
-static bool audio_mixer_play_wav(audio_mixer_sound_t* sound,
-      audio_mixer_voice_t* voice, bool repeat, float volume,
-      audio_mixer_stop_cb_t stop_cb)
-{
-   voice->types.wav.position = 0;
-   return true;
-}
-
-#ifdef HAVE_STB_VORBIS
-static bool audio_mixer_play_ogg(
-      audio_mixer_sound_t* sound,
-      audio_mixer_voice_t* voice,
-      bool repeat, float volume,
-      const char *resampler_ident,
-      enum resampler_quality quality,
-      audio_mixer_stop_cb_t stop_cb)
-{
-   stb_vorbis_info info;
-   int res                         = 0;
-   float ratio                     = 1.0f;
-   unsigned samples                = 0;
-   void *ogg_buffer                = NULL;
-   void *resampler_data            = NULL;
-   const retro_resampler_t* resamp = NULL;
-   stb_vorbis *stb_vorbis          = stb_vorbis_open_memory(
-         (const unsigned char*)sound->types.ogg.data,
-         sound->types.ogg.size, &res, NULL);
-
-   if (!stb_vorbis)
-      return false;
-
-   info                    = stb_vorbis_get_info(stb_vorbis);
-
-   if (info.sample_rate != s_rate)
-   {
-      ratio = (double)s_rate / (double)info.sample_rate;
-
-      if (!retro_resampler_realloc(&resampler_data,
-               &resamp, resampler_ident, quality,
-               ratio))
-         goto error;
-   }
-
-   /* Allocate on a 16-byte boundary, and pad to a multiple of 16 bytes. We
-    * add 16 more samples in the formula below just as safeguard, because
-    * resampler->process sometimes reports more output samples than the
-    * formula below calculates. Ideally, audio resamplers should have a
-    * function to return the number of samples they will output given a
-    * count of input samples. */
-   samples                         = (unsigned)(AUDIO_MIXER_TEMP_BUFFER * ratio);
-   ogg_buffer                      = (float*)memalign_alloc(16,
-         (((samples + 16) + 15) & ~15) * sizeof(float));
-
-   if (!ogg_buffer)
-   {
-      if (resamp && resampler_data)
-         resamp->free(resampler_data);
-      goto error;
-   }
-
-   voice->types.ogg.resampler      = resamp;
-   voice->types.ogg.resampler_data = resampler_data;
-   voice->types.ogg.buffer         = (float*)ogg_buffer;
-   voice->types.ogg.buf_samples    = samples;
-   voice->types.ogg.ratio          = ratio;
-   voice->types.ogg.stream         = stb_vorbis;
-   voice->types.ogg.position       = 0;
-   voice->types.ogg.samples        = 0;
-
-   return true;
-
-error:
-   stb_vorbis_close(stb_vorbis);
-   return false;
-}
-
-static void audio_mixer_release_ogg(audio_mixer_voice_t* voice)
-{
-   if (voice->types.ogg.stream)
-      stb_vorbis_close(voice->types.ogg.stream);
-   if (voice->types.ogg.resampler && voice->types.ogg.resampler_data)
-      voice->types.ogg.resampler->free(voice->types.ogg.resampler_data);
-   if (voice->types.ogg.buffer)
-      memalign_free(voice->types.ogg.buffer);
-}
-
-#endif
-
-#ifdef HAVE_IBXM
-static bool audio_mixer_play_mod(
-      audio_mixer_sound_t* sound,
-      audio_mixer_voice_t* voice,
-      bool repeat, float volume,
-      audio_mixer_stop_cb_t stop_cb)
-{
-   struct data data;
-   char message[64];
-   int buf_samples               = 0;
-   int samples                   = 0;
-   void *mod_buffer              = NULL;
-   struct module* module         = NULL;
-   struct replay* replay         = NULL;
-
-   data.buffer                   = (char*)sound->types.mod.data;
-   data.length                   = sound->types.mod.size;
-   module                        = module_load(&data, message);
-
-   if (!module)
-   {
-      printf("audio_mixer_play_mod module_load() failed with error: %s\n", message);
-      goto error;
-   }
-
-   if (voice->types.mod.module)
-      dispose_module(voice->types.mod.module);
-
-   voice->types.mod.module = module;
-
-   replay = new_replay(module, s_rate, 1);
-
-   if (!replay)
-   {
-      printf("audio_mixer_play_mod new_replay() failed\n");
-      goto error;
-   }
-
-   buf_samples = calculate_mix_buf_len(s_rate);
-   mod_buffer  = memalign_alloc(16, ((buf_samples + 15) & ~15) * sizeof(int));
-
-   if (!mod_buffer)
-   {
-      printf("audio_mixer_play_mod cannot allocate mod_buffer !\n");
-      goto error;
-   }
-
-   samples = replay_calculate_duration(replay);
-
-   if (!samples)
-   {
-      printf("audio_mixer_play_mod cannot retrieve duration !\n");
-      goto error;
-   }
-
-   voice->types.mod.buffer         = (int*)mod_buffer;
-   voice->types.mod.buf_samples    = buf_samples;
-   voice->types.mod.stream         = replay;
-   voice->types.mod.position       = 0;
-   voice->types.mod.samples        = 0; /* samples; */
-
-   return true;
-
-error:
-   if (mod_buffer)
-      memalign_free(mod_buffer);
-   if (module)
-      dispose_module(module);
-   return false;
-
-}
-
-static void audio_mixer_release_mod(audio_mixer_voice_t* voice)
-{
-   if (voice->types.mod.stream)
-      dispose_replay(voice->types.mod.stream);
-   if (voice->types.mod.buffer)
-      memalign_free(voice->types.mod.buffer);
-}
-#endif
-
-#ifdef HAVE_DR_FLAC
-static bool audio_mixer_play_flac(
-      audio_mixer_sound_t* sound,
-      audio_mixer_voice_t* voice,
-      bool repeat, float volume,
-      const char *resampler_ident,
-      enum resampler_quality quality,
-      audio_mixer_stop_cb_t stop_cb)
-{
-   float ratio                     = 1.0f;
-   unsigned samples                = 0;
-   void *flac_buffer                = NULL;
-   void *resampler_data            = NULL;
-   const retro_resampler_t* resamp = NULL;
-   drflac *dr_flac          = drflac_open_memory((const unsigned char*)sound->types.flac.data,sound->types.flac.size);
-
-   if (!dr_flac)
-      return false;
-   if (dr_flac->sampleRate != s_rate)
-   {
-      ratio = (double)s_rate / (double)(dr_flac->sampleRate);
-
-      if (!retro_resampler_realloc(&resampler_data,
-               &resamp, resampler_ident, quality,
-               ratio))
-         goto error;
-   }
-
-   /* Allocate on a 16-byte boundary, and pad to a multiple of 16 bytes. We
-    * add 16 more samples in the formula below just as safeguard, because
-    * resampler->process sometimes reports more output samples than the
-    * formula below calculates. Ideally, audio resamplers should have a
-    * function to return the number of samples they will output given a
-    * count of input samples. */
-   samples                         = (unsigned)(AUDIO_MIXER_TEMP_BUFFER * ratio);
-   flac_buffer                     = (float*)memalign_alloc(16,
-         (((samples + 16) + 15) & ~15) * sizeof(float));
-
-   if (!flac_buffer)
-   {
-      if (resamp && resamp->free)
-         resamp->free(resampler_data);
-      goto error;
-   }
-
-   voice->types.flac.resampler      = resamp;
-   voice->types.flac.resampler_data = resampler_data;
-   voice->types.flac.buffer         = (float*)flac_buffer;
-   voice->types.flac.buf_samples    = samples;
-   voice->types.flac.ratio          = ratio;
-   voice->types.flac.stream         = dr_flac;
-   voice->types.flac.position       = 0;
-   voice->types.flac.samples        = 0;
-
-   return true;
-
-error:
-   drflac_close(dr_flac);
-   return false;
-}
-
-static void audio_mixer_release_flac(audio_mixer_voice_t* voice)
-{
-   if (voice->types.flac.stream)
-      drflac_close(voice->types.flac.stream);
-   if (voice->types.flac.resampler && voice->types.flac.resampler_data)
-      voice->types.flac.resampler->free(voice->types.flac.resampler_data);
-   if (voice->types.flac.buffer)
-      memalign_free(voice->types.flac.buffer);
-}
-#endif
-
-#ifdef HAVE_DR_MP3
-static bool audio_mixer_play_mp3(
-      audio_mixer_sound_t* sound,
-      audio_mixer_voice_t* voice,
-      bool repeat, float volume,
-      const char *resampler_ident,
-      enum resampler_quality quality,
-      audio_mixer_stop_cb_t stop_cb)
-{
-   float ratio                     = 1.0f;
-   unsigned samples                = 0;
-   void *mp3_buffer                = NULL;
-   void *resampler_data            = NULL;
-   const retro_resampler_t* resamp = NULL;
-   bool res;
-
-   res = drmp3_init_memory(&voice->types.mp3.stream, (const unsigned char*)sound->types.mp3.data, sound->types.mp3.size, NULL);
-
-   if (!res)
-      return false;
-
-   if (voice->types.mp3.stream.sampleRate != s_rate)
-   {
-      ratio = (double)s_rate / (double)(voice->types.mp3.stream.sampleRate);
-
-      if (!retro_resampler_realloc(&resampler_data,
-               &resamp, resampler_ident, quality,
-               ratio))
-         goto error;
-   }
-
-   /* Allocate on a 16-byte boundary, and pad to a multiple of 16 bytes. We
-    * add 16 more samples in the formula below just as safeguard, because
-    * resampler->process sometimes reports more output samples than the
-    * formula below calculates. Ideally, audio resamplers should have a
-    * function to return the number of samples they will output given a
-    * count of input samples. */
-   samples                         = (unsigned)(AUDIO_MIXER_TEMP_BUFFER * ratio);
-   mp3_buffer                      = (float*)memalign_alloc(16,
-         (((samples + 16) + 15) & ~15) * sizeof(float));
-
-   if (!mp3_buffer)
-   {
-      if (resamp && resampler_data)
-         resamp->free(resampler_data);
-      goto error;
-   }
-
-   voice->types.mp3.resampler      = resamp;
-   voice->types.mp3.resampler_data = resampler_data;
-   voice->types.mp3.buffer         = (float*)mp3_buffer;
-   voice->types.mp3.buf_samples    = samples;
-   voice->types.mp3.ratio          = ratio;
-   voice->types.mp3.position       = 0;
-   voice->types.mp3.samples        = 0;
-
-   return true;
-
-error:
-   drmp3_uninit(&voice->types.mp3.stream);
-   return false;
-}
-
-static void audio_mixer_release_mp3(audio_mixer_voice_t* voice)
-{
-   if (voice->types.mp3.resampler && voice->types.mp3.resampler_data)
-      voice->types.mp3.resampler->free(voice->types.mp3.resampler_data);
-   if (voice->types.mp3.buffer)
-      memalign_free(voice->types.mp3.buffer);
-   if (voice->types.mp3.stream.pData)
-      drmp3_uninit(&voice->types.mp3.stream);
-}
-
-#endif
-
-audio_mixer_voice_t* audio_mixer_play(audio_mixer_sound_t* sound,
-      bool repeat, float volume,
-      const char *resampler_ident,
-      enum resampler_quality quality,
-      audio_mixer_stop_cb_t stop_cb)
-{
-   unsigned i;
-   bool res                   = false;
-   audio_mixer_voice_t* voice = s_voices;
-
-   if (!sound)
-      return NULL;
-
-   for (i = 0; i < AUDIO_MIXER_MAX_VOICES; i++, voice++)
-   {
-      if (voice->type != AUDIO_MIXER_TYPE_NONE)
-         continue;
-
-      AUDIO_MIXER_LOCK(voice);
-
-      if (voice->type != AUDIO_MIXER_TYPE_NONE)
-      {
-         AUDIO_MIXER_UNLOCK(voice);
-         continue;
-      }
-
-      /* claim the voice, also helps with cleanup on error */
-      voice->type = sound->type;
-
-      switch (sound->type)
-      {
-         case AUDIO_MIXER_TYPE_WAV:
-            res = audio_mixer_play_wav(sound, voice, repeat, volume, stop_cb);
-            break;
-         case AUDIO_MIXER_TYPE_OGG:
-#ifdef HAVE_STB_VORBIS
-            res = audio_mixer_play_ogg(sound, voice, repeat, volume,
-                  resampler_ident, quality, stop_cb);
-#endif
-            break;
-         case AUDIO_MIXER_TYPE_MOD:
-#ifdef HAVE_IBXM
-            res = audio_mixer_play_mod(sound, voice, repeat, volume, stop_cb);
-#endif
-            break;
-         case AUDIO_MIXER_TYPE_FLAC:
-#ifdef HAVE_DR_FLAC
-            res = audio_mixer_play_flac(sound, voice, repeat, volume,
-                  resampler_ident, quality, stop_cb);
-#endif
-            break;
-         case AUDIO_MIXER_TYPE_MP3:
-#ifdef HAVE_DR_MP3
-            res = audio_mixer_play_mp3(sound, voice, repeat, volume,
-                  resampler_ident, quality, stop_cb);
-#endif
-            break;
-         case AUDIO_MIXER_TYPE_NONE:
-            break;
-      }
-
-      break;
-   }
-
-   if (res)
-   {
-      voice->repeat   = repeat;
-      voice->volume   = volume;
-      voice->sound    = sound;
-      voice->stop_cb  = stop_cb;
-      AUDIO_MIXER_UNLOCK(voice);
-   }
-   else
-   {
-      if (i < AUDIO_MIXER_MAX_VOICES)
-      {
-         audio_mixer_release(voice);
-         AUDIO_MIXER_UNLOCK(voice);
-      }
-      voice = NULL;
-   }
-
-   return voice;
-}
-
-/* Need to hold lock for voice.  */
-static void audio_mixer_release(audio_mixer_voice_t* voice)
-{
-   if (!voice)
-      return;
-
-   switch (voice->type)
-   {
-#ifdef HAVE_STB_VORBIS
-      case AUDIO_MIXER_TYPE_OGG:
-         audio_mixer_release_ogg(voice);
-         break;
-#endif
-#ifdef HAVE_IBXM
-      case AUDIO_MIXER_TYPE_MOD:
-         audio_mixer_release_mod(voice);
-         break;
-#endif
-#ifdef HAVE_DR_FLAC
-      case AUDIO_MIXER_TYPE_FLAC:
-         audio_mixer_release_flac(voice);
-         break;
-#endif
-#ifdef HAVE_DR_MP3
-      case AUDIO_MIXER_TYPE_MP3:
-         audio_mixer_release_mp3(voice);
-         break;
-#endif
-      default:
-         break;
-   }
-
-   memset(&voice->types, 0, sizeof(voice->types));
-   voice->type = AUDIO_MIXER_TYPE_NONE;
-}
-
-void audio_mixer_stop(audio_mixer_voice_t* voice)
-{
-   audio_mixer_stop_cb_t stop_cb = NULL;
-   audio_mixer_sound_t* sound    = NULL;
-
-   if (voice)
-   {
-      AUDIO_MIXER_LOCK(voice);
-      stop_cb     = voice->stop_cb;
-      sound       = voice->sound;
-
-      audio_mixer_release(voice);
-
-      AUDIO_MIXER_UNLOCK(voice);
-
-      if (stop_cb)
-         stop_cb(sound, AUDIO_MIXER_SOUND_STOPPED);
-   }
-}
-
-static void audio_mixer_mix_wav(float* buffer, size_t num_frames,
-      audio_mixer_voice_t* voice,
-      float volume)
-{
-   int i;
-   unsigned buf_free                = (unsigned)(num_frames * 2);
-   const audio_mixer_sound_t* sound = voice->sound;
-   unsigned pcm_available           = sound->types.wav.frames
-      * 2 - voice->types.wav.position;
-   const float* pcm                 = sound->types.wav.pcm +
-      voice->types.wav.position;
-
-again:
-   if (pcm_available < buf_free)
-   {
-      for (i = pcm_available; i != 0; i--)
-         *buffer++ += *pcm++ * volume;
-
-      if (voice->repeat)
-      {
-         if (voice->stop_cb)
-            voice->stop_cb(voice->sound, AUDIO_MIXER_SOUND_REPEATED);
-
-         buf_free                  -= pcm_available;
-         pcm_available              = sound->types.wav.frames * 2;
-         pcm                        = sound->types.wav.pcm;
-         voice->types.wav.position  = 0;
-         goto again;
-      }
-
-      if (voice->stop_cb)
-         voice->stop_cb(voice->sound, AUDIO_MIXER_SOUND_FINISHED);
-
-      audio_mixer_release(voice);
-   }
-   else
-   {
-      for (i = buf_free; i != 0; i--)
-         *buffer++ += *pcm++ * volume;
-
-      voice->types.wav.position += buf_free;
-   }
-}
-
-#ifdef HAVE_STB_VORBIS
-static void audio_mixer_mix_ogg(float* buffer, size_t num_frames,
-      audio_mixer_voice_t* voice,
-      float volume)
-{
-   int i;
-   float* temp_buffer = NULL;
-   unsigned buf_free                = (unsigned)(num_frames * 2);
-   unsigned temp_samples            = 0;
-   float* pcm                       = NULL;
-
-   if (!voice->types.ogg.stream)
-      return;
-
-   if (voice->types.ogg.position == voice->types.ogg.samples)
-   {
-again:
-      if (temp_buffer == NULL)
-         temp_buffer = (float*)malloc(AUDIO_MIXER_TEMP_BUFFER * sizeof(float));
-
-      temp_samples = stb_vorbis_get_samples_float_interleaved(
-            voice->types.ogg.stream, 2, temp_buffer,
-            AUDIO_MIXER_TEMP_BUFFER) * 2;
-
-      if (temp_samples == 0)
-      {
-         if (voice->repeat)
-         {
-            if (voice->stop_cb)
-               voice->stop_cb(voice->sound, AUDIO_MIXER_SOUND_REPEATED);
-
-            stb_vorbis_seek_start(voice->types.ogg.stream);
-            goto again;
-         }
-
-         if (voice->stop_cb)
-            voice->stop_cb(voice->sound, AUDIO_MIXER_SOUND_FINISHED);
-
-         audio_mixer_release(voice);
-         goto cleanup;
-      }
-
-      if (voice->types.ogg.resampler)
-      {
-         struct resampler_data info;
-         info.data_in = temp_buffer;
-         info.data_out = voice->types.ogg.buffer;
-         info.input_frames = temp_samples / 2;
-         info.output_frames = 0;
-         info.ratio = voice->types.ogg.ratio;
-
-         voice->types.ogg.resampler->process(
-               voice->types.ogg.resampler_data, &info);
-      }
-      else
-         memcpy(voice->types.ogg.buffer, temp_buffer,
-               temp_samples * sizeof(float));
-
-      voice->types.ogg.position = 0;
-      voice->types.ogg.samples  = voice->types.ogg.buf_samples;
-   }
-
-   pcm = voice->types.ogg.buffer + voice->types.ogg.position;
-
-   if (voice->types.ogg.samples < buf_free)
-   {
-      for (i = voice->types.ogg.samples; i != 0; i--)
-         *buffer++ += *pcm++ * volume;
-
-      buf_free -= voice->types.ogg.samples;
-      goto again;
-   }
-
-   for (i = buf_free; i != 0; --i )
-      *buffer++ += *pcm++ * volume;
-
-   voice->types.ogg.position += buf_free;
-   voice->types.ogg.samples  -= buf_free;
-
-cleanup:
-   if (temp_buffer != NULL)
-      free(temp_buffer);
-}
-#endif
-
-#ifdef HAVE_IBXM
-static void audio_mixer_mix_mod(float* buffer, size_t num_frames,
-      audio_mixer_voice_t* voice,
-      float volume)
-{
-   int i;
-   float samplef                    = 0.0f;
-   unsigned temp_samples            = 0;
-   unsigned buf_free                = (unsigned)(num_frames * 2);
-   int* pcm                         = NULL;
-
-   if (voice->types.mod.samples == 0)
-   {
-again:
-      temp_samples = replay_get_audio(
-            voice->types.mod.stream, voice->types.mod.buffer, 0 ) * 2;
-
-      if (temp_samples == 0)
-      {
-         if (voice->repeat)
-         {
-            if (voice->stop_cb)
-               voice->stop_cb(voice->sound, AUDIO_MIXER_SOUND_REPEATED);
-
-            replay_seek( voice->types.mod.stream, 0);
-            goto again;
-         }
-
-         if (voice->stop_cb)
-            voice->stop_cb(voice->sound, AUDIO_MIXER_SOUND_FINISHED);
-
-         audio_mixer_release(voice);
-         return;
-      }
-
-      voice->types.mod.position = 0;
-      voice->types.mod.samples  = temp_samples;
-   }
-   pcm = voice->types.mod.buffer + voice->types.mod.position;
-
-   if (voice->types.mod.samples < buf_free)
-   {
-      for (i = voice->types.mod.samples; i != 0; i--)
-      {
-         samplef     = ((float)(*pcm++) + 32768.0f) / 65535.0f;
-         samplef     = samplef * 2.0f - 1.0f;
-         *buffer++  += samplef * volume;
-      }
-
-      buf_free -= voice->types.mod.samples;
-      goto again;
-   }
-
-   for (i = buf_free; i != 0; --i )
-   {
-      samplef     = ((float)(*pcm++) + 32768.0f) / 65535.0f;
-      samplef     = samplef * 2.0f - 1.0f;
-      *buffer++  += samplef * volume;
-   }
-
-   voice->types.mod.position += buf_free;
-   voice->types.mod.samples  -= buf_free;
-}
-#endif
-
-#ifdef HAVE_DR_FLAC
-static void audio_mixer_mix_flac(float* buffer, size_t num_frames,
-      audio_mixer_voice_t* voice,
-      float volume)
-{
-   int i;
-   struct resampler_data info;
-   float temp_buffer[AUDIO_MIXER_TEMP_BUFFER] = { 0 };
-   unsigned buf_free                = (unsigned)(num_frames * 2);
-   unsigned temp_samples            = 0;
-   float *pcm                       = NULL;
-
-   if (voice->types.flac.position == voice->types.flac.samples)
-   {
-again:
-      temp_samples = (unsigned)drflac_read_f32( voice->types.flac.stream, AUDIO_MIXER_TEMP_BUFFER, temp_buffer);
-      if (temp_samples == 0)
-      {
-         if (voice->repeat)
-         {
-            if (voice->stop_cb)
-               voice->stop_cb(voice->sound, AUDIO_MIXER_SOUND_REPEATED);
-
-            drflac_seek_to_sample(voice->types.flac.stream,0);
-            goto again;
-         }
-
-         if (voice->stop_cb)
-            voice->stop_cb(voice->sound, AUDIO_MIXER_SOUND_FINISHED);
-
-         audio_mixer_release(voice);
-         return;
-      }
-
-      info.data_in              = temp_buffer;
-      info.data_out             = voice->types.flac.buffer;
-      info.input_frames         = temp_samples / 2;
-      info.output_frames        = 0;
-      info.ratio                = voice->types.flac.ratio;
-
-      if (voice->types.flac.resampler)
-         voice->types.flac.resampler->process(
-               voice->types.flac.resampler_data, &info);
-      else
-         memcpy(voice->types.flac.buffer, temp_buffer, temp_samples * sizeof(float));
-      voice->types.flac.position = 0;
-      voice->types.flac.samples  = voice->types.flac.buf_samples;
-   }
-
-   pcm = voice->types.flac.buffer + voice->types.flac.position;
-
-   if (voice->types.flac.samples < buf_free)
-   {
-      for (i = voice->types.flac.samples; i != 0; i--)
-         *buffer++ += *pcm++ * volume;
-
-      buf_free -= voice->types.flac.samples;
-      goto again;
-   }
-
-   for (i = buf_free; i != 0; --i )
-      *buffer++ += *pcm++ * volume;
-
-   voice->types.flac.position += buf_free;
-   voice->types.flac.samples  -= buf_free;
-}
-#endif
-
-#ifdef HAVE_DR_MP3
-static void audio_mixer_mix_mp3(float* buffer, size_t num_frames,
-      audio_mixer_voice_t* voice,
-      float volume)
-{
-   int i;
-   struct resampler_data info;
-   float temp_buffer[AUDIO_MIXER_TEMP_BUFFER] = { 0 };
-   unsigned buf_free                = (unsigned)(num_frames * 2);
-   unsigned temp_samples            = 0;
-   float* pcm                       = NULL;
-
-   if (voice->types.mp3.position == voice->types.mp3.samples)
-   {
-again:
-      temp_samples = (unsigned)drmp3_read_f32(
-            &voice->types.mp3.stream,
-            AUDIO_MIXER_TEMP_BUFFER / 2, temp_buffer) * 2;
-
-      if (temp_samples == 0)
-      {
-         if (voice->repeat)
-         {
-            if (voice->stop_cb)
-               voice->stop_cb(voice->sound, AUDIO_MIXER_SOUND_REPEATED);
-
-            drmp3_seek_to_frame(&voice->types.mp3.stream,0);
-            goto again;
-         }
-
-         if (voice->stop_cb)
-            voice->stop_cb(voice->sound, AUDIO_MIXER_SOUND_FINISHED);
-
-         audio_mixer_release(voice);
-         return;
-      }
-
-      info.data_in              = temp_buffer;
-      info.data_out             = voice->types.mp3.buffer;
-      info.input_frames         = temp_samples / 2;
-      info.output_frames        = 0;
-      info.ratio                = voice->types.mp3.ratio;
-
-      if (voice->types.mp3.resampler)
-         voice->types.mp3.resampler->process(
-               voice->types.mp3.resampler_data, &info);
-      else
-         memcpy(voice->types.mp3.buffer, temp_buffer,
-               temp_samples * sizeof(float));
-      voice->types.mp3.position = 0;
-      voice->types.mp3.samples  = voice->types.mp3.buf_samples;
-   }
-
-   pcm = voice->types.mp3.buffer + voice->types.mp3.position;
-
-   if (voice->types.mp3.samples < buf_free)
-   {
-      for (i = voice->types.mp3.samples; i != 0; i--)
-         *buffer++ += *pcm++ * volume;
-
-      buf_free -= voice->types.mp3.samples;
-      goto again;
-   }
-
-   for (i = buf_free; i != 0; --i )
-      *buffer++ += *pcm++ * volume;
-
-   voice->types.mp3.position += buf_free;
-   voice->types.mp3.samples  -= buf_free;
-}
-#endif
-
-void audio_mixer_mix(float* buffer, size_t num_frames,
-      float volume_override, bool override)
-{
-   unsigned i;
-   size_t j                   = 0;
-   float* sample              = NULL;
-   audio_mixer_voice_t* voice = s_voices;
-
-   for (i = 0; i < AUDIO_MIXER_MAX_VOICES; i++, voice++)
-   {
-      float volume;
-
-      AUDIO_MIXER_LOCK(voice);
-
-      volume = (override) ? volume_override : voice->volume;
-
-      switch (voice->type)
-      {
-         case AUDIO_MIXER_TYPE_WAV:
-            audio_mixer_mix_wav(buffer, num_frames, voice, volume);
-            break;
-         case AUDIO_MIXER_TYPE_OGG:
-#ifdef HAVE_STB_VORBIS
-            audio_mixer_mix_ogg(buffer, num_frames, voice, volume);
-#endif
-            break;
-         case AUDIO_MIXER_TYPE_MOD:
-#ifdef HAVE_IBXM
-            audio_mixer_mix_mod(buffer, num_frames, voice, volume);
-#endif
-            break;
-         case AUDIO_MIXER_TYPE_FLAC:
-#ifdef HAVE_DR_FLAC
-            audio_mixer_mix_flac(buffer, num_frames, voice, volume);
-#endif
-            break;
-            case AUDIO_MIXER_TYPE_MP3:
-#ifdef HAVE_DR_MP3
-            audio_mixer_mix_mp3(buffer, num_frames, voice, volume);
-#endif
-            break;
-         case AUDIO_MIXER_TYPE_NONE:
-            break;
-      }
-
-      AUDIO_MIXER_UNLOCK(voice);
-   }
-
-   for (j = 0, sample = buffer; j < num_frames * 2; j++, sample++)
-   {
-      if (*sample < -1.0f)
-         *sample = -1.0f;
-      else if (*sample > 1.0f)
-         *sample = 1.0f;
-   }
-}
-
-float audio_mixer_voice_get_volume(audio_mixer_voice_t *voice)
-{
-   if (!voice)
-      return 0.0f;
-
-   return voice->volume;
-}
-
-void audio_mixer_voice_set_volume(audio_mixer_voice_t *voice, float val)
-{
-   if (!voice)
-      return;
-
-   AUDIO_MIXER_LOCK(voice);
-   voice->volume = val;
-   AUDIO_MIXER_UNLOCK(voice);
-}

+ 0 - 94
app/src/main/cpp/libretro-common/include/audio/audio_mix.h

@@ -1,94 +0,0 @@
-/* Copyright  (C) 2010-2020 The RetroArch team
- *
- * ---------------------------------------------------------------------------------------
- * The following license statement only applies to this file (audio_mix.h).
- * ---------------------------------------------------------------------------------------
- *
- * Permission is hereby granted, free of charge,
- * to any person obtaining a copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
- * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#ifndef __LIBRETRO_SDK_AUDIO_MIX_H__
-#define __LIBRETRO_SDK_AUDIO_MIX_H__
-
-#include <retro_common_api.h>
-
-#include <stdint.h>
-#include <stddef.h>
-#ifdef _WIN32
-#include <direct.h>
-#else
-#include <unistd.h>
-#endif
-
-#include <formats/rwav.h>
-#include <audio/audio_resampler.h>
-
-RETRO_BEGIN_DECLS
-
-typedef struct
-{
-   double ratio;
-   void *buf;
-   int16_t *upsample_buf;
-   float *float_buf;
-   float *float_resample_buf;
-   int16_t *resample_buf;
-   const retro_resampler_t *resampler;
-   void *resampler_data;
-   rwav_t *rwav;
-   ssize_t len;
-   size_t resample_len;
-   int sample_rate;
-   bool resample;
-} audio_chunk_t;
-
-#if defined(__SSE2__)
-#define audio_mix_volume           audio_mix_volume_SSE2
-
-void audio_mix_volume_SSE2(float *out,
-      const float *in, float vol, size_t samples);
-#else
-#define audio_mix_volume           audio_mix_volume_C
-#endif
-
-void audio_mix_volume_C(float *dst, const float *src, float vol, size_t samples);
-
-void audio_mix_free_chunk(audio_chunk_t *chunk);
-
-audio_chunk_t* audio_mix_load_wav_file(const char *path, int sample_rate,
-      const char *resampler_ident, enum resampler_quality quality);
-
-size_t audio_mix_get_chunk_num_samples(audio_chunk_t *chunk);
-
-/**
- * audio_mix_get_chunk_sample:
- * @chunk              : audio chunk instance
- * @channel            : channel of the sample (0=left, 1=right)
- * @index              : index of the sample
- *
- * Get a sample from an audio chunk.
- *
- * Returns: A signed 16-bit audio sample, (if necessary) resampled into the desired output rate.
- **/
-int16_t audio_mix_get_chunk_sample(audio_chunk_t *chunk, unsigned channel, size_t sample);
-
-int16_t* audio_mix_get_chunk_samples(audio_chunk_t *chunk);
-
-int audio_mix_get_chunk_num_channels(audio_chunk_t *chunk);
-
-RETRO_END_DECLS
-
-#endif

+ 0 - 90
app/src/main/cpp/libretro-common/include/audio/audio_mixer.h

@@ -1,90 +0,0 @@
-/* Copyright  (C) 2010-2020 The RetroArch team
- *
- * ---------------------------------------------------------------------------------------
- * The following license statement only applies to this file (audio_mixer.h).
- * ---------------------------------------------------------------------------------------
- *
- * Permission is hereby granted, free of charge,
- * to any person obtaining a copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
- * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#ifndef __LIBRETRO_SDK_AUDIO_MIXER__H
-#define __LIBRETRO_SDK_AUDIO_MIXER__H
-
-#include <stdint.h>
-#include <stddef.h>
-#include <stdlib.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <boolean.h>
-#include <retro_common_api.h>
-
-#include <audio/audio_resampler.h>
-
-RETRO_BEGIN_DECLS
-
-enum audio_mixer_type
-{
-   AUDIO_MIXER_TYPE_NONE = 0,
-   AUDIO_MIXER_TYPE_WAV,
-   AUDIO_MIXER_TYPE_OGG,
-   AUDIO_MIXER_TYPE_MOD,
-   AUDIO_MIXER_TYPE_FLAC,
-   AUDIO_MIXER_TYPE_MP3
-};
-
-typedef struct audio_mixer_sound audio_mixer_sound_t;
-typedef struct audio_mixer_voice audio_mixer_voice_t;
-
-typedef void (*audio_mixer_stop_cb_t)(audio_mixer_sound_t* sound, unsigned reason);
-
-/* Reasons passed to the stop callback. */
-#define AUDIO_MIXER_SOUND_FINISHED 0
-#define AUDIO_MIXER_SOUND_STOPPED  1
-#define AUDIO_MIXER_SOUND_REPEATED 2
-
-void audio_mixer_init(unsigned rate);
-
-void audio_mixer_done(void);
-
-audio_mixer_sound_t* audio_mixer_load_wav(void *buffer, int32_t size,
-      const char *resampler_ident, enum resampler_quality quality);
-audio_mixer_sound_t* audio_mixer_load_ogg(void *buffer, int32_t size);
-audio_mixer_sound_t* audio_mixer_load_mod(void *buffer, int32_t size);
-audio_mixer_sound_t* audio_mixer_load_flac(void *buffer, int32_t size);
-audio_mixer_sound_t* audio_mixer_load_mp3(void *buffer, int32_t size);
-
-void audio_mixer_destroy(audio_mixer_sound_t* sound);
-
-audio_mixer_voice_t* audio_mixer_play(audio_mixer_sound_t* sound,
-      bool repeat, float volume,
-      const char *resampler_ident,
-      enum resampler_quality quality,
-      audio_mixer_stop_cb_t stop_cb);
-
-void audio_mixer_stop(audio_mixer_voice_t* voice);
-
-float audio_mixer_voice_get_volume(audio_mixer_voice_t *voice);
-
-void audio_mixer_voice_set_volume(audio_mixer_voice_t *voice, float val);
-
-void audio_mixer_mix(float* buffer, size_t num_frames, float volume_override, bool override);
-
-RETRO_END_DECLS
-
-#endif

+ 0 - 702
app/src/main/cpp/tasks/task_audio_mixer.c

@@ -1,702 +0,0 @@
-/*  RetroArch - A frontend for libretro.
- *  Copyright (C) 2011-2017 - Daniel De Matteis
- *
- *  RetroArch is free software: you can redistribute it and/or modify it under the terms
- *  of the GNU General Public License as published by the Free Software Found-
- *  ation, either version 3 of the License, or (at your option) any later version.
- *
- *  RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- *  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- *  PURPOSE.  See the GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License along with RetroArch.
- *  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "tasks_internal.h"
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <file/nbio.h>
-#include <file/file_path.h>
-#include <audio/audio_mixer.h>
-#include <compat/strl.h>
-#include <string/stdstring.h>
-#include <retro_miscellaneous.h>
-#include <queues/task_queue.h>
-
-#include "../file_path_special.h"
-#include "../audio/audio_driver.h"
-#include "../verbosity.h"
-
-#include "task_file_transfer.h"
-#include "tasks_internal.h"
-
-struct audio_mixer_userdata
-{
-   unsigned slot_selection_idx;
-   enum audio_mixer_stream_type stream_type;
-   enum audio_mixer_slot_selection_type slot_selection_type;
-};
-
-struct audio_mixer_handle
-{
-   nbio_buf_t *buffer;
-   retro_task_callback_t cb;
-   enum audio_mixer_type type;
-   char path[4095];
-   bool copy_data_over;
-   bool is_finished;
-};
-
-static void task_audio_mixer_load_free(retro_task_t *task)
-{
-   nbio_handle_t       *nbio        = (nbio_handle_t*)task->state;
-   struct audio_mixer_handle *mixer = (struct audio_mixer_handle*)nbio->data;
-
-   if (mixer)
-   {
-      if (mixer->buffer)
-      {
-         if (mixer->buffer->path)
-            free(mixer->buffer->path);
-         free(mixer->buffer);
-      }
-
-      if (mixer->cb)
-         mixer->cb(task, NULL, NULL, NULL);
-   }
-
-   if (!string_is_empty(nbio->path))
-      free(nbio->path);
-   if (nbio->data)
-      free(nbio->data);
-   nbio_free(nbio->handle);
-   free(nbio);
-}
-
-static int cb_nbio_audio_mixer_load(void *data, size_t len)
-{
-   nbio_handle_t *nbio             = (nbio_handle_t*)data;
-   struct audio_mixer_handle *mixer= (struct audio_mixer_handle*)nbio->data;
-   void *ptr                       = nbio_get_ptr(nbio->handle, &len);
-   nbio_buf_t *buffer              = (nbio_buf_t*)calloc(1, sizeof(*mixer->buffer));
-
-   if (!buffer)
-      return -1;
-
-   mixer->buffer                   = buffer;
-   mixer->buffer->buf              = ptr;
-   mixer->buffer->bufsize          = (unsigned)len;
-   mixer->copy_data_over           = true;
-   nbio->is_finished               = true;
-
-   return 0;
-}
-
-static void task_audio_mixer_handle_upload_ogg(retro_task_t *task,
-      void *task_data,
-      void *user_data, const char *err)
-{
-   audio_mixer_stream_params_t params;
-   nbio_buf_t             *img = (nbio_buf_t*)task_data;
-   struct audio_mixer_userdata *user = (struct audio_mixer_userdata*)user_data;
-   if (!img || !user)
-      return;
-
-   params.volume               = 1.0f;
-   params.slot_selection_type  = user->slot_selection_type;
-   params.slot_selection_idx   = user->slot_selection_idx;
-   params.stream_type          = user->stream_type;
-   params.type                 = AUDIO_MIXER_TYPE_OGG;
-   params.state                = AUDIO_STREAM_STATE_STOPPED;
-   params.buf                  = img->buf;
-   params.bufsize              = img->bufsize;
-   params.cb                   = NULL;
-   params.basename             = !string_is_empty(img->path) ? strdup(path_basename_nocompression(img->path)) : NULL;
-
-   audio_driver_mixer_add_stream(&params);
-
-   if (img->path)
-      free(img->path);
-   if (params.basename != NULL)
-      free(params.basename);
-   free(img);
-   free(user_data);
-}
-
-static void task_audio_mixer_handle_upload_ogg_and_play(retro_task_t *task,
-      void *task_data,
-      void *user_data, const char *err)
-{
-   audio_mixer_stream_params_t params;
-   nbio_buf_t             *img = (nbio_buf_t*)task_data;
-   struct audio_mixer_userdata *user = (struct audio_mixer_userdata*)user_data;
-
-   if (!img || !user)
-      return;
-
-   params.volume               = 1.0f;
-   params.slot_selection_type  = user->slot_selection_type;
-   params.slot_selection_idx   = user->slot_selection_idx;
-   params.stream_type          = user->stream_type;
-   params.type                 = AUDIO_MIXER_TYPE_OGG;
-   params.state                = AUDIO_STREAM_STATE_PLAYING;
-   params.buf                  = img->buf;
-   params.bufsize              = img->bufsize;
-   params.cb                   = NULL;
-   params.basename             = !string_is_empty(img->path) ? strdup(path_basename_nocompression(img->path)) : NULL;
-
-   audio_driver_mixer_add_stream(&params);
-
-   if (img->path)
-      free(img->path);
-   if (params.basename != NULL)
-      free(params.basename);
-   free(img);
-   free(user_data);
-}
-
-static void task_audio_mixer_handle_upload_flac(retro_task_t *task,
-      void *task_data,
-      void *user_data, const char *err)
-{
-   audio_mixer_stream_params_t params;
-   nbio_buf_t             *img = (nbio_buf_t*)task_data;
-   struct audio_mixer_userdata *user = (struct audio_mixer_userdata*)user_data;
-
-   if (!img || !user)
-      return;
-
-   params.volume               = 1.0f;
-   params.slot_selection_type  = user->slot_selection_type;
-   params.slot_selection_idx   = user->slot_selection_idx;
-   params.stream_type          = user->stream_type;
-   params.type                 = AUDIO_MIXER_TYPE_FLAC;
-   params.state                = AUDIO_STREAM_STATE_STOPPED;
-   params.buf                  = img->buf;
-   params.bufsize              = img->bufsize;
-   params.cb                   = NULL;
-   params.basename             = !string_is_empty(img->path) ? strdup(path_basename_nocompression(img->path)) : NULL;
-
-   audio_driver_mixer_add_stream(&params);
-
-   if (img->path)
-      free(img->path);
-   if (params.basename != NULL)
-      free(params.basename);
-   free(img);
-   free(user_data);
-}
-
-static void task_audio_mixer_handle_upload_flac_and_play(retro_task_t *task,
-      void *task_data,
-      void *user_data, const char *err)
-{
-   audio_mixer_stream_params_t params;
-   nbio_buf_t             *img = (nbio_buf_t*)task_data;
-   struct audio_mixer_userdata *user = (struct audio_mixer_userdata*)user_data;
-
-   if (!img || !user)
-      return;
-
-   params.volume               = 1.0f;
-   params.slot_selection_type  = user->slot_selection_type;
-   params.slot_selection_idx   = user->slot_selection_idx;
-   params.stream_type          = user->stream_type;
-   params.type                 = AUDIO_MIXER_TYPE_FLAC;
-   params.state                = AUDIO_STREAM_STATE_PLAYING;
-   params.buf                  = img->buf;
-   params.bufsize              = img->bufsize;
-   params.cb                   = NULL;
-   params.basename             = !string_is_empty(img->path) ? strdup(path_basename_nocompression(img->path)) : NULL;
-
-   audio_driver_mixer_add_stream(&params);
-
-   if (img->path)
-      free(img->path);
-   if (params.basename != NULL)
-      free(params.basename);
-   free(img);
-   free(user_data);
-}
-
-static void task_audio_mixer_handle_upload_mp3(retro_task_t *task,
-      void *task_data,
-      void *user_data, const char *err)
-{
-   audio_mixer_stream_params_t params;
-   nbio_buf_t             *img = (nbio_buf_t*)task_data;
-   struct audio_mixer_userdata *user = (struct audio_mixer_userdata*)user_data;
-
-   if (!img || !user)
-      return;
-
-   params.volume               = 1.0f;
-   params.slot_selection_type  = user->slot_selection_type;
-   params.slot_selection_idx   = user->slot_selection_idx;
-   params.stream_type          = user->stream_type;
-   params.type                 = AUDIO_MIXER_TYPE_MP3;
-   params.state                = AUDIO_STREAM_STATE_STOPPED;
-   params.buf                  = img->buf;
-   params.bufsize              = img->bufsize;
-   params.cb                   = NULL;
-   params.basename             = !string_is_empty(img->path) ? strdup(path_basename_nocompression(img->path)) : NULL;
-
-   audio_driver_mixer_add_stream(&params);
-
-   if (img->path)
-      free(img->path);
-   if (params.basename != NULL)
-      free(params.basename);
-   free(img);
-   free(user_data);
-}
-
-static void task_audio_mixer_handle_upload_mp3_and_play(retro_task_t *task,
-      void *task_data,
-      void *user_data, const char *err)
-{
-   audio_mixer_stream_params_t params;
-   nbio_buf_t             *img = (nbio_buf_t*)task_data;
-   struct audio_mixer_userdata *user = (struct audio_mixer_userdata*)user_data;
-
-   if (!img || !user)
-      return;
-
-   params.volume               = 1.0f;
-   params.slot_selection_type  = user->slot_selection_type;
-   params.slot_selection_idx   = user->slot_selection_idx;
-   params.stream_type          = user->stream_type;
-   params.type                 = AUDIO_MIXER_TYPE_MP3;
-   params.state                = AUDIO_STREAM_STATE_PLAYING;
-   params.buf                  = img->buf;
-   params.bufsize              = img->bufsize;
-   params.cb                   = NULL;
-   params.basename             = !string_is_empty(img->path) ? strdup(path_basename_nocompression(img->path)) : NULL;
-
-   audio_driver_mixer_add_stream(&params);
-
-   if (img->path)
-      free(img->path);
-   if (params.basename != NULL)
-      free(params.basename);
-   free(img);
-   free(user_data);
-}
-
-static void task_audio_mixer_handle_upload_mod(retro_task_t *task,
-      void *task_data,
-      void *user_data, const char *err)
-{
-   audio_mixer_stream_params_t params;
-   nbio_buf_t             *img = (nbio_buf_t*)task_data;
-   struct audio_mixer_userdata *user = (struct audio_mixer_userdata*)user_data;
-
-   if (!img || !user)
-      return;
-
-   params.volume               = 1.0f;
-   params.slot_selection_type  = user->slot_selection_type;
-   params.slot_selection_idx   = user->slot_selection_idx;
-   params.stream_type          = user->stream_type;
-   params.type                 = AUDIO_MIXER_TYPE_MOD;
-   params.state                = AUDIO_STREAM_STATE_STOPPED;
-   params.buf                  = img->buf;
-   params.bufsize              = img->bufsize;
-   params.cb                   = NULL;
-   params.basename             = !string_is_empty(img->path) ? strdup(path_basename_nocompression(img->path)) : NULL;
-
-   audio_driver_mixer_add_stream(&params);
-
-   if (img->path)
-      free(img->path);
-   if (params.basename != NULL)
-      free(params.basename);
-   free(img);
-   free(user_data);
-}
-
-static void task_audio_mixer_handle_upload_mod_and_play(retro_task_t *task,
-      void *task_data,
-      void *user_data, const char *err)
-{
-   audio_mixer_stream_params_t params;
-   nbio_buf_t             *img = (nbio_buf_t*)task_data;
-   struct audio_mixer_userdata *user = (struct audio_mixer_userdata*)user_data;
-
-   if (!img || !user)
-      return;
-
-   params.volume               = 1.0f;
-   params.slot_selection_type  = user->slot_selection_type;
-   params.slot_selection_idx   = user->slot_selection_idx;
-   params.stream_type          = user->stream_type;
-   params.type                 = AUDIO_MIXER_TYPE_MOD;
-   params.state                = AUDIO_STREAM_STATE_PLAYING;
-   params.buf                  = img->buf;
-   params.bufsize              = img->bufsize;
-   params.cb                   = NULL;
-   params.basename             = !string_is_empty(img->path) ? strdup(path_basename_nocompression(img->path)) : NULL;
-
-   audio_driver_mixer_add_stream(&params);
-
-   if (img->path)
-      free(img->path);
-   if (params.basename != NULL)
-      free(params.basename);
-   free(img);
-   free(user_data);
-}
-
-#ifdef HAVE_RWAV
-static void task_audio_mixer_handle_upload_wav(retro_task_t *task,
-      void *task_data,
-      void *user_data, const char *err)
-{
-   audio_mixer_stream_params_t params;
-   nbio_buf_t *img = (nbio_buf_t*)task_data;
-   struct audio_mixer_userdata *user = (struct audio_mixer_userdata*)user_data;
-
-   if (!img || !user)
-      return;
-
-   params.volume               = 1.0f;
-   params.slot_selection_type  = user->slot_selection_type;
-   params.slot_selection_idx   = user->slot_selection_idx;
-   params.stream_type          = user->stream_type;
-   params.type                 = AUDIO_MIXER_TYPE_WAV;
-   params.state                = AUDIO_STREAM_STATE_STOPPED;
-   params.buf                  = img->buf;
-   params.bufsize              = img->bufsize;
-   params.cb                   = NULL;
-   params.basename             = !string_is_empty(img->path) ? strdup(path_basename_nocompression(img->path)) : NULL;
-
-   audio_driver_mixer_add_stream(&params);
-
-   if (img->path)
-      free(img->path);
-   if (params.basename != NULL)
-      free(params.basename);
-   free(img);
-   free(user_data);
-}
-
-static void task_audio_mixer_handle_upload_wav_and_play(retro_task_t *task,
-      void *task_data,
-      void *user_data, const char *err)
-{
-   audio_mixer_stream_params_t params;
-   nbio_buf_t *img = (nbio_buf_t*)task_data;
-   struct audio_mixer_userdata *user = (struct audio_mixer_userdata*)user_data;
-
-   if (!img || !user)
-      return;
-
-   params.volume               = 1.0f;
-   params.slot_selection_type  = user->slot_selection_type;
-   params.slot_selection_idx   = user->slot_selection_idx;
-   params.stream_type          = user->stream_type;
-   params.type                 = AUDIO_MIXER_TYPE_WAV;
-   params.state                = AUDIO_STREAM_STATE_PLAYING;
-   params.buf                  = img->buf;
-   params.bufsize              = img->bufsize;
-   params.cb                   = NULL;
-   params.basename             = !string_is_empty(img->path) ? strdup(path_basename_nocompression(img->path)) : NULL;
-
-   audio_driver_mixer_add_stream(&params);
-
-   if (img->path)
-      free(img->path);
-   if (params.basename != NULL)
-      free(params.basename);
-   free(img);
-   free(user_data);
-}
-#endif
-
-bool task_audio_mixer_load_handler(retro_task_t *task)
-{
-   nbio_handle_t             *nbio  = (nbio_handle_t*)task->state;
-   struct audio_mixer_handle *mixer = (struct audio_mixer_handle*)nbio->data;
-
-   if (
-         nbio->is_finished
-         && (mixer && !mixer->is_finished)
-         && (mixer->copy_data_over)
-         && (!task_get_cancelled(task)))
-   {
-      nbio_buf_t *img = (nbio_buf_t*)malloc(sizeof(*img));
-
-      if (img)
-      {
-         img->buf     = mixer->buffer->buf;
-         img->bufsize = mixer->buffer->bufsize;
-         img->path    = strdup(nbio->path);
-      }
-
-      task_set_data(task, img);
-
-      mixer->copy_data_over = false;
-      mixer->is_finished    = true;
-
-      return false;
-   }
-
-   return true;
-}
-
-bool task_push_audio_mixer_load_and_play(
-      const char *fullpath, retro_task_callback_t cb, void *user_data,
-      bool system,
-      enum audio_mixer_slot_selection_type slot_selection_type,
-      int slot_selection_idx)
-{
-   nbio_handle_t             *nbio    = NULL;
-   struct audio_mixer_handle   *mixer = NULL;
-   retro_task_t                   *t  = task_init();
-   struct audio_mixer_userdata *user  = (struct audio_mixer_userdata*)calloc(1, sizeof(*user));
-   /* We are comparing against a fixed list of file
-    * extensions, the longest (jpeg) being 4 characters
-    * in length. We therefore only need to extract the first
-    * 5 characters from the extension of the input path
-    * to correctly validate a match */
-   const char *ext                    = NULL;
-   char ext_lower[6];
-
-   if (!t || !user)
-      goto error;
-
-   if (!(nbio = (nbio_handle_t*)calloc(1, sizeof(*nbio))))
-      goto error;
-
-   nbio->path         = strdup(fullpath);
-
-   if (!(mixer = (struct audio_mixer_handle*)calloc(1, sizeof(*mixer))))
-      goto error;
-
-   mixer->is_finished = false;
-
-   strlcpy(mixer->path, fullpath, sizeof(mixer->path));
-
-   nbio->type         = NBIO_TYPE_NONE;
-   mixer->type        = AUDIO_MIXER_TYPE_NONE;
-
-   /* Get file extension */
-   ext                = strrchr(fullpath, '.');
-
-   if (!ext || (*(++ext) == '\0'))
-      goto error;
-
-   /* Copy and convert to lower case */
-   strlcpy(ext_lower, ext, sizeof(ext_lower));
-   string_to_lower(ext_lower);
-
-#ifdef HAVE_RWAV
-   if (string_is_equal(ext_lower, "wav"))
-   {
-      mixer->type     = AUDIO_MIXER_TYPE_WAV;
-      nbio->type      = NBIO_TYPE_WAV;
-      t->callback     = task_audio_mixer_handle_upload_wav_and_play;
-   }
-   else
-#endif
-      if (string_is_equal(ext_lower, "ogg"))
-   {
-      mixer->type     = AUDIO_MIXER_TYPE_OGG;
-      nbio->type      = NBIO_TYPE_OGG;
-      t->callback     = task_audio_mixer_handle_upload_ogg_and_play;
-   }
-   else if (string_is_equal(ext_lower, "mp3"))
-   {
-      mixer->type     = AUDIO_MIXER_TYPE_MP3;
-      nbio->type      = NBIO_TYPE_MP3;
-      t->callback     = task_audio_mixer_handle_upload_mp3_and_play;
-   }
-   else if (string_is_equal(ext_lower, "flac"))
-   {
-      mixer->type     = AUDIO_MIXER_TYPE_FLAC;
-      nbio->type      = NBIO_TYPE_FLAC;
-      t->callback     = task_audio_mixer_handle_upload_flac_and_play;
-   }
-   else if (	
-         string_is_equal(ext_lower, "mod") ||
-         string_is_equal(ext_lower, "s3m") ||
-         string_is_equal(ext_lower, "xm"))
-   {
-      mixer->type     = AUDIO_MIXER_TYPE_MOD;
-      nbio->type      = NBIO_TYPE_MOD;
-      t->callback     = task_audio_mixer_handle_upload_mod_and_play;
-   }
-
-   if (system)
-      user->stream_type      = AUDIO_STREAM_TYPE_SYSTEM;
-   else
-      user->stream_type      = AUDIO_STREAM_TYPE_USER;
-
-   user->slot_selection_type = slot_selection_type;
-   user->slot_selection_idx  = slot_selection_idx;
-
-   nbio->data                = (struct audio_mixer_handle*)mixer;
-   nbio->is_finished         = false;
-   nbio->cb                  = &cb_nbio_audio_mixer_load;
-   nbio->status              = NBIO_STATUS_INIT;
-
-   t->state           = nbio;
-   t->handler         = task_file_load_handler;
-   t->cleanup         = task_audio_mixer_load_free;
-   t->user_data       = user;
-
-   task_queue_push(t);
-
-   return true;
-
-error:
-   if (nbio)
-   {
-      if (!string_is_empty(nbio->path))
-         free(nbio->path);
-      if (nbio->data)
-         free(nbio->data);
-      nbio_free(nbio->handle);
-      free(nbio);
-   }
-   if (user)
-      free(user);
-   if (t)
-      free(t);
-
-   RARCH_ERR("[audio mixer load] Failed to open '%s'.\n",
-         fullpath);
-
-   return false;
-}
-
-bool task_push_audio_mixer_load(
-      const char *fullpath, retro_task_callback_t cb, void *user_data,
-      bool system,
-      enum audio_mixer_slot_selection_type slot_selection_type,
-      int slot_selection_idx)
-{
-   nbio_handle_t             *nbio    = NULL;
-   struct audio_mixer_handle   *mixer = NULL;
-   retro_task_t                   *t  = task_init();
-   struct audio_mixer_userdata *user  = (struct audio_mixer_userdata*)calloc(1, sizeof(*user));
-   /* We are comparing against a fixed list of file
-    * extensions, the longest (jpeg) being 4 characters
-    * in length. We therefore only need to extract the first
-    * 5 characters from the extension of the input path
-    * to correctly validate a match */
-   const char *ext                    = NULL;
-   char ext_lower[6];
-
-   if (!t || !user)
-      goto error;
-
-   if (!(nbio = (nbio_handle_t*)calloc(1, sizeof(*nbio))))
-      goto error;
-
-   nbio->path         = strdup(fullpath);
-
-   if (!(mixer = (struct audio_mixer_handle*)calloc(1, sizeof(*mixer))))
-      goto error;
-
-   mixer->is_finished = false;
-   mixer->cb          = cb;
-
-   strlcpy(mixer->path, fullpath, sizeof(mixer->path));
-
-   nbio->type         = NBIO_TYPE_NONE;
-   mixer->type        = AUDIO_MIXER_TYPE_NONE;
-
-   /* Get file extension */
-   ext                = strrchr(fullpath, '.');
-
-   if (!ext || (*(++ext) == '\0'))
-      goto error;
-
-   /* Copy and convert to lower case */
-   strlcpy(ext_lower, ext, sizeof(ext_lower));
-   string_to_lower(ext_lower);
-
-#ifdef HAVE_RWAV
-   if (string_is_equal(ext_lower, "wav"))
-   {
-      mixer->type     = AUDIO_MIXER_TYPE_WAV;
-      nbio->type      = NBIO_TYPE_WAV;
-      t->callback     = task_audio_mixer_handle_upload_wav;
-   }
-   else
-#endif
-      if (string_is_equal(ext_lower, "ogg"))
-   {
-      mixer->type     = AUDIO_MIXER_TYPE_OGG;
-      nbio->type      = NBIO_TYPE_OGG;
-      t->callback     = task_audio_mixer_handle_upload_ogg;
-   }
-   else if (string_is_equal(ext_lower, "mp3"))
-   {
-      mixer->type     = AUDIO_MIXER_TYPE_MP3;
-      nbio->type      = NBIO_TYPE_MP3;
-      t->callback     = task_audio_mixer_handle_upload_mp3;
-   }
-   else if (string_is_equal(ext_lower, "flac"))
-   {
-      mixer->type     = AUDIO_MIXER_TYPE_FLAC;
-      nbio->type      = NBIO_TYPE_FLAC;
-      t->callback     = task_audio_mixer_handle_upload_flac;
-   }
-   else if (	
-         string_is_equal(ext_lower, "mod") ||
-         string_is_equal(ext_lower, "s3m") ||
-         string_is_equal(ext_lower, "xm"))
-   {
-      mixer->type     = AUDIO_MIXER_TYPE_MOD;
-      nbio->type      = NBIO_TYPE_MOD;
-      t->callback     = task_audio_mixer_handle_upload_mod;
-   }
-
-   nbio->data         = (struct audio_mixer_handle*)mixer;
-   nbio->is_finished  = false;
-   nbio->cb           = &cb_nbio_audio_mixer_load;
-   nbio->status       = NBIO_STATUS_INIT;
-
-   if (system)
-      user->stream_type      = AUDIO_STREAM_TYPE_SYSTEM;
-   else
-      user->stream_type      = AUDIO_STREAM_TYPE_USER;
-
-   user->slot_selection_type = slot_selection_type;
-   user->slot_selection_idx  = slot_selection_idx;
-
-   t->state                  = nbio;
-   t->handler                = task_file_load_handler;
-   t->cleanup                = task_audio_mixer_load_free;
-   t->user_data              = user;
-
-   task_queue_push(t);
-
-   return true;
-
-error:
-   if (nbio)
-   {
-      if (!string_is_empty(nbio->path))
-         free(nbio->path);
-      if (nbio->data)
-         free(nbio->data);
-      nbio_free(nbio->handle);
-      free(nbio);
-   }
-   if (user)
-      free(user);
-   if (t)
-      free(t);
-
-   RARCH_ERR("[audio mixer load] Failed to open '%s'.\n",
-         fullpath);
-
-   return false;
-}

+ 0 - 51
app/src/main/cpp/tasks/task_audio_mixer.h

@@ -1,51 +0,0 @@
-/*  RetroArch - A frontend for libretro.
- *  Copyright (C) 2011-2017 - Higor Euripedes
- *  Copyright (C) 2011-2017 - Daniel De Matteis
- *
- *  RetroArch is free software: you can redistribute it and/or modify it under the terms
- *  of the GNU General Public License as published by the Free Software Found-
- *  ation, either version 3 of the License, or (at your option) any later version.
- *
- *  RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- *  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- *  PURPOSE.  See the GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License along with RetroArch.
- *  If not, see <http://www.gnu.org/licenses/>.
- */
-#ifndef TASKS_HANDLER_AUDIO_MIXER_H
-#define TASKS_HANDLER_AUDIO_MIXER_H
-
-#include <stdint.h>
-
-#include <boolean.h>
-#include <retro_common_api.h>
-#include <retro_miscellaneous.h>
-
-#include <queues/task_queue.h>
-
-#ifdef HAVE_CONFIG_H
-#include "../config.h"
-#endif
-
-#include "../audio/audio_defines.h"
-
-RETRO_BEGIN_DECLS
-
-bool task_audio_mixer_load_handler(retro_task_t *task);
-
-bool task_push_audio_mixer_load_and_play(
-      const char *fullpath, retro_task_callback_t cb, void *user_data,
-      bool system,
-      enum audio_mixer_slot_selection_type slot_selection_type,
-      int slot_selection_idx);
-
-bool task_push_audio_mixer_load(
-      const char *fullpath, retro_task_callback_t cb, void *user_data,
-      bool system,
-      enum audio_mixer_slot_selection_type slot_selection_type,
-      int slot_selection_idx);
-
-RETRO_END_DECLS
-
-#endif