RetroArch
audio_mix.h
Go to the documentation of this file.
1 /* Copyright (C) 2010-2018 The RetroArch team
2  *
3  * ---------------------------------------------------------------------------------------
4  * The following license statement only applies to this file (audio_mix.h).
5  * ---------------------------------------------------------------------------------------
6  *
7  * Permission is hereby granted, free of charge,
8  * to any person obtaining a copy of this software and associated documentation files (the "Software"),
9  * to deal in the Software without restriction, including without limitation the rights to
10  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
11  * and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
16  * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
19  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  */
22 
23 #ifndef __LIBRETRO_SDK_AUDIO_MIX_H__
24 #define __LIBRETRO_SDK_AUDIO_MIX_H__
25 
26 #include <retro_common_api.h>
27 
28 #include <stdint.h>
29 #include <stddef.h>
30 #ifdef _WIN32
31 #include <direct.h>
32 #else
33 #include <unistd.h>
34 #endif
35 
36 #include <formats/rwav.h>
37 #include <audio/audio_resampler.h>
38 
40 
41 typedef struct
42 {
43  void *buf;
45  float *float_buf;
48  ssize_t len;
49  size_t resample_len;
52  bool resample;
55  double ratio;
57 
58 #if defined(__SSE2__)
59 #define audio_mix_volume audio_mix_volume_SSE2
60 
61 void audio_mix_volume_SSE2(float *out,
62  const float *in, float vol, size_t samples);
63 #else
64 #define audio_mix_volume audio_mix_volume_C
65 #endif
66 
67 void audio_mix_volume_C(float *dst, const float *src, float vol, size_t samples);
68 
70 
72 
74 
86 
88 
90 
92 
93 #endif
size_t resample_len
Definition: audio_mix.h:49
GLsizei samples
Definition: glext.h:7673
Definition: audio_resampler.h:130
int16_t audio_mix_get_chunk_sample(audio_chunk_t *chunk, unsigned channel, size_t sample)
Definition: audio_mix.c:259
#define RETRO_BEGIN_DECLS
Definition: retro_common_api.h:41
ssize_t len
Definition: audio_mix.h:48
GLsizei const GLchar ** path
Definition: glext.h:7901
Definition: audio_mix.h:41
int16_t * resample_buf
Definition: audio_mix.h:47
float * float_resample_buf
Definition: audio_mix.h:46
struct passwd out
Definition: missing_libc_functions.c:51
float * float_buf
Definition: audio_mix.h:45
audio_chunk_t * audio_mix_load_wav_file(const char *path, int sample_rate)
Definition: audio_mix.c:111
Definition: rwav.h:31
bool resample
Definition: audio_mix.h:52
int16_t * upsample_buf
Definition: audio_mix.h:44
signed short int16_t
Definition: stdint.h:122
int16_t * audio_mix_get_chunk_samples(audio_chunk_t *chunk)
Definition: audio_mix.c:288
GLenum src
Definition: glext.h:6980
GLuint in
Definition: glext.h:10523
unsigned sample_rate
Definition: ffmpeg_core.c:181
#define RETRO_END_DECLS
Definition: retro_common_api.h:42
Definition: ibxm.h:14
Definition: ibxm.c:40
void audio_mix_volume_C(float *dst, const float *src, float vol, size_t samples)
Definition: audio_mix.c:41
GLenum GLenum dst
Definition: glext.h:6980
double ratio
Definition: audio_mix.h:55
void * buf
Definition: audio_mix.h:43
int audio_mix_get_chunk_num_channels(audio_chunk_t *chunk)
Definition: audio_mix.c:308
int sample_rate
Definition: audio_mix.h:51
void audio_mix_free_chunk(audio_chunk_t *chunk)
Definition: audio_mix.c:78
size_t audio_mix_get_chunk_num_samples(audio_chunk_t *chunk)
Definition: audio_mix.c:233
rwav_t * rwav
Definition: audio_mix.h:50
const retro_resampler_t * resampler
Definition: audio_mix.h:53
void * resampler_data
Definition: audio_mix.h:54