Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

7.1 audio channels #119

Open
MAN-PANG opened this issue Oct 18, 2021 · 4 comments
Open

7.1 audio channels #119

MAN-PANG opened this issue Oct 18, 2021 · 4 comments

Comments

@MAN-PANG
Copy link

The code currently only supports 5.1 channels. Can we have an update that supports 7.1 channels, thanks!

@audionuma
Copy link
Contributor

Hello, as mentioned in the source code

/** \enum channel
you should look at which loudspeaker positions your 7.1 setup is related and use the corresponding value to set the channel type of an 8 channel ebu_r128_state.

@MAN-PANG
Copy link
Author

MAN-PANG commented Oct 18, 2021

Thanks for quick reply but I am confused because the function ebur128_init_channel_map will ignore channel numbers higher than 5. More specifically, the code below will iterate through st-> channels but channel number higher than 5 is deemed to be unused:

  static int ebur128_init_channel_map(ebur128_state* st) {
  size_t i;
  st->d->channel_map = (int*) malloc(st->channels * sizeof(int));
  if (!st->d->channel_map) {
    return EBUR128_ERROR_NOMEM;
  }
  if (st->channels == 4) {
    st->d->channel_map[0] = EBUR128_LEFT;
    st->d->channel_map[1] = EBUR128_RIGHT;
    st->d->channel_map[2] = EBUR128_LEFT_SURROUND;
    st->d->channel_map[3] = EBUR128_RIGHT_SURROUND;
  } else if (st->channels == 5) {
    st->d->channel_map[0] = EBUR128_LEFT;
    st->d->channel_map[1] = EBUR128_RIGHT;
    st->d->channel_map[2] = EBUR128_CENTER;
    st->d->channel_map[3] = EBUR128_LEFT_SURROUND;
    st->d->channel_map[4] = EBUR128_RIGHT_SURROUND;
  } else {
    for (i = 0; i < st->channels; ++i) {
      switch (i) {
        case 0: st->d->channel_map[i] = EBUR128_LEFT; break;
        case 1: st->d->channel_map[i] = EBUR128_RIGHT; break;
        case 2: st->d->channel_map[i] = EBUR128_CENTER; break;
        case 3: st->d->channel_map[i] = EBUR128_UNUSED; break;
        case 4: st->d->channel_map[i] = EBUR128_LEFT_SURROUND; break;
        case 5: st->d->channel_map[i] = EBUR128_RIGHT_SURROUND; break;
        default: st->d->channel_map[i] = EBUR128_UNUSED; break;
      }
    }
  }
  return EBUR128_SUCCESS;
}

@audionuma
Copy link
Contributor

audionuma commented Oct 18, 2021

You should not use the

static int ebur128_init_channel_map(ebur128_state* st) {
function that is not part of the public api, and seems to be used only for the default channels setup. You should use the
int ebur128_set_channel(ebur128_state* st,
function, setting each channel to it's appropriate value in a loop over channels indexes.

@MAN-PANG
Copy link
Author

@audionuma Thank you very much for your help. I'll take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants