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

Commit 28b76b33 authored by Glenn Kasten's avatar Glenn Kasten
Browse files

Use audio_channel_mask_t for channel mask

Change-Id: I1c1896da48983aa9f1462a4b471f910498816f60
parent fd4e20c2
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -135,7 +135,7 @@ public:
     * sampleRate:         Track sampling rate in Hz.
     * format:             Audio format (e.g AUDIO_FORMAT_PCM_16_BIT for signed
     *                     16 bits per sample).
     * channelMask:        Channel mask: see audio_channels_t.
     * channelMask:        Channel mask.
     * frameCount:         Minimum size of track PCM buffer in frames. This defines the
     *                     latency of the track. The actual size selected by the AudioTrack could be
     *                     larger if the requested size is not compatible with current audio HAL
@@ -154,7 +154,7 @@ public:
                        AudioTrack( audio_stream_type_t streamType,
                                    uint32_t sampleRate  = 0,
                                    audio_format_t format = AUDIO_FORMAT_DEFAULT,
                                    int channelMask      = 0,
                                    audio_channel_mask_t channelMask = 0,
                                    int frameCount       = 0,
                                    audio_output_flags_t flags = AUDIO_OUTPUT_FLAG_NONE,
                                    callback_t cbf       = NULL,
@@ -186,7 +186,7 @@ public:
                        AudioTrack( audio_stream_type_t streamType,
                                    uint32_t sampleRate = 0,
                                    audio_format_t format = AUDIO_FORMAT_DEFAULT,
                                    int channelMask     = 0,
                                    audio_channel_mask_t channelMask = 0,
                                    const sp<IMemory>& sharedBuffer = 0,
                                    audio_output_flags_t flags = AUDIO_OUTPUT_FLAG_NONE,
                                    callback_t cbf      = NULL,
@@ -204,13 +204,13 @@ public:
     * Returned status (from utils/Errors.h) can be:
     *  - NO_ERROR: successful initialization
     *  - INVALID_OPERATION: AudioTrack is already initialized
     *  - BAD_VALUE: invalid parameter (channels, format, sampleRate...)
     *  - BAD_VALUE: invalid parameter (channelMask, format, sampleRate...)
     *  - NO_INIT: audio server or audio hardware not initialized
     * */
            status_t    set(audio_stream_type_t streamType = AUDIO_STREAM_DEFAULT,
                            uint32_t sampleRate = 0,
                            audio_format_t format = AUDIO_FORMAT_DEFAULT,
                            int channelMask     = 0,
                            audio_channel_mask_t channelMask = 0,
                            int frameCount      = 0,
                            audio_output_flags_t flags = AUDIO_OUTPUT_FLAG_NONE,
                            callback_t cbf      = NULL,
@@ -485,7 +485,7 @@ protected:
            status_t createTrack_l(audio_stream_type_t streamType,
                                 uint32_t sampleRate,
                                 audio_format_t format,
                                 uint32_t channelMask,
                                 audio_channel_mask_t channelMask,
                                 int frameCount,
                                 audio_output_flags_t flags,
                                 const sp<IMemory>& sharedBuffer,
@@ -510,7 +510,7 @@ protected:
    uint8_t                 mChannelCount;
    uint8_t                 mMuted;
    uint8_t                 mReserved;
    uint32_t                mChannelMask;
    audio_channel_mask_t    mChannelMask;
    status_t                mStatus;
    uint32_t                mLatency;

+1 −3
Original line number Diff line number Diff line
@@ -534,9 +534,7 @@ status_t VideoEditorAudioPlayer::start(bool sourceAlreadyStarted) {
    } else {
        mAudioTrack = new AudioTrack(
                AUDIO_STREAM_MUSIC, mSampleRate, AUDIO_FORMAT_PCM_16_BIT,
                (numChannels == 2)
                    ? AUDIO_CHANNEL_OUT_STEREO
                    : AUDIO_CHANNEL_OUT_MONO,
                audio_channel_out_mask_from_count(numChannels),
                0, AUDIO_OUTPUT_FLAG_NONE, &AudioCallback, this, 0);

        if ((err = mAudioTrack->initCheck()) != OK) {
+9 −8
Original line number Diff line number Diff line
@@ -103,7 +103,7 @@ AudioTrack::AudioTrack(
        audio_stream_type_t streamType,
        uint32_t sampleRate,
        audio_format_t format,
        int channelMask,
        audio_channel_mask_t channelMask,
        int frameCount,
        audio_output_flags_t flags,
        callback_t cbf,
@@ -136,7 +136,8 @@ AudioTrack::AudioTrack(
      mIsTimed(false),
      mPreviousPriority(ANDROID_PRIORITY_NORMAL), mPreviousSchedulingGroup(SP_DEFAULT)
{
    mStatus = set((audio_stream_type_t)streamType, sampleRate, (audio_format_t)format, channelMask,
    mStatus = set((audio_stream_type_t)streamType, sampleRate, (audio_format_t)format,
            (audio_channel_mask_t) channelMask,
            frameCount, (audio_output_flags_t)flags, cbf, user, notificationFrames,
            0 /*sharedBuffer*/, false /*threadCanCallJava*/, sessionId);
}
@@ -145,7 +146,7 @@ AudioTrack::AudioTrack(
        audio_stream_type_t streamType,
        uint32_t sampleRate,
        audio_format_t format,
        int channelMask,
        audio_channel_mask_t channelMask,
        const sp<IMemory>& sharedBuffer,
        audio_output_flags_t flags,
        callback_t cbf,
@@ -186,7 +187,7 @@ status_t AudioTrack::set(
        audio_stream_type_t streamType,
        uint32_t sampleRate,
        audio_format_t format,
        int channelMask,
        audio_channel_mask_t channelMask,
        int frameCount,
        audio_output_flags_t flags,
        callback_t cbf,
@@ -252,7 +253,7 @@ status_t AudioTrack::set(
    }

    if (!audio_is_output_channel(channelMask)) {
        ALOGE("Invalid channel mask");
        ALOGE("Invalid channel mask %#x", channelMask);
        return BAD_VALUE;
    }
    uint32_t channelCount = popcount(channelMask);
@@ -286,7 +287,7 @@ status_t AudioTrack::set(
    status_t status = createTrack_l(streamType,
                                  sampleRate,
                                  format,
                                  (uint32_t)channelMask,
                                  channelMask,
                                  frameCount,
                                  flags,
                                  sharedBuffer,
@@ -304,7 +305,7 @@ status_t AudioTrack::set(

    mStreamType = streamType;
    mFormat = format;
    mChannelMask = (uint32_t)channelMask;
    mChannelMask = channelMask;
    mChannelCount = channelCount;
    mSharedBuffer = sharedBuffer;
    mMuted = false;
@@ -749,7 +750,7 @@ status_t AudioTrack::createTrack_l(
        audio_stream_type_t streamType,
        uint32_t sampleRate,
        audio_format_t format,
        uint32_t channelMask,
        audio_channel_mask_t channelMask,
        int frameCount,
        audio_output_flags_t flags,
        const sp<IMemory>& sharedBuffer,
+1 −1
Original line number Diff line number Diff line
@@ -135,7 +135,7 @@ public:
                                audio_io_handle_t input,
                                uint32_t sampleRate,
                                audio_format_t format,
                                uint32_t channelMask,
                                audio_channel_mask_t channelMask,
                                int frameCount,
                                track_flags_t flags,
                                pid_t tid,