void getLayer3SideInfo2()

in pedalboard/juce_overrides/juce_PatchedMP3AudioFormat.cpp [2652:2712]


  void getLayer3SideInfo2(const int stereo, const bool msStereo,
                          const int sampleRate, const int single) noexcept {
    const int powdiff = (single == 3) ? 4 : 0;
    sideinfo.mainDataStart = getBits(8);
    sideinfo.privateBits = stereo == 1 ? getOneBit() : getBitsUnchecked(2);

    for (int ch = 0; ch < stereo; ++ch) {
      auto &granule = sideinfo.ch[ch].gr[0];

      granule.part2_3Length = getBits(12);
      granule.bigValues = jmin(288u, getBitsUnchecked(9));

      const uint32 qss = getBitsUnchecked(8);
      granule.pow2gain = constants.powToGains + 256 - qss + powdiff;

      if (msStereo)
        granule.pow2gain += 2;

      granule.scaleFactorCompression = getBits(9);

      if (getOneBit()) {
        granule.blockType = getBitsUnchecked(2);
        granule.mixedBlockFlag = getOneBit();
        granule.tableSelect[0] = getBitsUnchecked(5);
        granule.tableSelect[1] = getBitsUnchecked(5);
        granule.tableSelect[2] = 0;

        for (int i = 0; i < 3; ++i) {
          const uint32 sbg = (getBitsUnchecked(3) << 3);
          granule.fullGain[i] = granule.pow2gain + sbg;
        }

        if (granule.blockType == 0) {
        }

        if (granule.blockType == 2)
          granule.region1Start = sampleRate == 8 ? 36 : (36 >> 1);
        else
          granule.region1Start = sampleRate == 8 ? (108 >> 1) : (54 >> 1);

        granule.region2Start = 576 >> 1;
      } else {
        for (int i = 0; i < 3; ++i)
          granule.tableSelect[i] = getBitsUnchecked(5);

        const int r0c = (int)getBitsUnchecked(4);
        const int r1c = (int)getBitsUnchecked(3);
        const int region0index = jmin(22, r0c + 1);
        const int region1index = jmin(22, r0c + 1 + r1c + 1);

        granule.region1Start =
            (uint32)(bandInfo[sampleRate].longIndex[region0index] >> 1);
        granule.region2Start =
            (uint32)(bandInfo[sampleRate].longIndex[region1index] >> 1);
        granule.blockType = 0;
        granule.mixedBlockFlag = 0;
      }
      granule.scaleFactorScale = getOneBit();
      granule.count1TableSelect = getOneBit();
    }
  }