• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Record from input play to output
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Record from input play to output


  • Subject: Record from input play to output
  • From: Paul Haddad <email@hidden>
  • Date: Sat, 29 Dec 2001 16:16:22 -0500

Hi All,

Let me preface this by saying I'm fairly clueless on audio stuff. :^)

I'm working on a long overdue update of my controller app for the DSBR-100 USB radio (http://www.pth.com/DSBRTuner). As part of this I'd like to support connecting the audio output of the radio tuner to the audio input of a Mac and output the results to one of the macs output channels.

Again not knowing much about audio I implemented the below routines which sort of work. I hear audio but it clips like mad, so my question is what is the proper way to do this?
---
Paul Haddad (email@hidden) AIM:(ETS Paul)

#define BUFFER_COUNT 16
static unsigned int recordCounter = 0;

static OSStatus playStream(AudioDeviceID inDevice, const AudioTimeStamp *inNow, const AudioBufferList *inInputData, const AudioTimeStamp *inInputTime, AudioBufferList *outOutputData, const AudioTimeStamp *inOutputTime, void *inClientData)
{
static unsigned int playCounter = 0;

if (playCounter < recordCounter) {
outOutputData->mNumberBuffers = 1;
outOutputData->mBuffers[0].mNumberChannels = 2;
outOutputData->mBuffers[0].mDataByteSize = 4096;
memcpy(outOutputData->mBuffers[0].mData, buffers[playCounter%BUFFER_COUNT].mBuffers[0].mData, 4096);
playCounter++;
}
return 0;
}

static OSStatus recordStream(AudioDeviceID inDevice, const AudioTimeStamp *inNow, const AudioBufferList *inInputData, const AudioTimeStamp *inInputTime, AudioBufferList *outOutputData, const AudioTimeStamp *inOutputTime, void *inClientData)
{
buffers[recordCounter%BUFFER_COUNT].mBuffers[0].mNumberChannels = inInputData->mBuffers[0].mNumberChannels;
buffers[recordCounter%BUFFER_COUNT].mBuffers[0].mDataByteSize = inInputData->mBuffers[0].mDataByteSize;
memcpy(buffers[recordCounter%BUFFER_COUNT].mBuffers[0].mData, inInputData->mBuffers[0].mData, inInputData->mBuffers[0].mDataByteSize);
recordCounter++;
return 0;
}


  • Prev by Date: Re: MIDI send problems.
  • Next by Date: dv audio
  • Previous by thread: Re: MIDI send problems.
  • Next by thread: dv audio
  • Index(es):
    • Date
    • Thread