MCPcopy Create free account
hub / github.com/HackerPoet/FractalSoundExplorer / WinAudio

Method WinAudio

WinAudio.cpp:8–26  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6WinAudio* WinAudio::WIN_AUDIO = NULL;
7
8WinAudio::WinAudio(HWND hwnd, int sample_rate) {
9 //Initialize variables
10 m_CurWaveOut = 0;
11 m_SampleRate = sample_rate;
12 m_IsReleasing = false;
13
14 //Specify output parameters
15 m_Format.wFormatTag = WAVE_FORMAT_PCM; // simple, uncompressed format
16 m_Format.nChannels = 2; // 1=mono, 2=stereo
17 m_Format.nSamplesPerSec = sample_rate; // sample rate
18 m_Format.nAvgBytesPerSec = sample_rate * 2; // nSamplesPerSec * n.Channels * wBitsPerSample/8
19 m_Format.nBlockAlign = 4; // n.Channels * wBitsPerSample/8
20 m_Format.wBitsPerSample = 16; // 16 for high quality, 8 for telephone-grade
21 m_Format.cbSize = 0; // must be set to zero
22
23 //Set handle
24 assert(WIN_AUDIO == NULL);
25 WIN_AUDIO = this;
26}
27
28WinAudio::~WinAudio() {
29 stop();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected