MCPcopy Create free account
hub / github.com/AgoraIO/API-Examples / Render

Method Render

windows/APIExample/APIExample/dsound/DSoundRender.cpp:69–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67}
68
69void DSoundRender::Render(BYTE * buffer, int buffer_len)
70{
71 LPVOID buf = NULL;
72 if ((res >= WAIT_OBJECT_0) && (res <= WAIT_OBJECT_0 + 3))
73 {
74 std::lock_guard<std::mutex> _(m_mutex);
75 m_pDSBuffer8->Lock(offset, buffer_len, &buf, (DWORD*)&buffer_len, NULL, NULL, 0);
76 memcpy(buf, buffer, buffer_len);
77 offset += BUFFERNOTIFYSIZE;
78 offset %= (BUFFERNOTIFYSIZE * MAX_AUDIO_BUF);
79#ifdef _DEBUG
80 TCHAR buffer[1024];
81#ifdef _UNICODE
82 swprintf_s(buffer, 1024, _T("offset:%d ,data_len:%d\n"), offset, buffer_len);
83#else
84 sprintf_s(buffer, 1024, _T("offset:%d ,data_len:%d\n"), offset, buffer_len);
85#endif // _UNICODE
86 OutputDebugString(buffer);
87#endif
88 m_pDSBuffer8->Unlock(buf, buffer_len, NULL, 0);
89 }
90 res = WaitForMultipleObjects(MAX_AUDIO_BUF, m_event, FALSE, INFINITE);
91}
92
93void DSoundRender::Close()
94{

Callers 1

PullAudioFrameThreadMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected