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
f032925c
Commit
f032925c
authored
Jul 02, 2020
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/osx: add `started` flag
This will keep track of AudioOutputUnitStart() and AudioOutputUnitStop(). This will provide some separation between "not (yet) (re)started" and "paused".
parent
8125a5dd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
4 deletions
+18
-4
OSXOutputPlugin.cxx
src/output/plugins/OSXOutputPlugin.cxx
+18
-4
No files found.
src/output/plugins/OSXOutputPlugin.cxx
View file @
f032925c
...
...
@@ -73,7 +73,14 @@ struct OSXOutput final : AudioOutput {
const
char
*
device_name
;
const
char
*
const
channel_map
;
const
bool
hog_device
;
bool
pause
;
/**
* Is the audio unit "started", i.e. was AudioOutputUnitStart() called?
*/
bool
started
;
#ifdef ENABLE_DSD
/**
* Enable DSD over PCM according to the DoP standard?
...
...
@@ -755,18 +762,22 @@ OSXOutput::Open(AudioFormat &audio_format)
Apple
::
ThrowOSStatus
(
status
,
"Unable to start audio output"
);
pause
=
false
;
started
=
true
;
}
size_t
OSXOutput
::
Play
(
const
void
*
chunk
,
size_t
size
)
{
assert
(
size
>
0
);
if
(
pause
)
{
pause
=
false
;
if
(
!
started
)
{
OSStatus
status
=
AudioOutputUnitStart
(
au
);
if
(
status
!=
noErr
)
throw
std
::
runtime_error
(
"Unable to restart audio output after pause"
);
pause
=
fals
e
;
started
=
tru
e
;
}
#ifdef ENABLE_DSD
if
(
dop_enabled
)
{
...
...
@@ -797,10 +808,13 @@ OSXOutput::Delay() const noexcept
bool
OSXOutput
::
Pause
()
{
if
(
!
pause
)
{
pause
=
true
;
pause
=
true
;
if
(
started
)
{
AudioOutputUnitStop
(
au
);
started
=
false
;
}
return
true
;
}
...
...
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