aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-11-03 19:02:11 -0700
committerChris Robinson <[email protected]>2018-11-03 19:05:23 -0700
commit4bfaa173c41076051b63aee85ab20572fdce46c2 (patch)
treef271ecd1f1166b5dab764d918176d308a2761a63 /Alc
parentba5ec8b0741398272ec52f0177e17ee776226f73 (diff)
Convert panning.c to C++
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALu.c5
-rw-r--r--Alc/ambdec.h8
-rw-r--r--Alc/hrtf.h8
-rw-r--r--Alc/panning.cpp (renamed from Alc/panning.c)21
4 files changed, 30 insertions, 12 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 23996697..ee3ed68f 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -90,6 +90,11 @@ extern inline void aluMatrixfSet(aluMatrixf *matrix,
ALfloat m20, ALfloat m21, ALfloat m22, ALfloat m23,
ALfloat m30, ALfloat m31, ALfloat m32, ALfloat m33);
+extern inline void CalcDirectionCoeffs(const ALfloat dir[3], ALfloat spread, ALfloat coeffs[MAX_AMBI_COEFFS]);
+extern inline void CalcAngleCoeffs(ALfloat azimuth, ALfloat elevation, ALfloat spread, ALfloat coeffs[MAX_AMBI_COEFFS]);
+extern inline float ScaleAzimuthFront(float azimuth, float scale);
+extern inline void ComputePanGains(const MixParams *dry, const ALfloat*RESTRICT coeffs, ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]);
+
/* Cone scalar */
ALfloat ConeScale = 1.0f;
diff --git a/Alc/ambdec.h b/Alc/ambdec.h
index 0bb84072..7776ae11 100644
--- a/Alc/ambdec.h
+++ b/Alc/ambdec.h
@@ -4,6 +4,10 @@
#include "alstring.h"
#include "alMain.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Helpers to read .ambdec configuration files. */
enum AmbDecScaleType {
@@ -43,4 +47,8 @@ void ambdec_init(AmbDecConf *conf);
void ambdec_deinit(AmbDecConf *conf);
int ambdec_load(AmbDecConf *conf, const char *fname);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif /* AMBDEC_H */
diff --git a/Alc/hrtf.h b/Alc/hrtf.h
index dab6a28e..1cdfe568 100644
--- a/Alc/hrtf.h
+++ b/Alc/hrtf.h
@@ -9,6 +9,10 @@
#include "atomic.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define HRTF_HISTORY_BITS (6)
#define HRTF_HISTORY_LENGTH (1<<HRTF_HISTORY_BITS)
#define HRTF_HISTORY_MASK (HRTF_HISTORY_LENGTH-1)
@@ -81,4 +85,8 @@ void GetHrtfCoeffs(const struct Hrtf *Hrtf, ALfloat elevation, ALfloat azimuth,
*/
void BuildBFormatHrtf(const struct Hrtf *Hrtf, DirectHrtfState *state, ALsizei NumChannels, const struct AngularPoint *AmbiPoints, const ALfloat (*RESTRICT AmbiMatrix)[MAX_AMBI_COEFFS], ALsizei AmbiCount, const ALfloat *RESTRICT AmbiOrderHFGain);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif /* ALC_HRTF_H */
diff --git a/Alc/panning.c b/Alc/panning.cpp
index 4328b30f..b9133ecf 100644
--- a/Alc/panning.c
+++ b/Alc/panning.cpp
@@ -38,12 +38,6 @@
#include "bs2b.h"
-extern inline void CalcDirectionCoeffs(const ALfloat dir[3], ALfloat spread, ALfloat coeffs[MAX_AMBI_COEFFS]);
-extern inline void CalcAngleCoeffs(ALfloat azimuth, ALfloat elevation, ALfloat spread, ALfloat coeffs[MAX_AMBI_COEFFS]);
-extern inline float ScaleAzimuthFront(float azimuth, float scale);
-extern inline void ComputePanGains(const MixParams *dry, const ALfloat*RESTRICT coeffs, ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]);
-
-
static const ALsizei FuMa2ACN[MAX_AMBI_COEFFS] = {
0, /* W */
3, /* X */
@@ -324,7 +318,7 @@ static bool MakeSpeakerMap(ALCdevice *device, const AmbDecConf *conf, ALsizei sp
char c;
if(sscanf(name, "AUX%u%c", &n, &c) == 1 && n < 16)
- ch = Aux0+n;
+ ch = static_cast<enum Channel>(Aux0+n);
else
{
ERR("AmbDec speaker label \"%s\" not recognized\n", name);
@@ -449,7 +443,8 @@ static void InitDistanceComp(ALCdevice *device, const AmbDecConf *conf, const AL
if(total > 0)
{
- device->ChannelDelay[0].Buffer = al_calloc(16, total * sizeof(ALfloat));
+ device->ChannelDelay[0].Buffer = reinterpret_cast<float*>(
+ al_calloc(16, total * sizeof(ALfloat)));
for(i = 1;i < MAX_OUTPUT_CHANNELS;i++)
{
size_t len = RoundUp(device->ChannelDelay[i-1].Length, 4);
@@ -860,7 +855,8 @@ static void InitHrtfPanning(ALCdevice *device)
count = COUNTOF(IndexMap);
}
- device->Hrtf = al_calloc(16, FAM_SIZE(DirectHrtfState, Chan, count));
+ device->Hrtf = reinterpret_cast<DirectHrtfState*>(
+ al_calloc(16, FAM_SIZE(DirectHrtfState, Chan, count)));
for(i = 0;i < count;i++)
{
@@ -1044,7 +1040,8 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, enum HrtfRequestMode hrtf
* higher).
*/
ALfloat scale = (ALfloat)(5000.0 / device->Frequency);
- FrontStablizer *stablizer = al_calloc(16, sizeof(*stablizer));
+ FrontStablizer *stablizer = reinterpret_cast<FrontStablizer*>(
+ al_calloc(16, sizeof(*stablizer)));
bandsplit_init(&stablizer->LFilter, scale);
stablizer->RFilter = stablizer->LFilter;
@@ -1194,7 +1191,7 @@ no_hrtf:
ConfigValueInt(alstr_get_cstr(device->DeviceName), NULL, "cf_level", &bs2blevel);
if(bs2blevel > 0 && bs2blevel <= 6)
{
- device->Bs2b = al_calloc(16, sizeof(*device->Bs2b));
+ device->Bs2b = reinterpret_cast<struct bs2b*>(al_calloc(16, sizeof(*device->Bs2b)));
bs2b_set_params(device->Bs2b, bs2blevel, device->Frequency);
TRACE("BS2B enabled\n");
InitPanning(device);
@@ -1212,7 +1209,7 @@ no_hrtf:
}
if(device->Render_Mode == NormalRender)
{
- device->Uhj_Encoder = al_calloc(16, sizeof(Uhj2Encoder));
+ device->Uhj_Encoder = reinterpret_cast<Uhj2Encoder*>(al_calloc(16, sizeof(Uhj2Encoder)));
TRACE("UHJ enabled\n");
InitUhjPanning(device);
return;