mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 23:35:03 +01:00
expand tabs in reaonablesynth code
This commit is contained in:
parent
caa7c3b579
commit
be6d6231fb
2 changed files with 22 additions and 22 deletions
|
|
@ -137,13 +137,13 @@ run(LV2_Handle handle, uint32_t n_samples)
|
||||||
LV2_Atom_Event const* ev = (LV2_Atom_Event const*) ((&(self->midiin)->body) + 1); // lv2_atom_sequence_begin
|
LV2_Atom_Event const* ev = (LV2_Atom_Event const*) ((&(self->midiin)->body) + 1); // lv2_atom_sequence_begin
|
||||||
while( (const uint8_t*)ev < ((const uint8_t*) &(self->midiin)->body + (self->midiin)->atom.size) ) {
|
while( (const uint8_t*)ev < ((const uint8_t*) &(self->midiin)->body + (self->midiin)->atom.size) ) {
|
||||||
if (ev->body.type == self->midi_MidiEvent) {
|
if (ev->body.type == self->midi_MidiEvent) {
|
||||||
if (written + BUFFER_SIZE_SAMPLES < ev->time.frames
|
if (written + BUFFER_SIZE_SAMPLES < ev->time.frames
|
||||||
&& ev->time.frames < n_samples) {
|
&& ev->time.frames < n_samples) {
|
||||||
/* first synthesize sound up until the message timestamp */
|
/* first synthesize sound up until the message timestamp */
|
||||||
written = synth_sound(self->synth, written, ev->time.frames, audio);
|
written = synth_sound(self->synth, written, ev->time.frames, audio);
|
||||||
}
|
}
|
||||||
/* send midi message to synth */
|
/* send midi message to synth */
|
||||||
synth_parse_midi(self->synth, (const uint8_t*)(ev+1), ev->body.size);
|
synth_parse_midi(self->synth, (const uint8_t*)(ev+1), ev->body.size);
|
||||||
}
|
}
|
||||||
ev = (LV2_Atom_Event const*)((const uint8_t*)ev + sizeof(LV2_Atom_Event) + ((ev->body.size + 7) & ~7));
|
ev = (LV2_Atom_Event const*)((const uint8_t*)ev + sizeof(LV2_Atom_Event) + ((ev->body.size + 7) & ~7));
|
||||||
}
|
}
|
||||||
|
|
@ -191,4 +191,4 @@ lv2_descriptor(uint32_t index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vi:set ts=8 sts=2 sw=2: */
|
/* vi:set ts=8 sts=2 sw=2 et: */
|
||||||
|
|
|
||||||
|
|
@ -240,8 +240,8 @@ static void process_key (void *synth,
|
||||||
// note off
|
// note off
|
||||||
if (sc->adsr_cnt[note] <= sc->adsr.off[1]) {
|
if (sc->adsr_cnt[note] <= sc->adsr.off[1]) {
|
||||||
if (sc->adsr_cnt[note] != sc->adsr.off[1]) {
|
if (sc->adsr_cnt[note] != sc->adsr.off[1]) {
|
||||||
// x-fade to release
|
// x-fade to release
|
||||||
sc->adsr_amp[note] = adsr_env(sc, note);
|
sc->adsr_amp[note] = adsr_env(sc, note);
|
||||||
}
|
}
|
||||||
sc->adsr_cnt[note] = sc->adsr.off[1] + 1;
|
sc->adsr_cnt[note] = sc->adsr.off[1] + 1;
|
||||||
}
|
}
|
||||||
|
|
@ -337,31 +337,31 @@ static void synth_process_midi_event(void *synth, struct rmidi_event_t *ev) {
|
||||||
switch(ev->type) {
|
switch(ev->type) {
|
||||||
case NOTE_ON:
|
case NOTE_ON:
|
||||||
if (rs->sc[ev->channel].miditable[ev->d.tone.note] <= 0)
|
if (rs->sc[ev->channel].miditable[ev->d.tone.note] <= 0)
|
||||||
rs->sc[ev->channel].miditable[ev->d.tone.note] = ev->d.tone.velocity;
|
rs->sc[ev->channel].miditable[ev->d.tone.note] = ev->d.tone.velocity;
|
||||||
break;
|
break;
|
||||||
case NOTE_OFF:
|
case NOTE_OFF:
|
||||||
if (rs->sc[ev->channel].miditable[ev->d.tone.note] > 0)
|
if (rs->sc[ev->channel].miditable[ev->d.tone.note] > 0)
|
||||||
rs->sc[ev->channel].miditable[ev->d.tone.note] *= -1.0;
|
rs->sc[ev->channel].miditable[ev->d.tone.note] *= -1.0;
|
||||||
break;
|
break;
|
||||||
case PROGRAM_CHANGE:
|
case PROGRAM_CHANGE:
|
||||||
break;
|
break;
|
||||||
case CONTROL_CHANGE:
|
case CONTROL_CHANGE:
|
||||||
if (ev->d.control.param == 0x00 || ev->d.control.param == 0x20) {
|
if (ev->d.control.param == 0x00 || ev->d.control.param == 0x20) {
|
||||||
/* 0x00 and 0x20 are used for BANK select */
|
/* 0x00 and 0x20 are used for BANK select */
|
||||||
break;
|
break;
|
||||||
} else
|
} else
|
||||||
if (ev->d.control.param == 121) {
|
if (ev->d.control.param == 121) {
|
||||||
/* reset all controllers */
|
/* reset all controllers */
|
||||||
break;
|
break;
|
||||||
} else
|
} else
|
||||||
if (ev->d.control.param == 120 || ev->d.control.param == 123) {
|
if (ev->d.control.param == 120 || ev->d.control.param == 123) {
|
||||||
/* Midi panic: 120: all sound off, 123: all notes off*/
|
/* Midi panic: 120: all sound off, 123: all notes off*/
|
||||||
synth_reset_channel(&(rs->sc[ev->channel]));
|
synth_reset_channel(&(rs->sc[ev->channel]));
|
||||||
break;
|
break;
|
||||||
} else
|
} else
|
||||||
if (ev->d.control.param >= 120) {
|
if (ev->d.control.param >= 120) {
|
||||||
/* params 122-127 are reserved - skip them. */
|
/* params 122-127 are reserved - skip them. */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
@ -493,4 +493,4 @@ static void * synth_alloc(void) {
|
||||||
static void synth_free(void *synth) {
|
static void synth_free(void *synth) {
|
||||||
free(synth);
|
free(synth);
|
||||||
}
|
}
|
||||||
/* vi:set ts=8 sts=2 sw=2: */
|
/* vi:set ts=8 sts=2 sw=2 et: */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue