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
947848eb
Commit
947848eb
authored
Sep 17, 2011
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/roar: export volume methods
Use these instead of exposing the internal roar_t struct.
parent
5e22fe48
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
78 additions
and
46 deletions
+78
-46
roar_mixer_plugin.c
src/mixer/roar_mixer_plugin.c
+3
-32
roar_output_plugin.c
src/output/roar_output_plugin.c
+49
-0
roar_output_plugin.h
src/output/roar_output_plugin.h
+8
-14
read_mixer.c
test/read_mixer.c
+18
-0
No files found.
src/mixer/roar_mixer_plugin.c
View file @
947848eb
...
...
@@ -34,7 +34,7 @@ typedef struct roar_mpd_mixer
{
/** the base mixer class */
struct
mixer
base
;
roar_t
*
self
;
struct
roar
*
self
;
}
roar_mixer_t
;
/**
...
...
@@ -82,20 +82,7 @@ static int
roar_mixer_get_volume
(
struct
mixer
*
mixer
,
G_GNUC_UNUSED
GError
**
error_r
)
{
roar_mixer_t
*
self
=
(
roar_mixer_t
*
)
mixer
;
g_mutex_lock
(
self
->
self
->
lock
);
if
(
self
->
self
->
vss
&&
self
->
self
->
alive
)
{
float
l
,
r
;
int
error
;
roar_vs_volume_get
(
self
->
self
->
vss
,
&
l
,
&
r
,
&
error
);
g_mutex_unlock
(
self
->
self
->
lock
);
return
(
l
+
r
)
*
50
;
}
else
{
g_mutex_unlock
(
self
->
self
->
lock
);
return
0
;
}
return
roar_output_get_volume
(
self
->
self
);
}
static
bool
...
...
@@ -103,23 +90,7 @@ roar_mixer_set_volume(struct mixer *mixer, unsigned volume,
G_GNUC_UNUSED
GError
**
error_r
)
{
roar_mixer_t
*
self
=
(
roar_mixer_t
*
)
mixer
;
g_mutex_lock
(
self
->
self
->
lock
);
if
(
self
->
self
->
vss
&&
self
->
self
->
alive
)
{
assert
(
volume
<=
100
);
int
error
;
float
level
=
volume
/
100
.
0
;
roar_vs_volume_mono
(
self
->
self
->
vss
,
level
,
&
error
);
g_mutex_unlock
(
self
->
self
->
lock
);
return
true
;
}
else
{
g_mutex_unlock
(
self
->
self
->
lock
);
return
false
;
}
return
roar_output_set_volume
(
self
->
self
,
volume
);
}
const
struct
mixer_plugin
roar_mixer_plugin
=
{
...
...
src/output/roar_output_plugin.c
View file @
947848eb
...
...
@@ -30,16 +30,65 @@
#include <string.h>
#include <stdint.h>
#include <roaraudio.h>
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "roaraudio"
typedef
struct
roar
{
roar_vs_t
*
vss
;
int
err
;
char
*
host
;
char
*
name
;
int
role
;
struct
roar_connection
con
;
struct
roar_audio_info
info
;
GMutex
*
lock
;
volatile
bool
alive
;
}
roar_t
;
static
inline
GQuark
roar_output_quark
(
void
)
{
return
g_quark_from_static_string
(
"roar_output"
);
}
int
roar_output_get_volume
(
struct
roar
*
roar
)
{
g_mutex_lock
(
roar
->
lock
);
if
(
roar
->
vss
&&
roar
->
alive
)
{
float
l
,
r
;
int
error
;
roar_vs_volume_get
(
roar
->
vss
,
&
l
,
&
r
,
&
error
);
g_mutex_unlock
(
roar
->
lock
);
return
(
l
+
r
)
*
50
;
}
else
{
g_mutex_unlock
(
roar
->
lock
);
return
0
;
}
}
bool
roar_output_set_volume
(
struct
roar
*
roar
,
unsigned
volume
)
{
g_mutex_lock
(
roar
->
lock
);
if
(
roar
->
vss
&&
roar
->
alive
)
{
assert
(
volume
<=
100
);
int
error
;
float
level
=
volume
/
100
.
0
;
roar_vs_volume_mono
(
roar
->
vss
,
level
,
&
error
);
g_mutex_unlock
(
roar
->
lock
);
return
true
;
}
else
{
g_mutex_unlock
(
roar
->
lock
);
return
false
;
}
}
static
void
roar_configure
(
struct
roar
*
self
,
const
struct
config_param
*
param
)
{
...
...
src/output/roar_output_plugin.h
View file @
947848eb
...
...
@@ -22,20 +22,14 @@
#ifndef __ROAR_OUTPUT_H
#define __ROAR_OUTPUT_H
#include <roaraudio.h>
#include <glib.h>
#include <stdbool.h>
typedef
struct
roar
{
roar_vs_t
*
vss
;
int
err
;
char
*
host
;
char
*
name
;
int
role
;
struct
roar_connection
con
;
struct
roar_audio_info
info
;
GMutex
*
lock
;
volatile
bool
alive
;
}
roar_t
;
struct
roar
;
int
roar_output_get_volume
(
struct
roar
*
roar
);
bool
roar_output_set_volume
(
struct
roar
*
roar
,
unsigned
volume
);
#endif
test/read_mixer.c
View file @
947848eb
...
...
@@ -55,6 +55,24 @@ pulse_output_set_volume(G_GNUC_UNUSED struct pulse_output *po,
#endif
#ifdef HAVE_ROAR
#include "output/roar_output_plugin.h"
int
roar_output_get_volume
(
G_GNUC_UNUSED
struct
roar
*
roar
)
{
return
-
1
;
}
bool
roar_output_set_volume
(
G_GNUC_UNUSED
struct
roar
*
roar
,
G_GNUC_UNUSED
unsigned
volume
)
{
return
true
;
}
#endif
#ifdef ENABLE_RAOP_OUTPUT
#include "output/raop_output_plugin.h"
...
...
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