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
50dc9836
Commit
50dc9836
authored
Oct 30, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PcmMix: use negative value instead of NaN for addition
Avoid NaN to allow -ffast-math.
parent
c4d3030d
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
7 deletions
+6
-7
PlayerThread.cxx
src/PlayerThread.cxx
+1
-3
PcmMix.cxx
src/pcm/PcmMix.cxx
+2
-2
PcmMix.hxx
src/pcm/PcmMix.hxx
+3
-2
No files found.
src/PlayerThread.cxx
View file @
50dc9836
...
...
@@ -36,8 +36,6 @@
#include "util/Domain.hxx"
#include "Log.hxx"
#include <cmath>
#include <glib.h>
#include <string.h>
...
...
@@ -783,7 +781,7 @@ Player::PlayNextChunk()
chunk
->
mix_ratio
=
((
float
)
cross_fade_position
)
/
cross_fade_chunks
;
}
else
{
chunk
->
mix_ratio
=
nan
(
""
)
;
chunk
->
mix_ratio
=
-
1
;
}
if
(
other_chunk
->
IsEmpty
())
{
...
...
src/pcm/PcmMix.cxx
View file @
50dc9836
...
...
@@ -194,9 +194,9 @@ pcm_mix(void *buffer1, const void *buffer2, size_t size,
int
vol1
;
float
s
;
/* portion1 is between 0.0 and 1.0 for crossfading, MixRamp uses
NaN
/* portion1 is between 0.0 and 1.0 for crossfading, MixRamp uses
-1
* to signal mixing rather than fading */
if
(
isnan
(
portion1
)
)
if
(
portion1
<
0
)
return
pcm_add
(
buffer1
,
buffer2
,
size
,
format
);
s
=
sin
(
M_PI_2
*
portion1
);
...
...
src/pcm/PcmMix.hxx
View file @
50dc9836
...
...
@@ -36,8 +36,9 @@
* @param size the size of both buffers in bytes
* @param format the sample format of both buffers
* @param portion1 a number between 0.0 and 1.0 specifying the portion
* of the first buffer in the mix; portion2 = (1.0 - portion1). The value
* NaN is used by the MixRamp code to specify that simple addition is required.
* of the first buffer in the mix; portion2 = (1.0 - portion1).
* Negative values are used by the MixRamp code to specify that simple
* addition is required.
*
* @return true on success, false if the format is not supported
*/
...
...
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