Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile
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
fallenstardust
YGOMobile
Commits
711c3715
Commit
711c3715
authored
Nov 22, 2019
by
Unicorn369
Committed by
fallenstardust
Dec 08, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复出现混音问题
parent
abe0f0b9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
3 deletions
+13
-3
Classes/gframe/sound_manager.cpp
Classes/gframe/sound_manager.cpp
+12
-3
Classes/gframe/sound_manager.h
Classes/gframe/sound_manager.h
+1
-0
No files found.
Classes/gframe/sound_manager.cpp
View file @
711c3715
...
...
@@ -9,6 +9,7 @@ bool SoundManager::Init(double sounds_volume, double music_volume, bool sounds_e
musicEnabled
=
music_enabled
;
rnd
.
seed
(
time
(
0
));
bgm_scene
=
-
1
;
bgm_process
=
true
;
RefreshBGMList
();
RefreshChantsList
();
try
{
...
...
@@ -134,7 +135,7 @@ void SoundManager::PlayBGM(BGM scene) {
scene
=
BGM
::
ALL
;
auto
&
list
=
BGMList
[
scene
];
int
count
=
list
.
size
();
if
(
musicEnabled
&&
(
scene
!=
bgm_scene
||
!
bgm
->
exists
(
bgmCurrent
))
&&
count
>
0
)
{
if
(
musicEnabled
&&
(
scene
!=
bgm_scene
||
!
bgm
->
exists
(
bgmCurrent
))
&&
bgm_process
&&
count
>
0
)
{
bgm_scene
=
scene
;
int
bgm
=
(
std
::
uniform_int_distribution
<>
(
0
,
count
-
1
))(
rnd
);
std
::
string
BGMName
=
"./sound/BGM/"
+
list
[
bgm
];
...
...
@@ -149,7 +150,11 @@ void SoundManager::StopBGM() {
}
bool
SoundManager
::
PlayChant
(
unsigned
int
code
)
{
if
(
ChantsList
.
count
(
code
))
{
if
(
bgm
)
PlayMusic
(
"./sound/chants/"
+
ChantsList
[
code
],
false
);
if
(
bgm
)
{
bgm_process
=
false
;
PlayMusic
(
"./sound/chants/"
+
ChantsList
[
code
],
false
);
bgm_process
=
true
;
}
return
true
;
}
return
false
;
...
...
@@ -162,7 +167,11 @@ void SoundManager::PlayCustomSound(char* SoundName) {
void
SoundManager
::
PlayCustomBGM
(
char
*
BGMName
)
{
if
(
!
musicEnabled
||
!
mainGame
->
chkMusicMode
->
isChecked
())
return
;
if
(
access
(
BGMName
,
0
)
!=
0
)
return
;
if
(
bgm
)
PlayMusic
(
BGMName
,
false
);
if
(
bgm
)
{
bgm_process
=
false
;
PlayMusic
(
BGMName
,
false
);
bgm_process
=
true
;
}
}
void
SoundManager
::
SetSoundVolume
(
double
volume
)
{
if
(
sfx
)
sfx
->
setVolume
(
volume
);
...
...
Classes/gframe/sound_manager.h
View file @
711c3715
...
...
@@ -70,6 +70,7 @@ private:
std
::
vector
<
std
::
string
>
BGMList
[
8
];
std
::
map
<
unsigned
int
,
std
::
string
>
ChantsList
;
int
bgm_scene
=
-
1
;
bool
bgm_process
;
std
::
mt19937
rnd
;
std
::
unique_ptr
<
YGOpen
::
OpenALSingleton
>
openal
;
std
::
unique_ptr
<
YGOpen
::
OpenALSoundLayer
>
sfx
;
...
...
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