• 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
Re: audio input/output help
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: audio input/output help


  • Subject: Re: audio input/output help
  • From: William Stewart <email@hidden>
  • Date: Thu, 18 Oct 2007 12:20:08 -0700

developer.apple.com/audio should give you a link to CAPlayThrough - this can be used to take input from one device and output to another. I don't know if you need to do that, but it at least shows you how to do both input and output.

For targeting the channels for input and output, the AUHAL unit (used in this example) can use a property to set this. Here's some basic code to do this for output (for input you'd have to flip this around, but its the same basic logic) (mOutput is a CAAudioUnit wrapper around AUHAL

UInt32 numOutputChannels;
OSStatus result;
SInt32 *channelMap = NULL;

require_noerr (result = mOutput.NumberChannels (kAudioUnitScope_Output, 0, numOutputChannels), home);

channelMap = new SInt32 [numOutputChannels];
for (unsigned int i = 0; i < numOutputChannels; ++i)
channelMap[i] = -1; // this is the default value and tells AUHAL that the device channel is not used

// Now you have to set the channels (say 0 and 1 for stereo) to the index of the channelMap on the device you want to use. So, if you want to use channels 9 and 10 on the device for you stereo signal, this would be:
channelMap[8] = 0;
channelMap[9] = 1;

#if VERBOSE_DEVICE_CHANS
printf ("Setting Device Channels\n\t[");
for (unsigned int i = 0; i < numOutputChannels; ++i)
printf ("%d, ", channelMap[i]);
printf ("]\n");
#endif


require_noerr (result = mOutput.SetProperty (kAudioOutputUnitProperty_ChannelMap, kAudioUnitScope_Input, 0,
channelMap, (numOutputChannels * sizeof(SInt32))), home);

home:
if (channelMap)
delete [] channelMap;



HTH

Bill


On Oct 18, 2007, at 11:45 AM, Nigel Redmon wrote:

I hate to ask these types of questions, but I'm time limited ("ship this week" they say :-/), and I'd appreciate any help in cutting directly to the chase...

I've taken over a project that uses Portaudio on PC and Mac. It mostly works, except when I use my digital mixer (Tascam DM-3200) with firewire interface as both input and output. Maybe something to do with 24 channels each way, but the point is I don't have time to figure out the problem which ultimately might find me down at the core audio level anyway, so I'd like to just ditch it and go with core audio.

So far, I figured out how to find all the input and output devices, with numbers of channels and other properties, and that works fine. Now to audio input and output...

My understanding is that I need to work at the HAL level, since I need input. My needs in a nutshell:

This is a multichannel speaker calibration app. There are an arbitrary number of sets of arbitrary number of speakers, each of which may be connected to an arbitrary output device (that sounds more complicated than it is--the idea is that an recording engineer might have a speaker configuration for 5.1 mix down and a configuration for stereo--even 10.2, etc.; he may have some of these configuration split over multiple output devices).

Input is always a single channel (from a calibrated mic), device and channel selected by the user. Output is (mostly) on a single channel as well (noise pulses and sweeps--you can only calibrate one speaker at a time). There is stereo output as well, just for simple audio cues--because it sounds good that way--but the needs are pretty simple overall. The app assumes a fixed 44.1 kHz on the software end, so I'd have to have sample rate conversion on input and output to ensure that rate on the app side.

Can someone recommend some example code that cuts right to this sort of thing? Again, sorry to ask this sort of basic question, but I'd appreciate any help in getting something together (and debugged) quickly.

Thanks,

Nigel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Coreaudio-api mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >audio input/output help (From: Nigel Redmon <email@hidden>)

  • Prev by Date: audio input/output help
  • Next by Date: Re: Using MIDISend/MIDISendSysex for Line 6 USB Device
  • Previous by thread: audio input/output help
  • Next by thread: Pitch Blend
  • Index(es):
    • Date
    • Thread