MCPcopy Create free account
hub / github.com/csound/csound / MidiIn

Method MidiIn

InOut/HaikuMidi.cpp:254–279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

252
253
254MidiIn::MidiIn(const char *name) :
255nodename(name), extSource(NULL), handler(NULL)
256{
257 if (!name || !*name) return; // empty name -- don't publish
258 extSource = FindProducer(name);
259 if (*name == '?') return; // was just a query
260 if (extSource) {
261 DPRINTF(("Connecting to external Producer %s\n", name);)
262 handler = new MidiInHandler(this); // anonymous endpoint
263 if (extSource->Connect(handler) != B_OK) {
264 extSource = NULL;
265 handler->Release();
266 handler = NULL;
267 fprintf(stderr, "Failed to connect to %s!!\n", name);
268 }
269 else
270 fprintf(stderr, "Connected to MIDI source %s\n", name);
271 extSource->Release(); // our extra hold...
272 } else {
273 DPRINTF(("Registering as Consumer %s\n", name);)
274 handler = new MidiInHandler(this, name);
275 BMidiRoster::Register(handler); // needs error check!
276 DPRINTF(("Published OK -- thread %lx\n", find_thread(NULL));)
277 fprintf(stderr, "Providing MIDI Input %s\n", name);
278 }
279}
280
281
282MidiIn::~MidiIn()

Callers

nothing calls this directly

Calls 2

FindProducerFunction · 0.85
ConnectMethod · 0.80

Tested by

no test coverage detected