Pergunta

I've been working in a quite entertaining project, I want to capture audio from the stereo mix on windows in PCM 44100 Hz 16 bit and pack it through the net with netcat (using cygwin).

The goal of this project is to be able to connect windows output audio to a pulseaudio server listening somewhere on the LAN.

So far, I've been able to dump the audio to a .wav file, and catting that file and piping it to netcat delivers it successfully to the pulseaudio server.

It's good, but I want to run it using a direct pipe from my client to netcat, so the audio must be sent to stdout.

The thing is that I cannot make windows write the audio to stdout, so far, I've been tethering with the mmioOpen function:

//Original instruction, where filename is a LPWSTR with the file name
//outputFile=mmioOpen(filename,&MMinfo,MMIO_WRITE | MMIO_CREATE);
//New instruction, quite dirty
HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE);
outputFile=(HMMIO)out;

//Rest of the function

Not working, I've been reading the documentation and i've also tried to set up an MMIOINFO structure to point at the stdout HANDLE and all, but to no avail.

I can't find no information in the docs about if it's possible to use the stdout as the output HANDLE through mmioOpen.

I've thought of using an intermediate file as buffer and keep putting it into stdout in a separate thread, but I don't believe that's good for latency, nor that it is a correct way to solve this problem.

Anybody knows if there's another way to capture the audio and write it directly into stdout?

Foi útil?

Solução

The handle returned by mmioOpen is not an "output handle". It is only useful for passing to other mmio functions.

But why are you using mmioOpen? It is for reading a WAV file. To get the real time audio data use the waveInOpen and related waveIn... functions.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top