Explorar el Código

- Added final changes to support 3D Audio/Effects on Android.

setaylor hace 13 años
padre
commit
321ee1a8d1

+ 0 - 64
gameplay/src/AudioBuffer.cpp

@@ -2,26 +2,16 @@
 #include "AudioBuffer.h"
 #include "FileSystem.h"
 
-#ifdef __ANDROID__
-extern AAssetManager* __assetManager;
-#endif
-
 namespace gameplay
 {
 
 // Audio buffer cache
 static std::vector<AudioBuffer*> __buffers;
 
-#ifndef __ANDROID__
 AudioBuffer::AudioBuffer(const char* path, ALuint buffer)
     : _filePath(path), _alBuffer(buffer)
 {
 }
-#else
-AudioBuffer::AudioBuffer(const char* path) : _filePath(path)
-{
-}
-#endif
 
 AudioBuffer::~AudioBuffer()
 {
@@ -36,13 +26,11 @@ AudioBuffer::~AudioBuffer()
         }
     }
 
-#ifndef __ANDROID__
     if (_alBuffer)
     {
         alDeleteBuffers(1, &_alBuffer);
         _alBuffer = 0;
     }
-#endif
 }
 
 AudioBuffer* AudioBuffer::create(const char* path)
@@ -62,7 +50,6 @@ AudioBuffer* AudioBuffer::create(const char* path)
         }
     }
 
-#ifndef __ANDROID__
     ALuint alBuffer;
     ALCenum al_error;
 
@@ -130,58 +117,8 @@ cleanup:
     if (alBuffer)
         alDeleteBuffers(1, &alBuffer);
     return NULL;
-#else
-    // Get the file header in order to determine the type.
-    AAsset* asset = AAssetManager_open(__assetManager, path, AASSET_MODE_RANDOM);
-    char header[12];
-    if (AAsset_read(asset, header, 12) != 12)
-    {
-        LOG_ERROR_VARG("Invalid audio buffer file: %s", path);
-        return NULL;
-    }
-
-    // Get the file descriptor for the audio file.
-    off_t start, length;
-    int fd = AAsset_openFileDescriptor(asset, &start, &length);
-    if (fd < 0)
-    {
-        LOG_ERROR_VARG("Failed to open file descriptor for asset: %s", path);
-        return NULL;
-    }
-    AAsset_close(asset);
-    SLDataLocator_AndroidFD data = {SL_DATALOCATOR_ANDROIDFD, fd, start, length};
-
-    // Set the appropriate mime type information.
-    SLDataFormat_MIME mime;
-    mime.formatType = SL_DATAFORMAT_MIME;
-    std::string pathStr = path;
-    if (memcmp(header, "RIFF", 4) == 0)
-    {
-        mime.mimeType = (SLchar*)"audio/x-wav";
-        mime.containerType = SL_CONTAINERTYPE_WAV;
-    }
-    else if (memcmp(header, "OggS", 4) == 0)
-    {
-        mime.mimeType = (SLchar*)"application/ogg";
-        mime.containerType = SL_CONTAINERTYPE_OGG;
-    }
-    else
-    {
-        LOG_ERROR_VARG("Unsupported audio file: %s", path);
-    }
-
-    buffer = new AudioBuffer(path);
-    buffer->_data = data;
-    buffer->_mime = mime;
-
-    // Add the buffer to the cache.
-    __buffers.push_back(buffer);
-
-    return buffer;
-#endif
 }
 
-#ifndef __ANDROID__
 bool AudioBuffer::loadWav(FILE* file, ALuint buffer)
 {
     unsigned char stream[12];
@@ -376,6 +313,5 @@ bool AudioBuffer::loadOgg(FILE* file, ALuint buffer)
 
     return true;
 }
-#endif
 
 }

+ 0 - 14
gameplay/src/AudioBuffer.h

@@ -19,17 +19,10 @@ class AudioBuffer : public Ref
 
 private:
     
-#ifndef __ANDROID__
     /**
      * Constructor.
      */
     AudioBuffer(const char* path, ALuint buffer);
-#else
-    /**
-     * Constructor.
-     */
-    AudioBuffer(const char* path);
-#endif
 
     /**
      * Destructor.
@@ -45,19 +38,12 @@ private:
      */
     static AudioBuffer* create(const char* path);
     
-#ifndef __ANDROID__
     static bool loadWav(FILE* file, ALuint buffer);
     
     static bool loadOgg(FILE* file, ALuint buffer);
-#endif
 
     std::string _filePath;
-#ifndef __ANDROID__
     ALuint _alBuffer;
-#else
-    SLDataLocator_AndroidFD _data;
-    SLDataFormat_MIME _mime;
-#endif
 };
 
 }

+ 2 - 144
gameplay/src/AudioController.cpp

@@ -4,22 +4,13 @@
 #include "AudioBuffer.h"
 #include "AudioSource.h"
 
-
 namespace gameplay
 {
 
-#ifndef __ANDROID__
 AudioController::AudioController() 
     : _alcDevice(NULL), _alcContext(NULL), _pausingSource(NULL)
 {
 }
-#else
-AudioController::AudioController() 
-    : _engineObject(NULL), _engineEngine(NULL), _outputMixObject(NULL), _listenerObject(NULL),
-    _listenerDoppler(NULL), _listenerLocation(NULL), _pausingSource(NULL)
-{
-}
-#endif
 
 AudioController::~AudioController()
 {
@@ -27,7 +18,6 @@ AudioController::~AudioController()
 
 void AudioController::initialize()
 {
-#ifndef __ANDROID__
     _alcDevice = alcOpenDevice (NULL);
     if (!_alcDevice)
     {
@@ -50,88 +40,10 @@ void AudioController::initialize()
     {
         LOG_ERROR_VARG("AudioController::initialize() error. Unable to make OpenAL context current. Error: %d\n", alcErr);
     }
-#else
-    // Create the engine.
-    SLresult result = slCreateEngine(&_engineObject, 0, NULL, 0, NULL, NULL);
-    if (result != SL_RESULT_SUCCESS)
-    {
-        LOG_ERROR("AudioController::initialize() error. Unable to create OpenSL engine.");
-        return;
-    }
-
-    // Realize the engine.
-    result = (*_engineObject)->Realize(_engineObject, SL_BOOLEAN_FALSE);
-    if (result != SL_RESULT_SUCCESS)
-    {
-        LOG_ERROR("AudioController::initialize() error. Unable to realize OpenSL engine.");
-        return;
-    }
-
-    // Get the engine interface in order to create other objects later on.
-    result = (*_engineObject)->GetInterface(_engineObject, SL_IID_ENGINE, &_engineEngine);
-    if (result != SL_RESULT_SUCCESS)
-    {
-        LOG_ERROR("AudioController::initialize() error. Unable to retrieve OpenSL engine interface.");
-        return;
-    }
-
-    // Create the output mix.
-    result = (*_engineEngine)->CreateOutputMix(_engineEngine, &_outputMixObject, 0, NULL, NULL);
-    if (result != SL_RESULT_SUCCESS)
-    {
-        LOG_ERROR("AudioController::initialize() error. Unable to create OpenSL output mix.");
-        return;
-    }
-
-    // Realize the output mix.
-    result = (*_outputMixObject)->Realize(_outputMixObject, SL_BOOLEAN_FALSE);
-    if (result != SL_RESULT_SUCCESS)
-    {
-        LOG_ERROR("AudioController::initialize() error. Unable to realize OpenSL output mix.");
-        return;
-    }
-
-    // Load the listener and its supported interfaces.
-    if (!_listenerObject)
-    {
-        const SLInterfaceID interfaces[3] = {SL_IID_3DDOPPLER, SL_IID_3DLOCATION};
-        const SLboolean required[3] = {SL_BOOLEAN_FALSE, SL_BOOLEAN_FALSE};
-        SLresult result = (*_engineEngine)->CreateListener(_engineEngine, &_listenerObject, 2, interfaces, required);
-        if (result != SL_RESULT_SUCCESS)
-        {
-            WARN_VARG("AudioController: failed to create listener (%u).", result);
-            return;
-        }
-
-        result = (*_listenerObject)->Realize(_listenerObject, SL_BOOLEAN_FALSE);
-        if (result != SL_RESULT_SUCCESS)
-        {
-            WARN("AudioController: failed to realize listener.");
-            return;
-        }
-
-        // Get the doppler interface in order to set the listener's velocity.
-        result = (*_listenerObject)->GetInterface(_listenerObject, SL_IID_3DDOPPLER, &_listenerDoppler);
-        if (result != SL_RESULT_SUCCESS)
-        {
-            WARN("AudioController: Unable to retrieve listener doppler interface.");
-            return;
-        }
-
-        // Get the location interface in order to set the listener's position and orientation.
-        result = (*_listenerObject)->GetInterface(_listenerObject, SL_IID_3DLOCATION, &_listenerLocation);
-        if (result != SL_RESULT_SUCCESS)
-        {
-            WARN("AudioController: Unable to retrieve listener location interface.");
-            return;
-        }
-    }
-#endif
 }
 
 void AudioController::finalize()
 {
-#ifndef __ANDROID__
     alcMakeContextCurrent(NULL);
     if (_alcContext)
     {
@@ -143,20 +55,6 @@ void AudioController::finalize()
         alcCloseDevice(_alcDevice);
         _alcDevice = NULL;
     }
-#else
-    if (_outputMixObject != NULL)
-    {
-        (*_outputMixObject)->Destroy(_outputMixObject);
-        _outputMixObject = NULL;
-    }
-
-    if (_engineObject != NULL)
-    {
-        (*_engineObject)->Destroy(_engineObject);
-        _engineObject = NULL;
-        _engineEngine = NULL;
-    }
-#endif
 }
 
 void AudioController::pause()
@@ -176,10 +74,9 @@ void AudioController::pause()
 }
 
 void AudioController::resume()
-{
-#ifndef __ANDROID__    
+{   
     alcMakeContextCurrent(_alcContext);
-#endif
+
     std::set<AudioSource*>::iterator itr = _playingSources.begin();
 
     // For each source that is playing, resume it.
@@ -197,49 +94,10 @@ void AudioController::update(long elapsedTime)
     AudioListener* listener = AudioListener::getInstance();
     if (listener)
     {
-#ifndef __ANDROID__
         alListenerf(AL_GAIN, listener->getGain());
         alListenerfv(AL_ORIENTATION, (ALfloat*)listener->getOrientation());
         alListenerfv(AL_VELOCITY, (ALfloat*)&listener->getVelocity());
         alListenerfv(AL_POSITION, (ALfloat*)&listener->getPosition());
-#else
-        if (_listenerObject)
-        {
-            SLVec3D f;
-            f.x = listener->getOrientationForward().x;
-            f.y = listener->getOrientationForward().y;
-            f.z = listener->getOrientationForward().z;
-            SLVec3D a;
-            a.x = listener->getOrientationUp().x;
-            a.y = listener->getOrientationUp().y;
-            a.z = listener->getOrientationUp().z;
-            SLresult result = (*_listenerLocation)->SetOrientationVectors(_listenerLocation, &f, &a);
-            if (result != SL_RESULT_SUCCESS)
-            {
-                WARN("AudioController: Unable to set listener orientation.");
-            }
-
-            SLVec3D p;
-            p.x = listener->getPosition().x;
-            p.y = listener->getPosition().y;
-            p.z = listener->getPosition().z;
-            result = (*_listenerLocation)->SetLocationCartesian(_listenerLocation, &p);
-            if (result != SL_RESULT_SUCCESS)
-            {
-                WARN("AudioController: Unable to set listener location.");
-            }
-
-            SLVec3D v;
-            v.x = listener->getVelocity().x;
-            v.y = listener->getVelocity().y;
-            v.z = listener->getVelocity().z;
-            result = (*_listenerDoppler)->SetVelocityCartesian(_listenerDoppler, &v);
-            if (result != SL_RESULT_SUCCESS)
-            {
-                WARN("AudioController: Unable to set listener velocity.");
-            }
-        }
-#endif
     }
 }
 

+ 1 - 9
gameplay/src/AudioController.h

@@ -54,17 +54,9 @@ private:
      */
     void update(long elapsedTime);
 
-#ifndef __ANDROID__
+
     ALCdevice* _alcDevice;
     ALCcontext* _alcContext;
-#else
-    SLObjectItf _engineObject;
-    SLEngineItf _engineEngine;
-    SLObjectItf _outputMixObject;
-    SLObjectItf _listenerObject;
-    SL3DDopplerItf _listenerDoppler;
-    SL3DLocationItf _listenerLocation;
-#endif
     std::set<AudioSource*> _playingSources;
     AudioSource* _pausingSource;
 };

+ 0 - 241
gameplay/src/AudioSource.cpp

@@ -9,8 +9,6 @@
 namespace gameplay
 {
 
-
-#ifndef __ANDROID__
 AudioSource::AudioSource(AudioBuffer* buffer, ALuint source) 
     : _alSource(source), _buffer(buffer), _looped(true), _gain(1.0f), _pitch(1.0f), _node(NULL)
 {
@@ -20,87 +18,14 @@ AudioSource::AudioSource(AudioBuffer* buffer, ALuint source)
     alSourcef(_alSource, AL_GAIN, _gain);
     alSourcefv(_alSource, AL_VELOCITY, (const ALfloat*)&_velocity);
 }
-#else
-AudioSource::AudioSource(AudioBuffer* buffer, const SLObjectItf& player)
-    : _playerObject(player), _playerDoppler(NULL), _playerLocation(NULL), _playerPlay(NULL), _playerPitch(NULL),
-    _playerSeek(NULL), _playerVolume(NULL), _buffer(buffer), _looped(true), _gain(1.0f), _pitch(1.0f), _node(NULL)
-{
-    // Get the different interfaces for the OpenSL audio player that we need.
-    SLresult result = (*_playerObject)->GetInterface(_playerObject, SL_IID_3DDOPPLER, &_playerDoppler);
-    if (result != SL_RESULT_SUCCESS)
-    {
-        WARN("AudioSource::AudioSource() - Failed to get 3D doppler interface for OpenSL audio player.");
-    }
-    
-    result = (*_playerObject)->GetInterface(_playerObject, SL_IID_3DLOCATION, &_playerLocation);
-    if (result != SL_RESULT_SUCCESS)
-    {
-        WARN("AudioSource::AudioSource() - Failed to get 3D location interface for OpenSL audio player.");
-    }
-
-    result = (*_playerObject)->GetInterface(_playerObject, SL_IID_PLAY, &_playerPlay);
-    if (result != SL_RESULT_SUCCESS)
-    {
-        WARN("AudioSource::AudioSource() - Failed to get play interface for OpenSL audio player.");
-    }
-
-    result = (*_playerObject)->GetInterface(_playerObject, SL_IID_PITCH, &_playerPitch);
-    if (result != SL_RESULT_SUCCESS)
-    {
-        WARN("AudioSource::AudioSource() - Failed to get rate pitch interface for OpenSL audio player.");
-    }
-
-    result = (*_playerObject)->GetInterface(_playerObject, SL_IID_SEEK, &_playerSeek);
-    if (result != SL_RESULT_SUCCESS)
-    {
-        WARN("AudioSource::AudioSource() - Failed to get seek interface for OpenSL audio player.");
-    }
-
-    result = (*_playerObject)->GetInterface(_playerObject, SL_IID_VOLUME, &_playerVolume);
-    if (result != SL_RESULT_SUCCESS)
-    {
-        WARN("AudioSource::AudioSource() - Failed to get volume interface for OpenSL audio player.");
-    }
-
-    // Get the max volume level (used to convert from our API's parameter to OpenSL's expected units).
-    if (_playerVolume)
-    {
-        result = (*_playerVolume)->GetMaxVolumeLevel(_playerVolume, &_maxVolume);
-        if (result != SL_RESULT_SUCCESS)
-        {
-            WARN("AudioSource::AudioSource() - Failed to get the max volume level for OpenSL audio player (needed for parameter conversion).");
-        }
-    }
-
-    setLooped(_looped);
-    setPitch(_pitch);
-    setGain(_gain);
-    setVelocity(_velocity);
-}
-#endif
 
 AudioSource::~AudioSource()
 {
-#ifndef __ANDROID__
     if (_alSource)
     {
         alDeleteSources(1, &_alSource);
         _alSource = 0;
     }
-#else
-    if (_playerObject)
-    {
-        (*_playerObject)->Destroy(_playerObject);
-        _playerObject = NULL;
-        _playerDoppler = NULL;
-        _playerLocation = NULL;
-        _playerPlay = NULL;
-        _playerPitch = NULL;
-        _playerSeek = NULL;
-        _playerVolume = NULL;
-    }
-#endif
-
     SAFE_RELEASE(_buffer);
 }
 
@@ -129,7 +54,6 @@ AudioSource* AudioSource::create(const char* path)
     if (buffer == NULL)
         return NULL;
 
-#ifndef __ANDROID__
     // Load the audio source.
     ALuint alSource = 0;
 
@@ -142,31 +66,6 @@ AudioSource* AudioSource::create(const char* path)
     }
     
     return new AudioSource(buffer, alSource);
-#else
-    AudioController* audioController = Game::getInstance()->getAudioController();
-    SLDataLocator_OutputMix locator = {SL_DATALOCATOR_OUTPUTMIX, audioController->_outputMixObject};
-
-    SLDataSource dataSource = {&buffer->_data, &buffer->_mime};
-    SLDataSink dataSink = {&locator, NULL};
-
-    SLObjectItf player;
-    const SLInterfaceID interfaces[] = {SL_IID_3DDOPPLER, SL_IID_3DLOCATION, SL_IID_PLAY, SL_IID_PITCH, SL_IID_SEEK, SL_IID_VOLUME};
-    const SLboolean required[] = {SL_BOOLEAN_FALSE, SL_BOOLEAN_FALSE, SL_BOOLEAN_FALSE, SL_BOOLEAN_FALSE, SL_BOOLEAN_FALSE, SL_BOOLEAN_FALSE};
-    SLresult result = (*audioController->_engineEngine)->CreateAudioPlayer(audioController->_engineEngine, &player, &dataSource, &dataSink, 6, interfaces, required);
-    if (result != SL_RESULT_SUCCESS)
-    {
-        WARN("AudioSource::create - Failed to create OpenSL audio player.");
-        return NULL;
-    }
-
-    result = (*player)->Realize(player, SL_BOOLEAN_FALSE);
-    if (result != SL_RESULT_SUCCESS)
-    {
-        WARN("AudioSource::create - Failed to realize OpenSL audio player.");
-    }
-
-    return new AudioSource(buffer, player);
-#endif
 }
 
 AudioSource* AudioSource::create(Properties* properties)
@@ -218,7 +117,6 @@ AudioSource* AudioSource::create(Properties* properties)
 
 AudioSource::State AudioSource::getState() const
 {
-#ifndef __ANDROID__
     ALint state;
     alGetSourcei(_alSource, AL_SOURCE_STATE, &state);
 
@@ -233,47 +131,12 @@ AudioSource::State AudioSource::getState() const
         default:         
             return INITIAL;
     }
-#else
-    if (_playerPlay != NULL)
-    {
-        SLuint32 state;
-        SLresult result = (*_playerPlay)->GetPlayState(_playerPlay, &state);
-        if (result != SL_RESULT_SUCCESS)
-        {
-            WARN("AudioSource::getState() failed to get player state.");
-        }
-
-        switch (state)
-        {
-            case SL_PLAYSTATE_PLAYING:
-                return PLAYING;
-            case SL_PLAYSTATE_PAUSED:
-                return PAUSED;
-            case SL_PLAYSTATE_STOPPED:
-                return STOPPED;
-            default:
-                return INITIAL;
-        }
-    }
-#endif
-
     return INITIAL;
 }
 
 void AudioSource::play()
 {
-#ifndef __ANDROID__
     alSourcePlay(_alSource);
-#else
-    if (_playerPlay != NULL)
-    {
-        SLresult result = (*_playerPlay)->SetPlayState(_playerPlay, SL_PLAYSTATE_PLAYING);
-        if (result != SL_RESULT_SUCCESS)
-        {
-            WARN("AudioSource::play() failed to set player state.");
-        }
-    }
-#endif
 
     // Add the source to the controller's list of currently playing sources.
     AudioController* audioController = Game::getInstance()->getAudioController();
@@ -283,18 +146,7 @@ void AudioSource::play()
 
 void AudioSource::pause()
 {
-#ifndef __ANDROID__
     alSourcePause(_alSource);
-#else
-    if (_playerPlay != NULL)
-    {
-        SLresult result = (*_playerPlay)->SetPlayState(_playerPlay, SL_PLAYSTATE_PAUSED);
-        if (result != SL_RESULT_SUCCESS)
-        {
-            WARN("AudioSource::pause() failed to set player state.");
-        }
-    }
-#endif
 
     // Remove the source from the controller's set of currently playing sources
     // if the source is being paused by the user and not the controller itself.
@@ -320,18 +172,7 @@ void AudioSource::resume()
 
 void AudioSource::stop()
 {
-#ifndef __ANDROID__
     alSourceStop(_alSource);
-#else
-    if (_playerPlay != NULL)
-    {
-        SLresult result = (*_playerPlay)->SetPlayState(_playerPlay, SL_PLAYSTATE_STOPPED);
-        if (result != SL_RESULT_SUCCESS)
-        {
-            WARN("AudioSource::stop() failed to set player state.");
-        }
-    }
-#endif
 
     // Remove the source from the controller's set of currently playing sources.
     AudioController* audioController = Game::getInstance()->getAudioController();
@@ -342,18 +183,7 @@ void AudioSource::stop()
 
 void AudioSource::rewind()
 {
-#ifndef __ANDROID__
     alSourceRewind(_alSource);
-#else
-    if (_playerPlay != NULL)
-    {
-        SLresult result = (*_playerPlay)->SetMarkerPosition(_playerPlay, 0);
-        if (result != SL_RESULT_SUCCESS)
-        {
-            WARN("AudioSource::rewind() failed to set player marker position.");
-        }
-    }
-#endif
 }
 
 bool AudioSource::isLooped() const
@@ -363,8 +193,6 @@ bool AudioSource::isLooped() const
 
 void AudioSource::setLooped(bool looped)
 {
-#ifndef __ANDROID__
-     // Clear error state.
     alGetError();
     alSourcei(_alSource, AL_LOOPING, (looped) ? AL_TRUE : AL_FALSE);
 
@@ -373,17 +201,6 @@ void AudioSource::setLooped(bool looped)
     {
         LOG_ERROR_VARG("AudioSource::setLooped Error: %d", error);
     }
-#else
-    if (_playerSeek)
-    {
-        SLresult result = (*_playerSeek)->SetLoop(_playerSeek, looped, 0, SL_TIME_UNKNOWN);
-        if (result != SL_RESULT_SUCCESS)
-        {
-            WARN("AudioSource::setLooped() failed.");
-        }
-    }
-#endif
-
     _looped = looped;
 }
 
@@ -394,19 +211,7 @@ float AudioSource::getGain() const
 
 void AudioSource::setGain(float gain)
 {
-#ifndef __ANDROID__
     alSourcef(_alSource, AL_GAIN, gain);
-#else
-    if (_playerVolume)
-    {
-        SLmillibel volume = (gain < MATH_EPSILON) ? SL_MILLIBEL_MIN : (10.0f * log10(gain)) * 100;
-        SLresult result = (*_playerVolume)->SetVolumeLevel(_playerVolume, volume);
-        if (result != SL_RESULT_SUCCESS)
-        {
-            WARN("AudioSource::setGain() failed to set player gain.");
-        }
-    }
-#endif
     _gain = gain;
 }
 
@@ -417,18 +222,7 @@ float AudioSource::getPitch() const
 
 void AudioSource::setPitch(float pitch)
 {
-#ifndef __ANDROID__
     alSourcef(_alSource, AL_PITCH, pitch);
-#else
-    if (_playerPitch)
-    {
-        SLresult result = (*_playerPitch)->SetPitch(_playerPitch, (SLpermille)(pitch * 1000));
-        if (result != SL_RESULT_SUCCESS)
-        {
-            WARN("AudioSource::setPitch() failed to set player pitch.");
-        }
-    }
-#endif
     _pitch = pitch;
 }
 
@@ -439,22 +233,7 @@ const Vector3& AudioSource::getVelocity() const
 
 void AudioSource::setVelocity(const Vector3& velocity)
 {
-#ifndef __ANDROID__
     alSourcefv(_alSource, AL_VELOCITY, (ALfloat*)&velocity);
-#else
-    if (_playerDoppler)
-    {
-        SLVec3D v;
-        v.x = velocity.x;
-        v.y = velocity.y;
-        v.z = velocity.z;
-        SLresult result = (*_playerDoppler)->SetVelocityCartesian(_playerDoppler, &v);
-        if (result != SL_RESULT_SUCCESS)
-        {
-            WARN("AudioSource::setVelocity - failed to set velocity.");
-        }
-    }
-#endif
     _velocity = velocity;
 }
 
@@ -487,31 +266,15 @@ void AudioSource::setNode(Node* node)
 
 void AudioSource::transformChanged(Transform* transform, long cookie)
 {
-#ifndef __ANDROID__
     if (_node)
     {
         Vector3 translation = _node->getTranslationWorld();
         alSourcefv(_alSource, AL_POSITION, (const ALfloat*)&translation.x);
     }
-#else
-    if (_playerLocation)
-    {
-        SLVec3D position;
-        position.x = transform->getTranslationX();
-        position.y = transform->getTranslationY();
-        position.z = transform->getTranslationZ();
-        SLresult result = (*_playerLocation)->SetLocationCartesian(_playerLocation, &position);
-        if (result != SL_RESULT_SUCCESS)
-        {
-            WARN("AudioSource::transformChanged - failed to update location.");
-        }
-    }
-#endif
 }
 
 AudioSource* AudioSource::clone(NodeCloneContext &context) const
 {
-#ifndef __ANDROID__
     ALuint alSource = 0;
     alGenSources(1, &alSource);
     if (alGetError() != AL_NO_ERROR)
@@ -520,11 +283,7 @@ AudioSource* AudioSource::clone(NodeCloneContext &context) const
         return NULL;
     }
     AudioSource* audioClone = new AudioSource(_buffer, alSource);
-#else
-    // TODO: Implement cloning audio source for Android
-    AudioSource* audioClone = new AudioSource(_buffer, _playerObject);
 
-#endif
     _buffer->addRef();
     audioClone->setLooped(isLooped());
     audioClone->setGain(getGain());

+ 0 - 18
gameplay/src/AudioSource.h

@@ -147,17 +147,10 @@ public:
 
 private:
 
-#ifndef __ANDROID__
     /**
      * Constructor that takes an AudioBuffer.
      */
     AudioSource(AudioBuffer* buffer, ALuint source);
-#else
-    /**
-     * Constructor that takes an AudioBuffer.
-     */
-    AudioSource(AudioBuffer* buffer, const SLObjectItf& player);
-#endif
 
     /**
      * Destructor.
@@ -183,18 +176,7 @@ private:
      */
     AudioSource* clone(NodeCloneContext &context) const;
 
-#ifndef __ANDROID__
     ALuint _alSource;
-#else
-    SLObjectItf _playerObject;
-    SL3DDopplerItf _playerDoppler;
-    SL3DLocationItf _playerLocation;
-    SLPlayItf _playerPlay;
-    SLPitchItf _playerPitch;
-    SLSeekItf _playerSeek;
-    SLVolumeItf _playerVolume;
-    SLmillibel _maxVolume;
-#endif
     AudioBuffer* _buffer;
     bool _looped;
     float _gain;

+ 2 - 7
gameplay/src/Base.h

@@ -163,12 +163,8 @@ extern void printError(const char* format, ...);
     #define NOMINMAX
 #endif
 
-// Audio (OpenAL, OpenSL, OggVorbis)
-#ifdef __ANDROID__
-#include <SLES/OpenSLES.h>
-#include <SLES/OpenSLES_Android.h>
-#else
-#ifdef __QNX__
+// Audio (OpenAL/Vorbis)
+#if defined (__QNX__) || defined(__ANDROID__)
 #include <AL/al.h>
 #include <AL/alc.h>
 #elif WIN32
@@ -179,7 +175,6 @@ extern void printError(const char* format, ...);
 #include <OpenAL/alc.h>
 #endif
 #include <vorbis/vorbisfile.h>
-#endif
 
 // Image
 #include <png.h>