• 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: Output Channel Selection Redux
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Output Channel Selection Redux


  • Subject: Re: Output Channel Selection Redux
  • From: Bob Ingraham <email@hidden>
  • Date: Tue, 24 Feb 2009 17:42:17 -0700 (MST)

Thanks!

However, when I implement this code, I get a segmentation fault in one of the threads:

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x2e445107
[Switching to process 12746 thread 0x7103]
0x90cfa76c in StereoInterleave32_X86 ()
(gdb) bt
#0  0x90cfa76c in StereoInterleave32_X86 ()
#1  0x90bdeaa2 in CBRConverter::RenderOutput ()
#2  0x90bde7dc in BufferedAudioConverter::FillBuffer ()
#3  0x90bde964 in AudioConverterChain::RenderOutput ()
#4  0x90bde7dc in BufferedAudioConverter::FillBuffer ()
#5  0x90bf5b73 in AudioConverterFillComplexBuffer ()
#6  0x700124ff in AUGenericOutputEntry ()
#7  0x90f2115b in HP_IOProc::Call ()
#8  0x90f20e4c in IOA_Device::CallIOProcs ()
#9  0x90f20d28 in HP_IOThread::PerformIO ()
#10 0x90f1f103 in HP_IOThread::WorkLoop ()
#11 0x90f1ec27 in HP_IOThread::ThreadEntry ()
#12 0x90f0f464 in CAPThread::Entry ()
#13 0x9101f095 in _pthread_start ()
#14 0x9101ef52 in thread_start ()
(gdb) info threads
* 4 process 12746 thread 0x7103  0x90cfa76c in StereoInterleave32_X86 ()
  3 process 12746 thread 0x6f13  0x90ff53ae in __semwait_signal ()
  2 process 12746 thread 0x5803  0x90fee1c6 in mach_msg_trap ()
  1 process 12746 local thread 0x2d03  0x90ff53ae in __semwait_signal ()
(gdb)

Here is the code snippet:

	SInt32 *channelMap = NULL;
	//UInt32 numOfChannels = fileFormat.NumberChannels();
	UInt32 numOfChannels = 16;	// Number of output device channels
	UInt32 mapSize = numOfChannels * sizeof(SInt32);
	channelMap = (SInt32 *)malloc(mapSize);
	for (i=0; i < numOfChannels; i++)
	{
		channelMap[i] = -1;
	}
	//channelMap[desiredInputChannel] = deviceOutputChannel;
	channelMap[2] = 0;
	channelMap[3] = 1;
	err = AudioUnitSetProperty(auOutput, kAudioOutputUnitProperty_ChannelMap, kAudioUnitScope_Input, 0, channelMap, mapSize);


The AudioUnitSetProperty() returns noErr.

I must be doing something wrong...

----- Original Message -----
From: "William Stewart" <email@hidden>
To: "Bob Ingraham" <email@hidden>
Cc: "CoreAudio API" <email@hidden>
Sent: Tuesday, February 24, 2009 4:42:36 PM GMT -07:00 US/Canada Mountain
Subject: Re: Output Channel Selection Redux


On Feb 24, 2009, at 2:38 PM, Bob Ingraham wrote:

> Hey All,
>
> Thanks for the help thus far!
>
> But I am just hitting a brick wall here. I think I'm on the right
> track with the SimpleSDK PlayFile example I've been modifying, but I
> just can't past the channel select problem using
> kAudioOutputUnitProperty_ChannelMap.
>
> Any help would be most appreciated...
>

Here's how we use this property in AULab:

	UInt32 numOutputChannels; // the number of channels of the device
	OSStatus result;
	SInt32 *channelMap = NULL;

	ca_require_noerr (result = mOutputAU.NumberChannels
(kAudioUnitScope_Output, 0, numOutputChannels), home);

		// this sets the channel map up so that all of the channels are
marked as unused
	channelMap = new SInt32 [numOutputChannels];
	for (unsigned int i = 0; i < numOutputChannels; ++i)
		channelMap[i] = -1;

//OUR_NUMBER_OF_CHANNELS is the number of channels you are using
// for AULab, this is the number of output channels of your AULab
session document

inDeviceChannels is a OUR_NUMBER_OF_CHANNELS sized array
each entry in this array describe which channel of the device that
channel fo the document should go to
if the number is > than the number of device channels, we skip it
(this is the "unused" part of the AULab output channel config)

	for (unsigned int i = 0; i < OUR_NUMBER_OF_CHANNELS ++i) {
		SInt32 chan = inDeviceChannels[i];
		if (chan >= 0 && UInt32(chan) < numOutputChannels)
			channelMap[chan] = i;
	}

// print it out
#if VERBOSE_DEVICE_CHANS
	printf ("Passed in:\n[");
	for (unsigned int i = 0; i < OUR_NUMBER_OF_CHANNELS; ++i)
		printf ("%d, ", inDeviceChannels[i]);
	printf ("]\n");
	printf ("Setting Device Channels\n\t[");
	for (unsigned int i = 0; i < numOutputChannels; ++i)
		printf ("%d, ", channelMap[i]);
	printf ("]\n");
#endif

// set it
	ca_require_noerr (result = mOutputAU.SetProperty
(kAudioOutputUnitProperty_ChannelMap, kAudioUnitScope_Input, 0,
								channelMap, (numOutputChannels * sizeof(SInt32))), home);

 _______________________________________________
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

  • Follow-Ups:
    • Re: Output Channel Selection Redux
      • From: William Stewart <email@hidden>
  • Prev by Date: does the AudioConverter implementation differ between tiger and leopard?
  • Next by Date: Re: Why Does Mono File Play as Stereo?
  • Previous by thread: Re: Output Channel Selection Redux
  • Next by thread: Re: Output Channel Selection Redux
  • Index(es):
    • Date
    • Thread