Browse Source

Improve master mode.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/branches/libjacknet@3955 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/1.9.8
sletz 15 years ago
parent
commit
cbd652cf85
13 changed files with 99 additions and 77 deletions
  1. +2
    -2
      common/JackAudioAdapterInterface.h
  2. +6
    -5
      common/JackNetAPI.cpp
  3. +14
    -7
      common/JackNetAdapter.cpp
  4. +7
    -3
      common/JackNetDriver.cpp
  5. +25
    -19
      common/JackNetInterface.cpp
  6. +2
    -1
      common/JackNetInterface.h
  7. +6
    -2
      common/JackNetManager.cpp
  8. +3
    -14
      common/JackNetTool.cpp
  9. +1
    -1
      common/JackNetTool.h
  10. +2
    -2
      common/JackWaitThreadedDriver.h
  11. +18
    -15
      macosx/iphone/iPhoneNet.xcodeproj/project.pbxproj
  12. +12
    -6
      macosx/iphone/main_master.mm
  13. +1
    -0
      macosx/iphone/main_slave.mm

+ 2
- 2
common/JackAudioAdapterInterface.h View File

@@ -212,13 +212,13 @@ namespace Jack

int GetInputs()
{
jack_log ( "JackAudioAdapterInterface::GetInputs %d", fCaptureChannels );
//jack_log("JackAudioAdapterInterface::GetInputs %d", fCaptureChannels);
return fCaptureChannels;
}

int GetOutputs()
{
jack_log ( "JackAudioAdapterInterface::GetOutputs %d", fPlaybackChannels );
//jack_log ("JackAudioAdapterInterface::GetOutputs %d", fPlaybackChannels);
return fPlaybackChannels;
}


+ 6
- 5
common/JackNetAPI.cpp View File

@@ -214,6 +214,7 @@ struct JackNetExtMaster : public JackNetMasterInterface {
fprintf(stderr, "Can't init new net master...\n");
goto error;
}
jack_info ( "Waiting for a slave..." );
break;
case KILL_MASTER:
@@ -787,7 +788,7 @@ struct JackNetAdapter : public JackAudioAdapterInterface {
Destroy();
}
int Flush()
void Flush()
{
for (int i = 0; i < fCaptureChannels; i++ ) {
fCaptureRingBuffer[i]->Reset(fRingbufferCurSize);
@@ -881,14 +882,14 @@ SERVER_EXPORT int jack_net_master_close(jack_net_master_t* net)
}
SERVER_EXPORT int jack_net_master_recv(jack_net_master_t* net, int audio_input, float** audio_input_buffer, int midi_input, void** midi_input_buffer)
{
JackNetExtMaster* slave = (JackNetExtMaster*)net;
return slave->Read(audio_input, audio_input_buffer, midi_input, midi_input_buffer);
JackNetExtMaster* master = (JackNetExtMaster*)net;
return master->Read(audio_input, audio_input_buffer, midi_input, midi_input_buffer);
}

SERVER_EXPORT int jack_net_master_send(jack_net_master_t* net, int audio_output, float** audio_output_buffer, int midi_output, void** midi_output_buffer)
{
JackNetExtMaster* slave = (JackNetExtMaster*)net;
return slave->Write(audio_output, audio_output_buffer, midi_output, midi_output_buffer);
JackNetExtMaster* master = (JackNetExtMaster*)net;
return master->Write(audio_output, audio_output_buffer, midi_output, midi_output_buffer);
}

// Adapter API


+ 14
- 7
common/JackNetAdapter.cpp View File

@@ -117,18 +117,18 @@ namespace Jack

JackNetAdapter::~JackNetAdapter()
{
jack_log ( "JackNetAdapter::~JackNetAdapter" );
jack_log ("JackNetAdapter::~JackNetAdapter");

int port_index;
if ( fSoftCaptureBuffer )
if (fSoftCaptureBuffer)
{
for ( port_index = 0; port_index < fCaptureChannels; port_index++ )
for (port_index = 0; port_index < fCaptureChannels; port_index++)
delete[] fSoftCaptureBuffer[port_index];
delete[] fSoftCaptureBuffer;
}
if ( fSoftPlaybackBuffer )
if (fSoftPlaybackBuffer)
{
for ( port_index = 0; port_index < fPlaybackChannels; port_index++ )
for ( port_index = 0; port_index < fPlaybackChannels; port_index++)
delete[] fSoftPlaybackBuffer[port_index];
delete[] fSoftPlaybackBuffer;
}
@@ -194,6 +194,8 @@ namespace Jack
}

//thread------------------------------------------------------------------------------
// TODO : if failure, thread exist... need to restart ?
bool JackNetAdapter::Init()
{
jack_log ( "JackNetAdapter::Init" );
@@ -201,11 +203,16 @@ namespace Jack
int port_index;

//init network connection
if ( !JackNetSlaveInterface::Init() )
if (!JackNetSlaveInterface::Init()) {
jack_error("JackNetSlaveInterface::Init() error..." );
return false;
}

//then set global parameters
SetParams();
if (!SetParams()) {
jack_error("SetParams error..." );
return false;
}

//set buffers
fSoftCaptureBuffer = new sample_t*[fCaptureChannels];


+ 7
- 3
common/JackNetDriver.cpp View File

@@ -142,13 +142,17 @@ namespace Jack
( fParams.fSlaveSyncMode ) ? "sync" : "async", ( fParams.fTransportSync ) ? "with" : "without" );

//init network
if (!JackNetSlaveInterface::Init())
if (!JackNetSlaveInterface::Init()) {
jack_error("JackNetSlaveInterface::Init() error..." );
return false;
}

//set global parameters
if (!SetParams())
if (!SetParams()) {
jack_error("SetParams error..." );
return false;
}
//allocate midi ports lists
fMidiCapturePortList = new jack_port_id_t [fParams.fSendMidiChannels];
fMidiPlaybackPortList = new jack_port_id_t [fParams.fReturnMidiChannels];


+ 25
- 19
common/JackNetInterface.cpp View File

@@ -67,9 +67,21 @@ namespace Jack
memset(&fReturnTransportData, 0, sizeof(net_transport_data_t));
}
void JackNetInterface::FreeNetworkBuffers()
{
delete fNetMidiCaptureBuffer;
delete fNetMidiPlaybackBuffer;
delete fNetAudioCaptureBuffer;
delete fNetAudioPlaybackBuffer;
fNetMidiCaptureBuffer = NULL;
fNetMidiPlaybackBuffer = NULL;
fNetAudioCaptureBuffer = NULL;
fNetAudioPlaybackBuffer = NULL;
}
JackNetInterface::~JackNetInterface()
{
jack_log ( "JackNetInterface::~JackNetInterface" );
jack_log ("JackNetInterface::~JackNetInterface");

fSocket.Close();
delete[] fTxBuffer;
@@ -270,11 +282,7 @@ namespace Jack
return true;
error:
delete fNetMidiCaptureBuffer;
delete fNetMidiPlaybackBuffer;
delete fNetAudioCaptureBuffer;
delete fNetAudioPlaybackBuffer;
FreeNetworkBuffers();
return false;
}

@@ -650,7 +658,7 @@ namespace Jack
return true;
}

net_status_t JackNetSlaveInterface::SendAvailableToMaster(int count)
net_status_t JackNetSlaveInterface::SendAvailableToMaster(long try_count)
{
jack_log ( "JackNetSlaveInterface::SendAvailableToMaster()" );
//utility
@@ -698,10 +706,11 @@ namespace Jack
return NET_RECV_ERROR;
}
}
while (strcmp(host_params.fPacketType, fParams.fPacketType) && (GetPacketType(&host_params) != SLAVE_SETUP) && (--count > 0));
while (strcmp(host_params.fPacketType, fParams.fPacketType) && (GetPacketType(&host_params) != SLAVE_SETUP) && (--try_count > 0));
// Time out failure..
if (count == 0) {
if (try_count == 0) {
jack_error("Time out error in connect");
return NET_CONNECT_ERROR;
}
@@ -710,8 +719,8 @@ namespace Jack
fParams = host_params;

//connect the socket
if ( fSocket.Connect() == SOCKET_ERROR ) {
jack_error ( "Error in connect : %s", StrError ( NET_ERROR_CODE ) );
if (fSocket.Connect() == SOCKET_ERROR) {
jack_error("Error in connect : %s", StrError(NET_ERROR_CODE));
return NET_CONNECT_ERROR;
}
return NET_CONNECTED;
@@ -719,17 +728,17 @@ namespace Jack

net_status_t JackNetSlaveInterface::SendStartToMaster()
{
jack_log ( "JackNetSlaveInterface::SendStartToMaster" );
jack_log("JackNetSlaveInterface::SendStartToMaster");

//tell the master to start
session_params_t net_params;
memset(&net_params, 0, sizeof ( session_params_t ));
SetPacketType ( &fParams, START_MASTER );
SessionParamsHToN(&fParams, &net_params);
if ( fSocket.Send ( &net_params, sizeof ( session_params_t ), 0 ) == SOCKET_ERROR )
if (fSocket.Send(&net_params, sizeof(session_params_t), 0) == SOCKET_ERROR)
{
jack_error ( "Error in send : %s", StrError ( NET_ERROR_CODE ) );
return ( fSocket.GetError() == NET_CONN_ERROR ) ? NET_ERROR : NET_SEND_ERROR;
jack_error("Error in send : %s", StrError(NET_ERROR_CODE));
return (fSocket.GetError() == NET_CONN_ERROR) ? NET_ERROR : NET_SEND_ERROR;
}
return NET_ROLLING;
}
@@ -784,10 +793,7 @@ namespace Jack
return true;
error:
delete fNetMidiCaptureBuffer;
delete fNetMidiPlaybackBuffer;
delete fNetAudioCaptureBuffer;
delete fNetAudioPlaybackBuffer;
FreeNetworkBuffers();
return false;
}



+ 2
- 1
common/JackNetInterface.h View File

@@ -63,6 +63,7 @@ namespace Jack

//utility methods
int SetNetBufferSize();
void FreeNetworkBuffers();
//virtual methods : depends on the sub class master/slave
virtual bool SetParams();
@@ -148,7 +149,7 @@ namespace Jack
bool InitConnection(int time_out);
bool InitRendering();
net_status_t SendAvailableToMaster(int count = LONG_MAX);
net_status_t SendAvailableToMaster(long count = LONG_MAX); // long here (and not int...)
net_status_t SendStartToMaster();
bool SetParams();


+ 6
- 2
common/JackNetManager.cpp View File

@@ -113,12 +113,16 @@ namespace Jack
bool JackNetMaster::Init(bool auto_connect)
{
//network init
if (!JackNetMasterInterface::Init())
if (!JackNetMasterInterface::Init()){
jack_error("JackNetMasterInterface::Init() error..." );
return false;
}

//set global parameters
if (!SetParams())
if (!SetParams()) {
jack_error("SetParams error..." );
return false;
}

//jack client and process
jack_status_t status;


+ 3
- 14
common/JackNetTool.cpp View File

@@ -49,7 +49,6 @@ HardwareClock::HardwareClock()
mach_timebase_info_data_t info;
mach_timebase_info(&info);
m_clockToSeconds = (double)info.numer/info.denom/1000000000.0;

Reset();
}

@@ -57,7 +56,6 @@ void HardwareClock::Reset()
{
m_startAbsTime = mach_absolute_time();
m_lastAbsTime = m_startAbsTime;
m_time = m_startAbsTime*m_clockToSeconds;
m_deltaTime = 1.0f/60.0f;
}
@@ -69,7 +67,6 @@ void HardwareClock::Update()

m_time = currentTime*m_clockToSeconds;
m_deltaTime = (double)dt*m_clockToSeconds;

m_lastAbsTime = currentTime;
}

@@ -200,8 +197,8 @@ namespace Jack
int NetMidiBuffer::RenderToNetwork ( int subcycle, size_t total_size )
{
int size = total_size - subcycle * fMaxPcktSize;
int copy_size = ( size <= fMaxPcktSize ) ? size : fMaxPcktSize;
memcpy ( fNetBuffer, fBuffer + subcycle * fMaxPcktSize, copy_size );
int copy_size = (size <= fMaxPcktSize) ? size : fMaxPcktSize;
memcpy(fNetBuffer, fBuffer + subcycle * fMaxPcktSize, copy_size);
return copy_size;
}

@@ -414,12 +411,9 @@ namespace Jack
return 0;
}
HardwareClock clock;
//network<->buffer
//network<->buffer
int NetCeltAudioBuffer::RenderFromNetwork(int cycle, int subcycle, size_t copy_size)
{
//clock.Update();
if (subcycle == fNumPackets - 1) {
for (int port_index = 0; port_index < fNPorts; port_index++)
memcpy(fCompressedBuffer[port_index] + subcycle * fSubPeriodBytesSize, fNetBuffer + port_index * fLastSubPeriodBytesSize, fLastSubPeriodBytesSize);
@@ -432,11 +426,6 @@ namespace Jack
jack_error("Packet(s) missing from... %d %d", fLastSubCycle, subcycle);
fLastSubCycle = subcycle;
//clock.Update();
//const float dt = clock.GetDeltaTime();
//printf("Delta: %f s\n", dt);
return copy_size;
}


+ 1
- 1
common/JackNetTool.h View File

@@ -278,7 +278,7 @@ namespace Jack
virtual int RenderToJackPorts () = 0;
//network<->buffer
virtual int RenderFromNetwork ( int cycle, int subcycle, size_t copy_size ) = 0;
virtual int RenderFromNetwork ( int cycle, int subcycle, size_t copy_size ) = 0;
virtual int RenderToNetwork (int subcycle, size_t total_size ) = 0;

virtual void SetBuffer ( int index, sample_t* buffer ) = 0;


+ 2
- 2
common/JackWaitThreadedDriver.h View File

@@ -64,8 +64,8 @@ class SERVER_EXPORT JackWaitThreadedDriver : public JackThreadedDriver
// JackRunnableInterface interface
bool Execute()
{
// Blocks until decorated driver is started (that is when it's Init method returns).
fDriver->Initialize();
// Blocks until decorated driver is started (that is when it's Initialize method returns true).
while (!fDriver->Initialize()) {}
fRunning = true;
return false;
}


+ 18
- 15
macosx/iphone/iPhoneNet.xcodeproj/project.pbxproj View File

@@ -153,12 +153,12 @@

/* Begin PBXFileReference section */
1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
1D6058910D05DD3D006BFB54 /* NetJack.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = NetJack.app; sourceTree = BUILT_PRODUCTS_DIR; };
1D6058910D05DD3D006BFB54 /* NetJackSlave.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = NetJackSlave.app; sourceTree = BUILT_PRODUCTS_DIR; };
1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
288765FC0DF74451002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
28AD733E0D9D9553002E5188 /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = "<group>"; };
32CA4F630368D1EE00C91783 /* iPhoneNet_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iPhoneNet_Prefix.pch; sourceTree = "<group>"; };
4B0772380F54018C000DC657 /* iPhoneNetMaster.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iPhoneNetMaster.app; sourceTree = BUILT_PRODUCTS_DIR; };
4B0772380F54018C000DC657 /* NetJackMaster.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = NetJackMaster.app; sourceTree = BUILT_PRODUCTS_DIR; };
4B0772490F54021B000DC657 /* main_slave.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = main_slave.mm; sourceTree = SOURCE_ROOT; };
4B0772500F54022D000DC657 /* main_master.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = main_master.mm; sourceTree = SOURCE_ROOT; };
4B0773840F541EE2000DC657 /* iPhoneNetAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iPhoneNetAppDelegate.h; sourceTree = "<group>"; };
@@ -182,7 +182,7 @@
4BCB37CE112D647C008C7BC1 /* iPhoneFaust.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iPhoneFaust.app; sourceTree = BUILT_PRODUCTS_DIR; };
4BCB37D5112D64B4008C7BC1 /* HardwareClock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HardwareClock.cpp; sourceTree = SOURCE_ROOT; };
4BCB37D8112D64D8008C7BC1 /* iphone-faust.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "iphone-faust.mm"; sourceTree = SOURCE_ROOT; };
4BCF75F210BC2FD90082C526 /* iPhoneFaustNet.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iPhoneFaustNet.app; sourceTree = BUILT_PRODUCTS_DIR; };
4BCF75F210BC2FD90082C526 /* iPhoneThruNet.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iPhoneThruNet.app; sourceTree = BUILT_PRODUCTS_DIR; };
4BCF75F610BC30140082C526 /* audio_thru.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = audio_thru.mm; sourceTree = SOURCE_ROOT; };
4BDFCCD7113DB30500D77992 /* Info copy.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info copy.plist"; sourceTree = "<group>"; };
4BDFCD57113DB6B700D77992 /* NetJackSlave.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = NetJackSlave.app; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -290,11 +290,11 @@
19C28FACFE9D520D11CA2CBB /* Products */ = {
isa = PBXGroup;
children = (
1D6058910D05DD3D006BFB54 /* NetJack.app */,
1D6058910D05DD3D006BFB54 /* NetJackSlave.app */,
4BFF45120F4D59DB00106083 /* libjacknet.a */,
4BFF45770F4D5D9700106083 /* iPhoneFaustNet.app */,
4B0772380F54018C000DC657 /* iPhoneNetMaster.app */,
4BCF75F210BC2FD90082C526 /* iPhoneFaustNet.app */,
4B0772380F54018C000DC657 /* NetJackMaster.app */,
4BCF75F210BC2FD90082C526 /* iPhoneThruNet.app */,
4B4146B010BD3C4300C12F0C /* iPhoneFaustNet.app */,
4BCB37CE112D647C008C7BC1 /* iPhoneFaust.app */,
4BDFCD57113DB6B700D77992 /* NetJackSlave.app */,
@@ -404,7 +404,7 @@
);
name = iPhoneNetSlave;
productName = iPhoneNet;
productReference = 1D6058910D05DD3D006BFB54 /* NetJack.app */;
productReference = 1D6058910D05DD3D006BFB54 /* NetJackSlave.app */;
productType = "com.apple.product-type.application";
};
4B07721F0F54018C000DC657 /* iPhoneNetMaster */ = {
@@ -421,7 +421,7 @@
);
name = iPhoneNetMaster;
productName = iPhoneNet;
productReference = 4B0772380F54018C000DC657 /* iPhoneNetMaster.app */;
productReference = 4B0772380F54018C000DC657 /* NetJackMaster.app */;
productType = "com.apple.product-type.application";
};
4B1A940F0F49BDE000D3626B /* libjacknet */ = {
@@ -489,7 +489,7 @@
);
name = iPhoneThruNet;
productName = iPhoneNet;
productReference = 4BCF75F210BC2FD90082C526 /* iPhoneFaustNet.app */;
productReference = 4BCF75F210BC2FD90082C526 /* iPhoneThruNet.app */;
productType = "com.apple.product-type.application";
};
4BDFCD3B113DB6B700D77992 /* iPhoneNetSlaveLib */ = {
@@ -793,7 +793,7 @@
"\"$(SRCROOT)/build/Debug-iphonesimulator\"",
);
OTHER_LDFLAGS = libcelt.a;
PRODUCT_NAME = iPhoneNetSlave;
PRODUCT_NAME = NetJackSlave;
SDKROOT = iphoneos3.1.3;
};
name = Debug;
@@ -822,7 +822,7 @@
"\"$(SRCROOT)/build/Debug-iphonesimulator\"",
);
OTHER_LDFLAGS = libcelt.a;
PRODUCT_NAME = NetJack;
PRODUCT_NAME = NetJackSlave;
SDKROOT = iphoneos3.1.3;
};
name = Release;
@@ -837,6 +837,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = iPhoneNet_Prefix.pch;
HEADER_SEARCH_PATHS = (
/usr/local/include,
../../macosx/coreaudio,
../../macosx,
../../posix,
@@ -848,8 +849,8 @@
"$(inherited)",
"\\\"$(SRCROOT)/build/Debug-iphonesimulator\\\"",
);
OTHER_LDFLAGS = "";
PRODUCT_NAME = iPhoneNetMaster;
OTHER_LDFLAGS = libcelt.a;
PRODUCT_NAME = NetJackMaster;
SDKROOT = iphoneos3.1.3;
};
name = Debug;
@@ -862,6 +863,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = iPhoneNet_Prefix.pch;
HEADER_SEARCH_PATHS = (
/usr/local/include,
../../macosx/coreaudio,
../../common/jack,
../../common,
@@ -873,7 +875,8 @@
"$(inherited)",
"\\\"$(SRCROOT)/build/Debug-iphonesimulator\\\"",
);
PRODUCT_NAME = iPhoneNetMaster;
OTHER_LDFLAGS = libcelt.a;
PRODUCT_NAME = NetJackMaster;
};
name = Release;
};
@@ -1097,7 +1100,7 @@
"\\\"$(SRCROOT)/build/Debug-iphonesimulator\\\"",
);
OTHER_LDFLAGS = "-ljacknet";
PRODUCT_NAME = iPhoneNetSlave;
PRODUCT_NAME = NetJackSlave;
SDKROOT = iphoneos3.1.3;
};
name = Debug;


+ 12
- 6
macosx/iphone/main_master.mm View File

@@ -20,7 +20,7 @@ jack_adapter_t* adapter;
float** audio_input_buffer;
float** audio_output_buffer;

int buffer_size = 4096;
int buffer_size = 1024;
int sample_rate = 44100;

jack_master_t request = { buffer_size, sample_rate, "master" };
@@ -30,18 +30,22 @@ static void MasterAudioCallback(int frames, float** inputs, float** outputs, voi
{
int i;
// Copy from iPod input to network
// Copy from iPod input to network buffers
for (i = 0; i < result.audio_input; i++) {
memcpy(audio_output_buffer[i], inputs[i], buffer_size * sizeof(float));
}
// Send network buffers
if (jack_net_master_send(net, result.audio_output, audio_output_buffer, 0, NULL) < 0) {
printf("jack_net_master_send error..\n");
}
// Copy from network to iPod output
// Recv network buffers
if (jack_net_master_recv(net, result.audio_input, audio_input_buffer, 0, NULL) < 0) {
printf("jack_net_master_recv error..\n");
}
// Copy from network buffers to iPod output
for (i = 0; i < result.audio_output; i++) {
memcpy(outputs[i], audio_input_buffer[i], buffer_size * sizeof(float));
}
@@ -57,6 +61,7 @@ int main(int argc, char *argv[]) {
TiPhoneCoreAudioRenderer audio_device(NUM_INPUT, NUM_OUTPUT);
if ((net = jack_net_master_open(DEFAULT_MULTICAST_IP, DEFAULT_PORT, "iPhone", &request, &result)) == 0) {
printf("jack_net_master_open error..\n");
return -1;
}
@@ -82,7 +87,7 @@ int main(int argc, char *argv[]) {
}
// Run until interrupted
while (1) {}
//while (1) {}
/*
// Quite brutal way, the application actually does not start completely, the netjack audio processing loop is used instead...
@@ -105,10 +110,11 @@ int main(int argc, char *argv[]) {
};
*/
int retVal = UIApplicationMain(argc, argv, nil, nil);
audio_device.Stop();
audio_device.Close();
int retVal = UIApplicationMain(argc, argv, nil, nil);
// Wait for application end
jack_net_master_close(net);


+ 1
- 0
macosx/iphone/main_slave.mm View File

@@ -70,6 +70,7 @@ int main(int argc, char *argv[]) {

//if ((net = jack_net_slave_open("169.254.112.119", DEFAULT_PORT, "iPhone", &request, &result)) == 0) {
if ((net = jack_net_slave_open(DEFAULT_MULTICAST_IP, DEFAULT_PORT, "iPod", &request, &result)) == 0) {
printf("jack_net_slave_open error..\n");
return -1;
}


Loading…
Cancel
Save