Functions | |
| HPI_ERR | HPI_OutStreamOpen (HPI_HSUBSYS *phSubSys, HW16 wAdapterIndex, HW16 wOutStreamIndex, HPI_HOSTREAM *phOutStream) |
| Open and initializes an output stream. | |
| HPI_ERR | HPI_OutStreamClose (HPI_HSUBSYS *phSubSys, HPI_HOSTREAM hOutStream) |
| Closes an output stream and deallocates host buffers if they are being used. | |
| HPI_ERR | HPI_OutStreamGetInfo (HPI_HSUBSYS *phSubSys, HPI_HOSTREAM hOutStream, HW16 *pwState, HW32 *pdwBufferSize, HW32 *pdwDataToPlay) |
| HPI_ERR | HPI_OutStreamGetInfoEx (HPI_HSUBSYS *phSubSys, HPI_HOSTREAM hOutStream, HW16 *pwState, HW32 *pdwBufferSize, HW32 *pdwDataToPlay, HW32 *pdwSamplesPlayed, HW32 *pdwAuxiliaryDataToPlay) |
| Get information about attributes and state of output stream. | |
| HPI_ERR | HPI_OutStreamWriteBuf (HPI_HSUBSYS *phSubSys, HPI_HOSTREAM hOutStream, HW8 *pbData, HW32 dwBytesToWrite, HPI_FORMAT *pFormat) |
| Writes a block of audio data to the specified output stream. | |
| HPI_ERR | HPI_OutStreamWrite (HPI_HSUBSYS *phSubSys, HPI_HOSTREAM hOutStream, HPI_DATA *pData) |
| Writes a block of audio data to the specified output stream. | |
| HPI_ERR | HPI_OutStreamStart (HPI_HSUBSYS *phSubSys, HPI_HOSTREAM hOutStream) |
| Starts an output stream playing audio data. | |
| HPI_ERR | HPI_OutStreamStop (HPI_HSUBSYS *phSubSys, HPI_HOSTREAM hOutStream) |
| Stops an output stream playing audio data. | |
| HPI_ERR | HPI_OutStreamReset (HPI_HSUBSYS *phSubSys, HPI_HOSTREAM hOutStream) |
| Clears the audio data buffer of an output stream. | |
| HPI_ERR | HPI_OutStreamQueryFormat (HPI_HSUBSYS *phSubSys, HPI_HOSTREAM hOutStream, HPI_FORMAT *pFormat) |
| Queries an OutStream to see whether it supports a certain audio format, described in pFormat. | |
| HPI_ERR | HPI_OutStreamSetVelocity (HPI_HSUBSYS *phSubSys, HPI_HOSTREAM hOutStream, short nVelocity) |
| Sets the playback velocity for scrubbing. | |
| HPI_ERR | HPI_OutStreamAncillaryReset (HPI_HSUBSYS *phSubSys, HPI_HOSTREAM hOutStream, HW16 wMode) |
| Resets MPEG ancillary data extraction. | |
| HPI_ERR | HPI_OutStreamAncillaryGetInfo (HPI_HSUBSYS *phSubSys, HPI_HOSTREAM hOutStream, HW32 *pdwFramesAvailable) |
| Returns information about the Ancillary stream. | |
| HPI_ERR | HPI_OutStreamAncillaryRead (HPI_HSUBSYS *phSubSys, HPI_HOSTREAM hOutStream, HPI_ANC_FRAME *pAncFrameBuffer, HW32 dwAncFrameBufferSizeInBytes, HW32 dwNumberOfAncillaryFramesToRead) |
| Reads frames of ancillary data from a stream's ancillary data buffer to pdwBuffer. | |
| HPI_ERR | HPI_OutStreamSetTimeScale (HPI_HSUBSYS *phSubSys, HPI_HOSTREAM hOutStream, HW32 dwTimeScale) |
| Sets the playback timescale with pitch and content preservation. | |
| HPI_ERR | HPI_OutStreamHostBufferAllocate (HPI_HSUBSYS *phSubSys, HPI_HOSTREAM hOutStream, HW32 dwSizeInBytes) |
| Allocates a buffer inside the driver for bus mastering transfers. | |
| HPI_ERR | HPI_OutStreamHostBufferFree (HPI_HSUBSYS *phSubSys, HPI_HOSTREAM hOutStream) |
| Free any buffers allocated by HPI_OutStreamHostBufferAllocate(). | |
| HPI_ERR | HPI_OutStreamGroupAdd (HPI_HSUBSYS *phSubSys, HPI_HOSTREAM hOutStream, HPI_HSTREAM hStream) |
| This function adds a stream to a group of streams. | |
| HPI_ERR | HPI_OutStreamGroupGetMap (HPI_HSUBSYS *phSubSys, HPI_HOSTREAM hOutStream, HW32 *pdwOutStreamMap, HW32 *pdwInStreamMap) |
| This function returns information about the streams that form a group. | |
| HPI_ERR | HPI_OutStreamGroupReset (HPI_HSUBSYS *phSubSys, HPI_HOSTREAM hOutStream) |
| Resets stream grouping information for a given out stream. | |
The state HPI_STATE_DRAINED indicates that the stream has run out of decoded data.
This can happen for two reasons:
Intentionally, when the end of the currently playing audio is reached.
A transient error condition when the adapter DSP was unable to decode audio fast enough.
The dwDataToPlay count returned from HPI_OutStreamGetInfoEx() measures the amount of encoded data (MPEG, PCM, etc.) in the stream's buffer. When there is less than a whole frame of encoded data left, it cannot be decoded for mixing and output. It is possible that HPI_OutStreamGetInfoEx() indicates that there is still a small amount of data to play, but the stream enters the DRAINED state, and the amount of data to play never gets to zero.
The size of a frame varies depending on the audio format. Compressed formats such as MPEG require whole frames of data in order to decode audio. The size of the input frame depends on the samplerate and bitrate (e.g. MPEG frame_bytes = bitrate/8 * 1152/samplerate).
AudioScience's implementation of PCM decoding also requires a minimum amount of input data. ASI4xxx adapters require 4608 bytes, whereas ASI6xxx adapters require 1536 bytes for stereo, half this for mono.
Conservative conditions to detect end of play:
Input data requirements for different algorithms.
| Bytes | PCM-16 | MP1 | MP2 | MP3 | AC-2
|
| AX | 4608 | <3456 | <3456 | - | 380 |
| AX4 | 4608 | <3456 | <3456 | 3456 | - |
| AX6 | 1536 | <=700 | <=700 | 1100 | 380 |
|
||||||||||||||||||||
|
Open and initializes an output stream. The handle is used for all future calls to that OutStream. An output stream may only be open by only one application at a time.
|
|
||||||||||||
|
Closes an output stream and deallocates host buffers if they are being used.
|
|
||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||
|
Get information about attributes and state of output stream. This is similar to HPI_OutStreamGetInfo() but returns extended information including the size of the streams buffer in pdwBufferSize. It also returns whether the stream is currently playing (the state) and the amount of audio data left to play.
|
|
||||||||||||||||||||||||
|
Writes a block of audio data to the specified output stream. dwBytesToWrite bytes are copied from *pbData array to the output stream hardware. On return the memory used to hold that data may be reused. A different format will only be accepted in the first write after the stream is opened or reset. The size of the data block that may be written is limited to half the size of the streams internal data buffer (specified by dwBufferSize returned by HPI_OutStreamGetInfo()).
wHE = HPI_FormatCreate( &hpiFormat, 2, // stereo channel HPI_FORMAT_MPEG_L2,// MPEG Layer II 44100L, //sample rate 128000L, //128k bits/sec 0 // no attributes ); wHE = HPI_OutStreamWriteBuf( phSubSys, hOutStream, &aData, dwBytes, &hpiFormat);
|
|
||||||||||||||||
|
Writes a block of audio data to the specified output stream. The data to write is specified by pData. pData also contains the format of the data (channels, compression, sampleRate). The HPI_OutStreamWrite() call copies the data in pData to the output stream hardware. Once the data has been written to the stream, the memory used to hold that data may be reused.
The size of the data block that may be written is limited to half the size of the streams internal data buffer (specified by dwBufferSize returned by HPI_OutStreamGetInfo()).
|
|
||||||||||||
|
Starts an output stream playing audio data. Data is taken from the circular buffer on the adapter hardware that has already been partially filled by HPI_OutStreamWrite commands. Audio is played from the current position in the buffer (which may be reset using HPI_OutStreamReset()).
|
|
||||||||||||
|
Stops an output stream playing audio data. The audio data buffer is not cleared, so a subsequent OutStreamStart will resume playing at the position in the buffer where the playback had been stopped.
|
|
||||||||||||
|
Clears the audio data buffer of an output stream. If the stream was playing at the time, it will be stopped.
|
|
||||||||||||||||
|
Queries an OutStream to see whether it supports a certain audio format, described in pFormat. The result, returned in the error code, is 0 if supported and HPI_ERROR_INVALID_FORMAT if not supported.
|
|
||||||||||||||||
|
Sets the playback velocity for scrubbing. Velocity range is +/- 4.0. nVelocity is set by nVelocity = (HW16)(fVelocity * HPI_VELOCITY_UNITS);
A typical playback call sequence without scrubbing is: Write Write Start Write ..... Stop Write Write SetVelocity Start Write SetVelocity ..... Stop - automatically turns of velocity/scrub mode. Data flow The scrubbing approach taken here is to decode audio to a "scrub buffer" that contains many seconds of PCM that can be traversed in at a variable rate.
Reverse scrubbing operates under the following constraints:
|
|
||||||||||||||||
|
Resets MPEG ancillary data extraction. Initializes the MPEG Layer II / III Ancillary data channel to support the extraction of wBytesPerFrame bytes from the MPEG bitstream.
|
|
||||||||||||||||
|
Returns information about the Ancillary stream.
|
|
||||||||||||||||||||||||
|
Reads frames of ancillary data from a stream's ancillary data buffer to pdwBuffer. Note that in the situation where energy level information is embedded in the ancillary data stream along with ancillary data, only the ancillary data will be returned in the ancillary data buffer. Bytes are filled in the bData[] array of the HPI_ANC_FRAME structures in the following order: The first bit of ancillary information that follows the valid audio data is placed in bit 7 of bData[0]. The first 8 bits of ancillary information following valid audio data are all placed in bData[0]. In the case where there are 6 bytes total of ancillary information (48 bits) the last byte filled is bData[5].
|
|
||||||||||||||||
|
Sets the playback timescale with pitch and content preservation.
Range is 0.8-1.2 ( to 120%) of original time. dwTimeScale = (HW16)(fTimeScale * HPI_OSTREAM_TIMESCALE_UNITS); The first call to HPI_OutStreamSetTimeScale should be made while the stream is reset so that time scaling can be performed after starting playback. Subsequent calls to HPI_OutStreamSetTimeScale can be made when the stream is playing to modify the timescale factor.
|
|
||||||||||||||||
|
Allocates a buffer inside the driver for bus mastering transfers. Once the buffer is allocated, OutStream data will be transferred from it in the background (rather than the application having to wait for the transfer). This function is provided so that the application can match the size of its transfers to the size of the buffer. After a call to HPI_OutStreamHostBufferAllocate(), HPI_OutStreamGetInfoEx() returns the size and data available in host buffer rather than the buffers on the adapter. However, while there is space in the adapter buffers, data will be quickly transferred to the adapter, providing additional buffering against delays in sending more audio data.
|
|
||||||||||||
|
Free any buffers allocated by HPI_OutStreamHostBufferAllocate().
|
|
||||||||||||||||
|
This function adds a stream to a group of streams. Stream groups are used to synchronise starting and stopping of multiple streams at once. The application of this is to support playing (or recording) multiple streams at once, enabling multi-channel recording and playback. When using the "Group" functions all streams that are to be grouped together should be opened. One of the streams should be selected to be the master stream and the other streams should be added to it's group. Both in streams and out streams can be added to the same group. Once a group has been formed, HPI_OutStreamStart() called on the master will cause all streams to start at once.
|
|
||||||||||||||||||||
|
This function returns information about the streams that form a group. Given an out stream handle, it returns a bit mapped representation of which streams belong to the group.
|
|
||||||||||||
|
Resets stream grouping information for a given out stream.
|
1.4.6-NO