Commit 82f1e003 authored by nanahira's avatar nanahira

rev

parent 493bccfb
...@@ -1313,8 +1313,10 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) { ...@@ -1313,8 +1313,10 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
//playing custom bgm //playing custom bgm
case 21: { //HINT_MUSIC case 21: { //HINT_MUSIC
if (data) { if (data) {
char textBufferU[1024];
myswprintf(textBuffer, L"./sound/BGM/custom/%ls.mp3", dataManager.GetDesc(data)); myswprintf(textBuffer, L"./sound/BGM/custom/%ls.mp3", dataManager.GetDesc(data));
soundManager.PlayCustomBGM(textBuffer); BufferIO::EncodeUTF8(textBuffer, textBufferU);
soundManager.PlayCustomBGM(textBufferU);
} else { } else {
soundManager.StopBGM(); soundManager.StopBGM();
} }
...@@ -1323,8 +1325,10 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) { ...@@ -1323,8 +1325,10 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
//playing custom sound effect //playing custom sound effect
case 22: { //HINT_SOUND case 22: { //HINT_SOUND
if (data) { if (data) {
char textBufferU[1024];
myswprintf(textBuffer, L"./sound/custom/%ls.wav", dataManager.GetDesc(data)); myswprintf(textBuffer, L"./sound/custom/%ls.wav", dataManager.GetDesc(data));
soundManager.PlayCustomSound(textBuffer); BufferIO::EncodeUTF8(textBuffer, textBufferU);
soundManager.PlayCustomSound(textBufferU);
} else { } else {
soundManager.StopSound(); soundManager.StopSound();
} }
...@@ -1333,8 +1337,10 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) { ...@@ -1333,8 +1337,10 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
//playing custom bgm in ogg format //playing custom bgm in ogg format
case 23: { //HINT_MUSIC_OGG case 23: { //HINT_MUSIC_OGG
if (data) { if (data) {
char textBufferU[1024];
myswprintf(textBuffer, L"./sound/BGM/custom/%ls.ogg", dataManager.GetDesc(data)); myswprintf(textBuffer, L"./sound/BGM/custom/%ls.ogg", dataManager.GetDesc(data));
soundManager.PlayCustomBGM(textBuffer); BufferIO::EncodeUTF8(textBuffer, textBufferU);
soundManager.PlayCustomBGM(textBufferU);
} else { } else {
soundManager.StopBGM(); soundManager.StopBGM();
} }
......
...@@ -313,7 +313,7 @@ void SoundManager::PlayBGM(int scene) { ...@@ -313,7 +313,7 @@ void SoundManager::PlayBGM(int scene) {
} }
#endif #endif
} }
void SoundManager::PlayCustomBGM(wchar_t* BGMName) { void SoundManager::PlayCustomBGM(char* BGMName) {
#ifdef YGOPRO_USE_AUDIO #ifdef YGOPRO_USE_AUDIO
if(!mainGame->chkEnableMusic->isChecked() || !mainGame->chkMusicMode->isChecked() || bgm_process || IsCurrentlyPlaying(BGMName)) if(!mainGame->chkEnableMusic->isChecked() || !mainGame->chkMusicMode->isChecked() || bgm_process || IsCurrentlyPlaying(BGMName))
return; return;
...@@ -326,19 +326,17 @@ void SoundManager::PlayCustomBGM(wchar_t* BGMName) { ...@@ -326,19 +326,17 @@ void SoundManager::PlayCustomBGM(wchar_t* BGMName) {
bgm_process = false; bgm_process = false;
#endif #endif
} }
void SoundManager::PlayCustomSound(wchar_t* SoundName) { void SoundManager::PlayCustomSound(char* SoundName) {
#ifdef YGOPRO_USE_AUDIO #ifdef YGOPRO_USE_AUDIO
if(!mainGame->chkEnableSound->isChecked()) if(!mainGame->chkEnableSound->isChecked())
return; return;
char soundNameU[1024];
BufferIO::EncodeUTF8(SoundName, soundNameU);
#ifdef YGOPRO_USE_MINIAUDIO #ifdef YGOPRO_USE_MINIAUDIO
ma_engine_set_volume(&engineSound, mainGame->gameConf.sound_volume); ma_engine_set_volume(&engineSound, mainGame->gameConf.sound_volume);
ma_engine_play_sound(&engineSound, soundNameU, nullptr); ma_engine_play_sound(&engineSound, SoundName, nullptr);
#endif #endif
#ifdef YGOPRO_USE_IRRKLANG #ifdef YGOPRO_USE_IRRKLANG
engineSound->setSoundVolume(mainGame->gameConf.sound_volume); engineSound->setSoundVolume(mainGame->gameConf.sound_volume);
engineSound->play2D(soundNameU); engineSound->play2D(SoundName);
#endif #endif
#endif #endif
} }
......
...@@ -29,6 +29,7 @@ private: ...@@ -29,6 +29,7 @@ private:
ma_engine engineMusic; ma_engine engineMusic;
ma_sound soundBGM; ma_sound soundBGM;
char currentPlayingMusic[1024]{}; char currentPlayingMusic[1024]{};
ma_sound soundEffect;
#endif #endif
#ifdef YGOPRO_USE_IRRKLANG #ifdef YGOPRO_USE_IRRKLANG
irrklang::ISoundEngine* engineSound; irrklang::ISoundEngine* engineSound;
...@@ -40,13 +41,14 @@ private: ...@@ -40,13 +41,14 @@ private:
public: public:
bool Init(); bool Init();
void RefreshBGMList(); void RefreshBGMList();
void PlaySound(char* sound);
void PlaySoundEffect(int sound); void PlaySoundEffect(int sound);
void PlayDialogSound(irr::gui::IGUIElement * element); void PlayDialogSound(irr::gui::IGUIElement * element);
bool IsCurrentlyPlaying(char* song); bool IsCurrentlyPlaying(char* song);
void PlayMusic(char* song, bool loop); void PlayMusic(char* song, bool loop);
void PlayBGM(int scene); void PlayBGM(int scene);
void PlayCustomBGM(wchar_t* BGMName); void PlayCustomBGM(char* BGMName);
void PlayCustomSound(wchar_t* SoundName); void PlayCustomSound(char* SoundName);
void StopBGM(); void StopBGM();
void StopSound(); void StopSound();
void SetSoundVolume(double volume); void SetSoundVolume(double volume);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment