mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-09 23:25:43 +01:00
Wrap some Jack_MidiPort stuff in #ifdefs to solve dylib errors on OS X
git-svn-id: svn://localhost/ardour2/branches/3.0@4361 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
c5f9501e50
commit
ca21a5ac7b
4 changed files with 25 additions and 17 deletions
|
|
@ -53,7 +53,7 @@ class MidiClockTicker : public Ticker
|
|||
{
|
||||
/// Singleton
|
||||
private:
|
||||
MidiClockTicker() : _jack_port(0), _ppqn(24), _last_tick(0.0) {};
|
||||
MidiClockTicker() : _midi_port(0), _ppqn(24), _last_tick(0.0) {};
|
||||
MidiClockTicker( const MidiClockTicker& );
|
||||
MidiClockTicker& operator= (const MidiClockTicker&);
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ public:
|
|||
const SMPTE::Time& transport_smpte);
|
||||
|
||||
void set_session(Session& s);
|
||||
void going_away() { _jack_port = 0; Ticker::going_away(); }
|
||||
void going_away() { _midi_port = 0; Ticker::going_away(); }
|
||||
|
||||
/// slot for the signal session::MIDIClock_PortChanged
|
||||
void update_midi_clock_port();
|
||||
|
|
@ -89,9 +89,9 @@ public:
|
|||
void set_ppqn(int ppqn) { _ppqn = ppqn; }
|
||||
|
||||
private:
|
||||
MIDI::JACK_MidiPort* _jack_port;
|
||||
int _ppqn;
|
||||
double _last_tick;
|
||||
MIDI::Port* _midi_port;
|
||||
int _ppqn;
|
||||
double _last_tick;
|
||||
|
||||
double one_ppqn_in_frames(nframes_t transport_position);
|
||||
|
||||
|
|
|
|||
|
|
@ -133,7 +133,9 @@ _thread_init_callback (void *arg)
|
|||
*/
|
||||
|
||||
PBD::notify_gui_about_thread_creation (pthread_self(), X_("Audioengine"), 4096);
|
||||
#ifdef WITH_JACK_MIDI
|
||||
MIDI::JACK_MidiPort::set_process_thread (pthread_self());
|
||||
#endif // WITH_JACK_MIDI
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ MIDIClock_Slave::update_midi_clock (Parser& parser, nframes_t timestamp)
|
|||
average_midi_clock_frame_duration += accumulator[i];
|
||||
average_midi_clock_frame_duration /= double(accumulator_size);
|
||||
|
||||
#if 1
|
||||
#ifdef WITH_JACK_MIDI
|
||||
JACK_MidiPort *jack_port = dynamic_cast<JACK_MidiPort *>(port);
|
||||
pthread_t process_thread_id = 0;
|
||||
if(jack_port) {
|
||||
|
|
@ -126,7 +126,7 @@ MIDIClock_Slave::update_midi_clock (Parser& parser, nframes_t timestamp)
|
|||
<< " reference: " << one_ppqn_in_frames
|
||||
<< " average: " << average_midi_clock_frame_duration
|
||||
<< std::endl;
|
||||
#endif
|
||||
#endif // WITH_JACK_MIDI
|
||||
|
||||
current.guard1++;
|
||||
current.position += one_ppqn_in_frames;
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ void MidiClockTicker::set_session(Session& s)
|
|||
|
||||
void MidiClockTicker::update_midi_clock_port()
|
||||
{
|
||||
_jack_port = (MIDI::JACK_MidiPort*) _session->midi_clock_port();
|
||||
_midi_port = _session->midi_clock_port();
|
||||
}
|
||||
|
||||
void MidiClockTicker::transport_state_changed()
|
||||
|
|
@ -122,10 +122,13 @@ void MidiClockTicker::transport_looped()
|
|||
}
|
||||
|
||||
void MidiClockTicker::tick(const nframes_t& transport_frames, const BBT_Time& transport_bbt, const SMPTE::Time& transport_smpt)
|
||||
{
|
||||
{
|
||||
#ifdef WITH_JACK_MIDI
|
||||
if (!Config->get_send_midi_clock() || _session == 0 || _session->transport_speed() != 1.0f)
|
||||
return;
|
||||
|
||||
MIDI::Jack_MidiPort & jack_port (dynamic_cast<MIDI::Jack_MidiPort &> (*_midi_port));
|
||||
|
||||
while (true) {
|
||||
double next_tick = _last_tick + one_ppqn_in_frames(transport_frames);
|
||||
nframes_t next_tick_offset = nframes_t(next_tick) - transport_frames;
|
||||
|
|
@ -135,17 +138,18 @@ void MidiClockTicker::tick(const nframes_t& transport_frames, const BBT_Time& tr
|
|||
<< ":Last tick time:" << _last_tick << ":"
|
||||
<< ":Next tick time:" << next_tick << ":"
|
||||
<< "Offset:" << next_tick_offset << ":"
|
||||
<< "cycle length:" << _jack_port->nframes_this_cycle()
|
||||
<< "cycle length:" << jack_port.nframes_this_cycle()
|
||||
<< endl;
|
||||
#endif
|
||||
|
||||
if (next_tick_offset >= _jack_port->nframes_this_cycle())
|
||||
if (next_tick_offset >= jack_port.nframes_this_cycle())
|
||||
return;
|
||||
|
||||
send_midi_clock_event(next_tick_offset);
|
||||
|
||||
_last_tick = next_tick;
|
||||
}
|
||||
#endif // WITH_JACK_MIDI
|
||||
}
|
||||
|
||||
double MidiClockTicker::one_ppqn_in_frames(nframes_t transport_position)
|
||||
|
|
@ -164,30 +168,32 @@ double MidiClockTicker::one_ppqn_in_frames(nframes_t transport_position)
|
|||
|
||||
void MidiClockTicker::send_midi_clock_event(nframes_t offset)
|
||||
{
|
||||
assert(_jack_port->is_process_thread());
|
||||
#ifdef WITH_JACK_MIDI
|
||||
assert (MIDI::JACK_MidiPort::is_process_thread());
|
||||
#endif // WITH_JACK_MIDI
|
||||
#if DEBUG_TICKER
|
||||
cerr << "Tick with offset " << offset << endl;
|
||||
#endif
|
||||
#endif // DEBUG_TICKER
|
||||
static uint8_t _midi_clock_tick[1] = { MIDI_CMD_COMMON_CLOCK };
|
||||
_jack_port->write(_midi_clock_tick, 1, offset);
|
||||
_midi_port->write(_midi_clock_tick, 1, offset);
|
||||
}
|
||||
|
||||
void MidiClockTicker::send_start_event(nframes_t offset)
|
||||
{
|
||||
static uint8_t _midi_clock_tick[1] = { MIDI_CMD_COMMON_START };
|
||||
_jack_port->write(_midi_clock_tick, 1, offset);
|
||||
_midi_port->write(_midi_clock_tick, 1, offset);
|
||||
}
|
||||
|
||||
void MidiClockTicker::send_continue_event(nframes_t offset)
|
||||
{
|
||||
static uint8_t _midi_clock_tick[1] = { MIDI_CMD_COMMON_CONTINUE };
|
||||
_jack_port->write(_midi_clock_tick, 1, offset);
|
||||
_midi_port->write(_midi_clock_tick, 1, offset);
|
||||
}
|
||||
|
||||
void MidiClockTicker::send_stop_event(nframes_t offset)
|
||||
{
|
||||
static uint8_t _midi_clock_tick[1] = { MIDI_CMD_COMMON_STOP };
|
||||
_jack_port->write(_midi_clock_tick, 1, offset);
|
||||
_midi_port->write(_midi_clock_tick, 1, offset);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue