Ejemplo n.º 1
0
void CAPlayThroughHost::RemoveDeviceListeners(AudioDeviceID input)
{
	UInt32 propSize;
	OSStatus err = AudioDeviceGetPropertyInfo(input, 0, true, kAudioDevicePropertyStreams, &propSize, NULL);
	if(!err)
	{
		AudioStreamID *streams = (AudioStreamID*)malloc(propSize);	
		err = AudioDeviceGetProperty(input, 0, true, kAudioDevicePropertyStreams, &propSize, streams);
		if(!err)
		{
			UInt32 numStreams = propSize / sizeof(AudioStreamID);
			for(UInt32 i=0; i < numStreams; i++)
			{
				UInt32 isInput;
				propSize = sizeof(UInt32);
				err = AudioStreamGetProperty(streams[i], 0, kAudioStreamPropertyDirection, &propSize, &isInput);
				if(!err && isInput)
					err = AudioStreamRemovePropertyListener(streams[i], 0, kAudioStreamPropertyPhysicalFormat, StreamListener);
			}
		}
	}
}
void	CAAudioHardwareStream::RemovePropertyListener(UInt32 inChannel, AudioHardwarePropertyID inPropertyID, AudioStreamPropertyListenerProc inListenerProc)
{
	OSStatus theError = AudioStreamRemovePropertyListener(GetAudioStreamID(), inChannel, inPropertyID, inListenerProc);
	ThrowIfError(theError, CAException(theError), "CAAudioHardwareStream::RemovePropertyListener: got an error removing a property listener");
}