git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@4482 0c269be4-1314-0410-8aa9-9f06e86f4224tags/1.9.8
@@ -353,12 +353,12 @@ EXPORT void* jack_port_get_buffer(jack_port_t* port, jack_nframes_t frames) | |||||
EXPORT void* jack_port_get_buffer_nulled(jack_port_t* port, jack_nframes_t frames) | EXPORT void* jack_port_get_buffer_nulled(jack_port_t* port, jack_nframes_t frames) | ||||
{ | { | ||||
#ifdef __CLIENTDEBUG__ | #ifdef __CLIENTDEBUG__ | ||||
JackGlobals::CheckContext("jack_port_get_buffer"); | |||||
JackGlobals::CheckContext("jack_port_get_buffer_nulled"); | |||||
#endif | #endif | ||||
uintptr_t port_aux = (uintptr_t)port; | uintptr_t port_aux = (uintptr_t)port; | ||||
jack_port_id_t myport = (jack_port_id_t)port_aux; | jack_port_id_t myport = (jack_port_id_t)port_aux; | ||||
if (!CheckPort(myport)) { | if (!CheckPort(myport)) { | ||||
jack_error("jack_port_get_buffer called with an incorrect port %ld", myport); | |||||
jack_error("jack_port_get_buffer_nulled called with an incorrect port %ld", myport); | |||||
return NULL; | return NULL; | ||||
} else { | } else { | ||||
JackGraphManager* manager = GetGraphManager(); | JackGraphManager* manager = GetGraphManager(); | ||||
@@ -1,5 +1,5 @@ | |||||
/* | /* | ||||
Copyright (C) 2008 Romain Moret at Grame | |||||
Copyright (C) 2008-2011 Romain Moret at Grame | |||||
This program is free software; you can redistribute it and/or modify | 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 | it under the terms of the GNU General Public License as published by | ||||
@@ -1,5 +1,5 @@ | |||||
/* | /* | ||||
Copyright (C) 2008 Romain Moret at Grame | |||||
Copyright (C) 2008-2011 Romain Moret at Grame | |||||
This program is free software; you can redistribute it and/or modify | 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 | it under the terms of the GNU General Public License as published by | ||||
@@ -1,6 +1,6 @@ | |||||
/* | /* | ||||
Copyright (C) 2001 Paul Davis | Copyright (C) 2001 Paul Davis | ||||
Copyright (C) 2008 Romain Moret at Grame | |||||
Copyright (C) 2008-2011 Romain Moret at Grame | |||||
This program is free software; you can redistribute it and/or modify | 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 | it under the terms of the GNU General Public License as published by | ||||
@@ -1,6 +1,6 @@ | |||||
/* | /* | ||||
Copyright (C) 2001 Paul Davis | Copyright (C) 2001 Paul Davis | ||||
Copyright (C) 2008 Romain Moret at Grame | |||||
Copyright (C) 2008-2011 Romain Moret at Grame | |||||
This program is free software; you can redistribute it and/or modify | 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 | it under the terms of the GNU General Public License as published by | ||||
@@ -1,6 +1,6 @@ | |||||
/* | /* | ||||
Copyright (C) 2001 Paul Davis | Copyright (C) 2001 Paul Davis | ||||
Copyright (C) 2008 Romain Moret at Grame | |||||
Copyright (C) 2008-2011 Romain Moret at Grame | |||||
This program is free software; you can redistribute it and/or modify | 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 | it under the terms of the GNU General Public License as published by | ||||
@@ -1,6 +1,6 @@ | |||||
/* | /* | ||||
Copyright (C) 2001 Paul Davis | Copyright (C) 2001 Paul Davis | ||||
Copyright (C) 2008 Romain Moret at Grame | |||||
Copyright (C) 2008-2011 Romain Moret at Grame | |||||
This program is free software; you can redistribute it and/or modify | 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 | it under the terms of the GNU General Public License as published by | ||||
@@ -1,5 +1,5 @@ | |||||
/* | /* | ||||
Copyright (C) 2008 Romain Moret at Grame | |||||
Copyright (C) 2008-2011 Romain Moret at Grame | |||||
This program is free software; you can redistribute it and/or modify | 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 | it under the terms of the GNU General Public License as published by | ||||
@@ -1,6 +1,6 @@ | |||||
/* | /* | ||||
Copyright (C) 2001 Paul Davis | Copyright (C) 2001 Paul Davis | ||||
Copyright (C) 2008 Romain Moret at Grame | |||||
Copyright (C) 2008-2011 Romain Moret at Grame | |||||
This program is free software; you can redistribute it and/or modify | 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 | it under the terms of the GNU General Public License as published by | ||||
@@ -1,6 +1,6 @@ | |||||
/* | /* | ||||
Copyright (C) 2001 Paul Davis | Copyright (C) 2001 Paul Davis | ||||
Copyright (C) 2008 Romain Moret at Grame | |||||
Copyright (C) 2008-2011 Romain Moret at Grame | |||||
This program is free software; you can redistribute it and/or modify | 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 | it under the terms of the GNU General Public License as published by | ||||
@@ -1,5 +1,5 @@ | |||||
/* | /* | ||||
Copyright (C) 2008 Romain Moret at Grame | |||||
Copyright (C) 2008-2011 Romain Moret at Grame | |||||
This program is free software; you can redistribute it and/or modify | 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 | it under the terms of the GNU General Public License as published by | ||||
@@ -1,5 +1,5 @@ | |||||
/* | /* | ||||
Copyright (C) 2008 Romain Moret at Grame | |||||
Copyright (C) 2008-2011 Romain Moret at Grame | |||||
This program is free software; you can redistribute it and/or modify | 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 | it under the terms of the GNU General Public License as published by | ||||
@@ -1,5 +1,5 @@ | |||||
/* | /* | ||||
Copyright(C) 2008 Romain Moret at Grame | |||||
Copyright (C) 2008-2011 Romain Moret at Grame | |||||
This program is free software; you can redistribute it and/or modify | 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 | it under the terms of the GNU General Public License as published by | ||||
@@ -307,6 +307,8 @@ namespace Jack | |||||
struct JackPortList { | struct JackPortList { | ||||
// "[---Header---|--audio data--|--audio data--]..." | |||||
jack_nframes_t fPeriodSize; | jack_nframes_t fPeriodSize; | ||||
jack_nframes_t fSubPeriodSize; | jack_nframes_t fSubPeriodSize; | ||||
size_t fSubPeriodBytesSize; | size_t fSubPeriodBytesSize; | ||||
@@ -494,6 +496,8 @@ namespace Jack | |||||
struct JackOptimizedPortList : JackPortList { | struct JackOptimizedPortList : JackPortList { | ||||
// "[---Header---|--active_port_num---audio data--|--active_port_num---audio data--]..." | |||||
JackOptimizedPortList(session_params_t* params, uint32_t nports) | JackOptimizedPortList(session_params_t* params, uint32_t nports) | ||||
:JackPortList(params, nports) | :JackPortList(params, nports) | ||||
{} | {} | ||||
@@ -558,6 +562,7 @@ namespace Jack | |||||
virtual int RenderToNetwork(char* net_buffer,int sub_cycle, size_t total_size, uint32_t& port_num) | virtual int RenderToNetwork(char* net_buffer,int sub_cycle, size_t total_size, uint32_t& port_num) | ||||
{ | { | ||||
// Init active port count | |||||
port_num = 0; | port_num = 0; | ||||
for (int port_index = 0; port_index < fNPorts; port_index++) { | for (int port_index = 0; port_index < fNPorts; port_index++) { | ||||
@@ -577,45 +582,6 @@ namespace Jack | |||||
}; | }; | ||||
struct JackPortListAllocate : public JackPortList { | |||||
JackPortListAllocate() | |||||
{ | |||||
fNPorts = 0; | |||||
fPeriodSize = 0; | |||||
fSubPeriodSize = 0; | |||||
fSubPeriodBytesSize = 0; | |||||
fPortBuffer = 0; | |||||
} | |||||
~JackPortListAllocate() | |||||
{ | |||||
for (int port_index = 0; port_index < fNPorts; port_index++) | |||||
delete [] fPortBuffer[port_index]; | |||||
delete [] fPortBuffer; | |||||
} | |||||
void Init(session_params_t* params, uint32_t nports) | |||||
{ | |||||
fNPorts = nports; | |||||
fPeriodSize = params->fPeriodSize; | |||||
if (params->fSendAudioChannels == 0 && params->fReturnAudioChannels == 0) { | |||||
fSubPeriodSize = params->fPeriodSize; | |||||
} else { | |||||
jack_nframes_t period = (int) powf(2.f, (int)(log(float((params->fMtu - sizeof(packet_header_t))) | |||||
/ (max(params->fReturnAudioChannels, params->fSendAudioChannels) * sizeof(sample_t))) / log(2.))); | |||||
fSubPeriodSize = (period > params->fPeriodSize) ? params->fPeriodSize : period; | |||||
} | |||||
fSubPeriodBytesSize = fSubPeriodSize * sizeof(sample_t); | |||||
fPortBuffer = new sample_t* [fNPorts]; | |||||
for (int port_index = 0; port_index < fNPorts; port_index++) | |||||
fPortBuffer[port_index] = new sample_t[fPeriodSize]; | |||||
} | |||||
}; | |||||
class SERVER_EXPORT NetFloatAudioBuffer : public NetAudioBuffer | class SERVER_EXPORT NetFloatAudioBuffer : public NetAudioBuffer | ||||
{ | { | ||||
private: | private: | ||||
@@ -673,8 +639,8 @@ namespace Jack | |||||
int fCompressedSizeByte; | int fCompressedSizeByte; | ||||
jack_nframes_t fPeriodSize; | jack_nframes_t fPeriodSize; | ||||
int fNumPackets; | int fNumPackets; | ||||
float fCycleDuration; // in sec | |||||
size_t fCycleSize; // needed size in bytes for an entire cycle | |||||
float fCycleDuration; // in sec | |||||
size_t fCycleSize; // needed size in bytes for an entire cycle | |||||
size_t fSubPeriodBytesSize; | size_t fSubPeriodBytesSize; | ||||
size_t fLastSubPeriodBytesSize; | size_t fLastSubPeriodBytesSize; | ||||
@@ -722,8 +688,8 @@ namespace Jack | |||||
jack_nframes_t fPeriodSize; | jack_nframes_t fPeriodSize; | ||||
int fNumPackets; | int fNumPackets; | ||||
float fCycleDuration; // in sec | |||||
size_t fCycleSize; // needed size in bytes for an entire cycle | |||||
float fCycleDuration; // in sec | |||||
size_t fCycleSize; // needed size in bytes for an entire cycle | |||||
size_t fSubPeriodSize; | size_t fSubPeriodSize; | ||||
size_t fSubPeriodBytesSize; | size_t fSubPeriodBytesSize; | ||||
@@ -761,10 +727,48 @@ namespace Jack | |||||
int RenderToNetwork(int sub_cycle, size_t total_size, uint32_t& port_num); | int RenderToNetwork(int sub_cycle, size_t total_size, uint32_t& port_num); | ||||
}; | }; | ||||
/* | |||||
#define AUDIO_BUFFER_SIZE 8 | #define AUDIO_BUFFER_SIZE 8 | ||||
/* | |||||
struct JackPortListAllocate : public JackPortList { | |||||
JackPortListAllocate() | |||||
{ | |||||
fNPorts = 0; | |||||
fPeriodSize = 0; | |||||
fSubPeriodSize = 0; | |||||
fSubPeriodBytesSize = 0; | |||||
fPortBuffer = 0; | |||||
} | |||||
~JackPortListAllocate() | |||||
{ | |||||
for (int port_index = 0; port_index < fNPorts; port_index++) | |||||
delete [] fPortBuffer[port_index]; | |||||
delete [] fPortBuffer; | |||||
} | |||||
void Init(session_params_t* params, uint32_t nports) | |||||
{ | |||||
fNPorts = nports; | |||||
fPeriodSize = params->fPeriodSize; | |||||
if (params->fSendAudioChannels == 0 && params->fReturnAudioChannels == 0) { | |||||
fSubPeriodSize = params->fPeriodSize; | |||||
} else { | |||||
jack_nframes_t period = (int) powf(2.f, (int)(log(float((params->fMtu - sizeof(packet_header_t))) | |||||
/ (max(params->fReturnAudioChannels, params->fSendAudioChannels) * sizeof(sample_t))) / log(2.))); | |||||
fSubPeriodSize = (period > params->fPeriodSize) ? params->fPeriodSize : period; | |||||
} | |||||
fSubPeriodBytesSize = fSubPeriodSize * sizeof(sample_t); | |||||
fPortBuffer = new sample_t* [fNPorts]; | |||||
for (int port_index = 0; port_index < fNPorts; port_index++) | |||||
fPortBuffer[port_index] = new sample_t[fPeriodSize]; | |||||
} | |||||
}; | |||||
class SERVER_EXPORT NetBufferedAudioBuffer : public NetAudioBuffer | class SERVER_EXPORT NetBufferedAudioBuffer : public NetAudioBuffer | ||||
{ | { | ||||
@@ -809,7 +813,7 @@ namespace Jack | |||||
}; | }; | ||||
*/ | */ | ||||
//utility ************************************************************************************* | |||||
//utility ************************************************************************************* | |||||
//socket API management | //socket API management | ||||
SERVER_EXPORT int SocketAPIInit(); | SERVER_EXPORT int SocketAPIInit(); | ||||
@@ -1,5 +1,5 @@ | |||||
/* | /* | ||||
Copyright (C) 2008 Romain Moret at Grame | |||||
Copyright (C) 2008-2011 Romain Moret at Grame | |||||
This program is free software; you can redistribute it and/or modify | 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 | it under the terms of the GNU General Public License as published by | ||||
@@ -1,5 +1,5 @@ | |||||
/* | /* | ||||
Copyright (C) 2008 Romain Moret at Grame | |||||
Copyright (C) 2008-2011 Romain Moret at Grame | |||||
This program is free software; you can redistribute it and/or modify | 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 | it under the terms of the GNU General Public License as published by | ||||
@@ -1,5 +1,5 @@ | |||||
/* | /* | ||||
Copyright (C) 2008 Romain Moret at Grame | |||||
Copyright (C) 2008-2011 Romain Moret at Grame | |||||
This program is free software; you can redistribute it and/or modify | 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 | it under the terms of the GNU General Public License as published by | ||||
@@ -18,8 +18,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||||
*/ | */ | ||||
#include "JackPortAudioDevices.h" | #include "JackPortAudioDevices.h" | ||||
#include "JackError.h" | |||||
#include <stdlib.h> | |||||
#include "JackError.h" | |||||
#include <stdlib.h> | |||||
using namespace std; | using namespace std; | ||||
@@ -290,3 +290,4 @@ bool PortAudioDevices::IsDuplex ( PaDeviceIndex id ) | |||||
//then the device isn't full duplex | //then the device isn't full duplex | ||||
return false; | return false; | ||||
} | } | ||||
@@ -1,5 +1,5 @@ | |||||
/* | /* | ||||
Copyright (C) 2008 Romain Moret at Grame | |||||
Copyright (C) 2008-2011 Romain Moret at Grame | |||||
This program is free software; you can redistribute it and/or modify | 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 | it under the terms of the GNU General Public License as published by | ||||