Commit c40a4ad3 authored by sletz's avatar sletz
Browse files

NetJack2 now only send data on network only is ports are connected both sides.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@4485 0c269be4-1314-0410-8aa9-9f06e86f4224
parent b5f18d53
......@@ -35,6 +35,10 @@ Chris Caudle
Jackdmp changes log
---------------------------
2011-07-12 Stephane Letz <letz@grame.fr>
* NetJack2 now only send data on network only is ports are connected both sides.
2011-07-11 Stephane Letz <letz@grame.fr>
* Add JACK_NETJACK_PORT and JACK_NETJACK_MULTICAST environment variables for NetJack2.
......
......@@ -180,13 +180,16 @@ void* JackGraphManager::GetBuffer(jack_port_id_t port_index, jack_nframes_t buff
return GetBuffer(0); // port_index 0 is not used
}
jack_int_t len = manager->Connections(port_index);
// Output port
if (port->fFlags & JackPortIsOutput) {
return (port->fTied != NO_PORT) ? GetBuffer(port->fTied, buffer_size) : GetBuffer(port_index);
}
// Input port
jack_int_t len = manager->Connections(port_index);
if (port->fTied != NO_PORT) {
return GetBuffer(port->fTied, buffer_size);
} else {
return (len == 0 && nulled) ? NULL : GetBuffer(port_index);
}
}
// No connections : return a zero-filled buffer
if (len == 0) {
......
......@@ -521,18 +521,17 @@ namespace Jack
//driver processes--------------------------------------------------------------------
int JackNetDriver::Read()
{
int midi_port_index;
int audio_port_index;
//buffers
for (midi_port_index = 0; midi_port_index < fParams.fSendMidiChannels; midi_port_index++)
for (int midi_port_index = 0; midi_port_index < fParams.fSendMidiChannels; midi_port_index++) {
fNetMidiCaptureBuffer->SetBuffer(midi_port_index, GetMidiInputBuffer(midi_port_index));
for (audio_port_index = 0; audio_port_index < fParams.fSendAudioChannels; audio_port_index++)
}
for (int audio_port_index = 0; audio_port_index < fParams.fSendAudioChannels; audio_port_index++) {
#ifdef OPTIMIZED_PROTOCOL
fNetAudioCaptureBuffer->SetBuffer(audio_port_index, GetInputBuffer(audio_port_index, true));
#else
fNetAudioCaptureBuffer->SetBuffer(audio_port_index, GetInputBuffer(audio_port_index));
#endif
}
#ifdef JACK_MONITOR
fNetTimeMon->New();
......@@ -570,18 +569,22 @@ namespace Jack
int JackNetDriver::Write()
{
int midi_port_index;
int audio_port_index;
//buffers
for (midi_port_index = 0; midi_port_index < fParams.fReturnMidiChannels; midi_port_index++)
for (int midi_port_index = 0; midi_port_index < fParams.fReturnMidiChannels; midi_port_index++) {
fNetMidiPlaybackBuffer->SetBuffer(midi_port_index, GetMidiOutputBuffer(midi_port_index));
for (audio_port_index = 0; audio_port_index < fPlaybackChannels; audio_port_index++)
}
for (int audio_port_index = 0; audio_port_index < fPlaybackChannels; audio_port_index++) {
#ifdef OPTIMIZED_PROTOCOL
fNetAudioPlaybackBuffer->SetBuffer(audio_port_index, GetOutputBuffer(audio_port_index, true));
// Port is connected on other side..
if ((long)fNetAudioPlaybackBuffer->GetBuffer(audio_port_index) == -1) {
fNetAudioPlaybackBuffer->SetBuffer(audio_port_index, GetOutputBuffer(audio_port_index, true));
} else {
fNetAudioPlaybackBuffer->SetBuffer(audio_port_index, NULL);
}
#else
fNetAudioPlaybackBuffer->SetBuffer(audio_port_index, GetOutputBuffer(audio_port_index));
#endif
}
#ifdef JACK_MONITOR
fNetTimeMon->Add(((float) (GetMicroSeconds() - fRcvSyncUst) / (float)fEngineControl->fPeriodUsecs) * 100.f);
......@@ -595,7 +598,7 @@ namespace Jack
return SOCKET_ERROR;
#ifdef JACK_MONITOR
fNetTimeMon->Add(((float)(GetMicroSeconds() - fRcvSyncUst) / (float) fEngineControl->fPeriodUsecs) * 100.f);
fNetTimeMon->Add(((float)(GetMicroSeconds() - fRcvSyncUst) / (float)fEngineControl->fPeriodUsecs) * 100.f);
#endif
//send data
......@@ -603,7 +606,7 @@ namespace Jack
return SOCKET_ERROR;
#ifdef JACK_MONITOR
fNetTimeMon->AddLast(((float)(GetMicroSeconds() - fRcvSyncUst) / (float) fEngineControl->fPeriodUsecs) * 100.f);
fNetTimeMon->AddLast(((float)(GetMicroSeconds() - fRcvSyncUst) / (float)fEngineControl->fPeriodUsecs) * 100.f);
#endif
return 0;
......
......@@ -417,10 +417,15 @@ namespace Jack
fTxHeader.fCycle++;
fTxHeader.fSubCycle = 0;
fTxHeader.fDataType = 's';
fTxHeader.fIsLastPckt = (fParams.fSendMidiChannels == 0 && fParams.fSendAudioChannels == 0) ? 1 : 0;
fTxHeader.fIsLastPckt = (fParams.fSendMidiChannels == 0 && fParams.fSendAudioChannels == 0) ? 1 : 0;
fTxHeader.fPacketSize = fParams.fMtu;
// Write active ports list
if (fNetAudioPlaybackBuffer)
fNetAudioPlaybackBuffer->ActivePortsToNetwork(fTxData, fTxHeader.fActivePorts);
memcpy(fTxBuffer, &fTxHeader, HEADER_SIZE);
//PacketHeaderDisplay(&fTxHeader);
return Send(fTxHeader.fPacketSize, 0);
}
......@@ -455,7 +460,7 @@ namespace Jack
for (subproc = 0; subproc < fTxHeader.fNumPacket; subproc++) {
fTxHeader.fSubCycle = subproc;
fTxHeader.fIsLastPckt = (subproc == (fTxHeader.fNumPacket - 1)) ? 1 : 0;
fTxHeader.fPacketSize = HEADER_SIZE + fNetAudioCaptureBuffer->RenderToNetwork(subproc,fTxHeader.fActivePorts);
fTxHeader.fPacketSize = HEADER_SIZE + fNetAudioCaptureBuffer->RenderToNetwork(subproc, fTxHeader.fActivePorts);
memcpy(fTxBuffer, &fTxHeader, HEADER_SIZE);
//PacketHeaderDisplay(&fTxHeader);
if (Send(fTxHeader.fPacketSize, 0) == SOCKET_ERROR)
......@@ -478,6 +483,10 @@ namespace Jack
fCycleOffset = fTxHeader.fCycle - rx_head->fCycle;
// Read active ports list
if (fNetAudioCaptureBuffer)
fNetAudioCaptureBuffer->ActivePortsFromNetwork(fRxData, rx_head->fActivePorts);
switch (fParams.fNetworkMode)
{
case 's' :
......@@ -928,6 +937,10 @@ namespace Jack
}
while ((strcmp(rx_head->fPacketType, "header") != 0) && (rx_head->fDataType != 's'));
// Read active ports list
if (fNetAudioPlaybackBuffer)
fNetAudioPlaybackBuffer->ActivePortsFromNetwork(fRxData, rx_head->fActivePorts);
fRxHeader.fIsLastPckt = rx_head->fIsLastPckt;
return rx_bytes;
}
......@@ -997,6 +1010,10 @@ namespace Jack
fTxHeader.fIsLastPckt = (fParams.fReturnMidiChannels == 0 && fParams.fReturnAudioChannels == 0) ? 1 : 0;
fTxHeader.fPacketSize = fParams.fMtu;
// Write active ports list
if (fNetAudioCaptureBuffer)
fNetAudioCaptureBuffer->ActivePortsToNetwork(fTxData, fTxHeader.fActivePorts);
memcpy(fTxBuffer, &fTxHeader, HEADER_SIZE);
return Send(fTxHeader.fPacketSize, 0);
}
......@@ -1024,6 +1041,7 @@ namespace Jack
//audio
if (fParams.fReturnAudioChannels > 0) {
fTxHeader.fDataType = 'a';
fNetAudioPlaybackBuffer->RenderFromJackPorts();
fTxHeader.fNumPacket = fNetAudioPlaybackBuffer->GetNumPackets();
......
......@@ -423,42 +423,43 @@ namespace Jack
#endif
//buffers
for (int port_index = 0; port_index < fParams.fSendMidiChannels; port_index++) {
fNetMidiCaptureBuffer->SetBuffer(port_index,
static_cast<JackMidiBuffer*>(jack_port_get_buffer(fMidiCapturePorts[port_index],
for (int midi_port_index = 0; midi_port_index < fParams.fSendMidiChannels; midi_port_index++) {
fNetMidiCaptureBuffer->SetBuffer(midi_port_index,
static_cast<JackMidiBuffer*>(jack_port_get_buffer(fMidiCapturePorts[midi_port_index],
fParams.fPeriodSize)));
}
for (int port_index = 0; port_index < fParams.fSendAudioChannels; port_index++) {
for (int audio_port_index = 0; audio_port_index < fParams.fSendAudioChannels; audio_port_index++) {
#ifdef OPTIMIZED_PROTOCOL
fNetAudioCaptureBuffer->SetBuffer(port_index,
static_cast<sample_t*>(jack_port_get_buffer_nulled(fAudioCapturePorts[port_index],
if ((long)fNetAudioCaptureBuffer->GetBuffer(audio_port_index) == -1) {
fNetAudioCaptureBuffer->SetBuffer(audio_port_index,
static_cast<sample_t*>(jack_port_get_buffer_nulled(fAudioCapturePorts[audio_port_index],
fParams.fPeriodSize)));
} else {
fNetAudioCaptureBuffer->SetBuffer(audio_port_index, NULL);
}
#else
fNetAudioCaptureBuffer->SetBuffer(port_index,
static_cast<sample_t*>(jack_port_get_buffer(fAudioCapturePorts[port_index],
fNetAudioCaptureBuffer->SetBuffer(audio_port_index,
static_cast<sample_t*>(jack_port_get_buffer(fAudioCapturePorts[audio_port_index],
fParams.fPeriodSize)));
#endif
// TODO
}
for (int port_index = 0; port_index < fParams.fReturnMidiChannels; port_index++) {
fNetMidiPlaybackBuffer->SetBuffer(port_index,
static_cast<JackMidiBuffer*>(jack_port_get_buffer(fMidiPlaybackPorts[port_index],
for (int midi_port_index = 0; midi_port_index < fParams.fReturnMidiChannels; midi_port_index++) {
fNetMidiPlaybackBuffer->SetBuffer(midi_port_index,
static_cast<JackMidiBuffer*>(jack_port_get_buffer(fMidiPlaybackPorts[midi_port_index],
fParams.fPeriodSize)));
}
for (int port_index = 0; port_index < fParams.fReturnAudioChannels; port_index++) {
/*
*/
for (int audio_port_index = 0; audio_port_index < fParams.fReturnAudioChannels; audio_port_index++) {
#ifdef OPTIMIZED_PROTOCOL
fNetAudioPlaybackBuffer->SetBuffer(port_index,
static_cast<sample_t*>(jack_port_get_buffer_nulled(fAudioPlaybackPorts[port_index],
fNetAudioPlaybackBuffer->SetBuffer(audio_port_index,
static_cast<sample_t*>(jack_port_get_buffer_nulled(fAudioPlaybackPorts[audio_port_index],
fParams.fPeriodSize)));
#else
fNetAudioPlaybackBuffer->SetBuffer(port_index,
static_cast<sample_t*>(jack_port_get_buffer(fAudioPlaybackPorts[port_index],
fNetAudioPlaybackBuffer->SetBuffer(audio_port_index,
static_cast<sample_t*>(jack_port_get_buffer(fAudioPlaybackPorts[audio_port_index],
fParams.fPeriodSize)));
#endif
}
......
......@@ -180,10 +180,9 @@ namespace Jack
}
}
int NetMidiBuffer::RenderFromNetwork(int sub_cycle, size_t copy_size)
void NetMidiBuffer::RenderFromNetwork(int sub_cycle, size_t copy_size)
{
memcpy(fBuffer + sub_cycle * fMaxPcktSize, fNetBuffer, copy_size);
return copy_size;
}
int NetMidiBuffer::RenderToNetwork(int sub_cycle, size_t total_size)
......@@ -229,9 +228,9 @@ namespace Jack
}
//network<->buffer
int NetFloatAudioBuffer::RenderFromNetwork(int cycle, int sub_cycle, size_t copy_size, uint32_t port_num)
void NetFloatAudioBuffer::RenderFromNetwork(int cycle, int sub_cycle, size_t copy_size, uint32_t port_num)
{
return fPortBuffer.RenderFromNetwork(fNetBuffer, cycle, sub_cycle, copy_size, port_num);
fPortBuffer.RenderFromNetwork(fNetBuffer, cycle, sub_cycle, copy_size, port_num);
}
int NetFloatAudioBuffer::RenderToNetwork(int sub_cycle, uint32_t& port_num)
......@@ -239,6 +238,17 @@ namespace Jack
return fPortBuffer.RenderToNetwork(fNetBuffer, sub_cycle, port_num);
}
void NetFloatAudioBuffer::ActivePortsToNetwork(char* net_buffer, uint32_t& port_num)
{
fPortBuffer.ActivePortsToNetwork(net_buffer, port_num);
}
void NetFloatAudioBuffer::ActivePortsFromNetwork(char* net_buffer, uint32_t port_num)
{
fPortBuffer.ActivePortsFromNetwork(net_buffer, port_num);
}
// Celt audio buffer *********************************************************************************
#if HAVE_CELT
......@@ -433,7 +443,7 @@ namespace Jack
}
//network<->buffer
int NetCeltAudioBuffer::RenderFromNetwork(int cycle, int sub_cycle, size_t copy_size, uint32_t port_num)
void NetCeltAudioBuffer::RenderFromNetwork(int cycle, int sub_cycle, size_t copy_size, uint32_t port_num)
{
if (sub_cycle == fNumPackets - 1) {
for (int port_index = 0; port_index < fNPorts; port_index++)
......@@ -447,7 +457,6 @@ namespace Jack
jack_error("Packet(s) missing from... %d %d", fLastSubCycle, sub_cycle);
fLastSubCycle = sub_cycle;
return copy_size;
}
int NetCeltAudioBuffer::RenderToNetwork(int sub_cycle, uint32_t& port_num)
......@@ -564,7 +573,7 @@ namespace Jack
}
//network<->buffer
int NetIntAudioBuffer::RenderFromNetwork(int cycle, int sub_cycle, size_t copy_size, uint32_t port_num)
void NetIntAudioBuffer::RenderFromNetwork(int cycle, int sub_cycle, size_t copy_size, uint32_t port_num)
{
if (sub_cycle == fNumPackets - 1) {
for (int port_index = 0; port_index < fNPorts; port_index++)
......@@ -578,7 +587,6 @@ namespace Jack
jack_error("Packet(s) missing from... %d %d", fLastSubCycle, sub_cycle);
fLastSubCycle = sub_cycle;
return copy_size;
}
int NetIntAudioBuffer::RenderToNetwork(int sub_cycle, uint32_t& port_num)
......@@ -797,6 +805,7 @@ namespace Jack
dst_header->fID = htonl(src_header->fID);
dst_header->fNumPacket = htonl(src_header->fNumPacket);
dst_header->fPacketSize = htonl(src_header->fPacketSize);
dst_header->fActivePorts = htonl(src_header->fActivePorts);
dst_header->fCycle = htonl(src_header->fCycle);
dst_header->fSubCycle = htonl(src_header->fSubCycle);
dst_header->fIsLastPckt = htonl(src_header->fIsLastPckt);
......@@ -808,6 +817,7 @@ namespace Jack
dst_header->fID = ntohl(src_header->fID);
dst_header->fNumPacket = ntohl(src_header->fNumPacket);
dst_header->fPacketSize = ntohl(src_header->fPacketSize);
dst_header->fActivePorts = ntohl(src_header->fActivePorts);
dst_header->fCycle = ntohl(src_header->fCycle);
dst_header->fSubCycle = ntohl(src_header->fSubCycle);
dst_header->fIsLastPckt = ntohl(src_header->fIsLastPckt);
......
......@@ -39,8 +39,8 @@ using namespace std;
#endif
#endif
#define MASTER_PROTOCOL 3
#define SLAVE_PROTOCOL 3
#define MASTER_PROTOCOL 4
#define SLAVE_PROTOCOL 4
#define OPTIMIZED_PROTOCOL
......@@ -256,7 +256,7 @@ namespace Jack
void RenderToJackPorts();
//network<->buffer
int RenderFromNetwork(int sub_cycle, size_t copy_size);
void RenderFromNetwork(int sub_cycle, size_t copy_size);
int RenderToNetwork(int sub_cycle, size_t total_size);
void SetBuffer(int index, JackMidiBuffer* buffer);
......@@ -288,8 +288,11 @@ namespace Jack
virtual void RenderToJackPorts() = 0;
//network<->buffer
virtual int RenderFromNetwork(int cycle, int sub_cycle, size_t copy_size, uint32_t port_num) = 0;
virtual void RenderFromNetwork(int cycle, int sub_cycle, size_t copy_size, uint32_t port_num) = 0;
virtual void ActivePortsFromNetwork(char* net_buffer, uint32_t port_num) {}
virtual int RenderToNetwork(int sub_cycle, uint32_t& port_num) = 0;
virtual void ActivePortsToNetwork(char* net_buffer, uint32_t& port_num) {}
virtual void SetBuffer(int index, sample_t* buffer) = 0;
virtual sample_t* GetBuffer(int index) = 0;
......@@ -337,8 +340,9 @@ namespace Jack
fSubPeriodBytesSize = fSubPeriodSize * sizeof(sample_t);
fPortBuffer = new sample_t* [fNPorts];
for (int port_index = 0; port_index < fNPorts; port_index++)
for (int port_index = 0; port_index < fNPorts; port_index++) {
fPortBuffer[port_index] = NULL;
}
fCycleDuration = float(fSubPeriodSize) / float(params->fSampleRate);
fCycleSize = params->fMtu * (fPeriodSize / fSubPeriodSize);
......@@ -420,7 +424,7 @@ namespace Jack
{}
//network<->buffer
virtual int RenderFromNetwork(char* net_buffer, int cycle, int sub_cycle, size_t copy_size, uint32_t port_num)
virtual void RenderFromNetwork(char* net_buffer, int cycle, int sub_cycle, size_t copy_size, uint32_t port_num)
{
for (int port_index = 0; port_index < fNPorts; port_index++) {
float* src = (float*)(net_buffer + port_index * fSubPeriodBytesSize);
......@@ -433,7 +437,6 @@ namespace Jack
jack_error("Packet(s) missing from... %d %d", fLastSubCycle, sub_cycle);
}
fLastSubCycle = sub_cycle;
return copy_size;
}
virtual int RenderToNetwork(char* net_buffer, int sub_cycle, uint32_t& port_num)
......@@ -462,7 +465,7 @@ namespace Jack
}
//network<->buffer
virtual int RenderFromNetwork(char* net_buffer, int cycle, int sub_cycle, size_t copy_size, uint32_t port_num)
virtual void RenderFromNetwork(char* net_buffer, int cycle, int sub_cycle, size_t copy_size, uint32_t port_num)
{
for (int port_index = 0; port_index < fNPorts; port_index++) {
memcpy(fPortBuffer[port_index] + sub_cycle * fSubPeriodSize, net_buffer + port_index * fSubPeriodBytesSize, fSubPeriodBytesSize);
......@@ -471,7 +474,6 @@ namespace Jack
jack_error("Packet(s) missing from... %d %d", fLastSubCycle, sub_cycle);
}
fLastSubCycle = sub_cycle;
return copy_size;
}
virtual int RenderToNetwork(char* net_buffer, int sub_cycle, uint32_t& port_num)
......@@ -485,10 +487,19 @@ namespace Jack
#endif
virtual void ActivePortsFromNetwork(char* net_buffer, uint32_t port_num)
{}
virtual void ActivePortsToNetwork(char* net_buffer, uint32_t& port_num)
{
port_num = fNPorts;
}
};
struct JackOptimizedPortList : JackPortList {
// Consuming port list is transmitted in the Sync packed
// "[---Header---|--active_port_num---audio data--|--active_port_num---audio data--]..."
JackOptimizedPortList(session_params_t* params, uint32_t nports)
......@@ -511,7 +522,7 @@ namespace Jack
}
fSubPeriodBytesSize = fSubPeriodSize * sizeof(sample_t) + sizeof(uint32_t); // The port number in coded on 4 bytes
return fPeriodSize / fSubPeriodSize; // At least one packet...
return fPeriodSize / fSubPeriodSize; // At least one packet
}
#ifdef __BIG_ENDIAN__
......@@ -521,36 +532,40 @@ namespace Jack
#else
//network<->buffer
virtual int RenderFromNetwork(char* net_buffer, int cycle, int sub_cycle, size_t copy_size, uint32_t port_num)
virtual void RenderFromNetwork(char* net_buffer, int cycle, int sub_cycle, size_t copy_size, uint32_t port_num)
{
/// Setup rendering parameters
int sub_period_size, sub_period_bytes_size;
if (port_num == 0) {
sub_period_size = fPeriodSize;
} else {
jack_nframes_t period = (int) powf(2.f, (int)(log(float(fPacketSize) / (port_num * sizeof(sample_t))) / log(2.)));
sub_period_size = (period > fPeriodSize) ? fPeriodSize : period;
}
sub_period_bytes_size = sub_period_size * sizeof(sample_t) + sizeof(uint32_t); // The port number in coded on 4 bytes
if (port_num > 0) {
/// Setup rendering parameters
int sub_period_size, sub_period_bytes_size;
if (port_num == 0) {
sub_period_size = fPeriodSize;
} else {
jack_nframes_t period = (int) powf(2.f, (int)(log(float(fPacketSize) / (port_num * sizeof(sample_t))) / log(2.)));
sub_period_size = (period > fPeriodSize) ? fPeriodSize : period;
}
sub_period_bytes_size = sub_period_size * sizeof(sample_t) + sizeof(uint32_t); // The port number in coded on 4 bytes
if (sub_cycle == 0) { // Cleanup all JACK ports
for (int port_index = 0; port_index < fNPorts; port_index++) {
memset(fPortBuffer[port_index], 0, fPeriodSize * sizeof(sample_t));
if (sub_cycle == 0) { // Cleanup all JACK ports
for (int port_index = 0; port_index < fNPorts; port_index++) {
if (fPortBuffer[port_index])
memset(fPortBuffer[port_index], 0, fPeriodSize * sizeof(sample_t));
}
}
}
for (uint32_t port_index = 0; port_index < port_num; port_index++) {
// Only copy to active ports : read the active port number then audio data
int* active_port_address = (int*)(net_buffer + port_index * sub_period_bytes_size);
int active_port = (int)(*active_port_address);
memcpy(fPortBuffer[active_port] + sub_cycle * sub_period_size, (char*)(active_port_address + 1), sub_period_bytes_size - sizeof(int));
}
for (uint32_t port_index = 0; port_index < port_num; port_index++) {
// Only copy to active ports : read the active port number then audio data
int* active_port_address = (int*)(net_buffer + port_index * sub_period_bytes_size);
int active_port = (int)(*active_port_address);
if (fPortBuffer[port_index])
memcpy(fPortBuffer[active_port] + sub_cycle * sub_period_size, (char*)(active_port_address + 1), sub_period_bytes_size - sizeof(int));
}
if (sub_cycle != fLastSubCycle + 1) {
jack_error("Packet(s) missing from... %d %d", fLastSubCycle, sub_cycle);
if (sub_cycle != fLastSubCycle + 1) {
jack_error("Packet(s) missing from... %d %d", fLastSubCycle, sub_cycle);
}
fLastSubCycle = sub_cycle;
}
fLastSubCycle = sub_cycle;
return copy_size;
}
virtual int RenderToNetwork(char* net_buffer,int sub_cycle, uint32_t& port_num)
......@@ -573,6 +588,37 @@ namespace Jack
#endif
virtual void ActivePortsToNetwork(char* net_buffer, uint32_t& port_num)
{
// Init active port count
port_num = 0;
short* active_port_address = (short*)net_buffer;
for (int port_index = 0; port_index < fNPorts; port_index++) {
// Write the active port number
if (fPortBuffer[port_index]) {
*active_port_address = port_index;
active_port_address++;
port_num++;
assert(port_num < 512);
}
}
}
virtual void ActivePortsFromNetwork(char* net_buffer, uint32_t port_num)
{
short* active_port_address = (short*)net_buffer;
for (int port_index = 0; port_index < fNPorts; port_index++) {
fPortBuffer[port_index] = NULL;
}
for (uint port_index = 0; port_index < port_num; port_index++) {
fPortBuffer[*active_port_address] = (sample_t*)-1;
active_port_address++;
}
}
};
class SERVER_EXPORT NetFloatAudioBuffer : public NetAudioBuffer
......@@ -613,8 +659,11 @@ namespace Jack
sample_t* GetBuffer(int index);
//network<->buffer
int RenderFromNetwork(int cycle, int sub_cycle, size_t copy_size, uint32_t port_num);
int RenderToNetwork(int sub_cycle, uint32_t& port_num);
void RenderFromNetwork(int cycle, int sub_cycle, size_t copy_size, uint32_t port_num);
void ActivePortsFromNetwork(char* net_buffer, uint32_t port_num);
int RenderToNetwork(int sub_cycle, uint32_t& ort_num);
void ActivePortsToNetwork(char* net_buffer, uint32_t& port_num);
};
#if HAVE_CELT
......@@ -625,9 +674,9 @@ namespace Jack
{
private:
CELTMode ** fCeltMode;
CELTEncoder ** fCeltEncoder;
CELTDecoder ** fCeltDecoder;
CELTMode** fCeltMode;
CELTEncoder** fCeltEncoder;
CELTDecoder** fCeltDecoder;
int fCompressedSizeByte;
jack_nframes_t fPeriodSize;
......@@ -667,7 +716,7 @@ namespace Jack
void RenderToJackPorts();
//network<->buffer
int RenderFromNetwork(int cycle, int sub_cycle, size_t copy_size, uint32_t port_num);
void RenderFromNetwork(int cycle, int sub_cycle, size_t copy_size, uint32_t port_num);
int RenderToNetwork(int sub_cycle, uint32_t& port_num);
};
......@@ -716,7 +765,7 @@ namespace Jack
void RenderToJackPorts();
//network<->buffer
int RenderFromNetwork(int cycle, int sub_cycle, size_t copy_size, uint32_t port_num);
void RenderFromNetwork(int cycle, int sub_cycle, size_t copy_size, uint32_t port_num);
int RenderToNetwork(int sub_cycle, uint32_t& port_num);
};
......@@ -790,10 +839,9 @@ namespace Jack
//void FinishRenderToJackPorts(int cycle);
//network<->buffer
int RenderFromNetwork(int sub_cycle, size_t copy_size)
void RenderFromNetwork(int sub_cycle, size_t copy_size)
{
// TODO
return 0;
}
int RenderToNetwork(int sub_cycle, size_t total_size)
{
......
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