Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
SRB2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
STJr
SRB2
Commits
8452ec5c
Commit
8452ec5c
authored
6 years ago
by
Marco Z
Browse files
Options
Downloads
Patches
Plain Diff
Checkpoint: Basic functions
parent
d93ca348
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/sdl/mixer_sound.c
+76
-1
76 additions, 1 deletion
src/sdl/mixer_sound.c
with
76 additions
and
1 deletion
src/sdl/mixer_sound.c
+
76
−
1
View file @
8452ec5c
...
...
@@ -69,6 +69,11 @@ static float loop_point;
static
boolean
songpaused
;
static
UINT32
music_bytes
;
static
boolean
is_looping
;
static
boolean
is_fadingout
;
static
boolean
is_fadingin
;
static
UINT8
fading_target
;
static
INT32
fading_id
;
static
UINT32
music_mslength
;
#ifdef HAVE_LIBGME
static
Music_Emu
*
gme
;
...
...
@@ -463,6 +468,30 @@ static void music_loop(void)
}
}
static
UINT32
music_fadeout
(
UINT32
interval
)
{
if
(
is_fadingout
)
{
CONS_Printf
(
"Fading out
\n
"
);
}
else
{
SDL_RemoveTimer
(
fading_id
);
}
}
static
UINT32
music_fadein
(
UINT32
interval
)
{
if
(
is_fadingin
)
{
CONS_Printf
(
"Fading in
\n
"
);
}
else
{
SDL_RemoveTimer
(
fading_id
);
}
}
#ifdef HAVE_LIBGME
static
void
mix_gme
(
void
*
udata
,
Uint8
*
stream
,
int
len
)
{
...
...
@@ -559,8 +588,9 @@ void I_ShutdownDigMusic(void)
#endif
if
(
!
music
)
return
;
is_looping
=
false
;
is_fadingin
=
is_fadingout
=
is_looping
=
false
;
music_bytes
=
0
;
SDL_RemoveTimer
(
fading_id
);
Mix_UnregisterEffect
(
MIX_CHANNEL_POST
,
count_music_bytes
);
Mix_HookMusicFinished
(
NULL
);
Mix_FreeMusic
(
music
);
...
...
@@ -849,6 +879,51 @@ boolean I_SetSongTrack(int track)
return
false
;
}
void
I_StopFadingMusic
()
{
if
(
fading_id
)
SDL_RemoveTimer
(
fading_id
);
is_fadingout
=
is_fadingin
=
false
;
fading_target
=
fading_id
=
-
1
;
}
void
I_FadeMusic
(
UINT8
fading_target_in
)
{
I_StopFadingMusic
();
if
(
!
is_fadingout
||
fading_target
!=
fading_target_in
)
{
fading_id
=
SDL_AddTimer
(
1
,
music_fadeout
,
NULL
);
if
(
fading_id
)
{
is_fadingout
=
true
;
fading_target
=
fading_target_in
;
}
}
}
void
I_FadeInMusic
(
UINT8
fading_target_in
)
{
I_StopFadingMusic
();
// if (!is_fadingin)
// {
// }
}
void
I_FadeOutMusic
(
UINT8
fading_target_in
)
{
I_StopFadingMusic
();
if
(
!
is_fadingout
||
fading_target
!=
fading_target_in
)
{
fading_id
=
SDL_AddTimer
(
1
,
music_fadeout
,
NULL
);
if
(
fading_id
)
{
is_fadingout
=
true
;
fading_target
=
fading_target_in
;
}
}
}
//
// MIDI Music
//
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment