Xeno-rat
Loading...
Searching...
No Matches
NAudio.Wave.Compression.AcmDriver Class Reference

Represents an installed ACM Driver. More...

Inheritance diagram for NAudio.Wave.Compression.AcmDriver:
Collaboration diagram for NAudio.Wave.Compression.AcmDriver:

Public Member Functions

override string ToString ()
 Returns the long name of the object as a string.
 
IEnumerable< AcmFormatGetFormats (AcmFormatTag formatTag)
 Retrieves a collection of audio formats associated with the specified format tag.
 
void Open ()
 Opens the audio driver if it is not already open.
 
void Close ()
 Closes the driver handle if it is not already closed.
 
void Dispose ()
 Disposes of the resources used by the current instance.
 

Static Public Member Functions

static bool IsCodecInstalled (string shortName)
 Checks if a codec with the specified short name is installed.
 
static AcmDriver AddLocalDriver (string driverFile)
 Adds a local driver from the specified file and returns the driver information.
 
static void RemoveLocalDriver (AcmDriver localDriver)
 Removes the local driver and frees the associated resources.
 
static bool ShowFormatChooseDialog (IntPtr ownerWindowHandle, string windowTitle, AcmFormatEnumFlags enumFlags, WaveFormat enumFormat, out WaveFormat selectedFormat, out string selectedFormatDescription, out string selectedFormatTagDescription)
 Displays a format selection dialog and returns the selected format and description.
 
static AcmDriver FindByShortName (string shortName)
 Finds an AcmDriver by its short name.
 
static IEnumerable< AcmDriverEnumerateAcmDrivers ()
 Enumerates the available audio compression managers (ACM) drivers and returns a collection of AcmDriver.
 

Properties

int MaxFormatSize [get]
 Gets the maximum size needed to store a WaveFormat for ACM interop functions.
 
string ShortName [get]
 The short name of this driver.
 
string LongName [get]
 The full name of this driver.
 
IntPtr DriverId [get]
 The driver ID.
 
IEnumerable< AcmFormatTagFormatTags [get]
 The list of FormatTags for this ACM Driver.
 

Private Member Functions

 AcmDriver (IntPtr hAcmDriver)
 Creates a new ACM Driver object.
 
bool AcmFormatTagEnumCallback (IntPtr hAcmDriverId, ref AcmFormatTagDetails formatTagDetails, IntPtr dwInstance, AcmDriverDetailsSupportFlags flags)
 Callback function for enumerating ACM format tags. Adds the details of the format tag to the collection and returns true.
 
bool AcmFormatEnumCallback (IntPtr hAcmDriverId, ref AcmFormatDetails formatDetails, IntPtr dwInstance, AcmDriverDetailsSupportFlags flags)
 Callback function for enumerating ACM format details.
 

Static Private Member Functions

static bool DriverEnumCallback (IntPtr hAcmDriver, IntPtr dwInstance, AcmDriverDetailsSupportFlags flags)
 Callback function for enumerating ACM drivers.
 

Private Attributes

AcmDriverDetails details
 
IntPtr driverId
 
IntPtr driverHandle
 
List< AcmFormatTagformatTags
 
List< AcmFormattempFormatsList
 
IntPtr localDllHandle
 

Static Private Attributes

static List< AcmDriverdrivers
 

Detailed Description

Represents an installed ACM Driver.

Constructor & Destructor Documentation

◆ AcmDriver()

NAudio.Wave.Compression.AcmDriver.AcmDriver ( IntPtr hAcmDriver)
inlineprivate

Creates a new ACM Driver object.

Parameters
hAcmDriverDriver handle
Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ AcmFormatEnumCallback()

bool NAudio.Wave.Compression.AcmDriver.AcmFormatEnumCallback ( IntPtr hAcmDriverId,
ref AcmFormatDetails formatDetails,
IntPtr dwInstance,
AcmDriverDetailsSupportFlags flags )
inlineprivate

Callback function for enumerating ACM format details.

Parameters
hAcmDriverIdHandle to the ACM driver identifier.
formatDetailsReference to the ACM format details.
dwInstancePointer to application-defined data.
flagsFlags indicating the support details of the ACM driver.
Returns
True if the ACM format details are successfully added to the temporary formats list; otherwise, false.

This callback function is used for enumerating ACM format details. It adds the ACM format details to the temporary formats list and returns a boolean value indicating the success of the operation.

Here is the caller graph for this function:

◆ AcmFormatTagEnumCallback()

bool NAudio.Wave.Compression.AcmDriver.AcmFormatTagEnumCallback ( IntPtr hAcmDriverId,
ref AcmFormatTagDetails formatTagDetails,
IntPtr dwInstance,
AcmDriverDetailsSupportFlags flags )
inlineprivate

Callback function for enumerating ACM format tags. Adds the details of the format tag to the collection and returns true.

Parameters
hAcmDriverIdHandle to the ACM driver identifier.
formatTagDetailsReference to the details of the format tag being enumerated.
dwInstancePointer to a user-defined instance data specified during the enumeration.
flagsFlags indicating the driver support details.
Returns
True if the format tag details are successfully added to the collection; otherwise, false.

This callback function is used for enumerating ACM format tags. It adds the details of the format tag to the collection and returns true upon successful addition.

◆ AddLocalDriver()

static AcmDriver NAudio.Wave.Compression.AcmDriver.AddLocalDriver ( string driverFile)
inlinestatic

Adds a local driver from the specified file and returns the driver information.

Parameters
driverFileThe path to the driver file to be added.
Exceptions
ArgumentExceptionThrown when failed to load the driver file or discover DriverProc.
MmExceptionThrown when acmDriverAdd operation fails.
Returns
The driver information for the added local driver.

This method loads the specified driver file using NativeMethods.LoadLibrary, then retrieves the address of the "DriverProc" function using NativeMethods.GetProcAddress. It then adds the driver using AcmInterop.acmDriverAdd, and if successful, creates and returns an AcmDriver object with the driver information. If the long name of the driver is missing, it is set to "Local driver: " followed by the name of the driver file.

Here is the call graph for this function:

◆ Close()

void NAudio.Wave.Compression.AcmDriver.Close ( )
inline

Closes the driver handle if it is not already closed.

This method checks if the driverHandle is not equal to IntPtr.Zero, and if so, it calls AcmInterop.acmDriverClose to close the driver handle with flags set to 0. After closing the driver handle, it sets the driverHandle to IntPtr.Zero.

Exceptions
MmExceptionThrown when an error occurs during the driver close operation.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Dispose()

void NAudio.Wave.Compression.AcmDriver.Dispose ( )
inline

Disposes of the resources used by the current instance.

This method checks if the driverHandle is not equal to IntPtr.Zero, and if so, it calls the Close method and suppresses the finalization of the current instance by the garbage collector.

Here is the call graph for this function:

◆ DriverEnumCallback()

static bool NAudio.Wave.Compression.AcmDriver.DriverEnumCallback ( IntPtr hAcmDriver,
IntPtr dwInstance,
AcmDriverDetailsSupportFlags flags )
inlinestaticprivate

Callback function for enumerating ACM drivers.

Parameters
hAcmDriverHandle to an ACM driver.
dwInstanceApplication-defined value specified in the acmDriverEnum function.
flagsSupport flags for the ACM driver.
Returns
True if the ACM driver details were successfully added to the list; otherwise, false.

This callback function is used for enumerating ACM drivers. It adds the details of the ACM driver specified by the handle hAcmDriver to the list of drivers. The application-defined value dwInstance is used for additional context during enumeration. The support flags flags provide information about the capabilities of the ACM driver.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ EnumerateAcmDrivers()

static IEnumerable< AcmDriver > NAudio.Wave.Compression.AcmDriver.EnumerateAcmDrivers ( )
inlinestatic

Enumerates the available audio compression managers (ACM) drivers and returns a collection of AcmDriver.

Returns
A collection of AcmDriver representing the available ACM drivers.

This method internally calls the acmDriverEnum function to enumerate the available ACM drivers. It populates the drivers collection with the available drivers and returns the collection.

Exceptions
MmExceptionThrown when an error occurs during the acmDriverEnum function call.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindByShortName()

static AcmDriver NAudio.Wave.Compression.AcmDriver.FindByShortName ( string shortName)
inlinestatic

Finds an AcmDriver by its short name.

Parameters
shortNameThe short name of the AcmDriver to find.
Returns
The AcmDriver with the specified shortName , or null if not found.
Here is the call graph for this function:

◆ GetFormats()

IEnumerable< AcmFormat > NAudio.Wave.Compression.AcmDriver.GetFormats ( AcmFormatTag formatTag)
inline

Retrieves a collection of audio formats associated with the specified format tag.

Parameters
formatTagThe format tag to filter the audio formats.
Exceptions
InvalidOperationExceptionThrown when the driver has not been opened prior to calling this method.
Returns
A collection of AcmFormat objects representing the audio formats associated with the specified format tag.

This method retrieves a collection of audio formats associated with the specified format tag from the driver. It allocates memory for a wave format and uses the AcmInterop.acmFormatEnum method to enumerate the audio formats. The retrieved audio formats are stored in the tempFormatsList collection and returned.

Here is the call graph for this function:

◆ IsCodecInstalled()

static bool NAudio.Wave.Compression.AcmDriver.IsCodecInstalled ( string shortName)
inlinestatic

Checks if a codec with the specified short name is installed.

Parameters
shortNameThe short name of the codec to be checked.
Returns
True if a codec with the specified short name is installed; otherwise, false.
Here is the call graph for this function:

◆ Open()

void NAudio.Wave.Compression.AcmDriver.Open ( )
inline

Opens the audio driver if it is not already open.

Exceptions
MmExceptionThrown when an error occurs while opening the audio driver.

This method checks if the driverHandle is equal to IntPtr.Zero and then attempts to open the driver using the AcmInterop.acmDriverOpen method. If the driver is already open, this method does nothing. If an error occurs during the opening process, a MmException is thrown with the message "acmDriverOpen".

Here is the call graph for this function:

◆ RemoveLocalDriver()

static void NAudio.Wave.Compression.AcmDriver.RemoveLocalDriver ( AcmDriver localDriver)
inlinestatic

Removes the local driver and frees the associated resources.

Parameters
localDriverThe AcmDriver to be removed.
Exceptions
ArgumentExceptionThrown when the localDriver has an invalid or uninitialized handle.

This method removes the local driver identified by the localDriver and frees the associated resources. It first checks if the localDriver has a valid handle, and if not, it throws an ArgumentException. After removing the driver, it frees the library associated with the local driver's handle using NativeMethods.FreeLibrary. Finally, it attempts to remove the driver using AcmInterop.acmDriverRemove and handles any exceptions using MmException.Try.

Here is the call graph for this function:

◆ ShowFormatChooseDialog()

static bool NAudio.Wave.Compression.AcmDriver.ShowFormatChooseDialog ( IntPtr ownerWindowHandle,
string windowTitle,
AcmFormatEnumFlags enumFlags,
WaveFormat enumFormat,
out WaveFormat selectedFormat,
out string selectedFormatDescription,
out string selectedFormatTagDescription )
inlinestatic

Displays a format selection dialog and returns the selected format and description.

Parameters
ownerWindowHandleThe handle to the owner window.
windowTitleThe title of the dialog window.
enumFlagsThe enumeration flags for the format selection.
enumFormatThe format to be enumerated.
selectedFormatWhen this method returns, contains the selected wave format.
selectedFormatDescriptionWhen this method returns, contains the description of the selected wave format.
selectedFormatTagDescriptionWhen this method returns, contains the tag description of the selected wave format.
Returns
True if the format selection was successful; otherwise, false.

This method displays a format selection dialog using the given parameters and returns the selected format and its description. If an error occurs during the format selection, a MmException is thrown with the appropriate error message.

Here is the call graph for this function:

◆ ToString()

override string NAudio.Wave.Compression.AcmDriver.ToString ( )
inline

Returns the long name of the object as a string.

Returns
The long name of the object as a string.

Member Data Documentation

◆ details

AcmDriverDetails NAudio.Wave.Compression.AcmDriver.details
private

◆ driverHandle

IntPtr NAudio.Wave.Compression.AcmDriver.driverHandle
private

◆ driverId

IntPtr NAudio.Wave.Compression.AcmDriver.driverId
private

◆ drivers

List<AcmDriver> NAudio.Wave.Compression.AcmDriver.drivers
staticprivate

◆ formatTags

List<AcmFormatTag> NAudio.Wave.Compression.AcmDriver.formatTags
private

◆ localDllHandle

IntPtr NAudio.Wave.Compression.AcmDriver.localDllHandle
private

◆ tempFormatsList

List<AcmFormat> NAudio.Wave.Compression.AcmDriver.tempFormatsList
private

Property Documentation

◆ DriverId

IntPtr NAudio.Wave.Compression.AcmDriver.DriverId
get

The driver ID.

◆ FormatTags

IEnumerable<AcmFormatTag> NAudio.Wave.Compression.AcmDriver.FormatTags
get

The list of FormatTags for this ACM Driver.

◆ LongName

string NAudio.Wave.Compression.AcmDriver.LongName
get

The full name of this driver.

◆ MaxFormatSize

int NAudio.Wave.Compression.AcmDriver.MaxFormatSize
get

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

◆ ShortName

string NAudio.Wave.Compression.AcmDriver.ShortName
get

The short name of this driver.


The documentation for this class was generated from the following file: