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
List
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
YGOPRO-520DIY
ygopro
Commits
4adcf746
Commit
4adcf746
authored
Mar 28, 2025
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
8818dc40
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
226 additions
and
52 deletions
+226
-52
.github/workflows/build.yml
.github/workflows/build.yml
+37
-5
gframe/premake5.lua
gframe/premake5.lua
+38
-8
gframe/sound_manager.cpp
gframe/sound_manager.cpp
+54
-9
gframe/sound_manager.h
gframe/sound_manager.h
+10
-2
premake/miniaudio/premake5.lua
premake/miniaudio/premake5.lua
+1
-1
premake5.lua
premake5.lua
+86
-27
No files found.
.github/workflows/build.yml
View file @
4adcf746
...
@@ -12,6 +12,7 @@ jobs:
...
@@ -12,6 +12,7 @@ jobs:
fail-fast
:
false
fail-fast
:
false
matrix
:
matrix
:
os
:
[
windows-2019
,
windows-2022
]
os
:
[
windows-2019
,
windows-2022
]
audiolib
:
[
miniaudio
,
irrklang
]
runs-on
:
${{ matrix.os }}
runs-on
:
${{ matrix.os }}
...
@@ -91,54 +92,75 @@ jobs:
...
@@ -91,54 +92,75 @@ jobs:
move sqlite-amalgamation-3490100 sqlite3
move sqlite-amalgamation-3490100 sqlite3
-
name
:
Download miniaudio
-
name
:
Download miniaudio
shell
:
bash
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
-
name
:
Download ogg
-
name
:
Download ogg
if
:
matrix.audiolib == 'miniaudio'
id
:
ogg
id
:
ogg
uses
:
mercury233/action-cache-download-file@v1.0.0
uses
:
mercury233/action-cache-download-file@v1.0.0
with
:
with
:
url
:
https://github.com/xiph/ogg/releases/download/v1.3.5/libogg-1.3.5.tar.gz
url
:
https://github.com/xiph/ogg/releases/download/v1.3.5/libogg-1.3.5.tar.gz
-
name
:
Extract ogg
-
name
:
Extract ogg
if
:
matrix.audiolib == 'miniaudio'
run
:
|
run
:
|
tar xf ${{ steps.ogg.outputs.filepath }}
tar xf ${{ steps.ogg.outputs.filepath }}
move libogg-1.3.5 miniaudio/external/ogg
move libogg-1.3.5 miniaudio/external/ogg
-
name
:
Download opus
-
name
:
Download opus
if
:
matrix.audiolib == 'miniaudio'
id
:
opus
id
:
opus
uses
:
mercury233/action-cache-download-file@v1.0.0
uses
:
mercury233/action-cache-download-file@v1.0.0
with
:
with
:
url
:
https://github.com/xiph/opus/releases/download/v1.5.2/opus-1.5.2.tar.gz
url
:
https://github.com/xiph/opus/releases/download/v1.5.2/opus-1.5.2.tar.gz
-
name
:
Extract opus
-
name
:
Extract opus
if
:
matrix.audiolib == 'miniaudio'
run
:
|
run
:
|
tar xf ${{ steps.opus.outputs.filepath }}
tar xf ${{ steps.opus.outputs.filepath }}
move opus-1.5.2 miniaudio/external/opus
move opus-1.5.2 miniaudio/external/opus
-
name
:
Download opusfile
-
name
:
Download opusfile
if
:
matrix.audiolib == 'miniaudio'
id
:
opusfile
id
:
opusfile
uses
:
mercury233/action-cache-download-file@v1.0.0
uses
:
mercury233/action-cache-download-file@v1.0.0
with
:
with
:
url
:
https://github.com/xiph/opusfile/releases/download/v0.12/opusfile-0.12.tar.gz
url
:
https://github.com/xiph/opusfile/releases/download/v0.12/opusfile-0.12.tar.gz
-
name
:
Extract opusfile
-
name
:
Extract opusfile
if
:
matrix.audiolib == 'miniaudio'
run
:
|
run
:
|
tar xf ${{ steps.opusfile.outputs.filepath }}
tar xf ${{ steps.opusfile.outputs.filepath }}
move opusfile-0.12 miniaudio/external/opusfile
move opusfile-0.12 miniaudio/external/opusfile
-
name
:
Download vorbis
-
name
:
Download vorbis
if
:
matrix.audiolib == 'miniaudio'
id
:
vorbis
id
:
vorbis
uses
:
mercury233/action-cache-download-file@v1.0.0
uses
:
mercury233/action-cache-download-file@v1.0.0
with
:
with
:
url
:
https://github.com/xiph/vorbis/releases/download/v1.3.7/libvorbis-1.3.7.tar.gz
url
:
https://github.com/xiph/vorbis/releases/download/v1.3.7/libvorbis-1.3.7.tar.gz
-
name
:
Extract vorbis
-
name
:
Extract vorbis
if
:
matrix.audiolib == 'miniaudio'
run
:
|
run
:
|
tar xf ${{ steps.vorbis.outputs.filepath }}
tar xf ${{ steps.vorbis.outputs.filepath }}
move libvorbis-1.3.7 miniaudio/external/vorbis
move libvorbis-1.3.7 miniaudio/external/vorbis
-
name
:
Download irrKlang
if
:
matrix.audiolib == 'irrklang'
id
:
irrKlang
uses
:
mercury233/action-cache-download-file@v1.0.0
with
:
url
:
https://www.ambiera.at/downloads/irrKlang-32bit-1.6.0.zip
-
name
:
Extract irrKlang
if
:
matrix.audiolib == 'irrklang'
run
:
|
7z x ${{ steps.irrKlang.outputs.filepath }}
move irrKlang-1.6.0 irrKlang
-
name
:
Download irrlicht
-
name
:
Download irrlicht
run
:
|
run
:
|
git clone --depth=1 https://github.com/mercury233/irrlicht
git clone --depth=1 https://github.com/mercury233/irrlicht
...
@@ -172,16 +194,26 @@ jobs:
...
@@ -172,16 +194,26 @@ jobs:
xcopy /E premake\* .
xcopy /E premake\* .
xcopy /E resource\* .
xcopy /E resource\* .
-
name
:
Use premake to generate Visual Studio solution (2019)
-
name
:
Use premake to generate Visual Studio solution (2019
, miniaudio
)
if
:
matrix.os == 'windows-2019'
if
:
matrix.os == 'windows-2019'
&& matrix.audiolib == 'miniaudio'
run
:
|
run
:
|
.\premake5.exe vs2019 --winxp-support
.\premake5.exe vs2019 --winxp-support
-
name
:
Use premake to generate Visual Studio solution (2022)
-
name
:
Use premake to generate Visual Studio solution (2022
, miniaudio
)
if
:
matrix.os == 'windows-2022'
if
:
matrix.os == 'windows-2022'
&& matrix.audiolib == 'miniaudio'
run
:
|
run
:
|
.\premake5.exe vs2022
.\premake5.exe vs2022
-
name
:
Use premake to generate Visual Studio solution (2019, irrKlang)
if
:
matrix.os == 'windows-2019' && matrix.audiolib == 'irrklang'
run
:
|
.\premake5.exe vs2019 --winxp-support --audio-lib=irrklang
-
name
:
Use premake to generate Visual Studio solution (2022, irrKlang)
if
:
matrix.os == 'windows-2022' && matrix.audiolib == 'irrklang'
run
:
|
.\premake5.exe vs2022 --audio-lib=irrklang
-
name
:
Add msbuild to PATH
-
name
:
Add msbuild to PATH
uses
:
microsoft/setup-msbuild@v2
uses
:
microsoft/setup-msbuild@v2
...
...
gframe/premake5.lua
View file @
4adcf746
...
@@ -40,14 +40,27 @@ project "YGOPro"
...
@@ -40,14 +40,27 @@ project "YGOPro"
if
USE_AUDIO
then
if
USE_AUDIO
then
defines
{
"YGOPRO_USE_AUDIO"
}
defines
{
"YGOPRO_USE_AUDIO"
}
includedirs
{
"../miniaudio/extras/miniaudio_split"
}
if
AUDIO_LIB
==
"miniaudio"
then
links
{
"miniaudio"
}
defines
{
"YGOPRO_USE_MINIAUDIO"
}
if
MINIAUDIO_SUPPORT_OPUS_VORBIS
then
includedirs
{
"../miniaudio/extras/miniaudio_split"
}
defines
{
"YGOPRO_MINIAUDIO_SUPPORT_OPUS_VORBIS"
}
links
{
"miniaudio"
}
includedirs
{
"../miniaudio/extras/decoders/libopus"
,
"../miniaudio/extras/decoders/libvorbis"
}
if
MINIAUDIO_SUPPORT_OPUS_VORBIS
then
if
not
BUILD_OPUS_VORBIS
then
defines
{
"YGOPRO_MINIAUDIO_SUPPORT_OPUS_VORBIS"
}
links
{
"opusfile"
,
"vorbisfile"
}
includedirs
{
"../miniaudio/extras/decoders/libopus"
,
"../miniaudio/extras/decoders/libvorbis"
}
libdirs
{
OPUS_LIB_DIR
,
VORBIS_LIB_DIR
}
if
not
MINIAUDIO_BUILD_OPUS_VORBIS
then
links
{
"opusfile"
,
"vorbisfile"
}
libdirs
{
OPUS_LIB_DIR
,
VORBIS_LIB_DIR
}
end
end
end
if
AUDIO_LIB
==
"irrklang"
then
defines
{
"YGOPRO_USE_IRRKLANG"
}
includedirs
{
IRRKLANG_INCLUDE_DIR
}
if
not
IRRKLANG_PRO
then
libdirs
{
IRRKLANG_LIB_DIR
}
end
if
IRRKLANG_PRO_BUILD_IKPMP3
then
links
{
"ikpmp3"
}
end
end
end
end
end
end
...
@@ -57,6 +70,17 @@ project "YGOPro"
...
@@ -57,6 +70,17 @@ project "YGOPro"
files
"ygopro.rc"
files
"ygopro.rc"
libdirs
{
"$(DXSDK_DIR)Lib/x86"
}
libdirs
{
"$(DXSDK_DIR)Lib/x86"
}
links
{
"opengl32"
,
"ws2_32"
,
"winmm"
,
"gdi32"
,
"kernel32"
,
"user32"
,
"imm32"
}
links
{
"opengl32"
,
"ws2_32"
,
"winmm"
,
"gdi32"
,
"kernel32"
,
"user32"
,
"imm32"
}
if
USE_AUDIO
and
AUDIO_LIB
==
"irrklang"
then
links
{
"irrKlang"
}
if
IRRKLANG_PRO
then
defines
{
"IRRKLANG_STATIC"
}
filter
{
"not configurations:Debug"
}
libdirs
{
IRRKLANG_PRO_RELEASE_LIB_DIR
}
filter
{
"configurations:Debug"
}
libdirs
{
IRRKLANG_PRO_DEBUG_LIB_DIR
}
filter
{}
end
end
filter
"not system:windows"
filter
"not system:windows"
links
{
"event_pthreads"
,
"dl"
,
"pthread"
}
links
{
"event_pthreads"
,
"dl"
,
"pthread"
}
filter
"system:macosx"
filter
"system:macosx"
...
@@ -66,5 +90,11 @@ project "YGOPro"
...
@@ -66,5 +90,11 @@ project "YGOPro"
buildoptions
{
"--target=arm64-apple-macos12"
}
buildoptions
{
"--target=arm64-apple-macos12"
}
linkoptions
{
"-arch arm64"
}
linkoptions
{
"-arch arm64"
}
end
end
if
USE_AUDIO
and
AUDIO_LIB
==
"irrklang"
then
links
{
"irrklang"
}
end
filter
"system:linux"
filter
"system:linux"
links
{
"GL"
,
"X11"
,
"Xxf86vm"
}
links
{
"GL"
,
"X11"
,
"Xxf86vm"
}
if
USE_AUDIO
and
AUDIO_LIB
==
"irrklang"
then
links
{
"IrrKlang"
}
end
gframe/sound_manager.cpp
View file @
4adcf746
#include "sound_manager.h"
#include "sound_manager.h"
#if defined(YGOPRO_USE_AUDIO) && defined(YGOPRO_MINIAUDIO_SUPPORT_OPUS_VORBIS)
#include "myfilesystem.h"
#if defined(YGOPRO_USE_MINIAUDIO) && defined(YGOPRO_MINIAUDIO_SUPPORT_OPUS_VORBIS)
#include <miniaudio_libvorbis.h>
#include <miniaudio_libvorbis.h>
#include <miniaudio_libopus.h>
#include <miniaudio_libopus.h>
#endif
#endif
#include "myfilesystem.h"
#ifdef IRRKLANG_STATIC
#include "../ikpmp3/ikpMP3.h"
#endif
namespace
ygo
{
namespace
ygo
{
...
@@ -14,6 +17,7 @@ bool SoundManager::Init() {
...
@@ -14,6 +17,7 @@ bool SoundManager::Init() {
bgm_scene
=
-
1
;
bgm_scene
=
-
1
;
RefreshBGMList
();
RefreshBGMList
();
rnd
.
reset
((
unsigned
int
)
std
::
time
(
nullptr
));
rnd
.
reset
((
unsigned
int
)
std
::
time
(
nullptr
));
#ifdef YGOPRO_USE_MINIAUDIO
engineConfig
=
ma_engine_config_init
();
engineConfig
=
ma_engine_config_init
();
#ifdef YGOPRO_MINIAUDIO_SUPPORT_OPUS_VORBIS
#ifdef YGOPRO_MINIAUDIO_SUPPORT_OPUS_VORBIS
ma_decoding_backend_vtable
*
pCustomBackendVTables
[]
=
ma_decoding_backend_vtable
*
pCustomBackendVTables
[]
=
...
@@ -35,6 +39,20 @@ bool SoundManager::Init() {
...
@@ -35,6 +39,20 @@ bool SoundManager::Init() {
}
else
{
}
else
{
return
true
;
return
true
;
}
}
#endif // YGOPRO_USE_MINIAUDIO
#ifdef YGOPRO_USE_IRRKLANG
engineSound
=
irrklang
::
createIrrKlangDevice
();
engineMusic
=
irrklang
::
createIrrKlangDevice
();
if
(
!
engineSound
||
!
engineMusic
)
{
return
false
;
}
else
{
#ifdef IRRKLANG_STATIC
irrklang
::
ikpMP3Init
(
engineMusic
);
#endif
return
true
;
}
#endif // YGOPRO_USE_IRRKLANG
#endif // YGOPRO_USE_AUDIO
#endif // YGOPRO_USE_AUDIO
return
false
;
return
false
;
}
}
...
@@ -55,7 +73,7 @@ void SoundManager::RefershBGMDir(std::wstring path, int scene) {
...
@@ -55,7 +73,7 @@ void SoundManager::RefershBGMDir(std::wstring path, int scene) {
FileSystem
::
TraversalDir
(
search
.
c_str
(),
[
this
,
&
path
,
scene
](
const
wchar_t
*
name
,
bool
isdir
)
{
FileSystem
::
TraversalDir
(
search
.
c_str
(),
[
this
,
&
path
,
scene
](
const
wchar_t
*
name
,
bool
isdir
)
{
if
(
!
isdir
&&
(
if
(
!
isdir
&&
(
IsExtension
(
name
,
L".mp3"
)
IsExtension
(
name
,
L".mp3"
)
#if
def YGOPRO_MINIAUDIO_SUPPORT_OPUS_VORBIS
#if
defined(YGOPRO_MINIAUDIO_SUPPORT_OPUS_VORBIS) || defined(YGOPRO_USE_IRRKLANG)
||
IsExtension
(
name
,
L".ogg"
)
||
IsExtension
(
name
,
L".ogg"
)
#endif
#endif
))
{
))
{
...
@@ -195,9 +213,13 @@ void SoundManager::PlaySoundEffect(int sound) {
...
@@ -195,9 +213,13 @@ 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
);
#ifdef YGOPRO_USE_AUDIO
#ifdef YGOPRO_USE_
MINI
AUDIO
ma_engine_set_volume
(
&
engineSound
,
mainGame
->
gameConf
.
sound_volume
);
ma_engine_set_volume
(
&
engineSound
,
mainGame
->
gameConf
.
sound_volume
);
auto
res
=
ma_engine_play_sound
(
&
engineSound
,
soundPath
,
nullptr
);
ma_engine_play_sound
(
&
engineSound
,
soundPath
,
nullptr
);
#endif
#ifdef YGOPRO_USE_IRRKLANG
engineSound
->
setSoundVolume
(
mainGame
->
gameConf
.
sound_volume
);
engineSound
->
play2D
(
soundPath
);
#endif
#endif
}
}
void
SoundManager
::
PlayDialogSound
(
irr
::
gui
::
IGUIElement
*
element
)
{
void
SoundManager
::
PlayDialogSound
(
irr
::
gui
::
IGUIElement
*
element
)
{
...
@@ -224,8 +246,11 @@ void SoundManager::PlayDialogSound(irr::gui::IGUIElement * element) {
...
@@ -224,8 +246,11 @@ void SoundManager::PlayDialogSound(irr::gui::IGUIElement * element) {
}
}
}
}
bool
SoundManager
::
IsCurrentlyPlaying
(
char
*
song
)
{
bool
SoundManager
::
IsCurrentlyPlaying
(
char
*
song
)
{
#ifdef YGOPRO_USE_AUDIO
#ifdef YGOPRO_USE_
MINI
AUDIO
return
currentPlayingMusic
[
0
]
&&
strcmp
(
currentPlayingMusic
,
song
)
==
0
&&
ma_sound_is_playing
(
&
soundBGM
);
return
currentPlayingMusic
[
0
]
&&
strcmp
(
currentPlayingMusic
,
song
)
==
0
&&
ma_sound_is_playing
(
&
soundBGM
);
#endif
#ifdef YGOPRO_USE_IRRKLANG
return
engineMusic
->
isCurrentlyPlaying
(
song
);
#endif
#endif
return
false
;
return
false
;
}
}
...
@@ -235,6 +260,7 @@ void SoundManager::PlayMusic(char* song, bool loop) {
...
@@ -235,6 +260,7 @@ void SoundManager::PlayMusic(char* song, bool loop) {
return
;
return
;
if
(
!
IsCurrentlyPlaying
(
song
))
{
if
(
!
IsCurrentlyPlaying
(
song
))
{
StopBGM
();
StopBGM
();
#ifdef YGOPRO_USE_MINIAUDIO
strcpy
(
currentPlayingMusic
,
song
);
strcpy
(
currentPlayingMusic
,
song
);
#ifdef _WIN32
#ifdef _WIN32
wchar_t
song_w
[
1024
];
wchar_t
song_w
[
1024
];
...
@@ -245,6 +271,12 @@ void SoundManager::PlayMusic(char* song, bool loop) {
...
@@ -245,6 +271,12 @@ void SoundManager::PlayMusic(char* song, bool loop) {
#endif
#endif
ma_sound_set_looping
(
&
soundBGM
,
loop
);
ma_sound_set_looping
(
&
soundBGM
,
loop
);
ma_sound_start
(
&
soundBGM
);
ma_sound_start
(
&
soundBGM
);
#endif
#ifdef YGOPRO_USE_IRRKLANG
engineMusic
->
stopAllSounds
();
engineMusic
->
setSoundVolume
(
mainGame
->
gameConf
.
music_volume
);
soundBGM
=
engineMusic
->
play2D
(
song
,
loop
,
false
,
true
);
#endif
}
}
#endif
#endif
}
}
...
@@ -255,7 +287,11 @@ void SoundManager::PlayBGM(int scene) {
...
@@ -255,7 +287,11 @@ void SoundManager::PlayBGM(int scene) {
if
(
!
mainGame
->
chkMusicMode
->
isChecked
())
if
(
!
mainGame
->
chkMusicMode
->
isChecked
())
scene
=
BGM_ALL
;
scene
=
BGM_ALL
;
char
BGMName
[
1024
];
char
BGMName
[
1024
];
#if defined(YGOPRO_USE_MINIAUDIO)
if
(
scene
!=
bgm_scene
||
!
IsCurrentlyPlaying
(
currentPlayingMusic
))
{
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
;
...
@@ -270,21 +306,30 @@ void SoundManager::PlayBGM(int scene) {
...
@@ -270,21 +306,30 @@ void SoundManager::PlayBGM(int scene) {
#endif
#endif
}
}
void
SoundManager
::
StopBGM
()
{
void
SoundManager
::
StopBGM
()
{
#ifdef YGOPRO_USE_AUDIO
#ifdef YGOPRO_USE_
MINI
AUDIO
if
(
!
currentPlayingMusic
[
0
])
if
(
!
currentPlayingMusic
[
0
])
return
;
return
;
memset
(
currentPlayingMusic
,
0
,
sizeof
(
currentPlayingMusic
));
memset
(
currentPlayingMusic
,
0
,
sizeof
(
currentPlayingMusic
));
ma_sound_uninit
(
&
soundBGM
);
ma_sound_uninit
(
&
soundBGM
);
#endif
#endif
#ifdef YGOPRO_USE_IRRKLANG
engineMusic
->
stopAllSounds
();
#endif
}
}
void
SoundManager
::
SetSoundVolume
(
double
volume
)
{
void
SoundManager
::
SetSoundVolume
(
double
volume
)
{
#ifdef YGOPRO_USE_AUDIO
#ifdef YGOPRO_USE_
MINI
AUDIO
ma_engine_set_volume
(
&
engineSound
,
volume
);
ma_engine_set_volume
(
&
engineSound
,
volume
);
#endif
#endif
#ifdef YGOPRO_USE_IRRKLANG
engineSound
->
setSoundVolume
(
volume
);
#endif
}
}
void
SoundManager
::
SetMusicVolume
(
double
volume
)
{
void
SoundManager
::
SetMusicVolume
(
double
volume
)
{
#ifdef YGOPRO_USE_AUDIO
#ifdef YGOPRO_USE_
MINI
AUDIO
ma_engine_set_volume
(
&
engineMusic
,
volume
);
ma_engine_set_volume
(
&
engineMusic
,
volume
);
#endif
#endif
#ifdef YGOPRO_USE_IRRKLANG
engineMusic
->
setSoundVolume
(
volume
);
#endif
}
}
}
}
gframe/sound_manager.h
View file @
4adcf746
...
@@ -3,9 +3,12 @@
...
@@ -3,9 +3,12 @@
#include "game.h"
#include "game.h"
#include "../ocgcore/mtrandom.h"
#include "../ocgcore/mtrandom.h"
#ifdef YGOPRO_USE_AUDIO
#ifdef YGOPRO_USE_
MINI
AUDIO
#include <miniaudio.h>
#include <miniaudio.h>
#endif
#endif
#ifdef YGOPRO_USE_IRRKLANG
#include <irrKlang.h>
#endif
namespace
ygo
{
namespace
ygo
{
...
@@ -14,7 +17,7 @@ private:
...
@@ -14,7 +17,7 @@ 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_AUDIO
#ifdef YGOPRO_USE_
MINI
AUDIO
ma_engine_config
engineConfig
;
ma_engine_config
engineConfig
;
#ifdef YGOPRO_MINIAUDIO_SUPPORT_OPUS_VORBIS
#ifdef YGOPRO_MINIAUDIO_SUPPORT_OPUS_VORBIS
ma_resource_manager_config
resourceManagerConfig
;
ma_resource_manager_config
resourceManagerConfig
;
...
@@ -24,6 +27,11 @@ private:
...
@@ -24,6 +27,11 @@ private:
ma_engine
engineMusic
;
ma_engine
engineMusic
;
ma_sound
soundBGM
;
ma_sound
soundBGM
;
char
currentPlayingMusic
[
1024
]{};
char
currentPlayingMusic
[
1024
]{};
#endif
#ifdef YGOPRO_USE_IRRKLANG
irrklang
::
ISoundEngine
*
engineSound
;
irrklang
::
ISoundEngine
*
engineMusic
;
irrklang
::
ISound
*
soundBGM
;
#endif
#endif
void
RefershBGMDir
(
std
::
wstring
path
,
int
scene
);
void
RefershBGMDir
(
std
::
wstring
path
,
int
scene
);
...
...
premake/miniaudio/premake5.lua
View file @
4adcf746
...
@@ -4,7 +4,7 @@ project "miniaudio"
...
@@ -4,7 +4,7 @@ project "miniaudio"
if
MINIAUDIO_SUPPORT_OPUS_VORBIS
then
if
MINIAUDIO_SUPPORT_OPUS_VORBIS
then
files
{
"extras/decoders/libopus/*"
,
"extras/decoders/libvorbis/*"
}
files
{
"extras/decoders/libopus/*"
,
"extras/decoders/libvorbis/*"
}
if
BUILD_OPUS_VORBIS
then
if
MINIAUDIO_
BUILD_OPUS_VORBIS
then
files
{
"external/ogg/src/**.c"
,
"external/ogg/src/**.h"
}
files
{
"external/ogg/src/**.c"
,
"external/ogg/src/**.h"
}
files
{
"external/opus/src/**.c"
,
"external/opus/src/**.h"
}
files
{
"external/opus/src/**.c"
,
"external/opus/src/**.h"
}
files
{
"external/opus/celt/*.c"
,
"external/opus/celt/*.h"
}
files
{
"external/opus/celt/*.c"
,
"external/opus/celt/*.h"
}
...
...
premake5.lua
View file @
4adcf746
-- default global settings
-- default global settings
USE_AUDIO
=
true
BUILD_LUA
=
true
BUILD_LUA
=
true
LUA_LIB_NAME
=
"lua"
BUILD_EVENT
=
os
.
istarget
(
"windows"
)
BUILD_EVENT
=
os
.
istarget
(
"windows"
)
BUILD_FREETYPE
=
os
.
istarget
(
"windows"
)
BUILD_FREETYPE
=
os
.
istarget
(
"windows"
)
BUILD_SQLITE
=
os
.
istarget
(
"windows"
)
BUILD_SQLITE
=
os
.
istarget
(
"windows"
)
BUILD_IRRLICHT
=
not
os
.
istarget
(
"macosx"
)
BUILD_IRRLICHT
=
not
os
.
istarget
(
"macosx"
)
BUILD_OPUS_VORBIS
=
os
.
istarget
(
"windows"
)
USE_AUDIO
=
true
AUDIO_LIB
=
"miniaudio"
MINIAUDIO_SUPPORT_OPUS_VORBIS
=
true
MINIAUDIO_SUPPORT_OPUS_VORBIS
=
true
LUA_LIB_NAME
=
"lua"
MINIAUDIO_BUILD_OPUS_VORBIS
=
os
.
istarget
(
"windows"
)
IRRKLANG_PRO_BUILD_IKPMP3
=
false
-- read settings from command line or environment variables
-- read settings from command line or environment variables
...
@@ -16,7 +20,7 @@ newoption { trigger = "build-lua", category = "YGOPro - lua", description = "" }
...
@@ -16,7 +20,7 @@ newoption { trigger = "build-lua", category = "YGOPro - lua", description = "" }
newoption
{
trigger
=
"no-build-lua"
,
category
=
"YGOPro - lua"
,
description
=
""
}
newoption
{
trigger
=
"no-build-lua"
,
category
=
"YGOPro - lua"
,
description
=
""
}
newoption
{
trigger
=
"lua-include-dir"
,
category
=
"YGOPro - lua"
,
description
=
""
,
value
=
"PATH"
}
newoption
{
trigger
=
"lua-include-dir"
,
category
=
"YGOPro - lua"
,
description
=
""
,
value
=
"PATH"
}
newoption
{
trigger
=
"lua-lib-dir"
,
category
=
"YGOPro - lua"
,
description
=
""
,
value
=
"PATH"
}
newoption
{
trigger
=
"lua-lib-dir"
,
category
=
"YGOPro - lua"
,
description
=
""
,
value
=
"PATH"
}
newoption
{
trigger
=
"lua-lib-name"
,
category
=
"YGOPro - lua"
,
description
=
""
,
value
=
"NAME"
,
default
=
"lua"
}
newoption
{
trigger
=
"lua-lib-name"
,
category
=
"YGOPro - lua"
,
description
=
""
,
value
=
"NAME"
,
default
=
LUA_LIB_NAME
}
newoption
{
trigger
=
"build-event"
,
category
=
"YGOPro - event"
,
description
=
""
}
newoption
{
trigger
=
"build-event"
,
category
=
"YGOPro - event"
,
description
=
""
}
newoption
{
trigger
=
"no-build-event"
,
category
=
"YGOPro - event"
,
description
=
""
}
newoption
{
trigger
=
"no-build-event"
,
category
=
"YGOPro - event"
,
description
=
""
}
...
@@ -38,13 +42,8 @@ newoption { trigger = "no-build-irrlicht", category = "YGOPro - irrlicht", descr
...
@@ -38,13 +42,8 @@ newoption { trigger = "no-build-irrlicht", category = "YGOPro - irrlicht", descr
newoption
{
trigger
=
"irrlicht-include-dir"
,
category
=
"YGOPro - irrlicht"
,
description
=
""
,
value
=
"PATH"
}
newoption
{
trigger
=
"irrlicht-include-dir"
,
category
=
"YGOPro - irrlicht"
,
description
=
""
,
value
=
"PATH"
}
newoption
{
trigger
=
"irrlicht-lib-dir"
,
category
=
"YGOPro - irrlicht"
,
description
=
""
,
value
=
"PATH"
}
newoption
{
trigger
=
"irrlicht-lib-dir"
,
category
=
"YGOPro - irrlicht"
,
description
=
""
,
value
=
"PATH"
}
newoption
{
trigger
=
"irrklang-pro"
,
category
=
"YGOPro - irrklang - pro"
,
description
=
""
}
newoption
{
trigger
=
"no-irrklang-pro"
,
category
=
"YGOPro - irrklang - pro"
,
description
=
""
}
newoption
{
trigger
=
"irrklang-pro-release-lib-dir"
,
category
=
"YGOPro - irrklang - pro"
,
description
=
""
,
value
=
"PATH"
}
newoption
{
trigger
=
"irrklang-pro-debug-lib-dir"
,
category
=
"YGOPro - irrklang - pro"
,
description
=
""
,
value
=
"PATH"
}
newoption
{
trigger
=
'build-ikpmp3'
,
category
=
"YGOPro - irrklang - ikpmp3"
,
description
=
""
}
newoption
{
trigger
=
"no-audio"
,
category
=
"YGOPro"
,
description
=
""
}
newoption
{
trigger
=
"no-audio"
,
category
=
"YGOPro"
,
description
=
""
}
newoption
{
trigger
=
"audio-lib"
,
category
=
"YGOPro"
,
description
=
""
,
value
=
"miniaudio, irrklang"
,
default
=
AUDIO_LIB
}
newoption
{
trigger
=
"miniaudio-include-dir"
,
category
=
"YGOPro - miniaudio"
,
description
=
""
,
value
=
"PATH"
}
newoption
{
trigger
=
"miniaudio-include-dir"
,
category
=
"YGOPro - miniaudio"
,
description
=
""
,
value
=
"PATH"
}
newoption
{
trigger
=
"miniaudio-lib-dir"
,
category
=
"YGOPro - miniaudio"
,
description
=
""
,
value
=
"PATH"
}
newoption
{
trigger
=
"miniaudio-lib-dir"
,
category
=
"YGOPro - miniaudio"
,
description
=
""
,
value
=
"PATH"
}
...
@@ -57,6 +56,17 @@ newoption { trigger = "opus-lib-dir", category = "YGOPro - miniaudio", descripti
...
@@ -57,6 +56,17 @@ newoption { trigger = "opus-lib-dir", category = "YGOPro - miniaudio", descripti
newoption
{
trigger
=
"vorbis-include-dir"
,
category
=
"YGOPro - miniaudio"
,
description
=
""
}
newoption
{
trigger
=
"vorbis-include-dir"
,
category
=
"YGOPro - miniaudio"
,
description
=
""
}
newoption
{
trigger
=
"vorbis-lib-dir"
,
category
=
"YGOPro - miniaudio"
,
description
=
""
}
newoption
{
trigger
=
"vorbis-lib-dir"
,
category
=
"YGOPro - miniaudio"
,
description
=
""
}
newoption
{
trigger
=
"use-irrklang"
,
category
=
"YGOPro - irrklang"
,
description
=
"Deprecated, use audio-lib=irrklang"
}
newoption
{
trigger
=
"no-use-irrklang"
,
category
=
"YGOPro - irrklang"
,
description
=
"Deprecated, use no-audio"
}
newoption
{
trigger
=
"irrklang-include-dir"
,
category
=
"YGOPro - irrklang"
,
description
=
""
,
value
=
"PATH"
}
newoption
{
trigger
=
"irrklang-lib-dir"
,
category
=
"YGOPro - irrklang"
,
description
=
""
,
value
=
"PATH"
}
newoption
{
trigger
=
"irrklang-pro"
,
category
=
"YGOPro - irrklang - pro"
,
description
=
""
}
newoption
{
trigger
=
"no-irrklang-pro"
,
category
=
"YGOPro - irrklang - pro"
,
description
=
""
}
newoption
{
trigger
=
"irrklang-pro-release-lib-dir"
,
category
=
"YGOPro - irrklang - pro"
,
description
=
""
,
value
=
"PATH"
}
newoption
{
trigger
=
"irrklang-pro-debug-lib-dir"
,
category
=
"YGOPro - irrklang - pro"
,
description
=
""
,
value
=
"PATH"
}
newoption
{
trigger
=
'build-ikpmp3'
,
category
=
"YGOPro - irrklang - ikpmp3"
,
description
=
""
}
newoption
{
trigger
=
"winxp-support"
,
category
=
"YGOPro"
,
description
=
""
}
newoption
{
trigger
=
"winxp-support"
,
category
=
"YGOPro"
,
description
=
""
}
newoption
{
trigger
=
"mac-arm"
,
category
=
"YGOPro"
,
description
=
"Cross compile for Apple Silicon"
}
newoption
{
trigger
=
"mac-arm"
,
category
=
"YGOPro"
,
description
=
"Cross compile for Apple Silicon"
}
...
@@ -119,24 +129,68 @@ end
...
@@ -119,24 +129,68 @@ end
if
GetParam
(
"no-audio"
)
then
if
GetParam
(
"no-audio"
)
then
USE_AUDIO
=
false
USE_AUDIO
=
false
elseif
GetParam
(
"no-use-miniaudio"
)
then
print
(
"Warning: --no-use-miniaudio is deprecated, use --no-audio"
)
USE_AUDIO
=
false
elseif
GetParam
(
"use-miniaudio"
)
then
print
(
"Warning: --use-miniaudio is deprecated, use --audio-lib=miniaudio"
)
USE_AUDIO
=
true
AUDIO_LIB
=
"miniaudio"
elseif
GetParam
(
"no-use-irrklang"
)
then
print
(
"Warning: --no-use-irrklang is deprecated, use --no-audio"
)
USE_AUDIO
=
false
elseif
GetParam
(
"use-irrklang"
)
then
print
(
"Warning: --use-irrklang is deprecated, use --audio-lib=irrklang"
)
USE_AUDIO
=
true
AUDIO_LIB
=
"irrklang"
end
end
if
GetParam
(
"miniaudio-support-opus-vorbis"
)
then
if
USE_AUDIO
then
MINIAUDIO_SUPPORT_OPUS_VORBIS
=
true
AUDIO_LIB
=
GetParam
(
"audio-lib"
)
or
AUDIO_LIB
elseif
GetParam
(
"no-miniaudio-support-opus-vorbis"
)
then
if
AUDIO_LIB
==
"miniaudio"
then
MINIAUDIO_SUPPORT_OPUS_VORBIS
=
false
if
GetParam
(
"miniaudio-support-opus-vorbis"
)
then
end
MINIAUDIO_SUPPORT_OPUS_VORBIS
=
true
if
MINIAUDIO_SUPPORT_OPUS_VORBIS
then
elseif
GetParam
(
"no-miniaudio-support-opus-vorbis"
)
then
if
GetParam
(
"build-opus-vorbis"
)
then
MINIAUDIO_SUPPORT_OPUS_VORBIS
=
false
BUILD_OPUS_VORBIS
=
true
end
elseif
GetParam
(
"no-build-opus-vorbis"
)
then
if
MINIAUDIO_SUPPORT_OPUS_VORBIS
then
BUILD_OPUS_VORBIS
=
false
if
GetParam
(
"no-build-opus-vorbis"
)
then
end
MINIAUDIO_BUILD_OPUS_VORBIS
=
false
if
not
BUILD_OPUS_VORBIS
then
elseif
GetParam
(
"build-opus-vorbis"
)
then
OPUS_INCLUDE_DIR
=
GetParam
(
"opus-include-dir"
)
or
os
.
findheader
(
"opus"
)
MINIAUDIO_BUILD_OPUS_VORBIS
=
true
OPUS_LIB_DIR
=
GetParam
(
"opus-lib-dir"
)
or
os
.
findlib
(
"opusfile"
)
end
VORBIS_INCLUDE_DIR
=
GetParam
(
"vorbis-include-dir"
)
or
os
.
findheader
(
"vorbis"
)
if
not
MINIAUDIO_BUILD_OPUS_VORBIS
then
VORBIS_LIB_DIR
=
GetParam
(
"vorbis-lib-dir"
)
or
os
.
findlib
(
"vorbis"
)
OPUS_INCLUDE_DIR
=
GetParam
(
"opus-include-dir"
)
or
os
.
findheader
(
"opus"
)
OPUS_LIB_DIR
=
GetParam
(
"opus-lib-dir"
)
or
os
.
findlib
(
"opusfile"
)
VORBIS_INCLUDE_DIR
=
GetParam
(
"vorbis-include-dir"
)
or
os
.
findheader
(
"vorbis"
)
VORBIS_LIB_DIR
=
GetParam
(
"vorbis-lib-dir"
)
or
os
.
findlib
(
"vorbis"
)
end
end
elseif
AUDIO_LIB
==
"irrklang"
then
print
(
"Warning: irrKlang is deprecated and may be removed in future, please consider switching to miniaudio"
)
IRRKLANG_INCLUDE_DIR
=
GetParam
(
"irrklang-include-dir"
)
or
"../irrklang/include"
if
os
.
istarget
(
"windows"
)
then
IRRKLANG_LIB_DIR
=
"../irrklang/lib/Win32-visualStudio"
elseif
os
.
istarget
(
"linux"
)
then
IRRKLANG_LIB_DIR
=
"../irrklang/bin/linux-gcc-64"
IRRKLANG_LINK_RPATH
=
"-Wl,-rpath=./irrklang/bin/linux-gcc-64/"
elseif
os
.
istarget
(
"macosx"
)
then
IRRKLANG_LIB_DIR
=
"../irrklang/bin/macosx-gcc"
end
IRRKLANG_LIB_DIR
=
GetParam
(
"irrklang-lib-dir"
)
or
IRRKLANG_LIB_DIR
if
GetParam
(
"irrklang-pro"
)
and
os
.
istarget
(
"windows"
)
then
IRRKLANG_PRO
=
true
elseif
GetParam
(
"no-irrklang-pro"
)
then
IRRKLANG_PRO
=
false
end
if
IRRKLANG_PRO
then
-- irrklang pro can't use the pro lib to debug
IRRKLANG_PRO_RELEASE_LIB_DIR
=
GetParam
(
"irrklang-pro-release-lib-dir"
)
or
"../irrklang/lib/Win32-vs2019"
IRRKLANG_PRO_DEBUG_LIB_DIR
=
GetParam
(
"irrklang-pro-debug-lib-dir"
)
or
"../irrklang/lib/Win32-visualStudio-debug"
end
IRRKLANG_PRO_BUILD_IKPMP3
=
GetParam
(
"build-ikpmp3"
)
or
IRRKLANG_PRO
else
error
(
"Unknown audio library: "
..
AUDIO_LIB
)
end
end
end
end
...
@@ -237,5 +291,10 @@ workspace "YGOPro"
...
@@ -237,5 +291,10 @@ workspace "YGOPro"
include
"sqlite3"
include
"sqlite3"
end
end
if
USE_AUDIO
then
if
USE_AUDIO
then
include
"miniaudio"
if
AUDIO_LIB
==
"miniaudio"
then
include
"miniaudio"
end
if
IRRKLANG_PRO_BUILD_IKPMP3
then
include
"ikpmp3"
end
end
end
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