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

Commit 66e4635c authored by Glenn Kasten's avatar Glenn Kasten
Browse files

Use symbolic constants from <system/audio.h>

AUDIO_INTERLEAVE_*
AUDIO_STREAM_MIN
AUDIO_SESSION_ALLOCATE

Change-Id: I31dd6f327204685e50716079ce21c4ba206dff11
parent 1392eb3d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -374,7 +374,7 @@ int main(int argc, char **argv) {
    }

    sp<IMediaPlayer> player =
        service->create(client, 0);
        service->create(client, AUDIO_SESSION_ALLOCATE);

    if (player != NULL && player->setDataSource(source) == NO_ERROR) {
        player->setVideoSurfaceTexture(surface->getIGraphicBufferProducer());
+0 −5
Original line number Diff line number Diff line
@@ -36,11 +36,6 @@ class StaticAudioTrackClientProxy;
class AudioTrack : public RefBase
{
public:
    enum channel_index {
        MONO   = 0,
        LEFT   = 0,
        RIGHT  = 1
    };

    /* Events used by AudioTrack callback function (callback_t).
     * Keep in sync with frameworks/base/media/java/android/media/AudioTrack.java NATIVE_EVENT_*.
+6 −6
Original line number Diff line number Diff line
@@ -333,8 +333,8 @@ status_t AudioTrack::set(
        mOffloadInfo = NULL;
    }

    mVolume[LEFT] = 1.0f;
    mVolume[RIGHT] = 1.0f;
    mVolume[AUDIO_INTERLEAVE_LEFT] = 1.0f;
    mVolume[AUDIO_INTERLEAVE_RIGHT] = 1.0f;
    mSendLevel = 0.0f;
    // mFrameCount is initialized in createTrack_l
    mReqFrameCount = frameCount;
@@ -573,8 +573,8 @@ status_t AudioTrack::setVolume(float left, float right)
    }

    AutoMutex lock(mLock);
    mVolume[LEFT] = left;
    mVolume[RIGHT] = right;
    mVolume[AUDIO_INTERLEAVE_LEFT] = left;
    mVolume[AUDIO_INTERLEAVE_RIGHT] = right;

    mProxy->setVolumeLR((uint32_t(uint16_t(right * 0x1000)) << 16) | uint16_t(left * 0x1000));

@@ -1134,8 +1134,8 @@ status_t AudioTrack::createTrack_l(size_t epoch)
        mStaticProxy = new StaticAudioTrackClientProxy(cblk, buffers, frameCount, mFrameSizeAF);
        mProxy = mStaticProxy;
    }
    mProxy->setVolumeLR((uint32_t(uint16_t(mVolume[RIGHT] * 0x1000)) << 16) |
            uint16_t(mVolume[LEFT] * 0x1000));
    mProxy->setVolumeLR((uint32_t(uint16_t(mVolume[AUDIO_INTERLEAVE_RIGHT] * 0x1000)) << 16) |
            uint16_t(mVolume[AUDIO_INTERLEAVE_LEFT] * 0x1000));
    mProxy->setSendLevel(mSendLevel);
    mProxy->setSampleRate(mSampleRate);
    mProxy->setEpoch(epoch);
+1 −1
Original line number Diff line number Diff line
@@ -1057,7 +1057,7 @@ bool ToneGenerator::initAudioTrack() {
                      0,    // notificationFrames
                      0,    // sharedBuffer
                      mThreadCanCallJava,
                      0,    // sessionId
                      AUDIO_SESSION_ALLOCATE,
                      AudioTrack::TRANSFER_CALLBACK);

    if (mpAudioTrack->initCheck() != NO_ERROR) {
+1 −1
Original line number Diff line number Diff line
@@ -1133,7 +1133,7 @@ AudioFlinger::PlaybackThread::PlaybackThread(const sp<AudioFlinger>& audioFlinge

    // mStreamTypes[AUDIO_STREAM_CNT] is initialized by stream_type_t default constructor
    // There is no AUDIO_STREAM_MIN, and ++ operator does not compile
    for (audio_stream_type_t stream = (audio_stream_type_t) 0; stream < AUDIO_STREAM_CNT;
    for (audio_stream_type_t stream = AUDIO_STREAM_MIN; stream < AUDIO_STREAM_CNT;
            stream = (audio_stream_type_t) (stream + 1)) {
        mStreamTypes[stream].volume = mAudioFlinger->streamVolume_l(stream);
        mStreamTypes[stream].mute = mAudioFlinger->streamMute_l(stream);