foobar2000 SDK  2015-08-03
audio_math.h
Go to the documentation of this file.
1 #ifndef audio_sample_size
2 #error PFC not included?
3 #endif
4 
5 /*
6 PROBLEM:
7 audio_math is implemented in pfc (pfc::audio_math) and in shared.dll (::audio_math)
8 We must overlay shared.dll methods on top of PFC ones
9 */
10 
11 namespace audio_math
12 {
14  void SHARED_EXPORT scale(const audio_sample * p_source,t_size p_count,audio_sample * p_output,audio_sample p_scale);
15  void SHARED_EXPORT convert_to_int16(const audio_sample * p_source,t_size p_count,t_int16 * p_output,audio_sample p_scale);
16  void SHARED_EXPORT convert_to_int32(const audio_sample * p_source,t_size p_count,t_int32 * p_output,audio_sample p_scale);
17  audio_sample SHARED_EXPORT convert_to_int16_calculate_peak(const audio_sample * p_source,t_size p_count,t_int16 * p_output,audio_sample p_scale);
18  void SHARED_EXPORT convert_from_int16(const t_int16 * p_source,t_size p_count,audio_sample * p_output,audio_sample p_scale);
19  void SHARED_EXPORT convert_from_int32(const t_int32 * p_source,t_size p_count,audio_sample * p_output,audio_sample p_scale);
20  audio_sample SHARED_EXPORT convert_to_int32_calculate_peak(const audio_sample * p_source,t_size p_count,t_int32 * p_output,audio_sample p_scale);
21  audio_sample SHARED_EXPORT calculate_peak(const audio_sample * p_source,t_size p_count);
22  void SHARED_EXPORT kill_denormal(audio_sample * p_buffer,t_size p_count);
23  void SHARED_EXPORT add_offset(audio_sample * p_buffer,audio_sample p_delta,t_size p_count);
24 }
25 
28 
29 // Overlay class, overrides specific pfc::audio_math methods
31 public:
32  static void scale(const audio_sample * p_source,t_size p_count,audio_sample * p_output,audio_sample p_scale) {
33  audio_math_shareddll::scale(p_source, p_count, p_output, p_scale);
34  }
35  static void convert_to_int16(const audio_sample * p_source,t_size p_count,t_int16 * p_output,audio_sample p_scale) {
36  audio_math_shareddll::convert_to_int16(p_source, p_count, p_output, p_scale);
37  }
38  static void convert_to_int32(const audio_sample * p_source,t_size p_count,t_int32 * p_output,audio_sample p_scale) {
39  audio_math_shareddll::convert_to_int32(p_source, p_count, p_output, p_scale);
40  }
41  static audio_sample convert_to_int16_calculate_peak(const audio_sample * p_source,t_size p_count,t_int16 * p_output,audio_sample p_scale) {
42  return audio_math_shareddll::convert_to_int16_calculate_peak(p_source,p_count,p_output,p_scale);
43  }
44  static void convert_from_int16(const t_int16 * p_source,t_size p_count,audio_sample * p_output,audio_sample p_scale) {
45  audio_math_shareddll::convert_from_int16(p_source,p_count,p_output,p_scale);
46  }
47  static void convert_from_int32(const t_int32 * p_source,t_size p_count,audio_sample * p_output,audio_sample p_scale) {
48  audio_math_shareddll::convert_from_int32(p_source,p_count,p_output,p_scale);
49  }
50  static audio_sample convert_to_int32_calculate_peak(const audio_sample * p_source,t_size p_count,t_int32 * p_output,audio_sample p_scale) {
51  return audio_math_shareddll::convert_to_int32_calculate_peak(p_source,p_count,p_output,p_scale);
52  }
53  static audio_sample calculate_peak(const audio_sample * p_source,t_size p_count) {
54  return audio_math_shareddll::calculate_peak(p_source,p_count);
55  }
56  static void kill_denormal(audio_sample * p_buffer,t_size p_count) {
57  audio_math_shareddll::kill_denormal(p_buffer, p_count);
58  }
59  static void add_offset(audio_sample * p_buffer,audio_sample p_delta,t_size p_count) {
60  audio_math_shareddll::add_offset(p_buffer,p_delta,p_count);
61  }
62 };
63 
64 // Anyone trying to talk to audio_math namespace will reach fb2k_audio_math which calls the right thing
65 #define audio_math fb2k_audio_math
static audio_sample convert_to_int16_calculate_peak(const audio_sample *p_source, t_size p_count, t_int16 *p_output, audio_sample p_scale)
Definition: audio_math.h:41
void SHARED_EXPORT scale(const audio_sample *p_source, t_size p_count, audio_sample *p_output, audio_sample p_scale)
p_source/p_output can point to same buffer
audio_sample SHARED_EXPORT convert_to_int32_calculate_peak(const audio_sample *p_source, t_size p_count, t_int32 *p_output, audio_sample p_scale)
void SHARED_EXPORT convert_from_int32(const t_int32 *p_source, t_size p_count, audio_sample *p_output, audio_sample p_scale)
int16_t t_int16
Definition: int_types.h:6
static void add_offset(audio_sample *p_buffer, audio_sample p_delta, t_size p_count)
Definition: audio_math.h:59
void SHARED_EXPORT convert_from_int16(const t_int16 *p_source, t_size p_count, audio_sample *p_output, audio_sample p_scale)
pfc::audio_math audio_math_pfc
Definition: audio_math.h:27
void SHARED_EXPORT kill_denormal(audio_sample *p_buffer, t_size p_count)
int32_t t_int32
Definition: int_types.h:4
static void convert_to_int32(const audio_sample *p_source, t_size p_count, t_int32 *p_output, audio_sample p_scale)
Definition: audio_math.h:38
static void convert_from_int16(const t_int16 *p_source, t_size p_count, audio_sample *p_output, audio_sample p_scale)
Definition: audio_math.h:44
static void scale(const audio_sample *p_source, t_size p_count, audio_sample *p_output, audio_sample p_scale)
Definition: audio_math.h:32
size_t t_size
Definition: int_types.h:48
void SHARED_EXPORT add_offset(audio_sample *p_buffer, audio_sample p_delta, t_size p_count)
static void kill_denormal(audio_sample *p_buffer, t_size p_count)
Definition: audio_math.h:56
static void convert_from_int32(const t_int32 *p_source, t_size p_count, audio_sample *p_output, audio_sample p_scale)
Definition: audio_math.h:47
static void convert_to_int16(const audio_sample *p_source, t_size p_count, t_int16 *p_output, audio_sample p_scale)
Definition: audio_math.h:35
float audio_sample
Definition: audio_sample.h:6
static audio_sample calculate_peak(const audio_sample *p_source, t_size p_count)
Definition: audio_math.h:53
void SHARED_EXPORT convert_to_int16(const audio_sample *p_source, t_size p_count, t_int16 *p_output, audio_sample p_scale)
audio_sample SHARED_EXPORT calculate_peak(const audio_sample *p_source, t_size p_count)
static audio_sample convert_to_int32_calculate_peak(const audio_sample *p_source, t_size p_count, t_int32 *p_output, audio_sample p_scale)
Definition: audio_math.h:50
void SHARED_EXPORT convert_to_int32(const audio_sample *p_source, t_size p_count, t_int32 *p_output, audio_sample p_scale)
audio_sample SHARED_EXPORT convert_to_int16_calculate_peak(const audio_sample *p_source, t_size p_count, t_int16 *p_output, audio_sample p_scale)