The QAudioBuffer class represents a collection of audio samples with a specific format and sample rate. 更多...
| 頭: | #include <QAudioBuffer> |
| qmake: | QT += multimedia |
| class | StereoFrame |
| typedef | S16S |
| typedef | S16U |
| typedef | S32F |
| typedef | S8S |
| typedef | S8U |
| QAudioBuffer () | |
| QAudioBuffer (const QAudioBuffer & other ) | |
| QAudioBuffer (const QByteArray & data , const QAudioFormat & format , qint64 startTime = -1) | |
| QAudioBuffer (int numFrames , const QAudioFormat & format , qint64 startTime = -1) | |
| ~QAudioBuffer () | |
| int | byteCount () const |
| const void * | constData () const |
| const T * | constData () const |
| const void * | data () const |
| void * | data () |
| const T * | data () const |
| T * | data () |
| qint64 | duration () const |
| QAudioFormat | format () const |
| int | frameCount () const |
| bool | isValid () const |
| int | sampleCount () const |
| qint64 | startTime () const |
| QAudioBuffer & | operator= (const QAudioBuffer & other ) |
The QAudioBuffer class represents a collection of audio samples with a specific format and sample rate.
This is a predefined specialization for a signed stereo 16 bit sample. Each channel is a signed short .
This is a predefined specialization for an unsigned stereo 16 bit sample. Each channel is an unsigned short .
This is a predefined specialization for an 32 bit float sample. Each channel is a float .
This is a predefined specialization for a signed stereo 8 bit sample. Each channel is a signed char .
This is a predefined specialization for an unsigned stereo 8 bit sample. Each channel is an unsigned char .
創建新的、空無效緩衝。
創建新的音頻緩衝從 other . Generally this will have copy-on-write semantics - a copy will only be made when it has to be.
創建新的音頻緩衝從供給 data ,在給定 format . The format will determine how the number and sizes of the samples are interpreted from the data .
If the supplied data is not an integer multiple of the calculated frame size, the excess data will not be used.
This audio buffer will copy the contents of data .
startTime (in microseconds) indicates when this buffer starts in the stream. If this buffer is not part of a stream, set it to -1.
創建具有空間的新音頻緩衝為 numFrames frames of the given format . The individual samples will be initialized to the default for the format.
startTime (in microseconds) indicates when this buffer starts in the stream. If this buffer is not part of a stream, set it to -1.
銷毀此音頻緩衝。
返迴此緩衝的大小 (以字節為單位)。
返迴此緩衝數據的指針。隻可以讀取它。
This method is preferred over the const version of data () to prevent unnecessary copying.
There is also a templatized version of this constData() function that allows you to retrieve a specific type of read-only pointer to the data. Note that there is no checking done on the format of the audio buffer - this is simply a convenience function.
// With a 16bit sample buffer: const quint16 *data = buffer->constData<quint16>();
返迴此緩衝數據的指針。隻可以讀取它。
應該使用 constData () function rather than this to prevent accidental deep copying.
There is also a templatized version of this data() function that allows you to retrieve a specific type of read-only pointer to the data. Note that there is no checking done on the format of the audio buffer - this is simply a convenience function.
// With a 16bit sample const buffer: const quint16 *data = buffer->data<quint16>();
Returns a pointer to this buffer's data. You can modify the data through the returned pointer.
Since QAudioBuffers can share the actual sample data, calling this function will result in a deep copy being made if there are any other buffers using the sample. You should avoid calling this unless you really need to modify the data.
This pointer will remain valid until the underlying storage is detached. In particular, if you obtain a pointer, and then copy this audio buffer, changing data through this pointer may change both buffer instances. Calling data () on either instance will again cause a deep copy to be made, which may invalidate the pointers returned from this function previously.
There is also a templatized version of data () allows you to retrieve a specific type of pointer to the data. Note that there is no checking done on the format of the audio buffer - this is simply a convenience function.
// With a 16bit sample buffer: quint16 *data = buffer->data<quint16>(); // May cause deep copy
Returns the duration of audio in this buffer, in microseconds.
這從屬 format (),和 frameCount ().
返迴 format 對於此緩衝。
Several properties of this format influence how the duration () 或 byteCount () are calculated from the frameCount ().
Returns the number of complete audio frames in this buffer.
An audio frame is an interleaved set of one sample per channel for the same instant in time.
Returns true if this is a valid buffer. A valid buffer has more than zero frames in it and a valid format.
返迴此緩衝中的樣本數。
If the format of this buffer has multiple channels, then this count includes all channels. This means that a stereo buffer with 1000 samples in total will have 500 left samples and 500 right samples (interleaved), and this function will return 1000.
另請參閱 frameCount ().
Returns the time in a stream that this buffer starts at (in microseconds).
若此緩衝不屬於流,這將返迴 -1。
賦值 other 緩衝到此。