Commit 82f1e003 authored by nanahira's avatar nanahira

rev

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