27 #include "ardour/debug.h"
35 #define port_engine AudioEngine::instance()->port_engine()
39 , _has_been_mixed_down (false)
40 , _resolve_required (false)
41 , _input_active (true)
42 , _always_parse (false)
72 uint8_t* buf = (*b).buffer();
76 uint32_t limit = (*b).size();
78 for (
size_t n = 0; n < limit; ++n) {
109 for (
pframes_t i = 0; i < event_count; ++i) {
115 port_engine.midi_event_get (timestamp, size, &buf, buffer, i);
117 if (buf[0] == 0xfe) {
120 }
else if ((buf[0] & 0xF0) == 0x90 && buf[2] == 0) {
122 buf[0] = 0x80 | (buf[0] & 0x0F);
132 cerr <<
"Dropping incoming MIDI at time " << timestamp <<
"; offset="
168 for (uint8_t channel = 0; channel <= 0xF; channel++) {
177 if (
port_engine.midi_event_put (port_buffer, when, ev, 3) != 0) {
178 cerr <<
"failed to deliver sustain-zero on channel " << (int)channel <<
" on port " <<
name() << endl;
183 if (
port_engine.midi_event_put (port_buffer, 0, ev, 3) != 0) {
184 cerr <<
"failed to deliver ALL NOTES OFF on channel " << (int)channel <<
" on port " <<
name() << endl;
194 void* port_buffer = 0;
218 uint8_t
const *
const buf = ev.
buffer();
223 uint32_t limit = ev.
size();
225 for (
size_t n = 0; n < limit; ++n) {
237 for (
size_t i=0; i < ev.
size(); ++i) {
252 cerr <<
"write failed, drop flushed note off on the floor, time "
256 cerr <<
"drop flushed event on the floor, time " << ev.
time()
259 for (
size_t xx = 0; xx < ev.
size(); ++xx) {
260 cerr <<
' ' << hex << (int) ev.
buffer()[xx];
void resolve_notes(void *buffer, framepos_t when)
void flush_buffers(pframes_t nframes)
void cycle_end(pframes_t nframes)
MIDI::Parser _self_parser
bool sends_output() const
bool _has_been_mixed_down
LIBARDOUR_API uint64_t MidiIO
void silence(framecnt_t nframes, framecnt_t offset=0)
static AudioEngine * instance()
framecnt_t _port_buffer_offset
void set_input_active(bool yn)
virtual void cycle_start(pframes_t)
framepos_t sample_time_at_cycle_start()
PortEngine::PortHandle _port_handle
#define DEBUG_TRACE(bits, str)
MidiBuffer & get_midi_buffer(pframes_t nframes)
size_t raw_buffer_size(DataType t)
Buffer & get_buffer(pframes_t nframes)
LIBPBD_API uint64_t debug_bits
bool receives_input() const
#define DEBUG_STR_APPEND(id, s)
bool push_back(const Evoral::MIDIEvent< TimeType > &event)
void set_trace_on(bool yn)
void set_always_parse(bool yn)
static pframes_t _global_port_buffer_offset
const uint8_t * buffer() const
#define DEBUG_STR_DECL(id)
#define MIDI_CTL_ALL_NOTES_OFF
void cycle_start(pframes_t nframes)
std::string string_compose(const std::string &fmt, const T1 &o1)