public unsafe static AudioChannelLayoutTag[] GetAvailableEncodeChannelLayoutTags(AudioStreamBasicDescription format) { var type_size = sizeof(AudioStreamBasicDescription); uint size; if (AudioFormatPropertyNative.AudioFormatGetPropertyInfo(AudioFormatProperty.AvailableEncodeChannelLayoutTags, type_size, ref format, out size) != 0) { return(null); } var data = new AudioChannelLayoutTag[size / sizeof(AudioChannelLayoutTag)]; fixed(AudioChannelLayoutTag *ptr = data) { var res = AudioFormatPropertyNative.AudioFormatGetProperty(AudioFormatProperty.AvailableEncodeChannelLayoutTags, type_size, ref format, ref size, (int *)ptr); if (res != 0) { return(null); } return(data); } }
public unsafe static AudioChannelLayoutTag[] GetTagsForNumberOfChannels(int count) { const int type_size = sizeof(uint); int size; if (AudioFormatPropertyNative.AudioFormatGetPropertyInfo(AudioFormatProperty.TagsForNumberOfChannels, type_size, ref count, out size) != 0) { return(null); } var data = new AudioChannelLayoutTag[size / type_size]; fixed(AudioChannelLayoutTag *ptr = data) { var res = AudioFormatPropertyNative.AudioFormatGetProperty(AudioFormatProperty.TagsForNumberOfChannels, type_size, ref count, ref size, (int *)ptr); if (res != 0) { return(null); } return(data); } }