aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALu.c2
-rw-r--r--Alc/midi/base.h4
-rw-r--r--Alc/midi/dummy.c4
-rw-r--r--Alc/midi/fluidsynth.c14
-rw-r--r--Alc/midi/soft.c12
5 files changed, 19 insertions, 17 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index cd23057c..2e94ad63 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -1219,7 +1219,7 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
}
V0(device->Backend,lock)();
- V(device->Synth,process)(SamplesToDo, OutBuffer);
+ V(device->Synth,process)(SamplesToDo, OutBuffer, OutChannels);
ctx = ATOMIC_LOAD(&device->ContextList);
while(ctx)
diff --git a/Alc/midi/base.h b/Alc/midi/base.h
index 309e1a55..823e3802 100644
--- a/Alc/midi/base.h
+++ b/Alc/midi/base.h
@@ -90,7 +90,7 @@ struct MidiSynthVtable {
void (*const reset)(MidiSynth *self);
void (*const update)(MidiSynth *self, ALCdevice *device);
- void (*const process)(MidiSynth *self, ALuint samples, ALfloat (*restrict DryBuffer)[BUFFERSIZE]);
+ void (*const process)(MidiSynth *self, ALuint samples, ALfloat (*restrict DryBuffer)[BUFFERSIZE], ALuint NumChannels);
void (*const Delete)(void *ptr);
};
@@ -102,7 +102,7 @@ DECLARE_THUNK1(T, MidiSynth, void, setGain, ALfloat) \
DECLARE_THUNK(T, MidiSynth, void, stop) \
DECLARE_THUNK(T, MidiSynth, void, reset) \
DECLARE_THUNK1(T, MidiSynth, void, update, ALCdevice*) \
-DECLARE_THUNK2(T, MidiSynth, void, process, ALuint, ALfloatBUFFERSIZE*restrict) \
+DECLARE_THUNK3(T, MidiSynth, void, process, ALuint, ALfloatBUFFERSIZE*restrict, ALuint) \
static void T##_MidiSynth_Delete(void *ptr) \
{ T##_Delete(STATIC_UPCAST(T, MidiSynth, (MidiSynth*)ptr)); } \
\
diff --git a/Alc/midi/dummy.c b/Alc/midi/dummy.c
index d50b8fef..a04c1c9b 100644
--- a/Alc/midi/dummy.c
+++ b/Alc/midi/dummy.c
@@ -25,7 +25,7 @@ static DECLARE_FORWARD1(DSynth, MidiSynth, void, setGain, ALfloat)
static DECLARE_FORWARD(DSynth, MidiSynth, void, stop)
static DECLARE_FORWARD(DSynth, MidiSynth, void, reset)
static DECLARE_FORWARD1(DSynth, MidiSynth, void, update, ALCdevice*)
-static void DSynth_process(DSynth *self, ALuint SamplesToDo, ALfloat (*restrict DryBuffer)[BUFFERSIZE]);
+static void DSynth_process(DSynth *self, ALuint SamplesToDo, ALfloat (*restrict DryBuffer)[BUFFERSIZE], ALuint NumChannels);
DECLARE_DEFAULT_ALLOCATORS(DSynth)
DEFINE_MIDISYNTH_VTABLE(DSynth);
@@ -45,7 +45,7 @@ static void DSynth_processQueue(DSynth *self, ALuint64 time)
queue->pos++;
}
-static void DSynth_process(DSynth *self, ALuint SamplesToDo, ALfloatBUFFERSIZE*restrict UNUSED(DryBuffer))
+static void DSynth_process(DSynth *self, ALuint SamplesToDo, ALfloatBUFFERSIZE*restrict UNUSED(DryBuffer), ALuint UNUSED(NumChannels))
{
MidiSynth *synth = STATIC_CAST(MidiSynth, self);
ALuint64 curtime;
diff --git a/Alc/midi/fluidsynth.c b/Alc/midi/fluidsynth.c
index fbcd4353..1ddf44c3 100644
--- a/Alc/midi/fluidsynth.c
+++ b/Alc/midi/fluidsynth.c
@@ -579,7 +579,7 @@ static void FSynth_stop(FSynth *self);
static void FSynth_reset(FSynth *self);
static void FSynth_update(FSynth *self, ALCdevice *device);
static void FSynth_processQueue(FSynth *self, ALuint64 time);
-static void FSynth_process(FSynth *self, ALuint SamplesToDo, ALfloat (*restrict DryBuffer)[BUFFERSIZE]);
+static void FSynth_process(FSynth *self, ALuint SamplesToDo, ALfloat (*restrict DryBuffer)[BUFFERSIZE], ALuint NumChannels);
DECLARE_DEFAULT_ALLOCATORS(FSynth)
DEFINE_MIDISYNTH_VTABLE(FSynth);
@@ -844,9 +844,11 @@ static void FSynth_processQueue(FSynth *self, ALuint64 time)
}
}
-static void FSynth_process(FSynth *self, ALuint SamplesToDo, ALfloat (*restrict DryBuffer)[BUFFERSIZE])
+static void FSynth_process(FSynth *self, ALuint SamplesToDo, ALfloat (*restrict DryBuffer)[BUFFERSIZE], ALuint NumChannels)
{
MidiSynth *synth = STATIC_CAST(MidiSynth, self);
+ ALfloat *LeftBuffer = DryBuffer[0];
+ ALfloat *RightBuffer = DryBuffer[(NumChannels > 1) ? 1 : 0];
ALenum state = synth->State;
ALuint64 curtime;
ALuint total = 0;
@@ -855,8 +857,8 @@ static void FSynth_process(FSynth *self, ALuint SamplesToDo, ALfloat (*restrict
return;
if(state != AL_PLAYING)
{
- fluid_synth_write_float(self->Synth, SamplesToDo, DryBuffer[0], 0, 1,
- DryBuffer[1], 0, 1);
+ fluid_synth_write_float(self->Synth, SamplesToDo, LeftBuffer, 0, 1,
+ RightBuffer, 0, 1);
return;
}
@@ -884,8 +886,8 @@ static void FSynth_process(FSynth *self, ALuint SamplesToDo, ALfloat (*restrict
if(tonext > 0)
{
ALuint todo = minu(tonext, SamplesToDo-total);
- fluid_synth_write_float(self->Synth, todo, DryBuffer[0], total, 1,
- DryBuffer[1], total, 1);
+ fluid_synth_write_float(self->Synth, todo, LeftBuffer, total, 1,
+ RightBuffer, total, 1);
total += todo;
tonext -= todo;
}
diff --git a/Alc/midi/soft.c b/Alc/midi/soft.c
index 6566b411..e8050173 100644
--- a/Alc/midi/soft.c
+++ b/Alc/midi/soft.c
@@ -18,7 +18,7 @@ typedef struct SSynth {
DERIVE_FROM_TYPE(MidiSynth);
} SSynth;
-static void SSynth_mixSamples(SSynth *self, ALuint SamplesToDo, ALfloat (*restrict DryBuffer)[BUFFERSIZE]);
+static void SSynth_mixSamples(SSynth *self, ALuint SamplesToDo, ALfloat (*restrict DryBuffer)[BUFFERSIZE], ALuint NumChannels);
static void SSynth_Construct(SSynth *self, ALCdevice *device);
static void SSynth_Destruct(SSynth *self);
@@ -27,7 +27,7 @@ static DECLARE_FORWARD1(SSynth, MidiSynth, void, setGain, ALfloat)
static DECLARE_FORWARD(SSynth, MidiSynth, void, stop)
static DECLARE_FORWARD(SSynth, MidiSynth, void, reset)
static void SSynth_update(SSynth *self, ALCdevice *device);
-static void SSynth_process(SSynth *self, ALuint SamplesToDo, ALfloat (*restrict DryBuffer)[BUFFERSIZE]);
+static void SSynth_process(SSynth *self, ALuint SamplesToDo, ALfloat (*restrict DryBuffer)[BUFFERSIZE], ALuint NumChannels);
DECLARE_DEFAULT_ALLOCATORS(SSynth)
DEFINE_MIDISYNTH_VTABLE(SSynth);
@@ -48,7 +48,7 @@ static void SSynth_update(SSynth* UNUSED(self), ALCdevice* UNUSED(device))
}
-static void SSynth_mixSamples(SSynth* UNUSED(self), ALuint UNUSED(SamplesToDo), ALfloatBUFFERSIZE *restrict UNUSED(DryBuffer))
+static void SSynth_mixSamples(SSynth* UNUSED(self), ALuint UNUSED(SamplesToDo), ALfloatBUFFERSIZE *restrict UNUSED(DryBuffer), ALuint UNUSED(NumChannels))
{
}
@@ -61,7 +61,7 @@ static void SSynth_processQueue(SSynth *self, ALuint64 time)
queue->pos++;
}
-static void SSynth_process(SSynth *self, ALuint SamplesToDo, ALfloat (*restrict DryBuffer)[BUFFERSIZE])
+static void SSynth_process(SSynth *self, ALuint SamplesToDo, ALfloat (*restrict DryBuffer)[BUFFERSIZE], ALuint NumChannels)
{
MidiSynth *synth = STATIC_CAST(MidiSynth, self);
ALenum state = synth->State;
@@ -72,7 +72,7 @@ static void SSynth_process(SSynth *self, ALuint SamplesToDo, ALfloat (*restrict
return;
if(state != AL_PLAYING)
{
- SSynth_mixSamples(self, SamplesToDo, DryBuffer);
+ SSynth_mixSamples(self, SamplesToDo, DryBuffer, NumChannels);
return;
}
@@ -103,7 +103,7 @@ static void SSynth_process(SSynth *self, ALuint SamplesToDo, ALfloat (*restrict
if(tonext > 0)
{
ALuint todo = mini(tonext, SamplesToDo-total);
- SSynth_mixSamples(self, todo, DryBuffer);
+ SSynth_mixSamples(self, todo, DryBuffer, NumChannels);
total += todo;
tonext -= todo;
}