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

Commit 1e821372 authored by Glenn Kasten's avatar Glenn Kasten Committed by Android (Google) Code Review
Browse files

Merge "Replace hard-coded sample rate values by constants"

parents 83323f42 ad67c954
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -69,6 +69,11 @@ public class AudioTrack
    /** Maximum value for a channel volume */
    private static final float VOLUME_MAX = 1.0f;

    /** Minimum value for sample rate */
    private static final int SAMPLE_RATE_HZ_MIN = 4000;
    /** Maximum value for sample rate */
    private static final int SAMPLE_RATE_HZ_MAX = 48000;

    /** indicates AudioTrack state is stopped */
    public static final int PLAYSTATE_STOPPED = 1;  // matches SL_PLAYSTATE_STOPPED
    /** indicates AudioTrack state is paused */
@@ -685,7 +690,7 @@ public class AudioTrack
        }

        // sample rate, note these values are subject to change
        if ( (sampleRateInHz < 4000) || (sampleRateInHz > 48000) ) {
        if ( (sampleRateInHz < SAMPLE_RATE_HZ_MIN) || (sampleRateInHz > SAMPLE_RATE_HZ_MAX) ) {
            loge("getMinBufferSize(): " + sampleRateInHz + " Hz is not a supported sample rate.");
            return AudioTrack.ERROR_BAD_VALUE;
        }