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
0a0659d7
Commit
0a0659d7
authored
Feb 06, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mixer/Plugin: pass AudioOutput reference to init()
Passing a void pointer is unsafe.
parent
b6df4680
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
81 additions
and
143 deletions
+81
-143
MixerControl.cxx
src/mixer/MixerControl.cxx
+1
-1
MixerControl.hxx
src/mixer/MixerControl.hxx
+2
-1
MixerPlugin.hxx
src/mixer/MixerPlugin.hxx
+3
-2
AlsaMixerPlugin.cxx
src/mixer/plugins/AlsaMixerPlugin.cxx
+1
-1
OssMixerPlugin.cxx
src/mixer/plugins/OssMixerPlugin.cxx
+1
-1
PulseMixerPlugin.cxx
src/mixer/plugins/PulseMixerPlugin.cxx
+12
-19
PulseMixerPlugin.hxx
src/mixer/plugins/PulseMixerPlugin.hxx
+3
-3
RoarMixerPlugin.cxx
src/mixer/plugins/RoarMixerPlugin.cxx
+4
-4
SoftwareMixerPlugin.cxx
src/mixer/plugins/SoftwareMixerPlugin.cxx
+2
-1
WinmmMixerPlugin.cxx
src/mixer/plugins/WinmmMixerPlugin.cxx
+4
-6
Init.cxx
src/output/Init.cxx
+2
-2
PulseOutputPlugin.cxx
src/output/plugins/PulseOutputPlugin.cxx
+30
-34
PulseOutputPlugin.hxx
src/output/plugins/PulseOutputPlugin.hxx
+5
-5
RoarOutputPlugin.cxx
src/output/plugins/RoarOutputPlugin.cxx
+4
-4
RoarOutputPlugin.hxx
src/output/plugins/RoarOutputPlugin.hxx
+2
-2
WinmmOutputPlugin.cxx
src/output/plugins/WinmmOutputPlugin.cxx
+2
-2
WinmmOutputPlugin.hxx
src/output/plugins/WinmmOutputPlugin.hxx
+1
-1
read_mixer.cxx
test/read_mixer.cxx
+2
-54
No files found.
src/mixer/MixerControl.cxx
View file @
0a0659d7
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
Mixer
*
Mixer
*
mixer_new
(
EventLoop
&
event_loop
,
mixer_new
(
EventLoop
&
event_loop
,
const
MixerPlugin
&
plugin
,
void
*
ao
,
const
MixerPlugin
&
plugin
,
AudioOutput
&
ao
,
const
config_param
&
param
,
const
config_param
&
param
,
Error
&
error
)
Error
&
error
)
{
{
...
...
src/mixer/MixerControl.hxx
View file @
0a0659d7
...
@@ -28,11 +28,12 @@
...
@@ -28,11 +28,12 @@
class
Error
;
class
Error
;
class
Mixer
;
class
Mixer
;
class
EventLoop
;
class
EventLoop
;
struct
AudioOutput
;
struct
MixerPlugin
;
struct
MixerPlugin
;
struct
config_param
;
struct
config_param
;
Mixer
*
Mixer
*
mixer_new
(
EventLoop
&
event_loop
,
const
MixerPlugin
&
plugin
,
void
*
ao
,
mixer_new
(
EventLoop
&
event_loop
,
const
MixerPlugin
&
plugin
,
AudioOutput
&
ao
,
const
config_param
&
param
,
const
config_param
&
param
,
Error
&
error
);
Error
&
error
);
...
...
src/mixer/MixerPlugin.hxx
View file @
0a0659d7
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
#define MPD_MIXER_PLUGIN_HXX
#define MPD_MIXER_PLUGIN_HXX
struct
config_param
;
struct
config_param
;
struct
AudioOutput
;
class
Mixer
;
class
Mixer
;
class
EventLoop
;
class
EventLoop
;
class
Error
;
class
Error
;
...
@@ -36,13 +37,13 @@ struct MixerPlugin {
...
@@ -36,13 +37,13 @@ struct MixerPlugin {
/**
/**
* Alocates and configures a mixer device.
* Alocates and configures a mixer device.
*
*
* @param ao the
pointer returned by AudioOutputPlugin.ini
t
* @param ao the
associated AudioOutpu
t
* @param param the configuration section
* @param param the configuration section
* @param error_r location to store the error occurring, or
* @param error_r location to store the error occurring, or
* nullptr to ignore errors
* nullptr to ignore errors
* @return a mixer object, or nullptr on error
* @return a mixer object, or nullptr on error
*/
*/
Mixer
*
(
*
init
)(
EventLoop
&
event_loop
,
void
*
ao
,
Mixer
*
(
*
init
)(
EventLoop
&
event_loop
,
AudioOutput
&
ao
,
const
config_param
&
param
,
const
config_param
&
param
,
Error
&
error
);
Error
&
error
);
...
...
src/mixer/plugins/AlsaMixerPlugin.cxx
View file @
0a0659d7
...
@@ -167,7 +167,7 @@ AlsaMixer::Configure(const config_param ¶m)
...
@@ -167,7 +167,7 @@ AlsaMixer::Configure(const config_param ¶m)
}
}
static
Mixer
*
static
Mixer
*
alsa_mixer_init
(
EventLoop
&
event_loop
,
gcc_unused
void
*
ao
,
alsa_mixer_init
(
EventLoop
&
event_loop
,
gcc_unused
AudioOutput
&
ao
,
const
config_param
&
param
,
const
config_param
&
param
,
gcc_unused
Error
&
error
)
gcc_unused
Error
&
error
)
{
{
...
...
src/mixer/plugins/OssMixerPlugin.cxx
View file @
0a0659d7
...
@@ -97,7 +97,7 @@ OssMixer::Configure(const config_param ¶m, Error &error)
...
@@ -97,7 +97,7 @@ OssMixer::Configure(const config_param ¶m, Error &error)
}
}
static
Mixer
*
static
Mixer
*
oss_mixer_init
(
gcc_unused
EventLoop
&
event_loop
,
gcc_unused
void
*
ao
,
oss_mixer_init
(
gcc_unused
EventLoop
&
event_loop
,
gcc_unused
AudioOutput
&
ao
,
const
config_param
&
param
,
const
config_param
&
param
,
Error
&
error
)
Error
&
error
)
{
{
...
...
src/mixer/plugins/PulseMixerPlugin.cxx
View file @
0a0659d7
...
@@ -35,13 +35,13 @@
...
@@ -35,13 +35,13 @@
#include <assert.h>
#include <assert.h>
class
PulseMixer
final
:
public
Mixer
{
class
PulseMixer
final
:
public
Mixer
{
PulseOutput
*
output
;
PulseOutput
&
output
;
bool
online
;
bool
online
;
struct
pa_cvolume
volume
;
struct
pa_cvolume
volume
;
public
:
public
:
PulseMixer
(
PulseOutput
*
_output
)
PulseMixer
(
PulseOutput
&
_output
)
:
Mixer
(
pulse_mixer_plugin
),
:
Mixer
(
pulse_mixer_plugin
),
output
(
_output
),
online
(
false
)
output
(
_output
),
online
(
false
)
{
{
...
@@ -130,7 +130,7 @@ PulseMixer::Update(pa_context *context, pa_stream *stream)
...
@@ -130,7 +130,7 @@ PulseMixer::Update(pa_context *context, pa_stream *stream)
}
}
void
void
pulse_mixer_on_connect
(
gcc_unused
PulseMixer
*
pm
,
pulse_mixer_on_connect
(
gcc_unused
PulseMixer
&
pm
,
struct
pa_context
*
context
)
struct
pa_context
*
context
)
{
{
pa_operation
*
o
;
pa_operation
*
o
;
...
@@ -151,41 +151,34 @@ pulse_mixer_on_connect(gcc_unused PulseMixer *pm,
...
@@ -151,41 +151,34 @@ pulse_mixer_on_connect(gcc_unused PulseMixer *pm,
}
}
void
void
pulse_mixer_on_disconnect
(
PulseMixer
*
pm
)
pulse_mixer_on_disconnect
(
PulseMixer
&
pm
)
{
{
pm
->
Offline
();
pm
.
Offline
();
}
}
void
void
pulse_mixer_on_change
(
PulseMixer
*
pm
,
pulse_mixer_on_change
(
PulseMixer
&
pm
,
struct
pa_context
*
context
,
struct
pa_stream
*
stream
)
struct
pa_context
*
context
,
struct
pa_stream
*
stream
)
{
{
pm
->
Update
(
context
,
stream
);
pm
.
Update
(
context
,
stream
);
}
}
static
Mixer
*
static
Mixer
*
pulse_mixer_init
(
gcc_unused
EventLoop
&
event_loop
,
void
*
ao
,
pulse_mixer_init
(
gcc_unused
EventLoop
&
event_loop
,
AudioOutput
&
ao
,
gcc_unused
const
config_param
&
param
,
gcc_unused
const
config_param
&
param
,
Error
&
error
)
gcc_unused
Error
&
error
)
{
{
PulseOutput
*
po
=
(
PulseOutput
*
)
ao
;
PulseOutput
&
po
=
(
PulseOutput
&
)
ao
;
if
(
ao
==
nullptr
)
{
error
.
Set
(
pulse_mixer_domain
,
"The pulse mixer cannot work without the audio output"
);
return
nullptr
;
}
PulseMixer
*
pm
=
new
PulseMixer
(
po
);
PulseMixer
*
pm
=
new
PulseMixer
(
po
);
pulse_output_set_mixer
(
po
,
pm
);
pulse_output_set_mixer
(
po
,
*
pm
);
return
pm
;
return
pm
;
}
}
PulseMixer
::~
PulseMixer
()
PulseMixer
::~
PulseMixer
()
{
{
pulse_output_clear_mixer
(
output
,
this
);
pulse_output_clear_mixer
(
output
,
*
this
);
}
}
int
int
...
...
src/mixer/plugins/PulseMixerPlugin.hxx
View file @
0a0659d7
...
@@ -25,12 +25,12 @@ struct pa_context;
...
@@ -25,12 +25,12 @@ struct pa_context;
struct
pa_stream
;
struct
pa_stream
;
void
void
pulse_mixer_on_connect
(
PulseMixer
*
pm
,
pa_context
*
context
);
pulse_mixer_on_connect
(
PulseMixer
&
pm
,
pa_context
*
context
);
void
void
pulse_mixer_on_disconnect
(
PulseMixer
*
pm
);
pulse_mixer_on_disconnect
(
PulseMixer
&
pm
);
void
void
pulse_mixer_on_change
(
PulseMixer
*
pm
,
pa_context
*
context
,
pa_stream
*
stream
);
pulse_mixer_on_change
(
PulseMixer
&
pm
,
pa_context
*
context
,
pa_stream
*
stream
);
#endif
#endif
src/mixer/plugins/RoarMixerPlugin.cxx
View file @
0a0659d7
...
@@ -26,10 +26,10 @@
...
@@ -26,10 +26,10 @@
class
RoarMixer
final
:
public
Mixer
{
class
RoarMixer
final
:
public
Mixer
{
/** the base mixer class */
/** the base mixer class */
RoarOutput
*
self
;
RoarOutput
&
self
;
public
:
public
:
RoarMixer
(
RoarOutput
*
_output
)
RoarMixer
(
RoarOutput
&
_output
)
:
Mixer
(
roar_mixer_plugin
),
:
Mixer
(
roar_mixer_plugin
),
self
(
_output
)
{}
self
(
_output
)
{}
...
@@ -46,11 +46,11 @@ public:
...
@@ -46,11 +46,11 @@ public:
};
};
static
Mixer
*
static
Mixer
*
roar_mixer_init
(
gcc_unused
EventLoop
&
event_loop
,
void
*
ao
,
roar_mixer_init
(
gcc_unused
EventLoop
&
event_loop
,
AudioOutput
&
ao
,
gcc_unused
const
config_param
&
param
,
gcc_unused
const
config_param
&
param
,
gcc_unused
Error
&
error
)
gcc_unused
Error
&
error
)
{
{
return
new
RoarMixer
((
RoarOutput
*
)
ao
);
return
new
RoarMixer
((
RoarOutput
&
)
ao
);
}
}
int
int
...
...
src/mixer/plugins/SoftwareMixerPlugin.cxx
View file @
0a0659d7
...
@@ -84,7 +84,8 @@ public:
...
@@ -84,7 +84,8 @@ public:
};
};
static
Mixer
*
static
Mixer
*
software_mixer_init
(
gcc_unused
EventLoop
&
event_loop
,
gcc_unused
void
*
ao
,
software_mixer_init
(
gcc_unused
EventLoop
&
event_loop
,
gcc_unused
AudioOutput
&
ao
,
gcc_unused
const
config_param
&
param
,
gcc_unused
const
config_param
&
param
,
gcc_unused
Error
&
error
)
gcc_unused
Error
&
error
)
{
{
...
...
src/mixer/plugins/WinmmMixerPlugin.cxx
View file @
0a0659d7
...
@@ -31,10 +31,10 @@
...
@@ -31,10 +31,10 @@
#include <windows.h>
#include <windows.h>
class
WinmmMixer
final
:
public
Mixer
{
class
WinmmMixer
final
:
public
Mixer
{
WinmmOutput
*
output
;
WinmmOutput
&
output
;
public
:
public
:
WinmmMixer
(
WinmmOutput
*
_output
)
WinmmMixer
(
WinmmOutput
&
_output
)
:
Mixer
(
winmm_mixer_plugin
),
:
Mixer
(
winmm_mixer_plugin
),
output
(
_output
)
{
output
(
_output
)
{
}
}
...
@@ -67,13 +67,11 @@ winmm_volume_encode(int volume)
...
@@ -67,13 +67,11 @@ winmm_volume_encode(int volume)
}
}
static
Mixer
*
static
Mixer
*
winmm_mixer_init
(
gcc_unused
EventLoop
&
event_loop
,
void
*
ao
,
winmm_mixer_init
(
gcc_unused
EventLoop
&
event_loop
,
AudioOutput
&
ao
,
gcc_unused
const
config_param
&
param
,
gcc_unused
const
config_param
&
param
,
gcc_unused
Error
&
error
)
gcc_unused
Error
&
error
)
{
{
assert
(
ao
!=
nullptr
);
return
new
WinmmMixer
((
WinmmOutput
&
)
ao
);
return
new
WinmmMixer
((
WinmmOutput
*
)
ao
);
}
}
int
int
...
...
src/output/Init.cxx
View file @
0a0659d7
...
@@ -129,10 +129,10 @@ audio_output_load_mixer(EventLoop &event_loop, AudioOutput *ao,
...
@@ -129,10 +129,10 @@ audio_output_load_mixer(EventLoop &event_loop, AudioOutput *ao,
if
(
plugin
==
nullptr
)
if
(
plugin
==
nullptr
)
return
nullptr
;
return
nullptr
;
return
mixer_new
(
event_loop
,
*
plugin
,
ao
,
param
,
error
);
return
mixer_new
(
event_loop
,
*
plugin
,
*
ao
,
param
,
error
);
case
MIXER_TYPE_SOFTWARE
:
case
MIXER_TYPE_SOFTWARE
:
mixer
=
mixer_new
(
event_loop
,
software_mixer_plugin
,
nullptr
,
mixer
=
mixer_new
(
event_loop
,
software_mixer_plugin
,
*
ao
,
config_param
(),
config_param
(),
IgnoreError
());
IgnoreError
());
assert
(
mixer
!=
nullptr
);
assert
(
mixer
!=
nullptr
);
...
...
src/output/plugins/PulseOutputPlugin.cxx
View file @
0a0659d7
...
@@ -70,70 +70,66 @@ SetError(Error &error, pa_context *context, const char *msg)
...
@@ -70,70 +70,66 @@ SetError(Error &error, pa_context *context, const char *msg)
}
}
void
void
pulse_output_lock
(
PulseOutput
*
po
)
pulse_output_lock
(
PulseOutput
&
po
)
{
{
pa_threaded_mainloop_lock
(
po
->
mainloop
);
pa_threaded_mainloop_lock
(
po
.
mainloop
);
}
}
void
void
pulse_output_unlock
(
PulseOutput
*
po
)
pulse_output_unlock
(
PulseOutput
&
po
)
{
{
pa_threaded_mainloop_unlock
(
po
->
mainloop
);
pa_threaded_mainloop_unlock
(
po
.
mainloop
);
}
}
void
void
pulse_output_set_mixer
(
PulseOutput
*
po
,
PulseMixer
*
pm
)
pulse_output_set_mixer
(
PulseOutput
&
po
,
PulseMixer
&
pm
)
{
{
assert
(
po
!=
nullptr
);
assert
(
po
.
mixer
==
nullptr
);
assert
(
po
->
mixer
==
nullptr
);
assert
(
pm
!=
nullptr
);
po
->
mixer
=
pm
;
po
.
mixer
=
&
pm
;
if
(
po
->
mainloop
==
nullptr
)
if
(
po
.
mainloop
==
nullptr
)
return
;
return
;
pa_threaded_mainloop_lock
(
po
->
mainloop
);
pa_threaded_mainloop_lock
(
po
.
mainloop
);
if
(
po
->
context
!=
nullptr
&&
if
(
po
.
context
!=
nullptr
&&
pa_context_get_state
(
po
->
context
)
==
PA_CONTEXT_READY
)
{
pa_context_get_state
(
po
.
context
)
==
PA_CONTEXT_READY
)
{
pulse_mixer_on_connect
(
pm
,
po
->
context
);
pulse_mixer_on_connect
(
pm
,
po
.
context
);
if
(
po
->
stream
!=
nullptr
&&
if
(
po
.
stream
!=
nullptr
&&
pa_stream_get_state
(
po
->
stream
)
==
PA_STREAM_READY
)
pa_stream_get_state
(
po
.
stream
)
==
PA_STREAM_READY
)
pulse_mixer_on_change
(
pm
,
po
->
context
,
po
->
stream
);
pulse_mixer_on_change
(
pm
,
po
.
context
,
po
.
stream
);
}
}
pa_threaded_mainloop_unlock
(
po
->
mainloop
);
pa_threaded_mainloop_unlock
(
po
.
mainloop
);
}
}
void
void
pulse_output_clear_mixer
(
PulseOutput
*
po
,
gcc_unused
PulseMixer
*
pm
)
pulse_output_clear_mixer
(
PulseOutput
&
po
,
gcc_unused
PulseMixer
&
pm
)
{
{
assert
(
po
!=
nullptr
);
assert
(
po
.
mixer
==
&
pm
);
assert
(
pm
!=
nullptr
);
assert
(
po
->
mixer
==
pm
);
po
->
mixer
=
nullptr
;
po
.
mixer
=
nullptr
;
}
}
bool
bool
pulse_output_set_volume
(
PulseOutput
*
po
,
const
pa_cvolume
*
volume
,
pulse_output_set_volume
(
PulseOutput
&
po
,
const
pa_cvolume
*
volume
,
Error
&
error
)
Error
&
error
)
{
{
pa_operation
*
o
;
pa_operation
*
o
;
if
(
po
->
context
==
nullptr
||
po
->
stream
==
nullptr
||
if
(
po
.
context
==
nullptr
||
po
.
stream
==
nullptr
||
pa_stream_get_state
(
po
->
stream
)
!=
PA_STREAM_READY
)
{
pa_stream_get_state
(
po
.
stream
)
!=
PA_STREAM_READY
)
{
error
.
Set
(
pulse_output_domain
,
"disconnected"
);
error
.
Set
(
pulse_output_domain
,
"disconnected"
);
return
false
;
return
false
;
}
}
o
=
pa_context_set_sink_input_volume
(
po
->
context
,
o
=
pa_context_set_sink_input_volume
(
po
.
context
,
pa_stream_get_index
(
po
->
stream
),
pa_stream_get_index
(
po
.
stream
),
volume
,
nullptr
,
nullptr
);
volume
,
nullptr
,
nullptr
);
if
(
o
==
nullptr
)
{
if
(
o
==
nullptr
)
{
SetError
(
error
,
po
->
context
,
SetError
(
error
,
po
.
context
,
"failed to set PulseAudio volume"
);
"failed to set PulseAudio volume"
);
return
false
;
return
false
;
}
}
...
@@ -190,7 +186,7 @@ pulse_output_context_state_cb(struct pa_context *context, void *userdata)
...
@@ -190,7 +186,7 @@ pulse_output_context_state_cb(struct pa_context *context, void *userdata)
switch
(
pa_context_get_state
(
context
))
{
switch
(
pa_context_get_state
(
context
))
{
case
PA_CONTEXT_READY
:
case
PA_CONTEXT_READY
:
if
(
po
->
mixer
!=
nullptr
)
if
(
po
->
mixer
!=
nullptr
)
pulse_mixer_on_connect
(
po
->
mixer
,
context
);
pulse_mixer_on_connect
(
*
po
->
mixer
,
context
);
pa_threaded_mainloop_signal
(
po
->
mainloop
,
0
);
pa_threaded_mainloop_signal
(
po
->
mainloop
,
0
);
break
;
break
;
...
@@ -198,7 +194,7 @@ pulse_output_context_state_cb(struct pa_context *context, void *userdata)
...
@@ -198,7 +194,7 @@ pulse_output_context_state_cb(struct pa_context *context, void *userdata)
case
PA_CONTEXT_TERMINATED
:
case
PA_CONTEXT_TERMINATED
:
case
PA_CONTEXT_FAILED
:
case
PA_CONTEXT_FAILED
:
if
(
po
->
mixer
!=
nullptr
)
if
(
po
->
mixer
!=
nullptr
)
pulse_mixer_on_disconnect
(
po
->
mixer
);
pulse_mixer_on_disconnect
(
*
po
->
mixer
);
/* the caller thread might be waiting for these
/* the caller thread might be waiting for these
states */
states */
...
@@ -231,7 +227,7 @@ pulse_output_subscribe_cb(pa_context *context,
...
@@ -231,7 +227,7 @@ pulse_output_subscribe_cb(pa_context *context,
idx
==
pa_stream_get_index
(
po
->
stream
)
&&
idx
==
pa_stream_get_index
(
po
->
stream
)
&&
(
type
==
PA_SUBSCRIPTION_EVENT_NEW
||
(
type
==
PA_SUBSCRIPTION_EVENT_NEW
||
type
==
PA_SUBSCRIPTION_EVENT_CHANGE
))
type
==
PA_SUBSCRIPTION_EVENT_CHANGE
))
pulse_mixer_on_change
(
po
->
mixer
,
context
,
po
->
stream
);
pulse_mixer_on_change
(
*
po
->
mixer
,
context
,
po
->
stream
);
}
}
/**
/**
...
@@ -487,7 +483,7 @@ pulse_output_stream_state_cb(pa_stream *stream, void *userdata)
...
@@ -487,7 +483,7 @@ pulse_output_stream_state_cb(pa_stream *stream, void *userdata)
switch
(
pa_stream_get_state
(
stream
))
{
switch
(
pa_stream_get_state
(
stream
))
{
case
PA_STREAM_READY
:
case
PA_STREAM_READY
:
if
(
po
->
mixer
!=
nullptr
)
if
(
po
->
mixer
!=
nullptr
)
pulse_mixer_on_change
(
po
->
mixer
,
po
->
context
,
stream
);
pulse_mixer_on_change
(
*
po
->
mixer
,
po
->
context
,
stream
);
pa_threaded_mainloop_signal
(
po
->
mainloop
,
0
);
pa_threaded_mainloop_signal
(
po
->
mainloop
,
0
);
break
;
break
;
...
@@ -495,7 +491,7 @@ pulse_output_stream_state_cb(pa_stream *stream, void *userdata)
...
@@ -495,7 +491,7 @@ pulse_output_stream_state_cb(pa_stream *stream, void *userdata)
case
PA_STREAM_FAILED
:
case
PA_STREAM_FAILED
:
case
PA_STREAM_TERMINATED
:
case
PA_STREAM_TERMINATED
:
if
(
po
->
mixer
!=
nullptr
)
if
(
po
->
mixer
!=
nullptr
)
pulse_mixer_on_disconnect
(
po
->
mixer
);
pulse_mixer_on_disconnect
(
*
po
->
mixer
);
pa_threaded_mainloop_signal
(
po
->
mainloop
,
0
);
pa_threaded_mainloop_signal
(
po
->
mainloop
,
0
);
break
;
break
;
...
...
src/output/plugins/PulseOutputPlugin.hxx
View file @
0a0659d7
...
@@ -28,19 +28,19 @@ class Error;
...
@@ -28,19 +28,19 @@ class Error;
extern
const
struct
AudioOutputPlugin
pulse_output_plugin
;
extern
const
struct
AudioOutputPlugin
pulse_output_plugin
;
void
void
pulse_output_lock
(
PulseOutput
*
po
);
pulse_output_lock
(
PulseOutput
&
po
);
void
void
pulse_output_unlock
(
PulseOutput
*
po
);
pulse_output_unlock
(
PulseOutput
&
po
);
void
void
pulse_output_set_mixer
(
PulseOutput
*
po
,
PulseMixer
*
pm
);
pulse_output_set_mixer
(
PulseOutput
&
po
,
PulseMixer
&
pm
);
void
void
pulse_output_clear_mixer
(
PulseOutput
*
po
,
PulseMixer
*
pm
);
pulse_output_clear_mixer
(
PulseOutput
&
po
,
PulseMixer
&
pm
);
bool
bool
pulse_output_set_volume
(
PulseOutput
*
po
,
pulse_output_set_volume
(
PulseOutput
&
po
,
const
pa_cvolume
*
volume
,
Error
&
error
);
const
pa_cvolume
*
volume
,
Error
&
error
);
#endif
#endif
src/output/plugins/RoarOutputPlugin.cxx
View file @
0a0659d7
...
@@ -93,9 +93,9 @@ RoarOutput::GetVolume() const
...
@@ -93,9 +93,9 @@ RoarOutput::GetVolume() const
}
}
int
int
roar_output_get_volume
(
RoarOutput
*
roar
)
roar_output_get_volume
(
RoarOutput
&
roar
)
{
{
return
roar
->
GetVolume
();
return
roar
.
GetVolume
();
}
}
bool
bool
...
@@ -115,9 +115,9 @@ RoarOutput::SetVolume(unsigned volume)
...
@@ -115,9 +115,9 @@ RoarOutput::SetVolume(unsigned volume)
}
}
bool
bool
roar_output_set_volume
(
RoarOutput
*
roar
,
unsigned
volume
)
roar_output_set_volume
(
RoarOutput
&
roar
,
unsigned
volume
)
{
{
return
roar
->
SetVolume
(
volume
);
return
roar
.
SetVolume
(
volume
);
}
}
inline
void
inline
void
...
...
src/output/plugins/RoarOutputPlugin.hxx
View file @
0a0659d7
...
@@ -25,9 +25,9 @@ class RoarOutput;
...
@@ -25,9 +25,9 @@ class RoarOutput;
extern
const
struct
AudioOutputPlugin
roar_output_plugin
;
extern
const
struct
AudioOutputPlugin
roar_output_plugin
;
int
int
roar_output_get_volume
(
RoarOutput
*
roar
);
roar_output_get_volume
(
RoarOutput
&
roar
);
bool
bool
roar_output_set_volume
(
RoarOutput
*
roar
,
unsigned
volume
);
roar_output_set_volume
(
RoarOutput
&
roar
,
unsigned
volume
);
#endif
#endif
src/output/plugins/WinmmOutputPlugin.cxx
View file @
0a0659d7
...
@@ -59,9 +59,9 @@ struct WinmmOutput {
...
@@ -59,9 +59,9 @@ struct WinmmOutput {
static
constexpr
Domain
winmm_output_domain
(
"winmm_output"
);
static
constexpr
Domain
winmm_output_domain
(
"winmm_output"
);
HWAVEOUT
HWAVEOUT
winmm_output_get_handle
(
WinmmOutput
*
output
)
winmm_output_get_handle
(
WinmmOutput
&
output
)
{
{
return
output
->
handle
;
return
output
.
handle
;
}
}
static
bool
static
bool
...
...
src/output/plugins/WinmmOutputPlugin.hxx
View file @
0a0659d7
...
@@ -35,7 +35,7 @@ extern const struct AudioOutputPlugin winmm_output_plugin;
...
@@ -35,7 +35,7 @@ extern const struct AudioOutputPlugin winmm_output_plugin;
gcc_pure
gcc_pure
HWAVEOUT
HWAVEOUT
winmm_output_get_handle
(
WinmmOutput
*
);
winmm_output_get_handle
(
WinmmOutput
&
output
);
#endif
#endif
...
...
test/read_mixer.cxx
View file @
0a0659d7
...
@@ -35,59 +35,6 @@
...
@@ -35,59 +35,6 @@
#include <string.h>
#include <string.h>
#include <unistd.h>
#include <unistd.h>
#ifdef HAVE_PULSE
#include "output/plugins/PulseOutputPlugin.hxx"
void
pulse_output_lock
(
gcc_unused
PulseOutput
*
po
)
{
}
void
pulse_output_unlock
(
gcc_unused
PulseOutput
*
po
)
{
}
void
pulse_output_set_mixer
(
gcc_unused
PulseOutput
*
po
,
gcc_unused
PulseMixer
*
pm
)
{
}
void
pulse_output_clear_mixer
(
gcc_unused
PulseOutput
*
po
,
gcc_unused
PulseMixer
*
pm
)
{
}
bool
pulse_output_set_volume
(
gcc_unused
PulseOutput
*
po
,
gcc_unused
const
struct
pa_cvolume
*
volume
,
gcc_unused
Error
&
error
)
{
return
false
;
}
#endif
#ifdef HAVE_ROAR
#include "output/plugins/RoarOutputPlugin.hxx"
int
roar_output_get_volume
(
gcc_unused
RoarOutput
*
roar
)
{
return
-
1
;
}
bool
roar_output_set_volume
(
gcc_unused
RoarOutput
*
roar
,
gcc_unused
unsigned
volume
)
{
return
true
;
}
#endif
void
void
GlobalEvents
::
Emit
(
gcc_unused
Event
event
)
GlobalEvents
::
Emit
(
gcc_unused
Event
event
)
{
{
...
@@ -116,7 +63,8 @@ int main(int argc, gcc_unused char **argv)
...
@@ -116,7 +63,8 @@ int main(int argc, gcc_unused char **argv)
EventLoop
event_loop
;
EventLoop
event_loop
;
Error
error
;
Error
error
;
Mixer
*
mixer
=
mixer_new
(
event_loop
,
alsa_mixer_plugin
,
nullptr
,
Mixer
*
mixer
=
mixer_new
(
event_loop
,
alsa_mixer_plugin
,
*
(
AudioOutput
*
)
nullptr
,
config_param
(),
error
);
config_param
(),
error
);
if
(
mixer
==
NULL
)
{
if
(
mixer
==
NULL
)
{
LogError
(
error
,
"mixer_new() failed"
);
LogError
(
error
,
"mixer_new() failed"
);
...
...
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