BASS.NET API for the Un4seen BASS Audio Library

ACMFORMAT 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.17.5
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

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:
C#
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