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.h24
1 files changed, 16 insertions, 8 deletions
diff --git a/audio/audio_template.h b/audio/audio_template.h
index 1006d6b1eb..3287d7075e 100644
--- a/audio/audio_template.h
+++ b/audio/audio_template.h
@@ -78,13 +78,17 @@ static void glue (audio_pcm_hw_free_resources_, TYPE) (HW *hw)
static void glue(audio_pcm_hw_alloc_resources_, TYPE)(HW *hw)
{
- size_t samples = hw->samples;
- if (audio_bug(__func__, samples == 0)) {
- dolog("Attempted to allocate empty buffer\n");
- }
+ if (glue(audio_get_pdo_, TYPE)(hw->s->dev)->mixing_engine) {
+ size_t samples = hw->samples;
+ if (audio_bug(__func__, samples == 0)) {
+ dolog("Attempted to allocate empty buffer\n");
+ }
- HWBUF = g_malloc0(sizeof(STSampleBuffer) + sizeof(st_sample) * samples);
- HWBUF->size = samples;
+ HWBUF = g_malloc0(sizeof(STSampleBuffer) + sizeof(st_sample) * samples);
+ HWBUF->size = samples;
+ } else {
+ HWBUF = NULL;
+ }
}
static void glue (audio_pcm_sw_free_resources_, TYPE) (SW *sw)
@@ -103,6 +107,10 @@ static int glue (audio_pcm_sw_alloc_resources_, TYPE) (SW *sw)
{
int samples;
+ if (!glue(audio_get_pdo_, TYPE)(sw->s->dev)->mixing_engine) {
+ return 0;
+ }
+
samples = ((int64_t) sw->HWBUF->size << 32) / sw->ratio;
sw->buf = audio_calloc(__func__, samples, sizeof(struct st_sample));
@@ -328,9 +336,9 @@ static HW *glue(audio_pcm_hw_add_, TYPE)(AudioState *s, struct audsettings *as)
HW *hw;
AudiodevPerDirectionOptions *pdo = glue(audio_get_pdo_, TYPE)(s->dev);
- if (pdo->fixed_settings) {
+ if (!pdo->mixing_engine || pdo->fixed_settings) {
hw = glue(audio_pcm_hw_add_new_, TYPE)(s, as);
- if (hw) {
+ if (!pdo->mixing_engine || hw) {
return hw;
}
}