diff --git a/common/JackAPI.cpp b/common/JackAPI.cpp index 03eb4d1d..0af76a6c 100644 --- a/common/JackAPI.cpp +++ b/common/JackAPI.cpp @@ -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) { #ifdef __CLIENTDEBUG__ - JackGlobals::CheckContext("jack_port_get_buffer"); + JackGlobals::CheckContext("jack_port_get_buffer_nulled"); #endif uintptr_t port_aux = (uintptr_t)port; jack_port_id_t myport = (jack_port_id_t)port_aux; 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; } else { JackGraphManager* manager = GetGraphManager(); diff --git a/common/JackNetAdapter.cpp b/common/JackNetAdapter.cpp index 855b8e19..7642fd58 100644 --- a/common/JackNetAdapter.cpp +++ b/common/JackNetAdapter.cpp @@ -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 it under the terms of the GNU General Public License as published by diff --git a/common/JackNetAdapter.h b/common/JackNetAdapter.h index d90a1d97..d76c8b1a 100644 --- a/common/JackNetAdapter.h +++ b/common/JackNetAdapter.h @@ -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 it under the terms of the GNU General Public License as published by diff --git a/common/JackNetDriver.cpp b/common/JackNetDriver.cpp index 26a3fc8a..3308e49a 100644 --- a/common/JackNetDriver.cpp +++ b/common/JackNetDriver.cpp @@ -1,6 +1,6 @@ /* 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 it under the terms of the GNU General Public License as published by diff --git a/common/JackNetDriver.h b/common/JackNetDriver.h index 1d19d860..f73337c7 100644 --- a/common/JackNetDriver.h +++ b/common/JackNetDriver.h @@ -1,6 +1,6 @@ /* 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 it under the terms of the GNU General Public License as published by diff --git a/common/JackNetInterface.cpp b/common/JackNetInterface.cpp index 3c665b18..438c7127 100644 --- a/common/JackNetInterface.cpp +++ b/common/JackNetInterface.cpp @@ -1,6 +1,6 @@ /* 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 it under the terms of the GNU General Public License as published by diff --git a/common/JackNetInterface.h b/common/JackNetInterface.h index 88f5b400..082292a2 100644 --- a/common/JackNetInterface.h +++ b/common/JackNetInterface.h @@ -1,6 +1,6 @@ /* 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 it under the terms of the GNU General Public License as published by diff --git a/common/JackNetManager.cpp b/common/JackNetManager.cpp index dbfdc5a6..89857923 100644 --- a/common/JackNetManager.cpp +++ b/common/JackNetManager.cpp @@ -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 it under the terms of the GNU General Public License as published by diff --git a/common/JackNetOneDriver.cpp b/common/JackNetOneDriver.cpp index 36b3b82b..a7bec4c6 100644 --- a/common/JackNetOneDriver.cpp +++ b/common/JackNetOneDriver.cpp @@ -1,6 +1,6 @@ /* 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 it under the terms of the GNU General Public License as published by diff --git a/common/JackNetOneDriver.h b/common/JackNetOneDriver.h index a38a612d..f0dfc165 100644 --- a/common/JackNetOneDriver.h +++ b/common/JackNetOneDriver.h @@ -1,6 +1,6 @@ /* 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 it under the terms of the GNU General Public License as published by diff --git a/common/JackNetSocket.h b/common/JackNetSocket.h index 7f950802..db349468 100644 --- a/common/JackNetSocket.h +++ b/common/JackNetSocket.h @@ -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 it under the terms of the GNU General Public License as published by diff --git a/common/JackNetTool.cpp b/common/JackNetTool.cpp index e1862364..6549d27c 100644 --- a/common/JackNetTool.cpp +++ b/common/JackNetTool.cpp @@ -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 it under the terms of the GNU General Public License as published by diff --git a/common/JackNetTool.h b/common/JackNetTool.h index c481769c..2f68f0b0 100644 --- a/common/JackNetTool.h +++ b/common/JackNetTool.h @@ -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 it under the terms of the GNU General Public License as published by @@ -307,6 +307,8 @@ namespace Jack struct JackPortList { + // "[---Header---|--audio data--|--audio data--]..." + jack_nframes_t fPeriodSize; jack_nframes_t fSubPeriodSize; size_t fSubPeriodBytesSize; @@ -494,6 +496,8 @@ namespace Jack struct JackOptimizedPortList : JackPortList { + // "[---Header---|--active_port_num---audio data--|--active_port_num---audio data--]..." + JackOptimizedPortList(session_params_t* params, uint32_t 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) { + // Init active port count port_num = 0; 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 { private: @@ -673,8 +639,8 @@ namespace Jack int fCompressedSizeByte; jack_nframes_t fPeriodSize; 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 fLastSubPeriodBytesSize; @@ -722,8 +688,8 @@ namespace Jack jack_nframes_t fPeriodSize; 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 fSubPeriodBytesSize; @@ -761,10 +727,48 @@ namespace Jack int RenderToNetwork(int sub_cycle, size_t total_size, uint32_t& port_num); }; - + /* #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 { @@ -809,7 +813,7 @@ namespace Jack }; */ -//utility ************************************************************************************* + //utility ************************************************************************************* //socket API management SERVER_EXPORT int SocketAPIInit(); diff --git a/posix/JackNetUnixSocket.cpp b/posix/JackNetUnixSocket.cpp index 14868697..0512903e 100644 --- a/posix/JackNetUnixSocket.cpp +++ b/posix/JackNetUnixSocket.cpp @@ -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 it under the terms of the GNU General Public License as published by diff --git a/posix/JackNetUnixSocket.h b/posix/JackNetUnixSocket.h index 10fc2331..a1be3b02 100644 --- a/posix/JackNetUnixSocket.h +++ b/posix/JackNetUnixSocket.h @@ -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 it under the terms of the GNU General Public License as published by diff --git a/windows/portaudio/JackPortAudioDevices.cpp b/windows/portaudio/JackPortAudioDevices.cpp index d7b8395c..364cbabe 100644 --- a/windows/portaudio/JackPortAudioDevices.cpp +++ b/windows/portaudio/JackPortAudioDevices.cpp @@ -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 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 "JackError.h" -#include +#include "JackError.h" +#include using namespace std; @@ -290,3 +290,4 @@ bool PortAudioDevices::IsDuplex ( PaDeviceIndex id ) //then the device isn't full duplex return false; } + diff --git a/windows/portaudio/JackPortAudioDevices.h b/windows/portaudio/JackPortAudioDevices.h index c8ab656b..a11d8b45 100644 --- a/windows/portaudio/JackPortAudioDevices.h +++ b/windows/portaudio/JackPortAudioDevices.h @@ -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 it under the terms of the GNU General Public License as published by