Commit 137db10d authored by sletz's avatar sletz
Browse files

Correct Alsa driver

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@1536 0c269be4-1314-0410-8aa9-9f06e86f4224
parent 1231a5d8
......@@ -5,11 +5,11 @@ Copyright (C) 2004-2006 Grame
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
(at your option) any later version.
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
......@@ -90,8 +90,8 @@ int JackAudioDriver::Attach()
jack_error("driver: cannot register port for %s", buf);
return -1;
}
port = fGraphManager->GetPort(port_index);
port->Rename("system:capture_%d", i + 1);
port = fGraphManager->GetPort(port_index);
port->Rename("system:capture_%d", i + 1);
port->SetLatency(fEngineControl->fBufferSize + fCaptureLatency);
fCapturePortList[i] = port_index;
JackLog("JackAudioDriver::Attach fCapturePortList[i] %ld = \n", port_index);
......@@ -105,12 +105,12 @@ int JackAudioDriver::Attach()
jack_error("driver: cannot register port for %s", buf);
return -1;
}
port = fGraphManager->GetPort(port_index);
port->Rename("system:playback_%d", i + 1);
port = fGraphManager->GetPort(port_index);
port->Rename("system:playback_%d", i + 1);
port->SetLatency(fEngineControl->fBufferSize + fPlaybackLatency);
fPlaybackPortList[i] = port_index;
JackLog("JackAudioDriver::Attach fPlaybackPortList[i] %ld = \n", port_index);
// Monitor ports
if (fWithMonitorPorts) {
JackLog("Create monitor port \n");
......
......@@ -124,7 +124,7 @@ struct JackClientCheckRequest : public JackRequest
{
char fName[JACK_CLIENT_NAME_SIZE + 1];
int fOptions;
int fOptions;
JackClientCheckRequest()
{}
......@@ -453,7 +453,7 @@ struct JackPortConnectNameRequest : public JackRequest
{
CheckRes(trans->Read(&fRefNum, sizeof(int)));
CheckRes(trans->Read(&fSrc, JACK_PORT_NAME_SIZE + 1));
CheckRes(trans->Read(&fDst,JACK_PORT_NAME_SIZE + 1));
CheckRes(trans->Read(&fDst, JACK_PORT_NAME_SIZE + 1));
return 0;
}
......
......@@ -2081,7 +2081,7 @@ int JackAlsaDriver::Attach()
assert(fCaptureChannels < PORT_NUM);
assert(fPlaybackChannels < PORT_NUM);
alsa_driver_t* alsa_driver = (alsa_driver_t*)fDriver;
alsa_driver_t* alsa_driver = (alsa_driver_t*)fDriver;
JackLog("JackAudioDriver::Attach fBufferSize %ld fSampleRate %ld\n", fEngineControl->fBufferSize, fEngineControl->fSampleRate);
......@@ -2092,6 +2092,7 @@ int JackAlsaDriver::Attach()
return -1;
}
port = fGraphManager->GetPort(port_index);
port->Rename("system:capture_%d", i + 1);
port->SetLatency(alsa_driver->frames_per_cycle + alsa_driver->capture_frame_latency);
fCapturePortList[i] = port_index;
JackLog("JackAudioDriver::Attach fCapturePortList[i] %ld \n", port_index);
......@@ -2106,22 +2107,23 @@ int JackAlsaDriver::Attach()
return -1;
}
port = fGraphManager->GetPort(port_index);
port->Rename("system:playback_%d", i + 1);
port->SetLatency((alsa_driver->frames_per_cycle * (alsa_driver->user_nperiods - 1)) + alsa_driver->playback_frame_latency);
fPlaybackPortList[i] = port_index;
JackLog("JackAudioDriver::Attach fPlaybackPortList[i] %ld \n", port_index);
// Monitor ports
if (fWithMonitorPorts) {
JackLog("Create monitor port \n");
snprintf(buf, sizeof(buf) - 1, "%s:monitor_%lu",fClientControl->fName, i + 1);
if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, buf, JackPortIsOutput)) == NO_PORT) {
jack_error ("ALSA: cannot register monitor port for %s", buf);
} else {
port = fGraphManager->GetPort(port_index);
port->SetLatency(alsa_driver->frames_per_cycle);
fMonitorPortList[i] = port_index;
}
// Monitor ports
if (fWithMonitorPorts) {
JackLog("Create monitor port \n");
snprintf(buf, sizeof(buf) - 1, "%s:monitor_%lu",fClientControl->fName, i + 1);
if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, buf, JackPortIsOutput)) == NO_PORT) {
jack_error ("ALSA: cannot register monitor port for %s", buf);
} else {
port = fGraphManager->GetPort(port_index);
port->SetLatency(alsa_driver->frames_per_cycle);
fMonitorPortList[i] = port_index;
}
}
}
return 0;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment