Commit b699aa32 authored by fallenstardust's avatar fallenstardust

remove AndroidSoundEffectPlayer

parent 711c3715
/*
* IAudioTracker.h
*
* Created on: 2014-9-30
* Author: mabin
*/
#ifndef IAUDIOTRACKER_H_
#define IAUDIOTRACKER_H_
#include <irrlicht.h>
namespace ygo {
enum AUDIO_PATH_TYPE
{
AP_TYPE_ASSET=0,
AP_TYPE_PATH
};
class IAudioTracker {
public:
IAudioTracker(){}
virtual ~IAudioTracker(){}
virtual void playBGM(irr::io::path path, AUDIO_PATH_TYPE type) = 0;
virtual void playSound(irr::io::path path, AUDIO_PATH_TYPE type) = 0;
};
}
#endif /* IAUDIOTRACKER_H_ */
/*
* IYGOSoundEffectPlayer.h
*
* Created on: 2014-9-30
* Author: mabin
*/
#ifndef IYGOSOUNDEFFECTPLAYER_H_
#define IYGOSOUNDEFFECTPLAYER_H_
namespace ygo {
class IYGOSoundEffectPlayer {
public:
IYGOSoundEffectPlayer(){}
virtual ~IYGOSoundEffectPlayer(){}
virtual void doPlayerEnterEffect() = 0;
virtual void doShuffleCardEffect() = 0;
virtual void doNewTurnEffect() = 0;
virtual void doNewPhaseEffect() = 0;
virtual void doSetCardEffect() = 0;
virtual void doSummonEffect() = 0;
virtual void doSpecialSummonEffect() = 0;
virtual void doFlipCardEffect() = 0;
virtual void doActivateEffect() = 0;
virtual void doDrawCardEffect() = 0;
virtual void doDamageEffect() = 0;
virtual void doGainLpEffect() = 0;
virtual void doEquipEffect() = 0;
virtual void doAddCounterEffect() = 0;
virtual void doRemoveCounterEffect() = 0;
virtual void doAttackEffect() = 0;
virtual void doCoinFlipEffect() = 0;
virtual void doDiceRollEffect() = 0;
virtual void doChatEffect() = 0;
virtual void doDestroyEffect() = 0;
virtual void setSEEnabled(bool enabled) = 0;
//add new sound effect and BGM @fallenstardust
virtual void doMenuBGM() = 0;
virtual void doDeckBgm() = 0;
virtual void doSaveDeck() = 0;
virtual void doDelete() = 0;
virtual void doLeave() = 0;
virtual void doReady() = 0;
virtual void doUnReady() = 0;
virtual void doPlayerExit() = 0;
virtual void doOpeningBGM() = 0;
virtual void doDisadvantageBgm() = 0;
virtual void doAdvantageBgm() = 0;
virtual void doWinBgm() = 0;
virtual void doLoseBgm() = 0;
virtual void doStartGame() = 0;
virtual void doPressButton() = 0;
};
}
#endif /* IYGOSOUNDEFFECTPLAYER_H_ */
This diff is collapsed.
...@@ -413,7 +413,6 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -413,7 +413,6 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
break; break;
} }
case STOC_JOIN_GAME: { case STOC_JOIN_GAME: {
//mainGame->soundEffectPlayer->doPlayerEnterEffect();
STOC_JoinGame* pkt = (STOC_JoinGame*)pdata; STOC_JoinGame* pkt = (STOC_JoinGame*)pdata;
std::wstring str; std::wstring str;
wchar_t msgbuf[256]; wchar_t msgbuf[256];
...@@ -572,7 +571,6 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -572,7 +571,6 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
break; break;
} }
case STOC_DUEL_START: { case STOC_DUEL_START: {
//mainGame->soundEffectPlayer->doStartGame();
mainGame->HideElement(mainGame->wHostPrepare); mainGame->HideElement(mainGame->wHostPrepare);
mainGame->WaitFrameSignal(11); mainGame->WaitFrameSignal(11);
mainGame->gMutex.lock(); mainGame->gMutex.lock();
...@@ -781,7 +779,6 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -781,7 +779,6 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
break; break;
} }
case STOC_HS_PLAYER_ENTER: { case STOC_HS_PLAYER_ENTER: {
//mainGame->soundEffectPlayer->doPlayerEnterEffect();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::PLAYER_ENTER); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::PLAYER_ENTER);
STOC_HS_PlayerEnter* pkt = (STOC_HS_PlayerEnter*)pdata; STOC_HS_PlayerEnter* pkt = (STOC_HS_PlayerEnter*)pdata;
if(pkt->pos > 3) if(pkt->pos > 3)
...@@ -816,7 +813,6 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -816,7 +813,6 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
break; break;
mainGame->gMutex.lock(); mainGame->gMutex.lock();
if(state < 8) { if(state < 8) {
//mainGame->soundEffectPlayer->doPlayerEnterEffect();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::PLAYER_ENTER); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::PLAYER_ENTER);
wchar_t* prename = (wchar_t*)mainGame->stHostPrepDuelist[pos]->getText(); wchar_t* prename = (wchar_t*)mainGame->stHostPrepDuelist[pos]->getText();
mainGame->stHostPrepDuelist[state]->setText(prename); mainGame->stHostPrepDuelist[state]->setText(prename);
...@@ -843,7 +839,6 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -843,7 +839,6 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->btnHostPrepNotReady->setVisible(false); mainGame->btnHostPrepNotReady->setVisible(false);
} }
} else if(state == PLAYERCHANGE_LEAVE) { } else if(state == PLAYERCHANGE_LEAVE) {
//mainGame->soundEffectPlayer->doPlayerExit();
mainGame->stHostPrepDuelist[pos]->setText(L""); mainGame->stHostPrepDuelist[pos]->setText(L"");
mainGame->chkHostPrepReady[pos]->setChecked(false); mainGame->chkHostPrepReady[pos]->setChecked(false);
} else if(state == PLAYERCHANGE_OBSERVE) { } else if(state == PLAYERCHANGE_OBSERVE) {
...@@ -2113,7 +2108,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2113,7 +2108,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_SHUFFLE_DECK: { case MSG_SHUFFLE_DECK: {
//mainGame->soundEffectPlayer->doShuffleCardEffect();
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
if(mainGame->dField.deck[player].size() < 2) if(mainGame->dField.deck[player].size() < 2)
return true; return true;
...@@ -2157,7 +2151,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2157,7 +2151,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
int count = BufferIO::ReadInt8(pbuf); int count = BufferIO::ReadInt8(pbuf);
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) { if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
if(count > 1) if(count > 1)
//mainGame->soundEffectPlayer->doShuffleCardEffect();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::SHUFFLE); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::SHUFFLE);
mainGame->WaitFrameSignal(5); mainGame->WaitFrameSignal(5);
if(player == 1 && !mainGame->dInfo.isReplay && !mainGame->dInfo.isSingleMode) { if(player == 1 && !mainGame->dInfo.isReplay && !mainGame->dInfo.isSingleMode) {
...@@ -2203,7 +2196,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2203,7 +2196,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) { if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
if(count > 1) if(count > 1)
//mainGame->soundEffectPlayer->doShuffleCardEffect();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::SHUFFLE); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::SHUFFLE);
for (int i = 0; i < 5; ++i) { for (int i = 0; i < 5; ++i) {
for (auto cit = mainGame->dField.extra[player].begin(); cit != mainGame->dField.extra[player].end(); ++cit) { for (auto cit = mainGame->dField.extra[player].begin(); cit != mainGame->dField.extra[player].end(); ++cit) {
...@@ -2350,7 +2342,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2350,7 +2342,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_NEW_TURN: { case MSG_NEW_TURN: {
//mainGame->soundEffectPlayer->doNewTurnEffect();
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
mainGame->dInfo.turn++; mainGame->dInfo.turn++;
if(!mainGame->dInfo.isTag && !mainGame->dInfo.isReplay && mainGame->dInfo.player_type < 7) { if(!mainGame->dInfo.isTag && !mainGame->dInfo.isReplay && mainGame->dInfo.player_type < 7) {
...@@ -2390,7 +2381,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2390,7 +2381,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_NEW_PHASE: { case MSG_NEW_PHASE: {
//mainGame->soundEffectPlayer->doNewPhaseEffect();
unsigned short phase = BufferIO::ReadInt16(pbuf); unsigned short phase = BufferIO::ReadInt16(pbuf);
mainGame->btnPhaseStatus->setVisible(false); mainGame->btnPhaseStatus->setVisible(false);
mainGame->btnBP->setVisible(false); mainGame->btnBP->setVisible(false);
...@@ -2451,7 +2441,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2451,7 +2441,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
if(cl & LOCATION_REMOVED && pl != cl) if(cl & LOCATION_REMOVED && pl != cl)
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BANISHED); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BANISHED);
else if(reason & REASON_DESTROY && pl != cl) else if(reason & REASON_DESTROY && pl != cl)
//mainGame->soundEffectPlayer->doDestroyEffect();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::DESTROYED); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::DESTROYED);
} }
if (pl == 0) { if (pl == 0) {
...@@ -2669,7 +2658,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2669,7 +2658,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_SET: { case MSG_SET: {
//mainGame->soundEffectPlayer->doSetCardEffect();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::SET); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::SET);
/*int code = */BufferIO::ReadInt32(pbuf); /*int code = */BufferIO::ReadInt32(pbuf);
/*int cc = mainGame->LocalPlayer*/(BufferIO::ReadInt8(pbuf)); /*int cc = mainGame->LocalPlayer*/(BufferIO::ReadInt8(pbuf));
...@@ -2723,7 +2711,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2723,7 +2711,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_SUMMONING: { case MSG_SUMMONING: {
//mainGame->soundEffectPlayer->doSummonEffect();
unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf); unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf);
/*int cc = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); /*int cc = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
/*int cl = */BufferIO::ReadInt8(pbuf); /*int cl = */BufferIO::ReadInt8(pbuf);
...@@ -2748,7 +2735,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2748,7 +2735,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_SPSUMMONING: { case MSG_SPSUMMONING: {
//mainGame->soundEffectPlayer->doSpecialSummonEffect();
unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf); unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf);
/*int cc = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); /*int cc = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
/*int cl = */BufferIO::ReadInt8(pbuf); /*int cl = */BufferIO::ReadInt8(pbuf);
...@@ -2776,7 +2762,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2776,7 +2762,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_FLIPSUMMONING: { case MSG_FLIPSUMMONING: {
//mainGame->soundEffectPlayer->doFlipCardEffect();
unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf); unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf);
int cc = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int cc = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int cl = BufferIO::ReadInt8(pbuf); int cl = BufferIO::ReadInt8(pbuf);
...@@ -2806,7 +2791,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2806,7 +2791,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_CHAINING: { case MSG_CHAINING: {
//mainGame->soundEffectPlayer->doActivateEffect();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::ACTIVATE); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::ACTIVATE);
unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf); unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf);
int pcc = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int pcc = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
...@@ -3006,7 +2990,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3006,7 +2990,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
} }
} else { } else {
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
//mainGame->soundEffectPlayer->doDrawCardEffect();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::DRAW); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::DRAW);
mainGame->gMutex.lock(); mainGame->gMutex.lock();
pcard = mainGame->dField.GetCard(player, LOCATION_DECK, mainGame->dField.deck[player].size() - 1); pcard = mainGame->dField.GetCard(player, LOCATION_DECK, mainGame->dField.deck[player].size() - 1);
...@@ -3024,7 +3007,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3024,7 +3007,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_DAMAGE: { case MSG_DAMAGE: {
//mainGame->soundEffectPlayer->doDamageEffect();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::DAMAGE); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::DAMAGE);
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int val = BufferIO::ReadInt32(pbuf); int val = BufferIO::ReadInt32(pbuf);
...@@ -3056,7 +3038,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3056,7 +3038,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_RECOVER: { case MSG_RECOVER: {
//mainGame->soundEffectPlayer->doGainLpEffect();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::RECOVER); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::RECOVER);
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int val = BufferIO::ReadInt32(pbuf); int val = BufferIO::ReadInt32(pbuf);
...@@ -3086,7 +3067,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3086,7 +3067,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_EQUIP: { case MSG_EQUIP: {
//mainGame->soundEffectPlayer->doEquipEffect();
int c1 = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int c1 = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int l1 = BufferIO::ReadInt8(pbuf); int l1 = BufferIO::ReadInt8(pbuf);
int s1 = BufferIO::ReadInt8(pbuf); int s1 = BufferIO::ReadInt8(pbuf);
...@@ -3212,7 +3192,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3212,7 +3192,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
break; break;
} }
case MSG_PAY_LPCOST: { case MSG_PAY_LPCOST: {
//mainGame->soundEffectPlayer->doDamageEffect();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::DAMAGE); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::DAMAGE);
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int cost = BufferIO::ReadInt32(pbuf); int cost = BufferIO::ReadInt32(pbuf);
...@@ -3240,7 +3219,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3240,7 +3219,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_ADD_COUNTER: { case MSG_ADD_COUNTER: {
//mainGame->soundEffectPlayer->doAddCounterEffect();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::COUNTER_ADD); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::COUNTER_ADD);
int type = BufferIO::ReadInt16(pbuf); int type = BufferIO::ReadInt16(pbuf);
int c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
...@@ -3264,7 +3242,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3264,7 +3242,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_REMOVE_COUNTER: { case MSG_REMOVE_COUNTER: {
//mainGame->soundEffectPlayer->doRemoveCounterEffect();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::COUNTER_REMOVE); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::COUNTER_REMOVE);
int type = BufferIO::ReadInt16(pbuf); int type = BufferIO::ReadInt16(pbuf);
int c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
...@@ -3288,7 +3265,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3288,7 +3265,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_ATTACK: { case MSG_ATTACK: {
//mainGame->soundEffectPlayer->doAttackEffect();
int ca = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int ca = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int la = BufferIO::ReadInt8(pbuf); int la = BufferIO::ReadInt8(pbuf);
int sa = BufferIO::ReadInt8(pbuf); int sa = BufferIO::ReadInt8(pbuf);
...@@ -3398,7 +3374,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3398,7 +3374,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_TOSS_COIN: { case MSG_TOSS_COIN: {
//mainGame->soundEffectPlayer->doCoinFlipEffect();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::COIN); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::COIN);
/*int player = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); /*int player = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int count = BufferIO::ReadInt8(pbuf); int count = BufferIO::ReadInt8(pbuf);
...@@ -3422,7 +3397,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3422,7 +3397,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_TOSS_DICE: { case MSG_TOSS_DICE: {
//mainGame->soundEffectPlayer->doDiceRollEffect();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::DICE); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::DICE);
/*int player = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); /*int player = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int count = BufferIO::ReadInt8(pbuf); int count = BufferIO::ReadInt8(pbuf);
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "materials.h" #include "materials.h"
#include "../ocgcore/common.h" #include "../ocgcore/common.h"
#include <algorithm> #include <algorithm>
#include <android/AndroidSoundEffectPlayer.h>
namespace ygo { namespace ygo {
...@@ -50,7 +49,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -50,7 +49,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
} }
case BUTTON_FIRST: case BUTTON_FIRST:
case BUTTON_SECOND: { case BUTTON_SECOND: {
//mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
mainGame->HideElement(mainGame->wFTSelect); mainGame->HideElement(mainGame->wFTSelect);
CTOS_TPResult cstr; CTOS_TPResult cstr;
...@@ -59,7 +57,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -59,7 +57,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_REPLAY_START: { case BUTTON_REPLAY_START: {
//mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
if(!mainGame->dInfo.isReplay) if(!mainGame->dInfo.isReplay)
break; break;
...@@ -71,7 +68,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -71,7 +68,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_REPLAY_PAUSE: { case BUTTON_REPLAY_PAUSE: {
//mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
if(!mainGame->dInfo.isReplay) if(!mainGame->dInfo.isReplay)
break; break;
...@@ -83,7 +79,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -83,7 +79,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_REPLAY_STEP: { case BUTTON_REPLAY_STEP: {
//mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
if(!mainGame->dInfo.isReplay) if(!mainGame->dInfo.isReplay)
break; break;
...@@ -91,7 +86,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -91,7 +86,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_REPLAY_EXIT: { case BUTTON_REPLAY_EXIT: {
//mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
if(!mainGame->dInfo.isReplay) if(!mainGame->dInfo.isReplay)
break; break;
...@@ -99,7 +93,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -99,7 +93,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_REPLAY_SWAP: { case BUTTON_REPLAY_SWAP: {
//mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
if(mainGame->dInfo.isReplay) if(mainGame->dInfo.isReplay)
ReplayMode::SwapField(); ReplayMode::SwapField();
...@@ -108,7 +101,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -108,7 +101,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_REPLAY_UNDO: { case BUTTON_REPLAY_UNDO: {
//mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
if(!mainGame->dInfo.isReplay) if(!mainGame->dInfo.isReplay)
break; break;
...@@ -116,7 +108,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -116,7 +108,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_REPLAY_SAVE: { case BUTTON_REPLAY_SAVE: {
//mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
if(mainGame->ebRSName->getText()[0] == 0) if(mainGame->ebRSName->getText()[0] == 0)
break; break;
...@@ -126,7 +117,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -126,7 +117,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_REPLAY_CANCEL: { case BUTTON_REPLAY_CANCEL: {
//mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
mainGame->actionParam = 0; mainGame->actionParam = 0;
mainGame->HideElement(mainGame->wReplaySave); mainGame->HideElement(mainGame->wReplaySave);
...@@ -134,7 +124,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -134,7 +124,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_LEAVE_GAME: { case BUTTON_LEAVE_GAME: {
//mainGame->soundEffectPlayer->doPlayerExit();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::EQUIP); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::EQUIP);
if(mainGame->dInfo.isSingleMode) { if(mainGame->dInfo.isSingleMode) {
mainGame->singleSignal.SetNoWait(true); mainGame->singleSignal.SetNoWait(true);
...@@ -170,20 +159,17 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -170,20 +159,17 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_SURRENDER_YES: { case BUTTON_SURRENDER_YES: {
//mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
DuelClient::SendPacketToServer(CTOS_SURRENDER); DuelClient::SendPacketToServer(CTOS_SURRENDER);
mainGame->HideElement(mainGame->wSurrender); mainGame->HideElement(mainGame->wSurrender);
break; break;
} }
case BUTTON_SURRENDER_NO: { case BUTTON_SURRENDER_NO: {
//mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
mainGame->HideElement(mainGame->wSurrender); mainGame->HideElement(mainGame->wSurrender);
break; break;
} }
case BUTTON_CHAIN_IGNORE: { case BUTTON_CHAIN_IGNORE: {
//mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
mainGame->ignore_chain = mainGame->btnChainIgnore->isPressed(); mainGame->ignore_chain = mainGame->btnChainIgnore->isPressed();
mainGame->always_chain = false; mainGame->always_chain = false;
...@@ -192,7 +178,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -192,7 +178,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_CHAIN_ALWAYS: { case BUTTON_CHAIN_ALWAYS: {
//mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
mainGame->always_chain = mainGame->btnChainAlways->isPressed(); mainGame->always_chain = mainGame->btnChainAlways->isPressed();
mainGame->ignore_chain = false; mainGame->ignore_chain = false;
...@@ -201,7 +186,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -201,7 +186,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_CHAIN_WHENAVAIL: { case BUTTON_CHAIN_WHENAVAIL: {
//mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
mainGame->chain_when_avail = mainGame->btnChainWhenAvail->isPressed(); mainGame->chain_when_avail = mainGame->btnChainWhenAvail->isPressed();
mainGame->always_chain = false; mainGame->always_chain = false;
...@@ -210,20 +194,17 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -210,20 +194,17 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_CANCEL_OR_FINISH: { case BUTTON_CANCEL_OR_FINISH: {
//mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
CancelOrFinish(); CancelOrFinish();
break; break;
} }
case BUTTON_MSG_OK: { case BUTTON_MSG_OK: {
//mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
mainGame->HideElement(mainGame->wMessage); mainGame->HideElement(mainGame->wMessage);
mainGame->actionSignal.Set(); mainGame->actionSignal.Set();
break; break;
} }
case BUTTON_YES: { case BUTTON_YES: {
//mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
switch(mainGame->dInfo.curMsg) { switch(mainGame->dInfo.curMsg) {
case MSG_SELECT_YESNO: case MSG_SELECT_YESNO:
...@@ -258,7 +239,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -258,7 +239,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_NO: { case BUTTON_NO: {
//mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
switch(mainGame->dInfo.curMsg) { switch(mainGame->dInfo.curMsg) {
case MSG_SELECT_YESNO: case MSG_SELECT_YESNO:
...@@ -292,35 +272,30 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -292,35 +272,30 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_POS_AU: { case BUTTON_POS_AU: {
//mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
DuelClient::SetResponseI(POS_FACEUP_ATTACK); DuelClient::SetResponseI(POS_FACEUP_ATTACK);
mainGame->HideElement(mainGame->wPosSelect, true); mainGame->HideElement(mainGame->wPosSelect, true);
break; break;
} }
case BUTTON_POS_AD: { case BUTTON_POS_AD: {
//mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
DuelClient::SetResponseI(POS_FACEDOWN_ATTACK); DuelClient::SetResponseI(POS_FACEDOWN_ATTACK);
mainGame->HideElement(mainGame->wPosSelect, true); mainGame->HideElement(mainGame->wPosSelect, true);
break; break;
} }
case BUTTON_POS_DU: { case BUTTON_POS_DU: {
//mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
DuelClient::SetResponseI(POS_FACEUP_DEFENSE); DuelClient::SetResponseI(POS_FACEUP_DEFENSE);
mainGame->HideElement(mainGame->wPosSelect, true); mainGame->HideElement(mainGame->wPosSelect, true);
break; break;
} }
case BUTTON_POS_DD: { case BUTTON_POS_DD: {
//mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
DuelClient::SetResponseI(POS_FACEDOWN_DEFENSE); DuelClient::SetResponseI(POS_FACEDOWN_DEFENSE);
mainGame->HideElement(mainGame->wPosSelect, true); mainGame->HideElement(mainGame->wPosSelect, true);
break; break;
} }
case BUTTON_OPTION_PREV: { case BUTTON_OPTION_PREV: {
//mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
selected_option--; selected_option--;
mainGame->btnOptionn->setVisible(true); mainGame->btnOptionn->setVisible(true);
...@@ -330,7 +305,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -330,7 +305,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_OPTION_NEXT: { case BUTTON_OPTION_NEXT: {
//mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
selected_option++; selected_option++;
mainGame->btnOptionp->setVisible(true); mainGame->btnOptionp->setVisible(true);
...@@ -344,7 +318,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -344,7 +318,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
case BUTTON_OPTION_2: case BUTTON_OPTION_2:
case BUTTON_OPTION_3: case BUTTON_OPTION_3:
case BUTTON_OPTION_4: { case BUTTON_OPTION_4: {
//mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
int step = mainGame->scrOption->isVisible() ? mainGame->scrOption->getPos() : 0; int step = mainGame->scrOption->isVisible() ? mainGame->scrOption->getPos() : 0;
selected_option = id - BUTTON_OPTION_0 + step; selected_option = id - BUTTON_OPTION_0 + step;
...@@ -352,20 +325,17 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -352,20 +325,17 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_OPTION_OK: { case BUTTON_OPTION_OK: {
//mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
SetResponseSelectedOption(); SetResponseSelectedOption();
break; break;
} }
case BUTTON_ANNUMBER_OK: { case BUTTON_ANNUMBER_OK: {
//mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
DuelClient::SetResponseI(mainGame->cbANNumber->getSelected()); DuelClient::SetResponseI(mainGame->cbANNumber->getSelected());
mainGame->HideElement(mainGame->wANNumber, true); mainGame->HideElement(mainGame->wANNumber, true);
break; break;
} }
case BUTTON_ANCARD_OK: { case BUTTON_ANCARD_OK: {
//mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
int sel = mainGame->lstANCard->getSelected(); int sel = mainGame->lstANCard->getSelected();
if(sel == -1) if(sel == -1)
...@@ -375,7 +345,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -375,7 +345,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_CMD_SHUFFLE: { case BUTTON_CMD_SHUFFLE: {
//mainGame->soundEffectPlayer->doShuffleCardEffect();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::SHUFFLE); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::SHUFFLE);
mainGame->btnShuffle->setVisible(false); mainGame->btnShuffle->setVisible(false);
DuelClient::SetResponseI(8); DuelClient::SetResponseI(8);
...@@ -574,7 +543,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -574,7 +543,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_CMD_SHOWLIST: { case BUTTON_CMD_SHOWLIST: {
//mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
mainGame->wCmdMenu->setVisible(false); mainGame->wCmdMenu->setVisible(false);
selectable_cards.clear(); selectable_cards.clear();
...@@ -803,7 +771,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -803,7 +771,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_CARD_SEL_OK: { case BUTTON_CARD_SEL_OK: {
//mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
mainGame->stCardListTip->setVisible(false); mainGame->stCardListTip->setVisible(false);
if(mainGame->dInfo.isReplay) { if(mainGame->dInfo.isReplay) {
...@@ -834,7 +801,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -834,7 +801,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_CARD_DISP_OK: { case BUTTON_CARD_DISP_OK: {
//mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
mainGame->HideElement(mainGame->wCardDisplay); mainGame->HideElement(mainGame->wCardDisplay);
break; break;
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "single_mode.h" #include "single_mode.h"
#ifdef _IRR_ANDROID_PLATFORM_ #ifdef _IRR_ANDROID_PLATFORM_
#include <android/AndroidSoundEffectPlayer.h>
#include <android/CAndroidGUIEditBox.h> #include <android/CAndroidGUIEditBox.h>
#include <android/CAndroidGUIComboBox.h> #include <android/CAndroidGUIComboBox.h>
#include <android/CAndroidGUISkin.h> #include <android/CAndroidGUISkin.h>
...@@ -81,8 +80,6 @@ bool Game::Initialize() { ...@@ -81,8 +80,6 @@ bool Game::Initialize() {
setPositionFix(appPosition); setPositionFix(appPosition);
device->setProcessReceiver(this); device->setProcessReceiver(this);
//soundEffectPlayer = new AndroidSoundEffectPlayer(app);
//soundEffectPlayer->setSEEnabled(options->isSoundEffectEnabled());
app->onInputEvent = android::handleInput; app->onInputEvent = android::handleInput;
ILogger* logger = device->getLogger(); ILogger* logger = device->getLogger();
// logger->setLogLevel(ELL_WARNING); // logger->setLogLevel(ELL_WARNING);
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
#include <list> #include <list>
#include "IYGOSoundEffectPlayer.h"
namespace ygo { namespace ygo {
...@@ -549,7 +548,6 @@ public: ...@@ -549,7 +548,6 @@ public:
float xScale; float xScale;
float yScale; float yScale;
IYGOSoundEffectPlayer* soundEffectPlayer;
#ifdef _IRR_ANDROID_PLATFORM_ #ifdef _IRR_ANDROID_PLATFORM_
ANDROID_APP appMain; ANDROID_APP appMain;
int glversion; int glversion;
......
...@@ -61,14 +61,12 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -61,14 +61,12 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON); mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
switch(id) { switch(id) {
case BUTTON_MODE_EXIT: { case BUTTON_MODE_EXIT: {
//mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->StopBGM(); mainGame->soundManager->StopBGM();
mainGame->SaveConfig(); mainGame->SaveConfig();
mainGame->device->closeDevice(); mainGame->device->closeDevice();
break; break;
} }
case BUTTON_LAN_MODE: { case BUTTON_LAN_MODE: {
//mainGame->soundEffectPlayer->doPressButton();
mainGame->btnCreateHost->setEnabled(true); mainGame->btnCreateHost->setEnabled(true);
mainGame->btnJoinHost->setEnabled(true); mainGame->btnJoinHost->setEnabled(true);
mainGame->btnJoinCancel->setEnabled(true); mainGame->btnJoinCancel->setEnabled(true);
...@@ -118,7 +116,6 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -118,7 +116,6 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_JOIN_CANCEL: { case BUTTON_JOIN_CANCEL: {
//mainGame->soundEffectPlayer->doPressButton();
mainGame->HideElement(mainGame->wLanWindow); mainGame->HideElement(mainGame->wLanWindow);
mainGame->ShowElement(mainGame->wMainMenu); mainGame->ShowElement(mainGame->wMainMenu);
if(exit_on_return) if(exit_on_return)
...@@ -126,12 +123,10 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -126,12 +123,10 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_LAN_REFRESH: { case BUTTON_LAN_REFRESH: {
//mainGame->soundEffectPlayer->doPressButton();
DuelClient::BeginRefreshHost(); DuelClient::BeginRefreshHost();
break; break;
} }
case BUTTON_CREATE_HOST: { case BUTTON_CREATE_HOST: {
//mainGame->soundEffectPlayer->doPressButton();
mainGame->btnHostConfirm->setEnabled(true); mainGame->btnHostConfirm->setEnabled(true);
mainGame->btnHostCancel->setEnabled(true); mainGame->btnHostCancel->setEnabled(true);
mainGame->HideElement(mainGame->wLanWindow); mainGame->HideElement(mainGame->wLanWindow);
...@@ -139,7 +134,6 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -139,7 +134,6 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_HOST_CONFIRM: { case BUTTON_HOST_CONFIRM: {
//mainGame->soundEffectPlayer->doPressButton();
bot_mode = false; bot_mode = false;
BufferIO::CopyWStr(mainGame->ebServerName->getText(), mainGame->gameConf.gamename, 20); BufferIO::CopyWStr(mainGame->ebServerName->getText(), mainGame->gameConf.gamename, 20);
if(!NetServer::StartServer(mainGame->gameConf.serverport)) if(!NetServer::StartServer(mainGame->gameConf.serverport))
...@@ -153,7 +147,6 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -153,7 +147,6 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_HOST_CANCEL: { case BUTTON_HOST_CANCEL: {
//mainGame->soundEffectPlayer->doPressButton();
mainGame->btnCreateHost->setEnabled(true); mainGame->btnCreateHost->setEnabled(true);
mainGame->btnJoinHost->setEnabled(true); mainGame->btnJoinHost->setEnabled(true);
mainGame->btnJoinCancel->setEnabled(true); mainGame->btnJoinCancel->setEnabled(true);
...@@ -162,18 +155,15 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -162,18 +155,15 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_HP_DUELIST: { case BUTTON_HP_DUELIST: {
//mainGame->soundEffectPlayer->doPressButton();
mainGame->cbDeckSelect->setEnabled(true); mainGame->cbDeckSelect->setEnabled(true);
DuelClient::SendPacketToServer(CTOS_HS_TODUELIST); DuelClient::SendPacketToServer(CTOS_HS_TODUELIST);
break; break;
} }
case BUTTON_HP_OBSERVER: { case BUTTON_HP_OBSERVER: {
//mainGame->soundEffectPlayer->doPressButton();
DuelClient::SendPacketToServer(CTOS_HS_TOOBSERVER); DuelClient::SendPacketToServer(CTOS_HS_TOOBSERVER);
break; break;
} }
case BUTTON_HP_KICK: { case BUTTON_HP_KICK: {
//mainGame->soundEffectPlayer->doPressButton();
int id = 0; int id = 0;
while(id < 4) { while(id < 4) {
if(mainGame->btnHostPrepKick[id] == caller) if(mainGame->btnHostPrepKick[id] == caller)
...@@ -186,7 +176,6 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -186,7 +176,6 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_HP_READY: { case BUTTON_HP_READY: {
//mainGame->soundEffectPlayer->doPressButton();
if(mainGame->cbCategorySelect->getSelected() == -1 || mainGame->cbDeckSelect->getSelected() == -1 || if(mainGame->cbCategorySelect->getSelected() == -1 || mainGame->cbDeckSelect->getSelected() == -1 ||
!deckManager.LoadDeck(mainGame->cbCategorySelect, mainGame->cbDeckSelect)) { !deckManager.LoadDeck(mainGame->cbCategorySelect, mainGame->cbDeckSelect)) {
break; break;
...@@ -198,19 +187,16 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -198,19 +187,16 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_HP_NOTREADY: { case BUTTON_HP_NOTREADY: {
//mainGame->soundEffectPlayer->doPressButton();
DuelClient::SendPacketToServer(CTOS_HS_NOTREADY); DuelClient::SendPacketToServer(CTOS_HS_NOTREADY);
mainGame->cbCategorySelect->setEnabled(true); mainGame->cbCategorySelect->setEnabled(true);
mainGame->cbDeckSelect->setEnabled(true); mainGame->cbDeckSelect->setEnabled(true);
break; break;
} }
case BUTTON_HP_START: { case BUTTON_HP_START: {
//mainGame->soundEffectPlayer->doPressButton();
DuelClient::SendPacketToServer(CTOS_HS_START); DuelClient::SendPacketToServer(CTOS_HS_START);
break; break;
} }
case BUTTON_HP_CANCEL: { case BUTTON_HP_CANCEL: {
//mainGame->soundEffectPlayer->doPressButton();
DuelClient::StopClient(); DuelClient::StopClient();
mainGame->btnCreateHost->setEnabled(true); mainGame->btnCreateHost->setEnabled(true);
mainGame->btnJoinHost->setEnabled(true); mainGame->btnJoinHost->setEnabled(true);
...@@ -229,7 +215,6 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -229,7 +215,6 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_REPLAY_MODE: { case BUTTON_REPLAY_MODE: {
//mainGame->soundEffectPlayer->doPressButton();
mainGame->HideElement(mainGame->wMainMenu); mainGame->HideElement(mainGame->wMainMenu);
mainGame->ShowElement(mainGame->wReplay); mainGame->ShowElement(mainGame->wReplay);
mainGame->ebRepStartTurn->setText(L"1"); mainGame->ebRepStartTurn->setText(L"1");
...@@ -238,7 +223,6 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -238,7 +223,6 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_SINGLE_MODE: { case BUTTON_SINGLE_MODE: {
//mainGame->soundEffectPlayer->doPressButton();
mainGame->HideElement(mainGame->wMainMenu); mainGame->HideElement(mainGame->wMainMenu);
mainGame->ShowElement(mainGame->wSinglePlay); mainGame->ShowElement(mainGame->wSinglePlay);
mainGame->RefreshSingleplay(); mainGame->RefreshSingleplay();
...@@ -246,7 +230,6 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -246,7 +230,6 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_LOAD_REPLAY: { case BUTTON_LOAD_REPLAY: {
//mainGame->soundEffectPlayer->doPressButton();
if(mainGame->lstReplayList->getSelected() == -1) if(mainGame->lstReplayList->getSelected() == -1)
break; break;
if(!ReplayMode::cur_replay.OpenReplay(mainGame->lstReplayList->getListItem(mainGame->lstReplayList->getSelected()))) if(!ReplayMode::cur_replay.OpenReplay(mainGame->lstReplayList->getListItem(mainGame->lstReplayList->getSelected())))
...@@ -299,7 +282,6 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -299,7 +282,6 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_CANCEL_REPLAY: { case BUTTON_CANCEL_REPLAY: {
//mainGame->soundEffectPlayer->doPressButton();
mainGame->HideElement(mainGame->wReplay); mainGame->HideElement(mainGame->wReplay);
mainGame->ShowElement(mainGame->wMainMenu); mainGame->ShowElement(mainGame->wMainMenu);
break; break;
...@@ -412,7 +394,6 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -412,7 +394,6 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_LOAD_SINGLEPLAY: { case BUTTON_LOAD_SINGLEPLAY: {
//mainGame->soundEffectPlayer->doPressButton();
if(mainGame->lstSinglePlayList->getSelected() == -1) if(mainGame->lstSinglePlayList->getSelected() == -1)
break; break;
mainGame->singleSignal.SetNoWait(false); mainGame->singleSignal.SetNoWait(false);
...@@ -420,14 +401,12 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -420,14 +401,12 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_CANCEL_SINGLEPLAY: { case BUTTON_CANCEL_SINGLEPLAY: {
//mainGame->soundEffectPlayer->doPressButton();
mainGame->HideElement(mainGame->wSinglePlay); mainGame->HideElement(mainGame->wSinglePlay);
mainGame->ShowElement(mainGame->wMainMenu); mainGame->ShowElement(mainGame->wMainMenu);
break; break;
} }
case BUTTON_DECK_EDIT: { case BUTTON_DECK_EDIT: {
mainGame->RefreshCategoryDeck(mainGame->cbDBCategory, mainGame->cbDBDecks); mainGame->RefreshCategoryDeck(mainGame->cbDBCategory, mainGame->cbDBDecks);
//mainGame->soundEffectPlayer->doPressButton();
if(mainGame->cbDBCategory->getSelected() != -1 && mainGame->cbDBDecks->getSelected() != -1) { if(mainGame->cbDBCategory->getSelected() != -1 && mainGame->cbDBDecks->getSelected() != -1) {
deckManager.LoadDeck(mainGame->cbDBCategory, mainGame->cbDBDecks); deckManager.LoadDeck(mainGame->cbDBCategory, mainGame->cbDBDecks);
mainGame->ebDeckname->setText(L""); mainGame->ebDeckname->setText(L"");
......
/*
* AndroidSoundEffectPlayer.cpp
*
* Created on: 2014-10-1
* Author: mabin
*/
#include "AndroidSoundEffectPlayer.h"
#include "OpenSLSoundTracker.h"
#include "SoundPoolWrapperTracker.h"
namespace ygo {
AndroidSoundEffectPlayer::AndroidSoundEffectPlayer(ANDROID_APP app) :
m_pAudioTracker(NULL), m_isEnabled(false) {
if (m_pAudioTracker == NULL) {
// m_pAudioTracker = new OpenSLSoundTracker(app->activity->assetManager);
m_pAudioTracker = new SoundPoolWrapperTracker(app);
}
}
AndroidSoundEffectPlayer::~AndroidSoundEffectPlayer() {
if (m_pAudioTracker != NULL) {
delete m_pAudioTracker;
m_pAudioTracker = NULL;
}
}
void AndroidSoundEffectPlayer::setSEEnabled(bool enabled) {
m_isEnabled = enabled;
}
void AndroidSoundEffectPlayer::doPlayerEnterEffect() {
if (m_isEnabled) {
m_pAudioTracker->playBGM(irr::io::path("sound/playerenter.ogg"),
AP_TYPE_ASSET);
}
}
void AndroidSoundEffectPlayer::doShuffleCardEffect() {
if (m_isEnabled) {
m_pAudioTracker->playBGM(irr::io::path("sound/shuffle.ogg"),
AP_TYPE_ASSET);
}
}
void AndroidSoundEffectPlayer::doNewTurnEffect() {
if (m_isEnabled) {
m_pAudioTracker->playBGM(irr::io::path("sound/nextturn.ogg"),
AP_TYPE_ASSET);
}
}
void AndroidSoundEffectPlayer::doNewPhaseEffect() {
if (m_isEnabled) {
m_pAudioTracker->playBGM(irr::io::path("sound/phase.ogg"),
AP_TYPE_ASSET);
}
}
void AndroidSoundEffectPlayer::doSetCardEffect() {
if (m_isEnabled) {
m_pAudioTracker->playBGM(irr::io::path("sound/set.ogg"),
AP_TYPE_ASSET);
}
}
void AndroidSoundEffectPlayer::doSummonEffect() {
if (m_isEnabled) {
m_pAudioTracker->playBGM(irr::io::path("sound/summon.ogg"),
AP_TYPE_ASSET);
}
}
void AndroidSoundEffectPlayer::doSpecialSummonEffect() {
if (m_isEnabled) {
m_pAudioTracker->playBGM(irr::io::path("sound/specialsummon.ogg"),
AP_TYPE_ASSET);
}
}
void AndroidSoundEffectPlayer::doFlipCardEffect() {
if (m_isEnabled) {
m_pAudioTracker->playBGM(irr::io::path("sound/flip.ogg"),
AP_TYPE_ASSET);
}
}
void AndroidSoundEffectPlayer::doActivateEffect() {
if (m_isEnabled) {
m_pAudioTracker->playBGM(irr::io::path("sound/activate.ogg"),
AP_TYPE_ASSET);
}
}
void AndroidSoundEffectPlayer::doDrawCardEffect() {
if (m_isEnabled) {
m_pAudioTracker->playBGM(irr::io::path("sound/draw.ogg"),
AP_TYPE_ASSET);
}
}
void AndroidSoundEffectPlayer::doDamageEffect() {
if (m_isEnabled) {
m_pAudioTracker->playBGM(irr::io::path("sound/damage.ogg"),
AP_TYPE_ASSET);
}
}
void AndroidSoundEffectPlayer::doGainLpEffect() {
if (m_isEnabled) {
m_pAudioTracker->playBGM(irr::io::path("sound/addcounter.ogg"),
AP_TYPE_ASSET);
}
}
void AndroidSoundEffectPlayer::doEquipEffect() {
if (m_isEnabled) {
m_pAudioTracker->playBGM(irr::io::path("sound/equip.ogg"),
AP_TYPE_ASSET);
}
}
void AndroidSoundEffectPlayer::doAddCounterEffect() {
if (m_isEnabled) {
m_pAudioTracker->playBGM(irr::io::path("sound/addcounter.ogg"),
AP_TYPE_ASSET);
}
}
void AndroidSoundEffectPlayer::doRemoveCounterEffect() {
if (m_isEnabled) {
m_pAudioTracker->playBGM(irr::io::path("sound/coinflip.ogg"),
AP_TYPE_ASSET);
}
}
void AndroidSoundEffectPlayer::doAttackEffect() {
if (m_isEnabled) {
m_pAudioTracker->playBGM(irr::io::path("sound/attack.ogg"),
AP_TYPE_ASSET);
}
}
void AndroidSoundEffectPlayer::doCoinFlipEffect() {
if (m_isEnabled) {
m_pAudioTracker->playBGM(irr::io::path("sound/coinflip.ogg"),
AP_TYPE_ASSET);
}
}
void AndroidSoundEffectPlayer::doDiceRollEffect() {
if (m_isEnabled) {
m_pAudioTracker->playBGM(irr::io::path("sound/diceroll.ogg"),
AP_TYPE_ASSET);
}
}
void AndroidSoundEffectPlayer::doChatEffect() {
if (m_isEnabled) {
m_pAudioTracker->playBGM(irr::io::path("sound/chatmessage.ogg"),
AP_TYPE_ASSET);
}
}
void AndroidSoundEffectPlayer::doDestroyEffect() {
if (m_isEnabled) {
m_pAudioTracker->playBGM(irr::io::path("sound/destroyed.ogg"),
AP_TYPE_ASSET);
}
}
//add new soundeffect and BGM
void AndroidSoundEffectPlayer::doMenuBGM() {
if (m_isEnabled) {
m_pAudioTracker->playBGM(irr::io::path("sound/MenuBGM.ogg"),
AP_TYPE_ASSET);
}
}
void AndroidSoundEffectPlayer::doDeckBgm() {
if (m_isEnabled) {
m_pAudioTracker->playBGM(irr::io::path("sound/DeckBgm.ogg"),
AP_TYPE_ASSET);
}
}
void AndroidSoundEffectPlayer::doSaveDeck() {
if (m_isEnabled) {
m_pAudioTracker->playBGM(irr::io::path("sound/addcounter.ogg"),
AP_TYPE_ASSET);
}
}
void AndroidSoundEffectPlayer::doDelete() {
if (m_isEnabled) {
m_pAudioTracker->playBGM(irr::io::path("sound/phase.ogg"),
AP_TYPE_ASSET);
}
}
void AndroidSoundEffectPlayer::doLeave() {
if (m_isEnabled) {
m_pAudioTracker->playBGM(irr::io::path("sound/equip.ogg"),
AP_TYPE_ASSET);
}
}
void AndroidSoundEffectPlayer::doReady() {
if (m_isEnabled) {
m_pAudioTracker->playBGM(irr::io::path("sound/addcounte.ogg"),
AP_TYPE_ASSET);
}
}
void AndroidSoundEffectPlayer::doUnReady() {
if (m_isEnabled) {
m_pAudioTracker->playBGM(irr::io::path("sound/phase.ogg"),
AP_TYPE_ASSET);
}
}
void AndroidSoundEffectPlayer::doPlayerExit() {
if (m_isEnabled) {
m_pAudioTracker->playBGM(irr::io::path("sound/equip.ogg"),
AP_TYPE_ASSET);
}
}
void AndroidSoundEffectPlayer::doOpeningBGM() {
if (m_isEnabled) {
m_pAudioTracker->playBGM(irr::io::path("sound/doOpeningBGM.ogg"),
AP_TYPE_ASSET);
}
}
void AndroidSoundEffectPlayer::doDisadvantageBgm() {
if (m_isEnabled) {
m_pAudioTracker->playBGM(irr::io::path("sound/doDisadvantageBgm.ogg"),
AP_TYPE_ASSET);
}
}
void AndroidSoundEffectPlayer::doAdvantageBgm() {
if (m_isEnabled) {
m_pAudioTracker->playBGM(irr::io::path("sound/doAdvantageBgm.ogg"),
AP_TYPE_ASSET);
}
}
void AndroidSoundEffectPlayer::doWinBgm() {
if (m_isEnabled) {
m_pAudioTracker->playBGM(irr::io::path("sound/doWinBgm.ogg"),
AP_TYPE_ASSET);
}
}
void AndroidSoundEffectPlayer::doLoseBgm() {
if (m_isEnabled) {
m_pAudioTracker->playBGM(irr::io::path("sound/doLoseBgm.ogg"),
AP_TYPE_ASSET);
}
}
void AndroidSoundEffectPlayer::doStartGame() {
if (m_isEnabled) {
m_pAudioTracker->playBGM(irr::io::path("sound/doStartGame.ogg"),
AP_TYPE_ASSET);
}
}
void AndroidSoundEffectPlayer::doPressButton() {
if (m_isEnabled) {
m_pAudioTracker->playBGM(irr::io::path("sound/chatmessage.ogg"),
AP_TYPE_ASSET);
}
}
} /* namespace ygo */
/*
* AndroidSoundEffectPlayer.h
*
* Created on: 2014-10-1
* Author: mabin
*/
#ifndef ANDROIDSOUNDEFFECTPLAYER_H_
#define ANDROIDSOUNDEFFECTPLAYER_H_
#include "../../Classes/gframe/IYGOSoundEffectPlayer.h"
#include "../../Classes/gframe/IAudioTracker.h"
#include <android/asset_manager.h>
#include <android/asset_manager_jni.h>
#include <android_native_app_glue.h>
namespace ygo {
class AndroidSoundEffectPlayer: virtual public ygo::IYGOSoundEffectPlayer {
public:
AndroidSoundEffectPlayer(ANDROID_APP app);
virtual ~AndroidSoundEffectPlayer();
virtual void doPlayerEnterEffect();
virtual void doShuffleCardEffect();
virtual void doNewTurnEffect();
virtual void doNewPhaseEffect();
virtual void doSetCardEffect();
virtual void doSummonEffect();
virtual void doSpecialSummonEffect();
virtual void doFlipCardEffect();
virtual void doActivateEffect();
virtual void doDrawCardEffect();
virtual void doDamageEffect();
virtual void doGainLpEffect();
virtual void doEquipEffect();
virtual void doAddCounterEffect();
virtual void doRemoveCounterEffect();
virtual void doAttackEffect();
virtual void doCoinFlipEffect();
virtual void doDiceRollEffect();
virtual void doChatEffect();
virtual void doDestroyEffect();
virtual void setSEEnabled(bool enabled);
//add new sound effect and BGM @fallenstardust
virtual void doMenuBGM();
virtual void doDeckBgm();
virtual void doSaveDeck();
virtual void doDelete();
virtual void doLeave();
virtual void doReady();
virtual void doUnReady();
virtual void doPlayerExit();
virtual void doOpeningBGM();
virtual void doDisadvantageBgm();
virtual void doAdvantageBgm();
virtual void doWinBgm();
virtual void doLoseBgm();
virtual void doStartGame();
virtual void doPressButton();
private:
IAudioTracker* m_pAudioTracker;
bool m_isEnabled;
};
}
/* namespace ygo */
#endif /* ANDROIDSOUNDEFFECTPLAYER_H_ */
/*
* OpenSLSoundTracker.cpp
*
* Created on: 2014-9-30
* Author: mabin
*/
#include "OpenSLSoundTracker.h"
namespace ygo {
OpenSLSoundTracker::OpenSLSoundTracker(AAssetManager* am) :
mBQPlayerObject(NULL), mOutputMixObject(NULL), mEngineObject(NULL), mFDPlayerObject(
NULL) {
initAudioEngine();
mAm = am;
}
OpenSLSoundTracker::~OpenSLSoundTracker() {
// destroy buffer queue audio player object, and invalidate all associated interfaces
if (mFDPlayerObject != NULL) {
(*mFDPlayerObject)->Destroy(mFDPlayerObject);
mFDPlayerObject = NULL;
mFDPlayerPlay = NULL;
}
// destroy buffer queue audio player object, and invalidate all associated interfaces
if (mBQPlayerObject != NULL) {
(*mBQPlayerObject)->Destroy(mBQPlayerObject);
mBQPlayerObject = NULL;
mBQPlayerPlay = NULL;
mBQPlayerBufferQueue = NULL;
}
// destroy output mix object, and invalidate all associated interfaces
if (mOutputMixObject != NULL) {
(*mOutputMixObject)->Destroy(mOutputMixObject);
mOutputMixObject = NULL;
}
// destroy engine object, and invalidate all associated interfaces
if (mEngineObject != NULL) {
(*mEngineObject)->Destroy(mEngineObject);
mEngineObject = NULL;
mEngine = NULL;
}
mAm = NULL;
}
void OpenSLSoundTracker::initAudioEngine() {
SLresult result;
// create engine
result = slCreateEngine(&mEngineObject, 0, NULL, 0, NULL, NULL);
assert(SL_RESULT_SUCCESS == result);
(void) result;
// realize the engine
result = (*mEngineObject)->Realize(mEngineObject, SL_BOOLEAN_FALSE);
assert(SL_RESULT_SUCCESS == result);
(void) result;
// get the engine interface, which is needed in order to create other objects
result = (*mEngineObject)->GetInterface(mEngineObject, SL_IID_ENGINE,
&mEngine);
assert(SL_RESULT_SUCCESS == result);
(void) result;
const SLInterfaceID ids[0] = {};
const SLboolean req[0] = {};
result = (*mEngine)->CreateOutputMix(mEngine, &mOutputMixObject, 0, ids,
req);
assert(SL_RESULT_SUCCESS == result);
(void) result;
// realize the output mix
result = (*mOutputMixObject)->Realize(mOutputMixObject, SL_BOOLEAN_FALSE);
assert(SL_RESULT_SUCCESS == result);
(void) result;
}
void OpenSLSoundTracker::createBufferQueuePlayer() {
SLresult result;
// configure audio source
SLDataLocator_AndroidSimpleBufferQueue loc_bufq = {
SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, 2 };
SLDataFormat_PCM format_pcm = { SL_DATAFORMAT_PCM, 1, SL_SAMPLINGRATE_16,
SL_PCMSAMPLEFORMAT_FIXED_16, SL_PCMSAMPLEFORMAT_FIXED_16,
SL_SPEAKER_FRONT_CENTER, SL_BYTEORDER_LITTLEENDIAN };
SLDataSource audioSrc = { &loc_bufq, &format_pcm };
// configure audio sink
SLDataLocator_OutputMix loc_outmix = { SL_DATALOCATOR_OUTPUTMIX,
mOutputMixObject };
SLDataSink audioSnk = { &loc_outmix, NULL };
// create audio player
const SLInterfaceID ids[1] = { SL_IID_BUFFERQUEUE };
const SLboolean req[1] = { SL_BOOLEAN_TRUE };
result = (*mEngine)->CreateAudioPlayer(mEngine, &mBQPlayerObject, &audioSrc,
&audioSnk, 1, ids, req);
assert(SL_RESULT_SUCCESS == result);
(void) result;
// realize the player
result = (*mBQPlayerObject)->Realize(mBQPlayerObject, SL_BOOLEAN_FALSE);
assert(SL_RESULT_SUCCESS == result);
(void) result;
// get the play interface
result = (*mBQPlayerObject)->GetInterface(mBQPlayerObject, SL_IID_PLAY,
&mBQPlayerPlay);
assert(SL_RESULT_SUCCESS == result);
(void) result;
// get the buffer queue interface
result = (*mBQPlayerObject)->GetInterface(mBQPlayerObject,
SL_IID_BUFFERQUEUE, &mBQPlayerBufferQueue);
assert(SL_RESULT_SUCCESS == result);
(void) result;
// set the player's state to playing
result = (*mBQPlayerPlay)->SetPlayState(mBQPlayerPlay,
SL_PLAYSTATE_PLAYING);
assert(SL_RESULT_SUCCESS == result);
(void) result;
}
void OpenSLSoundTracker::playBGM(irr::io::path path, AUDIO_PATH_TYPE type) {
// destroy buffer queue audio player object, and invalidate all associated interfaces
if (mFDPlayerObject != NULL) {
(*mFDPlayerObject)->Destroy(mFDPlayerObject);
mFDPlayerObject = NULL;
mFDPlayerPlay = NULL;
}
SLresult result;
AAsset* asset = AAssetManager_open(mAm, path.c_str(), AASSET_MODE_UNKNOWN);
// the asset might not be found
if (NULL == asset) {
return;
}
// open asset as file descriptor
off_t start, length;
int fd = AAsset_openFileDescriptor(asset, &start, &length);
assert(0 <= fd);
AAsset_close(asset);
// configure audio source
SLDataLocator_AndroidFD loc_fd = { SL_DATALOCATOR_ANDROIDFD, fd, start,
length };
SLDataFormat_MIME format_mime = { SL_DATAFORMAT_MIME, NULL,
SL_CONTAINERTYPE_UNSPECIFIED };
SLDataSource audioSrc = { &loc_fd, &format_mime };
// configure audio sink
SLDataLocator_OutputMix loc_outmix = { SL_DATALOCATOR_OUTPUTMIX,
mOutputMixObject };
SLDataSink audioSnk = { &loc_outmix, NULL };
// create audio player
const SLInterfaceID ids[3] = { SL_IID_SEEK, SL_IID_MUTESOLO, SL_IID_VOLUME };
const SLboolean req[3] =
{ SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE };
result = (*mEngine)->CreateAudioPlayer(mEngine, &mFDPlayerObject, &audioSrc,
&audioSnk, 3, ids, req);
assert(SL_RESULT_SUCCESS == result);
(void) result;
// realize the player
result = (*mFDPlayerObject)->Realize(mFDPlayerObject, SL_BOOLEAN_FALSE);
assert(SL_RESULT_SUCCESS == result);
(void) result;
// get the play interface
result = (*mFDPlayerObject)->GetInterface(mFDPlayerObject, SL_IID_PLAY,
&mFDPlayerPlay);
assert(SL_RESULT_SUCCESS == result);
(void) result;
if (NULL != mFDPlayerPlay) {
// set the player's state
result = (*mFDPlayerPlay)->SetPlayState(mFDPlayerPlay, SL_PLAYSTATE_PLAYING);
assert(SL_RESULT_SUCCESS == result);
(void) result;
}
return;
}
void OpenSLSoundTracker::playSound(irr::io::path path, AUDIO_PATH_TYPE type) {
}
} /* namespace ygo */
/*
* OpenSLSoundTracker.h
*
* Created on: 2014-9-30
* Author: mabin
*/
#ifndef OPENSLSOUNDTRACKER_H_
#define OPENSLSOUNDTRACKER_H_
#include "../../Classes/gframe/IAudioTracker.h"
// for native audio
#include <SLES/OpenSLES.h>
#include <SLES/OpenSLES_Android.h>
// for native asset manager
#include <sys/types.h>
#include <android/asset_manager.h>
#include <android/asset_manager_jni.h>
namespace ygo {
class OpenSLSoundTracker: public virtual ygo::IAudioTracker {
public:
OpenSLSoundTracker(AAssetManager* am);
virtual ~OpenSLSoundTracker();
virtual void playBGM(irr::io::path path, AUDIO_PATH_TYPE type);
virtual void playSound(irr::io::path path, AUDIO_PATH_TYPE type);
private:
void initAudioEngine();
void createBufferQueuePlayer();
void createBufferQueuePlayer2();
void createAssetFilePlayer();
void createUriFilePlayer();
SLObjectItf mEngineObject;
SLObjectItf mOutputMixObject;
SLEnvironmentalReverbItf mOutputMixEnvironmentalReverb;
SLEngineItf mEngine;
SLObjectItf mBQPlayerObject;
SLPlayItf mBQPlayerPlay;
SLAndroidSimpleBufferQueueItf mBQPlayerBufferQueue;
AAssetManager* mAm;
SLObjectItf mFDPlayerObject;
SLPlayItf mFDPlayerPlay;
};
}
/* namespace ygo */
#endif /* OPENSLSOUNDTRACKER_H_ */
/*
* SoundPoolWrapperTracker.cpp
*
* Created on: 2014-10-2
* Author: mabin
*/
#include "SoundPoolWrapperTracker.h"
namespace ygo {
static void* audioPlayThread(void* param);
SoundPoolWrapperTracker::SoundPoolWrapperTracker(ANDROID_APP app) :
m_isTerminated(false), m_sounds(NULL) {
m_sounds = new std::list<irr::io::path>();
m_pPlaySignal = new Signal();
m_mainApp = app;
pthread_mutex_init(&m_soundLock, NULL);
//init Audio Thread;
pthread_attr_t audioAttr;
pthread_attr_init(&audioAttr);
pthread_create(&m_audioThread, &audioAttr, audioPlayThread, (void *) this);
pthread_attr_destroy(&audioAttr);
pthread_detach(m_audioThread);
}
SoundPoolWrapperTracker::~SoundPoolWrapperTracker() {
if (m_sounds != NULL) {
delete m_sounds;
m_sounds = NULL;
}
m_isTerminated = true;
m_pPlaySignal->SetNoWait(true);
m_pPlaySignal->Set();
pthread_join(m_audioThread, NULL);
pthread_mutex_destroy(&m_soundLock);
}
void* audioPlayThread(void* param) {
SoundPoolWrapperTracker* spwt = (SoundPoolWrapperTracker*) param;
ANDROID_APP app = spwt->getMainApp();
Signal* signal = (Signal*)spwt->getPlaySignal();
JNIEnv* jni = 0;
pthread_mutex_t soundlock = spwt->getSoundLock();
std::list<irr::io::path>* sounds = (std::list<irr::io::path>*)spwt->getSounds();
app->activity->vm->AttachCurrentThread(&jni, NULL);
jobject lNativeActivity = app->activity->clazz;
jclass ClassNativeActivity = jni->GetObjectClass(lNativeActivity);
jmethodID MethodGetApp = jni->GetMethodID(ClassNativeActivity,
"getApplication", "()Landroid/app/Application;");
jobject application = jni->CallObjectMethod(lNativeActivity, MethodGetApp);
jclass classApp = jni->GetObjectClass(application);
jmethodID playSoundMethod = jni->GetMethodID(classApp, "playSoundEffect",
"(Ljava/lang/String;)V");
while (!spwt->m_isTerminated) {
signal->Wait();
if (signal->GetNoWait()) {
break;
}
pthread_mutex_lock(&soundlock);
for (auto iter = sounds->begin(); iter != sounds->end(); iter++) {
if (*iter != NULL) {
const char * pathStr = (*iter).c_str();
if (pathStr != NULL && pathStr[0] != '\0') {
jstring pathString = jni->NewStringUTF((*iter).c_str());
jni->CallVoidMethod(application, playSoundMethod,
pathString);
if (pathString) {
jni->DeleteLocalRef(pathString);
}
}
}
}
sounds->clear();
pthread_mutex_unlock(&soundlock);
signal->Reset();
}
jni->DeleteLocalRef(classApp);
jni->DeleteLocalRef(ClassNativeActivity);
app->activity->vm->DetachCurrentThread();
delete signal;
return NULL;
}
void ygo::SoundPoolWrapperTracker::playBGM(irr::io::path path,
AUDIO_PATH_TYPE type) {
pthread_mutex_lock(&m_soundLock);
m_sounds->push_back(path);
pthread_mutex_unlock(&m_soundLock);
m_pPlaySignal->Set();
}
void ygo::SoundPoolWrapperTracker::playSound(irr::io::path path,
AUDIO_PATH_TYPE type) {
}
} /* namespace ygo */
/*
* SoundPoolWrapperTracker.h
*
* Created on: 2014-10-2
* Author: mabin
*/
#ifndef SOUNDPOOLWRAPPERTRACKER_H_
#define SOUNDPOOLWRAPPERTRACKER_H_
#include "../../Classes/gframe/IAudioTracker.h"
#include <android_native_app_glue.h>
#include "../../Classes/gframe/mysignal.h"
#include <list>
#include <pthread.h>
namespace ygo {
class SoundPoolWrapperTracker: public ygo::IAudioTracker {
public:
SoundPoolWrapperTracker(ANDROID_APP app);
virtual ~SoundPoolWrapperTracker();
virtual void playBGM(irr::io::path path, AUDIO_PATH_TYPE type);
virtual void playSound(irr::io::path path, AUDIO_PATH_TYPE type);
inline const std::list<irr::io::path>* getSounds() {
return m_sounds;
}
inline const ANDROID_APP getMainApp() {
return m_mainApp;
}
inline const Signal* getPlaySignal() {
return m_pPlaySignal;
}
inline const pthread_mutex_t getSoundLock() {
return m_soundLock;
}
volatile bool m_isTerminated;
private:
ANDROID_APP m_mainApp;
pthread_t m_audioThread;
Signal* m_pPlaySignal;
pthread_mutex_t m_soundLock;
std::list<irr::io::path> * m_sounds;
};
}
/* namespace ygo */
#endif /* SOUNDPOOLWRAPPERTRACKER_H_ */
...@@ -48,9 +48,6 @@ LOCAL_SRC_FILES := $(LOCAL_PATH)/android/android_tools.cpp \ ...@@ -48,9 +48,6 @@ LOCAL_SRC_FILES := $(LOCAL_PATH)/android/android_tools.cpp \
$(LOCAL_PATH)/android/CAndroidGUISkin.cpp \ $(LOCAL_PATH)/android/CAndroidGUISkin.cpp \
$(LOCAL_PATH)/android/CustomShaderConstantSetCallBack.cpp \ $(LOCAL_PATH)/android/CustomShaderConstantSetCallBack.cpp \
$(LOCAL_PATH)/android/YGOGameOptions.cpp \ $(LOCAL_PATH)/android/YGOGameOptions.cpp \
$(LOCAL_PATH)/android/AndroidSoundEffectPlayer.cpp \
$(LOCAL_PATH)/android/OpenSLSoundTracker.cpp \
$(LOCAL_PATH)/android/SoundPoolWrapperTracker.cpp \
$(LOCAL_PATH)/../Classes/gframe/CGUIEditBox.cpp \ $(LOCAL_PATH)/../Classes/gframe/CGUIEditBox.cpp \
$(LOCAL_PATH)/../Classes/gframe/CGUIButton.cpp \ $(LOCAL_PATH)/../Classes/gframe/CGUIButton.cpp \
$(LOCAL_PATH)/../Classes/gframe/CGUIComboBox.cpp \ $(LOCAL_PATH)/../Classes/gframe/CGUIComboBox.cpp \
......
...@@ -8,7 +8,7 @@ android { ...@@ -8,7 +8,7 @@ android {
applicationId "cn.garymb.ygomobile" applicationId "cn.garymb.ygomobile"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 28 targetSdkVersion 28
versionCode 354001201 versionCode 354001208
versionName "3.5.4" versionName "3.5.4"
flavorDimensions "versionCode" flavorDimensions "versionCode"
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true
......
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