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
1
Merge Requests
1
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
nanahira
ygopro
Commits
e337da72
Commit
e337da72
authored
Mar 31, 2025
by
mercury233
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "less conversion"
This reverts commit
15687a2c
.
parent
15687a2c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
17 deletions
+21
-17
gframe/sound_manager.cpp
gframe/sound_manager.cpp
+18
-14
gframe/sound_manager.h
gframe/sound_manager.h
+3
-3
No files found.
gframe/sound_manager.cpp
View file @
e337da72
...
@@ -250,35 +250,37 @@ void SoundManager::PlayDialogSound(irr::gui::IGUIElement * element) {
...
@@ -250,35 +250,37 @@ void SoundManager::PlayDialogSound(irr::gui::IGUIElement * element) {
PlaySoundEffect
(
SOUND_QUESTION
);
PlaySoundEffect
(
SOUND_QUESTION
);
}
}
}
}
bool
SoundManager
::
IsCurrentlyPlaying
(
wchar_t
*
music
)
{
bool
SoundManager
::
IsCurrentlyPlaying
(
char
*
song
)
{
#ifdef YGOPRO_USE_MINIAUDIO
#ifdef YGOPRO_USE_MINIAUDIO
return
currentPlayingMusic
[
0
]
&&
!
mywcsncasecmp
(
currentPlayingMusic
,
music
,
1024
)
&&
ma_sound_is_playing
(
&
soundBGM
);
return
currentPlayingMusic
[
0
]
&&
strcmp
(
currentPlayingMusic
,
song
)
==
0
&&
ma_sound_is_playing
(
&
soundBGM
);
#endif
#endif
#ifdef YGOPRO_USE_IRRKLANG
#ifdef YGOPRO_USE_IRRKLANG
char
cmusic
[
1024
];
return
engineMusic
->
isCurrentlyPlaying
(
song
);
BufferIO
::
EncodeUTF8
(
music
,
cmusic
);
return
engineMusic
->
isCurrentlyPlaying
(
cmusic
);
#endif
#endif
return
false
;
return
false
;
}
}
void
SoundManager
::
PlayMusic
(
wchar_t
*
music
,
bool
loop
)
{
void
SoundManager
::
PlayMusic
(
char
*
song
,
bool
loop
)
{
#ifdef YGOPRO_USE_AUDIO
#ifdef YGOPRO_USE_AUDIO
if
(
!
mainGame
->
chkEnableMusic
->
isChecked
())
if
(
!
mainGame
->
chkEnableMusic
->
isChecked
())
return
;
return
;
if
(
!
IsCurrentlyPlaying
(
music
))
{
if
(
!
IsCurrentlyPlaying
(
song
))
{
StopBGM
();
StopBGM
();
#ifdef YGOPRO_USE_MINIAUDIO
#ifdef YGOPRO_USE_MINIAUDIO
BufferIO
::
CopyWStr
(
music
,
currentPlayingMusic
,
1024
);
strcpy
(
currentPlayingMusic
,
song
);
ma_sound_init_from_file_w
(
&
engineMusic
,
music
,
MA_SOUND_FLAG_ASYNC
|
MA_SOUND_FLAG_STREAM
,
nullptr
,
nullptr
,
&
soundBGM
);
#ifdef _WIN32
wchar_t
song_w
[
1024
];
BufferIO
::
DecodeUTF8
(
song
,
song_w
);
ma_sound_init_from_file_w
(
&
engineMusic
,
song_w
,
MA_SOUND_FLAG_ASYNC
|
MA_SOUND_FLAG_STREAM
,
nullptr
,
nullptr
,
&
soundBGM
);
#else
ma_sound_init_from_file
(
&
engineMusic
,
song
,
MA_SOUND_FLAG_ASYNC
|
MA_SOUND_FLAG_STREAM
,
nullptr
,
nullptr
,
&
soundBGM
);
#endif
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
();
engineMusic
->
stopAllSounds
();
engineMusic
->
setSoundVolume
(
mainGame
->
gameConf
.
music_volume
);
engineMusic
->
setSoundVolume
(
mainGame
->
gameConf
.
music_volume
);
char
cmusic
[
1024
];
soundBGM
=
engineMusic
->
play2D
(
song
,
loop
,
false
,
true
);
BufferIO
::
EncodeUTF8
(
music
,
cmusic
);
soundBGM
=
engineMusic
->
play2D
(
cmusic
,
loop
,
false
,
true
);
#endif
#endif
}
}
#endif
#endif
...
@@ -289,6 +291,7 @@ void SoundManager::PlayBGM(int scene) {
...
@@ -289,6 +291,7 @@ 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 defined(YGOPRO_USE_MINIAUDIO)
#if defined(YGOPRO_USE_MINIAUDIO)
if
(
scene
!=
bgm_scene
||
!
IsCurrentlyPlaying
(
currentPlayingMusic
))
{
if
(
scene
!=
bgm_scene
||
!
IsCurrentlyPlaying
(
currentPlayingMusic
))
{
#elif defined(YGOPRO_USE_IRRKLANG)
#elif defined(YGOPRO_USE_IRRKLANG)
...
@@ -300,8 +303,9 @@ void SoundManager::PlayBGM(int scene) {
...
@@ -300,8 +303,9 @@ void SoundManager::PlayBGM(int scene) {
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
BGMName
[
1024
];
wchar_t
fname
[
1024
];
myswprintf
(
BGMName
,
L"./sound/BGM/%ls"
,
name
);
myswprintf
(
fname
,
L"./sound/BGM/%ls"
,
name
);
BufferIO
::
EncodeUTF8
(
fname
,
BGMName
);
PlayMusic
(
BGMName
,
false
);
PlayMusic
(
BGMName
,
false
);
}
}
#endif
#endif
...
...
gframe/sound_manager.h
View file @
e337da72
...
@@ -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
;
wchar_t
currentPlayingMusic
[
1024
]{};
char
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
IsCurrentlyPlaying
(
wchar_t
*
music
);
bool
IsCurrentlyPlaying
(
char
*
song
);
void
PlayMusic
(
wchar_t
*
music
,
bool
loop
);
void
PlayMusic
(
char
*
song
,
bool
loop
);
void
PlayBGM
(
int
scene
);
void
PlayBGM
(
int
scene
);
void
StopBGM
();
void
StopBGM
();
void
SetSoundVolume
(
double
volume
);
void
SetSoundVolume
(
double
volume
);
...
...
mercury233
@mercury233
mentioned in commit
4d3563de
·
Apr 13, 2025
mentioned in commit
4d3563de
mentioned in commit 4d3563de707305211f34c0122a1bbe694a9c6c4d
Toggle commit list
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