Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b4be88c3 authored by Robert Wu's avatar Robert Wu Committed by Android (Google) Code Review
Browse files

Merge "Don't apply extra AAudio volume ramps"

parents 90aa89fe b7e30fa0
Loading
Loading
Loading
Loading
+22 −18
Original line number Diff line number Diff line
@@ -42,14 +42,15 @@ aaudio_result_t AAudioFlowGraph::configure(audio_format_t sourceFormat,
                          audio_format_t sinkFormat,
                          int32_t sinkChannelCount,
                          bool useMonoBlend,
                          float audioBalance) {
                          float audioBalance,
                          bool isExclusive) {
    FlowGraphPortFloatOutput *lastOutput = nullptr;

    // TODO change back to ALOGD
    ALOGI("%s() source format = 0x%08x, channels = %d, sink format = 0x%08x, channels = %d, "
          "useMonoBlend = %d, audioBalance = %f",
          "useMonoBlend = %d, audioBalance = %f, isExclusive %d",
          __func__, sourceFormat, sourceChannelCount, sinkFormat, sinkChannelCount,
          useMonoBlend, audioBalance);
          useMonoBlend, audioBalance, isExclusive);

    switch (sourceFormat) {
        case AUDIO_FORMAT_PCM_FLOAT:
@@ -94,6 +95,8 @@ aaudio_result_t AAudioFlowGraph::configure(audio_format_t sourceFormat,
        return AAUDIO_ERROR_UNIMPLEMENTED;
    }

    // Apply volume ramps for only exclusive streams.
    if (isExclusive) {
        // Apply volume ramps to set the left/right audio balance and target volumes.
        // The signals will be decoupled, volume ramps will be applied, before the signals are
        // combined again.
@@ -110,6 +113,7 @@ aaudio_result_t AAudioFlowGraph::configure(audio_format_t sourceFormat,
        }
        lastOutput = &mManyToMultiConverter->output;
        setAudioBalance(audioBalance);
    }

    switch (sinkFormat) {
        case AUDIO_FORMAT_PCM_FLOAT:
+3 −1
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ public:
     * @param useMonoBlend
     * @param audioBalance
     * @param channelMask
     * @param isExclusive
     * @return
     */
    aaudio_result_t configure(audio_format_t sourceFormat,
@@ -50,7 +51,8 @@ public:
                              audio_format_t sinkFormat,
                              int32_t sinkChannelCount,
                              bool useMonoBlend,
                              float audioBalance);
                              float audioBalance,
                              bool isExclusive);

    void process(const void *source, void *destination, int32_t numFrames);

+2 −1
Original line number Diff line number Diff line
@@ -54,7 +54,8 @@ aaudio_result_t AudioStreamInternalPlay::open(const AudioStreamBuilder &builder)
                             getDeviceFormat(),
                             getDeviceChannelCount(),
                             getRequireMonoBlend(),
                             getAudioBalance());
                             getAudioBalance(),
                             (getSharingMode() == AAUDIO_SHARING_MODE_EXCLUSIVE));

        if (result != AAUDIO_OK) {
            safeReleaseClose();