ReactOS 0.4.16-dev-297-gc569aee
winmm_test.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define WAVE_FORMAT_48M08   0x00001000 /* 48 kHz, Mono, 8-bit */
 
#define WAVE_FORMAT_48S08   0x00002000 /* 48 kHz, Stereo, 8-bit */
 
#define WAVE_FORMAT_48M16   0x00004000 /* 48 kHz, Mono, 16-bit */
 
#define WAVE_FORMAT_48S16   0x00008000 /* 48 kHz, Stereo, 16-bit */
 
#define WAVE_FORMAT_96M08   0x00010000 /* 96 kHz, Mono, 8-bit */
 
#define WAVE_FORMAT_96S08   0x00020000 /* 96 kHz, Stereo, 8-bit */
 
#define WAVE_FORMAT_96M16   0x00040000 /* 96 kHz, Mono, 16-bit */
 
#define WAVE_FORMAT_96S16   0x00080000 /* 96 kHz, Stereo, 16-bit */
 
#define DRV_QUERYDEVICEINTERFACE   (DRV_RESERVED + 12)
 
#define DRV_QUERYDEVICEINTERFACESIZE   (DRV_RESERVED + 13)
 

Functions

const chardev_name (int)
 
const charwave_open_flags (DWORD)
 
const charmmsys_error (MMRESULT)
 
const charwave_out_error (MMRESULT)
 
const charget_format_str (WORD format)
 
const charwave_time_format (UINT type)
 
DWORD bytes_to_samples (DWORD bytes, LPWAVEFORMATEX pwfx)
 
DWORD bytes_to_ms (DWORD bytes, LPWAVEFORMATEX pwfx)
 
DWORD time_to_bytes (LPMMTIME mmtime, LPWAVEFORMATEX pwfx)
 

Variables

static const unsigned int win_formats [][4]
 

Macro Definition Documentation

◆ DRV_QUERYDEVICEINTERFACE

#define DRV_QUERYDEVICEINTERFACE   (DRV_RESERVED + 12)

Definition at line 31 of file winmm_test.h.

◆ DRV_QUERYDEVICEINTERFACESIZE

#define DRV_QUERYDEVICEINTERFACESIZE   (DRV_RESERVED + 13)

Definition at line 34 of file winmm_test.h.

◆ WAVE_FORMAT_48M08

#define WAVE_FORMAT_48M08   0x00001000 /* 48 kHz, Mono, 8-bit */

Definition at line 20 of file winmm_test.h.

◆ WAVE_FORMAT_48M16

#define WAVE_FORMAT_48M16   0x00004000 /* 48 kHz, Mono, 16-bit */

Definition at line 22 of file winmm_test.h.

◆ WAVE_FORMAT_48S08

#define WAVE_FORMAT_48S08   0x00002000 /* 48 kHz, Stereo, 8-bit */

Definition at line 21 of file winmm_test.h.

◆ WAVE_FORMAT_48S16

#define WAVE_FORMAT_48S16   0x00008000 /* 48 kHz, Stereo, 16-bit */

Definition at line 23 of file winmm_test.h.

◆ WAVE_FORMAT_96M08

#define WAVE_FORMAT_96M08   0x00010000 /* 96 kHz, Mono, 8-bit */

Definition at line 24 of file winmm_test.h.

◆ WAVE_FORMAT_96M16

#define WAVE_FORMAT_96M16   0x00040000 /* 96 kHz, Mono, 16-bit */

Definition at line 26 of file winmm_test.h.

◆ WAVE_FORMAT_96S08

#define WAVE_FORMAT_96S08   0x00020000 /* 96 kHz, Stereo, 8-bit */

Definition at line 25 of file winmm_test.h.

◆ WAVE_FORMAT_96S16

#define WAVE_FORMAT_96S16   0x00080000 /* 96 kHz, Stereo, 16-bit */

Definition at line 27 of file winmm_test.h.

Function Documentation

◆ bytes_to_ms()

DWORD bytes_to_ms ( DWORD  bytes,
LPWAVEFORMATEX  pwfx 
)

Definition at line 466 of file wave.c.

467{
468 return bytes_to_samples(bytes, pwfx) * 1000 / pwfx->nSamplesPerSec;
469}
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
#define bytes_to_samples
Definition: intsym.h:226
DWORD nSamplesPerSec
Definition: mmreg.h:80

Referenced by check_position().

◆ bytes_to_samples()

DWORD bytes_to_samples ( DWORD  bytes,
LPWAVEFORMATEX  pwfx 
)

Definition at line 461 of file wave.c.

462{
463 return bytes / pwfx->nBlockAlign;
464}
WORD nBlockAlign
Definition: mmreg.h:82

◆ dev_name()

◆ get_format_str()

const char * get_format_str ( WORD  format)

Definition at line 408 of file wave.c.

409{
410 static char msg[32];
411#define WAVE_FORMAT(f) case f: return #f
412 switch (format) {
455 }
456#undef WAVE_FORMAT
457 sprintf(msg, "Unknown(0x%04x)", format);
458 return msg;
459}
#define msg(x)
Definition: auth_time.c:54
#define WAVE_FORMAT_MULAW
Definition: constants.h:428
#define WAVE_FORMAT_ADPCM
Definition: constants.h:426
#define WAVE_FORMAT_ALAW
Definition: constants.h:427
#define WAVE_FORMAT_PCM
Definition: constants.h:425
#define WAVE_FORMAT_EXTENSIBLE
Definition: ksmedia.h:651
#define WAVE_FORMAT_YAMAHA_ADPCM
Definition: mmreg.h:110
#define WAVE_FORMAT_DSPGROUP_TRUESPEECH
Definition: mmreg.h:112
#define WAVE_FORMAT_MEDIASPACE_ADPCM
Definition: mmreg.h:104
#define WAVE_FORMAT_OLIGSM
Definition: mmreg.h:134
#define WAVE_FORMAT_IBM_CVSD
Definition: mmreg.h:98
#define WAVE_FORMAT_CREATIVE_FASTSPEECH10
Definition: mmreg.h:132
#define WAVE_FORMAT_IMA_ADPCM
Definition: mmreg.h:103
#define WAVE_FORMAT_OLISBC
Definition: mmreg.h:137
#define WAVE_FORMAT_ECHOSC1
Definition: mmreg.h:113
#define WAVE_FORMAT_G721_ADPCM
Definition: mmreg.h:125
#define WAVE_FORMAT_DIALOGIC_OKI_ADPCM
Definition: mmreg.h:109
#define WAVE_FORMAT_OLIADPCM
Definition: mmreg.h:135
#define WAVE_FORMAT_CONTROL_RES_CR10
Definition: mmreg.h:123
#define WAVE_FORMAT_APTX
Definition: mmreg.h:115
#define WAVE_FORMAT_GSM610
Definition: mmreg.h:118
#define WAVE_FORMAT_FM_TOWNS_SND
Definition: mmreg.h:133
#define WAVE_FORMAT_AUDIOFILE_AF10
Definition: mmreg.h:116
#define WAVE_FORMAT_OLIOPR
Definition: mmreg.h:138
#define WAVE_FORMAT_MPEG
Definition: mmreg.h:126
#define WAVE_FORMAT_DEVELOPMENT
Definition: mmreg.h:160
#define WAVE_FORMAT_DIGISTD
Definition: mmreg.h:107
#define WAVE_FORMAT_AUDIOFILE_AF36
Definition: mmreg.h:114
#define WAVE_FORMAT_SIERRA_ADPCM
Definition: mmreg.h:105
#define WAVE_FORMAT_DIGIFIX
Definition: mmreg.h:108
#define WAVE_FORMAT_MPEGLAYER3
Definition: mmreg.h:127
#define WAVE_FORMAT_DIGIADPCM
Definition: mmreg.h:122
#define WAVE_FORMAT_NMS_VBXADPCM
Definition: mmreg.h:124
#define WAVE_FORMAT_ANTEX_ADPCME
Definition: mmreg.h:119
#define WAVE_FORMAT_OLICELP
Definition: mmreg.h:136
#define WAVE_FORMAT_CREATIVE_ADPCM
Definition: mmreg.h:130
#define WAVE_FORMAT_SONARC
Definition: mmreg.h:111
#define WAVE_FORMAT_OKI_ADPCM
Definition: mmreg.h:101
#define WAVE_FORMAT_CREATIVE_FASTSPEECH8
Definition: mmreg.h:131
#define WAVE_FORMAT_DOLBY_AC2
Definition: mmreg.h:117
#define WAVE_FORMAT_G723_ADPCM
Definition: mmreg.h:106
#define WAVE_FORMAT_CONTROL_RES_VQLPC
Definition: mmreg.h:120
#define WAVE_FORMAT_DIGIREAL
Definition: mmreg.h:121
#define WAVE_FORMAT(f)
Definition: format.c:58

Referenced by wave_out_test_deviceOut().

◆ mmsys_error()

const char * mmsys_error ( MMRESULT  error)

Definition at line 220 of file wave.c.

221{
222#define ERR_TO_STR(dev) case dev: return #dev
223 static char unknown[32];
224 switch (error) {
264 }
265 sprintf(unknown, "Unknown(0x%08x)", error);
266 return unknown;
267#undef ERR_TO_STR
268}
static WCHAR unknown[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1605
#define error(str)
Definition: mkdosfs.c:1605
#define WAVERR_STILLPLAYING
Definition: mmsystem.h:177
#define MMSYSERR_NOMEM
Definition: mmsystem.h:103
#define MMIOERR_CHUNKNOTFOUND
Definition: mmsystem.h:517
#define MMIOERR_CANNOTEXPAND
Definition: mmsystem.h:516
#define MMIOERR_FILENOTFOUND
Definition: mmsystem.h:509
#define MMSYSERR_NOTSUPPORTED
Definition: mmsystem.h:104
#define MIDIERR_INVALIDSETUP
Definition: mmsystem.h:236
#define MMIOERR_OUTOFMEMORY
Definition: mmsystem.h:510
#define MIDIERR_NODEVICE
Definition: mmsystem.h:235
#define MMSYSERR_NODRIVER
Definition: mmsystem.h:102
#define JOYERR_NOCANDO
Definition: mmsystem.h:431
#define MMIOERR_CANNOTREAD
Definition: mmsystem.h:513
#define MIDIERR_UNPREPARED
Definition: mmsystem.h:231
#define MIDIERR_NOTREADY
Definition: mmsystem.h:234
#define MMIOERR_CANNOTSEEK
Definition: mmsystem.h:515
#define TIMERR_STRUCT
Definition: mmsystem.h:420
#define MIXERR_INVALVALUE
Definition: mmsystem.h:297
#define JOYERR_UNPLUGGED
Definition: mmsystem.h:432
#define MMSYSERR_INVALHANDLE
Definition: mmsystem.h:101
#define MMSYSERR_INVALPARAM
Definition: mmsystem.h:107
#define MMIOERR_CANNOTOPEN
Definition: mmsystem.h:511
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define WAVERR_BADFORMAT
Definition: mmsystem.h:176
#define MMSYSERR_ALLOCATED
Definition: mmsystem.h:100
#define MIXERR_INVALLINE
Definition: mmsystem.h:295
#define MMSYSERR_ERROR
Definition: mmsystem.h:97
#define MIDIERR_STILLPLAYING
Definition: mmsystem.h:232
#define MMSYSERR_INVALFLAG
Definition: mmsystem.h:106
#define MMIOERR_UNBUFFERED
Definition: mmsystem.h:518
#define MMSYSERR_BADDEVICEID
Definition: mmsystem.h:98
#define WAVERR_UNPREPARED
Definition: mmsystem.h:178
#define MMIOERR_CANNOTCLOSE
Definition: mmsystem.h:512
#define JOYERR_PARMS
Definition: mmsystem.h:430
#define MMIOERR_CANNOTWRITE
Definition: mmsystem.h:514
#define MIXERR_INVALCONTROL
Definition: mmsystem.h:296
#define MMSYSERR_NOTENABLED
Definition: mmsystem.h:99
#define TIMERR_NOCANDO
Definition: mmsystem.h:419
#define WAVERR_SYNC
Definition: mmsystem.h:179
#define MMSYSERR_BADERRNUM
Definition: mmsystem.h:105
#define ERR_TO_STR(dev)

Referenced by wave_out_error(), wave_out_test_deviceOut(), and wave_out_tests().

◆ time_to_bytes()

DWORD time_to_bytes ( LPMMTIME  mmtime,
LPWAVEFORMATEX  pwfx 
)

Definition at line 471 of file wave.c.

472{
473 if (mmtime->wType == TIME_BYTES)
474 return mmtime->u.cb;
475 else if (mmtime->wType == TIME_SAMPLES)
476 return mmtime->u.sample * pwfx->nBlockAlign;
477 else if (mmtime->wType == TIME_MS)
478 return mmtime->u.ms * pwfx->nAvgBytesPerSec / 1000;
479 else if (mmtime->wType == TIME_SMPTE)
480 return ((mmtime->u.smpte.hour * 60 * 60) +
481 (mmtime->u.smpte.min * 60) +
482 (mmtime->u.smpte.sec)) * pwfx->nAvgBytesPerSec +
483 mmtime->u.smpte.frame * pwfx->nAvgBytesPerSec / 30;
484
485 trace("FIXME: time_to_bytes() type not supported\n");
486 return -1;
487}
#define trace
Definition: atltest.h:70
#define TIME_BYTES
Definition: mmsystem.h:30
#define TIME_SAMPLES
Definition: mmsystem.h:29
#define TIME_MS
Definition: mmsystem.h:28
#define TIME_SMPTE
Definition: mmsystem.h:31
DWORD nAvgBytesPerSec
Definition: mmreg.h:81
DWORD ms
Definition: mmsystem.h:967
DWORD cb
Definition: mmsystem.h:969
DWORD sample
Definition: mmsystem.h:968
UINT wType
Definition: mmsystem.h:965
union mmtime_tag::@3035 u
struct mmtime_tag::@3035::@3036 smpte

Referenced by check_position().

◆ wave_open_flags()

const char * wave_open_flags ( DWORD  flags)

Definition at line 284 of file wave.c.

285{
286 static char msg[1024];
287 BOOL first = TRUE;
288 msg[0] = 0;
290 strcat(msg, "CALLBACK_EVENT");
291 first = FALSE;
292 }
294 if (!first) strcat(msg, "|");
295 strcat(msg, "CALLBACK_FUNCTION");
296 first = FALSE;
297 }
299 if (!first) strcat(msg, "|");
300 strcat(msg, "CALLBACK_NULL");
301 first = FALSE;
302 }
304 if (!first) strcat(msg, "|");
305 strcat(msg, "CALLBACK_THREAD");
306 first = FALSE;
307 }
309 if (!first) strcat(msg, "|");
310 strcat(msg, "CALLBACK_WINDOW");
311 first = FALSE;
312 }
314 if (!first) strcat(msg, "|");
315 strcat(msg, "WAVE_ALLOWSYNC");
316 first = FALSE;
317 }
319 if (!first) strcat(msg, "|");
320 strcat(msg, "WAVE_FORMAT_DIRECT");
321 first = FALSE;
322 }
324 if (!first) strcat(msg, "|");
325 strcat(msg, "WAVE_FORMAT_QUERY");
326 first = FALSE;
327 }
328 if ((flags & WAVE_MAPPED) == WAVE_MAPPED) {
329 if (!first) strcat(msg, "|");
330 strcat(msg, "WAVE_MAPPED");
331 }
332 return msg;
333}
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
GLbitfield flags
Definition: glext.h:7161
const GLint * first
Definition: glext.h:5794
#define CALLBACK_WINDOW
Definition: mmsystem.h:148
#define CALLBACK_TYPEMASK
Definition: mmsystem.h:146
#define WAVE_FORMAT_QUERY
Definition: mmsystem.h:188
#define CALLBACK_THREAD
Definition: mmsystem.h:151
#define WAVE_ALLOWSYNC
Definition: mmsystem.h:189
#define CALLBACK_EVENT
Definition: mmsystem.h:152
#define WAVE_MAPPED
Definition: mmsystem.h:190
#define CALLBACK_FUNCTION
Definition: mmsystem.h:150
#define WAVE_FORMAT_DIRECT
Definition: mmsystem.h:191
#define CALLBACK_NULL
Definition: mmsystem.h:147

Referenced by wave_in_test_deviceIn(), and wave_out_test_deviceOut().

◆ wave_out_error()

const char * wave_out_error ( MMRESULT  error)

Definition at line 270 of file wave.c.

271{
272 static char msg[1024];
273 static char long_msg[1100];
274 MMRESULT rc;
275
276 rc = waveOutGetErrorTextA(error, msg, sizeof(msg));
277 if (rc != MMSYSERR_NOERROR)
278 sprintf(long_msg, "waveOutGetErrorTextA(%x) failed with error %x", error, rc);
279 else
280 sprintf(long_msg, "%s(%s)", mmsys_error(error), msg);
281 return long_msg;
282}
UINT MMRESULT
Definition: mmsystem.h:962
const char * mmsys_error(MMRESULT error)
Definition: wave.c:220
UINT WINAPI waveOutGetErrorTextA(UINT uError, LPSTR lpText, UINT uSize)
Definition: winmm.c:2198

Referenced by check_position(), test_fragmentsize(), wave_in_test_deviceIn(), wave_out_test_device(), and wave_out_test_deviceOut().

◆ wave_time_format()

const char * wave_time_format ( UINT  type)

Definition at line 391 of file wave.c.

392{
393 static char msg[32];
394#define TIME_FORMAT(f) case f: return #f
395 switch (type) {
402 }
403#undef TIME_FORMAT
404 sprintf(msg, "Unknown(0x%04x)", type);
405 return msg;
406}
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define TIME_TICKS
Definition: mmsystem.h:33
#define TIME_MIDI
Definition: mmsystem.h:32
#define TIME_FORMAT(f)

Referenced by check_position().

Variable Documentation

◆ win_formats

const unsigned int win_formats[][4]
static

Definition at line 37 of file winmm_test.h.