00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <sstream>
00021 #include <stdexcept>
00022
00023 #include "JackCoreMidiPhysicalInputPort.h"
00024 #include "JackCoreMidiUtil.h"
00025
00026 using Jack::JackCoreMidiPhysicalInputPort;
00027
00028 JackCoreMidiPhysicalInputPort::
00029 JackCoreMidiPhysicalInputPort(const char *alias_name, const char *client_name,
00030 const char *driver_name, int index,
00031 MIDIClientRef client, MIDIPortRef internal_input,
00032 double time_ratio, size_t max_bytes,
00033 size_t max_messages):
00034 JackCoreMidiInputPort(time_ratio, max_bytes, max_messages)
00035 {
00036 MIDIEndpointRef source = MIDIGetSource(index);
00037 if (! source) {
00038
00039 std::stringstream stream;
00040 stream << "The source at index '" << index << "' is not available";
00041 throw std::runtime_error(stream.str().c_str());
00042 }
00043 OSStatus status = MIDIPortConnectSource(internal_input, source, this);
00044 if (status != noErr) {
00045 throw std::runtime_error(GetMacOSErrorString(status));
00046 }
00047 Initialize(alias_name, client_name, driver_name, index, source);
00048 }
00049
00050 JackCoreMidiPhysicalInputPort::~JackCoreMidiPhysicalInputPort()
00051 {
00052
00053 }