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
e6d7663b
Commit
e6d7663b
authored
May 22, 2007
by
J. Alexander Treuman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleaning up/correcting some comments.
git-svn-id:
https://svn.musicpd.org/mpd/trunk@6200
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
f2850a66
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
10 deletions
+7
-10
pcm_utils.c
src/pcm_utils.c
+7
-10
No files found.
src/pcm_utils.c
View file @
e6d7663b
...
...
@@ -185,7 +185,7 @@ static int pcm_getSamplerateConverter(void)
}
#endif
/* outFormat bits must be 16 and channels must be 2! */
/* outFormat bits must be 16 and channels must be
1 or
2! */
void
pcm_convertAudioFormat
(
AudioFormat
*
inFormat
,
char
*
inBuffer
,
size_t
inSize
,
AudioFormat
*
outFormat
,
char
*
outBuffer
)
...
...
@@ -202,7 +202,7 @@ void pcm_convertAudioFormat(AudioFormat * inFormat, char *inBuffer,
assert
(
outFormat
->
bits
==
16
);
assert
(
outFormat
->
channels
==
2
||
outFormat
->
channels
==
1
);
/* convert
s
*/
/* convert
to 16 bit audio
*/
switch
(
inFormat
->
bits
)
{
case
8
:
dataBitLen
=
inSize
<<
1
;
...
...
@@ -231,14 +231,13 @@ void pcm_convertAudioFormat(AudioFormat * inFormat, char *inBuffer,
exit
(
EXIT_FAILURE
);
}
/* convert
s only between 16 bit
audio between mono and stereo */
/* convert audio between mono and stereo */
if
(
inFormat
->
channels
==
outFormat
->
channels
)
{
dataChannelConv
=
dataBitConv
;
dataChannelLen
=
dataBitLen
;
}
else
{
switch
(
inFormat
->
channels
)
{
/* convert from 1 -> 2 channels */
case
1
:
case
1
:
/* convert from 1 -> 2 channels */
dataChannelLen
=
(
dataBitLen
>>
1
)
<<
2
;
if
(
dataChannelLen
>
channelConvBufferLength
)
{
channelConvBuffer
=
xrealloc
(
channelConvBuffer
,
...
...
@@ -257,8 +256,7 @@ void pcm_convertAudioFormat(AudioFormat * inFormat, char *inBuffer,
}
}
break
;
/* convert from 2 -> 1 channels */
case
2
:
case
2
:
/* convert from 2 -> 1 channels */
dataChannelLen
=
dataBitLen
>>
1
;
if
(
dataChannelLen
>
channelConvBufferLength
)
{
channelConvBuffer
=
xrealloc
(
channelConvBuffer
,
...
...
@@ -278,8 +276,8 @@ void pcm_convertAudioFormat(AudioFormat * inFormat, char *inBuffer,
}
break
;
default:
ERROR
(
"only 1 or 2 channels are supported for
conversion!
\n
"
);
ERROR
(
"only 1 or 2 channels are supported for "
"
conversion!
\n
"
);
exit
(
EXIT_FAILURE
);
}
}
...
...
@@ -337,7 +335,6 @@ void pcm_convertAudioFormat(AudioFormat * inFormat, char *inBuffer,
src_float_to_short_array
(
data
.
data_out
,
(
short
*
)
outBuffer
,
data
.
output_frames
*
outFormat
->
channels
);
#else
/* only works if outFormat is 16-bit stereo! */
/* resampling code blatantly ripped from ESD */
mpd_uint32
rd_dat
=
0
;
mpd_uint32
wr_dat
=
0
;
...
...
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