Esempio n. 1
0
        public TOut GetAudioObjectPropertyDataDynamic <TOut>(uint deviceObjectID, AudioObjectPropertySelectorExtended selector, AudioObjectPropertyScope scope)
        {
            var    propertyAddress     = new AudioObjectPropertyAddress(selector, scope, AudioObjectPropertyElement.Master);
            uint   inQualifierDataSize = 0;
            IntPtr inQualifierData     = IntPtr.Zero; // aka NULL in obj-c

            uint dataPropertySize;

            var err = AudioObjectGetPropertyDataSize(deviceObjectID, ref propertyAddress, ref inQualifierDataSize, inQualifierData, out dataPropertySize);

            if (err != 0)
            {
                throw new Exception(err.ToString());
            }

            return(GetAudioObjectPropertyDataFixed <TOut>(deviceObjectID, selector, scope, (int)dataPropertySize));
        }
Esempio n. 2
0
        public TOut GetAudioObjectPropertyDataFixed <TOut>(uint deviceObjectID, AudioObjectPropertySelectorExtended selector, AudioObjectPropertyScope scope, int size)
        {
            var propertyAddress = new AudioObjectPropertyAddress(selector, scope, AudioObjectPropertyElement.Master);
            var propInfo        = GetUnmanagedPropertyData(deviceObjectID, propertyAddress, size);

            if (typeof(TOut) == typeof(int[]))
            {
                return((TOut)MarshalToIntArray(propInfo));
            }
            else if (typeof(TOut) == typeof(string))
            {
                return((TOut)MarshalToString(propInfo));
            }
            else
            {
                throw new NotSupportedException("Type not yet handled.  Sorry this was built by a lazy engineer.");
            }
        }
 public AudioObjectPropertyAddress(AudioObjectPropertySelectorExtended selector, AudioObjectPropertyScope scope, AudioObjectPropertyElement element)
 {
     Selector = (uint)selector;
     Scope    = (uint)scope;
     Element  = (uint)element;
 }