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
347a33b0
Commit
347a33b0
authored
Oct 03, 2006
by
Warren Dukes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup flushWarningBuffer() and make some for() loops in audio.c look and do something sane.
git-svn-id:
https://svn.musicpd.org/mpd/trunk@4867
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
648f48ce
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
18 deletions
+24
-18
audio.c
src/audio.c
+8
-8
log.c
src/log.c
+16
-10
No files found.
src/audio.c
View file @
347a33b0
...
@@ -274,7 +274,7 @@ static void syncAudioDeviceStates(void)
...
@@ -274,7 +274,7 @@ static void syncAudioDeviceStates(void)
if
(
!
audio_format
.
channels
)
if
(
!
audio_format
.
channels
)
return
;
return
;
for
(
i
=
audioOutputArraySize
;
--
i
>=
0
;
)
{
for
(
i
=
0
;
i
<
audioOutputArraySize
;
++
i
)
{
switch
(
audioDeviceStates
[
i
])
{
switch
(
audioDeviceStates
[
i
])
{
case
DEVICE_ON
:
case
DEVICE_ON
:
/* This will reopen only if the audio format changed */
/* This will reopen only if the audio format changed */
...
@@ -303,7 +303,7 @@ static int flushAudioBuffer(void)
...
@@ -303,7 +303,7 @@ static int flushAudioBuffer(void)
syncAudioDeviceStates
();
syncAudioDeviceStates
();
for
(
i
=
audioOutputArraySize
;
--
i
>=
0
;
)
{
for
(
i
=
0
;
i
<
audioOutputArraySize
;
++
i
)
{
if
(
audioDeviceStates
[
i
]
!=
DEVICE_ON
)
if
(
audioDeviceStates
[
i
]
!=
DEVICE_ON
)
continue
;
continue
;
err
=
playAudioOutput
(
&
audioOutputArray
[
i
],
audioBuffer
,
err
=
playAudioOutput
(
&
audioOutputArray
[
i
],
audioBuffer
,
...
@@ -340,7 +340,7 @@ int openAudioDevice(AudioFormat * audioFormat)
...
@@ -340,7 +340,7 @@ int openAudioDevice(AudioFormat * audioFormat)
syncAudioDeviceStates
();
syncAudioDeviceStates
();
for
(
i
=
audioOutputArraySize
;
--
i
>=
0
;
)
{
for
(
i
=
0
;
i
<
audioOutputArraySize
;
++
i
)
{
if
(
audioOutputArray
[
i
].
open
)
if
(
audioOutputArray
[
i
].
open
)
ret
=
0
;
ret
=
0
;
}
}
...
@@ -349,7 +349,7 @@ int openAudioDevice(AudioFormat * audioFormat)
...
@@ -349,7 +349,7 @@ int openAudioDevice(AudioFormat * audioFormat)
audioOpened
=
1
;
audioOpened
=
1
;
else
{
else
{
/* close all devices if there was an error */
/* close all devices if there was an error */
for
(
i
=
audioOutputArraySize
;
--
i
>=
0
;
)
{
for
(
i
=
0
;
i
<
audioOutputArraySize
;
++
i
)
{
closeAudioOutput
(
&
audioOutputArray
[
i
]);
closeAudioOutput
(
&
audioOutputArray
[
i
]);
}
}
...
@@ -393,7 +393,7 @@ void dropBufferedAudio(void)
...
@@ -393,7 +393,7 @@ void dropBufferedAudio(void)
syncAudioDeviceStates
();
syncAudioDeviceStates
();
audioBufferPos
=
0
;
audioBufferPos
=
0
;
for
(
i
=
audioOutputArraySize
;
--
i
>=
0
;
)
{
for
(
i
=
0
;
i
<
audioOutputArraySize
;
++
i
)
{
if
(
audioDeviceStates
[
i
]
==
DEVICE_ON
)
if
(
audioDeviceStates
[
i
]
==
DEVICE_ON
)
dropBufferedAudioOutput
(
&
audioOutputArray
[
i
]);
dropBufferedAudioOutput
(
&
audioOutputArray
[
i
]);
}
}
...
@@ -409,7 +409,7 @@ void closeAudioDevice(void)
...
@@ -409,7 +409,7 @@ void closeAudioDevice(void)
audioBuffer
=
NULL
;
audioBuffer
=
NULL
;
audioBufferSize
=
0
;
audioBufferSize
=
0
;
for
(
i
=
audioOutputArraySize
;
--
i
>=
0
;
)
{
for
(
i
=
0
;
i
<
audioOutputArraySize
;
++
i
)
{
if
(
audioDeviceStates
[
i
]
==
DEVICE_ON
)
if
(
audioDeviceStates
[
i
]
==
DEVICE_ON
)
audioDeviceStates
[
i
]
=
DEVICE_ENABLE
;
audioDeviceStates
[
i
]
=
DEVICE_ENABLE
;
closeAudioOutput
(
&
audioOutputArray
[
i
]);
closeAudioOutput
(
&
audioOutputArray
[
i
]);
...
@@ -422,7 +422,7 @@ void sendMetadataToAudioDevice(MpdTag * tag)
...
@@ -422,7 +422,7 @@ void sendMetadataToAudioDevice(MpdTag * tag)
{
{
int
i
;
int
i
;
for
(
i
=
audioOutputArraySize
;
--
i
>=
0
;
)
{
for
(
i
=
0
;
i
<
audioOutputArraySize
;
++
i
)
{
sendMetadataToAudioOutput
(
&
audioOutputArray
[
i
],
tag
);
sendMetadataToAudioOutput
(
&
audioOutputArray
[
i
],
tag
);
}
}
}
}
...
@@ -500,7 +500,7 @@ void readAudioDevicesState(FILE *fp)
...
@@ -500,7 +500,7 @@ void readAudioDevicesState(FILE *fp)
if
(
!
name
||
!
(
++
name
))
if
(
!
name
||
!
(
++
name
))
goto
errline
;
goto
errline
;
for
(
i
=
audioOutputArraySize
;
--
i
>=
0
;
)
{
for
(
i
=
0
;
i
<
audioOutputArraySize
;
++
i
)
{
if
(
!
strcmp
(
name
,
audioOutputArray
[
i
].
name
))
{
if
(
!
strcmp
(
name
,
audioOutputArray
[
i
].
name
))
{
/* devices default to on */
/* devices default to on */
if
(
!
atoi
(
c
))
if
(
!
atoi
(
c
))
...
...
src/log.c
View file @
347a33b0
...
@@ -93,22 +93,28 @@ static void do_log(FILE *fp, const char *fmt, va_list args)
...
@@ -93,22 +93,28 @@ static void do_log(FILE *fp, const char *fmt, va_list args)
void
flushWarningLog
(
void
)
void
flushWarningLog
(
void
)
{
{
char
*
s
;
char
*
s
=
warningBuffer
;
DEBUG
(
"flushing warning messages
\n
"
);
DEBUG
(
"flushing warning messages
\n
"
);
if
(
warningBuffer
==
NULL
)
if
(
warningBuffer
!=
NULL
)
return
;
{
while
(
s
!=
NULL
)
{
s
=
strtok
(
warningBuffer
,
"
\n
"
);
char
*
next
=
strchr
(
s
,
'\n'
);
while
(
s
!=
NULL
)
{
if
(
next
!=
NULL
)
{
fprintf
(
stderr
,
"%s
\n
"
,
s
);
*
next
=
'\0'
;
s
=
strtok
(
NULL
,
"
\n
"
);
next
++
;
}
fprintf
(
stderr
,
"%s
\n
"
,
s
);
s
=
next
;
}
warningBuffer
=
NULL
;
}
}
free
(
warningBuffer
);
warningBuffer
=
NULL
;
warningFlushed
=
1
;
warningFlushed
=
1
;
DEBUG
(
"done flushing warning messages
\n
"
);
}
}
void
initLog
(
const
int
verbose
)
void
initLog
(
const
int
verbose
)
...
...
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