mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-23 16:09:47 +00:00
Move audio_mixer code to libretro-common
This commit is contained in:
parent
8906ebc272
commit
1274092fdd
@ -186,7 +186,7 @@ OBJ += frontend/frontend.o \
|
||||
file_path_str.o \
|
||||
$(LIBRETRO_COMM_DIR)/hash/rhash.o \
|
||||
audio/audio_driver.o \
|
||||
audio/audio_mixer.o \
|
||||
$(LIBRETRO_COMM_DIR)/audio/audio_mixer.o \
|
||||
input/input_driver.o \
|
||||
gfx/video_coord_array.o \
|
||||
gfx/video_driver.o \
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <audio/conversion/s16_to_float.h>
|
||||
#include <audio/audio_resampler.h>
|
||||
#include <audio/dsp_filter.h>
|
||||
#include <audio/audio_mixer.h>
|
||||
#include <file/file_path.h>
|
||||
#include <lists/dir_list.h>
|
||||
|
||||
@ -31,7 +32,6 @@
|
||||
#endif
|
||||
|
||||
#include "audio_driver.h"
|
||||
#include "audio_mixer.h"
|
||||
#include "audio_thread_wrapper.h"
|
||||
#include "../record/record_driver.h"
|
||||
#include "../frontend/frontend_driver.h"
|
||||
|
@ -1,52 +0,0 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2017 - Andre Leiradella
|
||||
*
|
||||
* 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 __AUDIO_MIXER__H
|
||||
#define __AUDIO_MIXER__H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <boolean.h>
|
||||
#include <retro_common_api.h>
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
typedef struct audio_mixer_sound_t audio_mixer_sound_t;
|
||||
typedef struct audio_mixer_voice_t audio_mixer_voice_t;
|
||||
|
||||
typedef void (*audio_mixer_stop_cb_t)(audio_mixer_voice_t* voice, 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(const char* path);
|
||||
audio_mixer_sound_t* audio_mixer_load_ogg(const char* path);
|
||||
|
||||
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, audio_mixer_stop_cb_t stop_cb);
|
||||
void audio_mixer_stop(audio_mixer_voice_t* voice);
|
||||
|
||||
void audio_mixer_mix(float* buffer, size_t num_frames);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
@ -672,7 +672,7 @@ DRIVERS
|
||||
#include "../gfx/video_coord_array.c"
|
||||
#include "../input/input_driver.c"
|
||||
#include "../audio/audio_driver.c"
|
||||
#include "../audio/audio_mixer.c"
|
||||
#include "../libretro-common/audio/audio_mixer.c"
|
||||
#include "../camera/camera_driver.c"
|
||||
#include "../location/location_driver.c"
|
||||
#include "../driver.c"
|
||||
|
@ -1,21 +1,28 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2017 - Andre Leiradella
|
||||
*
|
||||
* 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.
|
||||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
*
|
||||
* 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.
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (audio_mixer.c).
|
||||
* ---------------------------------------------------------------------------------------
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
* 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 "audio_mixer.h"
|
||||
|
||||
#include <audio/audio_mixer.h>
|
||||
#include <audio/audio_resampler.h>
|
||||
|
||||
#include <streams/file_stream.h>
|
||||
#include <formats/rwav.h>
|
||||
#include <memalign.h>
|
||||
@ -25,7 +32,7 @@
|
||||
#include <math.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
#include "../../config.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STB_VORBIS
|
||||
@ -33,7 +40,7 @@
|
||||
#define STB_VORBIS_NO_STDIO
|
||||
#define STB_VORBIS_NO_CRT
|
||||
|
||||
#include "../deps/stb/stb_vorbis.h"
|
||||
#include "../../deps/stb/stb_vorbis.h"
|
||||
#endif
|
||||
|
||||
#define AUDIO_MIXER_MAX_VOICES 8
|
59
libretro-common/include/audio/audio_mixer.h
Normal file
59
libretro-common/include/audio/audio_mixer.h
Normal file
@ -0,0 +1,59 @@
|
||||
/* Copyright (C) 2010-2017 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 <boolean.h>
|
||||
#include <retro_common_api.h>
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
typedef struct audio_mixer_sound_t audio_mixer_sound_t;
|
||||
typedef struct audio_mixer_voice_t audio_mixer_voice_t;
|
||||
|
||||
typedef void (*audio_mixer_stop_cb_t)(audio_mixer_voice_t* voice, 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(const char* path);
|
||||
audio_mixer_sound_t* audio_mixer_load_ogg(const char* path);
|
||||
|
||||
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, audio_mixer_stop_cb_t stop_cb);
|
||||
void audio_mixer_stop(audio_mixer_voice_t* voice);
|
||||
|
||||
void audio_mixer_mix(float* buffer, size_t num_frames);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user