aboutsummaryrefslogtreecommitdiff
path: root/audio/audio_template.h
diff options
context:
space:
mode:
Diffstat (limited to 'audio/audio_template.h')
-rw-r--r--audio/audio_template.h46
1 files changed, 22 insertions, 24 deletions
diff --git a/audio/audio_template.h b/audio/audio_template.h
index 1232bb54db..c721fed75d 100644
--- a/audio/audio_template.h
+++ b/audio/audio_template.h
@@ -36,9 +36,9 @@
#define HWBUF hw->conv_buf
#endif
-static void glue (audio_init_nb_voices_, TYPE) (struct audio_driver *drv)
+static void glue(audio_init_nb_voices_, TYPE)(AudioState *s,
+ struct audio_driver *drv)
{
- AudioState *s = &glob_audio_state;
int max_voices = glue (drv->max_voices_, TYPE);
int voice_size = glue (drv->voice_size_, TYPE);
@@ -183,8 +183,8 @@ static void glue (audio_pcm_hw_del_sw_, TYPE) (SW *sw)
static void glue (audio_pcm_hw_gc_, TYPE) (HW **hwp)
{
- AudioState *s = &glob_audio_state;
HW *hw = *hwp;
+ AudioState *s = hw->s;
if (!hw->sw_head.lh_first) {
#ifdef DAC
@@ -199,15 +199,14 @@ static void glue (audio_pcm_hw_gc_, TYPE) (HW **hwp)
}
}
-static HW *glue (audio_pcm_hw_find_any_, TYPE) (HW *hw)
+static HW *glue(audio_pcm_hw_find_any_, TYPE)(AudioState *s, HW *hw)
{
- AudioState *s = &glob_audio_state;
return hw ? hw->entries.le_next : glue (s->hw_head_, TYPE).lh_first;
}
-static HW *glue (audio_pcm_hw_find_any_enabled_, TYPE) (HW *hw)
+static HW *glue(audio_pcm_hw_find_any_enabled_, TYPE)(AudioState *s, HW *hw)
{
- while ((hw = glue (audio_pcm_hw_find_any_, TYPE) (hw))) {
+ while ((hw = glue(audio_pcm_hw_find_any_, TYPE)(s, hw))) {
if (hw->enabled) {
return hw;
}
@@ -215,12 +214,10 @@ static HW *glue (audio_pcm_hw_find_any_enabled_, TYPE) (HW *hw)
return NULL;
}
-static HW *glue (audio_pcm_hw_find_specific_, TYPE) (
- HW *hw,
- struct audsettings *as
- )
+static HW *glue(audio_pcm_hw_find_specific_, TYPE)(AudioState *s, HW *hw,
+ struct audsettings *as)
{
- while ((hw = glue (audio_pcm_hw_find_any_, TYPE) (hw))) {
+ while ((hw = glue(audio_pcm_hw_find_any_, TYPE)(s, hw))) {
if (audio_pcm_info_eq (&hw->info, as)) {
return hw;
}
@@ -228,10 +225,10 @@ static HW *glue (audio_pcm_hw_find_specific_, TYPE) (
return NULL;
}
-static HW *glue (audio_pcm_hw_add_new_, TYPE) (struct audsettings *as)
+static HW *glue(audio_pcm_hw_add_new_, TYPE)(AudioState *s,
+ struct audsettings *as)
{
HW *hw;
- AudioState *s = &glob_audio_state;
struct audio_driver *drv = s->drv;
if (!glue (s->nb_hw_voices_, TYPE)) {
@@ -255,6 +252,7 @@ static HW *glue (audio_pcm_hw_add_new_, TYPE) (struct audsettings *as)
return NULL;
}
+ hw->s = s;
hw->pcm_ops = drv->pcm_ops;
hw->ctl_caps = drv->ctl_caps;
@@ -328,33 +326,33 @@ AudiodevPerDirectionOptions *glue(audio_get_pdo_, TYPE)(Audiodev *dev)
abort();
}
-static HW *glue (audio_pcm_hw_add_, TYPE) (struct audsettings *as)
+static HW *glue(audio_pcm_hw_add_, TYPE)(AudioState *s, struct audsettings *as)
{
HW *hw;
- AudioState *s = &glob_audio_state;
AudiodevPerDirectionOptions *pdo = glue(audio_get_pdo_, TYPE)(s->dev);
if (pdo->fixed_settings) {
- hw = glue (audio_pcm_hw_add_new_, TYPE) (as);
+ hw = glue(audio_pcm_hw_add_new_, TYPE)(s, as);
if (hw) {
return hw;
}
}
- hw = glue (audio_pcm_hw_find_specific_, TYPE) (NULL, as);
+ hw = glue(audio_pcm_hw_find_specific_, TYPE)(s, NULL, as);
if (hw) {
return hw;
}
- hw = glue (audio_pcm_hw_add_new_, TYPE) (as);
+ hw = glue(audio_pcm_hw_add_new_, TYPE)(s, as);
if (hw) {
return hw;
}
- return glue (audio_pcm_hw_find_any_, TYPE) (NULL);
+ return glue(audio_pcm_hw_find_any_, TYPE)(s, NULL);
}
-static SW *glue (audio_pcm_create_voice_pair_, TYPE) (
+static SW *glue(audio_pcm_create_voice_pair_, TYPE)(
+ AudioState *s,
const char *sw_name,
struct audsettings *as
)
@@ -362,7 +360,6 @@ static SW *glue (audio_pcm_create_voice_pair_, TYPE) (
SW *sw;
HW *hw;
struct audsettings hw_as;
- AudioState *s = &glob_audio_state;
AudiodevPerDirectionOptions *pdo = glue(audio_get_pdo_, TYPE)(s->dev);
if (pdo->fixed_settings) {
@@ -378,8 +375,9 @@ static SW *glue (audio_pcm_create_voice_pair_, TYPE) (
sw_name ? sw_name : "unknown", sizeof (*sw));
goto err1;
}
+ sw->s = s;
- hw = glue (audio_pcm_hw_add_, TYPE) (&hw_as);
+ hw = glue(audio_pcm_hw_add_, TYPE)(s, &hw_as);
if (!hw) {
goto err2;
}
@@ -476,7 +474,7 @@ SW *glue (AUD_open_, TYPE) (
}
}
else {
- sw = glue (audio_pcm_create_voice_pair_, TYPE) (name, as);
+ sw = glue(audio_pcm_create_voice_pair_, TYPE)(s, name, as);
if (!sw) {
dolog ("Failed to create voice `%s'\n", name);
return NULL;