Mercurial > mm7
diff Media/Audio/AudioPlayer.cpp @ 2516:56b6d74ce716
.
author | Ritor1 |
---|---|
date | Thu, 02 Oct 2014 22:01:06 +0600 |
parents | b96f6cb1855d |
children | 1bcadc6dd203 |
line wrap: on
line diff
--- a/Media/Audio/AudioPlayer.cpp Thu Oct 02 21:16:27 2014 +0600 +++ b/Media/Audio/AudioPlayer.cpp Thu Oct 02 22:01:06 2014 +0600 @@ -429,13 +429,13 @@ fclose(File); return 1; } -//char â wchar_t +//char to wchar_t bool char2wchar_t(char *str1, wchar_t *str2) { - std::wstringstream st; - st << str1; - return !(st >> str2).fail(); -}; + std::wstringstream st; + st << str1; + return !(st >> str2).fail(); +} //----- (004AA13F) -------------------------------------------------------- void AudioPlayer::PlayMusicTrack(MusicID eTrack) { @@ -443,33 +443,31 @@ if (!bNoSound && bPlayerReady && uMusicVolimeMultiplier) { if ( use_music_folder ) - { + { alSourceStop(mSourceID); - sprintf(string, "Music\\%d.mp3", eTrack); + sprintf(string, "Music\\%d.mp3", eTrack); if (!FileExists(string)) - { + { Log::Warning(L"File 14.mp3 in Music\\ folder not found"); - return; - } - LPWSTR wStr = new WCHAR[255]; - //wchar_t *wStr = new wchar_t; - char2wchar_t(string,wStr); - PlayAudio(wStr); - delete []wStr; - alSourcef (mSourceID, AL_GAIN, pSoundVolumeLevels[uMusicVolimeMultiplier]); - } - else if ( hAILRedbook ) - { + return; + } + LPWSTR wStr = new WCHAR[255]; + char2wchar_t(string, wStr); + PlayAudio(wStr); + delete []wStr; + alSourcef (mSourceID, AL_GAIN, pSoundVolumeLevels[uMusicVolimeMultiplier]); + } + else if ( hAILRedbook ) + { AIL_redbook_stop(hAILRedbook); AIL_redbook_set_volume(hAILRedbook, (signed)pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); AIL_redbook_track_info(hAILRedbook, eTrack, &uCurrentMusicTrackStartMS, &uCurrentMusicTrackEndMS); AIL_redbook_play(hAILRedbook, uCurrentMusicTrackStartMS + 1, uCurrentMusicTrackEndMS); uCurrentMusicTrackLength = ((uCurrentMusicTrackEndMS - uCurrentMusicTrackStartMS) * 128) / 1000; - } + } } } - //----- (004AA1F3) -------------------------------------------------------- void AudioPlayer::SetMusicVolume(int vol) {