Changeset 3932
- Timestamp:
- 03/02/10 06:27:53 (5 months ago)
- Files:
-
- jack2/branches/libjacknet/common/JackNetInterface.cpp (modified) (9 diffs)
- jack2/branches/libjacknet/common/JackNetInterface.h (modified) (1 diff)
- jack2/branches/libjacknet/common/JackNetTool.cpp (modified) (1 diff)
- jack2/branches/libjacknet/common/JackNetTool.h (modified) (2 diffs)
- jack2/branches/libjacknet/common/JackTools.h (modified) (1 diff)
- jack2/branches/libjacknet/macosx/coreaudio/TiPhoneCoreAudioRenderer.cpp (modified) (2 diffs)
- jack2/branches/libjacknet/macosx/coreaudio/TiPhoneCoreAudioRenderer.h (modified) (1 diff)
- jack2/branches/libjacknet/macosx/iphone/main_master.mm (modified) (1 diff)
- jack2/branches/libjacknet/macosx/iphone/main_slave.mm (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
jack2/branches/libjacknet/common/JackNetInterface.cpp
r3926 r3932 116 116 //bufsize = sync + audio + midi 117 117 bufsize = MAX_LATENCY * (fParams.fMtu + ( int ) audio_size + ( int ) midi_size); 118 jack_info("SetNetBufferSize bufsize = %d", bufsize); 118 119 119 120 //tx buffer … … 299 300 300 301 //audio net buffers 301 fNetAudioCaptureBuffer = new NetAudioBuffer ( &fParams, fParams.fSendAudioChannels, fTxData ); 302 fNetAudioPlaybackBuffer = new NetAudioBuffer ( &fParams, fParams.fReturnAudioChannels, fRxData ); 302 fNetAudioCaptureBuffer = new NetSingleAudioBuffer ( &fParams, fParams.fSendAudioChannels, fTxData ); 303 fNetAudioPlaybackBuffer = new NetSingleAudioBuffer ( &fParams, fParams.fReturnAudioChannels, fRxData ); 304 305 //fNetAudioCaptureBuffer = new NetBufferedAudioBuffer ( &fParams, fParams.fSendAudioChannels, fTxData ); 306 //fNetAudioPlaybackBuffer = new NetBufferedAudioBuffer ( &fParams, fParams.fReturnAudioChannels, fRxData ); 307 303 308 assert ( fNetAudioCaptureBuffer ); 304 309 assert ( fNetAudioPlaybackBuffer ); … … 388 393 { 389 394 if (fParams.fNetworkMode == 's') { 390 return (fCycleOffset < 3);395 return (fCycleOffset < (CYCLE_OFFSET_SLOW + 1)); 391 396 } else { 392 397 return true; … … 465 470 // - this mode will skip the two first cycles, thus it lets time for data to be processed and queued on the socket rx buffer 466 471 //the slow mode is the safest mode because it wait twice the bandwidth relative time (send/return + process) 467 if (fCycleOffset < 2) {472 if (fCycleOffset < CYCLE_OFFSET_SLOW) { 468 473 return 0; 469 474 } else { 470 475 rx_bytes = Recv ( rx_head->fPacketSize, 0 ); 471 476 } 472 473 if (fCycleOffset > 2) {477 478 if (fCycleOffset > CYCLE_OFFSET_SLOW) { 474 479 jack_info("Warning : '%s' runs in slow network mode, but data received too late (%d cycle(s) offset)", fParams.fName, fCycleOffset); 475 480 } … … 515 520 uint recvd_midi_pckt = 0; 516 521 uint recvd_audio_pckt = 0; 522 int last_cycle = 0; 523 517 524 packet_header_t* rx_head = reinterpret_cast<packet_header_t*> ( fRxBuffer ); 518 525 … … 554 561 fRxHeader.fSubCycle = rx_head->fSubCycle; 555 562 fRxHeader.fIsLastPckt = rx_head->fIsLastPckt; 556 fNetAudioPlaybackBuffer->RenderToJackPorts ( rx_head->f SubCycle);563 fNetAudioPlaybackBuffer->RenderToJackPorts ( rx_head->fCycle, rx_head->fSubCycle); 557 564 jumpcnt = 0; 565 last_cycle = rx_head->fCycle; 558 566 break; 559 567 560 568 case 's': //sync 561 569 jack_info("NetMaster : overloaded, skipping receive from '%s'", fParams.fName); 570 // Finish rendering (copy to JACK ports) 571 fNetAudioPlaybackBuffer->FinishRenderToJackPorts(last_cycle); 562 572 return 0; 563 573 } 564 574 } 565 575 } 576 577 // Finish rendering (copy to JACK ports) 578 fNetAudioPlaybackBuffer->FinishRenderToJackPorts(last_cycle); 566 579 return rx_bytes; 567 580 } … … 791 804 792 805 //audio net buffers 793 fNetAudioCaptureBuffer = new NetAudioBuffer ( &fParams, fParams.fSendAudioChannels, fRxData ); 794 fNetAudioPlaybackBuffer = new NetAudioBuffer ( &fParams, fParams.fReturnAudioChannels, fTxData ); 806 fNetAudioCaptureBuffer = new NetSingleAudioBuffer ( &fParams, fParams.fSendAudioChannels, fRxData ); 807 fNetAudioPlaybackBuffer = new NetSingleAudioBuffer ( &fParams, fParams.fReturnAudioChannels, fTxData ); 808 809 //fNetAudioCaptureBuffer = new NetBufferedAudioBuffer ( &fParams, fParams.fSendAudioChannels, fRxData ); 810 //fNetAudioPlaybackBuffer = new NetBufferedAudioBuffer ( &fParams, fParams.fReturnAudioChannels, fTxData ); 795 811 796 812 //audio netbuffer length … … 868 884 uint recvd_audio_pckt = 0; 869 885 int rx_bytes = 0; 886 int last_cycle = 0; 887 870 888 packet_header_t* rx_head = reinterpret_cast<packet_header_t*> ( fRxBuffer ); 871 889 … … 894 912 rx_bytes = Recv ( rx_head->fPacketSize, 0 ); 895 913 if (recvd_audio_pckt++ != rx_head->fSubCycle) { 896 //jack_error("Packet(s) missing from '%s'...", fParams.fMasterNetName); 897 jack_error("Packet(s) missing from '%s'... %d %d %d", fParams.fMasterNetName, rx_head->fCycle, recvd_audio_pckt, rx_head->fSubCycle); 914 jack_error("Packet(s) missing from '%s'...", fParams.fMasterNetName); 898 915 } 899 916 fRxHeader.fCycle = rx_head->fCycle; 900 917 fRxHeader.fSubCycle = rx_head->fSubCycle; 901 918 fRxHeader.fIsLastPckt = rx_head->fIsLastPckt; 902 fNetAudioCaptureBuffer->RenderToJackPorts ( rx_head->fSubCycle ); 919 fNetAudioCaptureBuffer->RenderToJackPorts ( rx_head->fCycle, rx_head->fSubCycle); 920 last_cycle = rx_head->fCycle; 903 921 break; 904 922 905 923 case 's': //sync 906 924 jack_info ( "NetSlave : overloaded, skipping receive." ); 925 // Finish rendering (copy to JACK ports) 926 fNetAudioCaptureBuffer->FinishRenderToJackPorts(last_cycle); 907 927 return 0; 908 928 } 909 929 } 910 930 } 931 932 // Finish rendering (copy to JACK ports) 933 fNetAudioCaptureBuffer->FinishRenderToJackPorts(last_cycle); 911 934 fRxHeader.fCycle = rx_head->fCycle; 912 935 return 0; jack2/branches/libjacknet/common/JackNetInterface.h
r3614 r3932 213 213 #define SLAVE_INIT_TIMEOUT 2000000 // in usec 214 214 215 #define MAX_LATENCY 6 215 #define CYCLE_OFFSET_SLOW 2 216 #define MAX_LATENCY CYCLE_OFFSET_SLOW * 4 216 217 217 218 #endif jack2/branches/libjacknet/common/JackNetTool.cpp
r3931 r3932 128 128 // net audio buffer ********************************************************************************* 129 129 130 NetAudioBuffer::NetAudioBuffer ( session_params_t* params, uint32_t nports, char* net_buffer ) 131 { 132 fNPorts = nports; 133 fPeriodSize = params->fPeriodSize; 134 fSubPeriodSize = params->fFramesPerPacket; 135 fSubPeriodBytesSize = fSubPeriodSize * sizeof ( sample_t ); 136 fPortBuffer = new sample_t* [fNPorts]; 137 for ( int port_index = 0; port_index < fNPorts; port_index++ ) 138 fPortBuffer[port_index] = NULL; 130 131 NetSingleAudioBuffer::NetSingleAudioBuffer ( session_params_t* params, uint32_t nports, char* net_buffer ) 132 : fPortBuffer(params, nports), fNetBuffer(net_buffer) 133 {} 134 135 NetSingleAudioBuffer::~NetSingleAudioBuffer() 136 {} 137 138 size_t NetSingleAudioBuffer::GetSize() 139 { 140 return fPortBuffer.GetSize(); 141 } 142 143 void NetSingleAudioBuffer::SetBuffer ( int index, sample_t* buffer ) 144 { 145 fPortBuffer.SetBuffer(index, buffer); 146 } 147 148 sample_t* NetSingleAudioBuffer::GetBuffer ( int index ) 149 { 150 return fPortBuffer.GetBuffer(index); 151 } 152 153 void NetSingleAudioBuffer::RenderFromJackPorts (int subcycle) 154 { 155 fPortBuffer.RenderFromJackPorts(fNetBuffer, subcycle); 156 } 157 158 void NetSingleAudioBuffer::RenderToJackPorts (int cycle, int subcycle) 159 { 160 fPortBuffer.RenderToJackPorts(fNetBuffer, subcycle); 161 } 162 163 // Buffered 164 165 NetBufferedAudioBuffer::NetBufferedAudioBuffer ( session_params_t* params, uint32_t nports, char* net_buffer ) 166 { 167 fMaxCycle = 0; 139 168 fNetBuffer = net_buffer; 140 } 141 142 NetAudioBuffer::~NetAudioBuffer() 143 { 144 delete[] fPortBuffer; 145 } 146 147 size_t NetAudioBuffer::GetSize() 148 { 149 return fNPorts * fSubPeriodBytesSize; 150 } 151 152 void NetAudioBuffer::SetBuffer ( int index, sample_t* buffer ) 153 { 154 fPortBuffer[index] = buffer; 155 } 156 157 sample_t* NetAudioBuffer::GetBuffer ( int index ) 158 { 159 return fPortBuffer[index]; 160 } 161 162 #ifdef __BIG_ENDIAN__ 163 164 static inline float SwapFloat(float f) 165 { 166 union 167 { 168 float f; 169 unsigned char b[4]; 170 } dat1, dat2; 171 172 dat1.f = f; 173 dat2.b[0] = dat1.b[3]; 174 dat2.b[1] = dat1.b[2]; 175 dat2.b[2] = dat1.b[1]; 176 dat2.b[3] = dat1.b[0]; 177 return dat2.f; 178 } 179 180 void NetAudioBuffer::RenderFromJackPorts ( int subcycle ) 181 { 182 for ( int port_index = 0; port_index < fNPorts; port_index++ ) { 183 float* src = (float*)(fPortBuffer[port_index] + subcycle * fSubPeriodSize); 184 float* dst = (float*)(fNetBuffer + port_index * fSubPeriodBytesSize); 185 for (unsigned int sample = 0; sample < fSubPeriodBytesSize / sizeof(float); sample++) { 186 dst[sample] = SwapFloat(src[sample]); 187 } 188 } 189 } 190 191 void NetAudioBuffer::RenderToJackPorts ( int subcycle ) 192 { 193 for ( int port_index = 0; port_index < fNPorts; port_index++ ) { 194 float* src = (float*)(fNetBuffer + port_index * fSubPeriodBytesSize); 195 float* dst = (float*)(fPortBuffer[port_index] + subcycle * fSubPeriodSize); 196 for (unsigned int sample = 0; sample < fSubPeriodBytesSize / sizeof(float); sample++) { 197 dst[sample] = SwapFloat(src[sample]); 198 } 199 } 169 170 for (int i = 0; i < AUDIO_BUFFER_SIZE; i++) { 171 fPortBuffer[i].Init(params, nports); 172 } 173 174 fJackPortBuffer = new sample_t* [nports]; 175 for ( int port_index = 0; port_index < nports; port_index++ ) 176 fJackPortBuffer[port_index] = NULL; 177 } 178 179 NetBufferedAudioBuffer::~NetBufferedAudioBuffer() 180 { 181 delete [] fJackPortBuffer; 182 } 183 184 size_t NetBufferedAudioBuffer::GetSize() 185 { 186 return fPortBuffer[0].GetSize(); 187 } 188 189 void NetBufferedAudioBuffer::SetBuffer ( int index, sample_t* buffer ) 190 { 191 fJackPortBuffer[index] = buffer; 192 } 193 194 sample_t* NetBufferedAudioBuffer::GetBuffer ( int index ) 195 { 196 return fJackPortBuffer[index]; 200 197 } 201 198 202 #else 203 204 void NetAudioBuffer::RenderFromJackPorts ( int subcycle ) 205 { 206 for ( int port_index = 0; port_index < fNPorts; port_index++ ) 207 memcpy ( fNetBuffer + port_index * fSubPeriodBytesSize, fPortBuffer[port_index] + subcycle * fSubPeriodSize, fSubPeriodBytesSize ); 208 } 209 210 void NetAudioBuffer::RenderToJackPorts ( int subcycle ) 211 { 212 for ( int port_index = 0; port_index < fNPorts; port_index++ ) 213 memcpy ( fPortBuffer[port_index] + subcycle * fSubPeriodSize, fNetBuffer + port_index * fSubPeriodBytesSize, fSubPeriodBytesSize ); 214 } 215 216 #endif 199 void NetBufferedAudioBuffer::RenderFromJackPorts (int subcycle ) 200 { 201 fPortBuffer[0].RenderFromJackPorts(fNetBuffer, subcycle); // Always use first buffer... 202 } 203 204 void NetBufferedAudioBuffer::RenderToJackPorts (int cycle, int subcycle) 205 { 206 if (cycle < fMaxCycle) { 207 jack_info("Wrong order fCycle %d subcycle %d fMaxCycle %d", cycle, subcycle, fMaxCycle); 208 } 209 fPortBuffer[cycle % AUDIO_BUFFER_SIZE].RenderToJackPorts(fNetBuffer, subcycle); 210 } 211 212 void NetBufferedAudioBuffer::FinishRenderToJackPorts (int cycle) 213 { 214 fMaxCycle = std::max(fMaxCycle, cycle); 215 fPortBuffer[(cycle + 1) % AUDIO_BUFFER_SIZE].Copy(fJackPortBuffer); // Copy internal buffer in JACK ports 216 } 217 217 218 218 // SessionParams ************************************************************************************ jack2/branches/libjacknet/common/JackNetTool.h
r3402 r3932 249 249 // audio data ********************************************************************************* 250 250 251 class SERVER_EXPORT NetAudioBuffer 252 { 253 254 public: 255 NetAudioBuffer () 256 {} 257 ~NetAudioBuffer() 258 {} 259 260 virtual size_t GetSize() = 0; 261 //jack<->buffer 262 virtual void RenderFromJackPorts (int subcycle ) = 0; 263 virtual void RenderToJackPorts ( int cycle, int subcycle) = 0; 264 virtual void FinishRenderToJackPorts (int cycle) = 0; 265 266 virtual void SetBuffer ( int index, sample_t* buffer ) = 0; 267 virtual sample_t* GetBuffer ( int index ) = 0; 268 }; 269 251 270 /** 252 271 \Brief Audio buffer and operations class … … 258 277 259 278 */ 260 261 class SERVER_EXPORT NetAudioBuffer 279 280 struct JackPortList { 281 282 jack_nframes_t fPeriodSize; 283 jack_nframes_t fSubPeriodSize; 284 size_t fSubPeriodBytesSize; 285 sample_t** fPortBuffer; 286 int fNPorts; 287 288 JackPortList(session_params_t* params, uint32_t nports) 289 { 290 fNPorts = nports; 291 fPeriodSize = params->fPeriodSize; 292 fSubPeriodSize = params->fFramesPerPacket; 293 fSubPeriodBytesSize = fSubPeriodSize * sizeof ( sample_t ); 294 fPortBuffer = new sample_t* [fNPorts]; 295 for ( int port_index = 0; port_index < fNPorts; port_index++ ) 296 fPortBuffer[port_index] = NULL; 297 } 298 299 JackPortList() 300 { 301 fNPorts = 0; 302 fPeriodSize = 0; 303 fSubPeriodSize = 0; 304 fSubPeriodBytesSize = 0; 305 fPortBuffer = 0; 306 } 307 308 ~JackPortList() 309 { 310 delete [] fPortBuffer; 311 } 312 313 void SetBuffer( int index, sample_t* buffer ) 314 { 315 fPortBuffer[index] = buffer; 316 } 317 318 sample_t* GetBuffer ( int index ) 319 { 320 return fPortBuffer[index]; 321 } 322 323 void Copy(sample_t** buffers) 324 { 325 for ( int port_index = 0; port_index < fNPorts; port_index++ ) 326 memcpy(buffers[port_index], fPortBuffer[port_index], fPeriodSize * sizeof(float)); 327 } 328 329 size_t GetSize() 330 { 331 return fNPorts * fSubPeriodBytesSize; 332 } 333 334 #ifdef __BIG_ENDIAN__ 335 336 static inline float SwapFloat(float f) 337 { 338 union 339 { 340 float f; 341 unsigned char b[4]; 342 } dat1, dat2; 343 344 dat1.f = f; 345 dat2.b[0] = dat1.b[3]; 346 dat2.b[1] = dat1.b[2]; 347 dat2.b[2] = dat1.b[1]; 348 dat2.b[3] = dat1.b[0]; 349 return dat2.f; 350 } 351 352 void RenderFromJackPorts (char* net_buffer, int subcycle ) 353 { 354 for ( int port_index = 0; port_index < fNPorts; port_index++ ) { 355 float* src = (float*)(fPortBuffer[port_index] + subcycle * fSubPeriodSize); 356 float* dst = (float*)(net_buffer + port_index * fSubPeriodBytesSize); 357 for (unsigned int sample = 0; sample < fSubPeriodBytesSize / sizeof(float); sample++) { 358 dst[sample] = SwapFloat(src[sample]); 359 } 360 } 361 } 362 363 void RenderToJackPorts (char* net_buffer, int subcycle) 364 { 365 for ( int port_index = 0; port_index < fNPorts; port_index++ ) { 366 float* src = (float*)(net_buffer + port_index * fSubPeriodBytesSize); 367 float* dst = (float*)(fPortBuffer[port_index] + subcycle * fSubPeriodSize); 368 for (unsigned int sample = 0; sample < fSubPeriodBytesSize / sizeof(float); sample++) { 369 dst[sample] = SwapFloat(src[sample]); 370 } 371 } 372 } 373 374 #else 375 376 void RenderFromJackPorts (char* net_buffer, int subcycle ) 377 { 378 for ( int port_index = 0; port_index < fNPorts; port_index++ ) 379 memcpy ( net_buffer + port_index * fSubPeriodBytesSize, fPortBuffer[port_index] + subcycle * fSubPeriodSize, fSubPeriodBytesSize ); 380 } 381 382 void RenderToJackPorts (char* net_buffer, int subcycle) 383 { 384 for ( int port_index = 0; port_index < fNPorts; port_index++ ) 385 memcpy ( fPortBuffer[port_index] + subcycle * fSubPeriodSize, net_buffer + port_index * fSubPeriodBytesSize, fSubPeriodBytesSize ); 386 } 387 388 #endif 389 390 }; 391 392 struct JackPortListAllocate : public JackPortList { 393 394 JackPortListAllocate() 395 { 396 fNPorts = 0; 397 fPeriodSize = 0; 398 fSubPeriodSize = 0; 399 fSubPeriodBytesSize = 0; 400 fPortBuffer = 0; 401 } 402 403 ~JackPortListAllocate() 404 { 405 for ( int port_index = 0; port_index < fNPorts; port_index++ ) 406 delete [] fPortBuffer[port_index]; 407 delete [] fPortBuffer; 408 } 409 410 void Init(session_params_t* params, uint32_t nports) 411 { 412 fNPorts = nports; 413 fPeriodSize = params->fPeriodSize; 414 fSubPeriodSize = params->fFramesPerPacket; 415 fSubPeriodBytesSize = fSubPeriodSize * sizeof ( sample_t ); 416 fPortBuffer = new sample_t* [fNPorts]; 417 for ( int port_index = 0; port_index < fNPorts; port_index++ ) 418 fPortBuffer[port_index] = new sample_t[fPeriodSize]; 419 } 420 421 }; 422 423 class SERVER_EXPORT NetSingleAudioBuffer : public NetAudioBuffer 262 424 { 263 425 private: 264 int fNPorts; 265 jack_nframes_t fPeriodSize; 266 jack_nframes_t fSubPeriodSize; 267 size_t fSubPeriodBytesSize; 426 JackPortList fPortBuffer; 268 427 char* fNetBuffer; 269 sample_t** fPortBuffer;428 270 429 public: 271 Net AudioBuffer ( session_params_t* params, uint32_t nports, char* net_buffer );272 ~Net AudioBuffer();430 NetSingleAudioBuffer ( session_params_t* params, uint32_t nports, char* net_buffer ); 431 ~NetSingleAudioBuffer(); 273 432 274 433 size_t GetSize(); 275 434 //jack<->buffer 276 void RenderFromJackPorts ( int subcycle ); 277 void RenderToJackPorts ( int subcycle ); 435 void RenderFromJackPorts (int subcycle ); 436 void RenderToJackPorts (int cycle, int subcycle); 437 438 void SetBuffer ( int index, sample_t* buffer ); 439 sample_t* GetBuffer ( int index ); 440 441 void FinishRenderToJackPorts (int cycle) {} 442 }; 443 444 #define AUDIO_BUFFER_SIZE 8 445 446 class SERVER_EXPORT NetBufferedAudioBuffer : public NetAudioBuffer 447 { 448 449 private: 450 char* fNetBuffer; 451 JackPortListAllocate fPortBuffer[AUDIO_BUFFER_SIZE]; 452 sample_t** fJackPortBuffer; 453 int fMaxCycle; 454 455 public: 456 NetBufferedAudioBuffer ( session_params_t* params, uint32_t nports, char* net_buffer ); 457 ~NetBufferedAudioBuffer(); 458 459 size_t GetSize(); 460 //jack<->buffer 461 void RenderFromJackPorts (int subcycle ); 462 void RenderToJackPorts ( int cycle, int subcycle); 463 void FinishRenderToJackPorts (int cycle); 278 464 279 465 void SetBuffer ( int index, sample_t* buffer ); jack2/branches/libjacknet/common/JackTools.h
r3814 r3932 138 138 T Add ( T measure_point ) 139 139 { 140 return fCurrentMeasure[fMeasureId++] = measure_point;140 return fCurrentMeasure[fMeasureId++] = measure_point; 141 141 } 142 142 jack2/branches/libjacknet/macosx/coreaudio/TiPhoneCoreAudioRenderer.cpp
r3922 r3932 119 119 } 120 120 121 int TiPhoneCoreAudioRenderer::Open Default(int bufferSize, int samplerate)121 int TiPhoneCoreAudioRenderer::Open(int bufferSize, int samplerate) 122 122 { 123 123 OSStatus err1; … … 126 126 AudioStreamBasicDescription srcFormat, dstFormat; 127 127 128 printf("Open DefaultfDevNumInChans = %ld fDevNumOutChans = %ld bufferSize = %ld samplerate = %ld\n", fDevNumInChans, fDevNumOutChans, bufferSize, samplerate);128 printf("Open fDevNumInChans = %ld fDevNumOutChans = %ld bufferSize = %ld samplerate = %ld\n", fDevNumInChans, fDevNumOutChans, bufferSize, samplerate); 129 129 130 130 // Initialize and configure the audio session jack2/branches/libjacknet/macosx/coreaudio/TiPhoneCoreAudioRenderer.h
r3922 r3932 79 79 } 80 80 81 int Open Default(int bufferSize, int sampleRate);81 int Open(int bufferSize, int sampleRate); 82 82 int Close(); 83 83 jack2/branches/libjacknet/macosx/iphone/main_master.mm
r3924 r3932 72 72 } 73 73 74 if (audio_device.Open Default(buffer_size, sample_rate) < 0) {74 if (audio_device.Open(buffer_size, sample_rate) < 0) { 75 75 return -1; 76 76 } jack2/branches/libjacknet/macosx/iphone/main_slave.mm
r3924 r3932 12 12 #include "TiPhoneCoreAudioRenderer.h" 13 13 14 #define NUM_INPUT 215 #define NUM_OUTPUT 214 #define NUM_INPUT 1 15 #define NUM_OUTPUT 1 16 16 17 17 jack_net_slave_t* net; … … 34 34 { 35 35 36 jack_adapter_pull_and_push(adapter, audio_output_buffer, audio_input_buffer, buffer_size); 36 //jack_adapter_pull_and_push(adapter, audio_output_buffer, audio_input_buffer, buffer_size); 37 38 // Process input, produce output 39 if (audio_input == audio_output) { 40 // Copy input to output 41 for (int i = 0; i < audio_input; i++) { 42 memcpy(audio_output_buffer[i], audio_input_buffer[i], buffer_size * sizeof(float)); 43 } 44 } 37 45 return 0; 38 46 } … … 40 48 static void SlaveAudioCallback(int frames, float** inputs, float** outputs, void* arg) 41 49 { 42 jack_adapter_push_and_pull(adapter, inputs, outputs, frames);50 //jack_adapter_push_and_pull(adapter, inputs, outputs, frames); 43 51 } 52 53 //http://www.securityfocus.com/infocus/1884 54 55 #define WIFI_MTU 1500 56 44 57 45 58 int main(int argc, char *argv[]) { 46 59 47 NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];60 NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; 48 61 49 jack_slave_t request = { NUM_INPUT, NUM_OUTPUT, 0, 0, DEFAULT_MTU, -1, JackSlowMode };62 jack_slave_t request = { NUM_INPUT, NUM_OUTPUT, 0, 0, WIFI_MTU, -1, JackSlowMode }; 50 63 jack_master_t result; 51 64 52 if ((net = jack_net_slave_open( DEFAULT_MULTICAST_IP, DEFAULT_PORT, "iPhone", &request, &result)) == 0) {65 if ((net = jack_net_slave_open("169.254.136.64", DEFAULT_PORT, "iPhone", &request, &result)) == 0) { 53 66 return -1; 54 67 } … … 70 83 } 71 84 72 if (audio_device.Open Default(result.buffer_size, result.sample_rate) < 0) {85 if (audio_device.Open(result.buffer_size, result.sample_rate) < 0) { 73 86 return -1; 74 87 }
