#include "client.h"
#include "client/sound/dma.h"
#include <mmsystem.h>
Go to the source code of this file.
◆ WAV_BUFFER_SIZE
#define WAV_BUFFER_SIZE 0x0400 |
◆ WAV_BUFFERS
◆ WAV_MASK
◆ WAVE_Activate()
static void WAVE_Activate |
( |
qboolean |
active | ) |
|
|
static |
◆ WAVE_BeginPainting()
◆ WAVE_FillAPI()
void WAVE_FillAPI |
( |
snddmaAPI_t * |
api | ) |
|
◆ WAVE_Init()
static sndinitstat_t WAVE_Init |
( |
void |
| ) |
|
|
static |
Definition at line 100 of file wave.c.
106 Com_DPrintf(
"Initializing wave sound\n");
111 memset(&
dma, 0,
sizeof(
dma));
115 if (
s_khz->integer == 44)
117 else if (
s_khz->integer == 22)
122 memset(&format, 0,
sizeof(format));
123 format.wFormatTag = WAVE_FORMAT_PCM;
124 format.nChannels =
dma.channels;
125 format.wBitsPerSample =
dma.samplebits;
126 format.nSamplesPerSec =
dma.speed;
127 format.nBlockAlign = format.nChannels * format.wBitsPerSample / 8;
129 format.nAvgBytesPerSec = format.nSamplesPerSec * format.nBlockAlign;
132 Com_DPrintf(
"...opening waveform device: ");
133 while ((hr = waveOutOpen((LPHWAVEOUT)&
hWaveOut, WAVE_MAPPER,
135 0, 0
L, CALLBACK_NULL)) != MMSYSERR_NOERROR) {
136 if (hr != MMSYSERR_ALLOCATED) {
137 Com_DPrintf(
"failed\n");
142 _T(
"The sound hardware is in use by another app.\n\n")
143 _T(
"Select Retry to try to start sound again or Cancel to run ") _T(
"q2pro") _T(
" with no sound."),
144 _T(
"Sound not available"),
145 MB_RETRYCANCEL | MB_SETFOREGROUND | MB_ICONEXCLAMATION) != IDRETRY) {
146 Com_DPrintf(
"hw in use\n");
158 Com_DPrintf(
"...allocating waveform buffer: ");
162 Com_DPrintf(
" failed with error %#lx\n", GetLastError());
168 Com_DPrintf(
"...locking waveform buffer: ");
171 Com_DPrintf(
" failed with error %#lx\n", GetLastError());
183 Com_DPrintf(
"...allocating waveform header: ");
184 hWaveHdr = GlobalAlloc(GMEM_MOVEABLE ,
187 Com_DPrintf(
"failed with error %#lx\n", GetLastError());
193 Com_DPrintf(
"...locking waveform header: ");
196 Com_DPrintf(
"failed with error %#lx\n", GetLastError());
204 Com_DPrintf(
"...preparing headers: ");
211 Com_DPrintf(
"failed\n");
220 dma.submission_chunk = 512;
224 Com_Printf(
"Wave sound initialized\n");
Referenced by WAVE_FillAPI().
◆ WAVE_Shutdown()
Definition at line 51 of file wave.c.
55 Com_Printf(
"Shutting down wave sound\n");
58 Com_DPrintf(
"...resetting waveOut\n");
62 Com_DPrintf(
"...unpreparing headers\n");
67 Com_DPrintf(
"...closing waveOut\n");
71 Com_DPrintf(
"...freeing WAV header\n");
77 Com_DPrintf(
"...freeing WAV buffer\n");
Referenced by WAVE_FillAPI(), WAVE_Init(), and WAVE_Submit().
◆ WAVE_Submit()
Definition at line 261 of file wave.c.
277 Com_DPrintf(
"WAVE_Submit: Sound overrun\n");
301 wResult = waveOutWrite(
hWaveOut, h,
sizeof(WAVEHDR));
303 if (wResult != MMSYSERR_NOERROR) {
304 Com_EPrintf(
"WAVE_Submit: Failed to write block to device\n");
Referenced by WAVE_FillAPI().
◆ gSndBufSize
◆ hData
◆ hWaveHdr
◆ hWaveOut
◆ lpData
◆ lpWaveHdr
◆ sample16
◆ snd_completed
◆ snd_sent
◆ wav_init