diff --git a/common/JackNetAPI.cpp b/common/JackNetAPI.cpp index 72e525f4..ac9cc561 100644 --- a/common/JackNetAPI.cpp +++ b/common/JackNetAPI.cpp @@ -844,6 +844,8 @@ struct JackNetExtSlave : public JackNetSlaveInterface, public JackRunnableInterf return SOCKET_ERROR; } + if (fFrames < 0) fFrames = fParams.fPeriodSize; + fProcessCallback(fFrames, fParams.fSendAudioChannels, fAudioCaptureBuffer, diff --git a/common/JackNetTool.cpp b/common/JackNetTool.cpp index b695b8b6..8dfbcf83 100644 --- a/common/JackNetTool.cpp +++ b/common/JackNetTool.cpp @@ -996,23 +996,23 @@ namespace Jack int NetIntAudioBuffer::RenderFromJackPorts() { - // Count active ports - int active_ports = 0; for (int port_index = 0; port_index < fNPorts; port_index++) { if (fPortBuffer[port_index]) { for (uint frame = 0; frame < fPeriodSize; frame++) { - fIntBuffer[port_index][frame] = short(fPortBuffer[port_index][frame] * 32768.f); + fIntBuffer[port_index][frame] = short(fPortBuffer[port_index][frame] * 32767.f); } - active_ports++; + } else { + memset(fIntBuffer[port_index], 0, fPeriodSize * sizeof(short)); } } - return active_ports; + // All ports active + return fNPorts; } void NetIntAudioBuffer::RenderToJackPorts() { - float coef = 1.f / 32768.f; + float coef = 1.f / 32767.f; for (int port_index = 0; port_index < fNPorts; port_index++) { if (fPortBuffer[port_index]) { for (uint frame = 0; frame < fPeriodSize; frame++) { diff --git a/common/JackNetTool.h b/common/JackNetTool.h index 4222363e..bb7cef11 100644 --- a/common/JackNetTool.h +++ b/common/JackNetTool.h @@ -180,7 +180,7 @@ namespace Jack uint32_t fActivePorts; //number of active ports uint32_t fCycle; //process cycle counter uint32_t fSubCycle; //midi/audio subcycle counter - uint32_t fFrames; //process cycle size in frames + int32_t fFrames; //process cycle size in frames (can be -1 to indicate entire buffer) uint32_t fIsLastPckt; //is it the last packet of a given cycle ('y' or 'n') } POST_PACKED_STRUCTURE;