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
Package registry
Model registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
John Peter Sa
SRB2
Commits
f76f855b
Commit
f76f855b
authored
6 years ago
by
Marco Z
Browse files
Options
Downloads
Patches
Plain Diff
Defer tag loading due to playback wipe bug
parent
68ed55fa
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/win32/win_snd.c
+41
-24
41 additions, 24 deletions
src/win32/win_snd.c
with
41 additions
and
24 deletions
src/win32/win_snd.c
+
41
−
24
View file @
f76f855b
...
@@ -43,6 +43,7 @@ static FMOD_CHANNEL *music_channel;
...
@@ -43,6 +43,7 @@ static FMOD_CHANNEL *music_channel;
static
UINT8
music_volume
,
midi_volume
,
sfx_volume
;
static
UINT8
music_volume
,
midi_volume
,
sfx_volume
;
static
INT32
current_track
;
static
INT32
current_track
;
static
boolean
looppointloaded
=
false
;
// deferred loop point loading
#ifdef HAVE_LIBGME
#ifdef HAVE_LIBGME
static
Music_Emu
*
gme
;
static
Music_Emu
*
gme
;
...
@@ -549,8 +550,6 @@ boolean I_LoadSong(char *data, size_t len)
...
@@ -549,8 +550,6 @@ boolean I_LoadSong(char *data, size_t len)
{
{
FMOD_CREATESOUNDEXINFO
fmt
;
FMOD_CREATESOUNDEXINFO
fmt
;
FMOD_RESULT
e
;
FMOD_RESULT
e
;
FMOD_TAG
tag
;
unsigned
int
loopstart
,
loopend
;
if
(
if
(
#ifdef HAVE_LIBGME
#ifdef HAVE_LIBGME
...
@@ -685,6 +684,36 @@ boolean I_LoadSong(char *data, size_t len)
...
@@ -685,6 +684,36 @@ boolean I_LoadSong(char *data, size_t len)
return
false
;
return
false
;
}
}
// Must load the loop point after starting song playback
// Otherwise, the music cuts off during screen wipes
looppointloaded
=
false
;
return
true
;
}
void
I_UnloadSong
(
void
)
{
I_StopSong
();
#ifdef HAVE_LIBGME
if
(
gme
)
{
gme_delete
(
gme
);
gme
=
NULL
;
}
#endif
if
(
music_stream
)
{
FMR
(
FMOD_Sound_Release
(
music_stream
));
music_stream
=
NULL
;
}
}
static
void
FindLoopPoint
()
{
FMOD_RESULT
e
;
FMOD_TAG
tag
;
unsigned
int
loopstart
,
loopend
;
// Try to find a loop point in streaming music formats (ogg, mp3)
// Try to find a loop point in streaming music formats (ogg, mp3)
// A proper LOOPPOINT is its own tag, stupid.
// A proper LOOPPOINT is its own tag, stupid.
...
@@ -696,7 +725,8 @@ boolean I_LoadSong(char *data, size_t len)
...
@@ -696,7 +725,8 @@ boolean I_LoadSong(char *data, size_t len)
FMR
(
FMOD_Sound_GetLoopPoints
(
music_stream
,
NULL
,
FMOD_TIMEUNIT_PCM
,
&
loopend
,
FMOD_TIMEUNIT_PCM
));
FMR
(
FMOD_Sound_GetLoopPoints
(
music_stream
,
NULL
,
FMOD_TIMEUNIT_PCM
,
&
loopend
,
FMOD_TIMEUNIT_PCM
));
if
(
loopstart
>
0
)
if
(
loopstart
>
0
)
FMR
(
FMOD_Sound_SetLoopPoints
(
music_stream
,
loopstart
,
FMOD_TIMEUNIT_PCM
,
loopend
,
FMOD_TIMEUNIT_PCM
));
FMR
(
FMOD_Sound_SetLoopPoints
(
music_stream
,
loopstart
,
FMOD_TIMEUNIT_PCM
,
loopend
,
FMOD_TIMEUNIT_PCM
));
return
true
;
looppointloaded
=
true
;
return
;
}
}
// Use LOOPMS for time in miliseconds.
// Use LOOPMS for time in miliseconds.
...
@@ -708,7 +738,8 @@ boolean I_LoadSong(char *data, size_t len)
...
@@ -708,7 +738,8 @@ boolean I_LoadSong(char *data, size_t len)
FMR
(
FMOD_Sound_GetLoopPoints
(
music_stream
,
NULL
,
FMOD_TIMEUNIT_MS
,
&
loopend
,
FMOD_TIMEUNIT_PCM
));
FMR
(
FMOD_Sound_GetLoopPoints
(
music_stream
,
NULL
,
FMOD_TIMEUNIT_MS
,
&
loopend
,
FMOD_TIMEUNIT_PCM
));
if
(
loopstart
>
0
)
if
(
loopstart
>
0
)
FMR
(
FMOD_Sound_SetLoopPoints
(
music_stream
,
loopstart
,
FMOD_TIMEUNIT_MS
,
loopend
,
FMOD_TIMEUNIT_PCM
));
FMR
(
FMOD_Sound_SetLoopPoints
(
music_stream
,
loopstart
,
FMOD_TIMEUNIT_MS
,
loopend
,
FMOD_TIMEUNIT_PCM
));
return
true
;
looppointloaded
=
true
;
return
;
}
}
// Try to fetch it from the COMMENT tag, like A.J. Freda
// Try to fetch it from the COMMENT tag, like A.J. Freda
...
@@ -733,28 +764,11 @@ boolean I_LoadSong(char *data, size_t len)
...
@@ -733,28 +764,11 @@ boolean I_LoadSong(char *data, size_t len)
if
(
loopstart
>
0
)
if
(
loopstart
>
0
)
FMR
(
FMOD_Sound_SetLoopPoints
(
music_stream
,
loopstart
,
FMOD_TIMEUNIT_PCM
,
loopend
,
FMOD_TIMEUNIT_PCM
));
FMR
(
FMOD_Sound_SetLoopPoints
(
music_stream
,
loopstart
,
FMOD_TIMEUNIT_PCM
,
loopend
,
FMOD_TIMEUNIT_PCM
));
}
}
return
true
;
looppointloaded
=
true
;
return
;
}
}
// No special loop point
looppointloaded
=
true
;
return
true
;
}
void
I_UnloadSong
(
void
)
{
I_StopSong
();
#ifdef HAVE_LIBGME
if
(
gme
)
{
gme_delete
(
gme
);
gme
=
NULL
;
}
#endif
if
(
music_stream
)
{
FMR
(
FMOD_Sound_Release
(
music_stream
));
music_stream
=
NULL
;
}
}
}
boolean
I_PlaySong
(
boolean
looping
)
boolean
I_PlaySong
(
boolean
looping
)
...
@@ -780,6 +794,9 @@ boolean I_PlaySong(boolean looping)
...
@@ -780,6 +794,9 @@ boolean I_PlaySong(boolean looping)
FMR
(
FMOD_Channel_SetPriority
(
music_channel
,
0
));
FMR
(
FMOD_Channel_SetPriority
(
music_channel
,
0
));
current_track
=
0
;
current_track
=
0
;
if
(
!
looppointloaded
)
FindLoopPoint
();
return
true
;
return
true
;
}
}
...
...
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