Obtaining Audio Data Streams
API Description
This API is used to obtain the audio data streams after audio mixing of each venue in a meeting. Only 32-bit libraries are supported.
Precautions
This API is an asynchronous API. The return value of the callback function only indicates whether the API is successfully called. The actual service processing result is returned in the corresponding notification function.
This API can be called before joining a meeting. After a meeting is created or joined, a notification is sent.
Method Definition
HWM_SDK_AGENT_API hwmsdk::HwmErrCode SetAudioRawDataOutputConfig(bool isOpen);
Callback Function
virtual void OnSetAudioRawDataOutputConfigResult(hwmsdk::HwmErrCode ret, const char* reason) {};
Notification Function
virtual void OnAudioFrameNotify(const AudioFrameData* pFrame) {};
Parameter Description
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
isOpen |
Yes |
bool |
Whether to enable the function. |
Type |
Description |
---|---|
HwmErrCode |
If 0 is returned, the operation is successful. If other values are returned, the operation fails. For details about values returned upon failures, see Common Error Codes. |
Parameter |
Type |
Description |
---|---|---|
eFrameType |
Audio frame type. |
|
iSamples |
signed int |
Number of sampling points for each channel. |
iSamplesPerSec |
signed int |
Sampling ratio. |
iBytesPerSample |
signed int |
Number of bytes of each sampling point. Generally, the PCM audio is 16 bits. |
iChannels |
signed int |
Number of audio channels. |
pBuffer |
char * |
Data buffer. Length = iSamples x iBytesPerSample x iChannels |
uiDataLen |
signed int |
Data length, which is used after encoding or before decoding. The value of this parameter needs to be updated after encryption or decryption. |
uiBufferLen |
signed int |
Buffer length. The encoded data is encrypted by a third party. The data length increases to prevent overflow. |
Enumerated Value |
Description |
---|---|
AUDIO_FRAME_TYPE_PCM16 |
16-bit precision PCM |
Sample Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
/** * The notification of reporting audio stream frame data */ void demoNotifyProc::OnAudioFrameNotify(const AudioFrameData* pFrame) { if(nullptr != pFrame) { FILE* recordFile = nullptr; std::string Path ("D:\\AudioFrame.pcm"); auto error = fopen_s(&recordFile,Path.c_str(), "ab+"); if (error != 0) { CTools::OutputRetStr("open file error = " + std::to_string(error)); } if (nullptr != recordFile) { fwrite(pFrame->pBuffer, sizeof(char), pFrame->iSamples * pFrame->iBytesPerSample * pFrame->iChannels, recordFile); fclose(recordFile); } } } |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot