git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@4756 0c269be4-1314-0410-8aa9-9f06e86f4224tags/1.9.9.5
@@ -496,11 +496,13 @@ struct JackNetExtSlave : public JackNetSlaveInterface, public JackRunnableInterf | |||||
int Open(jack_master_t* result) | int Open(jack_master_t* result) | ||||
{ | { | ||||
// Check CELT encoder parameters | |||||
if ((fParams.fSampleEncoder == JackCeltEncoder) && (fParams.fKBps == 0)) { | if ((fParams.fSampleEncoder == JackCeltEncoder) && (fParams.fKBps == 0)) { | ||||
jack_error("CELT encoder with 0 for kps..."); | jack_error("CELT encoder with 0 for kps..."); | ||||
return -1; | return -1; | ||||
} | } | ||||
// Check latency | |||||
if (fParams.fNetworkLatency > NETWORK_MAX_LATENCY) { | if (fParams.fNetworkLatency > NETWORK_MAX_LATENCY) { | ||||
jack_error("Error : network latency is limited to %d", NETWORK_MAX_LATENCY); | jack_error("Error : network latency is limited to %d", NETWORK_MAX_LATENCY); | ||||
return -1; | return -1; | ||||
@@ -552,7 +554,7 @@ struct JackNetExtSlave : public JackNetSlaveInterface, public JackRunnableInterf | |||||
return -1; | return -1; | ||||
} | } | ||||
// Finish connection... | |||||
// Finish connection | |||||
if (!JackNetSlaveInterface::InitRendering()) { | if (!JackNetSlaveInterface::InitRendering()) { | ||||
jack_error("Starting network fails..."); | jack_error("Starting network fails..."); | ||||
return -1; | return -1; | ||||
@@ -615,29 +617,33 @@ struct JackNetExtSlave : public JackNetSlaveInterface, public JackRunnableInterf | |||||
void FreePorts() | void FreePorts() | ||||
{ | { | ||||
if (fAudioCaptureBuffer) { | if (fAudioCaptureBuffer) { | ||||
for (int 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++) { | |||||
delete[] fAudioCaptureBuffer[audio_port_index]; | delete[] fAudioCaptureBuffer[audio_port_index]; | ||||
} | |||||
delete[] fAudioCaptureBuffer; | delete[] fAudioCaptureBuffer; | ||||
fAudioCaptureBuffer = NULL; | fAudioCaptureBuffer = NULL; | ||||
} | } | ||||
if (fMidiCaptureBuffer) { | if (fMidiCaptureBuffer) { | ||||
for (int 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++) { | |||||
delete[] (fMidiCaptureBuffer[midi_port_index]); | delete[] (fMidiCaptureBuffer[midi_port_index]); | ||||
} | |||||
delete[] fMidiCaptureBuffer; | delete[] fMidiCaptureBuffer; | ||||
fMidiCaptureBuffer = NULL; | fMidiCaptureBuffer = NULL; | ||||
} | } | ||||
if (fAudioPlaybackBuffer) { | if (fAudioPlaybackBuffer) { | ||||
for (int audio_port_index = 0; audio_port_index < fParams.fReturnAudioChannels; audio_port_index++) | |||||
for (int audio_port_index = 0; audio_port_index < fParams.fReturnAudioChannels; audio_port_index++) { | |||||
delete[] fAudioPlaybackBuffer[audio_port_index]; | delete[] fAudioPlaybackBuffer[audio_port_index]; | ||||
} | |||||
delete[] fAudioPlaybackBuffer; | delete[] fAudioPlaybackBuffer; | ||||
fAudioPlaybackBuffer = NULL; | fAudioPlaybackBuffer = NULL; | ||||
} | } | ||||
if (fMidiPlaybackBuffer) { | if (fMidiPlaybackBuffer) { | ||||
for (int 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++) { | |||||
delete[] fMidiPlaybackBuffer[midi_port_index]; | delete[] fMidiPlaybackBuffer[midi_port_index]; | ||||
} | |||||
delete[] fMidiPlaybackBuffer; | delete[] fMidiPlaybackBuffer; | ||||
fMidiPlaybackBuffer = NULL; | fMidiPlaybackBuffer = NULL; | ||||
} | } | ||||
@@ -995,8 +1001,8 @@ LIB_EXPORT int jack_adapter_pull_and_push(jack_adapter_t* adapter, float** input | |||||
static void jack_format_and_log(int level, const char *prefix, const char *fmt, va_list ap) | static void jack_format_and_log(int level, const char *prefix, const char *fmt, va_list ap) | ||||
{ | { | ||||
const char* netjack_log = getenv("JACK_NETJACK_LOG"); | |||||
bool is_netjack_log = (netjack_log) ? atoi(netjack_log) : 0; | |||||
static const char* netjack_log = getenv("JACK_NETJACK_LOG"); | |||||
static bool is_netjack_log = (netjack_log) ? atoi(netjack_log) : 0; | |||||
if (is_netjack_log) { | if (is_netjack_log) { | ||||
char buffer[300]; | char buffer[300]; | ||||
@@ -199,6 +199,7 @@ namespace Jack | |||||
fRxHeader.fCycle = rx_head->fCycle; | fRxHeader.fCycle = rx_head->fCycle; | ||||
fRxHeader.fIsLastPckt = rx_head->fIsLastPckt; | fRxHeader.fIsLastPckt = rx_head->fIsLastPckt; | ||||
buffer->RenderFromNetwork(rx_head->fSubCycle, rx_bytes - HEADER_SIZE); | buffer->RenderFromNetwork(rx_head->fSubCycle, rx_bytes - HEADER_SIZE); | ||||
// Last midi packet is received, so finish rendering... | // Last midi packet is received, so finish rendering... | ||||
if (++recvd_midi_pckt == rx_head->fNumPacket) { | if (++recvd_midi_pckt == rx_head->fNumPacket) { | ||||
buffer->RenderToJackPorts(); | buffer->RenderToJackPorts(); | ||||
@@ -214,6 +215,7 @@ namespace Jack | |||||
fRxHeader.fIsLastPckt = rx_head->fIsLastPckt; | fRxHeader.fIsLastPckt = rx_head->fIsLastPckt; | ||||
fRxHeader.fActivePorts = rx_head->fActivePorts; | fRxHeader.fActivePorts = rx_head->fActivePorts; | ||||
rx_bytes = buffer->RenderFromNetwork(rx_head->fCycle, rx_head->fSubCycle, fRxHeader.fActivePorts); | rx_bytes = buffer->RenderFromNetwork(rx_head->fCycle, rx_head->fSubCycle, fRxHeader.fActivePorts); | ||||
// Last audio packet is received, so finish rendering... | // Last audio packet is received, so finish rendering... | ||||
if (fRxHeader.fIsLastPckt) { | if (fRxHeader.fIsLastPckt) { | ||||
buffer->RenderToJackPorts(); | buffer->RenderToJackPorts(); | ||||
@@ -223,7 +225,6 @@ namespace Jack | |||||
int JackNetInterface::FinishRecv(NetAudioBuffer* buffer) | int JackNetInterface::FinishRecv(NetAudioBuffer* buffer) | ||||
{ | { | ||||
// TODO : finish midi and audio rendering ? | |||||
buffer->RenderToJackPorts(); | buffer->RenderToJackPorts(); | ||||
return NET_PACKET_ERROR; | return NET_PACKET_ERROR; | ||||
} | } | ||||
@@ -656,8 +657,9 @@ namespace Jack | |||||
// then tell the master we are ready | // then tell the master we are ready | ||||
jack_info("Initializing connection with %s...", fParams.fMasterNetName); | jack_info("Initializing connection with %s...", fParams.fMasterNetName); | ||||
status = SendStartToMaster(); | status = SendStartToMaster(); | ||||
if (status == NET_ERROR) | |||||
if (status == NET_ERROR) { | |||||
return false; | return false; | ||||
} | |||||
} | } | ||||
while (status != NET_ROLLING); | while (status != NET_ROLLING); | ||||
@@ -704,8 +706,9 @@ namespace Jack | |||||
session_params_t net_params; | session_params_t net_params; | ||||
memset(&net_params, 0, sizeof(session_params_t)); | memset(&net_params, 0, sizeof(session_params_t)); | ||||
SessionParamsHToN(&fParams, &net_params); | SessionParamsHToN(&fParams, &net_params); | ||||
if (fSocket.SendTo(&net_params, sizeof(session_params_t), 0, fMulticastIP) == SOCKET_ERROR) | |||||
if (fSocket.SendTo(&net_params, sizeof(session_params_t), 0, fMulticastIP) == SOCKET_ERROR) { | |||||
jack_error("Error in data send : %s", StrError(NET_ERROR_CODE)); | jack_error("Error in data send : %s", StrError(NET_ERROR_CODE)); | ||||
} | |||||
// filter incoming packets : don't exit while no error is detected | // filter incoming packets : don't exit while no error is detected | ||||
memset(&net_params, 0, sizeof(session_params_t)); | memset(&net_params, 0, sizeof(session_params_t)); | ||||
@@ -1743,9 +1743,6 @@ | |||||
4B370A21133DD7E300237B68 /* JackCoreMidiVirtualInputPort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackCoreMidiVirtualInputPort.h; path = ../../coremidi/JackCoreMidiVirtualInputPort.h; sourceTree = BUILT_PRODUCTS_DIR; }; | 4B370A21133DD7E300237B68 /* JackCoreMidiVirtualInputPort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackCoreMidiVirtualInputPort.h; path = ../../coremidi/JackCoreMidiVirtualInputPort.h; sourceTree = BUILT_PRODUCTS_DIR; }; | ||||
4B370A22133DD7E300237B68 /* JackCoreMidiVirtualOutputPort.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackCoreMidiVirtualOutputPort.cpp; path = ../../coremidi/JackCoreMidiVirtualOutputPort.cpp; sourceTree = BUILT_PRODUCTS_DIR; }; | 4B370A22133DD7E300237B68 /* JackCoreMidiVirtualOutputPort.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackCoreMidiVirtualOutputPort.cpp; path = ../../coremidi/JackCoreMidiVirtualOutputPort.cpp; sourceTree = BUILT_PRODUCTS_DIR; }; | ||||
4B370A23133DD7E300237B68 /* JackCoreMidiVirtualOutputPort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackCoreMidiVirtualOutputPort.h; path = ../../coremidi/JackCoreMidiVirtualOutputPort.h; sourceTree = BUILT_PRODUCTS_DIR; }; | 4B370A23133DD7E300237B68 /* JackCoreMidiVirtualOutputPort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackCoreMidiVirtualOutputPort.h; path = ../../coremidi/JackCoreMidiVirtualOutputPort.h; sourceTree = BUILT_PRODUCTS_DIR; }; | ||||
4B37C20306DF1FBE0016E567 /* CALatencyLog.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = CALatencyLog.cpp; path = /Developer/Examples/CoreAudio/PublicUtility/CALatencyLog.cpp; sourceTree = "<absolute>"; }; | |||||
4B37C20406DF1FBE0016E567 /* CALatencyLog.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = CALatencyLog.h; path = /Developer/Examples/CoreAudio/PublicUtility/CALatencyLog.h; sourceTree = "<absolute>"; }; | |||||
4B37C20906DF1FE20016E567 /* latency.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = latency.c; path = /Developer/Examples/CoreAudio/PublicUtility/latency.c; sourceTree = "<absolute>"; }; | |||||
4B38115F1326878E00C61B14 /* jack_latent_client */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_latent_client; sourceTree = BUILT_PRODUCTS_DIR; }; | 4B38115F1326878E00C61B14 /* jack_latent_client */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_latent_client; sourceTree = BUILT_PRODUCTS_DIR; }; | ||||
4B3811971326884E00C61B14 /* jack_latent_client */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_latent_client; sourceTree = BUILT_PRODUCTS_DIR; }; | 4B3811971326884E00C61B14 /* jack_latent_client */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_latent_client; sourceTree = BUILT_PRODUCTS_DIR; }; | ||||
4B3811FA13269C8300C61B14 /* latent_client.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = latent_client.c; path = "../example-clients/latent_client.c"; sourceTree = SOURCE_ROOT; }; | 4B3811FA13269C8300C61B14 /* latent_client.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = latent_client.c; path = "../example-clients/latent_client.c"; sourceTree = SOURCE_ROOT; }; | ||||
@@ -3049,9 +3046,6 @@ | |||||
4B37C20006DF1F900016E567 /* Latency */ = { | 4B37C20006DF1F900016E567 /* Latency */ = { | ||||
isa = PBXGroup; | isa = PBXGroup; | ||||
children = ( | children = ( | ||||
4B37C20906DF1FE20016E567 /* latency.c */, | |||||
4B37C20306DF1FBE0016E567 /* CALatencyLog.cpp */, | |||||
4B37C20406DF1FBE0016E567 /* CALatencyLog.h */, | |||||
); | ); | ||||
name = Latency; | name = Latency; | ||||
sourceTree = "<group>"; | sourceTree = "<group>"; | ||||