Commit e6913f96 authored by sletz's avatar sletz
Browse files

Dynamic allocation in ASIO JackRouter.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@4707 0c269be4-1314-0410-8aa9-9f06e86f4224
parent f11b3215
......@@ -306,6 +306,7 @@ namespace Jack
SessionParamsNToH(&net_params, &host_params);
}
while ((GetPacketType(&host_params) != START_MASTER) && (++attempt < SLAVE_SETUP_RETRY));
if (attempt == SLAVE_SETUP_RETRY) {
jack_error("Slave doesn't respond, exiting");
return false;
......@@ -354,16 +355,6 @@ namespace Jack
return false;
}
// set the new timeout for the socket
//float time = 3 * 1000000.f * (float(fParams.fPeriodSize) / float(fParams.fSampleRate));
/*
if (fSocket.SetTimeOut(PACKET_TIMEOUT) == SOCKET_ERROR) {
jack_error("Can't set rx timeout : %s", StrError(NET_ERROR_CODE));
goto error;
}
*/
// set the new rx buffer size
if (SetNetBufferSize() == SOCKET_ERROR) {
jack_error("Can't set net buffer sizes : %s", StrError(NET_ERROR_CODE));
......@@ -829,14 +820,6 @@ namespace Jack
jack_error("NetAudioBuffer allocation error...");
return false;
}
/*
if (fSocket.SetTimeOut(PACKET_TIMEOUT) == SOCKET_ERROR) {
jack_error("Can't set rx timeout : %s", StrError(NET_ERROR_CODE));
goto error;
}
*/
// set the new buffer sizes
if (SetNetBufferSize() == SOCKET_ERROR) {
......
......@@ -157,7 +157,6 @@ JackRouter::JackRouter() : AsioDriver()
#endif
{
long i;
fSamplePosition = 0;
fActive = false;
fStarted = false;
......@@ -166,23 +165,13 @@ JackRouter::JackRouter() : AsioDriver()
fClient = NULL;
fAutoConnectIn = true;
fAutoConnectOut = true;
for (i = 0; i < kNumInputs; i++) {
fInputBuffers[i] = 0;
fInputPorts[i] = 0;
fInMap[i] = 0;
}
for (i = 0; i < kNumOutputs; i++) {
fOutputBuffers[i] = 0;
fOutputPorts[i] = 0;
fOutMap[i] = 0;
}
fCallbacks = 0;
fActiveInputs = fActiveOutputs = 0;
fToggle = 0;
fBufferSize = 512;
fSampleRate = 44100;
printf("Constructor\n");
printf("Constructor\n");
// Use "jackrouter.ini" parameters if available
HMODULE handle = LoadLibrary(JACK_ROUTER);
......@@ -212,15 +201,46 @@ JackRouter::JackRouter() : AsioDriver()
} else {
printf("LoadLibrary error\n");
}
#ifdef LONG_SAMPLE
fInputBuffers = new long*[kNumInputs];
fOutputBuffers = new long*[kNumOutputs];
#else
fInputBuffers = new float*[kNumInputs];
fOutputBuffers = new float*[kNumOutputs];
#endif
fInMap = new long[kNumInputs];
fOutMap = new long[kNumOutputs];
fInputPorts new jack_port_t*[kNumInputs];
fOutputPorts new jack_port_t*[kNumOutputs];
for (i = 0; i < kNumInputs; i++) {
fInputBuffers[i] = 0;
fInputPorts[i] = 0;
fInMap[i] = 0;
}
for (i = 0; i < kNumOutputs; i++) {
fOutputBuffers[i] = 0;
fOutputPorts[i] = 0;
fOutMap[i] = 0;
}
}
//------------------------------------------------------------------------------------------
JackRouter::~JackRouter()
{
printf("Destructor\n");
stop ();
disposeBuffers ();
jack_client_close(fClient);
printf("Destructor\n");
delete[] fInputBuffers;
delete[] fOutputBuffers;
delete[] fInputPorts;
delete[] fOutputPorts;
delete[] fInMap;
delete[] fOutMap;
}
//------------------------------------------------------------------------------------------
......@@ -654,7 +674,6 @@ error:
fAsioTime.timeInfo.samplePosition.hi = fAsioTime.timeInfo.samplePosition.lo = 0;
fAsioTime.timeInfo.sampleRate = fSampleRate;
fAsioTime.timeInfo.flags = kSystemTimeValid | kSamplePositionValid | kSampleRateValid;
fAsioTime.timeCode.speed = 1.;
fAsioTime.timeCode.timeCodeSamples.lo = fAsioTime.timeCode.timeCodeSamples.hi = 0;
fAsioTime.timeCode.flags = kTcValid | kTcRunning ;
......
......@@ -46,7 +46,6 @@ static int kNumOutputs = 4;
#include "combase.h"
#include "iasiodrv.h"
#define MAX_PORTS 32
#define LONG_SAMPLE 1
#define PATH_SEP "\\"
......@@ -135,14 +134,14 @@ private:
ASIOTimeStamp fTheSystemTime;
#ifdef LONG_SAMPLE
long* fInputBuffers[MAX_PORTS * 2];
long* fOutputBuffers[MAX_PORTS * 2];
long** fInputBuffers;
long** fOutputBuffers;
#else
float* fInputBuffers[MAX_PORTS * 2];
float* fOutputBuffers[MAX_PORTS * 2];
float** fInputBuffers;
float** fOutputBuffers;
#endif
long fInMap[MAX_PORTS];
long fOutMap[MAX_PORTS];
long* fInMap;
long* fOutMap;
long fInputLatency;
long fOutputLatency;
......@@ -159,8 +158,8 @@ private:
// Jack part
jack_client_t* fClient;
jack_port_t* fInputPorts[MAX_PORTS];
jack_port_t* fOutputPorts[MAX_PORTS];
jack_port_t** fInputPorts;
jack_port_t** fOutputPorts;
long fBufferSize;
ASIOSampleRate fSampleRate;
......
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