• 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: Outputing to different Channels on a Device
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Outputing to different Channels on a Device


  • Subject: Re: Outputing to different Channels on a Device
  • From: Marc Van Olmen <email@hidden>
  • Date: Sat, 30 Sep 2006 00:17:00 -0400

Hi,

figured out I had the index of SetProperty wrong it needed to be 0 instead of 1, did some copy/paste of some code on apple website, without checking it's meaning

Here some sample code to make it work for any stereo device:


if ( (fStereoPairOutputIndex > 1) && (fStereoPairOutputIndex * 2 + 1 <= aDevice->CountChannels())) { OS_Int32 * aChannelMapPtr = NULL; OS_UInt32 aChannelCount,i; OS_UInt32 aDataSize; OS_Boolean aWritable; BAIL_OSERROR(AudioUnitGetPropertyInfo(fOutputAudioUnit, kAudioOutputUnitProperty_ChannelMap, kAudioUnitScope_Output, 0, &aDataSize, &aWritable)); if ( (aDataSize > 0) && (aWritable)) { aChannelCount = aDataSize / sizeof(OS_Int32);

       aChannelMapPtr = (OS_Int32 *)malloc(aDataSize);

	BAIL_OSERROR(AudioUnitGetProperty(	fOutputAudioUnit,
						kAudioOutputUnitProperty_ChannelMap,
						kAudioUnitScope_Output,
						0,
						aChannelMapPtr,
						&aDataSize));

	if ((fStereoPairOutputIndex * 2 + 1) < aChannelCount) {

		for (i = 0; i < aChannelCount; i++) {
			aChannelMapPtr[i] = -1;
		}

		aChannelMapPtr[(fStereoPairOutputIndex - 1) * 2] = 0;
		aChannelMapPtr[(fStereoPairOutputIndex - 1) * 2 + 1] = 1;

		BAIL_OSERROR(AudioUnitSetProperty(fOutputAudioUnit,
						kAudioOutputUnitProperty_ChannelMap,
						kAudioUnitScope_Output,
						0,
						aChannelMapPtr,
						aDataSize));
	}

   free((void *)aChannelMapPtr);
}




On 28 Sep 2006, at 19:55, Marc Van Olmen wrote:

ok I tried many more combinations but nothing worked.
For example this one also gave an error:

 aChannelMap[0] = aDeviceChannelOutputLeft;
 aChannelMap[1] = aDeviceChannelOutputRight;

 BAIL_OSERROR(AudioUnitSetProperty(fOutputAudioUnit,
 			kAudioOutputUnitProperty_ChannelMap,
 			kAudioUnitScope_Output,
 			1,
 			aChannelMap,
 			8));


I know that it should work because with AULab I can address the different channels.


so just need to figure out how to put this thing in code.

still searching...

marc




marc

I tried the follow this functions deoesn't give an error back anymore
but still all sounds go to channel 0,1 on device..



BAIL_OSERROR(AudioUnitSetProperty(fOutputAudioUnit, kAudioOutputUnitProperty_ChannelMap, kAudioUnitScope_Global, 1, aChannelMap, aSizeOfChannelMem));

So not sure what to do ....

On 28 Sep 2006, at 01:54, Marc Van Olmen wrote:

hi,

I want to play 3 files (english,french,spanish) to different audio
channels of a device.

Letting 3 streams playing to default output channels seems to work
fine. I'm creating AudioUnit for each of them.

But I have trouble trying let it playback to its other channel.



So now I want to playback French file to channel 2 and 3 of a
device which has 12 outputs (decklink card).
I retreived the number of channels by Using HALLab (info button):
but also by this code:


anError = AudioDeviceGetProperty(fAudioDeviceID, 0, kOutputAudioDevice, kAudioDevicePropertyStreamConfiguration, &aPropertySize, aBufferList); if (!anError) { for (i = 0; i < aBufferList->mNumberBuffers; ++i) { anAnswer += aBufferList->mBuffers[i].mNumberChannels; } } OS_Pointer_Free(aBufferList);

which gives 1 buffer and 12 channels back.

So quickly tested this code...
	aChannelMap[0] = -1;
	aChannelMap[1] = -1;
	aChannelMap[2] = 0;
	aChannelMap[3] = 1;
	aChannelMap[4] = -1;
	aChannelMap[5] = -1;
	aChannelMap[6] = -1;
	aChannelMap[7] = -1;
	aChannelMap[8] = -1;
	aChannelMap[9] = -1;
	aChannelMap[10] = -1;
	aChannelMap[11] = -1;

	BAIL_OSERROR(AudioUnitSetProperty(fOutputAudioUnit,
					kAudioOutputUnitProperty_ChannelMap,
					kAudioUnitScope_Input,
					1,
					aChannelMap,
					aSizeOfChannelMem));


but it returns 'fmt?'

any thoughts?,

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

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:
40sky4studios.be


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: 
 >Outputing to different Channels on a Device (From: Marc Van Olmen <email@hidden>)
 >Re: Outputing to different Channels on a Device (From: Marc Van Olmen <email@hidden>)
 >Re: Outputing to different Channels on a Device (From: Marc Van Olmen <email@hidden>)

  • Prev by Date: Re: missing frame in clipOutputSamples and convertInputSamples
  • Next by Date: Re: Reading midi events from device
  • Previous by thread: Re: Outputing to different Channels on a Device
  • Next by thread: how to properly rename classes in a custom Cocoa view
  • Index(es):
    • Date
    • Thread