Ejemplo n.º 1
0
void	CAHALAudioDevice::SetiSubOwnerControlValue(AudioObjectPropertyScope inScope, UInt32 inChannel, bool inValue)
{
	CAPropertyAddress theAddress(kAudioDevicePropertyDriverShouldOwniSub, inScope, inChannel);
	UInt32 theValue = (inValue ? 1 : 0);
	UInt32 theSize = sizeof(UInt32);
	SetPropertyData(theAddress, 0, NULL, theSize, &theValue);
}
Ejemplo n.º 2
0
void	CAHALAudioDevice::ReleaseHogMode()
{
	CAPropertyAddress theAddress(kAudioDevicePropertyHogMode);
	if(HasProperty(theAddress))
	{
		pid_t thePID = -1;
		SetPropertyData(theAddress, 0, NULL, sizeof(pid_t), &thePID);
	}
}
Ejemplo n.º 3
0
bool	CAHALAudioDevice::TakeHogMode()
{
	CAPropertyAddress theAddress(kAudioDevicePropertyHogMode);
	pid_t thePID = getpid();
	if(HasProperty(theAddress))
	{
		SetPropertyData(theAddress, 0, NULL, sizeof(pid_t), &thePID);
	}
	return thePID == getpid();
}
	//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	// TakeDeviceMaster()
	//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	bool Device::TakeDeviceMaster()
	{
		pid_t pid = getpid();
		UInt32 size = sizeof(pid_t);
		try
		{
			SetPropertyData(PropertyAddress(kCMIODevicePropertyDeviceMaster), 0, NULL, size, &pid);
		}
		catch (...)
		{
			// Unable to acquire mastership
			return false;
		}
		
		return true;
	}
	//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	// TakeHogMode()
	//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	bool Device::TakeHogMode()
	{
		try
		{
			pid_t pid = getpid();
			UInt32 size = sizeof(pid_t);
			SetPropertyData(PropertyAddress(kCMIODevicePropertyHogMode), 0, NULL, size, &pid);
		}
		catch (...)
		{
			// Unable to acquire the hog
			return false;
		}
		
		return true;
	}
Ejemplo n.º 6
0
OSStatus
PA_Stream::SetProperty(const AudioTimeStamp * /* inWhen */,
		       UInt32 inChannel,
		       AudioDevicePropertyID inPropertyID,
		       UInt32 inPropertyDataSize,
		       const void *inPropertyData)
{
	AudioObjectPropertyAddress addr;
	
	addr.mSelector = inPropertyID;
	addr.mElement = inChannel;
	addr.mScope = 0;
	
	if (!HasProperty(&addr))
		return kAudioHardwareUnknownPropertyError;
	
	return SetPropertyData(&addr, 0, NULL, inPropertyDataSize, inPropertyData);
}
Ejemplo n.º 7
0
void	CAAudioHardwareSystem::SetDefaultDevice(bool inIsInput, bool inIsSystem, AudioDeviceID inDevice)
{
	AudioHardwarePropertyID thePropertyID = 0;
	if(inIsInput)
	{
		thePropertyID = kAudioHardwarePropertyDefaultInputDevice;
	}
	else if(inIsSystem)
	{
		thePropertyID = kAudioHardwarePropertyDefaultSystemOutputDevice;
	}
	else
	{
		thePropertyID = kAudioHardwarePropertyDefaultOutputDevice;
	}
	UInt32 theSize = sizeof(AudioDeviceID);
	SetPropertyData(thePropertyID, theSize, &inDevice);
}
Ejemplo n.º 8
0
void	CAHALAudioDevice::SetIOProcStreamUsage(AudioDeviceIOProcID inIOProcID, bool inIsInput, const bool* inStreamUsage)
{
	//	make an AudioHardwareIOProcStreamUsage the right size
	UInt32 theNumberStreams = GetNumberStreams(inIsInput);
	UInt32 theSize = SizeOf32(void*) + SizeOf32(UInt32) + (theNumberStreams * SizeOf32(UInt32));
	CAAutoFree<AudioHardwareIOProcStreamUsage> theStreamUsage(theSize);
	
	//	set it up
	theStreamUsage->mIOProc = reinterpret_cast<void*>(inIOProcID);
	theStreamUsage->mNumberStreams = theNumberStreams;
	for(UInt32 theIndex = 0; theIndex < theNumberStreams; ++theIndex)
	{
		theStreamUsage->mStreamIsOn[theIndex] = (inStreamUsage[theIndex] ? 1 : 0);
	}
	
	//	set the property
	CAPropertyAddress theAddress(kAudioDevicePropertyIOProcStreamUsage, inIsInput ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput);
	SetPropertyData(theAddress, 0, NULL, theSize, theStreamUsage);
}
	//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	// SetScheduledOutputNotificationProcAndRefCon()
	//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	void Stream::SetScheduledOutputNotificationProcAndRefCon(const CMIOStreamScheduledOutputNotificationProcAndRefCon& scheduledOutputNotificationProcAndRefCon)
	{
		UInt32 size = sizeof(CMIOStreamScheduledOutputNotificationProcAndRefCon);
		SetPropertyData(PropertyAddress(kCMIOStreamPropertyScheduledOutputNotificationProc), 0, NULL, size, &scheduledOutputNotificationProcAndRefCon);
	}
Ejemplo n.º 10
0
	//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	// SetOutputBuffersRequiredForStartup()
	//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	void Stream::SetOutputBuffersRequiredForStartup(UInt32 bufferCount)
	{
		UInt32 size = sizeof(UInt32);
		SetPropertyData(PropertyAddress(kCMIOStreamPropertyOutputBuffersRequiredForStartup), 0, NULL, size, &bufferCount);
	}
Ejemplo n.º 11
0
	//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	// SetOutputBufferQueueSize()
	//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	void Stream::SetOutputBufferQueueSize(UInt32 queueSize)
	{
		UInt32 size = sizeof(UInt32);
		SetPropertyData(PropertyAddress(kCMIOStreamPropertyOutputBufferQueueSize), 0, NULL, size, &queueSize);
	}
Ejemplo n.º 12
0
	//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	// SetEndOfData()
	//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	void Stream::SetEndOfData(bool endOfData)
	{
		UInt32 theEndOfData = endOfData ? 1 : 0;
		UInt32 size = sizeof(UInt32);
		SetPropertyData(PropertyAddress(kCMIOStreamPropertyEndOfData), 0, NULL, size, &theEndOfData);
	}
	//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	// FeatureControl::SetTune()
	//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	void FeatureControl::SetTune(bool tune)
	{
		UInt32 value = (tune ? 1 : 0);
		UInt32 size = sizeof(UInt32);
		SetPropertyData(PropertyAddress(kCMIOFeatureControlPropertyTune), 0, NULL, size, &value);
	}
Ejemplo n.º 14
0
void	CAAudioHardwareSystem::SetAllowsIdleSleepDuringIO(bool inAllowIdleSleep)
{
	UInt32 theValue = inAllowIdleSleep ? 1 : 0;
	SetPropertyData(kAudioHardwarePropertySleepingIsAllowed, sizeof(UInt32), &theValue);
}
void	CAAudioHardwareStream::SetCurrentIOProcFormat(const AudioStreamBasicDescription& inFormat)
{
	UInt32 theSize = sizeof(AudioStreamBasicDescription);
	SetPropertyData(0, kAudioDevicePropertyStreamFormat, theSize, &inFormat);
}
Ejemplo n.º 16
0
void	CAHALAudioSystemObject::SetDefaultAudioDevice(bool inIsInput, bool inIsSystem, AudioObjectID inNewDefaultDevice)
{
	CAPropertyAddress theAddress(CAHALAudioSystemObject_CalculateDefaultDeviceProperySelector(inIsInput, inIsSystem));
	UInt32 theSize = sizeof(AudioObjectID);
	SetPropertyData(theAddress, 0, NULL, theSize, &inNewDefaultDevice);
}
	//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	// FeatureControl::SetOnOff()
	//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	void FeatureControl::SetOnOff(bool onOff)
	{
		UInt32 value = (onOff ? 1 : 0);
		UInt32 size = sizeof(UInt32);
		SetPropertyData(PropertyAddress(kCMIOFeatureControlPropertyOnOff), 0, NULL, size, &value);
	}
	//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	// FeatureControl::SetAutomaticManual()
	//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	void FeatureControl::SetAutomaticManual(bool automaticManual)
	{
		UInt32 value = (automaticManual ? 1 : 0);
		UInt32 size = sizeof(UInt32);
		SetPropertyData(PropertyAddress(kCMIOFeatureControlPropertyAutomaticManual), 0, NULL, size, &value);
	}
Ejemplo n.º 19
0
	void Device::SetIsRunning(bool isRunning)
	{
		UInt32 value = isRunning ? 1 : 0;
		UInt32 size = sizeof(UInt32);
		SetPropertyData(PropertyAddress(kCMIODevicePropertyDeviceIsRunning), 0, NULL, size, &value);
	}
	//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	// FeatureControl::SetAbsoluteValue()
	//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	void FeatureControl::SetAbsoluteValue(Float32 absoluteValue)
	{
		UInt32 size = sizeof(Float32);
		SetPropertyData(PropertyAddress(kCMIOFeatureControlPropertyAbsoluteValue), 0, NULL, size, &absoluteValue);
	}
	//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	// FeatureControl::SetNativeValue()
	//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	void FeatureControl::SetNativeValue(Float32 nativeValue)
	{
		UInt32 size = sizeof(Float32);
		SetPropertyData(PropertyAddress(kCMIOFeatureControlPropertyNativeValue), 0, NULL, size, &nativeValue);
	}
Ejemplo n.º 22
0
void	CAAudioHardwareSystem::SetBootChimeVolumeControlValueAsScalar(Float32 inScalarValue)
{
	UInt32 theSize = sizeof(Float32);
	SetPropertyData(kAudioHardwarePropertyBootChimeVolumeScalar, theSize, &inScalarValue);
}
Ejemplo n.º 23
0
void	CAAudioHardwareSystem::SetBootChimeVolumeControlValueAsDB(Float32 inDBValue)
{
	UInt32 theSize = sizeof(Float32);
	SetPropertyData(kAudioHardwarePropertyBootChimeVolumeDecibels, theSize, &inDBValue);
}
Ejemplo n.º 24
0
	//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	// SetMinimumFrameRate()
	//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	void Stream::SetMinimumFrameRate(Float64 sampleRate)
	{
		UInt32 size = sizeof(Float64);
		SetPropertyData(PropertyAddress(kCMIOStreamPropertyMinimumFrameRate), 0, NULL, size, &sampleRate);
	}
Ejemplo n.º 25
0
	//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	// ReleaseDeviceMaster()
	//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	void Device::ReleaseDeviceMaster()
	{
		pid_t pid = -1;
		UInt32 size = sizeof(pid_t);
		SetPropertyData(PropertyAddress(kCMIODevicePropertyDeviceMaster), 0, NULL, size, &pid);
	}
	//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	// FeatureControl::SetAbsoluteNative()
	//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	void FeatureControl::SetAbsoluteNative(bool absoluteNative)
	{
		UInt32 value = (absoluteNative ? 1 : 0);
		UInt32 size = sizeof(UInt32);
		SetPropertyData(PropertyAddress(kCMIOFeatureControlPropertyAbsoluteNative), 0, NULL, size, &value);
	}
void	CAAudioHardwareStream::SetCurrentDataSourceByID(UInt32 inID)
{
	UInt32 theSize = sizeof(UInt32);
	SetPropertyData(0, kAudioDevicePropertyDataSource, theSize, &inID);
}
Ejemplo n.º 28
0
	//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	// SetExcludeNonDALAccess()
	//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	void Device::SetExcludeNonDALAccess(bool exclude)
	{
		UInt32 excludeNonDALAccess = exclude ? 1 : 0;
		UInt32 size = sizeof(UInt32);
		SetPropertyData(PropertyAddress(kCMIODevicePropertyDeviceMaster), 0, NULL, size, &excludeNonDALAccess);
	}
void	CAAudioHardwareStream::SetCurrentPhysicalFormat(const AudioStreamBasicDescription& inFormat)
{
	UInt32 theSize = sizeof(AudioStreamBasicDescription);
	SetPropertyData(0, kAudioStreamPropertyPhysicalFormat, theSize, &inFormat);
}
Ejemplo n.º 30
0
	//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	// SetPreferredFormat()
	//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	void Stream::SetPreferredFormat(CMFormatDescriptionRef format)
	{
		UInt32 size = sizeof(CMFormatDescriptionRef);
		SetPropertyData(PropertyAddress(kCMIOStreamPropertyPreferredFormatDescription), 0, NULL, size, &format);
	}