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
c6f10188
Commit
c6f10188
authored
Oct 30, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CrossFade: use negative value for invalid MixRamp overlap
Avoid NaN to allow -ffast-math.
parent
c0c0526f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
6 deletions
+13
-6
CrossFade.cxx
src/CrossFade.cxx
+12
-5
test_mixramp.cxx
test/test_mixramp.cxx
+1
-1
No files found.
src/CrossFade.cxx
View file @
c6f10188
...
...
@@ -83,7 +83,7 @@ mixramp_interpolate(const char *ramp_list, float required_db)
return
secs
;
}
return
nan
(
""
)
;
return
-
1
;
}
unsigned
...
...
@@ -96,7 +96,6 @@ CrossFadeSettings::Calculate(float total_time,
{
unsigned
int
chunks
=
0
;
float
chunks_f
;
float
mixramp_overlap
;
if
(
duration
<
0
||
duration
>=
total_time
||
/* we can't crossfade when the audio formats are different */
...
...
@@ -112,9 +111,17 @@ CrossFadeSettings::Calculate(float total_time,
chunks
=
(
chunks_f
*
duration
+
0.5
);
}
else
{
/* Calculate mixramp overlap. */
mixramp_overlap
=
mixramp_interpolate
(
mixramp_start
,
mixramp_db
-
replay_gain_db
)
+
mixramp_interpolate
(
mixramp_prev_end
,
mixramp_db
-
replay_gain_prev_db
);
if
(
!
std
::
isnan
(
mixramp_overlap
)
&&
const
float
mixramp_overlap_current
=
mixramp_interpolate
(
mixramp_start
,
mixramp_db
-
replay_gain_db
);
const
float
mixramp_overlap_prev
=
mixramp_interpolate
(
mixramp_prev_end
,
mixramp_db
-
replay_gain_prev_db
);
const
float
mixramp_overlap
=
mixramp_overlap_current
+
mixramp_overlap_prev
;
if
(
mixramp_overlap_current
>=
0
&&
mixramp_overlap_prev
>=
0
&&
mixramp_delay
<=
mixramp_overlap
)
{
chunks
=
(
chunks_f
*
(
mixramp_overlap
-
mixramp_delay
));
FormatDebug
(
cross_fade_domain
,
...
...
test/test_mixramp.cxx
View file @
c6f10188
...
...
@@ -43,7 +43,7 @@ public:
free
(
foo
);
foo
=
strdup
(
input
);
CPPUNIT_ASSERT
(
std
::
isnan
(
mixramp_interpolate
(
foo
,
6.1
))
);
CPPUNIT_ASSERT
(
mixramp_interpolate
(
foo
,
6.1
)
<
0
);
free
(
foo
);
foo
=
strdup
(
input
);
...
...
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