AcmStream encapsulates an Audio Compression Manager Stream used to convert audio from one format to another.
More...
|
| AcmStream (WaveFormat sourceFormat, WaveFormat destFormat) |
| Creates a new ACM stream to convert one format to another. Note that not all conversions can be done in one step.
|
|
| AcmStream (IntPtr driverId, WaveFormat sourceFormat, WaveFilter waveFilter) |
| Creates a new ACM stream to convert one format to another, using a specified driver identifier and wave filter.
|
|
int | SourceToDest (int source) |
| Converts the source value to destination and returns the result.
|
|
int | DestToSource (int dest) |
| Converts the specified destination value to the source format and returns the result.
|
|
void | Reposition () |
| Repositions the stream header.
|
|
int | Convert (int bytesToConvert, out int sourceBytesConverted) |
| Converts the specified number of bytes and returns the converted bytes count.
|
|
int | Convert (int bytesToConvert) |
| Converts the contents of the SourceBuffer into the DestinationBuffer.
|
|
void | Dispose () |
| Releases the unmanaged resources used by the WaveFormatConverter and optionally releases the managed resources.
|
|
|
virtual void | Dispose (bool disposing) |
| Frees resources associated with this ACM Stream.
|
|
|
byte[] | SourceBuffer [get] |
| Returns the Source Buffer. Fill this with data prior to calling convert.
|
|
byte[] | DestBuffer [get] |
| Returns the Destination buffer. This will contain the converted data after a successful call to Convert.
|
|
|
| ~AcmStream () |
| Frees resources associated with this ACM Stream.
|
|
AcmStream encapsulates an Audio Compression Manager Stream used to convert audio from one format to another.
◆ AcmStream() [1/2]
Creates a new ACM stream to convert one format to another. Note that not all conversions can be done in one step.
- Parameters
-
sourceFormat | The source audio format |
destFormat | The destination audio format |
◆ AcmStream() [2/2]
NAudio.Wave.Compression.AcmStream.AcmStream |
( |
IntPtr | driverId, |
|
|
WaveFormat | sourceFormat, |
|
|
WaveFilter | waveFilter ) |
|
inline |
Creates a new ACM stream to convert one format to another, using a specified driver identifier and wave filter.
- Parameters
-
driverId | the driver identifier |
sourceFormat | the source format |
waveFilter | the wave filter |
◆ ~AcmStream()
NAudio.Wave.Compression.AcmStream.~AcmStream |
( |
| ) |
|
|
inlineprivate |
Frees resources associated with this ACM Stream.
◆ Convert() [1/2]
int NAudio.Wave.Compression.AcmStream.Convert |
( |
int | bytesToConvert | ) |
|
|
inline |
Converts the contents of the SourceBuffer into the DestinationBuffer.
- Parameters
-
bytesToConvert | The number of bytes in the SourceBuffer that need to be converted |
- Returns
- The number of converted bytes in the DestinationBuffer
◆ Convert() [2/2]
int NAudio.Wave.Compression.AcmStream.Convert |
( |
int | bytesToConvert, |
|
|
out int | sourceBytesConverted ) |
|
inline |
Converts the specified number of bytes and returns the converted bytes count.
- Parameters
-
bytesToConvert | The number of bytes to be converted. |
- Returns
- The number of bytes after conversion.
- Exceptions
-
MmException | Thrown when the conversion does not convert all the bytes. |
This method is marked as obsolete and it is recommended to call the version returning sourceBytesConverted instead. The method internally calls another overloaded method to perform the conversion and checks if the conversion was successful. If the conversion did not convert all the bytes, a MmException is thrown with the message "AcmStreamHeader.Convert didn't convert everything".
◆ DestToSource()
int NAudio.Wave.Compression.AcmStream.DestToSource |
( |
int | dest | ) |
|
|
inline |
Converts the specified destination value to the source format and returns the result.
- Parameters
-
dest | The destination value to be converted. |
- Returns
- The converted value in the source format.
- Exceptions
-
MmException | Thrown when the acmStreamSize method fails. |
If the dest parameter is 0, the method returns 0, as zero is considered an invalid parameter for acmStreamSize. The method uses the acmStreamSize method to determine the size of the buffer needed to convert the specified destination value to the source format.
◆ Dispose() [1/2]
void NAudio.Wave.Compression.AcmStream.Dispose |
( |
| ) |
|
|
inline |
Releases the unmanaged resources used by the WaveFormatConverter and optionally releases the managed resources.
- Parameters
-
disposing | true to release both managed and unmanaged resources; false to release only unmanaged resources. |
- Exceptions
-
MmException | Thrown when an error occurs during the ACM stream close operation. |
This method releases the unmanaged resources used by the WaveFormatConverter. If the disposing parameter is true, it also releases the managed resources. The method first checks if the streamHeader is not null, and if so, disposes it and sets it to null. Then, it checks if the streamHandle is not IntPtr.Zero, and if so, calls acmStreamClose to close the stream handle. If an error occurs during the acmStreamClose operation, a MmException is thrown with details of the error. Finally, it checks if the driverHandle is not IntPtr.Zero, and if so, calls acmDriverClose to close the driver handle.
◆ Dispose() [2/2]
virtual void NAudio.Wave.Compression.AcmStream.Dispose |
( |
bool | disposing | ) |
|
|
inlineprotectedvirtual |
Frees resources associated with this ACM Stream.
◆ Reposition()
void NAudio.Wave.Compression.AcmStream.Reposition |
( |
| ) |
|
|
inline |
Repositions the stream header.
This method calls the Reposition method of the streamHeader object to reposition the stream header.
◆ SourceToDest()
int NAudio.Wave.Compression.AcmStream.SourceToDest |
( |
int | source | ) |
|
|
inline |
Converts the source value to destination and returns the result.
- Parameters
-
source | The value to be converted. |
- Returns
- The converted value from source .
- Exceptions
-
MmException | Thrown when an error occurs during the conversion process. |
◆ SuggestPcmFormat()
Suggests a PCM format based on the given compressed format.
- Parameters
-
compressedFormat | The compressed format for which to suggest a PCM format. |
- Returns
- A PCM format suggested based on the given compressed format.
- Exceptions
-
MmException | Thrown when an error occurs during the suggestion process. |
This method suggests a PCM format based on the given compressed format using the acmFormatSuggest2 function from AcmInterop. It creates a PCM format with the same sample rate and channels as the compressed format, with 16-bit sample size. The suggested PCM format is returned after the suggestion process is completed.
◆ driverHandle
IntPtr NAudio.Wave.Compression.AcmStream.driverHandle |
|
private |
◆ sourceFormat
readonly WaveFormat NAudio.Wave.Compression.AcmStream.sourceFormat |
|
private |
◆ streamHandle
IntPtr NAudio.Wave.Compression.AcmStream.streamHandle |
|
private |
◆ streamHeader
◆ DestBuffer
byte [] NAudio.Wave.Compression.AcmStream.DestBuffer |
|
get |
Returns the Destination buffer. This will contain the converted data after a successful call to Convert.
◆ SourceBuffer
byte [] NAudio.Wave.Compression.AcmStream.SourceBuffer |
|
get |
Returns the Source Buffer. Fill this with data prior to calling convert.
The documentation for this class was generated from the following file:
- /Users/sumansaurabh/Documents/my-startup/xeno-rat/Plugins/LiveMicrophone/lib/NAudio.WinMM/Compression/AcmStream.cs