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
FormatTags
The list of FormatTags for this ACM Driver
public IEnumerable<AcmFormatTag> FormatTags { get; }
Property Value
LongName
The full name of this driver
public string LongName { get; }
Property Value
MaxFormatSize
Gets the maximum size needed to store a WaveFormat for ACM interop functions
public int MaxFormatSize { get; }
Property Value
ShortName
The short name of this driver
public string ShortName { get; }
Property Value
Methods
AddLocalDriver(string)
Attempts to add a new ACM driver from a file
public static AcmDriver AddLocalDriver(string driverFile)
Parameters
driverFilestringFull 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
disposingbool
EnumerateAcmDrivers()
Gets a list of the ACM Drivers installed
public static IEnumerable<AcmDriver> EnumerateAcmDrivers()
Returns
~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
shortNamestringShort 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
formatTagAcmFormatTagFormat 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
shortNamestringThe 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
localDriverAcmDriverLocal 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
ownerWindowHandlenintOwner window handle, can be null
windowTitlestringWindow title
enumFlagsAcmFormatEnumFlagsEnumeration flags. None to get everything
enumFormatWaveFormatEnumeration format. Only needed with certain enumeration flags
selectedFormatWaveFormatThe selected format
selectedFormatDescriptionstringTextual description of the selected format
selectedFormatTagDescriptionstringTextual description of the selected format tag
Returns
- bool
True if a format was selected
ToString()
ToString
public override string ToString()