BASS.NET API for the Un4seen BASS Audio LibraryACMFORMAT Constructor (IntPtr)BASS.NET API for the Un4seen BASS Audio Library
Creates an instance of a generic audio codec format from the given format buffer pointer.

Namespace: Un4seen.Bass.AddOn.Enc
Assembly: Bass.Net (in Bass.Net.dll) Version: 2.4.12.0
Syntax

public ACMFORMAT(
	IntPtr codec
)

Parameters

codec
Type: SystemIntPtr
A pointer to an ACM codec format structure as returned by BASS_Encode_GetACMFormat(Int32, IntPtr, Int32, String, BASSACMFormat).
Examples

VB
Dim codec As ACMFORMAT = Nothing
' get the maximum codec format length
Dim formlen As Integer = BASS_Encode_GetACMFormat(0, IntPtr.Zero, 0, Nothing, BASSACMFormat.BASS_ACM_NONE)
Dim buffer(formlen - 1) As Byte
Dim hGC As GCHandle = GCHandle.Alloc(buffer, GCHandleType.Pinned)
Try
  Dim codecPtr As IntPtr = hGC.AddrOfPinnedObject()
  If BassEnc.BASS_Encode_GetACMFormat(handle, codecPtr, formlen, title, flags) > 0 Then
    codec = New ACMFORMAT(codecPtr)
  End If
Catch
  codec = Nothing
Finally
  hGC.Free()
End Try
ACMFORMAT codec = null;
// get the maximum codec format length
int formlen = BASS_Encode_GetACMFormat(0, IntPtr.Zero, 0, null, BASSACMFormat.BASS_ACM_NONE);
byte[] buffer = new byte[formlen];
GCHandle hGC = GCHandle.Alloc( buffer, GCHandleType.Pinned );
try
{
  IntPtr codecPtr = hGC.AddrOfPinnedObject();
  if ( BassEnc.BASS_Encode_GetACMFormat( handle, codecPtr, formlen, title, flags) > 0 )
  {
    codec = new ACMFORMAT(codecPtr);
  }
}
catch { codec = null; }
finally
{
  hGC.Free();
}
If you are into C# you might also use native pointers in an unsafe codeblock:
ACMFORMAT codec = null;
// get the maximum codec format length
int formlen = BASS_Encode_GetACMFormat(0, IntPtr.Zero, 0, null, BASSACMFormat.BASS_ACM_NONE);
byte[] buffer = new byte[formlen];
unsafe
{
  fixed (byte* p = buffer)
  {
    if ( BassEnc.BASS_Encode_GetACMFormat( handle, (IntPtr)p, formlen, title, flags) > 0 )
    {
      codec = new ACMFORMAT((IntPtr)p);
    }
  }
}
See Also

Reference