/*----------------------------------------------------------------------------- IMiniportAudioEngineNode::GetDeviceChannelVolume Decscription: When handling GET volume KS property for the device, Portcls calls this method, inside its property handlers, to get the current setting on the specific channel. Parameters: _In_ _ulNodeId: node id for the target audio engine node _In_ _uiChannel: the target channel for this GET volume operation _Out_ _pVolume: a pointer to a LONG variable for receiving returned information Return Value: Appropriate NTSTATUS code Called at PASSIVE_LEVEL Remarks -------------------------------------------------------------------------------------------------------------------------*/ STDMETHODIMP_(NTSTATUS) CMiniportWaveRT::GetDeviceChannelVolume(_In_ ULONG _ulNodeId, _In_ UINT32 _uiChannel, _Out_ LONG *_pVolume) { NTSTATUS ntStatus = STATUS_INVALID_DEVICE_REQUEST; PAGED_CODE (); DPF_ENTER(("[CMiniportWaveRT::GetDeviceChannelVolume]")); IF_TRUE_ACTION_JUMP(_ulNodeId != KSNODE_WAVE_AUDIO_ENGINE, ntStatus = STATUS_INVALID_DEVICE_REQUEST, Exit); ntStatus = GetChannelVolume(_uiChannel, _pVolume); Exit: return ntStatus; }
void AudioManager::LoadMusic( const tstring& path, const tstring& name, float32 volume, uint8 channel ) { Logger::GetInstance()->Log(mSoundService != nullptr, _T("Sound Service is invalid."), STARENGINE_LOG_TAG); if(mMusicList.find(name) != mMusicList.end()) { Logger::GetInstance()->Log(LogLevel::Warning, _T("Sound Service: The music file '") + name + _T("' is already loaded."), STARENGINE_LOG_TAG); return; } auto pathit = mMusicPathList.find(path); if(pathit != mMusicPathList.end()) { star::Logger::GetInstance()->Log(LogLevel::Warning, _T("Sound Service : Sound File Path Already Exists"), STARENGINE_LOG_TAG); tstring nameold = pathit->second; auto nameit = mMusicList.find(nameold); if(nameit != mMusicList.end()) { star::Logger::GetInstance()->Log(LogLevel::Warning, _T("Sound Service: Found sound file of old path, making copy for new name"), STARENGINE_LOG_TAG); mMusicList[name] = nameit->second; return; } mMusicPathList.erase(pathit); return; } SoundFile* music = new SoundFile(path, channel); music->SetCompleteVolume( volume, GetChannelVolume(channel), GetVolume() ); mMusicList[name] = music; mMusicPathList[path] = name; return; }
void AudioManager::LoadEffect( const tstring& path, const tstring& name, float32 volume, uint8 channel ) { Logger::GetInstance()->Log(mSoundService != nullptr, _T("Sound Service is invalid."),STARENGINE_LOG_TAG); if(mEffectsList.find(name) != mEffectsList.end()) { star::Logger::GetInstance()->Log(LogLevel::Warning, _T("Sound Service: The effect '") + name + _T("' already exists."), STARENGINE_LOG_TAG); return; } auto pathit = mSoundEffectPathList.find(path); if(pathit != mSoundEffectPathList.end()) { star::Logger::GetInstance()->Log(LogLevel::Warning, _T("Sound Service: Sound Effect Path Already Exists"), STARENGINE_LOG_TAG); tstring nameold = pathit->second; auto nameit = mMusicList.find(nameold); if(nameit!= mMusicList.end()) { star::Logger::GetInstance()-> Log(LogLevel::Warning, _T("Sound Service: Found Sound Effect of old path, making copy for new name")); mMusicList[name] = nameit->second; } mSoundEffectPathList.erase(pathit); } SoundEffect* effect = new SoundEffect(path, channel); effect->SetCompleteVolume( volume, GetChannelVolume(channel), GetVolume() ); mEffectsList[name] = effect; mSoundEffectPathList[path] = name; return; }