Skip to content

Commit 470ba9b

Browse files
committed
replace w/ appropriate macro that should work v18+
1 parent 692eb9b commit 470ba9b

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

rematrix-filter.c

+20-20
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ struct rematrix_data {
3333
obs_source_t *context;
3434
size_t channels;
3535
//store the routing information
36-
float mix[MAX_AUDIO_CHANNELS][MAX_AUDIO_CHANNELS];
36+
float mix[MAX_AV_PLANES][MAX_AV_PLANES];
3737

38-
double gain[MAX_AUDIO_CHANNELS];
38+
double gain[MAX_AV_PLANES];
3939
//store a temporary buffer
40-
uint8_t *tmpbuffer[MAX_AUDIO_CHANNELS];
40+
uint8_t *tmpbuffer[MAX_AV_PLANES];
4141
//ensure we can treat it as a dynamic array
4242
size_t size;
4343
};
@@ -70,11 +70,11 @@ static void rematrix_update(void *data, obs_data_t *settings) {
7070
bool gain_changed = false;
7171
bool mix_changed = false;
7272

73-
double gain[MAX_AUDIO_CHANNELS];
74-
float mix[MAX_AUDIO_CHANNELS][MAX_AUDIO_CHANNELS];
73+
double gain[MAX_AV_PLANES];
74+
float mix[MAX_AV_PLANES][MAX_AV_PLANES];
7575

7676
//make enough space for c strings
77-
int pad_digits = (int)floor(log10(abs(MAX_AUDIO_CHANNELS))) + 1;
77+
int pad_digits = (int)floor(log10(abs(MAX_AV_PLANES))) + 1;
7878

7979
//template out the route format
8080
const char* route_name_format = "route %i";
@@ -92,8 +92,8 @@ static void rematrix_update(void *data, obs_data_t *settings) {
9292
char* mix_name = (char *)calloc(mix_len, sizeof(char));
9393

9494
//copy the routing over from the settings
95-
for (long long i = 0; i < MAX_AUDIO_CHANNELS; i++) {
96-
for (long long j = 0; j < MAX_AUDIO_CHANNELS; j++) {
95+
for (long long i = 0; i < MAX_AV_PLANES; i++) {
96+
for (long long j = 0; j < MAX_AV_PLANES; j++) {
9797
sprintf(mix_name, mix_name_format, i, j);
9898
mix[i][j] = (float)obs_data_get_double(settings, mix_name) / SCALE;
9999

@@ -149,11 +149,11 @@ static struct obs_audio_data *rematrix_filter_audio(void *data,
149149
struct obs_audio_data *audio) {
150150

151151
//initialize once, optimize for fast use
152-
static volatile long long ch_count[MAX_AUDIO_CHANNELS];
153-
static volatile double gain[MAX_AUDIO_CHANNELS];
154-
static volatile float mix[MAX_AUDIO_CHANNELS][MAX_AUDIO_CHANNELS];
155-
static volatile double true_gain[MAX_AUDIO_CHANNELS];
156-
static volatile uint32_t options[MAX_AUDIO_CHANNELS];
152+
static volatile long long ch_count[MAX_AV_PLANES];
153+
static volatile double gain[MAX_AV_PLANES];
154+
static volatile float mix[MAX_AV_PLANES][MAX_AV_PLANES];
155+
static volatile double true_gain[MAX_AV_PLANES];
156+
static volatile uint32_t options[MAX_AV_PLANES];
157157

158158
struct rematrix_data *rematrix = data;
159159
const size_t channels = rematrix->channels;
@@ -292,7 +292,7 @@ static struct obs_audio_data *rematrix_filter_audio(void *data,
292292
static void rematrix_defaults(obs_data_t *settings)
293293
{
294294
//make enough space for c strings
295-
int pad_digits = (int)floor(log10(abs(MAX_AUDIO_CHANNELS))) + 1;
295+
int pad_digits = (int)floor(log10(abs(MAX_AV_PLANES))) + 1;
296296

297297
//template out the gain format
298298
const char* gain_name_format = "gain %i";
@@ -305,8 +305,8 @@ static void rematrix_defaults(obs_data_t *settings)
305305
char* mix_name = (char *)calloc(gain_len, sizeof(char));
306306

307307
//default is no routing (ordered) -1 or any out of bounds is mute*
308-
for (long long i = 0; i < MAX_AUDIO_CHANNELS; i++) {
309-
for (long long j = 0; j < MAX_AUDIO_CHANNELS; j++) {
308+
for (long long i = 0; i < MAX_AV_PLANES; i++) {
309+
for (long long j = 0; j < MAX_AV_PLANES; j++) {
310310
sprintf(mix_name, mix_name_format, i, j);
311311
//default mix is a ch to itself
312312
if (i == j) {
@@ -337,7 +337,7 @@ static bool update_visible(obs_properties_t *props, obs_property_t *prop,
337337
size_t j = 0;
338338

339339
//make enough space for c strings
340-
int pad_digits = (int)floor(log10(abs(MAX_AUDIO_CHANNELS))) + 1;
340+
int pad_digits = (int)floor(log10(abs(MAX_AV_PLANES))) + 1;
341341

342342
//template out
343343
const char* route_obs_format = "out.ch.%i";
@@ -398,16 +398,16 @@ static obs_properties_t *rematrix_properties(void *data)
398398
obs_properties_t *props = obs_properties_create();
399399

400400
//make a list long enough for the maximum # of chs
401-
obs_property_t *route[MAX_AUDIO_CHANNELS];
401+
obs_property_t *route[MAX_AV_PLANES];
402402
//pseduo-pan w/ gain (thanks Matt)
403-
obs_property_t *gain[MAX_AUDIO_CHANNELS];
403+
obs_property_t *gain[MAX_AV_PLANES];
404404

405405
obs_property_t *view_route;
406406

407407
size_t channels = audio_output_get_channels(obs_get_audio());
408408

409409
//make enough space for c strings
410-
int pad_digits = (int)floor(log10(abs(MAX_AUDIO_CHANNELS))) + 1;
410+
int pad_digits = (int)floor(log10(abs(MAX_AV_PLANES))) + 1;
411411

412412
//template out the route format
413413
const char* route_name_format = "route %i";

0 commit comments

Comments
 (0)