Mercurial > projects > dstep
diff dstep/coreaudio/AudioHardware.d @ 16:19885b43130e
Huge update, the bridge actually works now
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Sun, 03 Jan 2010 22:06:11 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/coreaudio/AudioHardware.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,678 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 30, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.coreaudio.AudioHardware; + +import dstep.coreaudio.CoreAudioTypes; +import dstep.corefoundation.CoreFoundation; +import dstep.internal.Version; +import dstep.objc.bridge.TypeEncoding; + +alias uint AudioObjectPropertySelector; +alias uint AudioObjectPropertyScope; +alias uint AudioObjectPropertyElement; +alias uint AudioClassID; +alias uint AudioObjectID; +alias uint AudioHardwarePropertyID; +alias uint AudioDeviceID; +alias uint AudioDevicePropertyID; +alias AudioDeviceIOProc AudioDeviceIOProcID; +alias uint AudioStreamID; + +extern (C) +{ + alias int function (AudioDeviceID inDevice, uint inChannel, bool isInput, AudioDevicePropertyID inPropertyID) AudioDevicePropertyListenerProc; + alias int function (AudioDevicePropertyID inPropertyID, void* inClientData) AudioHardwarePropertyListenerProc; + alias int function (AudioDeviceID inDevice, AudioTimeStamp* inNow, AudioBufferList* inInputData, AudioTimeStamp* inInputTime, AudioBufferList* outOutputData, AudioTimeStamp* inOutputTime, void* inClientData) AudioDeviceIOProc; + alias int function (AudioStreamID inStream, uint inChannel, AudioDevicePropertyID inPropertyID, void* inClientData) AudioStreamPropertyListenerProc; + alias int function (AudioObjectID inObjectID, uint inNumberAddresses, AudioObjectPropertyAddress* inAddresses, void* inClientData) AudioObjectPropertyListenerProc; +} + +// This is needed otherwise the enums will fail compiling with gdc +version (GNU) +{ + private + { + const __kAudioHardwareNotRunningError = getOSType!("stop"); + const __kAudioHardwareUnspecifiedError = getOSType!("what"); + const __kAudioHardwareUnknownPropertyError = getOSType!("who?"); + const __kAudioHardwareBadPropertySizeError = getOSType!("!siz"); + const __kAudioHardwareIllegalOperationError = getOSType!("nope"); + const __kAudioHardwareBadObjectError = getOSType!("!obj"); + const __kAudioHardwareBadDeviceError = getOSType!("!dev"); + const __kAudioHardwareBadStreamError = getOSType!("!str"); + const __kAudioHardwareUnsupportedOperationError = getOSType!("unop"); + const __kAudioDeviceUnsupportedFormatError = getOSType!("!dat"); + const __kAudioDevicePermissionsError = getOSType!("!hog"); + const __kAudioObjectPropertySelectorWildcard = getOSType!("****"); + const __kAudioObjectPropertyScopeWildcard = getOSType!("****"); + const __kAudioObjectPropertyScopeGlobal = getOSType!("glob"); + const __kAudioObjectClassID = getOSType!("aobj"); + const __kAudioObjectClassIDWildcard = getOSType!("****"); + const __kAudioObjectPropertyClass = getOSType!("clas"); + const __kAudioObjectPropertyOwner = getOSType!("stdv"); + const __kAudioObjectPropertyCreator = getOSType!("oplg"); + const __kAudioObjectPropertyName = getOSType!("lnam"); + const __kAudioObjectPropertyManufacturer = getOSType!("lmak"); + const __kAudioObjectPropertyElementName = getOSType!("lchn"); + const __kAudioObjectPropertyElementCategoryName = getOSType!("lccn"); + const __kAudioObjectPropertyElementNumberName = getOSType!("lcnn"); + const __kAudioObjectPropertyOwnedObjects = getOSType!("ownd"); + const __kAudioObjectPropertyListenerAdded = getOSType!("lisa"); + const __kAudioObjectPropertyListenerRemoved = getOSType!("lisr"); + const __kAudioControlClassID = getOSType!("actl"); + const __kAudioLevelControlClassID = getOSType!("levl"); + const __kAudioBooleanControlClassID = getOSType!("togl"); + const __kAudioSelectorControlClassID = getOSType!("slct"); + const __kAudioStereoPanControlClassID = getOSType!("span"); + const __kAudioVolumeControlClassID = getOSType!("vlme"); + const __kAudioLFEVolumeControlClassID = getOSType!("subv"); + const __kAudioBootChimeVolumeControlClassID = getOSType!("pram"); + const __kAudioMuteControlClassID = getOSType!("mute"); + const __kAudioSoloControlClassID = getOSType!("solo"); + const __kAudioJackControlClassID = getOSType!("jack"); + const __kAudioLFEMuteControlClassID = getOSType!("subm"); + const __kAudioISubOwnerControlClassID = getOSType!("atch"); + const __kAudioDataSourceControlClassID = getOSType!("dsrc"); + const __kAudioDataDestinationControlClassID = getOSType!("dest"); + const __kAudioClockSourceControlClassID = getOSType!("clck"); + const __kAudioLineLevelControlClassID = getOSType!("nlvl"); + const __kAudioControlPropertyScope = getOSType!("cscp"); + const __kAudioControlPropertyElement = getOSType!("celm"); + const __kAudioControlPropertyVariant = getOSType!("cvar"); + const __kAudioLevelControlPropertyScalarValue = getOSType!("lcsv"); + const __kAudioLevelControlPropertyDecibelValue = getOSType!("lcdv"); + const __kAudioLevelControlPropertyDecibelRange = getOSType!("lcdr"); + const __kAudioLevelControlPropertyConvertScalarToDecibels = getOSType!("lcsd"); + const __kAudioLevelControlPropertyConvertDecibelsToScalar = getOSType!("lcds"); + const __kAudioLevelControlPropertyDecibelsToScalarTransferFunction = getOSType!("lctf"); + const __kAudioBooleanControlPropertyValue = getOSType!("bcvl"); + const __kAudioSelectorControlPropertyCurrentItem = getOSType!("scci"); + const __kAudioSelectorControlPropertyAvailableItems = getOSType!("scai"); + const __kAudioSelectorControlPropertyItemName = getOSType!("scin"); + const __kAudioClockSourceControlPropertyItemKind = getOSType!("clkk"); + const __kAudioStereoPanControlPropertyValue = getOSType!("spcv"); + const __kAudioStereoPanControlPropertyPanningChannels = getOSType!("spcc"); + const __kAudioSystemObjectClassID = getOSType!("asys"); + const __kAudioHardwarePropertyProcessIsMaster = getOSType!("mast"); + const __kAudioHardwarePropertyIsInitingOrExiting = getOSType!("inot"); + const __kAudioHardwarePropertyDevices = getOSType!("dev#"); + const __kAudioHardwarePropertyDefaultInputDevice = getOSType!("dIn "); + const __kAudioHardwarePropertyDefaultOutputDevice = getOSType!("dOut"); + const __kAudioHardwarePropertyDefaultSystemOutputDevice = getOSType!("sOut"); + const __kAudioHardwarePropertyDeviceForUID = getOSType!("duid"); + const __kAudioHardwarePropertyProcessIsAudible = getOSType!("pmut"); + const __kAudioHardwarePropertySleepingIsAllowed = getOSType!("slep"); + const __kAudioHardwarePropertyUnloadingIsAllowed = getOSType!("unld"); + const __kAudioHardwarePropertyHogModeIsAllowed = getOSType!("hogr"); + const __kAudioHardwarePropertyRunLoop = getOSType!("rnlp"); + const __kAudioHardwarePropertyPlugInForBundleID = getOSType!("pibi"); + const __kAudioHardwarePropertyUserSessionIsActiveOrHeadless = getOSType!("user"); + const __kAudioHardwarePropertyBootChimeVolumeScalar = getOSType!("bbvs"); + const __kAudioHardwarePropertyBootChimeVolumeDecibels = getOSType!("bbvd"); + const __kAudioHardwarePropertyBootChimeVolumeRangeDecibels = getOSType!("bbd#"); + const __kAudioHardwarePropertyBootChimeVolumeScalarToDecibels = getOSType!("bv2d"); + const __kAudioHardwarePropertyBootChimeVolumeDecibelsToScalar = getOSType!("bd2v"); + const __kAudioHardwarePropertyBootChimeVolumeDecibelsToScalarTransferFunction = getOSType!("bvtf"); + const __kAudioPlugInClassID = getOSType!("aplg"); + const __kAudioPlugInPropertyBundleID = getOSType!("piid"); + const __kAudioPlugInCreateAggregateDevice = getOSType!("cagg"); + const __kAudioPlugInDestroyAggregateDevice = getOSType!("dagg"); + const __kAudioDevicePropertyScopeInput = getOSType!("inpt"); + const __kAudioDevicePropertyScopeOutput = getOSType!("outp"); + const __kAudioDevicePropertyScopePlayThrough = getOSType!("ptru"); + const __kAudioDeviceClassID = getOSType!("adev"); + const __kAudioDevicePropertyPlugIn = getOSType!("plug"); + const __kAudioDevicePropertyConfigurationApplication = getOSType!("capp"); + const __kAudioDevicePropertyDeviceUID = getOSType!("uid "); + const __kAudioDevicePropertyModelUID = getOSType!("muid"); + const __kAudioDevicePropertyTransportType = getOSType!("tran"); + const __kAudioDevicePropertyRelatedDevices = getOSType!("akin"); + const __kAudioDevicePropertyClockDomain = getOSType!("clkd"); + const __kAudioDevicePropertyDeviceIsAlive = getOSType!("livn"); + const __kAudioDevicePropertyDeviceHasChanged = getOSType!("diff"); + const __kAudioDevicePropertyDeviceIsRunning = getOSType!("goin"); + const __kAudioDevicePropertyDeviceIsRunningSomewhere = getOSType!("gone"); + const __kAudioDevicePropertyDeviceCanBeDefaultDevice = getOSType!("dflt"); + const __kAudioDevicePropertyDeviceCanBeDefaultSystemDevice = getOSType!("sflt"); + const __kAudioDeviceProcessorOverload = getOSType!("over"); + const __kAudioDevicePropertyHogMode = getOSType!("oink"); + const __kAudioDevicePropertyLatency = getOSType!("ltnc"); + const __kAudioDevicePropertyBufferFrameSize = getOSType!("fsiz"); + const __kAudioDevicePropertyBufferFrameSizeRange = getOSType!("fsz#"); + const __kAudioDevicePropertyUsesVariableBufferFrameSizes = getOSType!("vfsz"); + const __kAudioDevicePropertyStreams = getOSType!("stm#"); + const __kAudioDevicePropertySafetyOffset = getOSType!("saft"); + const __kAudioDevicePropertyIOCycleUsage = getOSType!("ncyc"); + const __kAudioDevicePropertyStreamConfiguration = getOSType!("slay"); + const __kAudioDevicePropertyIOProcStreamUsage = getOSType!("suse"); + const __kAudioDevicePropertyPreferredChannelsForStereo = getOSType!("dch2"); + const __kAudioDevicePropertyPreferredChannelLayout = getOSType!("srnd"); + const __kAudioDevicePropertyNominalSampleRate = getOSType!("nsrt"); + const __kAudioDevicePropertyAvailableNominalSampleRates = getOSType!("nsr#"); + const __kAudioDevicePropertyActualSampleRate = getOSType!("asrt"); + const __kAudioDevicePropertyIcon = getOSType!("icon"); + const __kAudioDevicePropertyIsHidden = getOSType!("hidn"); + const __kAudioDevicePropertyJackIsConnected = getOSType!("jack"); + const __kAudioDevicePropertyVolumeScalar = getOSType!("volm"); + const __kAudioDevicePropertyVolumeDecibels = getOSType!("vold"); + const __kAudioDevicePropertyVolumeRangeDecibels = getOSType!("vdb#"); + const __kAudioDevicePropertyVolumeScalarToDecibels = getOSType!("v2db"); + const __kAudioDevicePropertyVolumeDecibelsToScalar = getOSType!("db2v"); + const __kAudioDevicePropertyVolumeDecibelsToScalarTransferFunction = getOSType!("vctf"); + const __kAudioDevicePropertyStereoPan = getOSType!("span"); + const __kAudioDevicePropertyStereoPanChannels = getOSType!("spn#"); + const __kAudioDevicePropertyMute = getOSType!("mute"); + const __kAudioDevicePropertySolo = getOSType!("solo"); + const __kAudioDevicePropertyDataSource = getOSType!("ssrc"); + const __kAudioDevicePropertyDataSources = getOSType!("ssc#"); + const __kAudioDevicePropertyDataSourceNameForIDCFString = getOSType!("lscn"); + const __kAudioDevicePropertyClockSource = getOSType!("csrc"); + const __kAudioDevicePropertyClockSources = getOSType!("csc#"); + const __kAudioDevicePropertyClockSourceNameForIDCFString = getOSType!("lcsn"); + const __kAudioDevicePropertyClockSourceKindForID = getOSType!("csck"); + const __kAudioDevicePropertyPlayThru = getOSType!("thru"); + const __kAudioDevicePropertyPlayThruSolo = getOSType!("thrs"); + const __kAudioDevicePropertyPlayThruVolumeScalar = getOSType!("mvsc"); + const __kAudioDevicePropertyPlayThruVolumeDecibels = getOSType!("mvdb"); + const __kAudioDevicePropertyPlayThruVolumeRangeDecibels = getOSType!("mvd#"); + const __kAudioDevicePropertyPlayThruVolumeScalarToDecibels = getOSType!("mv2d"); + const __kAudioDevicePropertyPlayThruVolumeDecibelsToScalar = getOSType!("mv2s"); + const __kAudioDevicePropertyPlayThruVolumeDecibelsToScalarTransferFunction = getOSType!("mvtf"); + const __kAudioDevicePropertyPlayThruStereoPan = getOSType!("mspn"); + const __kAudioDevicePropertyPlayThruStereoPanChannels = getOSType!("msp#"); + const __kAudioDevicePropertyPlayThruDestination = getOSType!("mdds"); + const __kAudioDevicePropertyPlayThruDestinations = getOSType!("mdd#"); + const __kAudioDevicePropertyPlayThruDestinationNameForIDCFString = getOSType!("mddc"); + const __kAudioDevicePropertyChannelNominalLineLevel = getOSType!("nlvl"); + const __kAudioDevicePropertyChannelNominalLineLevels = getOSType!("nlv#"); + const __kAudioDevicePropertyChannelNominalLineLevelNameForIDCFString = getOSType!("lcnl"); + const __kAudioDevicePropertyDriverShouldOwniSub = getOSType!("isub"); + const __kAudioDevicePropertySubVolumeScalar = getOSType!("svlm"); + const __kAudioDevicePropertySubVolumeDecibels = getOSType!("svld"); + const __kAudioDevicePropertySubVolumeRangeDecibels = getOSType!("svd#"); + const __kAudioDevicePropertySubVolumeScalarToDecibels = getOSType!("sv2d"); + const __kAudioDevicePropertySubVolumeDecibelsToScalar = getOSType!("sd2v"); + const __kAudioDevicePropertySubVolumeDecibelsToScalarTransferFunction = getOSType!("svtf"); + const __kAudioDevicePropertySubMute = getOSType!("smut"); + const __kAudioDevicePropertyDeviceName = getOSType!("name"); + const __kAudioDevicePropertyDeviceManufacturer = getOSType!("makr"); + const __kAudioDevicePropertyRegisterBufferList = getOSType!("rbuf"); + const __kAudioDevicePropertyBufferSize = getOSType!("bsiz"); + const __kAudioDevicePropertyBufferSizeRange = getOSType!("bsz#"); + const __kAudioDevicePropertyChannelName = getOSType!("chnm"); + const __kAudioDevicePropertyChannelCategoryName = getOSType!("ccnm"); + const __kAudioDevicePropertyChannelNumberName = getOSType!("cnnm"); + const __kAudioDevicePropertySupportsMixing = getOSType!("mix?"); + const __kAudioDevicePropertyStreamFormat = getOSType!("sfmt"); + const __kAudioDevicePropertyStreamFormats = getOSType!("sfm#"); + const __kAudioDevicePropertyStreamFormatSupported = getOSType!("sfm?"); + const __kAudioDevicePropertyStreamFormatMatch = getOSType!("sfmm"); + const __kAudioDevicePropertyDataSourceNameForID = getOSType!("sscn"); + const __kAudioDevicePropertyClockSourceNameForID = getOSType!("cscn"); + const __kAudioDevicePropertyPlayThruDestinationNameForID = getOSType!("mddn"); + const __kAudioDevicePropertyChannelNominalLineLevelNameForID = getOSType!("cnlv"); + const __kAudioStreamClassID = getOSType!("astr"); + const __kAudioStreamPropertyDirection = getOSType!("sdir"); + const __kAudioStreamPropertyTerminalType = getOSType!("term"); + const __kAudioStreamPropertyStartingChannel = getOSType!("schn"); + const __kAudioStreamPropertyVirtualFormat = getOSType!("sfmt"); + const __kAudioStreamPropertyAvailableVirtualFormats = getOSType!("sfma"); + const __kAudioStreamPropertyPhysicalFormat = getOSType!("pft "); + const __kAudioStreamPropertyAvailablePhysicalFormats = getOSType!("pfta"); + const __kAudioStreamPropertyPhysicalFormats = getOSType!("pft#"); + const __kAudioStreamPropertyPhysicalFormatSupported = getOSType!("pft?"); + const __kAudioStreamPropertyPhysicalFormatMatch = getOSType!("pftm"); + const __kAudioAggregateDeviceClassID = getOSType!("aagg"); + const __kAudioDeviceTransportTypeAggregate = getOSType!("grup"); + const __kAudioDeviceTransportTypeAutoAggregate = getOSType!("fgrp"); + const __kAudioAggregateDevicePropertyFullSubDeviceList = getOSType!("grup"); + const __kAudioAggregateDevicePropertyActiveSubDeviceList = getOSType!("agrp"); + const __kAudioAggregateDevicePropertyComposition = getOSType!("acom"); + const __kAudioAggregateDevicePropertyMasterSubDevice = getOSType!("amst"); + const __kAudioSubDeviceClassID = getOSType!("asub"); + const __kAudioSubDevicePropertyExtraLatency = getOSType!("xltc"); + const __kAudioSubDevicePropertyDriftCompensation = getOSType!("drft"); + const __kAudioSubDevicePropertyDriftCompensationQuality = getOSType!("drfq"); + } +} + +enum +{ + kAudioHardwareNoError = 0, + kAudioHardwareNotRunningError = getOSType!("stop"), + kAudioHardwareUnspecifiedError = getOSType!("what"), + kAudioHardwareUnknownPropertyError = getOSType!("who?"), + kAudioHardwareBadPropertySizeError = getOSType!("!siz"), + kAudioHardwareIllegalOperationError = getOSType!("nope"), + kAudioHardwareBadObjectError = getOSType!("!obj"), + kAudioHardwareBadDeviceError = getOSType!("!dev"), + kAudioHardwareBadStreamError = getOSType!("!str"), + kAudioHardwareUnsupportedOperationError = getOSType!("unop"), + kAudioDeviceUnsupportedFormatError = getOSType!("!dat"), + kAudioDevicePermissionsError = getOSType!("!hog") +} + +version (D_LP64) +{ + enum : ulong + { + kAudioObjectPropertySelectorWildcard = getOSType!("****"), + kAudioObjectPropertyScopeWildcard = getOSType!("****"), + kAudioObjectPropertyElementWildcard = 0xFFFFFFFFUL, + kAudioPropertyWildcardPropertyID = kAudioObjectPropertySelectorWildcard, + kAudioPropertyWildcardSection = 0xFF, + kAudioPropertyWildcardChannel = kAudioObjectPropertyElementWildcard + } +} + +else +{ + enum + { + kAudioObjectPropertySelectorWildcard = getOSType!("****"), + kAudioObjectPropertyScopeWildcard = getOSType!("****"), + kAudioObjectPropertyElementWildcard = 0xFFFFFFFFU, + kAudioPropertyWildcardPropertyID = kAudioObjectPropertySelectorWildcard, + kAudioPropertyWildcardSection = 0xFF, + kAudioPropertyWildcardChannel = kAudioObjectPropertyElementWildcard + } +} + +enum +{ + kAudioObjectPropertyScopeGlobal = getOSType!("glob"), + kAudioObjectPropertyElementMaster = 0UL, + kAudioObjectClassID = getOSType!("aobj"), + kAudioObjectClassIDWildcard = getOSType!("****"), + kAudioObjectUnknown = 0UL +} + +enum +{ + kAudioObjectPropertyClass = getOSType!("clas"), + kAudioObjectPropertyOwner = getOSType!("stdv"), + kAudioObjectPropertyCreator = getOSType!("oplg"), + kAudioObjectPropertyName = getOSType!("lnam"), + kAudioObjectPropertyManufacturer = getOSType!("lmak"), + kAudioObjectPropertyElementName = getOSType!("lchn"), + kAudioObjectPropertyElementCategoryName = getOSType!("lccn"), + kAudioObjectPropertyElementNumberName = getOSType!("lcnn"), + kAudioObjectPropertyOwnedObjects = getOSType!("ownd"), + kAudioObjectPropertyListenerAdded = getOSType!("lisa"), + kAudioObjectPropertyListenerRemoved = getOSType!("lisr") +} + +enum +{ + kAudioControlClassID = getOSType!("actl"), + kAudioLevelControlClassID = getOSType!("levl"), + kAudioBooleanControlClassID = getOSType!("togl"), + kAudioSelectorControlClassID = getOSType!("slct"), + kAudioStereoPanControlClassID = getOSType!("span") +} + +enum +{ + kAudioVolumeControlClassID = getOSType!("vlme"), + kAudioLFEVolumeControlClassID = getOSType!("subv"), + kAudioBootChimeVolumeControlClassID = getOSType!("pram") +} + +enum +{ + kAudioMuteControlClassID = getOSType!("mute"), + kAudioSoloControlClassID = getOSType!("solo"), + kAudioJackControlClassID = getOSType!("jack"), + kAudioLFEMuteControlClassID = getOSType!("subm"), + kAudioISubOwnerControlClassID = getOSType!("atch") +} + +enum +{ + kAudioDataSourceControlClassID = getOSType!("dsrc"), + kAudioDataDestinationControlClassID = getOSType!("dest"), + kAudioClockSourceControlClassID = getOSType!("clck"), + kAudioLineLevelControlClassID = getOSType!("nlvl") +} + +enum +{ + kAudioControlPropertyScope = getOSType!("cscp"), + kAudioControlPropertyElement = getOSType!("celm"), + kAudioControlPropertyVariant = getOSType!("cvar") +} + +enum +{ + kAudioLevelControlPropertyScalarValue = getOSType!("lcsv"), + kAudioLevelControlPropertyDecibelValue = getOSType!("lcdv"), + kAudioLevelControlPropertyDecibelRange = getOSType!("lcdr"), + kAudioLevelControlPropertyConvertScalarToDecibels = getOSType!("lcsd"), + kAudioLevelControlPropertyConvertDecibelsToScalar = getOSType!("lcds"), + kAudioLevelControlPropertyDecibelsToScalarTransferFunction = getOSType!("lctf") +} + +enum +{ + kAudioBooleanControlPropertyValue = getOSType!("bcvl") +} + +enum +{ + kAudioSelectorControlPropertyCurrentItem = getOSType!("scci"), + kAudioSelectorControlPropertyAvailableItems = getOSType!("scai"), + kAudioSelectorControlPropertyItemName = getOSType!("scin") +} + +enum +{ + kAudioClockSourceControlPropertyItemKind = getOSType!("clkk") +} + +enum +{ + kAudioStereoPanControlPropertyValue = getOSType!("spcv"), + kAudioStereoPanControlPropertyPanningChannels = getOSType!("spcc") +} + +enum +{ + kAudioSystemObjectClassID = getOSType!("asys"), + kAudioObjectSystemObject = 1UL +} + +enum +{ + kAudioHardwarePropertyProcessIsMaster = getOSType!("mast"), + kAudioHardwarePropertyIsInitingOrExiting = getOSType!("inot"), + kAudioHardwarePropertyDevices = getOSType!("dev#"), + kAudioHardwarePropertyDefaultInputDevice = getOSType!("dIn "), + kAudioHardwarePropertyDefaultOutputDevice = getOSType!("dOut"), + kAudioHardwarePropertyDefaultSystemOutputDevice = getOSType!("sOut"), + kAudioHardwarePropertyDeviceForUID = getOSType!("duid"), + kAudioHardwarePropertyProcessIsAudible = getOSType!("pmut"), + kAudioHardwarePropertySleepingIsAllowed = getOSType!("slep"), + kAudioHardwarePropertyUnloadingIsAllowed = getOSType!("unld"), + kAudioHardwarePropertyHogModeIsAllowed = getOSType!("hogr"), + kAudioHardwarePropertyRunLoop = getOSType!("rnlp"), + kAudioHardwarePropertyPlugInForBundleID = getOSType!("pibi"), + kAudioHardwarePropertyUserSessionIsActiveOrHeadless = getOSType!("user") +} + +enum +{ + kAudioHardwarePropertyBootChimeVolumeScalar = getOSType!("bbvs"), + kAudioHardwarePropertyBootChimeVolumeDecibels = getOSType!("bbvd"), + kAudioHardwarePropertyBootChimeVolumeRangeDecibels = getOSType!("bbd#"), + kAudioHardwarePropertyBootChimeVolumeScalarToDecibels = getOSType!("bv2d"), + kAudioHardwarePropertyBootChimeVolumeDecibelsToScalar = getOSType!("bd2v"), + kAudioHardwarePropertyBootChimeVolumeDecibelsToScalarTransferFunction = getOSType!("bvtf") +} + +enum +{ + kAudioPlugInClassID = getOSType!("aplg") +} + +enum +{ + kAudioPlugInPropertyBundleID = getOSType!("piid"), + kAudioPlugInCreateAggregateDevice = getOSType!("cagg"), + kAudioPlugInDestroyAggregateDevice = getOSType!("dagg") +} + +enum +{ + kAudioDevicePropertyScopeInput = getOSType!("inpt"), + kAudioDevicePropertyScopeOutput = getOSType!("outp"), + kAudioDevicePropertyScopePlayThrough = getOSType!("ptru"), + kAudioDeviceClassID = getOSType!("adev"), + kAudioDeviceUnknown = kAudioObjectUnknown +} + +enum +{ + kAudioDeviceStartTimeIsInputFlag = (1L << 0), + kAudioDeviceStartTimeDontConsultDeviceFlag = (1L << 1), + kAudioDeviceStartTimeDontConsultHALFlag = (1L << 2) +} + +enum +{ + kAudioDevicePropertyPlugIn = getOSType!("plug"), + kAudioDevicePropertyConfigurationApplication = getOSType!("capp"), + kAudioDevicePropertyDeviceUID = getOSType!("uid "), + kAudioDevicePropertyModelUID = getOSType!("muid"), + kAudioDevicePropertyTransportType = getOSType!("tran"), + kAudioDevicePropertyRelatedDevices = getOSType!("akin"), + kAudioDevicePropertyClockDomain = getOSType!("clkd"), + kAudioDevicePropertyDeviceIsAlive = getOSType!("livn"), + kAudioDevicePropertyDeviceHasChanged = getOSType!("diff"), + kAudioDevicePropertyDeviceIsRunning = getOSType!("goin"), + kAudioDevicePropertyDeviceIsRunningSomewhere = getOSType!("gone"), + kAudioDevicePropertyDeviceCanBeDefaultDevice = getOSType!("dflt"), + kAudioDevicePropertyDeviceCanBeDefaultSystemDevice = getOSType!("sflt"), + kAudioDeviceProcessorOverload = getOSType!("over"), + kAudioDevicePropertyHogMode = getOSType!("oink"), + kAudioDevicePropertyLatency = getOSType!("ltnc"), + kAudioDevicePropertyBufferFrameSize = getOSType!("fsiz"), + kAudioDevicePropertyBufferFrameSizeRange = getOSType!("fsz#"), + kAudioDevicePropertyUsesVariableBufferFrameSizes = getOSType!("vfsz"), + kAudioDevicePropertyStreams = getOSType!("stm#"), + kAudioDevicePropertySafetyOffset = getOSType!("saft"), + kAudioDevicePropertyIOCycleUsage = getOSType!("ncyc"), + kAudioDevicePropertyStreamConfiguration = getOSType!("slay"), + kAudioDevicePropertyIOProcStreamUsage = getOSType!("suse"), + kAudioDevicePropertyPreferredChannelsForStereo = getOSType!("dch2"), + kAudioDevicePropertyPreferredChannelLayout = getOSType!("srnd"), + kAudioDevicePropertyNominalSampleRate = getOSType!("nsrt"), + kAudioDevicePropertyAvailableNominalSampleRates = getOSType!("nsr#"), + kAudioDevicePropertyActualSampleRate = getOSType!("asrt"), + kAudioDevicePropertyIcon = getOSType!("icon"), + kAudioDevicePropertyIsHidden = getOSType!("hidn") +} + +enum +{ + kAudioDevicePropertyJackIsConnected = getOSType!("jack"), + kAudioDevicePropertyVolumeScalar = getOSType!("volm"), + kAudioDevicePropertyVolumeDecibels = getOSType!("vold"), + kAudioDevicePropertyVolumeRangeDecibels = getOSType!("vdb#"), + kAudioDevicePropertyVolumeScalarToDecibels = getOSType!("v2db"), + kAudioDevicePropertyVolumeDecibelsToScalar = getOSType!("db2v"), + kAudioDevicePropertyVolumeDecibelsToScalarTransferFunction = getOSType!("vctf"), + kAudioDevicePropertyStereoPan = getOSType!("span"), + kAudioDevicePropertyStereoPanChannels = getOSType!("spn#"), + kAudioDevicePropertyMute = getOSType!("mute"), + kAudioDevicePropertySolo = getOSType!("solo"), + kAudioDevicePropertyDataSource = getOSType!("ssrc"), + kAudioDevicePropertyDataSources = getOSType!("ssc#"), + kAudioDevicePropertyDataSourceNameForIDCFString = getOSType!("lscn"), + kAudioDevicePropertyClockSource = getOSType!("csrc"), + kAudioDevicePropertyClockSources = getOSType!("csc#"), + kAudioDevicePropertyClockSourceNameForIDCFString = getOSType!("lcsn"), + kAudioDevicePropertyClockSourceKindForID = getOSType!("csck"), + kAudioDevicePropertyPlayThru = getOSType!("thru"), + kAudioDevicePropertyPlayThruSolo = getOSType!("thrs"), + kAudioDevicePropertyPlayThruVolumeScalar = getOSType!("mvsc"), + kAudioDevicePropertyPlayThruVolumeDecibels = getOSType!("mvdb"), + kAudioDevicePropertyPlayThruVolumeRangeDecibels = getOSType!("mvd#"), + kAudioDevicePropertyPlayThruVolumeScalarToDecibels = getOSType!("mv2d"), + kAudioDevicePropertyPlayThruVolumeDecibelsToScalar = getOSType!("mv2s"), + kAudioDevicePropertyPlayThruVolumeDecibelsToScalarTransferFunction = getOSType!("mvtf"), + kAudioDevicePropertyPlayThruStereoPan = getOSType!("mspn"), + kAudioDevicePropertyPlayThruStereoPanChannels = getOSType!("msp#"), + kAudioDevicePropertyPlayThruDestination = getOSType!("mdds"), + kAudioDevicePropertyPlayThruDestinations = getOSType!("mdd#"), + kAudioDevicePropertyPlayThruDestinationNameForIDCFString = getOSType!("mddc"), + kAudioDevicePropertyChannelNominalLineLevel = getOSType!("nlvl"), + kAudioDevicePropertyChannelNominalLineLevels = getOSType!("nlv#"), + kAudioDevicePropertyChannelNominalLineLevelNameForIDCFString = getOSType!("lcnl"), + kAudioDevicePropertyDriverShouldOwniSub = getOSType!("isub"), + kAudioDevicePropertySubVolumeScalar = getOSType!("svlm"), + kAudioDevicePropertySubVolumeDecibels = getOSType!("svld"), + kAudioDevicePropertySubVolumeRangeDecibels = getOSType!("svd#"), + kAudioDevicePropertySubVolumeScalarToDecibels = getOSType!("sv2d"), + kAudioDevicePropertySubVolumeDecibelsToScalar = getOSType!("sd2v"), + kAudioDevicePropertySubVolumeDecibelsToScalarTransferFunction = getOSType!("svtf"), + kAudioDevicePropertySubMute = getOSType!("smut") +} + +enum +{ + kAudioDevicePropertyDeviceName = getOSType!("name"), + kAudioDevicePropertyDeviceNameCFString = kAudioObjectPropertyName, + kAudioDevicePropertyDeviceManufacturer = getOSType!("makr"), + kAudioDevicePropertyDeviceManufacturerCFString = kAudioObjectPropertyManufacturer, + kAudioDevicePropertyRegisterBufferList = getOSType!("rbuf"), + kAudioDevicePropertyBufferSize = getOSType!("bsiz"), + kAudioDevicePropertyBufferSizeRange = getOSType!("bsz#"), + kAudioDevicePropertyChannelName = getOSType!("chnm"), + kAudioDevicePropertyChannelNameCFString = kAudioObjectPropertyElementName, + kAudioDevicePropertyChannelCategoryName = getOSType!("ccnm"), + kAudioDevicePropertyChannelCategoryNameCFString = kAudioObjectPropertyElementCategoryName, + kAudioDevicePropertyChannelNumberName = getOSType!("cnnm"), + kAudioDevicePropertyChannelNumberNameCFString = kAudioObjectPropertyElementNumberName, + kAudioDevicePropertySupportsMixing = getOSType!("mix?"), + kAudioDevicePropertyStreamFormat = getOSType!("sfmt"), + kAudioDevicePropertyStreamFormats = getOSType!("sfm#"), + kAudioDevicePropertyStreamFormatSupported = getOSType!("sfm?"), + kAudioDevicePropertyStreamFormatMatch = getOSType!("sfmm"), + kAudioDevicePropertyDataSourceNameForID = getOSType!("sscn"), + kAudioDevicePropertyClockSourceNameForID = getOSType!("cscn"), + kAudioDevicePropertyPlayThruDestinationNameForID = getOSType!("mddn"), + kAudioDevicePropertyChannelNominalLineLevelNameForID = getOSType!("cnlv") +} + +enum +{ + kAudioStreamClassID = getOSType!("astr"), + kAudioStreamUnknown = kAudioObjectUnknown +} + +enum +{ + kAudioStreamPropertyDirection = getOSType!("sdir"), + kAudioStreamPropertyTerminalType = getOSType!("term"), + kAudioStreamPropertyStartingChannel = getOSType!("schn"), + kAudioStreamPropertyLatency = kAudioDevicePropertyLatency, + kAudioStreamPropertyVirtualFormat = getOSType!("sfmt"), + kAudioStreamPropertyAvailableVirtualFormats = getOSType!("sfma"), + kAudioStreamPropertyPhysicalFormat = getOSType!("pft "), + kAudioStreamPropertyAvailablePhysicalFormats = getOSType!("pfta") +} + +enum +{ + kAudioStreamPropertyOwningDevice = kAudioObjectPropertyOwner, + kAudioStreamPropertyPhysicalFormats = getOSType!("pft#"), + kAudioStreamPropertyPhysicalFormatSupported = getOSType!("pft?"), + kAudioStreamPropertyPhysicalFormatMatch = getOSType!("pftm") +} + +enum +{ + kAudioAggregateDeviceClassID = getOSType!("aagg"), + kAudioDeviceTransportTypeAggregate = getOSType!("grup"), + kAudioDeviceTransportTypeAutoAggregate = getOSType!("fgrp") +} + +enum +{ + kAudioAggregateDevicePropertyFullSubDeviceList = getOSType!("grup"), + kAudioAggregateDevicePropertyActiveSubDeviceList = getOSType!("agrp"), + kAudioAggregateDevicePropertyComposition = getOSType!("acom") +} + +enum +{ + kAudioAggregateDevicePropertyMasterSubDevice = getOSType!("amst") +} + +enum +{ + kAudioSubDeviceClassID = getOSType!("asub") +} + +enum +{ + kAudioSubDeviceDriftCompensationMinQuality = 0, + kAudioSubDeviceDriftCompensationLowQuality = 0x20, + kAudioSubDeviceDriftCompensationMediumQuality = 0x40, + kAudioSubDeviceDriftCompensationHighQuality = 0x60, + kAudioSubDeviceDriftCompensationMaxQuality = 0x7F +} + +enum +{ + kAudioSubDevicePropertyExtraLatency = getOSType!("xltc"), + kAudioSubDevicePropertyDriftCompensation = getOSType!("drft"), + kAudioSubDevicePropertyDriftCompensationQuality = getOSType!("drfq") +} + +struct AudioObjectPropertyAddress +{ + uint mSelector; + uint mScope; + uint mElement; +} + + +struct AudioHardwareIOProcStreamUsage +{ + void* mIOProc; + uint mNumberStreams; + uint* mStreamIsOn; +} + + +struct AudioStreamRangedDescription +{ + AudioStreamBasicDescription mFormat; + AudioValueRange mSampleRateRange; +} + +extern (C) +{ + void AudioObjectShow (uint inObjectID); + ubyte AudioObjectHasProperty (uint inObjectID, AudioObjectPropertyAddress* inAddress); + int AudioObjectIsPropertySettable (uint inObjectID, AudioObjectPropertyAddress* inAddress, char* outIsSettable); + int AudioObjectGetPropertyDataSize (uint inObjectID, AudioObjectPropertyAddress* inAddress, uint inQualifierDataSize, void* inQualifierData, uint* outDataSize); + int AudioObjectGetPropertyData (uint inObjectID, AudioObjectPropertyAddress* inAddress, uint inQualifierDataSize, void* inQualifierData, uint* ioDataSize, void* outData); + int AudioObjectSetPropertyData (uint inObjectID, AudioObjectPropertyAddress* inAddress, uint inQualifierDataSize, void* inQualifierData, uint inDataSize, void* inData); + int AudioObjectAddPropertyListener (uint inObjectID, AudioObjectPropertyAddress* inAddress, AudioObjectPropertyListenerProc inListener, void* inClientData); + int AudioObjectRemovePropertyListener (uint inObjectID, AudioObjectPropertyAddress* inAddress, AudioObjectPropertyListenerProc inListener, void* inClientData); + int AudioHardwareAddRunLoopSource (CFRunLoopSourceRef inRunLoopSource); + int AudioHardwareRemoveRunLoopSource (CFRunLoopSourceRef inRunLoopSource); + int AudioHardwareUnload (); + int AudioHardwareGetPropertyInfo (uint inPropertyID, uint* outSize, char* outWritable); + int AudioHardwareGetProperty (uint inPropertyID, uint* ioPropertyDataSize, void* outPropertyData); + int AudioHardwareSetProperty (uint inPropertyID, uint inPropertyDataSize, void* inPropertyData); + int AudioHardwareAddPropertyListener (uint inPropertyID, AudioHardwarePropertyListenerProc inProc, void* inClientData); + int AudioHardwareRemovePropertyListener (uint inPropertyID, AudioHardwarePropertyListenerProc inProc); + int AudioDeviceCreateIOProcID (uint inDevice, AudioDeviceIOProc inProc, void* inClientData, AudioDeviceIOProcID* outIOProcID); + int AudioDeviceDestroyIOProcID (uint inDevice, AudioDeviceIOProcID inIOProcID); + int AudioDeviceAddIOProc (uint inDevice, AudioDeviceIOProc inProc, void* inClientData); + int AudioDeviceRemoveIOProc (uint inDevice, AudioDeviceIOProc inProc); + int AudioDeviceStart (uint inDevice, AudioDeviceIOProcID inProcID); + int AudioDeviceStartAtTime (uint inDevice, AudioDeviceIOProcID inProcID, AudioTimeStamp* ioRequestedStartTime, uint inFlags); + int AudioDeviceStop (uint inDevice, AudioDeviceIOProcID inProcID); + int AudioDeviceRead (uint inDevice, AudioTimeStamp* inStartTime, AudioBufferList* outData); + int AudioDeviceGetCurrentTime (uint inDevice, AudioTimeStamp* outTime); + int AudioDeviceTranslateTime (uint inDevice, AudioTimeStamp* inTime, AudioTimeStamp* outTime); + int AudioDeviceGetNearestStartTime (uint inDevice, AudioTimeStamp* ioRequestedStartTime, uint inFlags); + int AudioDeviceGetPropertyInfo (uint inDevice, uint inChannel, ubyte isInput, uint inPropertyID, uint* outSize, char* outWritable); + int AudioDeviceGetProperty (uint inDevice, uint inChannel, ubyte isInput, uint inPropertyID, uint* ioPropertyDataSize, void* outPropertyData); + int AudioDeviceSetProperty (uint inDevice, AudioTimeStamp* inWhen, uint inChannel, ubyte isInput, uint inPropertyID, uint inPropertyDataSize, void* inPropertyData); + int AudioDeviceAddPropertyListener (uint inDevice, uint inChannel, ubyte isInput, uint inPropertyID, AudioDevicePropertyListenerProc inProc, void* inClientData); + int AudioDeviceRemovePropertyListener (uint inDevice, uint inChannel, ubyte isInput, uint inPropertyID, AudioDevicePropertyListenerProc inProc); + int AudioStreamGetPropertyInfo (uint inStream, uint inChannel, uint inPropertyID, uint* outSize, char* outWritable); + int AudioStreamGetProperty (uint inStream, uint inChannel, uint inPropertyID, uint* ioPropertyDataSize, void* outPropertyData); + int AudioStreamSetProperty (uint inStream, AudioTimeStamp* inWhen, uint inChannel, uint inPropertyID, uint inPropertyDataSize, void* inPropertyData); + int AudioStreamAddPropertyListener (uint inStream, uint inChannel, uint inPropertyID, AudioStreamPropertyListenerProc inProc, void* inClientData); + int AudioStreamRemovePropertyListener (uint inStream, uint inChannel, uint inPropertyID, AudioStreamPropertyListenerProc inProc); +} \ No newline at end of file