OSDN Git Service

Remove AudioTrackProxy since AudioTrack is RefBase
authorGlenn Kasten <gkasten@google.com>
Tue, 15 Nov 2011 21:54:02 +0000 (13:54 -0800)
committerGlenn Kasten <gkasten@google.com>
Thu, 17 Nov 2011 01:25:13 +0000 (17:25 -0800)
Change-Id: I4a1f755178699e0fdedf58e1f3cbd82e6067e071

wilhelm/src/android/AudioPlayer_to_android.cpp
wilhelm/src/android/AudioTrackProxy.h [deleted file]
wilhelm/src/classes.h
wilhelm/src/itf/IEngine.c
wilhelm/src/locks.c

index e79a161..8f85e59 100644 (file)
@@ -1382,7 +1382,7 @@ SLresult android_audioPlayer_realize(CAudioPlayer *pAudioPlayer, SLboolean async
 
         uint32_t sampleRate = sles_to_android_sampleRate(df_pcm->samplesPerSec);
 
-        pAudioPlayer->mAudioTrack = new android::AudioTrackProxy(new android::AudioTrack(
+        pAudioPlayer->mAudioTrack = new android::AudioTrack(
                 pAudioPlayer->mStreamType,                           // streamType
                 sampleRate,                                          // sampleRate
                 sles_to_android_sampleFormat(df_pcm->bitsPerSample), // format
@@ -1394,7 +1394,7 @@ SLresult android_audioPlayer_realize(CAudioPlayer *pAudioPlayer, SLboolean async
                 (void *) pAudioPlayer,                               // user
                 0      // FIXME find appropriate frame count         // notificationFrame
                 , pAudioPlayer->mSessionId
-                ));
+                );
         android::status_t status = pAudioPlayer->mAudioTrack->initCheck();
         if (status != android::NO_ERROR) {
             SL_LOGE("AudioTrack::initCheck status %u", status);
diff --git a/wilhelm/src/android/AudioTrackProxy.h b/wilhelm/src/android/AudioTrackProxy.h
deleted file mode 100644 (file)
index 6b711b8..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// sp<> capable proxy for AudioTrack
-
-#include <media/AudioTrack.h>
-
-namespace android {
-
-class AudioTrackProxy : public RefBase {
-
-public:
-
-    AudioTrackProxy(AudioTrack *raw) : mRaw(raw) { assert(raw != NULL); }
-
-    // don't define all methods, just the ones needed
-
-    void setVolume(float left, float right)
-            { mRaw->setVolume(left, right); }
-    void stop()
-            { mRaw->stop(); }
-    void start()
-            { mRaw->start(); }
-    status_t initCheck()
-            { return mRaw->initCheck(); }
-    status_t setSampleRate(int sampleRate)
-            { return mRaw->setSampleRate(sampleRate); }
-    void pause()
-            { mRaw->pause(); }
-    void getPosition(uint32_t *p)
-            { mRaw->getPosition(p); }
-    void mute(bool muted)
-            { mRaw->mute(muted); }
-    void flush()
-            { mRaw->flush(); }
-    void setMarkerPosition(uint32_t marker)
-            { mRaw->setMarkerPosition(marker); }
-    void setPositionUpdatePeriod(uint32_t updatePeriod)
-            { mRaw->setPositionUpdatePeriod(updatePeriod); }
-    status_t attachAuxEffect(int effectId)
-            { return mRaw->attachAuxEffect(effectId); }
-    status_t setAuxEffectSendLevel(float level)
-            { return mRaw->setAuxEffectSendLevel(level); }
-
-protected:
-
-    virtual ~AudioTrackProxy()
-            { }
-    virtual void onLastStrongRef(const void* id)
-            {
-                assert(mRaw != NULL);
-                delete mRaw;
-                mRaw = NULL;
-            }
-
-private:
-    android::AudioTrack *mRaw;
-
-    AudioTrackProxy(const AudioTrackProxy &);
-    AudioTrackProxy &operator=(const AudioTrackProxy &);
-};
-
-}
index 6bbadd1..3c481ee 100644 (file)
@@ -15,7 +15,6 @@
  */
 
 #ifdef ANDROID
-#include "android/AudioTrackProxy.h"
 #include "android/CallbackProtector.h"
 #include "android/android_Effect.h"
 #include "android/android_GenericPlayer.h"
@@ -99,7 +98,7 @@
     int mStreamType;
     // FIXME consolidate the next several variables into one class to avoid placement new
     /** plays the PCM data for this player */
-    android::sp<android::AudioTrackProxy> mAudioTrack;
+    android::sp<android::AudioTrack> mAudioTrack;
     android::sp<android::CallbackProtector> mCallbackProtector;
     android::sp<android::GenericPlayer> mAPlayer;
     /** aux effect the AudioTrack will be attached to if aux send enabled */
index 41de0a1..0c17d4b 100644 (file)
@@ -252,7 +252,7 @@ static SLresult IEngine_CreateAudioPlayer(SLEngineItf self, SLObjectItf *pPlayer
                     // placement new (explicit constructor)
                     // FIXME unnecessary once those fields are encapsulated in one class, rather
                     //   than a structure
-                    (void) new (&thiz->mAudioTrack) android::sp<android::AudioTrackProxy>();
+                    (void) new (&thiz->mAudioTrack) android::sp<android::AudioTrack>();
                     (void) new (&thiz->mCallbackProtector)
                             android::sp<android::CallbackProtector>();
                     (void) new (&thiz->mAuxEffect) android::sp<android::AudioEffect>();
index 743d4a9..d95c23a 100644 (file)
@@ -203,7 +203,7 @@ void object_unlock_exclusive_attributes(IObject *thiz, unsigned attributes)
     slPrefetchCallback prefetchCallback = NULL;
     void *prefetchContext = NULL;
     SLuint32 prefetchEvents = SL_PREFETCHEVENT_NONE;
-    android::sp<android::AudioTrackProxy> audioTrack;
+    android::sp<android::AudioTrack> audioTrack;
     if (SL_OBJECTID_AUDIOPLAYER == objectID) {
         CAudioPlayer *ap = (CAudioPlayer *) thiz;
         prefetchCallback = ap->mPrefetchStatus.mDeferredPrefetchCallback;