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
495e1b6c
Commit
495e1b6c
authored
May 23, 2007
by
J. Alexander Treuman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tidying up pcm_utils.c a bit more.
git-svn-id:
https://svn.musicpd.org/mpd/trunk@6230
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
fbb3a94f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
pcm_utils.c
src/pcm_utils.c
+9
-8
No files found.
src/pcm_utils.c
View file @
495e1b6c
...
...
@@ -275,7 +275,7 @@ static int pcm_convertSampleRate(mpd_sint8 channels, mpd_uint32 inSampleRate,
}
#endif
/* !HAVE_LIBSAMPLERATE */
static
char
*
pcm_convertChannels
(
mpd_sint8
inC
hannels
,
char
*
inBuffer
,
static
char
*
pcm_convertChannels
(
mpd_sint8
c
hannels
,
char
*
inBuffer
,
size_t
inSize
,
size_t
*
outSize
)
{
static
char
*
buf
;
...
...
@@ -285,7 +285,7 @@ static char *pcm_convertChannels(mpd_sint8 inChannels, char *inBuffer,
mpd_sint16
*
out
;
int
inSamples
,
i
;
switch
(
inC
hannels
)
{
switch
(
c
hannels
)
{
/* convert from 1 -> 2 channels */
case
1
:
*
outSize
=
(
inSize
>>
1
)
<<
2
;
...
...
@@ -329,7 +329,7 @@ static char *pcm_convertChannels(mpd_sint8 inChannels, char *inBuffer,
return
outBuffer
;
}
static
char
*
pcm_convertTo16bit
(
mpd_sint8
inB
its
,
char
*
inBuffer
,
size_t
inSize
,
static
char
*
pcm_convertTo16bit
(
mpd_sint8
b
its
,
char
*
inBuffer
,
size_t
inSize
,
size_t
*
outSize
)
{
static
char
*
buf
;
...
...
@@ -339,7 +339,7 @@ static char *pcm_convertTo16bit(mpd_sint8 inBits, char *inBuffer, size_t inSize,
mpd_sint16
*
out
;
int
i
;
switch
(
inB
its
)
{
switch
(
b
its
)
{
case
8
:
*
outSize
=
inSize
<<
1
;
if
(
*
outSize
>
len
)
{
...
...
@@ -405,12 +405,14 @@ void pcm_convertAudioFormat(AudioFormat * inFormat, char *inBuffer,
size_t
pcm_sizeOfConvBuffer
(
AudioFormat
*
inFormat
,
size_t
inSize
,
AudioFormat
*
outFormat
)
{
const
int
shift
=
sizeof
(
mpd_sint16
)
*
outFormat
->
channels
;
const
double
ratio
=
(
double
)
outFormat
->
sampleRate
/
(
double
)
inFormat
->
sampleRate
;
const
int
shift
=
2
*
outFormat
->
channels
;
size_t
outSize
=
inSize
;
switch
(
inFormat
->
bits
)
{
case
8
:
outSize
=
outSize
<<
1
;
outSize
<<=
1
;
break
;
case
16
:
break
;
...
...
@@ -431,8 +433,7 @@ size_t pcm_sizeOfConvBuffer(AudioFormat * inFormat, size_t inSize,
}
outSize
/=
shift
;
outSize
=
floor
(
0
.
5
+
(
double
)
outSize
*
((
double
)
outFormat
->
sampleRate
/
(
double
)
inFormat
->
sampleRate
));
outSize
=
floor
(
0
.
5
+
(
double
)
outSize
*
ratio
);
outSize
*=
shift
;
return
outSize
;
...
...
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