Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
873025a4
Commit
873025a4
authored
Nov 14, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/sidplay: correctly calculate floating point time
Internally, use only the integer time. When needed, convert it to a floating point seconds value.
parent
409a3ed8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
8 deletions
+11
-8
sidplay_plugin.cxx
src/decoder/sidplay_plugin.cxx
+11
-8
No files found.
src/decoder/sidplay_plugin.cxx
View file @
873025a4
...
...
@@ -283,8 +283,10 @@ sidplay_file_decode(struct decoder *decoder, const char *path_fs)
/* .. and play */
float
data_time
=
0
;
int
timebase
=
player
.
timebase
();
unsigned
data_time
=
0
;
const
unsigned
timebase
=
player
.
timebase
();
song_len
*=
timebase
;
enum
decoder_command
cmd
;
do
{
char
buffer
[
4096
];
...
...
@@ -295,12 +297,13 @@ sidplay_file_decode(struct decoder *decoder, const char *path_fs)
break
;
cmd
=
decoder_data
(
decoder
,
NULL
,
buffer
,
nbytes
,
data_time
,
0
,
NULL
);
data_time
=
player
.
time
()
/
timebase
;
(
float
)
data_time
/
(
float
)
timebase
,
0
,
NULL
);
data_time
=
player
.
time
()
;
if
(
cmd
==
DECODE_COMMAND_SEEK
)
{
int
target_time
=
decoder_seek_where
(
decoder
);
unsigned
target_time
=
(
unsigned
)
(
decoder_seek_where
(
decoder
)
*
timebase
);
/* can't rewind so return to zero and seek forward */
if
(
target_time
<
data_time
)
{
...
...
@@ -313,13 +316,13 @@ sidplay_file_decode(struct decoder *decoder, const char *path_fs)
nbytes
=
player
.
play
(
buffer
,
sizeof
(
buffer
));
if
(
nbytes
==
0
)
break
;
data_time
=
player
.
time
()
/
timebase
;
data_time
=
player
.
time
()
;
}
decoder_command_finished
(
decoder
);
}
if
(
song_len
&&
data_time
>=
(
float
)
song_len
)
if
(
song_len
>
0
&&
data_time
>=
song_len
)
break
;
}
while
(
cmd
!=
DECODE_COMMAND_STOP
);
...
...
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