T GetProperty <T> (AudioFileStreamProperty property) { int size, writable; if (AudioFileStreamGetPropertyInfo(handle, property, out size, out writable) != 0) { return(default(T)); } var buffer = Marshal.AllocHGlobal(size); if (buffer == IntPtr.Zero) { return(default(T)); } try { var r = AudioFileStreamGetProperty(handle, property, ref size, buffer); if (r == 0) { return((T)Marshal.PtrToStructure(buffer, typeof(T))); } return(default(T)); } finally { Marshal.FreeHGlobal(buffer); } }
public IntPtr GetProperty(AudioFileStreamProperty property, out int size) { bool writable; LastError = AudioFileStreamGetPropertyInfo(handle, property, out size, out writable); if (LastError != 0) { return(IntPtr.Zero); } var buffer = Marshal.AllocHGlobal(size); if (buffer == IntPtr.Zero) { return(IntPtr.Zero); } LastError = AudioFileStreamGetProperty(handle, property, ref size, buffer); if (LastError == 0) { return(buffer); } Marshal.FreeHGlobal(buffer); return(IntPtr.Zero); }
unsafe T?GetProperty <T> (AudioFileStreamProperty property) where T : struct { int size; bool writable; LastError = AudioFileStreamGetPropertyInfo(handle, property, out size, out writable); if (LastError != 0) { return(null); } var buffer = Marshal.AllocHGlobal(size); if (buffer == IntPtr.Zero) { return(null); } try { LastError = AudioFileStreamGetProperty(handle, property, ref size, buffer); if (LastError == 0) { return((T)Marshal.PtrToStructure(buffer, typeof(T))); } return(null); } finally { Marshal.FreeHGlobal(buffer); } }
unsafe T?GetProperty <T> (AudioFileStreamProperty property) where T : struct { int size, writable; LastError = AudioFileStreamGetPropertyInfo(handle, property, out size, out writable); if (LastError != 0) { return(null); } var buffer = Marshal.AllocHGlobal(size); if (buffer == IntPtr.Zero) { return(null); } try { LastError = AudioFileStreamGetProperty(handle, property, ref size, buffer); if (LastError == 0) { T result = *(T *)buffer; return(result); } return(null); } finally { Marshal.FreeHGlobal(buffer); } }
public bool GetProperty(AudioFileStreamProperty property, ref int dataSize, IntPtr outPropertyData) { if (outPropertyData == IntPtr.Zero) { throw new ArgumentNullException("outPropertyData"); } return(AudioFileStreamGetProperty(handle, property, ref dataSize, outPropertyData) == 0); }
public bool GetProperty(AudioFileStreamProperty property, ref int dataSize, IntPtr outPropertyData) { if (outPropertyData == IntPtr.Zero) { ObjCRuntime.ThrowHelper.ThrowArgumentNullException(nameof(outPropertyData)); } return(AudioFileStreamGetProperty(handle, property, ref dataSize, outPropertyData) == 0); }
public bool SetProperty(AudioFileStreamProperty property, int dataSize, IntPtr propertyData) { if (propertyData == IntPtr.Zero) { ObjCRuntime.ThrowHelper.ThrowArgumentNullException(nameof(propertyData)); } LastError = AudioFileStreamSetProperty(handle, property, dataSize, propertyData); return(LastError == 0); }
public bool SetProperty(AudioFileStreamProperty property, int dataSize, IntPtr propertyData) { if (propertyData == IntPtr.Zero) { throw new ArgumentNullException("propertyData"); } LastError = AudioFileStreamSetProperty(handle, property, dataSize, propertyData); return(LastError == 0); }
protected virtual void OnPropertyFound(AudioFileStreamProperty propertyID, ref AudioFileStreamPropertyFlag ioFlags) { var p = PropertyFound; if (p != null) { var pf = new PropertyFoundEventArgs(propertyID, ioFlags); p(this, pf); ioFlags = pf.Flags; } }
int GetInt(AudioFileStreamProperty property) { unsafe { int val = 0; int size = 4; if (AudioFileStreamGetProperty(handle, property, ref size, (IntPtr)(&val)) == 0) { return(val); } return(0); } }
double GetDouble(AudioFileStreamProperty property) { unsafe { double val = 0; int size = 8; if (AudioFileStreamGetProperty(handle, property, ref size, (IntPtr)(&val)) == 0) { return(val); } return(0); } }
long GetLong(AudioFileStreamProperty property) { unsafe { long val = 0; int size = 8; if (AudioFileStreamGetProperty(handle, property, ref size, (IntPtr)(&val)) == 0) { return(val); } return(0); } }
public PropertyFoundEventArgs(AudioFileStreamProperty propertyID, AudioFileStreamPropertyFlag ioFlags) { Property = propertyID; Flags = ioFlags; }
extern static AudioFileStreamStatus AudioFileStreamSetProperty( AudioFileStreamID inAudioFileStream, AudioFileStreamProperty inPropertyID, int inPropertyDataSize, IntPtr inPropertyData);
public bool SetProperty(AudioFileStreamProperty property, int dataSize, IntPtr propertyData) { LastError = AudioFileStreamSetProperty(handle, property, dataSize, propertyData); return(LastError == 0); }
extern static OSStatus AudioFileStreamGetPropertyInfo( AudioFileStreamID inAudioFileStream, AudioFileStreamProperty inPropertyID, out int outPropertyDataSize, out int isWritable);
public bool GetProperty(AudioFileStreamProperty property, ref int dataSize, IntPtr outPropertyData) { return(AudioFileStreamGetProperty(handle, property, ref dataSize, outPropertyData) == 0); }
extern static AudioFileStreamStatus AudioFileStreamGetProperty( AudioFileStreamID inAudioFileStream, AudioFileStreamProperty inPropertyID, ref int ioPropertyDataSize, IntPtr outPropertyData);
extern static AudioFileStreamStatus AudioFileStreamGetPropertyInfo( AudioFileStreamID inAudioFileStream, AudioFileStreamProperty inPropertyID, out int outPropertyDataSize, [MarshalAs(UnmanagedType.I1)] out bool isWritable);
static void PropertyListener(IntPtr clientData, AudioFileStreamID audioFileStream, AudioFileStreamProperty propertyID, ref AudioFileStreamPropertyFlag ioFlags) { GCHandle handle = GCHandle.FromIntPtr(clientData); var afs = handle.Target as AudioFileStream; afs.OnPropertyFound(propertyID, ref ioFlags); }
public bool SetProperty(AudioFileStreamProperty property, int dataSize, IntPtr propertyData) { return(AudioFileStreamSetProperty(handle, property, dataSize, propertyData) == 0); }