Table of Contents

Class AcmDriver

Namespace
NAudio.Wave.Compression
Assembly
NAudio.WinMM.dll

Represents an installed ACM Driver

public class AcmDriver : IDisposable
Inheritance
AcmDriver
Implements
Inherited Members

Remarks

We have observed access violations inside msacm32.dll when ACM calls are issued concurrently from multiple threads. It isn't clear whether every ACM codec is affected or only some, but as a defensive measure NAudio serialises every msacm32 P/Invoke through a single process-wide lock. Driver enumeration, format enumeration and other operations on this type therefore block any concurrent ACM work for their duration.

Properties

DriverId

The driver ID

public nint DriverId { get; }

Property Value

nint

FormatTags

The list of FormatTags for this ACM Driver

public IEnumerable<AcmFormatTag> FormatTags { get; }

Property Value

IEnumerable<AcmFormatTag>

LongName

The full name of this driver

public string LongName { get; }

Property Value

string

MaxFormatSize

Gets the maximum size needed to store a WaveFormat for ACM interop functions

public int MaxFormatSize { get; }

Property Value

int

ShortName

The short name of this driver

public string ShortName { get; }

Property Value

string

Methods

AddLocalDriver(string)

Attempts to add a new ACM driver from a file

public static AcmDriver AddLocalDriver(string driverFile)

Parameters

driverFile string

Full path of the .acm or dll file containing the driver

Returns

AcmDriver

Handle to the driver

Close()

Closes this driver

public void Close()

Dispose()

Dispose

public void Dispose()

Dispose(bool)

Dispose pattern

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

EnumerateAcmDrivers()

Gets a list of the ACM Drivers installed

public static IEnumerable<AcmDriver> EnumerateAcmDrivers()

Returns

IEnumerable<AcmDriver>

~AcmDriver()

Finalizer. Only called when user forgets to call Dispose()

protected ~AcmDriver()

FindByShortName(string)

Finds a Driver by its short name

public static AcmDriver FindByShortName(string shortName)

Parameters

shortName string

Short Name

Returns

AcmDriver

The driver, or null if not found

GetFormats(AcmFormatTag)

Gets all the supported formats for a given format tag

public IEnumerable<AcmFormat> GetFormats(AcmFormatTag formatTag)

Parameters

formatTag AcmFormatTag

Format tag

Returns

IEnumerable<AcmFormat>

Supported formats

IsCodecInstalled(string)

Helper function to determine whether a particular codec is installed

public static bool IsCodecInstalled(string shortName)

Parameters

shortName string

The short name of the function

Returns

bool

Whether the codec is installed

Open()

Opens this driver

public void Open()

RemoveLocalDriver(AcmDriver)

Removes a driver previously added using AddLocalDriver

public static void RemoveLocalDriver(AcmDriver localDriver)

Parameters

localDriver AcmDriver

Local driver to remove

ShowFormatChooseDialog(nint, string, AcmFormatEnumFlags, WaveFormat, out WaveFormat, out string, out string)

Show Format Choose Dialog

public static bool ShowFormatChooseDialog(nint ownerWindowHandle, string windowTitle, AcmFormatEnumFlags enumFlags, WaveFormat enumFormat, out WaveFormat selectedFormat, out string selectedFormatDescription, out string selectedFormatTagDescription)

Parameters

ownerWindowHandle nint

Owner window handle, can be null

windowTitle string

Window title

enumFlags AcmFormatEnumFlags

Enumeration flags. None to get everything

enumFormat WaveFormat

Enumeration format. Only needed with certain enumeration flags

selectedFormat WaveFormat

The selected format

selectedFormatDescription string

Textual description of the selected format

selectedFormatTagDescription string

Textual description of the selected format tag

Returns

bool

True if a format was selected

ToString()

ToString

public override string ToString()

Returns

string