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
fd2ae556
Commit
fd2ae556
authored
Oct 20, 2004
by
Warren Dukes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some small cleanups
git-svn-id:
https://svn.musicpd.org/mpd/trunk@2280
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
f4d75d75
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
15 deletions
+8
-15
audio.c
src/audio.c
+4
-14
audioOutput.c
src/audioOutput.c
+4
-1
No files found.
src/audio.c
View file @
fd2ae556
...
@@ -136,18 +136,15 @@ void finishAudioDriver() {
...
@@ -136,18 +136,15 @@ void finishAudioDriver() {
}
}
int
isCurrentAudioFormat
(
AudioFormat
*
audioFormat
)
{
int
isCurrentAudioFormat
(
AudioFormat
*
audioFormat
)
{
if
(
!
a
oOutput
||
!
a
udioFormat
)
return
0
;
if
(
!
audioFormat
)
return
0
;
if
(
memcmp
(
audioFormat
,
&
audio_format
,
sizeof
(
AudioFormat
))
!=
0
)
return
0
;
if
(
memcmp
(
audioFormat
,
&
audio_format
,
sizeof
(
AudioFormat
))
!=
0
)
return
0
;
return
1
;
return
1
;
}
}
int
openAudioDevice
(
AudioFormat
*
audioFormat
)
{
int
openAudioDevice
(
AudioFormat
*
audioFormat
)
{
if
(
aoOutput
->
open
&&
!
isCurrentAudioFormat
(
audioFormat
))
{
if
(
!
aoOutput
->
open
||
!
isCurrentAudioFormat
(
audioFormat
))
{
closeAudioOutput
(
aoOutput
);
}
if
(
!
aoOutput
->
open
)
{
return
openAudioOutput
(
aoOutput
,
audioFormat
);
return
openAudioOutput
(
aoOutput
,
audioFormat
);
}
}
...
@@ -155,11 +152,6 @@ int openAudioDevice(AudioFormat * audioFormat) {
...
@@ -155,11 +152,6 @@ int openAudioDevice(AudioFormat * audioFormat) {
}
}
int
playAudio
(
char
*
playChunk
,
int
size
)
{
int
playAudio
(
char
*
playChunk
,
int
size
)
{
if
(
!
aoOutput
->
open
)
{
ERROR
(
"trying to play w/o the audio device being open!
\n
"
);
return
-
1
;
}
return
playAudioOutput
(
aoOutput
,
playChunk
,
size
);
return
playAudioOutput
(
aoOutput
,
playChunk
,
size
);
}
}
...
@@ -168,7 +160,5 @@ int isAudioDeviceOpen() {
...
@@ -168,7 +160,5 @@ int isAudioDeviceOpen() {
}
}
void
closeAudioDevice
()
{
void
closeAudioDevice
()
{
if
(
aoOutput
->
open
)
{
closeAudioOutput
(
aoOutput
);
closeAudioOutput
(
aoOutput
);
}
}
}
src/audioOutput.c
View file @
fd2ae556
...
@@ -41,18 +41,21 @@ AudioOutput * newAudioOutput(char * name) {
...
@@ -41,18 +41,21 @@ AudioOutput * newAudioOutput(char * name) {
}
}
int
openAudioOutput
(
AudioOutput
*
audioOutput
,
AudioFormat
*
audioFormat
)
{
int
openAudioOutput
(
AudioOutput
*
audioOutput
,
AudioFormat
*
audioFormat
)
{
if
(
audioOutput
->
open
)
closeAudioOutput
(
audioOutput
);
return
audioOutput
->
openDeviceFunc
(
audioOutput
,
audioFormat
);
return
audioOutput
->
openDeviceFunc
(
audioOutput
,
audioFormat
);
}
}
int
playAudioOutput
(
AudioOutput
*
audioOutput
,
char
*
playChunk
,
int
size
)
{
int
playAudioOutput
(
AudioOutput
*
audioOutput
,
char
*
playChunk
,
int
size
)
{
if
(
!
audioOutput
->
open
)
return
-
1
;
return
audioOutput
->
playFunc
(
audioOutput
,
playChunk
,
size
);
return
audioOutput
->
playFunc
(
audioOutput
,
playChunk
,
size
);
}
}
void
closeAudioOutput
(
AudioOutput
*
audioOutput
)
{
void
closeAudioOutput
(
AudioOutput
*
audioOutput
)
{
audioOutput
->
closeDeviceFunc
(
audioOutput
);
if
(
audioOutput
->
open
)
audioOutput
->
closeDeviceFunc
(
audioOutput
);
}
}
void
finishAudioOutput
(
AudioOutput
*
audioOutput
)
{
void
finishAudioOutput
(
AudioOutput
*
audioOutput
)
{
closeAudioOutput
(
audioOutput
);
audioOutput
->
finishDriverFunc
(
audioOutput
);
audioOutput
->
finishDriverFunc
(
audioOutput
);
free
(
audioOutput
);
free
(
audioOutput
);
}
}
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