Represents an installed ACM Driver.
More...
|
override string | ToString () |
| Returns the long name of the object as a string.
|
|
IEnumerable< AcmFormat > | GetFormats (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.
|
|
Represents an installed ACM Driver.
◆ AcmDriver()
NAudio.Wave.Compression.AcmDriver.AcmDriver |
( |
IntPtr | hAcmDriver | ) |
|
|
inlineprivate |
Creates a new ACM Driver object.
- Parameters
-
◆ AcmFormatEnumCallback()
Callback function for enumerating ACM format details.
- Parameters
-
hAcmDriverId | Handle to the ACM driver identifier. |
formatDetails | Reference to the ACM format details. |
dwInstance | Pointer to application-defined data. |
flags | Flags 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.
◆ AcmFormatTagEnumCallback()
Callback function for enumerating ACM format tags. Adds the details of the format tag to the collection and returns true.
- Parameters
-
hAcmDriverId | Handle to the ACM driver identifier. |
formatTagDetails | Reference to the details of the format tag being enumerated. |
dwInstance | Pointer to a user-defined instance data specified during the enumeration. |
flags | Flags 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
-
driverFile | The path to the driver file to be added. |
- Exceptions
-
ArgumentException | Thrown when failed to load the driver file or discover DriverProc. |
MmException | Thrown 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.
◆ 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
-
MmException | Thrown when an error occurs during the driver close operation. |
◆ 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.
◆ DriverEnumCallback()
static bool NAudio.Wave.Compression.AcmDriver.DriverEnumCallback |
( |
IntPtr | hAcmDriver, |
|
|
IntPtr | dwInstance, |
|
|
AcmDriverDetailsSupportFlags | flags ) |
|
inlinestaticprivate |
Callback function for enumerating ACM drivers.
- Parameters
-
hAcmDriver | Handle to an ACM driver. |
dwInstance | Application-defined value specified in the acmDriverEnum function. |
flags | Support 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.
◆ EnumerateAcmDrivers()
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
-
MmException | Thrown when an error occurs during the acmDriverEnum function call. |
◆ FindByShortName()
static AcmDriver NAudio.Wave.Compression.AcmDriver.FindByShortName |
( |
string | shortName | ) |
|
|
inlinestatic |
Finds an AcmDriver by its short name.
- Parameters
-
shortName | The short name of the AcmDriver to find. |
- Returns
- The AcmDriver with the specified shortName , or null if not found.
◆ GetFormats()
Retrieves a collection of audio formats associated with the specified format tag.
- Parameters
-
formatTag | The format tag to filter the audio formats. |
- Exceptions
-
InvalidOperationException | Thrown 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.
◆ IsCodecInstalled()
static bool NAudio.Wave.Compression.AcmDriver.IsCodecInstalled |
( |
string | shortName | ) |
|
|
inlinestatic |
Checks if a codec with the specified short name is installed.
- Parameters
-
shortName | The short name of the codec to be checked. |
- Returns
- True if a codec with the specified short name is installed; otherwise, false.
◆ Open()
void NAudio.Wave.Compression.AcmDriver.Open |
( |
| ) |
|
|
inline |
Opens the audio driver if it is not already open.
- Exceptions
-
MmException | Thrown 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".
◆ RemoveLocalDriver()
static void NAudio.Wave.Compression.AcmDriver.RemoveLocalDriver |
( |
AcmDriver | localDriver | ) |
|
|
inlinestatic |
Removes the local driver and frees the associated resources.
- Parameters
-
localDriver | The AcmDriver to be removed. |
- Exceptions
-
ArgumentException | Thrown 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.
◆ 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
-
ownerWindowHandle | The handle to the owner window. |
windowTitle | The title of the dialog window. |
enumFlags | The enumeration flags for the format selection. |
enumFormat | The format to be enumerated. |
selectedFormat | When this method returns, contains the selected wave format. |
selectedFormatDescription | When this method returns, contains the description of the selected wave format. |
selectedFormatTagDescription | When 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.
◆ 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.
◆ details
◆ 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 |
◆ DriverId
IntPtr NAudio.Wave.Compression.AcmDriver.DriverId |
|
get |
◆ FormatTags
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:
- /Users/sumansaurabh/Documents/my-startup/xeno-rat/Plugins/LiveMicrophone/lib/NAudio.WinMM/Compression/AcmDriver.cs