Browse Source

Use of PortRegister/PortUnRegister in drivers.

tags/1.9.8
Stephane Letz 13 years ago
parent
commit
07d2c64f39
12 changed files with 106 additions and 157 deletions
  1. +6
    -12
      common/JackAudioDriver.cpp
  2. +1
    -1
      common/JackEngine.cpp
  3. +1
    -7
      common/JackLockedEngine.h
  4. +4
    -8
      common/JackMidiDriver.cpp
  5. +25
    -33
      common/JackNetDriver.cpp
  6. +35
    -40
      common/JackNetOneDriver.cpp
  7. +4
    -7
      linux/alsa/JackAlsaDriver.cpp
  8. +7
    -11
      linux/alsarawmidi/JackALSARawMidiDriver.cpp
  9. +4
    -8
      linux/firewire/JackFFADODriver.cpp
  10. +4
    -8
      linux/freebob/JackFreebobDriver.cpp
  11. +3
    -6
      macosx/coreaudio/JackCoreAudioDriver.cpp
  12. +12
    -16
      macosx/coremidi/JackCoreMidiDriver.cpp

+ 6
- 12
common/JackAudioDriver.cpp View File

@@ -141,7 +141,7 @@ int JackAudioDriver::Attach()
for (i = 0; i < fCaptureChannels; i++) {
snprintf(alias, sizeof(alias) - 1, "%s:%s:out%d", fAliasName, fCaptureDriverName, i + 1);
snprintf(name, sizeof(name) - 1, "%s:capture_%d", fClientControl.fName, i + 1);
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, CaptureDriverFlags, fEngineControl->fBufferSize)) == NO_PORT) {
if (fEngine->PortRegister(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, CaptureDriverFlags, fEngineControl->fBufferSize, &port_index) < 0) {
jack_error("driver: cannot register port for %s", name);
return -1;
}
@@ -149,13 +149,12 @@ int JackAudioDriver::Attach()
port->SetAlias(alias);
fCapturePortList[i] = port_index;
jack_log("JackAudioDriver::Attach fCapturePortList[i] port_index = %ld", port_index);
fEngine->NotifyPortRegistration(port_index, true);
}

for (i = 0; i < fPlaybackChannels; i++) {
snprintf(alias, sizeof(alias) - 1, "%s:%s:in%d", fAliasName, fPlaybackDriverName, i + 1);
snprintf(name, sizeof(name) - 1, "%s:playback_%d", fClientControl.fName, i + 1);
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, PlaybackDriverFlags, fEngineControl->fBufferSize)) == NO_PORT) {
if (fEngine->PortRegister(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, PlaybackDriverFlags, fEngineControl->fBufferSize, &port_index) < 0) {
jack_error("driver: cannot register port for %s", name);
return -1;
}
@@ -163,18 +162,16 @@ int JackAudioDriver::Attach()
port->SetAlias(alias);
fPlaybackPortList[i] = port_index;
jack_log("JackAudioDriver::Attach fPlaybackPortList[i] port_index = %ld", port_index);
fEngine->NotifyPortRegistration(port_index, true);

// Monitor ports
if (fWithMonitorPorts) {
jack_log("Create monitor port");
snprintf(name, sizeof(name) - 1, "%s:monitor_%u", fClientControl.fName, i + 1);
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, fEngineControl->fBufferSize)) == NO_PORT) {
if (fEngine->PortRegister(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, fEngineControl->fBufferSize, &port_index) < 0) {
jack_error("Cannot register monitor port for %s", name);
return -1;
} else {
fMonitorPortList[i] = port_index;
fEngine->NotifyPortRegistration(port_index, true);
}
}
}
@@ -189,16 +186,13 @@ int JackAudioDriver::Detach()
jack_log("JackAudioDriver::Detach");

for (i = 0; i < fCaptureChannels; i++) {
fGraphManager->ReleasePort(fClientControl.fRefNum, fCapturePortList[i]);
fEngine->NotifyPortRegistration(fCapturePortList[i], false);
fEngine->PortUnRegister(fClientControl.fRefNum, fCapturePortList[i]);
}

for (i = 0; i < fPlaybackChannels; i++) {
fGraphManager->ReleasePort(fClientControl.fRefNum, fPlaybackPortList[i]);
fEngine->NotifyPortRegistration(fPlaybackPortList[i], false);
fEngine->PortUnRegister(fClientControl.fRefNum, fPlaybackPortList[i]);
if (fWithMonitorPorts) {
fGraphManager->ReleasePort(fClientControl.fRefNum, fMonitorPortList[i]);
fEngine->NotifyPortRegistration(fMonitorPortList[i], false);
fEngine->PortUnRegister(fClientControl.fRefNum, fMonitorPortList[i]);
}
}



+ 1
- 1
common/JackEngine.cpp View File

@@ -804,7 +804,7 @@ int JackEngine::PortRegister(int refnum, const char* name, const char *type, uns
return -1;
}

*port_index = fGraphManager->AllocatePort(refnum, name, type, (JackPortFlags)flags, fEngineControl->fBufferSize);
*port_index = fGraphManager->AllocatePort(refnum, name, type, (JackPortFlags)flags, buffer_size);
if (*port_index != NO_PORT) {
if (client->GetClientControl()->fActive)
NotifyPortRegistation(*port_index, true);


+ 1
- 7
common/JackLockedEngine.h View File

@@ -261,13 +261,7 @@ class SERVER_EXPORT JackLockedEngine
fEngine.NotifyGraphReorder();
CATCH_EXCEPTION
}
void NotifyPortRegistration(jack_port_id_t port_index, bool onoff)
{
TRY_CALL
JackLock lock(&fEngine);
fEngine.NotifyPortRegistation(port_index, onoff);
CATCH_EXCEPTION
}

void NotifyBufferSize(jack_nframes_t buffer_size)
{
TRY_CALL


+ 4
- 8
common/JackMidiDriver.cpp View File

@@ -67,7 +67,7 @@ int JackMidiDriver::Attach()
for (i = 0; i < fCaptureChannels; i++) {
snprintf(alias, sizeof(alias) - 1, "%s:%s:out%d", fAliasName, fCaptureDriverName, i + 1);
snprintf(name, sizeof(name) - 1, "%s:capture_%d", fClientControl.fName, i + 1);
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_MIDI_TYPE, CaptureDriverFlags, fEngineControl->fBufferSize)) == NO_PORT) {
if (fEngine->PortRegister(fClientControl.fRefNum, name, JACK_DEFAULT_MIDI_TYPE, CaptureDriverFlags, fEngineControl->fBufferSize, &port_index) < 0) {
jack_error("driver: cannot register port for %s", name);
return -1;
}
@@ -75,13 +75,12 @@ int JackMidiDriver::Attach()
port->SetAlias(alias);
fCapturePortList[i] = port_index;
jack_log("JackMidiDriver::Attach fCapturePortList[i] port_index = %ld", port_index);
fEngine->NotifyPortRegistration(port_index, true);
}

for (i = 0; i < fPlaybackChannels; i++) {
snprintf(alias, sizeof(alias) - 1, "%s:%s:in%d", fAliasName, fPlaybackDriverName, i + 1);
snprintf(name, sizeof(name) - 1, "%s:playback_%d", fClientControl.fName, i + 1);
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_MIDI_TYPE, PlaybackDriverFlags, fEngineControl->fBufferSize)) == NO_PORT) {
if (fEngine->PortRegister(fClientControl.fRefNum, name, JACK_DEFAULT_MIDI_TYPE, PlaybackDriverFlags, fEngineControl->fBufferSize, &port_index) < 0) {
jack_error("driver: cannot register port for %s", name);
return -1;
}
@@ -89,7 +88,6 @@ int JackMidiDriver::Attach()
port->SetAlias(alias);
fPlaybackPortList[i] = port_index;
jack_log("JackMidiDriver::Attach fPlaybackPortList[i] port_index = %ld", port_index);
fEngine->NotifyPortRegistration(port_index, true);
}

UpdateLatencies();
@@ -102,13 +100,11 @@ int JackMidiDriver::Detach()
jack_log("JackMidiDriver::Detach");

for (i = 0; i < fCaptureChannels; i++) {
fGraphManager->ReleasePort(fClientControl.fRefNum, fCapturePortList[i]);
fEngine->NotifyPortRegistration(fCapturePortList[i], false);
fEngine->PortUnRegister(fClientControl.fRefNum, fCapturePortList[i]);
}

for (i = 0; i < fPlaybackChannels; i++) {
fGraphManager->ReleasePort(fClientControl.fRefNum, fPlaybackPortList[i]);
fEngine->NotifyPortRegistration(fPlaybackPortList[i], false);
fEngine->PortUnRegister(fClientControl.fRefNum, fPlaybackPortList[i]);
}

return 0;


+ 25
- 33
common/JackNetDriver.cpp View File

@@ -19,9 +19,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

#include "JackNetDriver.h"
#include "JackEngineControl.h"
#include "JackLockedEngine.h"
#include "JackGraphManager.h"
#include "JackWaitThreadedDriver.h"
#include "JackLockedEngine.h"

using namespace std;

@@ -268,7 +268,7 @@ namespace Jack
jack_log("JackNetDriver::AllocPorts fBufferSize = %ld fSampleRate = %ld", fEngineControl->fBufferSize, fEngineControl->fSampleRate);

JackPort* port;
jack_port_id_t port_id;
jack_port_id_t port_index;
char name[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
char alias[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
unsigned long port_flags;
@@ -282,33 +282,32 @@ namespace Jack
{
snprintf(alias, sizeof(alias) - 1, "%s:%s:out%d", fAliasName, fCaptureDriverName, audio_port_index + 1);
snprintf(name, sizeof(name) - 1, "%s:capture_%d", fClientControl.fName, audio_port_index + 1);
if ((port_id = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE,
static_cast<JackPortFlags>(port_flags), fEngineControl->fBufferSize)) == NO_PORT)
if (fEngine->PortRegister(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE,
static_cast<JackPortFlags>(port_flags), fEngineControl->fBufferSize, &port_index) < 0)
{
jack_error("driver: cannot register port for %s", name);
return -1;
}
port = fGraphManager->GetPort(port_id);
port = fGraphManager->GetPort(port_index);
port->SetAlias(alias);
//port latency
range.min = range.max = fEngineControl->fBufferSize;
port->SetLatencyRange(JackCaptureLatency, &range);
fCapturePortList[audio_port_index] = port_id;
jack_log("JackNetDriver::AllocPorts() fCapturePortList[%d] audio_port_index = %ld fPortLatency = %ld", audio_port_index, port_id, port->GetLatency());
fEngine->NotifyPortRegistration(port_id, true);
fCapturePortList[audio_port_index] = port_index;
jack_log("JackNetDriver::AllocPorts() fCapturePortList[%d] audio_port_index = %ld fPortLatency = %ld", audio_port_index, port_index, port->GetLatency());
}
port_flags = JackPortIsInput | JackPortIsPhysical | JackPortIsTerminal;
for (audio_port_index = 0; audio_port_index < fPlaybackChannels; audio_port_index++)
{
snprintf(alias, sizeof(alias) - 1, "%s:%s:in%d", fAliasName, fPlaybackDriverName, audio_port_index + 1);
snprintf(name, sizeof(name) - 1, "%s:playback_%d",fClientControl.fName, audio_port_index + 1);
if ((port_id = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE,
static_cast<JackPortFlags>(port_flags), fEngineControl->fBufferSize)) == NO_PORT)
if (fEngine->PortRegister(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE,
static_cast<JackPortFlags>(port_flags), fEngineControl->fBufferSize, &port_index) < 0)
{
jack_error("driver: cannot register port for %s", name);
return -1;
}
port = fGraphManager->GetPort(port_id);
port = fGraphManager->GetPort(port_index);
port->SetAlias(alias);
//port latency
switch (fParams.fNetworkMode)
@@ -324,9 +323,8 @@ namespace Jack
break;
}
port->SetLatencyRange(JackPlaybackLatency, &range);
fPlaybackPortList[audio_port_index] = port_id;
jack_log("JackNetDriver::AllocPorts() fPlaybackPortList[%d] audio_port_index = %ld fPortLatency = %ld", audio_port_index, port_id, port->GetLatency());
fEngine->NotifyPortRegistration(port_id, true);
fPlaybackPortList[audio_port_index] = port_index;
jack_log("JackNetDriver::AllocPorts() fPlaybackPortList[%d] audio_port_index = %ld fPortLatency = %ld", audio_port_index, port_index, port->GetLatency());
}
//midi
port_flags = JackPortIsOutput | JackPortIsPhysical | JackPortIsTerminal;
@@ -334,19 +332,18 @@ namespace Jack
{
snprintf(alias, sizeof(alias) - 1, "%s:%s:out%d", fAliasName, fCaptureDriverName, midi_port_index + 1);
snprintf(name, sizeof (name) - 1, "%s:midi_capture_%d", fClientControl.fName, midi_port_index + 1);
if ((port_id = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_MIDI_TYPE,
static_cast<JackPortFlags>(port_flags), fEngineControl->fBufferSize)) == NO_PORT)
if (fEngine->PortRegister(fClientControl.fRefNum, name, JACK_DEFAULT_MIDI_TYPE,
static_cast<JackPortFlags>(port_flags), fEngineControl->fBufferSize, &port_index) < 0)
{
jack_error("driver: cannot register port for %s", name);
return -1;
}
port = fGraphManager->GetPort(port_id);
port = fGraphManager->GetPort(port_index);
//port latency
range.min = range.max = fEngineControl->fBufferSize;
port->SetLatencyRange(JackCaptureLatency, &range);
fMidiCapturePortList[midi_port_index] = port_id;
jack_log("JackNetDriver::AllocPorts() fMidiCapturePortList[%d] midi_port_index = %ld fPortLatency = %ld", midi_port_index, port_id, port->GetLatency());
fEngine->NotifyPortRegistration(port_id, true);
fMidiCapturePortList[midi_port_index] = port_index;
jack_log("JackNetDriver::AllocPorts() fMidiCapturePortList[%d] midi_port_index = %ld fPortLatency = %ld", midi_port_index, port_index, port->GetLatency());
}

port_flags = JackPortIsInput | JackPortIsPhysical | JackPortIsTerminal;
@@ -354,13 +351,13 @@ namespace Jack
{
snprintf(alias, sizeof(alias) - 1, "%s:%s:in%d", fAliasName, fPlaybackDriverName, midi_port_index + 1);
snprintf(name, sizeof(name) - 1, "%s:midi_playback_%d", fClientControl.fName, midi_port_index + 1);
if ((port_id = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_MIDI_TYPE,
static_cast<JackPortFlags>(port_flags), fEngineControl->fBufferSize)) == NO_PORT)
if (fEngine->PortRegister(fClientControl.fRefNum, name, JACK_DEFAULT_MIDI_TYPE,
static_cast<JackPortFlags>(port_flags), fEngineControl->fBufferSize, &port_index) < 0)
{
jack_error("driver: cannot register port for %s", name);
return -1;
}
port = fGraphManager->GetPort(port_id);
port = fGraphManager->GetPort(port_index);
//port latency
switch (fParams.fNetworkMode)
{
@@ -375,9 +372,8 @@ namespace Jack
break;
}
port->SetLatencyRange(JackPlaybackLatency, &range);
fMidiPlaybackPortList[midi_port_index] = port_id;
jack_log("JackNetDriver::AllocPorts() fMidiPlaybackPortList[%d] midi_port_index = %ld fPortLatency = %ld", midi_port_index, port_id, port->GetLatency());
fEngine->NotifyPortRegistration(port_id, true);
fMidiPlaybackPortList[midi_port_index] = port_index;
jack_log("JackNetDriver::AllocPorts() fMidiPlaybackPortList[%d] midi_port_index = %ld fPortLatency = %ld", midi_port_index, port_index, port->GetLatency());
}

return 0;
@@ -389,16 +385,14 @@ namespace Jack

for (int audio_port_index = 0; audio_port_index < fCaptureChannels; audio_port_index++) {
if (fCapturePortList[audio_port_index] > 0) {
fGraphManager->ReleasePort(fClientControl.fRefNum, fCapturePortList[audio_port_index]);
fEngine->NotifyPortRegistration(fCapturePortList[audio_port_index], false);
fEngine->PortUnRegister(fClientControl.fRefNum, fCapturePortList[audio_port_index]);
fCapturePortList[audio_port_index] = 0;
}
}

for (int audio_port_index = 0; audio_port_index < fPlaybackChannels; audio_port_index++) {
if (fPlaybackPortList[audio_port_index] > 0) {
fGraphManager->ReleasePort(fClientControl.fRefNum, fPlaybackPortList[audio_port_index]);
fEngine->NotifyPortRegistration(fPlaybackPortList[audio_port_index], false);
fEngine->PortUnRegister(fClientControl.fRefNum, fPlaybackPortList[audio_port_index]);
fPlaybackPortList[audio_port_index] = 0;
}
}
@@ -406,15 +400,13 @@ namespace Jack
for (int midi_port_index = 0; midi_port_index < fParams.fSendMidiChannels; midi_port_index++) {
if (fMidiCapturePortList && fMidiCapturePortList[midi_port_index] > 0) {
fGraphManager->ReleasePort(fClientControl.fRefNum, fMidiCapturePortList[midi_port_index]);
fEngine->NotifyPortRegistration(fMidiCapturePortList[midi_port_index], false);
fMidiCapturePortList[midi_port_index] = 0;
}
}

for (int midi_port_index = 0; midi_port_index < fParams.fReturnMidiChannels; midi_port_index++) {
if (fMidiPlaybackPortList && fMidiPlaybackPortList[midi_port_index] > 0) {
fGraphManager->ReleasePort(fClientControl.fRefNum, fMidiPlaybackPortList[midi_port_index]);
fEngine->NotifyPortRegistration(fMidiPlaybackPortList[midi_port_index], false);
fEngine->PortUnRegister(fClientControl.fRefNum, fMidiPlaybackPortList[midi_port_index]);
fMidiPlaybackPortList[midi_port_index] = 0;
}
}


+ 35
- 40
common/JackNetOneDriver.cpp View File

@@ -136,7 +136,7 @@ int JackNetOneDriver::Detach()

int JackNetOneDriver::AllocPorts()
{
jack_port_id_t port_id;
jack_port_id_t port_index;
char buf[64];
unsigned int chn;

@@ -146,16 +146,16 @@ int JackNetOneDriver::AllocPorts()
for (chn = 0; chn < netj.capture_channels_audio; chn++) {
snprintf (buf, sizeof(buf) - 1, "system:capture_%u", chn + 1);

if ( ( port_id = fGraphManager->AllocatePort ( fClientControl.fRefNum, buf, JACK_DEFAULT_AUDIO_TYPE,
CaptureDriverFlags, fEngineControl->fBufferSize ) ) == NO_PORT ) {
if (fEngine->PortRegister(fClientControl.fRefNum, buf, JACK_DEFAULT_AUDIO_TYPE,
CaptureDriverFlags, fEngineControl->fBufferSize, &port_index) < 0) {
jack_error ( "driver: cannot register port for %s", buf );
return -1;
}
//port = fGraphManager->GetPort ( port_id );
//port = fGraphManager->GetPort ( port_index );

netj.capture_ports = jack_slist_append (netj.capture_ports, (void *)(intptr_t)port_id);
netj.capture_ports = jack_slist_append (netj.capture_ports, (void *)(intptr_t)port_index);

if( netj.bitdepth == CELT_MODE ) {
if (netj.bitdepth == CELT_MODE) {
#if HAVE_CELT
#if HAVE_CELT_API_0_11
celt_int32 lookahead;
@@ -178,34 +178,33 @@ int JackNetOneDriver::AllocPorts()
netj.capture_srcs = jack_slist_append(netj.capture_srcs, (void *)src_new(SRC_LINEAR, 1, NULL));
#endif
}
fEngine->NotifyPortRegistration(port_id, true);
}

for (chn = netj.capture_channels_audio; chn < netj.capture_channels; chn++) {
snprintf (buf, sizeof(buf) - 1, "system:capture_%u", chn + 1);

if ( ( port_id = fGraphManager->AllocatePort ( fClientControl.fRefNum, buf, JACK_DEFAULT_MIDI_TYPE,
CaptureDriverFlags, fEngineControl->fBufferSize ) ) == NO_PORT ) {
if (fEngine->PortRegister(fClientControl.fRefNum, buf, JACK_DEFAULT_MIDI_TYPE,
CaptureDriverFlags, fEngineControl->fBufferSize, &port_index) < 0) {
jack_error ( "driver: cannot register port for %s", buf );
return -1;
}
//port = fGraphManager->GetPort ( port_id );
//port = fGraphManager->GetPort ( port_index );

netj.capture_ports =
jack_slist_append (netj.capture_ports, (void *)(intptr_t)port_id);
fEngine->NotifyPortRegistration(port_id, true);
jack_slist_append (netj.capture_ports, (void *)(intptr_t)port_index);
}

for (chn = 0; chn < netj.playback_channels_audio; chn++) {
snprintf (buf, sizeof(buf) - 1, "system:playback_%u", chn + 1);

if ( ( port_id = fGraphManager->AllocatePort ( fClientControl.fRefNum, buf, JACK_DEFAULT_AUDIO_TYPE,
PlaybackDriverFlags, fEngineControl->fBufferSize ) ) == NO_PORT ) {
if (fEngine->PortRegister(fClientControl.fRefNum, buf, JACK_DEFAULT_AUDIO_TYPE,
PlaybackDriverFlags, fEngineControl->fBufferSize, &port_index) < 0) {
jack_error ( "driver: cannot register port for %s", buf );
return -1;
}
//port = fGraphManager->GetPort ( port_id );
//port = fGraphManager->GetPort ( port_index );

netj.playback_ports = jack_slist_append (netj.playback_ports, (void *)(intptr_t)port_id);
netj.playback_ports = jack_slist_append (netj.playback_ports, (void *)(intptr_t)port_index);
if( netj.bitdepth == CELT_MODE ) {
#if HAVE_CELT
#if HAVE_CELT_API_0_11
@@ -224,21 +223,19 @@ int JackNetOneDriver::AllocPorts()
netj.playback_srcs = jack_slist_append(netj.playback_srcs, (void *)src_new(SRC_LINEAR, 1, NULL));
#endif
}
fEngine->NotifyPortRegistration(port_id, true);
}
for (chn = netj.playback_channels_audio; chn < netj.playback_channels; chn++) {
snprintf (buf, sizeof(buf) - 1, "system:playback_%u", chn + 1);

if ( ( port_id = fGraphManager->AllocatePort ( fClientControl.fRefNum, buf, JACK_DEFAULT_MIDI_TYPE,
PlaybackDriverFlags, fEngineControl->fBufferSize ) ) == NO_PORT ) {
if (fEngine->PortRegister(fClientControl.fRefNum, buf, JACK_DEFAULT_MIDI_TYPE,
PlaybackDriverFlags, fEngineControl->fBufferSize, &port_index) < 0) {
jack_error ( "driver: cannot register port for %s", buf );
return -1;
}
//port = fGraphManager->GetPort ( port_id );
//port = fGraphManager->GetPort ( port_index );

netj.playback_ports =
jack_slist_append (netj.playback_ports, (void *)(intptr_t)port_id);
fEngine->NotifyPortRegistration(port_id, true);
jack_slist_append (netj.playback_ports, (void *)(intptr_t)port_index);
}
return 0;
}
@@ -440,22 +437,20 @@ JackNetOneDriver::FreePorts ()

while( node != NULL ) {
JSList *this_node = node;
jack_port_id_t port_id = (jack_port_id_t)(intptr_t) node->data;
jack_port_id_t port_index = (jack_port_id_t)(intptr_t) node->data;
node = jack_slist_remove_link( node, this_node );
jack_slist_free_1( this_node );
fGraphManager->ReleasePort( fClientControl.fRefNum, port_id );
fEngine->NotifyPortRegistration(port_id, false);
fEngine->PortUnRegister(fClientControl.fRefNum, port_index);
}
netj.capture_ports = NULL;

node = netj.playback_ports;
while( node != NULL ) {
JSList *this_node = node;
jack_port_id_t port_id = (jack_port_id_t)(intptr_t) node->data;
jack_port_id_t port_index = (jack_port_id_t)(intptr_t) node->data;
node = jack_slist_remove_link( node, this_node );
jack_slist_free_1( this_node );
fGraphManager->ReleasePort( fClientControl.fRefNum, port_id );
fEngine->NotifyPortRegistration(port_id, false);
fEngine->PortUnRegister(fClientControl.fRefNum, port_index);
}
netj.playback_ports = NULL;

@@ -529,11 +524,11 @@ JackNetOneDriver::render_payload_to_jack_ports_float ( void *packet_payload, jac
#if HAVE_SAMPLERATE
SRC_DATA src;
#endif
jack_port_id_t port_id = (jack_port_id_t)(intptr_t) node->data;
JackPort *port = fGraphManager->GetPort( port_id );
jack_port_id_t port_index = (jack_port_id_t)(intptr_t) node->data;
JackPort *port = fGraphManager->GetPort( port_index );

jack_default_audio_sample_t* buf =
(jack_default_audio_sample_t*)fGraphManager->GetBuffer(port_id, fEngineControl->fBufferSize);
(jack_default_audio_sample_t*)fGraphManager->GetBuffer(port_index, fEngineControl->fBufferSize);

const char *porttype = port->GetType();

@@ -601,11 +596,11 @@ JackNetOneDriver::render_jack_ports_to_payload_float (JSList *playback_ports, JS
#endif
unsigned int i;
int_float_t val;
jack_port_id_t port_id = (jack_port_id_t)(intptr_t) node->data;
JackPort *port = fGraphManager->GetPort( port_id );
jack_port_id_t port_index = (jack_port_id_t)(intptr_t) node->data;
JackPort *port = fGraphManager->GetPort( port_index );

jack_default_audio_sample_t* buf =
(jack_default_audio_sample_t*)fGraphManager->GetBuffer(port_id, fEngineControl->fBufferSize);
(jack_default_audio_sample_t*)fGraphManager->GetBuffer(port_index, fEngineControl->fBufferSize);

const char *porttype = port->GetType();

@@ -668,11 +663,11 @@ JackNetOneDriver::render_payload_to_jack_ports_celt (void *packet_payload, jack_
unsigned char *packet_bufX = (unsigned char *)packet_payload;

while (node != NULL) {
jack_port_id_t port_id = (jack_port_id_t) (intptr_t)node->data;
JackPort *port = fGraphManager->GetPort( port_id );
jack_port_id_t port_index = (jack_port_id_t) (intptr_t)node->data;
JackPort *port = fGraphManager->GetPort( port_index );

jack_default_audio_sample_t* buf =
(jack_default_audio_sample_t*)fGraphManager->GetBuffer(port_id, fEngineControl->fBufferSize);
(jack_default_audio_sample_t*)fGraphManager->GetBuffer(port_index, fEngineControl->fBufferSize);

const char *portname = port->GetType();

@@ -717,11 +712,11 @@ JackNetOneDriver::render_jack_ports_to_payload_celt (JSList *playback_ports, JSL
unsigned char *packet_bufX = (unsigned char *)packet_payload;

while (node != NULL) {
jack_port_id_t port_id = (jack_port_id_t) (intptr_t) node->data;
JackPort *port = fGraphManager->GetPort( port_id );
jack_port_id_t port_index = (jack_port_id_t) (intptr_t) node->data;
JackPort *port = fGraphManager->GetPort( port_index );

jack_default_audio_sample_t* buf =
(jack_default_audio_sample_t*)fGraphManager->GetBuffer(port_id, fEngineControl->fBufferSize);
(jack_default_audio_sample_t*)fGraphManager->GetBuffer(port_index, fEngineControl->fBufferSize);

const char *portname = port->GetType();



+ 4
- 7
linux/alsa/JackAlsaDriver.cpp View File

@@ -116,7 +116,7 @@ int JackAlsaDriver::Attach()
for (int i = 0; i < fCaptureChannels; i++) {
snprintf(alias, sizeof(alias) - 1, "%s:%s:out%d", fAliasName, fCaptureDriverName, i + 1);
snprintf(name, sizeof(name) - 1, "%s:capture_%d", fClientControl.fName, i + 1);
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize)) == NO_PORT) {
if if (fEngine->PortRegister(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize, &port_index) < 0) {
jack_error("driver: cannot register port for %s", name);
return -1;
}
@@ -124,7 +124,6 @@ int JackAlsaDriver::Attach()
port->SetAlias(alias);
fCapturePortList[i] = port_index;
jack_log("JackAlsaDriver::Attach fCapturePortList[i] %ld ", port_index);
fEngine->NotifyPortRegistration(port_index, true);
}

port_flags = (unsigned long)PlaybackDriverFlags;
@@ -132,7 +131,7 @@ int JackAlsaDriver::Attach()
for (int i = 0; i < fPlaybackChannels; i++) {
snprintf(alias, sizeof(alias) - 1, "%s:%s:in%d", fAliasName, fPlaybackDriverName, i + 1);
snprintf(name, sizeof(name) - 1, "%s:playback_%d", fClientControl.fName, i + 1);
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize)) == NO_PORT) {
if (fEngine->PortRegister(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize, &port_index) < 0) {
jack_error("driver: cannot register port for %s", name);
return -1;
}
@@ -140,17 +139,15 @@ int JackAlsaDriver::Attach()
port->SetAlias(alias);
fPlaybackPortList[i] = port_index;
jack_log("JackAlsaDriver::Attach fPlaybackPortList[i] %ld ", port_index);
fEngine->NotifyPortRegistration(port_index, true);

// Monitor ports
if (fWithMonitorPorts) {
jack_log("Create monitor port");
snprintf(name, sizeof(name) - 1, "%s:monitor_%d", fClientControl.fName, i + 1);
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, MonitorDriverFlags, fEngineControl->fBufferSize)) == NO_PORT) {
jack_error ("ALSA: cannot register monitor port for %s", name);
if (fEngine->PortRegister(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, MonitorDriverFlags, fEngineControl->fBufferSize, &port_index) < 0) {
jack_error("ALSA: cannot register monitor port for %s", name);
} else {
fMonitorPortList[i] = port_index;
fEngine->NotifyPortRegistration(port_index, true);
}
}
}


+ 7
- 11
linux/alsarawmidi/JackALSARawMidiDriver.cpp View File

@@ -68,9 +68,9 @@ JackALSARawMidiDriver::Attach()
for (int i = 0; i < fCaptureChannels; i++) {
JackALSARawMidiInputPort *input_port = input_ports[i];
name = input_port->GetName();
index = fGraphManager->AllocatePort(fClientControl.fRefNum, name,
JACK_DEFAULT_MIDI_TYPE,
CaptureDriverFlags, buffer_size);
fEngine->PortRegister(fClientControl.fRefNum, name,
JACK_DEFAULT_MIDI_TYPE,
CaptureDriverFlags, buffer_size, &index);
if (index == NO_PORT) {
jack_error("JackALSARawMidiDriver::Attach - cannot register input "
"port with name '%s'.", name);
@@ -85,8 +85,6 @@ JackALSARawMidiDriver::Attach()

jack_info("JackALSARawMidiDriver::Attach - input port registered "
"(name='%s', alias='%s').", name, alias);

fEngine->NotifyPortRegistration(index, true);
}
if (! fEngineControl->fSyncMode) {
latency += buffer_size;
@@ -96,9 +94,9 @@ JackALSARawMidiDriver::Attach()
for (int i = 0; i < fPlaybackChannels; i++) {
JackALSARawMidiOutputPort *output_port = output_ports[i];
name = output_port->GetName();
index = fGraphManager->AllocatePort(fClientControl.fRefNum, name,
JACK_DEFAULT_MIDI_TYPE,
PlaybackDriverFlags, buffer_size);
fEngine->PortRegister(fClientControl.fRefNum, name,
JACK_DEFAULT_MIDI_TYPE,
PlaybackDriverFlags, buffer_size, &index);
if (index == NO_PORT) {
jack_error("JackALSARawMidiDriver::Attach - cannot register "
"output port with name '%s'.", name);
@@ -113,8 +111,6 @@ JackALSARawMidiDriver::Attach()

jack_info("JackALSARawMidiDriver::Attach - output port registered "
"(name='%s', alias='%s').", name, alias);

fEngine->NotifyPortRegistration(index, true);
}
return 0;
}
@@ -158,7 +154,7 @@ JackALSARawMidiDriver::Execute()
// called. This means that the amount of time that passes between
// 'GetMicroSeconds()' and 'ppoll()' is time that will be lost
// while waiting for 'poll() to timeout.
//
//
// I tried to replace the timeout with a 'timerfd' with absolute
// times, but, strangely, it actually slowed things down, and made
// the code a lot more complicated.


+ 4
- 8
linux/firewire/JackFFADODriver.cpp View File

@@ -420,10 +420,10 @@ int JackFFADODriver::Attach()
if (driver->capture_channels[chn].stream_type == ffado_stream_type_audio) {
snprintf(buf, sizeof(buf) - 1, "firewire_pcm:%s_in", portname);
printMessage ("Registering audio capture port %s", buf);
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, buf,
if (fEngine->PortRegister(fClientControl.fRefNum, buf,
JACK_DEFAULT_AUDIO_TYPE,
CaptureDriverFlags,
fEngineControl->fBufferSize)) == NO_PORT) {
fEngineControl->fBufferSize, &port_index) < 0) {
jack_error("driver: cannot register port for %s", buf);
return -1;
}
@@ -444,15 +444,13 @@ int JackFFADODriver::Attach()
jack_log("JackFFADODriver::Attach fCapturePortList[i] %ld ", port_index);
fCaptureChannels++;

fEngine->NotifyPortRegistration(port_index, true);

} else if (driver->capture_channels[chn].stream_type == ffado_stream_type_midi) {
snprintf(buf, sizeof(buf) - 1, "firewire_pcm:%s_in", portname);
printMessage ("Registering midi capture port %s", buf);
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, buf,
if (fEngine->PortRegister(fClientControl.fRefNum, buf,
JACK_DEFAULT_MIDI_TYPE,
CaptureDriverFlags,
fEngineControl->fBufferSize)) == NO_PORT) {
fEngineControl->fBufferSize, &port_index) < 0) {
jack_error("driver: cannot register port for %s", buf);
return -1;
}
@@ -476,8 +474,6 @@ int JackFFADODriver::Attach()
jack_log("JackFFADODriver::Attach fCapturePortList[i] %ld ", port_index);
fCaptureChannels++;

fEngine->NotifyPortRegistration(port_index, true);

} else {
printMessage ("Don't register capture port %s", portname);
}


+ 4
- 8
linux/freebob/JackFreebobDriver.cpp View File

@@ -731,10 +731,10 @@ int JackFreebobDriver::Attach()
} else {
printMessage ("Registering capture port %s", buf);

if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, buf,
if (fEngine->PortRegister(fClientControl.fRefNum, buf,
JACK_DEFAULT_AUDIO_TYPE,
CaptureDriverFlags,
fEngineControl->fBufferSize)) == NO_PORT) {
fEngineControl->fBufferSize, &port_index) < 0) {
jack_error("driver: cannot register port for %s", buf);
return -1;
}
@@ -744,8 +744,6 @@ int JackFreebobDriver::Attach()
fCapturePortList[i] = port_index;
jack_log("JackFreebobDriver::Attach fCapturePortList[i] %ld ", port_index);
driver->capture_nchannels_audio++;

fEngine->NotifyPortRegistration(port_index, true);
}
}

@@ -762,10 +760,10 @@ int JackFreebobDriver::Attach()
printMessage ("Don't register playback port %s", buf);
} else {
printMessage ("Registering playback port %s", buf);
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, buf,
if (fEngine->PortRegister(fClientControl.fRefNum, buf,
JACK_DEFAULT_AUDIO_TYPE,
PlaybackDriverFlags,
fEngineControl->fBufferSize)) == NO_PORT) {
fEngineControl->fBufferSize, &port_index) < 0) {
jack_error("driver: cannot register port for %s", buf);
return -1;
}
@@ -776,8 +774,6 @@ int JackFreebobDriver::Attach()
fPlaybackPortList[i] = port_index;
jack_log("JackFreebobDriver::Attach fPlaybackPortList[i] %ld ", port_index);
driver->playback_nchannels_audio++;

fEngine->NotifyPortRegistration(port_index, true);
}
}



+ 3
- 6
macosx/coreaudio/JackCoreAudioDriver.cpp View File

@@ -1643,7 +1643,7 @@ int JackCoreAudioDriver::Attach()

snprintf(name, sizeof(name) - 1, "%s:capture_%d", fClientControl.fName, i + 1);

if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, CaptureDriverFlags, fEngineControl->fBufferSize)) == NO_PORT) {
if (fEngine->PortRegister(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, CaptureDriverFlags, fEngineControl->fBufferSize, &port_index) < 0) {
jack_error("Cannot register port for %s", name);
return -1;
}
@@ -1651,7 +1651,6 @@ int JackCoreAudioDriver::Attach()
port = fGraphManager->GetPort(port_index);
port->SetAlias(alias);
fCapturePortList[i] = port_index;
fEngine->NotifyPortRegistration(port_index, true);
}

for (int i = 0; i < fPlaybackChannels; i++) {
@@ -1670,7 +1669,7 @@ int JackCoreAudioDriver::Attach()

snprintf(name, sizeof(name) - 1, "%s:playback_%d", fClientControl.fName, i + 1);

if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, PlaybackDriverFlags, fEngineControl->fBufferSize)) == NO_PORT) {
if (fEngine->PortRegister(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, PlaybackDriverFlags, fEngineControl->fBufferSize, &port_index) < 0) {
jack_error("Cannot register port for %s", name);
return -1;
}
@@ -1678,18 +1677,16 @@ int JackCoreAudioDriver::Attach()
port = fGraphManager->GetPort(port_index);
port->SetAlias(alias);
fPlaybackPortList[i] = port_index;
fEngine->NotifyPortRegistration(port_index, true);

// Monitor ports
if (fWithMonitorPorts) {
jack_log("Create monitor port");
snprintf(name, sizeof(name) - 1, "%s:monitor_%u", fClientControl.fName, i + 1);
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, MonitorDriverFlags, fEngineControl->fBufferSize)) == NO_PORT) {
if (fEngine->PortRegister(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, MonitorDriverFlags, fEngineControl->fBufferSize, &port_index) < 0) {
jack_error("Cannot register monitor port for %s", name);
return -1;
} else {
fMonitorPortList[i] = port_index;
fEngine->NotifyPortRegistration(port_index, true);
}
}
}


+ 12
- 16
macosx/coremidi/JackCoreMidiDriver.cpp View File

@@ -94,9 +94,9 @@ JackCoreMidiDriver::Attach()
for (int i = 0; i < num_physical_inputs; i++) {
port_obj = physical_input_ports[i];
name = port_obj->GetName();
index = fGraphManager->AllocatePort(fClientControl.fRefNum, name,
JACK_DEFAULT_MIDI_TYPE,
CaptureDriverFlags, buffer_size);
fEngine->PortRegister(fClientControl.fRefNum, name,
JACK_DEFAULT_MIDI_TYPE,
CaptureDriverFlags, buffer_size, &index);
if (index == NO_PORT) {
jack_error("JackCoreMidiDriver::Attach - cannot register physical "
"input port with name '%s'.", name);
@@ -107,16 +107,15 @@ JackCoreMidiDriver::Attach()
port->SetAlias(port_obj->GetAlias());
port->SetLatencyRange(JackCaptureLatency, &latency_range);
fCapturePortList[i] = index;
fEngine->NotifyPortRegistration(index, true);
}

// Virtual inputs
for (int i = 0; i < num_virtual_inputs; i++) {
port_obj = virtual_input_ports[i];
name = port_obj->GetName();
index = fGraphManager->AllocatePort(fClientControl.fRefNum, name,
JACK_DEFAULT_MIDI_TYPE,
CaptureDriverFlags, buffer_size);
fEngine->PortRegister(fClientControl.fRefNum, name,
JACK_DEFAULT_MIDI_TYPE,
CaptureDriverFlags, buffer_size, &index);
if (index == NO_PORT) {
jack_error("JackCoreMidiDriver::Attach - cannot register virtual "
"input port with name '%s'.", name);
@@ -127,7 +126,6 @@ JackCoreMidiDriver::Attach()
port->SetAlias(port_obj->GetAlias());
port->SetLatencyRange(JackCaptureLatency, &latency_range);
fCapturePortList[num_physical_inputs + i] = index;
fEngine->NotifyPortRegistration(index, true);
}

if (! fEngineControl->fSyncMode) {
@@ -140,9 +138,9 @@ JackCoreMidiDriver::Attach()
for (int i = 0; i < num_physical_outputs; i++) {
port_obj = physical_output_ports[i];
name = port_obj->GetName();
index = fGraphManager->AllocatePort(fClientControl.fRefNum, name,
JACK_DEFAULT_MIDI_TYPE,
PlaybackDriverFlags, buffer_size);
fEngine->PortRegister(fClientControl.fRefNum, name,
JACK_DEFAULT_MIDI_TYPE,
PlaybackDriverFlags, buffer_size, &index);
if (index == NO_PORT) {
jack_error("JackCoreMidiDriver::Attach - cannot register physical "
"output port with name '%s'.", name);
@@ -153,16 +151,15 @@ JackCoreMidiDriver::Attach()
port->SetAlias(port_obj->GetAlias());
port->SetLatencyRange(JackPlaybackLatency, &latency_range);
fPlaybackPortList[i] = index;
fEngine->NotifyPortRegistration(index, true);
}

// Virtual outputs
for (int i = 0; i < num_virtual_outputs; i++) {
port_obj = virtual_output_ports[i];
name = port_obj->GetName();
index = fGraphManager->AllocatePort(fClientControl.fRefNum, name,
JACK_DEFAULT_MIDI_TYPE,
PlaybackDriverFlags, buffer_size);
fEngine->PortRegister(fClientControl.fRefNum, name,
JACK_DEFAULT_MIDI_TYPE,
PlaybackDriverFlags, buffer_size, &index);
if (index == NO_PORT) {
jack_error("JackCoreMidiDriver::Attach - cannot register virtual "
"output port with name '%s'.", name);
@@ -173,7 +170,6 @@ JackCoreMidiDriver::Attach()
port->SetAlias(port_obj->GetAlias());
port->SetLatencyRange(JackPlaybackLatency, &latency_range);
fPlaybackPortList[num_physical_outputs + i] = index;
fEngine->NotifyPortRegistration(index, true);
}

return 0;


Loading…
Cancel
Save