Commit 4a182fbd authored by sletz's avatar sletz
Browse files

Cleanup.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@4482 0c269be4-1314-0410-8aa9-9f06e86f4224
parent 2f143cb0
......@@ -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();
......
/*
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
......
/*
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
......
/*
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
......
/*
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
......
/*
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
......
/*
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
......
/*
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
......
/*
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
......
/*
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
......
/*
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
......
/*
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
......
/*
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();
......
/*
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
......
/*
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
......
/*
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 <stdlib.h>
#include "JackError.h"
#include <stdlib.h>
using namespace std;
......@@ -290,3 +290,4 @@ bool PortAudioDevices::IsDuplex ( PaDeviceIndex id )
//then the device isn't full duplex
return false;
}
/*
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
......
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