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

Commit 79c5786c authored by Glenn Kasten's avatar Glenn Kasten
Browse files

Clean up channel mask handling

Use type audio_channel_mask_t instead of uint32_t.

Use function audio_channel_out_mask_from_count() to convert from channel
count to channel mask instead of hard-coded assumption.

Rename 'channels' to 'channelMask' to avoid confusion with channel count.

Change-Id: I21a85e668458b773d108f95c2381eef9c4816251
parent d21952fe
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -600,16 +600,15 @@ void SoundChannel::play(const sp<Sample>& sample, int nextChannelID, float leftV
        // wrong audio audio buffer size  (mAudioBufferSize)
        unsigned long toggle = mToggle ^ 1;
        void *userData = (void *)((unsigned long)this | toggle);
        uint32_t channels = (numChannels == 2) ?
                AUDIO_CHANNEL_OUT_STEREO : AUDIO_CHANNEL_OUT_MONO;
        audio_channel_mask_t channelMask = audio_channel_out_mask_from_count(numChannels);

        // do not create a new audio track if current track is compatible with sample parameters
#ifdef USE_SHARED_MEM_BUFFER
        newTrack = new AudioTrack(streamType, sampleRate, sample->format(),
                channels, sample->getIMemory(), AUDIO_OUTPUT_FLAG_FAST, callback, userData);
                channelMask, sample->getIMemory(), AUDIO_OUTPUT_FLAG_FAST, callback, userData);
#else
        newTrack = new AudioTrack(streamType, sampleRate, sample->format(),
                channels, frameCount, AUDIO_OUTPUT_FLAG_FAST, callback, userData,
                channelMask, frameCount, AUDIO_OUTPUT_FLAG_FAST, callback, userData,
                bufferFrames);
#endif
        oldTrack = mAudioTrack;