Browse Source

Add working midi out with fixed timings

master
cancel 6 years ago
parent
commit
f11a1911dc
  1. 2
      osc_out.c
  2. 2
      sim.c
  3. 6
      tui_main.c

2
osc_out.c

@ -216,7 +216,7 @@ void susnote_list_advance_time(Susnote_list* sl, double delta_time,
for (Usz i = 0; i < count;) {
Susnote sn = buffer[i];
sn.remaining -= delta_float;
if (sn.remaining > 0) {
if (sn.remaining > 0.001) {
if (sn.remaining < soonest)
soonest = sn.remaining;
buffer[i].remaining = sn.remaining;

2
sim.c

@ -365,7 +365,7 @@ BEGIN_OPERATOR(midi)
oe->octave = (U8)usz_clamp(octave_num, 1, 9);
oe->note = note_num;
oe->velocity = midi_velocity_of(velocity_g);
oe->bar_divisor = (U8)usz_clamp(index_of(length_g), 1, Glyphs_index_count);
oe->bar_divisor = (U8)(index_of(length_g) + 1);
END_OPERATOR
BEGIN_OPERATOR(osc)

6
tui_main.c

@ -896,7 +896,7 @@ void send_output_events(Oosc_dev* oosc_dev, Midi_mode const* midi_mode, Usz bpm,
Susnote_list* susnote_list, Oevent const* events,
Usz count) {
Midi_mode_type midi_mode_type = midi_mode->any.type;
double bar_secs = (double)bpm / 60.0;
double bar_secs = 60.0 / (double)bpm * 4.0;
enum { Midi_on_capacity = 512 };
typedef struct {
@ -1028,8 +1028,6 @@ void ged_do_stuff(Ged* a) {
double secs = stm_sec(stm_since(a->clock));
a->meter_level -= (float)secs;
a->meter_level = float_clamp(a->meter_level, 0.0f, 1.0f);
apply_time_to_sustained_notes(oosc_dev, midi_mode, secs, &a->susnote_list,
&a->time_to_next_note_off);
if (!a->is_playing)
return;
bool do_play = false;
@ -1068,6 +1066,8 @@ void ged_do_stuff(Ged* a) {
}
#endif
if (do_play) {
apply_time_to_sustained_notes(oosc_dev, midi_mode, secs_span,
&a->susnote_list, &a->time_to_next_note_off);
orca_run(a->field.buffer, a->markmap_r.buffer, a->field.height,
a->field.width, a->tick_num, &a->oevent_list, a->piano_bits);
++a->tick_num;

Loading…
Cancel
Save