AudioSamplePtr ETHAudioResourceManager::GetPointer(AudioPtr audio, const str_type::string &fileRelativePath, const str_type::string &programPath, const str_type::string &searchPath, const GS_SAMPLE_TYPE type) { if (fileRelativePath == GS_L("")) return AudioSamplePtr(); if (!m_resource.empty()) { str_type::string fileName = ETHGlobal::GetFileName(fileRelativePath); std::map<str_type::string, AudioSamplePtr>::iterator iter = m_resource.find(fileName); if (iter != m_resource.end()) return iter->second; } // we can set a search path to search the file in case // it hasn't been loaded yet if (searchPath != GS_L("")) { str_type::string fileName = ETHGlobal::GetFileName(fileRelativePath); str_type::string path = programPath; path += searchPath; path += fileName; AddFile(audio, path, type); return GetPointer(audio, fileName, programPath, GS_L(""), type); } return AudioSamplePtr(); }
AudioSamplePtr AudiereContext::LoadSampleFromFileInMemory(void *pBuffer, const unsigned int bufferLength, const GS_SAMPLE_TYPE type) { AudioSamplePtr audio = AudioSamplePtr(new AudiereSample); if (!audio->LoadSampleFromFileInMemory(weak_this, pBuffer, bufferLength, type)) { return AudioSamplePtr(); } return audio; }
AudioSamplePtr AudiereContext::LoadSampleFromFile(const std::wstring& fileName, const Platform::FileManagerPtr& fileManager, const GS_SAMPLE_TYPE type) { AudioSamplePtr audio = AudioSamplePtr(new AudiereSample); if (!audio->LoadSampleFromFile(weak_this, fileName, fileManager, type)) { return AudioSamplePtr(); } return audio; }
AudioSamplePtr IrrKlangAudio::LoadSampleFromFile( const str_type::string& fileName, const Platform::FileManagerPtr& fileManager, const Audio::SAMPLE_TYPE type) { AudioSamplePtr audio = AudioSamplePtr(new IrrKlangAudioSample); if (!audio->LoadSampleFromFile(weak_this, fileName, fileManager, type)) { return AudioSamplePtr(); } return audio; }
AudioSamplePtr IrrKlangAudio::LoadSampleFromFileInMemory( void *pBuffer, const unsigned int bufferLength, const Audio::SAMPLE_TYPE type) { AudioSamplePtr audio = AudioSamplePtr(new IrrKlangAudioSample); if (!audio->LoadSampleFromFileInMemory(weak_this, pBuffer, bufferLength, type)) { return AudioSamplePtr(); } return audio; }
AudioSamplePtr AndroidAudioContext::LoadSampleFromFileInMemory( void *pBuffer, const unsigned int bufferLength, const Audio::SAMPLE_TYPE type) { return AudioSamplePtr(); }
AudioSamplePtr ETHAudioResourceManager::AddFile(AudioPtr audio, const str_type::string &path, const GS_SAMPLE_TYPE type) { if (!m_resource.empty()) { str_type::string fileName = ETHGlobal::GetFileName(path); std::map<str_type::string, AudioSamplePtr>::iterator iter = m_resource.find(fileName); if (iter != m_resource.end()) return iter->second; } AudioSamplePtr pSample; str_type::string fixedName(path); Platform::FixSlashes(fixedName); if (!(pSample = audio->LoadSampleFromFile(fixedName, type))) { pSample.reset(); ETH_STREAM_DECL(ss) << GS_L("(Not loaded) \"") << fixedName << GS_L("\""); ETHResourceProvider::Log(ss.str(), Platform::Logger::ERROR); return AudioSamplePtr(); } //#ifdef _DEBUG str_type::string fileName = ETHGlobal::GetFileName(path); ETH_STREAM_DECL(ss) << GS_L("(Loaded) ") << fileName; ETHResourceProvider::Log(ss.str(), Platform::Logger::INFO); //#endif m_resource[fileName] = pSample; return pSample; }
AudioSamplePtr AndroidAudioContext::LoadSampleFromFile( const str_type::string& fileName, const Platform::FileManagerPtr& fileManager, const Audio::SAMPLE_TYPE type) { AudioSamplePtr sample = AudioSamplePtr(new AndroidAudioSample); sample->LoadSampleFromFile(weak_this, fileName, fileManager, type); return sample; }
void ParticleEditor::DeleteSoundFX() { if (m_manager) { m_manager->SetSoundEffect(AudioSamplePtr()); m_system.soundFXFile = GS_L(""); m_manager->SetSystem(m_system); } }
AudioSamplePtr AndroidAudioContext::LoadSampleFromFile(const str_type::string& fileName, const GS_SAMPLE_TYPE type) { AudioSamplePtr sample = AudioSamplePtr(new AndroidAudioSample); sample->LoadSampleFromFile(weak_this, fileName, type); return sample; }