📄 vc25pro_doc_unamsacmclasses.html
字号:
Unprepares the header before first usage. This class calls unprepareHeader() method of device to do this.
</TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">procedure <A HREF="#class_unaMsAcmDeviceHeader"><SPAN class="class">unaMsAcmDeviceHeader</SPAN></A>.rePrepare(); virtual;</SPAN><P />
Prepares the header after it was used once or more.
</TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">function <A HREF="#class_unaMsAcmDeviceHeader"><SPAN class="class">unaMsAcmDeviceHeader</SPAN></A>.isDoneHeader(): bool; virtual; abstract;</SPAN><P />
Returns true if header contains data what was produced or used by device and can be changed or re-used. Descendant classes must override this method.
</TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">function <A HREF="#class_unaMsAcmDeviceHeader"><SPAN class="class">unaMsAcmDeviceHeader</SPAN></A>.isInQueue(): bool; virtual; abstract;</SPAN><P /></TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">function <A HREF="#class_unaMsAcmDeviceHeader"><SPAN class="class">unaMsAcmDeviceHeader</SPAN></A>.enter(timeout: unsigned): bool;</SPAN><P /></TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">procedure <A HREF="#class_unaMsAcmDeviceHeader"><SPAN class="class">unaMsAcmDeviceHeader</SPAN></A>.leave();</SPAN><P /></TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">constructor <A HREF="#class_unaMsAcmDeviceHeader"><SPAN class="class">unaMsAcmDeviceHeader</SPAN></A>.create(device: <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>);</SPAN><P />
Creates device buffer header. This buffer is used to pass data to and from device.
</TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">procedure <A HREF="#class_unaMsAcmDeviceHeader"><SPAN class="class">unaMsAcmDeviceHeader</SPAN></A>.AfterConstruction(); override;</SPAN><P /></TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">procedure <A HREF="#class_unaMsAcmDeviceHeader"><SPAN class="class">unaMsAcmDeviceHeader</SPAN></A>.BeforeDestruction(); override;</SPAN><P /></TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">property <A HREF="#class_unaMsAcmDeviceHeader"><SPAN class="class">unaMsAcmDeviceHeader</SPAN></A>.isFree: bool;</SPAN><P /></TD></TR></TABLE></DIV>
<DIV><P /><H4>Class <A NAME="class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>(<SPAN class="class">unaThread</SPAN>)</H4><P />
This is abstract class used as a base for classes dealing with audio streams (codecs, waveIn and waveOut, mixers).
<P />Before opening stream device you should specify source and destination formats of audio streams device will work with.
Method setFormat() will be called to set up source and destination format structures. You can access these structures later using the srcFormat and dstFormat properties.
They are pointers on WAVEFORMATEX and should be treated as read-only data. Destructor takes care about releasing these structures.
<P />All stream processing is done chunk by chunk. Chunk is the minimal amount of data which can be processed once in a time.
Chunk size is calculated automatically, and it will be enough to hold about 1/10 of second of audio. Use chunkSize property to examine current size of chunk.
<P />Since processing the audio stream could take some time, unaMsAcmStreamDevice has build-in mechanism which prevents stream overloading.
Use the checkOverload property to enable or disable this mechanism. numOverload property specifies maximum number of unprocessed chunks in output or input stream.
When actual number reaches this value, all new chunks will be discarded, until there will be enough space in the stream to put new chunk of data.
<P />inBytes and outBytes properties holds the amount of audio data written to and read from device.
<P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">function <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.setFormat(isSrc: bool; const format: string): bool;</SPAN><P />
Sets the source or destination PCM format for device. Format is given in string representation using base64 encoding.
</TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">function <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.setFormatEx(isSrc: bool; const format: WAVEFORMATEX): bool; virtual;</SPAN><P />
Sets the source or destination PCM format for device. Format is given as WAVEFORMATEX structure.
</TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">function <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.doOpen(flags: unsigned): MMRESULT; virtual;</SPAN><P />
Opens device. This method is usually overrided by descendant classes to perform the actual job.
</TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">function <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.open2(query: bool = false; timeout: unsigned = 10000; flags: unsigned = 0): MMRESULT; virtual;</SPAN><P /></TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">function <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.doClose(timeout: unsigned = 1): MMRESULT; virtual;</SPAN><P />
Closes device. This method is usually overrided by descendant classes to perform the actual job.
</TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">function <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.doGetErrorText(errorCode: MMRESULT): string; virtual;</SPAN><P />
Uses mmGetErrorCodeText2() to produce the error message.
Other devices could have own doGetErrorText() implementation.
</TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">function <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.doGetPosition(): int64; virtual;</SPAN><P /></TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">function <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.beforeNewChunk(data: pointer; size: unsigned): bool; virtual;</SPAN><P />
Performs initial actions for new chunk of data, such as volume level calculation.
</TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">function <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.prepareHeader(header: <A HREF="#class_unaMsAcmDeviceHeader"><SPAN class="class">unaMsAcmDeviceHeader</SPAN></A>): MMRESULT; virtual; abstract;</SPAN><P />
Prepares the buffer header before first use. Descendant classes must override this method.
</TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">function <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.unprepareHeader(header: <A HREF="#class_unaMsAcmDeviceHeader"><SPAN class="class">unaMsAcmDeviceHeader</SPAN></A>): MMRESULT; virtual; abstract;</SPAN><P />
Unprepares the buffer header after last use. Descendant classes must override this method.
</TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">function <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.afterOpen(): MMRESULT; virtual;</SPAN><P />
Called after the device was opened. Descendant classes may override this method to perform additional actions required by hardware/software.
</TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">procedure <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.afterClose(closeResult: MMRESULT); virtual;</SPAN><P /></TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">function <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.close2(timeout: unsigned = 10000): MMRESULT; virtual;</SPAN><P /></TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">procedure <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.startIn(); override;</SPAN><P /></TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">procedure <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.startOut(); override;</SPAN><P /></TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">function <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.flush2(waitForComplete: bool = true): bool; virtual;</SPAN><P /></TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">function <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.getMasterIsSrc2(): bool; virtual; abstract;</SPAN><P /></TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">function <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.formatChooseDef2(var format: pWAVEFORMATEX): MMRESULT; dynamic;</SPAN><P /></TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">procedure <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.setRealTime(value: bool); virtual;</SPAN><P /></TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">property <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.dstChunkSize: unsigned;</SPAN><P /></TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">constructor <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.create(createInStream: bool = true; createOutStream: bool = true; inOverNum: unsigned = 0; outOverNum: unsigned = 0; calcVolume: bool = false);</SPAN><P />
Initializates class instance.
</TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">destructor <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.Destroy(); override;</SPAN><P /></TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">procedure <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.AfterConstruction(); override;</SPAN><P /></TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">procedure <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.BeforeDestruction(); override;</SPAN><P /></TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">function <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.open(query: bool = false; timeout: unsigned = 10000; flags: unsigned = 0): MMRESULT;</SPAN><P />
Opens the device.
</TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">function <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.close(timeout: unsigned = 10000): MMRESULT;</SPAN><P />
Closes the device.
</TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">function <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.isOpen(): bool;</SPAN><P />
Returns true if device was opened successfully.
</TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">function <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.getVolume(channel: unsigned = 0): unsigned;</SPAN><P />
Returns current volume level for open device.
Volume range is from 0 to 32768.
</TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">function <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.getPrevVolume(channel: unsigned = 0): unsigned;</SPAN><P />
Returns previous volume level for open device.
</TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">procedure <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.setDspProperty(isLD: bool; propID: uint; value: int); overload;</SPAN><P /></TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">procedure <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.setDspProperty(isLD: bool; propID: uint; const value: float); overload;</SPAN><P /></TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">function <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.getDspProperty(isLD: bool; propID: uint; def: int = 0): int; overload;</SPAN><P /></TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">function <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.getDspProperty(isLD: bool; propID: uint; const def: float): float; overload;</SPAN><P /></TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">function <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.okToRead(): bool;</SPAN><P />
Use this method to check if you can read new data from device.
</TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">function <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.getPosition(): int64;</SPAN><P />
Returns current position in samples.
</TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">function <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.read(buf: pointer; size: unsigned = 0): unsigned;</SPAN><P />
Reads data from device.
Returns size of actual returned data.
Specify 0 as size parameter value when reading from ACM codec device.
</TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">function <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.write(buf: pointer; size: unsigned): unsigned;</SPAN><P />
Sends data to device.
</TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">function <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.flush(waitForComplete: bool = true): bool;</SPAN><P /></TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">function <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.getDataAvailable(isIn: bool): unsigned;</SPAN><P />
Returns number of bytes available to read from the device.
</TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">function <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.getMasterIsSrc(): bool;</SPAN><P />
Returns true if device is output device (playback or codec).
Returns false if device is input device (recording).
</TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">function <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.assignStream(isInStream: bool; stream: unaAbstractStream; careDestroy: bool = false): unaAbstractStream; overload;</SPAN><P />
Assigns input or output stream for device.
You can specify nil as stream to disable the input/output.
If you wish the device to destroy the stream in own destructor - specify true in careDestroy parameter.
</TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">function <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.assignStream(streamClass: unaAbstractStreamClass; isInStream: bool; careDestroy: bool = true): unaAbstractStream; overload;</SPAN><P />
Assigns input or output stream for device.
Stream will be created using the provided stream class.
If you wish the device to destroy the stream in own destructor - specify true in careDestroy parameter.
</TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">function <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.addConsumer(device: <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>; removeOutStream: bool = true): unsigned;</SPAN><P />
Adds a new consumer for device output.
All data produced by device will be passed to all consumers added by this method.
If you wish to destroy the output stream leave the default true value for removeOutStream parameter.
(Stream will be destroyed only if it was not a stream assigned by assignStream() with careDestroy = false).
</TD></TR></TABLE><P /><TABLE BORDER="1" width="100%"><TR><TD><SPAN class="source">function <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>.removeConsumer(device: <A HREF="#class_unaMsAcmStreamDevice"><SPAN class="class">unaMsAcmStreamDevice</SPAN></A>): bool;</SPAN><P />
Removes consumer from consumers list.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -