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
88efc94e
Commit
88efc94e
authored
Mar 31, 2025
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into server
parents
4d8564bd
f45e2f0c
Pipeline
#34450
passed with stages
in 6 minutes and 1 second
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
16 deletions
+34
-16
gframe/sound_manager.cpp
gframe/sound_manager.cpp
+31
-12
gframe/sound_manager.h
gframe/sound_manager.h
+1
-2
ocgcore
ocgcore
+1
-1
script
script
+1
-1
No files found.
gframe/sound_manager.cpp
View file @
88efc94e
...
@@ -36,7 +36,6 @@ bool SoundManager::Init() {
...
@@ -36,7 +36,6 @@ bool SoundManager::Init() {
}
}
engineConfig
.
pResourceManager
=
&
resourceManager
;
engineConfig
.
pResourceManager
=
&
resourceManager
;
#endif
#endif
playingSoundEffect
=
FALSE
;
if
(
ma_engine_init
(
&
engineConfig
,
&
engineSound
)
!=
MA_SUCCESS
||
ma_engine_init
(
&
engineConfig
,
&
engineMusic
)
!=
MA_SUCCESS
)
{
if
(
ma_engine_init
(
&
engineConfig
,
&
engineSound
)
!=
MA_SUCCESS
||
ma_engine_init
(
&
engineConfig
,
&
engineMusic
)
!=
MA_SUCCESS
)
{
return
false
;
return
false
;
}
else
{
}
else
{
...
@@ -90,21 +89,38 @@ void SoundManager::PlaySound(char* sound) {
...
@@ -90,21 +89,38 @@ void SoundManager::PlaySound(char* sound) {
#ifdef YGOPRO_USE_AUDIO
#ifdef YGOPRO_USE_AUDIO
if
(
!
mainGame
->
chkEnableSound
->
isChecked
())
if
(
!
mainGame
->
chkEnableSound
->
isChecked
())
return
;
return
;
#ifdef YGOPRO_USE_MINIAUDIO
StopSound
();
SetSoundVolume
(
mainGame
->
gameConf
.
sound_volume
);
SetSoundVolume
(
mainGame
->
gameConf
.
sound_volume
);
playingSoundEffect
=
TRUE
;
#ifdef YGOPRO_USE_MINIAUDIO
ma_sound
*
usingSoundEffectPointer
=
nullptr
;
for
(
int
i
=
0
;
i
<
10
;
i
++
)
{
if
(
playingSoundEffect
[
i
]
&&
!
ma_sound_is_playing
(
playingSoundEffect
[
i
]))
{
ma_sound_uninit
(
playingSoundEffect
[
i
]);
if
(
usingSoundEffectPointer
)
{
free
(
playingSoundEffect
[
i
]);
playingSoundEffect
[
i
]
=
nullptr
;
}
else
{
usingSoundEffectPointer
=
playingSoundEffect
[
i
];
}
}
if
(
!
playingSoundEffect
[
i
]
&&
!
usingSoundEffectPointer
)
{
usingSoundEffectPointer
=
playingSoundEffect
[
i
]
=
(
ma_sound
*
)
malloc
(
sizeof
(
ma_sound
));
}
}
if
(
!
usingSoundEffectPointer
)
{
// force to stop the first sound
usingSoundEffectPointer
=
playingSoundEffect
[
0
];
ma_sound_uninit
(
usingSoundEffectPointer
);
}
#ifdef _WIN32
#ifdef _WIN32
wchar_t
sound_w
[
1024
];
wchar_t
sound_w
[
1024
];
BufferIO
::
DecodeUTF8
(
sound
,
sound_w
);
BufferIO
::
DecodeUTF8
(
sound
,
sound_w
);
ma_sound_init_from_file_w
(
&
engineSound
,
sound_w
,
MA_SOUND_FLAG_ASYNC
|
MA_SOUND_FLAG_STREAM
,
nullptr
,
nullptr
,
&
soundEffect
);
ma_sound_init_from_file_w
(
&
engineSound
,
sound_w
,
MA_SOUND_FLAG_ASYNC
|
MA_SOUND_FLAG_STREAM
,
nullptr
,
nullptr
,
usingSoundEffectPointer
);
#else
#else
ma_sound_init_from_file
(
&
engineSound
,
sound
,
MA_SOUND_FLAG_ASYNC
|
MA_SOUND_FLAG_STREAM
,
nullptr
,
nullptr
,
&
soundEffect
);
ma_sound_init_from_file
(
&
engineSound
,
sound
,
MA_SOUND_FLAG_ASYNC
|
MA_SOUND_FLAG_STREAM
,
nullptr
,
nullptr
,
usingSoundEffectPointer
);
#endif
#endif
ma_sound_start
(
&
soundEffect
);
ma_sound_start
(
usingSoundEffectPointer
);
#endif
#endif
#ifdef YGOPRO_USE_IRRKLANG
#ifdef YGOPRO_USE_IRRKLANG
SetSoundVolume
(
mainGame
->
gameConf
.
sound_volume
);
engineSound
->
play2D
(
soundPath
);
engineSound
->
play2D
(
soundPath
);
#endif
#endif
#endif
#endif
...
@@ -358,10 +374,13 @@ void SoundManager::StopBGM() {
...
@@ -358,10 +374,13 @@ void SoundManager::StopBGM() {
}
}
void
SoundManager
::
StopSound
()
{
void
SoundManager
::
StopSound
()
{
#ifdef YGOPRO_USE_MINIAUDIO
#ifdef YGOPRO_USE_MINIAUDIO
if
(
!
playingSoundEffect
)
for
(
int
i
=
0
;
i
<
10
;
i
++
)
{
return
;
if
(
playingSoundEffect
[
i
])
{
playingSoundEffect
=
FALSE
;
ma_sound_uninit
(
playingSoundEffect
[
i
]);
ma_sound_uninit
(
&
soundEffect
);
free
(
playingSoundEffect
[
i
]);
playingSoundEffect
[
i
]
=
nullptr
;
}
}
#endif
#endif
#ifdef YGOPRO_USE_IRRKLANG
#ifdef YGOPRO_USE_IRRKLANG
engineSound
->
stopAllSounds
();
engineSound
->
stopAllSounds
();
...
...
gframe/sound_manager.h
View file @
88efc94e
...
@@ -29,8 +29,7 @@ private:
...
@@ -29,8 +29,7 @@ private:
ma_engine
engineMusic
;
ma_engine
engineMusic
;
ma_sound
soundBGM
;
ma_sound
soundBGM
;
char
currentPlayingMusic
[
1024
]{};
char
currentPlayingMusic
[
1024
]{};
ma_sound
soundEffect
;
ma_sound
*
playingSoundEffect
[
10
]{};
char
playingSoundEffect
;
#endif
#endif
#ifdef YGOPRO_USE_IRRKLANG
#ifdef YGOPRO_USE_IRRKLANG
irrklang
::
ISoundEngine
*
engineSound
;
irrklang
::
ISoundEngine
*
engineSound
;
...
...
ocgcore
@
ca5bd0f5
Subproject commit c
d8598dd962280fabc48971c5de0e434682bb1df
Subproject commit c
a5bd0f5e1b4113d7e046d8228b70fc2281d08eb
script
@
3e5aeb86
Subproject commit
9f141e8cdfc7adee127eaca1a7981e816b555ae3
Subproject commit
3e5aeb86a3e4fc20bdf14a89fb3b4ba2f35f1cbe
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