Thank you, as always, for your useful input!
I actually stumbled upon your guide on
how to integrate WASAPI into the handmade hero code and I decided to ditch WaveOut as it is clearly gotten inferior to the Windows Core Audio API in terms of latency. However, I'm now facing a different kind of problem.
I wrote the following code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 | #include <mmdeviceapi.h>
#define ASSERT(expression) if (!(expression)) {*(int *) 0 = 0;}
static void InitWASAPI(int sampleRate, int bufferSize) {
if (CoInitializeEx(0, COINIT_SPEED_OVER_MEMORY) != S_OK) ASSERT(!"Error");
IMMDeviceEnumerator *enumerator;
if (CoCreateInstance(&CLSID_MMDeviceEnumerator, 0, CLSCTX_ALL, &IID_IMMDeviceEnumerator, (void **) &enumerator) != S_OK) ASSERT(!"Error");
}
int main(int argc, char **argv) {
InitWASAPI(48000, 48000);
return 0;
}
|
I'm using pure C here and this complicate things a little for me as there's no such thing as __uuidof() in C. So my first question is, what exactly does this operator do and are there any alternatives which are compatible with C?
And my second question is, why am I getting an undefined reference to CLSID_MMDeviceEnumerator and IID_IMMDeviceEnumerator when trying to compile the aforementioned code?