Browse Source

Port naming fix in CoreMidiDriver.

tags/v1.9.10
Stephane Letz 12 years ago
parent
commit
dcb782e682
6 changed files with 40 additions and 21 deletions
  1. +24
    -9
      common/JackServer.cpp
  2. +5
    -5
      macosx/coremidi/JackCoreMidiDriver.cpp
  3. +5
    -3
      macosx/coremidi/JackCoreMidiVirtualInputPort.cpp
  4. +1
    -1
      macosx/coremidi/JackCoreMidiVirtualInputPort.h
  5. +4
    -2
      macosx/coremidi/JackCoreMidiVirtualOutputPort.cpp
  6. +1
    -1
      macosx/coremidi/JackCoreMidiVirtualOutputPort.h

+ 24
- 9
common/JackServer.cpp View File

@@ -328,13 +328,20 @@ JackDriverInfo* JackServer::AddSlave(jack_driver_desc_t* driver_desc, JSList* dr
JackDriverInfo* info = new JackDriverInfo();
JackDriverClientInterface* slave = info->Open(driver_desc, fEngine, GetSynchroTable(), driver_params);
if (slave == NULL) {
delete info;
return NULL;
goto error;
}
slave->Attach();
if (slave->Attach() < 0) {
goto error;
}
slave->SetMaster(false);
fAudioDriver->AddSlave(slave);
return info;

error:
slave->Close();
delete info;
return NULL;
}

void JackServer::RemoveSlave(JackDriverInfo* info)
@@ -347,6 +354,9 @@ void JackServer::RemoveSlave(JackDriverInfo* info)

int JackServer::SwitchMaster(jack_driver_desc_t* driver_desc, JSList* driver_params)
{
std::list<JackDriverInterface*> slave_list;
std::list<JackDriverInterface*>::const_iterator it;
/// Remove current master
fAudioDriver->Stop();
fAudioDriver->Detach();
@@ -357,14 +367,12 @@ int JackServer::SwitchMaster(jack_driver_desc_t* driver_desc, JSList* driver_par
JackDriverClientInterface* master = info->Open(driver_desc, fEngine, GetSynchroTable(), driver_params);

if (master == NULL) {
delete info;
return -1;
goto error;
}

// Get slaves list
std::list<JackDriverInterface*> slave_list = fAudioDriver->GetSlaves();
std::list<JackDriverInterface*>::const_iterator it;

slave_list = fAudioDriver->GetSlaves();
// Move slaves in new master
for (it = slave_list.begin(); it != slave_list.end(); it++) {
JackDriverInterface* slave = *it;
@@ -377,9 +385,16 @@ int JackServer::SwitchMaster(jack_driver_desc_t* driver_desc, JSList* driver_par
// Activate master
fAudioDriver = master;
fDriverInfo = info;
fAudioDriver->Attach();
if (fAudioDriver->Attach() < 0) {
goto error;
}
fAudioDriver->SetMaster(true);
return fAudioDriver->Start();

error:
delete info;
return -1;
}

//----------------------


+ 5
- 5
macosx/coremidi/JackCoreMidiDriver.cpp View File

@@ -210,7 +210,7 @@ bool JackCoreMidiDriver::OpenAux()
virtual_input_ports[vi_count] =
new JackCoreMidiVirtualInputPort(fAliasName, client_name,
capture_driver_name,
vi_count + pi_count, client,
vi_count, vi_count + pi_count, client,
time_ratio);
} catch (std::exception e) {
jack_error("JackCoreMidiDriver::Open - while creating virtual "
@@ -235,7 +235,7 @@ bool JackCoreMidiDriver::OpenAux()
virtual_output_ports[vo_count] =
new JackCoreMidiVirtualOutputPort(fAliasName, client_name,
playback_driver_name,
vo_count + po_count, client,
vo_count, vo_count + po_count, client,
time_ratio);
} catch (std::exception e) {
jack_error("JackCoreMidiDriver::Open - while creating virtual "
@@ -595,7 +595,7 @@ JackCoreMidiDriver::Open(bool capturing_aux, bool playing_aux, int in_channels_a
return -1;
} else {
JackSleep(10000);
jack_info("CoreMIDI driver is running...");
jack_info("CoreMIDI driver is opened...");
}

return 0;
@@ -819,8 +819,8 @@ extern "C" {
{
const JSList * node;
const jack_driver_param_t * param;
int virtual_in = 1;
int virtual_out = 1;
int virtual_in = 2;
int virtual_out = 2;

for (node = params; node; node = jack_slist_next (node)) {
param = (const jack_driver_param_t *) node->data;


+ 5
- 3
macosx/coremidi/JackCoreMidiVirtualInputPort.cpp View File

@@ -44,13 +44,15 @@ HandleInputEvent(const MIDIPacketList *packet_list, void *port,

JackCoreMidiVirtualInputPort::
JackCoreMidiVirtualInputPort(const char *alias_name, const char *client_name,
const char *driver_name, int index,
const char *driver_name, int base_index, int index,
MIDIClientRef client, double time_ratio,
size_t max_bytes, size_t max_messages):
JackCoreMidiInputPort(time_ratio, max_bytes, max_messages)
{
CFStringRef name = CFStringCreateWithCString(0, "virtual",
CFStringGetSystemEncoding());
std::stringstream stream;
stream << "virtual" << (base_index + 1);
CFStringRef name = CFStringCreateWithCString(0, stream.str().c_str(),
CFStringGetSystemEncoding());
if (! name) {
throw std::bad_alloc();
}


+ 1
- 1
macosx/coremidi/JackCoreMidiVirtualInputPort.h View File

@@ -36,7 +36,7 @@ namespace Jack {

JackCoreMidiVirtualInputPort(const char *alias_name,
const char *client_name,
const char *driver_name, int index,
const char *driver_name, int base_index, int index,
MIDIClientRef client, double time_ratio,
size_t max_bytes=4096,
size_t max_messages=1024);


+ 4
- 2
macosx/coremidi/JackCoreMidiVirtualOutputPort.cpp View File

@@ -28,14 +28,16 @@ using Jack::JackCoreMidiVirtualOutputPort;

JackCoreMidiVirtualOutputPort::
JackCoreMidiVirtualOutputPort(const char *alias_name, const char *client_name,
const char *driver_name, int index,
const char *driver_name, int base_index, int index,
MIDIClientRef client, double time_ratio,
size_t max_bytes,
size_t max_messages):
JackCoreMidiOutputPort(time_ratio, max_bytes,
max_messages)
{
CFStringRef name = CFStringCreateWithCString(0, "virtual",
std::stringstream stream;
stream << "virtual" << (base_index + 1);
CFStringRef name = CFStringCreateWithCString(0, stream.str().c_str(),
CFStringGetSystemEncoding());
if (! name) {
throw std::bad_alloc();


+ 1
- 1
macosx/coremidi/JackCoreMidiVirtualOutputPort.h View File

@@ -35,7 +35,7 @@ namespace Jack {

JackCoreMidiVirtualOutputPort(const char *alias_name,
const char *client_name,
const char *driver_name, int index,
const char *driver_name, int base_index, int index,
MIDIClientRef client, double time_ratio,
size_t max_bytes=4096,
size_t max_messages=1024);


Loading…
Cancel
Save