#include <CoreServices/CoreServices.h>
#include <AudioUnit/AudioUnit.h>
#include <AudioToolbox/AudioUnitUtilities.h>
+#ifdef WITH_CARBON
+#include <Carbon/Carbon.h>
+#endif
#include "i18n.h"
vector<pair<int,int> >& io_configs = pinfo->cache.io_configs;
- DEBUG_TRACE (DEBUG::AudioUnits, string_compose ("%1 has %2 IO configurations\n", name(), io_configs.size()));
+ DEBUG_TRACE (DEBUG::AudioUnits, string_compose ("%1 has %2 IO configurations, looking for %3 in, %4 out\n",
+ name(), io_configs.size(), in, out));
//Ardour expects the plugin to tell it the output
//configuration but AU plugins can have multiple I/O
int32_t possible_out = i->second;
if ((possible_in == audio_in) && (possible_out == audio_out)) {
- DEBUG_TRACE (DEBUG::AudioUnits, string_compose ("\tCHOSEN: in %1 out %2\n", in, out));
+ DEBUG_TRACE (DEBUG::AudioUnits, string_compose ("\tCHOSEN: %1 in %2 out to match in %3 out %4\n",
+ possible_in, possible_out,
+ in, out));
+
+ out.set (DataType::MIDI, 0);
+ out.set (DataType::AUDIO, audio_out);
+
return 1;
}
}
_last_nframes = nframes;
}
+ DEBUG_TRACE (DEBUG::AudioUnits, string_compose ("%1 in %2 out %3 MIDI %4 bufs %5 (available %6)\n",
+ name(), input_channels, output_channels, _has_midi_input,
+ bufs.count(), bufs.available()));
+
/* the apparent number of buffers matches our input configuration, but we know that the bufferset
has the capacity to handle our outputs.
*/
+
assert (bufs.available() >= ChanCount (DataType::AUDIO, output_channels));
input_buffers = &bufs;
input_offset = offset;
cb_offset = 0;
- DEBUG_TRACE (DEBUG::AudioUnits, string_compose ("%1 in %2 out %3 MIDI %4 bufs %5 (available %6)\n",
- name(), input_channels, output_channels, _has_midi_input,
- bufs.count(), bufs.available()));
-
buffers->mNumberBuffers = output_channels;
for (int32_t i = 0; i < output_channels; ++i) {
Timecode::BBT_Time bbt;
TempoMetric metric = tmap.metric_at (_session.transport_frame() + input_offset);
- tmap.bbt_time_with_metric (_session.transport_frame() + input_offset, bbt, metric);
+ tmap.bbt_time (_session.transport_frame() + input_offset, bbt);
if (outCurrentBeat) {
float beat;
- beat = metric.meter().beats_per_bar() * bbt.bars;
+ beat = metric.meter().divisions_per_bar() * bbt.bars;
beat += bbt.beats;
beat += bbt.ticks / Timecode::BBT_Time::ticks_per_beat;
*outCurrentBeat = beat;
Timecode::BBT_Time bbt;
TempoMetric metric = tmap.metric_at (_session.transport_frame() + input_offset);
- tmap.bbt_time_with_metric (_session.transport_frame() + input_offset, bbt, metric);
+ tmap.bbt_time (_session.transport_frame() + input_offset, bbt);
if (outDeltaSampleOffsetToNextBeat) {
if (bbt.ticks == 0) {
} else {
*outDeltaSampleOffsetToNextBeat = (UInt32)
floor (((Timecode::BBT_Time::ticks_per_beat - bbt.ticks)/Timecode::BBT_Time::ticks_per_beat) * // fraction of a beat to next beat
- metric.tempo().frames_per_beat(_session.frame_rate(), metric.meter())); // frames per beat
+ metric.tempo().frames_per_beat (_session.frame_rate())); // frames per beat
}
}
if (outTimeSig_Numerator) {
- *outTimeSig_Numerator = (UInt32) lrintf (metric.meter().beats_per_bar());
+ *outTimeSig_Numerator = (UInt32) lrintf (metric.meter().divisions_per_bar());
}
if (outTimeSig_Denominator) {
*outTimeSig_Denominator = (UInt32) lrintf (metric.meter().note_divisor());
/* beat for the start of the bar.
1|1|0 -> 1
- 2|1|0 -> 1 + beats_per_bar
- 3|1|0 -> 1 + (2 * beats_per_bar)
+ 2|1|0 -> 1 + divisions_per_bar
+ 3|1|0 -> 1 + (2 * divisions_per_bar)
etc.
*/
- *outCurrentMeasureDownBeat = 1 + metric.meter().beats_per_bar() * (bbt.bars - 1);
+ *outCurrentMeasureDownBeat = 1 + metric.meter().divisions_per_bar() * (bbt.bars - 1);
}
return noErr;
if (outCycleStartBeat) {
TempoMetric metric = tmap.metric_at (loc->start() + input_offset);
- _session.tempo_map().bbt_time_with_metric (loc->start(), bbt, metric);
+ _session.tempo_map().bbt_time (loc->start(), bbt);
float beat;
- beat = metric.meter().beats_per_bar() * bbt.bars;
+ beat = metric.meter().divisions_per_bar() * bbt.bars;
beat += bbt.beats;
beat += bbt.ticks / Timecode::BBT_Time::ticks_per_beat;
if (outCycleEndBeat) {
TempoMetric metric = tmap.metric_at (loc->end() + input_offset);
- _session.tempo_map().bbt_time_with_metric (loc->end(), bbt, metric);
+ _session.tempo_map().bbt_time (loc->end(), bbt);
float beat;
- beat = metric.meter().beats_per_bar() * bbt.bars;
+ beat = metric.meter().divisions_per_bar() * bbt.bars;
beat += bbt.beats;
beat += bbt.ticks / Timecode::BBT_Time::ticks_per_beat;
int
AUPlugin::create_parameter_listener (AUEventListenerProc cb, void* arg, float interval_secs)
{
+#ifdef WITH_CARBON
CFRunLoopRef run_loop = (CFRunLoopRef) GetCFRunLoopFromEventLoop(GetCurrentEventLoop());
+#else
+ CFRunLoopRef run_loop = CFRunLoopGetCurrent();
+#endif
CFStringRef loop_mode = kCFRunLoopDefaultMode;
if (AUEventListenerCreate (cb, arg, run_loop, loop_mode, interval_secs, interval_secs, &_parameter_listener) != noErr) {