| 252 | |
| 253 | |
| 254 | MidiIn::MidiIn(const char *name) : |
| 255 | nodename(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 | |
| 282 | MidiIn::~MidiIn() |
nothing calls this directly
no test coverage detected