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
7d0c32b4
Commit
7d0c32b4
authored
Sep 08, 2008
by
Eric Wong
Committed by
Max Kellermann
Sep 08, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
alsa: move bitformat reading code out of the way
parent
67c642c9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
16 deletions
+12
-16
audioOutput_alsa.c
src/audioOutputs/audioOutput_alsa.c
+12
-16
No files found.
src/audioOutputs/audioOutput_alsa.c
View file @
7d0c32b4
...
...
@@ -119,6 +119,17 @@ static int alsa_testDefault(void)
return
0
;
}
static
snd_pcm_format_t
get_bitformat
(
const
struct
audio_format
*
af
)
{
switch
(
af
->
bits
)
{
case
8
:
return
SND_PCM_FORMAT_S8
;
case
16
:
return
SND_PCM_FORMAT_S16
;
case
24
:
return
SND_PCM_FORMAT_S24
;
case
32
:
return
SND_PCM_FORMAT_S32
;
}
return
SND_PCM_FORMAT_UNKNOWN
;
}
static
int
alsa_openDevice
(
struct
audio_output
*
audioOutput
)
{
AlsaData
*
ad
=
audioOutput
->
data
;
...
...
@@ -136,24 +147,9 @@ static int alsa_openDevice(struct audio_output *audioOutput)
unsigned
int
period_time
,
period_time_ro
;
unsigned
int
buffer_time
;
switch
(
audioFormat
->
bits
)
{
case
8
:
bitformat
=
SND_PCM_FORMAT_S8
;
break
;
case
16
:
bitformat
=
SND_PCM_FORMAT_S16
;
break
;
case
24
:
bitformat
=
SND_PCM_FORMAT_S24
;
break
;
case
32
:
bitformat
=
SND_PCM_FORMAT_S32
;
break
;
default:
if
((
bitformat
=
get_bitformat
(
audioFormat
))
==
SND_PCM_FORMAT_UNKNOWN
)
ERROR
(
"ALSA device
\"
%s
\"
doesn't support %i bit audio
\n
"
,
ad
->
device
,
audioFormat
->
bits
);
return
-
1
;
}
err
=
snd_pcm_open
(
&
ad
->
pcmHandle
,
ad
->
device
,
SND_PCM_STREAM_PLAYBACK
,
SND_PCM_NONBLOCK
);
...
...
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