2014-09-03 18:19:21 +08:00
|
|
|
/****************************************************************************
|
|
|
|
Copyright (c) 2014 Chukong Technologies Inc.
|
|
|
|
|
|
|
|
http://www.cocos2d-x.org
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
THE SOFTWARE.
|
|
|
|
****************************************************************************/
|
|
|
|
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS
|
|
|
|
|
|
|
|
#include "audio/include/AudioEngine.h"
|
|
|
|
#include "platform/CCFileUtils.h"
|
|
|
|
#include "base/ccUtils.h"
|
|
|
|
|
|
|
|
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
|
|
|
|
#include "android/AudioEngine-inl.h"
|
|
|
|
#elif CC_TARGET_PLATFORM == CC_PLATFORM_IOS
|
|
|
|
#include "ios/AudioEngine-inl.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define TIME_DELAY_PRECISION 0.0001
|
|
|
|
|
|
|
|
using namespace cocos2d;
|
2014-09-16 10:22:25 +08:00
|
|
|
using namespace cocos2d::experimental;
|
2014-09-03 18:19:21 +08:00
|
|
|
|
|
|
|
const int AudioEngine::INVAILD_AUDIO_ID = -1;
|
|
|
|
const float AudioEngine::TIME_UNKNOWN = -1.0f;
|
|
|
|
|
2014-09-05 11:13:51 +08:00
|
|
|
//audio file path,audio IDs
|
2014-09-10 13:47:17 +08:00
|
|
|
std::unordered_map<std::string,std::list<int>> AudioEngine::_audioPathIDMap;
|
2014-09-10 14:09:42 +08:00
|
|
|
//profileName,ProfileHelper
|
|
|
|
std::unordered_map<std::string, AudioEngine::ProfileHelper> AudioEngine::_audioPathProfileHelperMap;
|
2014-09-10 17:12:46 +08:00
|
|
|
int AudioEngine::_maxInstances = MAX_AUDIOINSTANCES;
|
2014-09-10 14:09:42 +08:00
|
|
|
AudioEngine::ProfileHelper* AudioEngine::_defaultProfileHelper;
|
2014-09-10 13:47:17 +08:00
|
|
|
std::unordered_map<int, AudioEngine::AudioInfo> AudioEngine::_audioIDInfoMap;
|
2014-09-05 11:13:51 +08:00
|
|
|
AudioEngineImpl* AudioEngine::_audioEngineImpl = nullptr;
|
2014-09-03 18:19:21 +08:00
|
|
|
|
2014-09-05 11:13:51 +08:00
|
|
|
void AudioEngine::end()
|
2014-09-03 18:19:21 +08:00
|
|
|
{
|
2014-09-05 11:13:51 +08:00
|
|
|
delete _audioEngineImpl;
|
|
|
|
_audioEngineImpl = nullptr;
|
2014-09-03 18:19:21 +08:00
|
|
|
|
2014-09-10 14:09:42 +08:00
|
|
|
delete _defaultProfileHelper;
|
|
|
|
_defaultProfileHelper = nullptr;
|
2014-09-03 18:19:21 +08:00
|
|
|
}
|
|
|
|
|
2014-09-05 11:13:51 +08:00
|
|
|
bool AudioEngine::lazyInit()
|
2014-09-03 18:19:21 +08:00
|
|
|
{
|
2014-09-05 11:13:51 +08:00
|
|
|
if (_audioEngineImpl == nullptr)
|
|
|
|
{
|
|
|
|
_audioEngineImpl = new (std::nothrow) AudioEngineImpl();
|
|
|
|
if(!_audioEngineImpl || !_audioEngineImpl->init() ){
|
|
|
|
return false;
|
|
|
|
}
|
2014-09-03 18:19:21 +08:00
|
|
|
}
|
|
|
|
|
2014-09-05 11:13:51 +08:00
|
|
|
return true;
|
2014-09-03 18:19:21 +08:00
|
|
|
}
|
|
|
|
|
2014-09-05 11:13:51 +08:00
|
|
|
int AudioEngine::play2d(const std::string& filePath, bool loop, float volume, const AudioProfile *profile)
|
2014-09-03 18:19:21 +08:00
|
|
|
{
|
|
|
|
int ret = AudioEngine::INVAILD_AUDIO_ID;
|
|
|
|
|
|
|
|
do {
|
2014-09-10 13:47:17 +08:00
|
|
|
if ( !lazyInit() ){
|
|
|
|
break;
|
2014-09-03 18:19:21 +08:00
|
|
|
}
|
|
|
|
|
2014-09-05 11:13:51 +08:00
|
|
|
if ( !FileUtils::getInstance()->isFileExist(filePath)){
|
2014-09-03 18:19:21 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-09-10 14:09:42 +08:00
|
|
|
ProfileHelper* manage = _defaultProfileHelper;
|
2014-09-05 11:13:51 +08:00
|
|
|
if (profile && profile != &manage->profile){
|
|
|
|
CC_ASSERT(!profile->name.empty());
|
2014-09-10 14:09:42 +08:00
|
|
|
manage = &_audioPathProfileHelperMap[profile->name];
|
2014-09-05 11:13:51 +08:00
|
|
|
manage->profile = *profile;
|
|
|
|
}
|
|
|
|
|
2014-09-10 13:47:17 +08:00
|
|
|
if (_audioIDInfoMap.size() >= _maxInstances) {
|
2014-09-05 11:13:51 +08:00
|
|
|
log("Fail to play %s cause by limited max instance of AudioEngine",filePath.c_str());
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (manage)
|
|
|
|
{
|
|
|
|
if(manage->profile.maxInstances != 0 && manage->audioIDs.size() >= manage->profile.maxInstances){
|
|
|
|
log("Fail to play %s cause by limited max instance of AudioProfile",filePath.c_str());
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (manage->profile.minDelay > TIME_DELAY_PRECISION) {
|
|
|
|
auto currTime = utils::gettime();
|
|
|
|
if (manage->lastPlayTime > TIME_DELAY_PRECISION && currTime - manage->lastPlayTime <= manage->profile.minDelay) {
|
|
|
|
log("Fail to play %s cause by limited minimum delay",filePath.c_str());
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2014-09-03 18:19:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (volume < 0.0f) {
|
|
|
|
volume = 0.0f;
|
|
|
|
}
|
|
|
|
else if (volume > 1.0f){
|
|
|
|
volume = 1.0f;
|
|
|
|
}
|
|
|
|
|
2014-09-05 11:13:51 +08:00
|
|
|
ret = _audioEngineImpl->play2d(filePath, loop, volume);
|
2014-09-03 18:19:21 +08:00
|
|
|
if (ret != INVAILD_AUDIO_ID)
|
|
|
|
{
|
2014-09-10 13:47:17 +08:00
|
|
|
_audioPathIDMap[filePath].push_back(ret);
|
|
|
|
auto it = _audioPathIDMap.find(filePath);
|
2014-09-03 18:19:21 +08:00
|
|
|
|
2014-09-10 13:47:17 +08:00
|
|
|
auto& audioRef = _audioIDInfoMap[ret];
|
2014-09-03 18:19:21 +08:00
|
|
|
audioRef.volume = volume;
|
|
|
|
audioRef.loop = loop;
|
|
|
|
audioRef.is3dAudio = false;
|
|
|
|
audioRef.filePath = &it->first;
|
2014-09-05 11:13:51 +08:00
|
|
|
|
2014-09-05 14:34:30 +08:00
|
|
|
if (manage) {
|
|
|
|
manage->lastPlayTime = utils::gettime();
|
|
|
|
manage->audioIDs.push_back(ret);
|
|
|
|
}
|
2014-09-10 14:09:42 +08:00
|
|
|
audioRef.profileHelper = manage;
|
2014-09-03 18:19:21 +08:00
|
|
|
}
|
|
|
|
} while (0);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
void AudioEngine::setLoop(int audioID, bool loop)
|
|
|
|
{
|
2014-09-10 13:47:17 +08:00
|
|
|
auto it = _audioIDInfoMap.find(audioID);
|
|
|
|
if (it != _audioIDInfoMap.end() && it->second.loop != loop){
|
2014-09-03 18:19:21 +08:00
|
|
|
_audioEngineImpl->setLoop(audioID, loop);
|
|
|
|
it->second.loop = loop;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AudioEngine::setVolume(int audioID, float volume)
|
|
|
|
{
|
2014-09-10 13:47:17 +08:00
|
|
|
auto it = _audioIDInfoMap.find(audioID);
|
2014-09-10 14:09:42 +08:00
|
|
|
if (it != _audioIDInfoMap.end()){
|
2014-09-03 18:19:21 +08:00
|
|
|
if (volume < 0.0f) {
|
|
|
|
volume = 0.0f;
|
|
|
|
}
|
|
|
|
else if (volume > 1.0f){
|
|
|
|
volume = 1.0f;
|
|
|
|
}
|
2014-09-10 14:09:42 +08:00
|
|
|
|
|
|
|
if (it->second.volume != volume){
|
|
|
|
_audioEngineImpl->setVolume(audioID, volume);
|
|
|
|
it->second.volume = volume;
|
|
|
|
}
|
2014-09-03 18:19:21 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AudioEngine::pause(int audioID)
|
|
|
|
{
|
2014-09-10 13:47:17 +08:00
|
|
|
auto it = _audioIDInfoMap.find(audioID);
|
|
|
|
if (it != _audioIDInfoMap.end() && it->second.state == AudioState::PLAYING){
|
2014-09-03 18:19:21 +08:00
|
|
|
_audioEngineImpl->pause(audioID);
|
|
|
|
it->second.state = AudioState::PAUSED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AudioEngine::pauseAll()
|
|
|
|
{
|
2014-09-10 13:47:17 +08:00
|
|
|
auto itEnd = _audioIDInfoMap.end();
|
|
|
|
for (auto it = _audioIDInfoMap.begin(); it != itEnd; ++it)
|
2014-09-03 18:19:21 +08:00
|
|
|
{
|
|
|
|
if (it->second.state == AudioState::PLAYING)
|
|
|
|
{
|
|
|
|
_audioEngineImpl->pause(it->first);
|
|
|
|
it->second.state = AudioState::PAUSED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AudioEngine::resume(int audioID)
|
|
|
|
{
|
2014-09-10 13:47:17 +08:00
|
|
|
auto it = _audioIDInfoMap.find(audioID);
|
|
|
|
if (it != _audioIDInfoMap.end() && it->second.state == AudioState::PAUSED){
|
2014-09-03 18:19:21 +08:00
|
|
|
_audioEngineImpl->resume(audioID);
|
|
|
|
it->second.state = AudioState::PLAYING;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AudioEngine::resumeAll()
|
|
|
|
{
|
2014-09-10 13:47:17 +08:00
|
|
|
auto itEnd = _audioIDInfoMap.end();
|
|
|
|
for (auto it = _audioIDInfoMap.begin(); it != itEnd; ++it)
|
2014-09-03 18:19:21 +08:00
|
|
|
{
|
|
|
|
if (it->second.state == AudioState::PAUSED)
|
|
|
|
{
|
|
|
|
_audioEngineImpl->resume(it->first);
|
|
|
|
it->second.state = AudioState::PLAYING;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AudioEngine::stop(int audioID)
|
|
|
|
{
|
2014-09-10 13:47:17 +08:00
|
|
|
auto it = _audioIDInfoMap.find(audioID);
|
|
|
|
if (it != _audioIDInfoMap.end()){
|
2014-09-03 18:19:21 +08:00
|
|
|
_audioEngineImpl->stop(audioID);
|
|
|
|
|
2014-09-10 13:47:17 +08:00
|
|
|
remove(audioID);
|
2014-09-03 18:19:21 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AudioEngine::remove(int audioID)
|
|
|
|
{
|
2014-09-10 13:47:17 +08:00
|
|
|
auto it = _audioIDInfoMap.find(audioID);
|
|
|
|
if (it != _audioIDInfoMap.end()){
|
2014-09-10 14:09:42 +08:00
|
|
|
if (it->second.profileHelper) {
|
|
|
|
it->second.profileHelper->audioIDs.remove(audioID);
|
2014-09-03 18:19:21 +08:00
|
|
|
}
|
2014-09-10 13:47:17 +08:00
|
|
|
_audioPathIDMap[*it->second.filePath].remove(audioID);
|
|
|
|
_audioIDInfoMap.erase(audioID);
|
2014-09-03 18:19:21 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AudioEngine::stopAll()
|
|
|
|
{
|
2014-09-14 22:48:41 +08:00
|
|
|
if(!_audioEngineImpl){
|
|
|
|
return;
|
|
|
|
}
|
2014-09-03 18:19:21 +08:00
|
|
|
_audioEngineImpl->stopAll();
|
2014-09-10 13:47:17 +08:00
|
|
|
auto itEnd = _audioIDInfoMap.end();
|
|
|
|
for (auto it = _audioIDInfoMap.begin(); it != itEnd; ++it)
|
2014-09-03 18:19:21 +08:00
|
|
|
{
|
2014-09-10 14:09:42 +08:00
|
|
|
if (it->second.profileHelper){
|
|
|
|
it->second.profileHelper->audioIDs.remove(it->first);
|
2014-09-03 18:19:21 +08:00
|
|
|
}
|
|
|
|
}
|
2014-09-10 13:47:17 +08:00
|
|
|
_audioPathIDMap.clear();
|
|
|
|
_audioIDInfoMap.clear();
|
2014-09-03 18:19:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void AudioEngine::uncache(const std::string &filePath)
|
|
|
|
{
|
2014-09-10 13:47:17 +08:00
|
|
|
if(_audioPathIDMap.find(filePath) != _audioPathIDMap.end()){
|
|
|
|
auto itEnd = _audioPathIDMap[filePath].end();
|
|
|
|
for (auto it = _audioPathIDMap[filePath].begin() ; it != itEnd; ++it) {
|
|
|
|
auto audioID = *it;
|
2014-09-03 18:19:21 +08:00
|
|
|
_audioEngineImpl->stop(audioID);
|
|
|
|
|
2014-09-10 13:47:17 +08:00
|
|
|
auto itInfo = _audioIDInfoMap.find(audioID);
|
|
|
|
if (itInfo != _audioIDInfoMap.end()){
|
2014-09-10 14:09:42 +08:00
|
|
|
if (itInfo->second.profileHelper) {
|
|
|
|
itInfo->second.profileHelper->audioIDs.remove(audioID);
|
2014-09-10 13:47:17 +08:00
|
|
|
}
|
|
|
|
_audioIDInfoMap.erase(audioID);
|
2014-09-03 18:19:21 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
_audioEngineImpl->uncache(filePath);
|
2014-09-10 13:47:17 +08:00
|
|
|
_audioPathIDMap.erase(filePath);
|
2014-09-03 18:19:21 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AudioEngine::uncacheAll()
|
|
|
|
{
|
2014-09-14 22:48:41 +08:00
|
|
|
if(!_audioEngineImpl){
|
|
|
|
return;
|
|
|
|
}
|
2014-09-03 18:19:21 +08:00
|
|
|
stopAll();
|
|
|
|
_audioEngineImpl->uncacheAll();
|
|
|
|
}
|
|
|
|
|
|
|
|
float AudioEngine::getDuration(int audioID)
|
|
|
|
{
|
2014-09-10 13:47:17 +08:00
|
|
|
auto it = _audioIDInfoMap.find(audioID);
|
|
|
|
if (it != _audioIDInfoMap.end() && it->second.state != AudioState::INITIALZING)
|
2014-09-03 18:19:21 +08:00
|
|
|
{
|
|
|
|
if (it->second.duration == TIME_UNKNOWN)
|
|
|
|
{
|
|
|
|
it->second.duration = _audioEngineImpl->getDuration(audioID);
|
|
|
|
}
|
|
|
|
return it->second.duration;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TIME_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool AudioEngine::setCurrentTime(int audioID, float time)
|
|
|
|
{
|
2014-09-10 13:47:17 +08:00
|
|
|
auto it = _audioIDInfoMap.find(audioID);
|
|
|
|
if (it != _audioIDInfoMap.end() && it->second.state != AudioState::INITIALZING){
|
2014-09-03 18:19:21 +08:00
|
|
|
return _audioEngineImpl->setCurrentTime(audioID, time);
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
float AudioEngine::getCurrentTime(int audioID)
|
|
|
|
{
|
2014-09-10 13:47:17 +08:00
|
|
|
auto it = _audioIDInfoMap.find(audioID);
|
|
|
|
if (it != _audioIDInfoMap.end() && it->second.state != AudioState::INITIALZING){
|
2014-09-03 18:19:21 +08:00
|
|
|
return _audioEngineImpl->getCurrentTime(audioID);
|
|
|
|
}
|
|
|
|
return 0.0f;
|
|
|
|
}
|
|
|
|
|
|
|
|
void AudioEngine::setFinishCallback(int audioID, const std::function<void (int, const std::string &)> &callback)
|
|
|
|
{
|
2014-09-10 13:47:17 +08:00
|
|
|
auto it = _audioIDInfoMap.find(audioID);
|
|
|
|
if (it != _audioIDInfoMap.end()){
|
2014-09-03 18:19:21 +08:00
|
|
|
_audioEngineImpl->setFinishCallback(audioID, callback);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-10 13:47:17 +08:00
|
|
|
bool AudioEngine::setMaxAudioInstance(int maxInstances)
|
2014-09-03 18:19:21 +08:00
|
|
|
{
|
2014-09-10 17:12:46 +08:00
|
|
|
if (maxInstances > 0 && maxInstances <= MAX_AUDIOINSTANCES) {
|
2014-09-03 18:19:21 +08:00
|
|
|
_maxInstances = maxInstances;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-09-05 11:13:51 +08:00
|
|
|
bool AudioEngine::isLoop(int audioID)
|
2014-09-03 18:19:21 +08:00
|
|
|
{
|
2014-09-10 13:47:17 +08:00
|
|
|
auto tmpIterator = _audioIDInfoMap.find(audioID);
|
|
|
|
if (tmpIterator != _audioIDInfoMap.end())
|
2014-09-03 18:19:21 +08:00
|
|
|
{
|
|
|
|
return tmpIterator->second.loop;
|
|
|
|
}
|
|
|
|
|
|
|
|
log("AudioEngine::isLoop-->The audio instance %d is non-existent", audioID);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-09-05 11:13:51 +08:00
|
|
|
float AudioEngine::getVolume(int audioID)
|
2014-09-03 18:19:21 +08:00
|
|
|
{
|
2014-09-10 13:47:17 +08:00
|
|
|
auto tmpIterator = _audioIDInfoMap.find(audioID);
|
|
|
|
if (tmpIterator != _audioIDInfoMap.end())
|
2014-09-03 18:19:21 +08:00
|
|
|
{
|
|
|
|
return tmpIterator->second.volume;
|
|
|
|
}
|
|
|
|
|
|
|
|
log("AudioEngine::getVolume-->The audio instance %d is non-existent", audioID);
|
|
|
|
return 0.0f;
|
|
|
|
}
|
|
|
|
|
2014-09-05 11:13:51 +08:00
|
|
|
AudioEngine::AudioState AudioEngine::getState(int audioID)
|
2014-09-03 18:19:21 +08:00
|
|
|
{
|
2014-09-10 13:47:17 +08:00
|
|
|
auto tmpIterator = _audioIDInfoMap.find(audioID);
|
|
|
|
if (tmpIterator != _audioIDInfoMap.end())
|
2014-09-03 18:19:21 +08:00
|
|
|
{
|
|
|
|
return tmpIterator->second.state;
|
|
|
|
}
|
2014-09-10 13:47:17 +08:00
|
|
|
|
2014-09-09 11:41:17 +08:00
|
|
|
return AudioState::ERROR;
|
2014-09-03 18:19:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
AudioProfile* AudioEngine::getProfile(int audioID)
|
|
|
|
{
|
2014-09-10 13:47:17 +08:00
|
|
|
auto it = _audioIDInfoMap.find(audioID);
|
|
|
|
if (it != _audioIDInfoMap.end())
|
2014-09-03 18:19:21 +08:00
|
|
|
{
|
2014-09-10 14:09:42 +08:00
|
|
|
return &it->second.profileHelper->profile;
|
2014-09-03 18:19:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2014-09-05 11:13:51 +08:00
|
|
|
AudioProfile* AudioEngine::getDefaultProfile()
|
|
|
|
{
|
2014-09-10 14:09:42 +08:00
|
|
|
if (_defaultProfileHelper == nullptr)
|
2014-09-05 11:13:51 +08:00
|
|
|
{
|
2014-09-10 14:09:42 +08:00
|
|
|
_defaultProfileHelper = new (std::nothrow) ProfileHelper();
|
2014-09-05 11:13:51 +08:00
|
|
|
}
|
|
|
|
|
2014-09-10 14:09:42 +08:00
|
|
|
return &_defaultProfileHelper->profile;
|
2014-09-05 11:13:51 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
AudioProfile* AudioEngine::getProfile(const std::string &name)
|
2014-09-03 18:19:21 +08:00
|
|
|
{
|
2014-09-10 14:09:42 +08:00
|
|
|
auto it = _audioPathProfileHelperMap.find(name);
|
|
|
|
if (it != _audioPathProfileHelperMap.end()) {
|
2014-09-05 11:13:51 +08:00
|
|
|
return &it->second.profile;
|
|
|
|
} else {
|
|
|
|
return nullptr;
|
|
|
|
}
|
2014-09-03 18:19:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|