Browse Source

Cleanup.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@4756 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/1.9.9.5
sletz 13 years ago
parent
commit
baacb28baa
3 changed files with 19 additions and 16 deletions
  1. +13
    -7
      common/JackNetAPI.cpp
  2. +6
    -3
      common/JackNetInterface.cpp
  3. +0
    -6
      macosx/Jackdmp.xcodeproj/project.pbxproj

+ 13
- 7
common/JackNetAPI.cpp View File

@@ -496,11 +496,13 @@ struct JackNetExtSlave : public JackNetSlaveInterface, public JackRunnableInterf

int Open(jack_master_t* result)
{
// Check CELT encoder parameters
if ((fParams.fSampleEncoder == JackCeltEncoder) && (fParams.fKBps == 0)) {
jack_error("CELT encoder with 0 for kps...");
return -1;
}
// Check latency
if (fParams.fNetworkLatency > NETWORK_MAX_LATENCY) {
jack_error("Error : network latency is limited to %d", NETWORK_MAX_LATENCY);
return -1;
@@ -552,7 +554,7 @@ struct JackNetExtSlave : public JackNetSlaveInterface, public JackRunnableInterf
return -1;
}

// Finish connection...
// Finish connection
if (!JackNetSlaveInterface::InitRendering()) {
jack_error("Starting network fails...");
return -1;
@@ -615,29 +617,33 @@ struct JackNetExtSlave : public JackNetSlaveInterface, public JackRunnableInterf
void FreePorts()
{
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;
fAudioCaptureBuffer = NULL;
}

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;
fMidiCaptureBuffer = NULL;
}

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;
fAudioPlaybackBuffer = NULL;
}

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;
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)
{
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) {
char buffer[300];


+ 6
- 3
common/JackNetInterface.cpp View File

@@ -199,6 +199,7 @@ namespace Jack
fRxHeader.fCycle = rx_head->fCycle;
fRxHeader.fIsLastPckt = rx_head->fIsLastPckt;
buffer->RenderFromNetwork(rx_head->fSubCycle, rx_bytes - HEADER_SIZE);
// Last midi packet is received, so finish rendering...
if (++recvd_midi_pckt == rx_head->fNumPacket) {
buffer->RenderToJackPorts();
@@ -214,6 +215,7 @@ namespace Jack
fRxHeader.fIsLastPckt = rx_head->fIsLastPckt;
fRxHeader.fActivePorts = rx_head->fActivePorts;
rx_bytes = buffer->RenderFromNetwork(rx_head->fCycle, rx_head->fSubCycle, fRxHeader.fActivePorts);
// Last audio packet is received, so finish rendering...
if (fRxHeader.fIsLastPckt) {
buffer->RenderToJackPorts();
@@ -223,7 +225,6 @@ namespace Jack

int JackNetInterface::FinishRecv(NetAudioBuffer* buffer)
{
// TODO : finish midi and audio rendering ?
buffer->RenderToJackPorts();
return NET_PACKET_ERROR;
}
@@ -656,8 +657,9 @@ namespace Jack
// then tell the master we are ready
jack_info("Initializing connection with %s...", fParams.fMasterNetName);
status = SendStartToMaster();
if (status == NET_ERROR)
if (status == NET_ERROR) {
return false;
}
}
while (status != NET_ROLLING);

@@ -704,8 +706,9 @@ namespace Jack
session_params_t net_params;
memset(&net_params, 0, sizeof(session_params_t));
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));
}

// filter incoming packets : don't exit while no error is detected
memset(&net_params, 0, sizeof(session_params_t));


+ 0
- 6
macosx/Jackdmp.xcodeproj/project.pbxproj View File

@@ -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; };
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; };
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; };
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; };
@@ -3049,9 +3046,6 @@
4B37C20006DF1F900016E567 /* Latency */ = {
isa = PBXGroup;
children = (
4B37C20906DF1FE20016E567 /* latency.c */,
4B37C20306DF1FBE0016E567 /* CALatencyLog.cpp */,
4B37C20406DF1FBE0016E567 /* CALatencyLog.h */,
);
name = Latency;
sourceTree = "<group>";


Loading…
Cancel
Save