Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
ygopro
Commits
bcc1b348
Commit
bcc1b348
authored
May 04, 2025
by
wind2009
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/patch-miniaudio' into develop
parents
0077af77
f4d23d09
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
53 additions
and
35 deletions
+53
-35
.github/workflows/build.yml
.github/workflows/build.yml
+9
-0
gframe/duelclient.cpp
gframe/duelclient.cpp
+1
-0
gframe/event_handler.cpp
gframe/event_handler.cpp
+0
-4
gframe/premake5.lua
gframe/premake5.lua
+1
-1
gframe/sound_manager.cpp
gframe/sound_manager.cpp
+35
-25
gframe/sound_manager.h
gframe/sound_manager.h
+5
-4
premake/miniaudio/premake5.lua
premake/miniaudio/premake5.lua
+1
-1
sound/files.txt
sound/files.txt
+1
-0
No files found.
.github/workflows/build.yml
View file @
bcc1b348
...
@@ -95,6 +95,9 @@ jobs:
...
@@ -95,6 +95,9 @@ jobs:
if
:
matrix.audiolib == 'miniaudio'
if
:
matrix.audiolib == 'miniaudio'
run
:
|
run
:
|
git clone --depth=1 --branch 0.11.22 https://github.com/mackron/miniaudio
git clone --depth=1 --branch 0.11.22 https://github.com/mackron/miniaudio
cd miniaudio
xcopy /Y extras\miniaudio_split\miniaudio.* .
cd ..
-
name
:
Download ogg
-
name
:
Download ogg
if
:
matrix.audiolib == 'miniaudio'
if
:
matrix.audiolib == 'miniaudio'
...
@@ -295,6 +298,9 @@ jobs:
...
@@ -295,6 +298,9 @@ jobs:
-
name
:
Download miniaudio
-
name
:
Download miniaudio
run
:
|
run
:
|
git clone --depth=1 --branch 0.11.22 https://github.com/mackron/miniaudio
git clone --depth=1 --branch 0.11.22 https://github.com/mackron/miniaudio
cd miniaudio
cp extras/miniaudio_split/miniaudio.* .
cd ..
-
name
:
Download irrlicht
-
name
:
Download irrlicht
run
:
|
run
:
|
...
@@ -387,6 +393,9 @@ jobs:
...
@@ -387,6 +393,9 @@ jobs:
-
name
:
Download miniaudio
-
name
:
Download miniaudio
run
:
|
run
:
|
git clone --depth=1 --branch 0.11.22 https://github.com/mackron/miniaudio
git clone --depth=1 --branch 0.11.22 https://github.com/mackron/miniaudio
cd miniaudio
cp extras/miniaudio_split/miniaudio.* .
cd ..
-
name
:
Download irrlicht
-
name
:
Download irrlicht
run
:
|
run
:
|
...
...
gframe/duelclient.cpp
View file @
bcc1b348
...
@@ -3034,6 +3034,7 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
...
@@ -3034,6 +3034,7 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
case
MSG_CHAIN_DISABLED
:
{
case
MSG_CHAIN_DISABLED
:
{
int
ct
=
BufferIO
::
ReadUInt8
(
pbuf
);
int
ct
=
BufferIO
::
ReadUInt8
(
pbuf
);
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
soundManager
.
PlaySoundEffect
(
SOUND_NEGATE
);
mainGame
->
showcardcode
=
mainGame
->
dField
.
chains
[
ct
-
1
].
code
;
mainGame
->
showcardcode
=
mainGame
->
dField
.
chains
[
ct
-
1
].
code
;
mainGame
->
showcarddif
=
0
;
mainGame
->
showcarddif
=
0
;
mainGame
->
showcard
=
3
;
mainGame
->
showcard
=
3
;
...
...
gframe/event_handler.cpp
View file @
bcc1b348
...
@@ -1898,14 +1898,12 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
...
@@ -1898,14 +1898,12 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
return
true
;
return
true
;
break
;
break
;
}
}
#ifdef YGOPRO_USE_AUDIO
case
CHECKBOX_ENABLE_MUSIC
:
{
case
CHECKBOX_ENABLE_MUSIC
:
{
if
(
!
mainGame
->
chkEnableMusic
->
isChecked
())
if
(
!
mainGame
->
chkEnableMusic
->
isChecked
())
soundManager
.
StopBGM
();
soundManager
.
StopBGM
();
return
true
;
return
true
;
break
;
break
;
}
}
#endif
case
CHECKBOX_DISABLE_CHAT
:
{
case
CHECKBOX_DISABLE_CHAT
:
{
bool
show
=
(
mainGame
->
is_building
&&
!
mainGame
->
is_siding
)
?
false
:
!
mainGame
->
chkIgnore1
->
isChecked
();
bool
show
=
(
mainGame
->
is_building
&&
!
mainGame
->
is_siding
)
?
false
:
!
mainGame
->
chkIgnore1
->
isChecked
();
mainGame
->
wChat
->
setVisible
(
show
);
mainGame
->
wChat
->
setVisible
(
show
);
...
@@ -1998,7 +1996,6 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
...
@@ -1998,7 +1996,6 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
return
true
;
return
true
;
break
;
break
;
}
}
#ifdef YGOPRO_USE_AUDIO
case
SCROLL_VOLUME
:
{
case
SCROLL_VOLUME
:
{
mainGame
->
gameConf
.
sound_volume
=
(
double
)
mainGame
->
scrSoundVolume
->
getPos
()
/
100
;
mainGame
->
gameConf
.
sound_volume
=
(
double
)
mainGame
->
scrSoundVolume
->
getPos
()
/
100
;
mainGame
->
gameConf
.
music_volume
=
(
double
)
mainGame
->
scrMusicVolume
->
getPos
()
/
100
;
mainGame
->
gameConf
.
music_volume
=
(
double
)
mainGame
->
scrMusicVolume
->
getPos
()
/
100
;
...
@@ -2007,7 +2004,6 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
...
@@ -2007,7 +2004,6 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
return
true
;
return
true
;
break
;
break
;
}
}
#endif
case
SCROLL_TAB_HELPER
:
{
case
SCROLL_TAB_HELPER
:
{
irr
::
core
::
rect
<
irr
::
s32
>
pos
=
mainGame
->
tabHelper
->
getRelativePosition
();
irr
::
core
::
rect
<
irr
::
s32
>
pos
=
mainGame
->
tabHelper
->
getRelativePosition
();
mainGame
->
tabHelper
->
setRelativePosition
(
irr
::
core
::
recti
(
0
,
mainGame
->
scrTabHelper
->
getPos
()
*
-
1
,
pos
.
LowerRightCorner
.
X
,
pos
.
LowerRightCorner
.
Y
));
mainGame
->
tabHelper
->
setRelativePosition
(
irr
::
core
::
recti
(
0
,
mainGame
->
scrTabHelper
->
getPos
()
*
-
1
,
pos
.
LowerRightCorner
.
X
,
pos
.
LowerRightCorner
.
Y
));
...
...
gframe/premake5.lua
View file @
bcc1b348
...
@@ -42,7 +42,7 @@ project "YGOPro"
...
@@ -42,7 +42,7 @@ project "YGOPro"
defines
{
"YGOPRO_USE_AUDIO"
}
defines
{
"YGOPRO_USE_AUDIO"
}
if
AUDIO_LIB
==
"miniaudio"
then
if
AUDIO_LIB
==
"miniaudio"
then
defines
{
"YGOPRO_USE_MINIAUDIO"
}
defines
{
"YGOPRO_USE_MINIAUDIO"
}
includedirs
{
"../miniaudio
/extras/miniaudio_split
"
}
includedirs
{
"../miniaudio"
}
links
{
"miniaudio"
}
links
{
"miniaudio"
}
if
MINIAUDIO_SUPPORT_OPUS_VORBIS
then
if
MINIAUDIO_SUPPORT_OPUS_VORBIS
then
defines
{
"YGOPRO_MINIAUDIO_SUPPORT_OPUS_VORBIS"
}
defines
{
"YGOPRO_MINIAUDIO_SUPPORT_OPUS_VORBIS"
}
...
...
gframe/sound_manager.cpp
View file @
bcc1b348
...
@@ -128,6 +128,10 @@ void SoundManager::PlaySoundEffect(int sound) {
...
@@ -128,6 +128,10 @@ void SoundManager::PlaySoundEffect(int sound) {
strcpy
(
soundName
,
"token"
);
strcpy
(
soundName
,
"token"
);
break
;
break
;
}
}
case
SOUND_NEGATE
:
{
strcpy
(
soundName
,
"negate"
);
break
;
}
case
SOUND_ATTACK
:
{
case
SOUND_ATTACK
:
{
strcpy
(
soundName
,
"attack"
);
strcpy
(
soundName
,
"attack"
);
break
;
break
;
...
@@ -149,7 +153,7 @@ void SoundManager::PlaySoundEffect(int sound) {
...
@@ -149,7 +153,7 @@ void SoundManager::PlaySoundEffect(int sound) {
break
;
break
;
}
}
case
SOUND_RECOVER
:
{
case
SOUND_RECOVER
:
{
strcpy
(
soundName
,
"
recover
"
);
strcpy
(
soundName
,
"
gainlp
"
);
break
;
break
;
}
}
case
SOUND_COUNTER_ADD
:
{
case
SOUND_COUNTER_ADD
:
{
...
@@ -161,11 +165,11 @@ void SoundManager::PlaySoundEffect(int sound) {
...
@@ -161,11 +165,11 @@ void SoundManager::PlaySoundEffect(int sound) {
break
;
break
;
}
}
case
SOUND_COIN
:
{
case
SOUND_COIN
:
{
strcpy
(
soundName
,
"coin"
);
strcpy
(
soundName
,
"coin
flip
"
);
break
;
break
;
}
}
case
SOUND_DICE
:
{
case
SOUND_DICE
:
{
strcpy
(
soundName
,
"dice"
);
strcpy
(
soundName
,
"dice
roll
"
);
break
;
break
;
}
}
case
SOUND_NEXT_TURN
:
{
case
SOUND_NEXT_TURN
:
{
...
@@ -205,7 +209,7 @@ void SoundManager::PlaySoundEffect(int sound) {
...
@@ -205,7 +209,7 @@ void SoundManager::PlaySoundEffect(int sound) {
break
;
break
;
}
}
case
SOUND_CHAT
:
{
case
SOUND_CHAT
:
{
strcpy
(
soundName
,
"chat"
);
strcpy
(
soundName
,
"chat
message
"
);
break
;
break
;
}
}
default:
default:
...
@@ -213,17 +217,17 @@ void SoundManager::PlaySoundEffect(int sound) {
...
@@ -213,17 +217,17 @@ void SoundManager::PlaySoundEffect(int sound) {
}
}
char
soundPath
[
40
];
char
soundPath
[
40
];
std
::
snprintf
(
soundPath
,
40
,
"./sound/%s.wav"
,
soundName
);
std
::
snprintf
(
soundPath
,
40
,
"./sound/%s.wav"
,
soundName
);
SetSoundVolume
(
mainGame
->
gameConf
.
sound_volume
);
#ifdef YGOPRO_USE_MINIAUDIO
#ifdef YGOPRO_USE_MINIAUDIO
ma_engine_set_volume
(
&
engineSound
,
mainGame
->
gameConf
.
sound_volume
);
ma_engine_play_sound
(
&
engineSound
,
soundPath
,
nullptr
);
ma_engine_play_sound
(
&
engineSound
,
soundPath
,
nullptr
);
#endif
#endif
#ifdef YGOPRO_USE_IRRKLANG
#ifdef YGOPRO_USE_IRRKLANG
engineSound
->
setSoundVolume
(
mainGame
->
gameConf
.
sound_volume
);
engineSound
->
play2D
(
soundPath
);
engineSound
->
play2D
(
soundPath
);
#endif
#endif
#endif // YGOPRO_USE_AUDIO
#endif // YGOPRO_USE_AUDIO
}
}
void
SoundManager
::
PlayDialogSound
(
irr
::
gui
::
IGUIElement
*
element
)
{
void
SoundManager
::
PlayDialogSound
(
irr
::
gui
::
IGUIElement
*
element
)
{
#ifdef YGOPRO_USE_AUDIO
if
(
element
==
mainGame
->
wMessage
)
{
if
(
element
==
mainGame
->
wMessage
)
{
PlaySoundEffect
(
SOUND_INFO
);
PlaySoundEffect
(
SOUND_INFO
);
}
else
if
(
element
==
mainGame
->
wQuery
)
{
}
else
if
(
element
==
mainGame
->
wQuery
)
{
...
@@ -245,32 +249,44 @@ void SoundManager::PlayDialogSound(irr::gui::IGUIElement * element) {
...
@@ -245,32 +249,44 @@ void SoundManager::PlayDialogSound(irr::gui::IGUIElement * element) {
}
else
if
(
element
==
mainGame
->
wFTSelect
)
{
}
else
if
(
element
==
mainGame
->
wFTSelect
)
{
PlaySoundEffect
(
SOUND_QUESTION
);
PlaySoundEffect
(
SOUND_QUESTION
);
}
}
#endif // YGOPRO_USE_AUDIO
}
}
bool
SoundManager
::
Is
CurrentlyPlaying
(
char
*
song
)
{
bool
SoundManager
::
Is
PlayingMusic
(
wchar_t
*
music
)
{
#ifdef YGOPRO_USE_MINIAUDIO
#ifdef YGOPRO_USE_MINIAUDIO
return
currentPlayingMusic
[
0
]
&&
strcmp
(
currentPlayingMusic
,
song
)
==
0
&&
ma_sound_is_playing
(
&
soundBGM
);
if
(
music
)
{
return
!
mywcsncasecmp
(
currentPlayingMusic
,
music
,
1024
)
&&
ma_sound_is_playing
(
&
soundBGM
);
}
else
{
return
ma_sound_is_playing
(
&
soundBGM
);
}
#endif
#endif
#ifdef YGOPRO_USE_IRRKLANG
#ifdef YGOPRO_USE_IRRKLANG
return
engineMusic
->
isCurrentlyPlaying
(
song
);
if
(
music
)
{
char
cmusic
[
1024
];
BufferIO
::
EncodeUTF8
(
music
,
cmusic
);
return
engineMusic
->
isCurrentlyPlaying
(
cmusic
);
}
else
{
return
soundBGM
&&
!
soundBGM
->
isFinished
();
}
#endif
#endif
return
false
;
return
false
;
}
}
void
SoundManager
::
PlayMusic
(
char
*
song
,
bool
loop
)
{
void
SoundManager
::
PlayMusic
(
wchar_t
*
music
,
bool
loop
)
{
#ifdef YGOPRO_USE_AUDIO
#ifdef YGOPRO_USE_AUDIO
if
(
!
mainGame
->
chkEnableMusic
->
isChecked
())
if
(
!
mainGame
->
chkEnableMusic
->
isChecked
())
return
;
return
;
if
(
!
Is
CurrentlyPlaying
(
song
))
{
if
(
!
Is
PlayingMusic
(
music
))
{
StopBGM
();
StopBGM
();
SetMusicVolume
(
mainGame
->
gameConf
.
music_volume
);
#ifdef YGOPRO_USE_MINIAUDIO
#ifdef YGOPRO_USE_MINIAUDIO
strcpy
(
currentPlayingMusic
,
song
);
BufferIO
::
CopyWStr
(
music
,
currentPlayingMusic
,
1024
);
ma_sound_init_from_file
(
&
engineMusic
,
song
,
MA_SOUND_FLAG_ASYNC
|
MA_SOUND_FLAG_STREAM
,
nullptr
,
nullptr
,
&
soundBGM
);
ma_sound_init_from_file
_w
(
&
engineMusic
,
music
,
MA_SOUND_FLAG_ASYNC
|
MA_SOUND_FLAG_STREAM
,
nullptr
,
nullptr
,
&
soundBGM
);
ma_sound_set_looping
(
&
soundBGM
,
loop
);
ma_sound_set_looping
(
&
soundBGM
,
loop
);
ma_sound_start
(
&
soundBGM
);
ma_sound_start
(
&
soundBGM
);
#endif
#endif
#ifdef YGOPRO_USE_IRRKLANG
#ifdef YGOPRO_USE_IRRKLANG
engineMusic
->
stopAllSounds
()
;
char
cmusic
[
1024
]
;
engineMusic
->
setSoundVolume
(
mainGame
->
gameConf
.
music_volume
);
BufferIO
::
EncodeUTF8
(
music
,
cmusic
);
soundBGM
=
engineMusic
->
play2D
(
song
,
loop
,
false
,
true
);
soundBGM
=
engineMusic
->
play2D
(
cmusic
,
loop
,
false
,
true
);
#endif
#endif
}
}
#endif
#endif
...
@@ -281,21 +297,15 @@ void SoundManager::PlayBGM(int scene) {
...
@@ -281,21 +297,15 @@ void SoundManager::PlayBGM(int scene) {
return
;
return
;
if
(
!
mainGame
->
chkMusicMode
->
isChecked
())
if
(
!
mainGame
->
chkMusicMode
->
isChecked
())
scene
=
BGM_ALL
;
scene
=
BGM_ALL
;
char
BGMName
[
1024
];
if
(
scene
!=
bgm_scene
||
!
IsPlayingMusic
())
{
#if defined(YGOPRO_USE_MINIAUDIO)
if
(
scene
!=
bgm_scene
||
!
IsCurrentlyPlaying
(
currentPlayingMusic
))
{
#elif defined(YGOPRO_USE_IRRKLANG)
if
(
scene
!=
bgm_scene
||
(
soundBGM
&&
soundBGM
->
isFinished
()))
{
#endif
int
count
=
BGMList
[
scene
].
size
();
int
count
=
BGMList
[
scene
].
size
();
if
(
count
<=
0
)
if
(
count
<=
0
)
return
;
return
;
bgm_scene
=
scene
;
bgm_scene
=
scene
;
int
bgm
=
rnd
.
get_random_integer
(
0
,
count
-
1
);
int
bgm
=
rnd
.
get_random_integer
(
0
,
count
-
1
);
auto
name
=
BGMList
[
scene
][
bgm
].
c_str
();
auto
name
=
BGMList
[
scene
][
bgm
].
c_str
();
wchar_t
fname
[
1024
];
wchar_t
BGMName
[
1024
];
myswprintf
(
fname
,
L"./sound/BGM/%ls"
,
name
);
myswprintf
(
BGMName
,
L"./sound/BGM/%ls"
,
name
);
BufferIO
::
EncodeUTF8
(
fname
,
BGMName
);
PlayMusic
(
BGMName
,
false
);
PlayMusic
(
BGMName
,
false
);
}
}
#endif
#endif
...
...
gframe/sound_manager.h
View file @
bcc1b348
...
@@ -15,7 +15,7 @@ namespace ygo {
...
@@ -15,7 +15,7 @@ namespace ygo {
class
SoundManager
{
class
SoundManager
{
private:
private:
std
::
vector
<
std
::
wstring
>
BGMList
[
8
];
std
::
vector
<
std
::
wstring
>
BGMList
[
8
];
int
bgm_scene
;
int
bgm_scene
{}
;
mt19937
rnd
;
mt19937
rnd
;
#ifdef YGOPRO_USE_MINIAUDIO
#ifdef YGOPRO_USE_MINIAUDIO
ma_engine_config
engineConfig
;
ma_engine_config
engineConfig
;
...
@@ -26,7 +26,7 @@ private:
...
@@ -26,7 +26,7 @@ private:
ma_engine
engineSound
;
ma_engine
engineSound
;
ma_engine
engineMusic
;
ma_engine
engineMusic
;
ma_sound
soundBGM
;
ma_sound
soundBGM
;
char
currentPlayingMusic
[
1024
]{};
wchar_t
currentPlayingMusic
[
1024
]{};
#endif
#endif
#ifdef YGOPRO_USE_IRRKLANG
#ifdef YGOPRO_USE_IRRKLANG
irrklang
::
ISoundEngine
*
engineSound
;
irrklang
::
ISoundEngine
*
engineSound
;
...
@@ -40,8 +40,8 @@ public:
...
@@ -40,8 +40,8 @@ public:
void
RefreshBGMList
();
void
RefreshBGMList
();
void
PlaySoundEffect
(
int
sound
);
void
PlaySoundEffect
(
int
sound
);
void
PlayDialogSound
(
irr
::
gui
::
IGUIElement
*
element
);
void
PlayDialogSound
(
irr
::
gui
::
IGUIElement
*
element
);
bool
Is
CurrentlyPlaying
(
char
*
song
);
bool
Is
PlayingMusic
(
wchar_t
*
music
=
0
);
void
PlayMusic
(
char
*
song
,
bool
loop
);
void
PlayMusic
(
wchar_t
*
music
,
bool
loop
);
void
PlayBGM
(
int
scene
);
void
PlayBGM
(
int
scene
);
void
StopBGM
();
void
StopBGM
();
void
SetSoundVolume
(
double
volume
);
void
SetSoundVolume
(
double
volume
);
...
@@ -60,6 +60,7 @@ extern SoundManager soundManager;
...
@@ -60,6 +60,7 @@ extern SoundManager soundManager;
#define SOUND_DESTROYED 108
#define SOUND_DESTROYED 108
#define SOUND_BANISHED 109
#define SOUND_BANISHED 109
#define SOUND_TOKEN 110
#define SOUND_TOKEN 110
#define SOUND_NEGATE 111
#define SOUND_ATTACK 201
#define SOUND_ATTACK 201
#define SOUND_DIRECT_ATTACK 202
#define SOUND_DIRECT_ATTACK 202
...
...
premake/miniaudio/premake5.lua
View file @
bcc1b348
project
"miniaudio"
project
"miniaudio"
kind
"StaticLib"
kind
"StaticLib"
files
{
"
extras/miniaudio_split/miniaudio.*
"
}
files
{
"
miniaudio.c"
,
"miniaudio.h
"
}
defines
{
"MA_NO_ENCODING"
,
"MA_NO_GENERATION"
,
"MA_NO_NEON"
}
defines
{
"MA_NO_ENCODING"
,
"MA_NO_GENERATION"
,
"MA_NO_NEON"
}
if
MINIAUDIO_SUPPORT_OPUS_VORBIS
then
if
MINIAUDIO_SUPPORT_OPUS_VORBIS
then
...
...
sound/files.txt
View file @
bcc1b348
...
@@ -8,6 +8,7 @@ equip.wav
...
@@ -8,6 +8,7 @@ equip.wav
destroyed.wav
destroyed.wav
banished.wav
banished.wav
token.wav
token.wav
negate.wav
attack.wav
attack.wav
directattack.wav
directattack.wav
draw.wav
draw.wav
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment