Open luciansvnc opened 10 years ago
Sending data over the network is unfortunately not a feature that the Novocaine project supports. Best of luck!
On Thu, Oct 23, 2014 at 11:15 AM, luciansvnc notifications@github.com wrote:
Hello! I recently tried use Novocaine with Multipeer Connectivity in order to stream music from one device to another. On the 'Host' side I used the following code in order to send data to the output streamer:
[self.audioManager setOutputBlock:^(float *data, UInt32 numFrames, UInt32 numChannels) { [wself.fileReader retrieveFreshAudio:data numFrames:numFrames numChannels:numChannels]; NSLog(@"Time: %f", wself.fileReader.currentTime);
NSMutableData *theData = [NSMutableData dataWithBytes:data length:(numFrames* numChannels*sizeof(float))]; [wself.outputStream write:(uint8_t *)[theData bytes] maxLength:[theData length]];
}];
[self.audioManager play];
On the 'Client' side I tried to receive and read the incoming data using this code:
__weak GuestViewController wSelf = self; u_int8_t bytes1[self.audioStreamReadMaxLength]; UInt32 length = [(NSInputStream )stream read:bytes1 maxLength:self.audioStreamReadMaxLength];
float *byteData = (float*)malloc(length); memcpy(byteData, bytes1 , length); self.ringBuffer->AddNewInterleavedFloatData(byteData, 1024, 1); if (!self.audioManager.playing) { [self.audioManager setOutputBlock:^(float *byteData, UInt32 numFrames, UInt32 numChannels) { wSelf.ringBuffer->FetchInterleavedData(byteData, numFrames, numChannels); }]; [self.audioManager play]; }
When I run the application the sound plays very well on the 'Host' but on the 'Client' side I can only hear some glitches. I spent a couple of days trying to solve this but I really didn't have any luck. Can you please tell me a way to correctly send the data from one device and to receive it and parse it on the other one. Thank you very much!
— Reply to this email directly or view it on GitHub https://github.com/alexbw/novocaine/issues/99.
@luciansvnc, https://github.com/tumtumtum/StreamingKit might help you
@alexbw thank you for your response. @iwxxcz thank you very much for your tip. I will definitely check it out.
@luciansvnc have you figured out a way for streaming? I'm running into the same problem
Hello! I recently tried use Novocaine with Multipeer Connectivity in order to stream music from one device to another. On the 'Host' side I used the following code in order to send data to the output streamer:
[self.audioManager setOutputBlock:^(float *data, UInt32 numFrames, UInt32 numChannels) { [wself.fileReader retrieveFreshAudio:data numFrames:numFrames numChannels:numChannels]; NSLog(@"Time: %f", wself.fileReader.currentTime);
On the 'Client' side I tried to receive and read the incoming data using this code:
__weak GuestViewController wSelf = self; u_int8_t bytes1[self.audioStreamReadMaxLength]; UInt32 length = [(NSInputStream )stream read:bytes1 maxLength:self.audioStreamReadMaxLength];
When I run the application the sound plays very well on the 'Host' but on the 'Client' side I can only hear some glitches. I spent a couple of days trying to solve this but I really didn't have any luck. Can you please tell me a way to correctly send the data from one device and to receive it and play it on the other one. Thank you very much!