Sound: 新增腾讯AI开放平台合成的语音 (千千音乐转换为 wav)
原有语音进行替换,新增语音暂未应用。 链接: https://ai.qq.com/product/aaitts.shtml
This commit is contained in:
parent
945ce69940
commit
1406b98421
|
@ -62,9 +62,34 @@
|
|||
<file>resources/sound/loss.wav</file>
|
||||
<file>resources/sound/move.wav</file>
|
||||
<file>resources/sound/newgame.wav</file>
|
||||
<file>resources/sound/remove.wav</file>
|
||||
<file>resources/sound/win.wav</file>
|
||||
<file>resources/sound/warning.wav</file>
|
||||
<file>resources/sound/capture.wav</file>
|
||||
<file>resources/sound/BlockMill_B.wav</file>
|
||||
<file>resources/sound/BlockMill_W.wav</file>
|
||||
<file>resources/sound/Capture_B.wav</file>
|
||||
<file>resources/sound/Capture_W.wav</file>
|
||||
<file>resources/sound/Draw.wav</file>
|
||||
<file>resources/sound/GameStart.wav</file>
|
||||
<file>resources/sound/Mill_B.wav</file>
|
||||
<file>resources/sound/Mill_W.wav</file>
|
||||
<file>resources/sound/MillRepeatly_B.wav</file>
|
||||
<file>resources/sound/MillRepeatly_W.wav</file>
|
||||
<file>resources/sound/NextMill_B.wav</file>
|
||||
<file>resources/sound/NextMill_W.wav</file>
|
||||
<file>resources/sound/Obvious.wav</file>
|
||||
<file>resources/sound/RepeatThreeDraw.wav</file>
|
||||
<file>resources/sound/Side_B.wav</file>
|
||||
<file>resources/sound/Side_W.wav</file>
|
||||
<file>resources/sound/Star_B.wav</file>
|
||||
<file>resources/sound/Star_W.wav</file>
|
||||
<file>resources/sound/Suffocated_B.wav</file>
|
||||
<file>resources/sound/Suffocated_W.wav</file>
|
||||
<file>resources/sound/Vantage.wav</file>
|
||||
<file>resources/sound/Very.wav</file>
|
||||
<file>resources/sound/Win_B.wav</file>
|
||||
<file>resources/sound/Win_W.wav</file>
|
||||
<file>resources/sound/WinsAndLossesAreObvious.wav</file>
|
||||
<file>resources/sound/GiveUp_B.wav</file>
|
||||
<file>resources/sound/GiveUp_W.wav</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -834,18 +834,17 @@
|
|||
</Image>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Media Include="resources\sound\capture.wav">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</Media>
|
||||
<Media Include="resources\sound\BlockMill_B.wav" />
|
||||
<Media Include="resources\sound\BlockMill_W.wav" />
|
||||
<Media Include="resources\sound\Capture_B.wav" />
|
||||
<Media Include="resources\sound\Capture_W.wav" />
|
||||
<Media Include="resources\sound\choose.wav">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</Media>
|
||||
<Media Include="resources\sound\Draw.wav" />
|
||||
<Media Include="resources\sound\drog.wav">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
|
@ -858,12 +857,19 @@
|
|||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</Media>
|
||||
<Media Include="resources\sound\GameStart.wav" />
|
||||
<Media Include="resources\sound\GiveUp_B.wav" />
|
||||
<Media Include="resources\sound\GiveUp_W.wav" />
|
||||
<Media Include="resources\sound\loss.wav">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</Media>
|
||||
<Media Include="resources\sound\MillRepeatly_B.wav" />
|
||||
<Media Include="resources\sound\MillRepeatly_W.wav" />
|
||||
<Media Include="resources\sound\Mill_B.wav" />
|
||||
<Media Include="resources\sound\Mill_W.wav" />
|
||||
<Media Include="resources\sound\move.wav">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
|
@ -876,12 +882,18 @@
|
|||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</Media>
|
||||
<Media Include="resources\sound\remove.wav">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</Media>
|
||||
<Media Include="resources\sound\NextMill_B.wav" />
|
||||
<Media Include="resources\sound\NextMill_W.wav" />
|
||||
<Media Include="resources\sound\Obvious.wav" />
|
||||
<Media Include="resources\sound\RepeatThreeDraw.wav" />
|
||||
<Media Include="resources\sound\Side_B.wav" />
|
||||
<Media Include="resources\sound\Side_W.wav" />
|
||||
<Media Include="resources\sound\Star_B.wav" />
|
||||
<Media Include="resources\sound\Star_W.wav" />
|
||||
<Media Include="resources\sound\Suffocated_B.wav" />
|
||||
<Media Include="resources\sound\Suffocated_W.wav" />
|
||||
<Media Include="resources\sound\Vantage.wav" />
|
||||
<Media Include="resources\sound\Very.wav" />
|
||||
<Media Include="resources\sound\warning.wav">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
|
@ -894,6 +906,9 @@
|
|||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</Media>
|
||||
<Media Include="resources\sound\WinsAndLossesAreObvious.wav" />
|
||||
<Media Include="resources\sound\Win_B.wav" />
|
||||
<Media Include="resources\sound\Win_W.wav" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtUic Include="gamewindow.ui" />
|
||||
|
|
|
@ -467,16 +467,91 @@
|
|||
<Media Include="resources\sound\newgame.wav">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Media>
|
||||
<Media Include="resources\sound\remove.wav">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Media>
|
||||
<Media Include="resources\sound\win.wav">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Media>
|
||||
<Media Include="resources\sound\warning.wav">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Media>
|
||||
<Media Include="resources\sound\capture.wav">
|
||||
<Media Include="resources\sound\BlockMill_B.wav">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Media>
|
||||
<Media Include="resources\sound\BlockMill_W.wav">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Media>
|
||||
<Media Include="resources\sound\Capture_B.wav">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Media>
|
||||
<Media Include="resources\sound\Capture_W.wav">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Media>
|
||||
<Media Include="resources\sound\Draw.wav">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Media>
|
||||
<Media Include="resources\sound\GameStart.wav">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Media>
|
||||
<Media Include="resources\sound\Mill_B.wav">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Media>
|
||||
<Media Include="resources\sound\Mill_W.wav">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Media>
|
||||
<Media Include="resources\sound\MillRepeatly_B.wav">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Media>
|
||||
<Media Include="resources\sound\MillRepeatly_W.wav">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Media>
|
||||
<Media Include="resources\sound\NextMill_B.wav">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Media>
|
||||
<Media Include="resources\sound\NextMill_W.wav">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Media>
|
||||
<Media Include="resources\sound\Obvious.wav">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Media>
|
||||
<Media Include="resources\sound\RepeatThreeDraw.wav">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Media>
|
||||
<Media Include="resources\sound\Side_B.wav">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Media>
|
||||
<Media Include="resources\sound\Side_W.wav">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Media>
|
||||
<Media Include="resources\sound\Star_B.wav">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Media>
|
||||
<Media Include="resources\sound\Star_W.wav">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Media>
|
||||
<Media Include="resources\sound\Suffocated_B.wav">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Media>
|
||||
<Media Include="resources\sound\Suffocated_W.wav">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Media>
|
||||
<Media Include="resources\sound\Vantage.wav">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Media>
|
||||
<Media Include="resources\sound\Very.wav">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Media>
|
||||
<Media Include="resources\sound\Win_B.wav">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Media>
|
||||
<Media Include="resources\sound\Win_W.wav">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Media>
|
||||
<Media Include="resources\sound\WinsAndLossesAreObvious.wav">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Media>
|
||||
<Media Include="resources\sound\GiveUp_B.wav">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Media>
|
||||
<Media Include="resources\sound\GiveUp_W.wav">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Media>
|
||||
</ItemGroup>
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1046,6 +1046,11 @@ void StateInfo::setSideToMove(player_t player)
|
|||
position->chOpponent = Player::idToCh(position->opponentId);
|
||||
}
|
||||
|
||||
player_t StateInfo::getSideToMove()
|
||||
{
|
||||
return position->sideToMove;
|
||||
}
|
||||
|
||||
void StateInfo::changeSideToMove()
|
||||
{
|
||||
setSideToMove(Player::getOpponent(position->sideToMove));
|
||||
|
|
|
@ -229,6 +229,9 @@ public:
|
|||
// 设置轮流
|
||||
void setSideToMove(player_t player);
|
||||
|
||||
// 获取轮流
|
||||
player_t getSideToMove();
|
||||
|
||||
// 改变轮流
|
||||
void changeSideToMove();
|
||||
|
||||
|
|
|
@ -386,8 +386,100 @@ void GameController::setSound(bool arg)
|
|||
#endif // TRAINING_MODE
|
||||
}
|
||||
|
||||
void GameController::playSound(const QString &soundPath)
|
||||
void GameController::playSound(sound_t soundType, player_t player)
|
||||
{
|
||||
string soundDir = ":/sound/resources/sound/";
|
||||
string sideStr = player == PLAYER_BLACK ? "B" : "W";
|
||||
string oppenentStr = player == PLAYER_WHITE? "B" : "W";
|
||||
string filename;
|
||||
|
||||
switch (soundType) {
|
||||
case GAME_SOUND_BLOCK_MILL:
|
||||
filename = "BlockMill_" + sideStr + ".wav";
|
||||
break;
|
||||
case GAME_SOUND_CAPTURE:
|
||||
filename = "Capture_" + oppenentStr + ".wav";
|
||||
break;
|
||||
case GAME_SOUND_CHOOSE:
|
||||
filename = "choose.wav";
|
||||
break;
|
||||
case GAME_SOUND_DRAW:
|
||||
filename = "Draw.wav";
|
||||
break;
|
||||
case GAME_SOUND_DROG:
|
||||
filename = "drog.wav";
|
||||
break;
|
||||
case GAME_SOUND_FORBIDDEN:
|
||||
filename = "forbidden.wav";
|
||||
break;
|
||||
case GAME_SOUND_GAME_START:
|
||||
filename = "GameStart.wav";
|
||||
break;
|
||||
case GAME_SOUND_GIVE_UP:
|
||||
filename = "GiveUp_" + sideStr + ".wav";
|
||||
break;
|
||||
case GAME_SOUND_LOSS:
|
||||
filename = "loss.wav";
|
||||
break;
|
||||
case GAME_SOUND_MILL:
|
||||
filename = "Mill_" + sideStr + ".wav";
|
||||
break;
|
||||
case GAME_SOUND_MILL_REPEATLY:
|
||||
filename = "MillRepeatly_" + sideStr + ".wav";
|
||||
break;
|
||||
case GAME_SOUND_MOVE:
|
||||
filename = "move.wav";
|
||||
break;
|
||||
case GAME_SOUND_NEW_GAME:
|
||||
filename = "newgame.wav";
|
||||
break;
|
||||
case GAME_SOUND_NEXT_MILL:
|
||||
filename = "NextMill_" + sideStr + ".wav";
|
||||
break;
|
||||
case GAME_SOUND_OBVIOUS:
|
||||
filename = "Obvious.wav";
|
||||
break;
|
||||
case GAME_SOUND_REMOVE:
|
||||
filename = "remove.wav";
|
||||
break;
|
||||
case GAME_SOUND_REPEAT_THREE_DRAW:
|
||||
filename = "RepeatThreeDraw.wav";
|
||||
break;
|
||||
case GAME_SOUND_SIDE:
|
||||
filename = "Side_" + sideStr + ".wav";
|
||||
break;
|
||||
case GAME_SOUND_STAR:
|
||||
filename = "Star_" + sideStr + ".wav";
|
||||
break;
|
||||
case GAME_SOUND_SUFFOCATED:
|
||||
filename = "Suffocated_" + sideStr + ".wav";
|
||||
break;
|
||||
case GAME_SOUND_VANTAGE:
|
||||
filename = "Vantage.wav";
|
||||
break;
|
||||
case GAME_SOUND_VERY:
|
||||
filename = "Very.wav";
|
||||
break;
|
||||
case GAME_SOUND_WARNING:
|
||||
filename = "warning.wav";
|
||||
break;
|
||||
case GAME_SOUND_WIN:
|
||||
if (player == PLAYER_DRAW) {
|
||||
filename = "Draw.wav";
|
||||
} else {
|
||||
filename = "Win_" + sideStr + ".wav";
|
||||
}
|
||||
break;
|
||||
case GAME_SOUND_WIN_AND_LOSSES_ARE_OBVIOUS:
|
||||
filename = "WinsAndLossesAreObvious.wav";
|
||||
break;
|
||||
default:
|
||||
filename = "";
|
||||
break;
|
||||
};
|
||||
|
||||
QString soundPath = QString::fromStdString(soundDir + filename);
|
||||
|
||||
#ifndef TRAINING_MODE
|
||||
if (soundPath == "") {
|
||||
return;
|
||||
|
@ -579,7 +671,8 @@ void GameController::timerEvent(QTimerEvent *event)
|
|||
emit time2Changed(qt2.toString("hh:mm:ss"));
|
||||
|
||||
// 如果胜负已分
|
||||
if (state.getWinner() != PLAYER_NOBODY) {
|
||||
player_t winner = state.getWinner();
|
||||
if (winner != PLAYER_NOBODY) {
|
||||
// 停止计时
|
||||
killTimer(timeID);
|
||||
|
||||
|
@ -596,7 +689,7 @@ void GameController::timerEvent(QTimerEvent *event)
|
|||
|
||||
// 播放音效
|
||||
#ifndef DONOT_PLAY_WIN_SOUND
|
||||
playSound(":/sound/resources/sound/win.wav");
|
||||
playSound(GAME_SOUND_WIN, winner);
|
||||
#endif
|
||||
#endif // TRAINING_MODE
|
||||
}
|
||||
|
@ -694,10 +787,10 @@ bool GameController::actionPiece(QPointF pos)
|
|||
if (state._place(r, s)) {
|
||||
if (state.getAction() == ACTION_CAPTURE) {
|
||||
// 播放成三音效
|
||||
playSound(":/sound/resources/sound/capture.wav");
|
||||
playSound(GAME_SOUND_MILL, state.getSideToMove());
|
||||
} else {
|
||||
// 播放移动棋子音效
|
||||
playSound(":/sound/resources/sound/drog.wav");
|
||||
playSound(GAME_SOUND_DROG, state.getSideToMove());
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
|
@ -712,22 +805,22 @@ bool GameController::actionPiece(QPointF pos)
|
|||
break;
|
||||
if (state.choose(r, s)) {
|
||||
// 播放选子音效
|
||||
playSound(":/sound/resources/sound/choose.wav");
|
||||
playSound(GAME_SOUND_CHOOSE, state.getSideToMove());
|
||||
result = true;
|
||||
} else {
|
||||
// 播放禁止音效
|
||||
playSound(":/sound/resources/sound/forbidden.wav");
|
||||
playSound(GAME_SOUND_FORBIDDEN, state.getSideToMove());
|
||||
}
|
||||
break;
|
||||
|
||||
case ACTION_CAPTURE:
|
||||
if (state._capture(r, s)) {
|
||||
// 播放音效
|
||||
playSound(":/sound/resources/sound/remove.wav");
|
||||
playSound(GAME_SOUND_CAPTURE, state.getSideToMove());
|
||||
result = true;
|
||||
} else {
|
||||
// 播放禁止音效
|
||||
playSound(":/sound/resources/sound/forbidden.wav");
|
||||
playSound(GAME_SOUND_FORBIDDEN, state.getSideToMove());
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -756,9 +849,10 @@ bool GameController::actionPiece(QPointF pos)
|
|||
|
||||
// 播放胜利或失败音效
|
||||
#ifndef DONOT_PLAY_WIN_SOUND
|
||||
if (state.getWinner() != PLAYER_NOBODY &&
|
||||
player_t winner = state.getWinner();
|
||||
if (winner != PLAYER_NOBODY &&
|
||||
(manualListModel.data(manualListModel.index(currentRow - 1))).toString().contains("Time over."))
|
||||
playSound(":/sound/resources/sound/win.wav");
|
||||
playSound(GAME_SOUND_WIN, winner);
|
||||
#endif
|
||||
|
||||
// AI设置
|
||||
|
@ -804,7 +898,7 @@ bool GameController::giveUp()
|
|||
}
|
||||
|
||||
if (state.getWinner() != PLAYER_NOBODY)
|
||||
playSound(":/sound/resources/sound/loss.wav");
|
||||
playSound(GAME_SOUND_GIVE_UP, state.getSideToMove());
|
||||
|
||||
#endif // TRAINING_MODE
|
||||
|
||||
|
@ -827,15 +921,15 @@ bool GameController::command(const QString &cmd, bool update /* = true */)
|
|||
|
||||
#ifndef TRAINING_MODE
|
||||
// 声音
|
||||
QString sound;
|
||||
sound_t soundType = GAME_SOUND_NONE;
|
||||
|
||||
switch (state.getAction()) {
|
||||
case ACTION_CHOOSE:
|
||||
case ACTION_PLACE:
|
||||
sound = ":/sound/resources/sound/drog.wav";
|
||||
soundType = GAME_SOUND_DROG;
|
||||
break;
|
||||
case ACTION_CAPTURE:
|
||||
sound = ":/sound/resources/sound/remove.wav";
|
||||
soundType = GAME_SOUND_CAPTURE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -851,12 +945,12 @@ bool GameController::command(const QString &cmd, bool update /* = true */)
|
|||
return false;
|
||||
|
||||
#ifndef TRAINING_MODE
|
||||
if (sound == ":/sound/resources/sound/drog.wav" && state.getAction() == ACTION_CAPTURE) {
|
||||
sound = ":/sound/resources/sound/capture.wav";
|
||||
if (soundType == GAME_SOUND_DROG && state.getAction() == ACTION_CAPTURE) {
|
||||
soundType = GAME_SOUND_MILL;
|
||||
}
|
||||
|
||||
if (update) {
|
||||
playSound(sound);
|
||||
playSound(soundType, state.getSideToMove());
|
||||
updateScence(state);
|
||||
}
|
||||
|
||||
|
@ -889,9 +983,10 @@ bool GameController::command(const QString &cmd, bool update /* = true */)
|
|||
|
||||
// 播放胜利或失败音效
|
||||
#ifndef DONOT_PLAY_WIN_SOUND
|
||||
if (state.getWinner() != PLAYER_NOBODY &&
|
||||
player_t winner = state.getWinner();
|
||||
if (winner != PLAYER_NOBODY &&
|
||||
(manualListModel.data(manualListModel.index(currentRow - 1))).toString().contains("Time over.")) {
|
||||
playSound(":/sound/resources/sound/win.wav");
|
||||
playSound(GAME_SOUND_WIN, winner);
|
||||
}
|
||||
#endif
|
||||
#endif // TRAINING_MODE
|
||||
|
|
|
@ -46,6 +46,36 @@
|
|||
|
||||
using namespace std;
|
||||
|
||||
enum sound_t
|
||||
{
|
||||
GAME_SOUND_NONE,
|
||||
GAME_SOUND_BLOCK_MILL,
|
||||
GAME_SOUND_CAPTURE,
|
||||
GAME_SOUND_CHOOSE,
|
||||
GAME_SOUND_DRAW,
|
||||
GAME_SOUND_DROG,
|
||||
GAME_SOUND_FORBIDDEN,
|
||||
GAME_SOUND_GAME_START,
|
||||
GAME_SOUND_GIVE_UP,
|
||||
GAME_SOUND_LOSS,
|
||||
GAME_SOUND_MILL,
|
||||
GAME_SOUND_MILL_REPEATLY,
|
||||
GAME_SOUND_MOVE,
|
||||
GAME_SOUND_NEW_GAME,
|
||||
GAME_SOUND_NEXT_MILL,
|
||||
GAME_SOUND_OBVIOUS,
|
||||
GAME_SOUND_REMOVE,
|
||||
GAME_SOUND_REPEAT_THREE_DRAW,
|
||||
GAME_SOUND_SIDE,
|
||||
GAME_SOUND_STAR,
|
||||
GAME_SOUND_SUFFOCATED,
|
||||
GAME_SOUND_VANTAGE,
|
||||
GAME_SOUND_VERY,
|
||||
GAME_SOUND_WARNING,
|
||||
GAME_SOUND_WIN,
|
||||
GAME_SOUND_WIN_AND_LOSSES_ARE_OBVIOUS
|
||||
};
|
||||
|
||||
class GameController : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -160,7 +190,7 @@ public slots:
|
|||
void setSound(bool arg = true);
|
||||
|
||||
// 播放声音
|
||||
void playSound(const QString &soundPath);
|
||||
void playSound(sound_t soundType, player_t player);
|
||||
|
||||
// 是否必败时认输
|
||||
void setGiveUpIfMostLose(bool enabled);
|
||||
|
|
Loading…
Reference in New Issue