add API to Evoral::SMF to retrieve all track/instrument names for use when importing
[ardour.git] / libs / ardour / audio_unit.cc
index dbcb697578d8ad043df42157130c30ea11e3da8f..4bc8cdaf3b354720c507a6e21c95d4e86960fa23 100644 (file)
@@ -1686,7 +1686,7 @@ AUPlugin::connect_and_run (BufferSet& bufs,
                        /* one MIDI port/buffer only */
                        MidiBuffer& m = bufs.get_midi (i);
                        for (MidiBuffer::iterator i = m.begin(); i != m.end(); ++i) {
-                               Evoral::MIDIEvent<framepos_t> ev (*i);
+                               Evoral::Event<framepos_t> ev (*i);
                                if (ev.is_channel_event()) {
                                        const uint8_t* b = ev.buffer();
                                        DEBUG_TRACE (DEBUG::AudioUnits, string_compose ("%1: MIDI event %2\n", name(), ev));
@@ -1808,7 +1808,7 @@ AUPlugin::get_beat_and_tempo_callback (Float64* outCurrentBeat,
        }
 
        if (outCurrentTempo) {
-               *outCurrentTempo = tmap.tempo_at_frame (transport_frame + input_offset).beats_per_minute();
+               *outCurrentTempo = tmap.tempo_at_frame (transport_frame + input_offset).quarter_notes_per_minute();
        }
 
        return noErr;
@@ -1833,7 +1833,7 @@ AUPlugin::get_musical_time_location_callback (UInt32*   outDeltaSampleOffsetToNe
                        /* on the beat */
                        *outDeltaSampleOffsetToNextBeat = 0;
                } else {
-                       double const next_beat = cail (tmap.quarter_note_at_frame (transport_frame + input_offset));
+                       double const next_beat = ceil (tmap.quarter_note_at_frame (transport_frame + input_offset));
                        framepos_t const next_beat_frame = tmap.frame_at_quarter_note (next_beat);
 
                        *outDeltaSampleOffsetToNextBeat = next_beat_frame - (transport_frame + input_offset);
@@ -1858,7 +1858,7 @@ AUPlugin::get_musical_time_location_callback (UInt32*   outDeltaSampleOffsetToNe
                bbt.beats = 1;
                bbt.ticks = 0;
 
-               *outCurrentMeasureDownBeat = tmap..pulse_at_bbt (bbt) * 4.0;
+               *outCurrentMeasureDownBeat = tmap.quarter_note_at_bbt (bbt);
        }
 
        return noErr;
@@ -1958,6 +1958,8 @@ AUPlugin::describe_io_port (ARDOUR::DataType dt, bool input, uint32_t id) const
                        break;
        }
 
+       std::string busname;
+
        if (dt == DataType::AUDIO) {
                if (input) {
                        uint32_t pid = id;
@@ -1966,6 +1968,7 @@ AUPlugin::describe_io_port (ARDOUR::DataType dt, bool input, uint32_t id) const
                                        id = pid;
                                        ss << _bus_name_in[bus];
                                        ss << " / Bus " << (1 + bus);
+                                       busname = _bus_name_in[bus];
                                        break;
                                }
                                pid -= bus_inputs[bus];
@@ -1978,6 +1981,7 @@ AUPlugin::describe_io_port (ARDOUR::DataType dt, bool input, uint32_t id) const
                                        id = pid;
                                        ss << _bus_name_out[bus];
                                        ss << " / Bus " << (1 + bus);
+                                       busname = _bus_name_out[bus];
                                        break;
                                }
                                pid -= bus_outputs[bus];
@@ -1994,6 +1998,10 @@ AUPlugin::describe_io_port (ARDOUR::DataType dt, bool input, uint32_t id) const
        ss << (id + 1);
 
        Plugin::IOPortDescription iod (ss.str());
+       if (!busname.empty()) {
+               iod.group_name = busname;
+               iod.group_channel = id;
+       }
        return iod;
 }