ReactOS  0.4.14-dev-1233-gf5658fd
wavemap.c File Reference
#include <stdarg.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "mmddk.h"
#include "mmreg.h"
#include "msacm.h"
#include "wine/unicode.h"
#include "wine/debug.h"
Include dependency graph for wavemap.c:

Go to the source code of this file.

Classes

struct  tagWAVEMAPDATA
 

Macros

#define TRY(sps, bps)
 
#define TRY(sps, bps)
 

Typedefs

typedef struct tagWAVEMAPDATA WAVEMAPDATA
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (wavemap)
 
static BOOL WAVEMAP_IsData (const WAVEMAPDATA *wm)
 
static void CALLBACK wodCallback (HWAVEOUT hWave, UINT uMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
 
static DWORD wodOpenHelper (WAVEMAPDATA *wom, UINT idx, LPWAVEOPENDESC lpDesc, LPWAVEFORMATEX lpwfx, DWORD dwFlags)
 
static DWORD wodOpen (DWORD_PTR *lpdwUser, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
 
static DWORD wodClose (WAVEMAPDATA *wom)
 
static DWORD wodWrite (WAVEMAPDATA *wom, LPWAVEHDR lpWaveHdrSrc, DWORD dwParam2)
 
static DWORD wodPrepare (WAVEMAPDATA *wom, LPWAVEHDR lpWaveHdrSrc, DWORD dwParam2)
 
static DWORD wodUnprepare (WAVEMAPDATA *wom, LPWAVEHDR lpWaveHdrSrc, DWORD dwParam2)
 
static DWORD wodGetPosition (WAVEMAPDATA *wom, LPMMTIME lpTime, DWORD dwParam2)
 
static DWORD wodGetDevCaps (UINT wDevID, WAVEMAPDATA *wom, LPWAVEOUTCAPSW lpWaveCaps, DWORD dwParam2)
 
static DWORD wodGetVolume (UINT wDevID, WAVEMAPDATA *wom, LPDWORD lpVol)
 
static DWORD wodSetVolume (UINT wDevID, WAVEMAPDATA *wom, DWORD vol)
 
static DWORD wodPause (WAVEMAPDATA *wom)
 
static DWORD wodRestart (WAVEMAPDATA *wom)
 
static DWORD wodReset (WAVEMAPDATA *wom)
 
static DWORD wodBreakLoop (WAVEMAPDATA *wom)
 
static DWORD wodMapperStatus (WAVEMAPDATA *wom, DWORD flags, LPVOID ptr)
 
static DWORD wodMapperReconfigure (WAVEMAPDATA *wom, DWORD dwParam1, DWORD dwParam2)
 
DWORD WINAPI WAVEMAP_wodMessage (UINT wDevID, UINT wMsg, DWORD_PTR dwUser, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
 
static void CALLBACK widCallback (HWAVEIN hWave, UINT uMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
 
static DWORD widOpenHelper (WAVEMAPDATA *wim, UINT idx, LPWAVEOPENDESC lpDesc, LPWAVEFORMATEX lpwfx, DWORD dwFlags)
 
static DWORD widOpen (DWORD_PTR *lpdwUser, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
 
static DWORD widClose (WAVEMAPDATA *wim)
 
static DWORD widAddBuffer (WAVEMAPDATA *wim, LPWAVEHDR lpWaveHdrDst, DWORD dwParam2)
 
static DWORD widPrepare (WAVEMAPDATA *wim, LPWAVEHDR lpWaveHdrDst, DWORD dwParam2)
 
static DWORD widUnprepare (WAVEMAPDATA *wim, LPWAVEHDR lpWaveHdrDst, DWORD dwParam2)
 
static DWORD widGetPosition (WAVEMAPDATA *wim, LPMMTIME lpTime, DWORD dwParam2)
 
static DWORD widGetDevCaps (UINT wDevID, WAVEMAPDATA *wim, LPWAVEINCAPSW lpWaveCaps, DWORD dwParam2)
 
static DWORD widStop (WAVEMAPDATA *wim)
 
static DWORD widStart (WAVEMAPDATA *wim)
 
static DWORD widReset (WAVEMAPDATA *wim)
 
static DWORD widMapperStatus (WAVEMAPDATA *wim, DWORD flags, LPVOID ptr)
 
static DWORD widMapperReconfigure (WAVEMAPDATA *wim, DWORD dwParam1, DWORD dwParam2)
 
DWORD WINAPI WAVEMAP_widMessage (WORD wDevID, WORD wMsg, DWORD_PTR dwUser, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
 
static LRESULT WAVEMAP_drvOpen (LPSTR str)
 
static LRESULT WAVEMAP_drvClose (DWORD_PTR dwDevID)
 
LRESULT CALLBACK WAVEMAP_DriverProc (DWORD_PTR dwDevID, HDRVR hDriv, UINT wMsg, LPARAM dwParam1, LPARAM dwParam2)
 

Variables

static struct WINE_WAVEMAP * oss = NULL
 

Macro Definition Documentation

◆ TRY [1/2]

#define TRY (   sps,
  bps 
)
Value:
wfx.nSamplesPerSec = (sps); wfx.wBitsPerSample = (bps); \
switch (res=wodOpenHelper(wom, i, lpDesc, &wfx, dwFlags | WAVE_FORMAT_DIRECT)) { \
case MMSYSERR_NOERROR: wom->avgSpeedInner = wfx.nAvgBytesPerSec; wom->nSamplesPerSecInner = wfx.nSamplesPerSec; goto found; \
case WAVERR_BADFORMAT: break; \
default: goto error; \
}
#define WAVERR_BADFORMAT
Definition: mmsystem.h:176
#define error(str)
Definition: mkdosfs.c:1605
#define WAVE_FORMAT_DIRECT
Definition: mmsystem.h:191
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
GLuint res
Definition: glext.h:9613
static DWORD wodOpenHelper(WAVEMAPDATA *wom, UINT idx, LPWAVEOPENDESC lpDesc, LPWAVEFORMATEX lpwfx, DWORD dwFlags)
Definition: wavemap.c:123

◆ TRY [2/2]

#define TRY (   sps,
  bps 
)
Value:
wfx.nSamplesPerSec = (sps); wfx.wBitsPerSample = (bps); \
switch (res=widOpenHelper(wim, i, lpDesc, &wfx, dwFlags | WAVE_FORMAT_DIRECT)) { \
case MMSYSERR_NOERROR: wim->avgSpeedInner = wfx.nAvgBytesPerSec; wim->nSamplesPerSecInner = wfx.nSamplesPerSec; goto found; \
case WAVERR_BADFORMAT: break; \
default: goto error; \
}
#define WAVERR_BADFORMAT
Definition: mmsystem.h:176
#define error(str)
Definition: mkdosfs.c:1605
#define WAVE_FORMAT_DIRECT
Definition: mmsystem.h:191
static DWORD widOpenHelper(WAVEMAPDATA *wim, UINT idx, LPWAVEOPENDESC lpDesc, LPWAVEFORMATEX lpwfx, DWORD dwFlags)
Definition: wavemap.c:713
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
GLuint res
Definition: glext.h:9613

Typedef Documentation

◆ WAVEMAPDATA

Function Documentation

◆ WAVEMAP_DriverProc()

LRESULT CALLBACK WAVEMAP_DriverProc ( DWORD_PTR  dwDevID,
HDRVR  hDriv,
UINT  wMsg,
LPARAM  dwParam1,
LPARAM  dwParam2 
)

Definition at line 1224 of file wavemap.c.

1226 {
1227  TRACE("(%08lX, %p, %08X, %08lX, %08lX)\n",
1228  dwDevID, hDriv, wMsg, dwParam1, dwParam2);
1229 
1230  switch(wMsg) {
1231  case DRV_LOAD: return 1;
1232  case DRV_FREE: return 1;
1233  case DRV_OPEN: return WAVEMAP_drvOpen((LPSTR)dwParam1);
1234  case DRV_CLOSE: return WAVEMAP_drvClose(dwDevID);
1235  case DRV_ENABLE: return 1;
1236  case DRV_DISABLE: return 1;
1237  case DRV_QUERYCONFIGURE: return 1;
1238  case DRV_CONFIGURE: MessageBoxA(0, "WAVEMAP MultiMedia Driver !", "Wave mapper Driver", MB_OK); return 1;
1239  case DRV_INSTALL: return DRVCNF_RESTART;
1240  case DRV_REMOVE: return DRVCNF_RESTART;
1241  default:
1242  return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
1243  }
1244 }
#define DRV_DISABLE
Definition: mmsystem.h:123
static LRESULT WAVEMAP_drvClose(DWORD_PTR dwDevID)
Definition: wavemap.c:1210
#define DRV_CLOSE
Definition: mmsystem.h:122
char * LPSTR
Definition: xmlstorage.h:182
#define DRV_QUERYCONFIGURE
Definition: mmsystem.h:126
#define DRV_OPEN
Definition: mmsystem.h:121
int WINAPI MessageBoxA(_In_opt_ HWND, _In_opt_ LPCSTR, _In_opt_ LPCSTR, _In_ UINT)
#define DRV_LOAD(x)
#define DRVCNF_RESTART
Definition: mmsystem.h:135
#define DRV_REMOVE
Definition: mmsystem.h:128
#define TRACE(s)
Definition: solgame.cpp:4
#define DRV_CONFIGURE
Definition: mmsystem.h:125
#define DRV_FREE
Definition: mmsystem.h:124
static LRESULT WAVEMAP_drvOpen(LPSTR str)
Definition: wavemap.c:1195
#define DRV_ENABLE
Definition: mmsystem.h:120
#define MB_OK
Definition: winuser.h:784
#define DRV_INSTALL
Definition: mmsystem.h:127
LRESULT WINAPI DefDriverProc(DWORD_PTR dwDriverIdentifier, HDRVR hDrv, UINT Msg, LPARAM lParam1, LPARAM lParam2)
Definition: driver.c:554

◆ WAVEMAP_drvClose()

static LRESULT WAVEMAP_drvClose ( DWORD_PTR  dwDevID)
static

Definition at line 1210 of file wavemap.c.

1211 {
1212  TRACE("(%08lx)\n", dwDevID);
1213 
1214  if (oss) {
1215  oss = NULL;
1216  return 1;
1217  }
1218  return 0;
1219 }
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static struct WINE_WAVEMAP * oss
Definition: wavemap.c:1190

Referenced by WAVEMAP_DriverProc().

◆ WAVEMAP_drvOpen()

static LRESULT WAVEMAP_drvOpen ( LPSTR  str)
static

Definition at line 1195 of file wavemap.c.

1196 {
1197  TRACE("(%p)\n", str);
1198 
1199  if (oss)
1200  return 0;
1201 
1202  /* I know, this is ugly, but who cares... */
1203  oss = (struct WINE_WAVEMAP*)1;
1204  return 1;
1205 }
const WCHAR * str
#define TRACE(s)
Definition: solgame.cpp:4
static struct WINE_WAVEMAP * oss
Definition: wavemap.c:1190

Referenced by WAVEMAP_DriverProc().

◆ WAVEMAP_IsData()

static BOOL WAVEMAP_IsData ( const WAVEMAPDATA wm)
static

Definition at line 70 of file wavemap.c.

71 {
72  return (!IsBadReadPtr(wm, sizeof(WAVEMAPDATA)) && wm->self == wm);
73 }
struct tagWAVEMAPDATA * self
Definition: wavemap.c:46
BOOL WINAPI IsBadReadPtr(IN LPCVOID lp, IN UINT_PTR ucb)
Definition: except.c:807

Referenced by widCallback(), widGetDevCaps(), wodCallback(), wodGetDevCaps(), wodGetVolume(), and wodSetVolume().

◆ WAVEMAP_widMessage()

DWORD WINAPI WAVEMAP_widMessage ( WORD  wDevID,
WORD  wMsg,
DWORD_PTR  dwUser,
DWORD_PTR  dwParam1,
DWORD_PTR  dwParam2 
)

Definition at line 1148 of file wavemap.c.

1150 {
1151  TRACE("(%u, %04X, %08lX, %08lX, %08lX);\n",
1152  wDevID, wMsg, dwUser, dwParam1, dwParam2);
1153 
1154  switch (wMsg) {
1155  case DRVM_INIT:
1156  case DRVM_EXIT:
1157  case DRVM_ENABLE:
1158  case DRVM_DISABLE:
1159  /* FIXME: Pretend this is supported */
1160  return 0;
1161 
1162  case WIDM_OPEN: return widOpen ((DWORD_PTR*)dwUser, (LPWAVEOPENDESC)dwParam1, dwParam2);
1163  case WIDM_CLOSE: return widClose ((WAVEMAPDATA*)dwUser);
1164 
1165  case WIDM_ADDBUFFER: return widAddBuffer ((WAVEMAPDATA*)dwUser, (LPWAVEHDR)dwParam1, dwParam2);
1166  case WIDM_PREPARE: return widPrepare ((WAVEMAPDATA*)dwUser, (LPWAVEHDR)dwParam1, dwParam2);
1167  case WIDM_UNPREPARE: return widUnprepare ((WAVEMAPDATA*)dwUser, (LPWAVEHDR)dwParam1, dwParam2);
1168  case WIDM_GETDEVCAPS: return widGetDevCaps (wDevID, (WAVEMAPDATA*)dwUser, (LPWAVEINCAPSW)dwParam1, dwParam2);
1169  case WIDM_GETNUMDEVS: return 1;
1170  case WIDM_GETPOS: return widGetPosition ((WAVEMAPDATA*)dwUser, (LPMMTIME)dwParam1, dwParam2);
1171  case WIDM_RESET: return widReset ((WAVEMAPDATA*)dwUser);
1172  case WIDM_START: return widStart ((WAVEMAPDATA*)dwUser);
1173  case WIDM_STOP: return widStop ((WAVEMAPDATA*)dwUser);
1174  case WIDM_MAPPER_STATUS: return widMapperStatus ((WAVEMAPDATA*)dwUser, dwParam1, (LPVOID)dwParam2);
1175  case DRVM_MAPPER_RECONFIGURE: return widMapperReconfigure((WAVEMAPDATA*)dwUser, dwParam1, dwParam2);
1176  /* known but not supported */
1179  return MMSYSERR_NOTSUPPORTED;
1180  default:
1181  FIXME("unknown message %u!\n", wMsg);
1182  }
1183  return MMSYSERR_NOTSUPPORTED;
1184 }
#define WIDM_GETDEVCAPS
Definition: mmddk.h:137
static DWORD widStop(WAVEMAPDATA *wim)
Definition: wavemap.c:1088
#define WIDM_RESET
Definition: mmddk.h:145
#define WIDM_START
Definition: mmddk.h:143
#define WIDM_STOP
Definition: mmddk.h:144
static DWORD widPrepare(WAVEMAPDATA *wim, LPWAVEHDR lpWaveHdrDst, DWORD dwParam2)
Definition: wavemap.c:905
#define WIDM_GETNUMDEVS
Definition: mmddk.h:136
#define DRV_QUERYDEVICEINTERFACESIZE
Definition: mmddk.h:97
#define WIDM_GETPOS
Definition: mmddk.h:146
#define DRVM_EXIT
Definition: mmddk.h:57
static DWORD widMapperReconfigure(WAVEMAPDATA *wim, DWORD dwParam1, DWORD dwParam2)
Definition: wavemap.c:1138
#define DRVM_ENABLE
Definition: mmddk.h:59
static DWORD widGetDevCaps(UINT wDevID, WAVEMAPDATA *wim, LPWAVEINCAPSW lpWaveCaps, DWORD dwParam2)
Definition: wavemap.c:1052
static DWORD widAddBuffer(WAVEMAPDATA *wim, LPWAVEHDR lpWaveHdrDst, DWORD dwParam2)
Definition: wavemap.c:887
#define FIXME(fmt,...)
Definition: debug.h:110
#define WIDM_ADDBUFFER
Definition: mmddk.h:142
#define DRVM_MAPPER_RECONFIGURE
Definition: mmddk.h:85
#define DRVM_DISABLE
Definition: mmddk.h:58
#define TRACE(s)
Definition: solgame.cpp:4
#define WIDM_PREPARE
Definition: mmddk.h:140
#define MMSYSERR_NOTSUPPORTED
Definition: mmsystem.h:104
static DWORD widReset(WAVEMAPDATA *wim)
Definition: wavemap.c:1102
#define DRVM_INIT
Definition: mmddk.h:56
static DWORD widGetPosition(WAVEMAPDATA *wim, LPMMTIME lpTime, DWORD dwParam2)
Definition: wavemap.c:990
uint32_t DWORD_PTR
Definition: typedefs.h:64
#define WIDM_UNPREPARE
Definition: mmddk.h:141
static DWORD widMapperStatus(WAVEMAPDATA *wim, DWORD flags, LPVOID ptr)
Definition: wavemap.c:1109
static DWORD widUnprepare(WAVEMAPDATA *wim, LPWAVEHDR lpWaveHdrDst, DWORD dwParam2)
Definition: wavemap.c:967
#define WIDM_MAPPER_STATUS
Definition: mmddk.h:148
static DWORD widOpen(DWORD_PTR *lpdwUser, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
Definition: wavemap.c:742
#define WIDM_OPEN
Definition: mmddk.h:138
#define WIDM_CLOSE
Definition: mmddk.h:139
#define DRV_QUERYDEVICEINTERFACE
Definition: mmddk.h:96
static DWORD widStart(WAVEMAPDATA *wim)
Definition: wavemap.c:1095
static DWORD widClose(WAVEMAPDATA *wim)
Definition: wavemap.c:869

◆ WAVEMAP_wodMessage()

DWORD WINAPI WAVEMAP_wodMessage ( UINT  wDevID,
UINT  wMsg,
DWORD_PTR  dwUser,
DWORD_PTR  dwParam1,
DWORD_PTR  dwParam2 
)

Definition at line 618 of file wavemap.c.

620 {
621  TRACE("(%u, %04X, %08lX, %08lX, %08lX);\n",
622  wDevID, wMsg, dwUser, dwParam1, dwParam2);
623 
624  switch (wMsg) {
625  case DRVM_INIT:
626  case DRVM_EXIT:
627  case DRVM_ENABLE:
628  case DRVM_DISABLE:
629  /* FIXME: Pretend this is supported */
630  return 0;
631  case WODM_OPEN: return wodOpen ((DWORD_PTR*)dwUser, (LPWAVEOPENDESC)dwParam1,dwParam2);
632  case WODM_CLOSE: return wodClose ((WAVEMAPDATA*)dwUser);
633  case WODM_WRITE: return wodWrite ((WAVEMAPDATA*)dwUser, (LPWAVEHDR)dwParam1, dwParam2);
634  case WODM_PAUSE: return wodPause ((WAVEMAPDATA*)dwUser);
635  case WODM_GETPOS: return wodGetPosition ((WAVEMAPDATA*)dwUser, (LPMMTIME)dwParam1, dwParam2);
636  case WODM_BREAKLOOP: return wodBreakLoop ((WAVEMAPDATA*)dwUser);
637  case WODM_PREPARE: return wodPrepare ((WAVEMAPDATA*)dwUser, (LPWAVEHDR)dwParam1, dwParam2);
638  case WODM_UNPREPARE: return wodUnprepare ((WAVEMAPDATA*)dwUser, (LPWAVEHDR)dwParam1, dwParam2);
639  case WODM_GETDEVCAPS: return wodGetDevCaps (wDevID, (WAVEMAPDATA*)dwUser, (LPWAVEOUTCAPSW)dwParam1,dwParam2);
640  case WODM_GETNUMDEVS: return 1;
645  case WODM_GETVOLUME: return wodGetVolume (wDevID, (WAVEMAPDATA*)dwUser, (LPDWORD)dwParam1);
646  case WODM_SETVOLUME: return wodSetVolume (wDevID, (WAVEMAPDATA*)dwUser, dwParam1);
647  case WODM_RESTART: return wodRestart ((WAVEMAPDATA*)dwUser);
648  case WODM_RESET: return wodReset ((WAVEMAPDATA*)dwUser);
649  case WODM_MAPPER_STATUS: return wodMapperStatus ((WAVEMAPDATA*)dwUser, dwParam1, (LPVOID)dwParam2);
650  case DRVM_MAPPER_RECONFIGURE: return wodMapperReconfigure((WAVEMAPDATA*)dwUser, dwParam1, dwParam2);
651  /* known but not supported */
654  return MMSYSERR_NOTSUPPORTED;
655  default:
656  FIXME("unknown message %d!\n", wMsg);
657  }
658  return MMSYSERR_NOTSUPPORTED;
659 }
#define WODM_PAUSE
Definition: mmddk.h:115
#define WODM_GETDEVCAPS
Definition: mmddk.h:109
#define WODM_GETPLAYBACKRATE
Definition: mmddk.h:123
static DWORD wodPrepare(WAVEMAPDATA *wom, LPWAVEHDR lpWaveHdrSrc, DWORD dwParam2)
Definition: wavemap.c:349
#define WODM_RESTART
Definition: mmddk.h:116
static DWORD wodMapperReconfigure(WAVEMAPDATA *wom, DWORD dwParam1, DWORD dwParam2)
Definition: wavemap.c:608
#define DRV_QUERYDEVICEINTERFACESIZE
Definition: mmddk.h:97
#define WODM_OPEN
Definition: mmddk.h:110
#define WODM_GETPITCH
Definition: mmddk.h:119
#define DRVM_EXIT
Definition: mmddk.h:57
#define DRVM_ENABLE
Definition: mmddk.h:59
static DWORD wodClose(WAVEMAPDATA *wom)
Definition: wavemap.c:296
static DWORD wodReset(WAVEMAPDATA *wom)
Definition: wavemap.c:565
#define WODM_MAPPER_STATUS
Definition: mmddk.h:128
static DWORD wodBreakLoop(WAVEMAPDATA *wom)
Definition: wavemap.c:572
#define FIXME(fmt,...)
Definition: debug.h:110
static DWORD wodUnprepare(WAVEMAPDATA *wom, LPWAVEHDR lpWaveHdrSrc, DWORD dwParam2)
Definition: wavemap.c:410
#define DRVM_MAPPER_RECONFIGURE
Definition: mmddk.h:85
static DWORD wodMapperStatus(WAVEMAPDATA *wom, DWORD flags, LPVOID ptr)
Definition: wavemap.c:579
static DWORD wodWrite(WAVEMAPDATA *wom, LPWAVEHDR lpWaveHdrSrc, DWORD dwParam2)
Definition: wavemap.c:314
#define DRVM_DISABLE
Definition: mmddk.h:58
#define WODM_GETVOLUME
Definition: mmddk.h:121
static DWORD wodGetVolume(UINT wDevID, WAVEMAPDATA *wom, LPDWORD lpVol)
Definition: wavemap.c:533
#define WODM_PREPARE
Definition: mmddk.h:112
static DWORD wodPause(WAVEMAPDATA *wom)
Definition: wavemap.c:551
#define TRACE(s)
Definition: solgame.cpp:4
#define WODM_BREAKLOOP
Definition: mmddk.h:125
#define WODM_WRITE
Definition: mmddk.h:114
#define WODM_SETPITCH
Definition: mmddk.h:120
#define MMSYSERR_NOTSUPPORTED
Definition: mmsystem.h:104
#define DRVM_INIT
Definition: mmddk.h:56
#define WODM_SETVOLUME
Definition: mmddk.h:122
static DWORD wodGetPosition(WAVEMAPDATA *wom, LPMMTIME lpTime, DWORD dwParam2)
Definition: wavemap.c:433
uint32_t DWORD_PTR
Definition: typedefs.h:64
#define WODM_CLOSE
Definition: mmddk.h:111
static DWORD wodGetDevCaps(UINT wDevID, WAVEMAPDATA *wom, LPWAVEOUTCAPSW lpWaveCaps, DWORD dwParam2)
Definition: wavemap.c:495
static DWORD wodSetVolume(UINT wDevID, WAVEMAPDATA *wom, DWORD vol)
Definition: wavemap.c:542
#define WODM_UNPREPARE
Definition: mmddk.h:113
#define WODM_SETPLAYBACKRATE
Definition: mmddk.h:124
#define WODM_GETPOS
Definition: mmddk.h:118
uint32_t * LPDWORD
Definition: typedefs.h:58
#define DRV_QUERYDEVICEINTERFACE
Definition: mmddk.h:96
static DWORD wodRestart(WAVEMAPDATA *wom)
Definition: wavemap.c:558
static DWORD wodOpen(DWORD_PTR *lpdwUser, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
Definition: wavemap.c:152
#define WODM_RESET
Definition: mmddk.h:117
#define WODM_GETNUMDEVS
Definition: mmddk.h:108

◆ widAddBuffer()

static DWORD widAddBuffer ( WAVEMAPDATA wim,
LPWAVEHDR  lpWaveHdrDst,
DWORD  dwParam2 
)
static

Definition at line 887 of file wavemap.c.

888 {
889  PACMSTREAMHEADER ash;
890  LPWAVEHDR lpWaveHdrSrc;
891 
892  TRACE("(%p %p %08x)\n", wim, lpWaveHdrDst, dwParam2);
893 
894  if (!wim->hAcmStream) {
895  return waveInAddBuffer(wim->u.in.hInnerWave, lpWaveHdrDst, dwParam2);
896  }
897 
898  lpWaveHdrDst->dwFlags |= WHDR_INQUEUE;
899  ash = (PACMSTREAMHEADER)lpWaveHdrDst->reserved;
900 
901  lpWaveHdrSrc = (LPWAVEHDR)((LPSTR)ash + sizeof(ACMSTREAMHEADER));
902  return waveInAddBuffer(wim->u.in.hInnerWave, lpWaveHdrSrc, sizeof(*lpWaveHdrSrc));
903 }
HACMSTREAM hAcmStream
Definition: wavemap.c:57
char * LPSTR
Definition: xmlstorage.h:182
DWORD dwFlags
Definition: mmsystem.h:1018
#define TRACE(s)
Definition: solgame.cpp:4
union tagWAVEMAPDATA::@465 u
UINT WINAPI waveInAddBuffer(HWAVEIN hWaveIn, WAVEHDR *lpWaveInHdr, UINT uSize)
Definition: winmm.c:2720
#define WHDR_INQUEUE
Definition: mmsystem.h:197
DWORD_PTR reserved
Definition: mmsystem.h:1021
struct tagWAVEMAPDATA::@465::@467 in
struct _ACMSTREAMHEADER * PACMSTREAMHEADER

Referenced by WAVEMAP_widMessage().

◆ widCallback()

static void CALLBACK widCallback ( HWAVEIN  hWave,
UINT  uMsg,
DWORD_PTR  dwInstance,
DWORD_PTR  dwParam1,
DWORD_PTR  dwParam2 
)
static

Definition at line 665 of file wavemap.c.

667 {
668  WAVEMAPDATA* wim = (WAVEMAPDATA*)dwInstance;
669 
670  TRACE("(%p %u %lx %lx %lx);\n", hWave, uMsg, dwInstance, dwParam1, dwParam2);
671 
672  if (!WAVEMAP_IsData(wim)) {
673  ERR("Bad data\n");
674  return;
675  }
676 
677  if (uMsg != WIM_OPEN && hWave != wim->u.in.hInnerWave)
678  ERR("Shouldn't happen (%p %p)\n", hWave, wim->u.in.hInnerWave);
679 
680  switch (uMsg) {
681  case WIM_OPEN:
682  case WIM_CLOSE:
683  /* dwParam1 & dwParam2 are supposed to be 0, nothing to do */
684  break;
685  case WIM_DATA:
686  if (wim->hAcmStream) {
687  LPWAVEHDR lpWaveHdrSrc = (LPWAVEHDR)dwParam1;
688  PACMSTREAMHEADER ash = (PACMSTREAMHEADER)((LPSTR)lpWaveHdrSrc - sizeof(ACMSTREAMHEADER));
689  LPWAVEHDR lpWaveHdrDst = (LPWAVEHDR)ash->dwUser;
690 
691  /* convert data just gotten from waveIn into requested format */
692  if (acmStreamConvert(wim->hAcmStream, ash, 0L) != MMSYSERR_NOERROR) {
693  ERR("ACM conversion failed\n");
694  return;
695  } else {
696  TRACE("Converted %d bytes into %d\n", ash->cbSrcLengthUsed, ash->cbDstLengthUsed);
697  }
698  /* and setup the wavehdr to return accordingly */
699  lpWaveHdrDst->dwFlags &= ~WHDR_INQUEUE;
700  lpWaveHdrDst->dwFlags |= WHDR_DONE;
701  lpWaveHdrDst->dwBytesRecorded = ash->cbDstLengthUsed;
702  dwParam1 = (DWORD_PTR)lpWaveHdrDst;
703  }
704  break;
705  default:
706  ERR("Unknown msg %u\n", uMsg);
707  }
708 
709  DriverCallback(wim->dwCallback, HIWORD(wim->dwFlags), (HDRVR)wim->u.in.hOuterWave,
710  uMsg, wim->dwClientInstance, dwParam1, dwParam2);
711 }
#define DWORD_PTR
Definition: treelist.c:76
struct wavehdr_tag * LPWAVEHDR
HACMSTREAM hAcmStream
Definition: wavemap.c:57
DWORD cbSrcLengthUsed
Definition: msacm.h:555
char * LPSTR
Definition: xmlstorage.h:182
DWORD cbDstLengthUsed
Definition: msacm.h:559
static BOOL WAVEMAP_IsData(const WAVEMAPDATA *wm)
Definition: wavemap.c:70
#define WIM_CLOSE
Definition: mmsystem.h:185
DWORD dwFlags
Definition: mmsystem.h:1018
#define WIM_OPEN
Definition: mmsystem.h:184
HWAVEOUT hWave
Definition: main.h:79
DWORD dwFlags
Definition: wavemap.c:61
#define TRACE(s)
Definition: solgame.cpp:4
union tagWAVEMAPDATA::@465 u
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
if(!(yy_init))
Definition: macro.lex.yy.c:714
struct _ACMSTREAMHEADER ACMSTREAMHEADER
static const WCHAR L[]
Definition: oid.c:1250
#define ERR(fmt,...)
Definition: debug.h:109
DWORD_PTR dwCallback
Definition: wavemap.c:59
DWORD_PTR dwUser
Definition: msacm.h:552
#define WHDR_INQUEUE
Definition: mmsystem.h:197
DWORD_PTR dwClientInstance
Definition: wavemap.c:60
#define HIWORD(l)
Definition: typedefs.h:246
#define WHDR_DONE
Definition: mmsystem.h:193
#define WIM_DATA
Definition: mmsystem.h:186
BOOL WINAPI DriverCallback(DWORD dwCallBack, UINT uFlags, HDRVR hDev, UINT wMsg, DWORD dwUser, DWORD dwParam1, DWORD dwParam2)
struct tagWAVEMAPDATA::@465::@467 in
struct _ACMSTREAMHEADER * PACMSTREAMHEADER
MMRESULT WINAPI acmStreamConvert(HACMSTREAM has, PACMSTREAMHEADER pash, DWORD fdwConvert)
Definition: stream.c:89
DWORD dwBytesRecorded
Definition: mmsystem.h:1016

Referenced by widOpen(), and widOpenHelper().

◆ widClose()

static DWORD widClose ( WAVEMAPDATA wim)
static

Definition at line 869 of file wavemap.c.

870 {
871  DWORD ret;
872 
873  TRACE("(%p)\n", wim);
874 
875  ret = waveInClose(wim->u.in.hInnerWave);
876  if (ret == MMSYSERR_NOERROR) {
877  if (wim->hAcmStream) {
878  ret = acmStreamClose(wim->hAcmStream, 0);
879  }
880  if (ret == MMSYSERR_NOERROR) {
881  HeapFree(GetProcessHeap(), 0, wim);
882  }
883  }
884  return ret;
885 }
UINT WINAPI waveInClose(HWAVEIN hWaveIn)
Definition: winmm.c:2637
HACMSTREAM hAcmStream
Definition: wavemap.c:57
#define TRACE(s)
Definition: solgame.cpp:4
union tagWAVEMAPDATA::@465 u
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define GetProcessHeap()
Definition: compat.h:403
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
struct tagWAVEMAPDATA::@465::@467 in
#define HeapFree(x, y, z)
Definition: compat.h:402
MMRESULT WINAPI acmStreamClose(HACMSTREAM has, DWORD fdwClose)
Definition: stream.c:65

Referenced by WAVEMAP_widMessage().

◆ widGetDevCaps()

static DWORD widGetDevCaps ( UINT  wDevID,
WAVEMAPDATA wim,
LPWAVEINCAPSW  lpWaveCaps,
DWORD  dwParam2 
)
static

Definition at line 1052 of file wavemap.c.

1053 {
1054  TRACE("(%04x, %p %p %08x)\n", wDevID, wim, lpWaveCaps, dwParam2);
1055 
1056  /* if opened low driver, forward message */
1057  if (WAVEMAP_IsData(wim))
1058  return waveInGetDevCapsW((UINT_PTR)wim->u.in.hInnerWave, lpWaveCaps, dwParam2);
1059  /* else if no drivers, nothing to map so return bad device */
1060  if (waveInGetNumDevs() == 0) {
1061  WARN("bad device id\n");
1062  return MMSYSERR_BADDEVICEID;
1063  }
1064  /* otherwise, return caps of mapper itself */
1065  if (wDevID == (UINT)-1 || wDevID == (UINT16)-1) {
1066  WAVEINCAPSW wic;
1067  static const WCHAR init[] = {'W','i','n','e',' ','w','a','v','e',' ','i','n',' ','m','a','p','p','e','r',0};
1068  wic.wMid = 0x00FF;
1069  wic.wPid = 0x0001;
1070  wic.vDriverVersion = 0x0001;
1071  strcpyW(wic.szPname, init);
1072  wic.dwFormats =
1078  wic.wChannels = 2;
1079  wic.wReserved1 = 0;
1080  memcpy(lpWaveCaps, &wic, min(dwParam2, sizeof(wic)));
1081 
1082  return MMSYSERR_NOERROR;
1083  }
1084  ERR("This shouldn't happen\n");
1085  return MMSYSERR_ERROR;
1086 }
#define WAVE_FORMAT_48S16
Definition: winmm_test.h:23
#define WAVE_FORMAT_1M08
Definition: mmsystem.h:206
#define WAVE_FORMAT_96S08
Definition: winmm_test.h:25
WCHAR szPname[MAXPNAMELEN]
Definition: mmsystem.h:1060
#define WAVE_FORMAT_48S08
Definition: winmm_test.h:21
#define WAVE_FORMAT_4M16
Definition: mmsystem.h:216
#define WARN(fmt,...)
Definition: debug.h:111
static int init
Definition: wintirpc.c:33
UINT WINAPI waveInGetDevCapsW(UINT_PTR uDeviceID, LPWAVEINCAPSW lpCaps, UINT uSize)
Definition: winmm.c:2576
static BOOL WAVEMAP_IsData(const WAVEMAPDATA *wm)
Definition: wavemap.c:70
#define WAVE_FORMAT_1S08
Definition: mmsystem.h:207
MMVERSION vDriverVersion
Definition: mmsystem.h:1059
#define WAVE_FORMAT_2M08
Definition: mmsystem.h:210
DWORD dwFormats
Definition: mmsystem.h:1061
#define WAVE_FORMAT_4S16
Definition: mmsystem.h:217
#define WAVE_FORMAT_2M16
Definition: mmsystem.h:212
#define WAVE_FORMAT_96S16
Definition: winmm_test.h:27
#define WAVE_FORMAT_4S08
Definition: mmsystem.h:215
#define WAVE_FORMAT_48M16
Definition: winmm_test.h:22
#define WAVE_FORMAT_2S16
Definition: mmsystem.h:213
#define TRACE(s)
Definition: solgame.cpp:4
union tagWAVEMAPDATA::@465 u
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define MMSYSERR_ERROR
Definition: mmsystem.h:97
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WAVE_FORMAT_4M08
Definition: mmsystem.h:214
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
#define WAVE_FORMAT_1S16
Definition: mmsystem.h:209
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define MMSYSERR_BADDEVICEID
Definition: mmsystem.h:98
#define ERR(fmt,...)
Definition: debug.h:109
#define WAVE_FORMAT_96M08
Definition: winmm_test.h:24
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
#define WAVE_FORMAT_2S08
Definition: mmsystem.h:211
unsigned short UINT16
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50
#define WAVE_FORMAT_1M16
Definition: mmsystem.h:208
#define WAVE_FORMAT_96M16
Definition: winmm_test.h:26
UINT WINAPI waveInGetNumDevs(void)
Definition: winmm.c:2568
struct tagWAVEMAPDATA::@465::@467 in
#define WAVE_FORMAT_48M08
Definition: winmm_test.h:20

Referenced by WAVEMAP_widMessage().

◆ widGetPosition()

static DWORD widGetPosition ( WAVEMAPDATA wim,
LPMMTIME  lpTime,
DWORD  dwParam2 
)
static

Definition at line 990 of file wavemap.c.

991 {
992  DWORD val;
993  MMTIME timepos;
994  TRACE("(%p %p %08x)\n", wim, lpTime, dwParam2);
995 
996  timepos = *lpTime;
997 
998  /* For TIME_MS, we're going to recalculate using TIME_BYTES */
999  if (lpTime->wType == TIME_MS)
1000  timepos.wType = TIME_BYTES;
1001 
1002  /* This can change timepos.wType if the requested type is not supported */
1003  val = waveInGetPosition(wim->u.in.hInnerWave, &timepos, dwParam2);
1004 
1005  if (timepos.wType == TIME_BYTES)
1006  {
1007  DWORD dwInnerSamplesPerOuter = wim->nSamplesPerSecInner / wim->nSamplesPerSecOuter;
1008  if (dwInnerSamplesPerOuter > 0)
1009  {
1010  DWORD dwInnerBytesPerSample = wim->avgSpeedInner / wim->nSamplesPerSecInner;
1011  DWORD dwInnerBytesPerOuterSample = dwInnerBytesPerSample * dwInnerSamplesPerOuter;
1012  DWORD remainder = 0;
1013 
1014  /* If we are up sampling (going from lower sample rate to higher),
1015  ** we need to make a special accommodation for times when we've
1016  ** written a partial output sample. This happens frequently
1017  ** to us because we use msacm to do our up sampling, and it
1018  ** will up sample on an unaligned basis.
1019  ** For example, if you convert a 2 byte wide 8,000 'outer'
1020  ** buffer to a 2 byte wide 48,000 inner device, you would
1021  ** expect 2 bytes of input to produce 12 bytes of output.
1022  ** Instead, msacm will produce 8 bytes of output.
1023  ** But reporting our position as 1 byte of output is
1024  ** nonsensical; the output buffer position needs to be
1025  ** aligned on outer sample size, and aggressively rounded up.
1026  */
1027  remainder = timepos.u.cb % dwInnerBytesPerOuterSample;
1028  if (remainder > 0)
1029  {
1030  timepos.u.cb -= remainder;
1031  timepos.u.cb += dwInnerBytesPerOuterSample;
1032  }
1033  }
1034 
1035  lpTime->u.cb = MulDiv(timepos.u.cb, wim->avgSpeedOuter, wim->avgSpeedInner);
1036 
1037  /* Once we have the TIME_BYTES right, we can easily convert to TIME_MS */
1038  if (lpTime->wType == TIME_MS)
1039  lpTime->u.ms = MulDiv(lpTime->u.cb, 1000, wim->avgSpeedOuter);
1040  else
1041  lpTime->wType = TIME_BYTES;
1042  }
1043  else if (lpTime->wType == TIME_SAMPLES && timepos.wType == TIME_SAMPLES)
1044  lpTime->u.sample = MulDiv(timepos.u.sample, wim->nSamplesPerSecOuter, wim->nSamplesPerSecInner);
1045  else
1046  /* other time types don't require conversion */
1047  lpTime->u = timepos.u;
1048 
1049  return val;
1050 }
DWORD cb
Definition: mmsystem.h:969
UINT wType
Definition: mmsystem.h:965
#define TIME_SAMPLES
Definition: mmsystem.h:29
GLuint GLfloat * val
Definition: glext.h:7180
double __cdecl remainder(double, double)
DWORD sample
Definition: mmsystem.h:968
#define TRACE(s)
Definition: solgame.cpp:4
union tagWAVEMAPDATA::@465 u
union mmtime_tag::@2937 u
#define TIME_MS
Definition: mmsystem.h:28
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD avgSpeedInner
Definition: wavemap.c:64
UINT WINAPI waveInGetPosition(HWAVEIN hWaveIn, LPMMTIME lpTime, UINT uSize)
Definition: winmm.c:2782
DWORD nSamplesPerSecInner
Definition: wavemap.c:67
#define TIME_BYTES
Definition: mmsystem.h:30
struct tagWAVEMAPDATA::@465::@467 in
DWORD avgSpeedOuter
Definition: wavemap.c:63
DWORD ms
Definition: mmsystem.h:967
#define MulDiv(x, y, z)
Definition: gdifloat.h:86
DWORD nSamplesPerSecOuter
Definition: wavemap.c:66

Referenced by WAVEMAP_widMessage().

◆ widMapperReconfigure()

static DWORD widMapperReconfigure ( WAVEMAPDATA wim,
DWORD  dwParam1,
DWORD  dwParam2 
)
static

Definition at line 1138 of file wavemap.c.

1139 {
1140  FIXME("(%p %08x %08x) stub!\n", wim, dwParam1, dwParam2);
1141 
1142  return MMSYSERR_NOERROR;
1143 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96

Referenced by WAVEMAP_widMessage().

◆ widMapperStatus()

static DWORD widMapperStatus ( WAVEMAPDATA wim,
DWORD  flags,
LPVOID  ptr 
)
static

Definition at line 1109 of file wavemap.c.

1110 {
1111  UINT id;
1113 
1114  TRACE("(%p %08x %p)\n", wim, flags, ptr);
1115 
1116  switch (flags) {
1118  ret = waveInGetID(wim->u.in.hInnerWave, &id);
1119  *(LPDWORD)ptr = id;
1120  break;
1122  FIXME("Unsupported yet flag=%d\n", flags);
1123  *(LPDWORD)ptr = 0; /* FIXME ?? */
1124  break;
1126  FIXME("Unsupported flag=%d\n", flags);
1127  /* ptr points to a WAVEFORMATEX struct - before or after streaming ? */
1128  *(LPDWORD)ptr = 0; /* FIXME ?? */
1129  break;
1130  default:
1131  FIXME("Unsupported flag=%d\n", flags);
1132  *(LPDWORD)ptr = 0;
1133  break;
1134  }
1135  return ret;
1136 }
#define WAVEIN_MAPPER_STATUS_DEVICE
Definition: mmddk.h:149
#define WAVEIN_MAPPER_STATUS_MAPPED
Definition: mmddk.h:150
#define WAVEIN_MAPPER_STATUS_FORMAT
Definition: mmddk.h:151
#define FIXME(fmt,...)
Definition: debug.h:110
static PVOID ptr
Definition: dispmode.c:27
#define TRACE(s)
Definition: solgame.cpp:4
union tagWAVEMAPDATA::@465 u
unsigned long DWORD
Definition: ntddk_ex.h:95
#define MMSYSERR_NOTSUPPORTED
Definition: mmsystem.h:104
GLbitfield flags
Definition: glext.h:7161
int ret
#define LPDWORD
Definition: nt_native.h:46
unsigned int UINT
Definition: ndis.h:50
GLenum GLuint id
Definition: glext.h:5579
UINT WINAPI waveInGetID(HWAVEIN hWaveIn, UINT *lpuDeviceID)
Definition: winmm.c:2798
struct tagWAVEMAPDATA::@465::@467 in

Referenced by WAVEMAP_widMessage().

◆ widOpen()

static DWORD widOpen ( DWORD_PTR lpdwUser,
LPWAVEOPENDESC  lpDesc,
DWORD  dwFlags 
)
static

Definition at line 742 of file wavemap.c.

743 {
744  UINT ndlo, ndhi;
745  UINT i;
746  WAVEMAPDATA* wim = HeapAlloc(GetProcessHeap(), 0, sizeof(WAVEMAPDATA));
747  DWORD res;
748 
749  TRACE("(%p %p %08x)\n", lpdwUser, lpDesc, dwFlags);
750 
751  if (!wim) {
752  WARN("no memory\n");
753  return MMSYSERR_NOMEM;
754  }
755 
756  wim->self = wim;
757  wim->dwCallback = lpDesc->dwCallback;
758  wim->dwFlags = dwFlags;
759  wim->dwClientInstance = lpDesc->dwInstance;
760  wim->u.in.hOuterWave = (HWAVEIN)lpDesc->hWave;
761 
762  ndhi = waveInGetNumDevs();
763  if (dwFlags & WAVE_MAPPED) {
764  if (lpDesc->uMappedDeviceID >= ndhi) return MMSYSERR_INVALPARAM;
765  ndlo = lpDesc->uMappedDeviceID;
766  ndhi = ndlo + 1;
767  dwFlags &= ~WAVE_MAPPED;
768  } else {
769  ndlo = 0;
770  }
771 
772  wim->avgSpeedOuter = wim->avgSpeedInner = lpDesc->lpFormat->nAvgBytesPerSec;
774 
775  for (i = ndlo; i < ndhi; i++) {
776  if (waveInOpen(&wim->u.in.hInnerWave, i, lpDesc->lpFormat,
779  wim->hAcmStream = 0;
780  goto found;
781  }
782  }
783 
784  if ((dwFlags & WAVE_FORMAT_DIRECT) == 0)
785  {
786  WAVEFORMATEX wfx;
787 
789  wfx.cbSize = 0; /* normally, this field is not used for PCM format, just in case */
790  /* try some ACM stuff */
791 
792 #define TRY(sps,bps) wfx.nSamplesPerSec = (sps); wfx.wBitsPerSample = (bps); \
793  switch (res=widOpenHelper(wim, i, lpDesc, &wfx, dwFlags | WAVE_FORMAT_DIRECT)) { \
794  case MMSYSERR_NOERROR: wim->avgSpeedInner = wfx.nAvgBytesPerSec; wim->nSamplesPerSecInner = wfx.nSamplesPerSec; goto found; \
795  case WAVERR_BADFORMAT: break; \
796  default: goto error; \
797  }
798 
799  for (i = ndlo; i < ndhi; i++) {
801  /* first try with same stereo/mono option as source */
802  wfx.nChannels = lpDesc->lpFormat->nChannels;
803  TRY(wfx.nSamplesPerSec, 16);
804  TRY(wfx.nSamplesPerSec, 8);
805  wfx.nChannels ^= 3;
806  TRY(wfx.nSamplesPerSec, 16);
807  TRY(wfx.nSamplesPerSec, 8);
808  }
809 
810  for (i = ndlo; i < ndhi; i++) {
812  /* first try with same stereo/mono option as source */
813  wfx.nChannels = lpDesc->lpFormat->nChannels;
814  TRY(96000, 16);
815  TRY(48000, 16);
816  TRY(44100, 16);
817  TRY(22050, 16);
818  TRY(11025, 16);
819 
820  /* 2^3 => 1, 1^3 => 2, so if stereo, try mono (and the other way around) */
821  wfx.nChannels ^= 3;
822  TRY(96000, 16);
823  TRY(48000, 16);
824  TRY(44100, 16);
825  TRY(22050, 16);
826  TRY(11025, 16);
827 
828  /* first try with same stereo/mono option as source */
829  wfx.nChannels = lpDesc->lpFormat->nChannels;
830  TRY(96000, 8);
831  TRY(48000, 8);
832  TRY(44100, 8);
833  TRY(22050, 8);
834  TRY(11025, 8);
835 
836  /* 2^3 => 1, 1^3 => 2, so if stereo, try mono (and the other way around) */
837  wfx.nChannels ^= 3;
838  TRY(96000, 8);
839  TRY(48000, 8);
840  TRY(44100, 8);
841  TRY(22050, 8);
842  TRY(11025, 8);
843  }
844 #undef TRY
845  }
846 
847  HeapFree(GetProcessHeap(), 0, wim);
848  WARN("ret = WAVERR_BADFORMAT\n");
849  return WAVERR_BADFORMAT;
850 found:
851  if (dwFlags & WAVE_FORMAT_QUERY) {
852  *lpdwUser = 0L;
853  HeapFree(GetProcessHeap(), 0, wim);
854  } else {
855  *lpdwUser = (DWORD_PTR)wim;
856  TRACE("Ok (stream=%p)\n", wim->hAcmStream);
857  }
858  return MMSYSERR_NOERROR;
859 error:
860  HeapFree(GetProcessHeap(), 0, wim);
861  if (res==ACMERR_NOTPOSSIBLE) {
862  WARN("ret = WAVERR_BADFORMAT\n");
863  return WAVERR_BADFORMAT;
864  }
865  WARN("ret = 0x%08x\n", res);
866  return res;
867 }
#define WAVERR_BADFORMAT
Definition: mmsystem.h:176
#define WAVE_FORMAT_QUERY
Definition: mmsystem.h:188
static void CALLBACK widCallback(HWAVEIN hWave, UINT uMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
Definition: wavemap.c:665
#define DWORD_PTR
Definition: treelist.c:76
#define error(str)
Definition: mkdosfs.c:1605
MMRESULT WINAPI waveInOpen(HWAVEIN *lphWaveIn, UINT uDeviceID, LPCWAVEFORMATEX lpFormat, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD dwFlags)
Definition: winmm.c:2626
DWORD nAvgBytesPerSec
Definition: mmreg.h:81
DWORD dwCallback
Definition: mmddk.h:400
WORD nChannels
Definition: mmreg.h:79
#define WARN(fmt,...)
Definition: debug.h:111
#define TRY(sps, bps)
HACMSTREAM hAcmStream
Definition: wavemap.c:57
#define CALLBACK_TYPEMASK
Definition: mmsystem.h:146
UINT uMappedDeviceID
Definition: mmddk.h:402
#define WAVE_FORMAT_DIRECT
Definition: mmsystem.h:191
#define MMSYSERR_NOMEM
Definition: mmsystem.h:103
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define WAVE_FORMAT_PCM
Definition: constants.h:425
#define CALLBACK_FUNCTION
Definition: mmsystem.h:150
DWORD dwFlags
Definition: wavemap.c:61
DWORD nSamplesPerSec
Definition: audioclient.idl:42
HWAVE hWave
Definition: mmddk.h:398
#define TRACE(s)
Definition: solgame.cpp:4
union tagWAVEMAPDATA::@465 u
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
struct tagWAVEMAPDATA * self
Definition: wavemap.c:46
LPWAVEFORMATEX lpFormat
Definition: mmddk.h:399
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
DWORD dwInstance
Definition: mmddk.h:401
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
DWORD avgSpeedInner
Definition: wavemap.c:64
uint32_t DWORD_PTR
Definition: typedefs.h:64
#define ACMERR_NOTPOSSIBLE
Definition: msacm.h:36
DWORD_PTR dwCallback
Definition: wavemap.c:59
DWORD nSamplesPerSecInner
Definition: wavemap.c:67
#define MMSYSERR_INVALPARAM
Definition: mmsystem.h:107
#define WAVE_MAPPED
Definition: mmsystem.h:190
DWORD_PTR dwClientInstance
Definition: wavemap.c:60
unsigned int UINT
Definition: ndis.h:50
DWORD nSamplesPerSec
Definition: mmreg.h:80
GLuint res
Definition: glext.h:9613
UINT WINAPI waveInGetNumDevs(void)
Definition: winmm.c:2568
struct tagWAVEMAPDATA::@465::@467 in
DWORD avgSpeedOuter
Definition: wavemap.c:63
#define HeapFree(x, y, z)
Definition: compat.h:402
DWORD nSamplesPerSecOuter
Definition: wavemap.c:66

Referenced by WAVEMAP_widMessage().

◆ widOpenHelper()

static DWORD widOpenHelper ( WAVEMAPDATA wim,
UINT  idx,
LPWAVEOPENDESC  lpDesc,
LPWAVEFORMATEX  lpwfx,
DWORD  dwFlags 
)
static

Definition at line 713 of file wavemap.c.

716 {
717  DWORD ret;
718 
719  TRACE("(%p %04x %p %p %08x)\n", wim, idx, lpDesc, lpwfx, dwFlags);
720 
721  /* source is always PCM, so the formulas below apply */
722  lpwfx->nBlockAlign = (lpwfx->nChannels * lpwfx->wBitsPerSample) / 8;
723  lpwfx->nAvgBytesPerSec = lpwfx->nSamplesPerSec * lpwfx->nBlockAlign;
724  if (dwFlags & WAVE_FORMAT_QUERY) {
725  ret = acmStreamOpen(NULL, 0, lpwfx, lpDesc->lpFormat, NULL, 0L, 0L, ACM_STREAMOPENF_QUERY);
726  } else {
727  ret = acmStreamOpen(&wim->hAcmStream, 0, lpwfx, lpDesc->lpFormat, NULL, 0L, 0L, 0L);
728  }
729  if (ret == MMSYSERR_NOERROR) {
730  ret = waveInOpen(&wim->u.in.hInnerWave, idx, lpwfx,
734  acmStreamClose(wim->hAcmStream, 0);
735  wim->hAcmStream = 0;
736  }
737  }
738  TRACE("ret = %08x\n", ret);
739  return ret;
740 }
#define WAVE_FORMAT_QUERY
Definition: mmsystem.h:188
static void CALLBACK widCallback(HWAVEIN hWave, UINT uMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
Definition: wavemap.c:665
MMRESULT WINAPI waveInOpen(HWAVEIN *lphWaveIn, UINT uDeviceID, LPCWAVEFORMATEX lpFormat, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD dwFlags)
Definition: winmm.c:2626
DWORD nAvgBytesPerSec
Definition: mmreg.h:81
WORD nChannels
Definition: mmreg.h:79
HACMSTREAM hAcmStream
Definition: wavemap.c:57
#define CALLBACK_TYPEMASK
Definition: mmsystem.h:146
#define CALLBACK_FUNCTION
Definition: mmsystem.h:150
unsigned int idx
Definition: utils.c:41
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
union tagWAVEMAPDATA::@465 u
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
LPWAVEFORMATEX lpFormat
Definition: mmddk.h:399
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
static const WCHAR L[]
Definition: oid.c:1250
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
uint32_t DWORD_PTR
Definition: typedefs.h:64
MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pwfxSrc, PWAVEFORMATEX pwfxDst, PWAVEFILTER pwfltr, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen)
Definition: stream.c:149
DWORD nSamplesPerSec
Definition: mmreg.h:80
WORD nBlockAlign
Definition: mmreg.h:82
WORD wBitsPerSample
Definition: mmreg.h:83
struct tagWAVEMAPDATA::@465::@467 in
#define ACM_STREAMOPENF_QUERY
Definition: msacm.h:213
MMRESULT WINAPI acmStreamClose(HACMSTREAM has, DWORD fdwClose)
Definition: stream.c:65

◆ widPrepare()

static DWORD widPrepare ( WAVEMAPDATA wim,
LPWAVEHDR  lpWaveHdrDst,
DWORD  dwParam2 
)
static

Definition at line 905 of file wavemap.c.

906 {
907  PACMSTREAMHEADER ash;
908  DWORD size;
909  DWORD dwRet;
910  LPWAVEHDR lpWaveHdrSrc;
911 
912  TRACE("(%p %p %08x)\n", wim, lpWaveHdrDst, dwParam2);
913 
914  if (!wim->hAcmStream) {
915  return waveInPrepareHeader(wim->u.in.hInnerWave, lpWaveHdrDst, dwParam2);
916  }
917  if (acmStreamSize(wim->hAcmStream, lpWaveHdrDst->dwBufferLength, &size,
919  WARN("acmStreamSize failed\n");
920  return MMSYSERR_ERROR;
921  }
922 
923  ash = HeapAlloc(GetProcessHeap(), 0, sizeof(ACMSTREAMHEADER) + sizeof(WAVEHDR) + size);
924  if (ash == NULL) {
925  WARN("no memory\n");
926  return MMSYSERR_NOMEM;
927  }
928 
929  ash->cbStruct = sizeof(*ash);
930  ash->fdwStatus = 0L;
931  ash->dwUser = (DWORD_PTR)lpWaveHdrDst;
932  ash->pbSrc = (LPBYTE)ash + sizeof(ACMSTREAMHEADER) + sizeof(WAVEHDR);
933  ash->cbSrcLength = size;
934  /* ash->cbSrcLengthUsed */
935  ash->dwSrcUser = 0L; /* FIXME ? */
936  ash->pbDst = (LPBYTE)lpWaveHdrDst->lpData;
937  ash->cbDstLength = lpWaveHdrDst->dwBufferLength;
938  /* ash->cbDstLengthUsed */
939  ash->dwDstUser = lpWaveHdrDst->dwUser; /* FIXME ? */
940  dwRet = acmStreamPrepareHeader(wim->hAcmStream, ash, 0L);
941  if (dwRet != MMSYSERR_NOERROR) {
942  WARN("acmStreamPrepareHeader failed\n");
943  goto errCleanUp;
944  }
945 
946  lpWaveHdrSrc = (LPWAVEHDR)((LPSTR)ash + sizeof(ACMSTREAMHEADER));
947  lpWaveHdrSrc->lpData = (LPSTR)ash->pbSrc;
948  lpWaveHdrSrc->dwBufferLength = size; /* conversion is not done yet */
949  lpWaveHdrSrc->dwFlags = 0;
950  lpWaveHdrSrc->dwLoops = 0;
951  dwRet = waveInPrepareHeader(wim->u.in.hInnerWave, lpWaveHdrSrc, sizeof(*lpWaveHdrSrc));
952  if (dwRet != MMSYSERR_NOERROR) {
953  WARN("waveInPrepareHeader failed\n");
954  goto errCleanUp;
955  }
956 
957  lpWaveHdrDst->reserved = (DWORD_PTR)ash;
958  lpWaveHdrDst->dwFlags = WHDR_PREPARED;
959  TRACE("=> (0)\n");
960  return MMSYSERR_NOERROR;
961 errCleanUp:
962  TRACE("=> (%d)\n", dwRet);
963  HeapFree(GetProcessHeap(), 0, ash);
964  return dwRet;
965 }
#define ACM_STREAMSIZEF_DESTINATION
Definition: msacm.h:218
DWORD cbDstLength
Definition: msacm.h:558
#define DWORD_PTR
Definition: treelist.c:76
LPBYTE pbSrc
Definition: msacm.h:553
struct wavehdr_tag * LPWAVEHDR
#define WARN(fmt,...)
Definition: debug.h:111
HACMSTREAM hAcmStream
Definition: wavemap.c:57
DWORD_PTR dwDstUser
Definition: msacm.h:560
LPSTR lpData
Definition: mmsystem.h:1014
char * LPSTR
Definition: xmlstorage.h:182
UINT WINAPI waveInPrepareHeader(HWAVEIN hWaveIn, WAVEHDR *lpWaveInHdr, UINT uSize)
Definition: winmm.c:2656
DWORD dwLoops
Definition: mmsystem.h:1019
DWORD cbSrcLength
Definition: msacm.h:554
#define MMSYSERR_NOMEM
Definition: mmsystem.h:103
unsigned char * LPBYTE
Definition: typedefs.h:53
DWORD dwFlags
Definition: mmsystem.h:1018
smooth NULL
Definition: ftsmooth.c:416
LPBYTE pbDst
Definition: msacm.h:557
DWORD cbStruct
Definition: msacm.h:550
struct wavehdr_tag WAVEHDR
#define TRACE(s)
Definition: solgame.cpp:4
union tagWAVEMAPDATA::@465 u
GLsizeiptr size
Definition: glext.h:5919
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define MMSYSERR_ERROR
Definition: mmsystem.h:97
unsigned long DWORD
Definition: ntddk_ex.h:95
struct _ACMSTREAMHEADER ACMSTREAMHEADER
static const WCHAR L[]
Definition: oid.c:1250
DWORD dwBufferLength
Definition: mmsystem.h:1015
DWORD_PTR dwSrcUser
Definition: msacm.h:556
DWORD_PTR dwUser
Definition: msacm.h:552
DWORD fdwStatus
Definition: msacm.h:551
#define WHDR_PREPARED
Definition: mmsystem.h:194
DWORD_PTR dwUser
Definition: mmsystem.h:1017
MMRESULT WINAPI acmStreamPrepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash, DWORD fdwPrepare)
Definition: stream.c:299
MMRESULT WINAPI acmStreamSize(HACMSTREAM has, DWORD cbInput, LPDWORD pdwOutputBytes, DWORD fdwSize)
Definition: stream.c:394
DWORD_PTR reserved
Definition: mmsystem.h:1021
struct tagWAVEMAPDATA::@465::@467 in
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by WAVEMAP_widMessage().

◆ widReset()

static DWORD widReset ( WAVEMAPDATA wim)
static

Definition at line 1102 of file wavemap.c.

1103 {
1104  TRACE("(%p)\n", wim);
1105 
1106  return waveInReset(wim->u.in.hInnerWave);
1107 }
#define TRACE(s)
Definition: solgame.cpp:4
union tagWAVEMAPDATA::@465 u
UINT WINAPI waveInReset(HWAVEIN hWaveIn)
Definition: winmm.c:2737
struct tagWAVEMAPDATA::@465::@467 in

Referenced by WAVEMAP_widMessage().

◆ widStart()

static DWORD widStart ( WAVEMAPDATA wim)
static

Definition at line 1095 of file wavemap.c.

1096 {
1097  TRACE("(%p)\n", wim);
1098 
1099  return waveInStart(wim->u.in.hInnerWave);
1100 }
#define TRACE(s)
Definition: solgame.cpp:4
union tagWAVEMAPDATA::@465 u
UINT WINAPI waveInStart(HWAVEIN hWaveIn)
Definition: winmm.c:2752
struct tagWAVEMAPDATA::@465::@467 in

Referenced by WAVEMAP_widMessage().

◆ widStop()

static DWORD widStop ( WAVEMAPDATA wim)
static

Definition at line 1088 of file wavemap.c.

1089 {
1090  TRACE("(%p)\n", wim);
1091 
1092  return waveInStop(wim->u.in.hInnerWave);
1093 }
#define TRACE(s)
Definition: solgame.cpp:4
union tagWAVEMAPDATA::@465 u
UINT WINAPI waveInStop(HWAVEIN hWaveIn)
Definition: winmm.c:2767
struct tagWAVEMAPDATA::@465::@467 in

Referenced by WAVEMAP_widMessage().

◆ widUnprepare()

static DWORD widUnprepare ( WAVEMAPDATA wim,
LPWAVEHDR  lpWaveHdrDst,
DWORD  dwParam2 
)
static

Definition at line 967 of file wavemap.c.

968 {
969  PACMSTREAMHEADER ash;
970  LPWAVEHDR lpWaveHdrSrc;
971  DWORD dwRet1, dwRet2;
972 
973  TRACE("(%p %p %08x)\n", wim, lpWaveHdrDst, dwParam2);
974 
975  if (!wim->hAcmStream) {
976  return waveInUnprepareHeader(wim->u.in.hInnerWave, lpWaveHdrDst, dwParam2);
977  }
978  ash = (PACMSTREAMHEADER)lpWaveHdrDst->reserved;
979  dwRet1 = acmStreamUnprepareHeader(wim->hAcmStream, ash, 0L);
980 
981  lpWaveHdrSrc = (LPWAVEHDR)((LPSTR)ash + sizeof(ACMSTREAMHEADER));
982  dwRet2 = waveInUnprepareHeader(wim->u.in.hInnerWave, lpWaveHdrSrc, sizeof(*lpWaveHdrSrc));
983 
984  HeapFree(GetProcessHeap(), 0, ash);
985 
986  lpWaveHdrDst->dwFlags &= ~WHDR_PREPARED;
987  return (dwRet1 == MMSYSERR_NOERROR) ? dwRet2 : dwRet1;
988 }
struct wavehdr_tag * LPWAVEHDR
HACMSTREAM hAcmStream
Definition: wavemap.c:57
char * LPSTR
Definition: xmlstorage.h:182
DWORD dwFlags
Definition: mmsystem.h:1018
UINT WINAPI waveInUnprepareHeader(HWAVEIN hWaveIn, WAVEHDR *lpWaveInHdr, UINT uSize)
Definition: winmm.c:2687
MMRESULT WINAPI acmStreamUnprepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash, DWORD fdwUnprepare)
Definition: stream.c:449
#define TRACE(s)
Definition: solgame.cpp:4
union tagWAVEMAPDATA::@465 u
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define GetProcessHeap()
Definition: compat.h:403
unsigned long DWORD
Definition: ntddk_ex.h:95
struct _ACMSTREAMHEADER ACMSTREAMHEADER
static const WCHAR L[]
Definition: oid.c:1250
#define WHDR_PREPARED
Definition: mmsystem.h:194
DWORD_PTR reserved
Definition: mmsystem.h:1021
struct tagWAVEMAPDATA::@465::@467 in
struct _ACMSTREAMHEADER * PACMSTREAMHEADER
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by WAVEMAP_widMessage().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( wavemap  )

◆ wodBreakLoop()

static DWORD wodBreakLoop ( WAVEMAPDATA wom)
static

Definition at line 572 of file wavemap.c.

573 {
574  TRACE("(%p)\n",wom);
575 
576  return waveOutBreakLoop(wom->u.out.hInnerWave);
577 }
UINT WINAPI waveOutBreakLoop(HWAVEOUT hWaveOut)
Definition: winmm.c:2360
#define TRACE(s)
Definition: solgame.cpp:4
union tagWAVEMAPDATA::@465 u
struct tagWAVEMAPDATA::@465::@466 out

Referenced by WAVEMAP_wodMessage().

◆ wodCallback()

static void CALLBACK wodCallback ( HWAVEOUT  hWave,
UINT  uMsg,
DWORD_PTR  dwInstance,
DWORD_PTR  dwParam1,
DWORD_PTR  dwParam2 
)
static

Definition at line 79 of file wavemap.c.

81 {
82  WAVEMAPDATA* wom = (WAVEMAPDATA*)dwInstance;
83 
84  TRACE("(%p %u %ld %lx %lx);\n", hWave, uMsg, dwInstance, dwParam1, dwParam2);
85 
86  if (!WAVEMAP_IsData(wom)) {
87  ERR("Bad data\n");
88  return;
89  }
90 
91  if (uMsg != WOM_OPEN && hWave != wom->u.out.hInnerWave)
92  ERR("Shouldn't happen (%p %p)\n", hWave, wom->u.out.hInnerWave);
93 
94  switch (uMsg) {
95  case WOM_OPEN:
96  case WOM_CLOSE:
97  /* dwParam1 & dwParam2 are supposed to be 0, nothing to do */
98  break;
99  case WOM_DONE:
100  if (wom->hAcmStream) {
101  LPWAVEHDR lpWaveHdrDst = (LPWAVEHDR)dwParam1;
102  PACMSTREAMHEADER ash = (PACMSTREAMHEADER)((LPSTR)lpWaveHdrDst - sizeof(ACMSTREAMHEADER));
103  LPWAVEHDR lpWaveHdrSrc = (LPWAVEHDR)ash->dwUser;
104 
105  lpWaveHdrSrc->dwFlags &= ~WHDR_INQUEUE;
106  lpWaveHdrSrc->dwFlags |= WHDR_DONE;
107  dwParam1 = (DWORD_PTR)lpWaveHdrSrc;
108  }
109  break;
110  default:
111  ERR("Unknown msg %u\n", uMsg);
112  }
113 
114  DriverCallback(wom->dwCallback, HIWORD(wom->dwFlags), (HDRVR)wom->u.out.hOuterWave,
115  uMsg, wom->dwClientInstance, dwParam1, dwParam2);
116 }
#define WOM_DONE
Definition: mmsystem.h:183
struct wavehdr_tag * LPWAVEHDR
HACMSTREAM hAcmStream
Definition: wavemap.c:57
char * LPSTR
Definition: xmlstorage.h:182
#define WOM_OPEN
Definition: mmsystem.h:181
static BOOL WAVEMAP_IsData(const WAVEMAPDATA *wm)
Definition: wavemap.c:70
#define WOM_CLOSE
Definition: mmsystem.h:182
DWORD dwFlags
Definition: mmsystem.h:1018
HWAVEOUT hWave
Definition: main.h:79
DWORD dwFlags
Definition: wavemap.c:61
#define TRACE(s)
Definition: solgame.cpp:4
union tagWAVEMAPDATA::@465 u
struct _ACMSTREAMHEADER ACMSTREAMHEADER
uint32_t DWORD_PTR
Definition: typedefs.h:64
#define ERR(fmt,...)
Definition: debug.h:109
DWORD_PTR dwCallback
Definition: wavemap.c:59
DWORD_PTR dwUser
Definition: msacm.h:552
#define WHDR_INQUEUE
Definition: mmsystem.h:197
DWORD_PTR dwClientInstance
Definition: wavemap.c:60
#define HIWORD(l)
Definition: typedefs.h:246
#define WHDR_DONE
Definition: mmsystem.h:193
BOOL WINAPI DriverCallback(DWORD dwCallBack, UINT uFlags, HDRVR hDev, UINT wMsg, DWORD dwUser, DWORD dwParam1, DWORD dwParam2)
struct _ACMSTREAMHEADER * PACMSTREAMHEADER
struct tagWAVEMAPDATA::@465::@466 out

Referenced by wodOpen(), and wodOpenHelper().

◆ wodClose()

static DWORD wodClose ( WAVEMAPDATA wom)
static

Definition at line 296 of file wavemap.c.

297 {
298  DWORD ret;
299 
300  TRACE("(%p)\n", wom);
301 
302  ret = waveOutClose(wom->u.out.hInnerWave);
303  if (ret == MMSYSERR_NOERROR) {
304  if (wom->hAcmStream) {
305  ret = acmStreamClose(wom->hAcmStream, 0);
306  }
307  if (ret == MMSYSERR_NOERROR) {
308  HeapFree(GetProcessHeap(), 0, wom);
309  }
310  }
311  return ret;
312 }
HACMSTREAM hAcmStream
Definition: wavemap.c:57
#define TRACE(s)
Definition: solgame.cpp:4
union tagWAVEMAPDATA::@465 u
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define GetProcessHeap()
Definition: compat.h:403
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
UINT WINAPI waveOutClose(HWAVEOUT hWaveOut)
Definition: winmm.c:2260
struct tagWAVEMAPDATA::@465::@466 out
#define HeapFree(x, y, z)
Definition: compat.h:402
MMRESULT WINAPI acmStreamClose(HACMSTREAM has, DWORD fdwClose)
Definition: stream.c:65

Referenced by WAVEMAP_wodMessage().

◆ wodGetDevCaps()

static DWORD wodGetDevCaps ( UINT  wDevID,
WAVEMAPDATA wom,
LPWAVEOUTCAPSW  lpWaveCaps,
DWORD  dwParam2 
)
static

Definition at line 495 of file wavemap.c.

496 {
497  static const WCHAR name[] = {'W','i','n','e',' ','w','a','v','e',' ','o','u','t',' ','m','a','p','p','e','r',0};
498 
499  TRACE("(%04x %p %p %08x)\n",wDevID, wom, lpWaveCaps, dwParam2);
500 
501  /* if opened low driver, forward message */
502  if (WAVEMAP_IsData(wom))
503  return waveOutGetDevCapsW((UINT_PTR)wom->u.out.hInnerWave, lpWaveCaps, dwParam2);
504  /* else if no drivers, nothing to map so return bad device */
505  if (waveOutGetNumDevs() == 0) {
506  WARN("bad device id\n");
507  return MMSYSERR_BADDEVICEID;
508  }
509  /* otherwise, return caps of mapper itself */
510  if (wDevID == (UINT)-1 || wDevID == (UINT16)-1) {
511  WAVEOUTCAPSW woc;
512  woc.wMid = 0x00FF;
513  woc.wPid = 0x0001;
514  woc.vDriverVersion = 0x0332;
515  lstrcpyW(woc.szPname, name);
516  woc.dwFormats =
522  woc.wChannels = 2;
523  woc.wReserved1 = 0;
525  memcpy(lpWaveCaps, &woc, min(dwParam2, sizeof(woc)));
526 
527  return MMSYSERR_NOERROR;
528  }
529  ERR("This shouldn't happen\n");
530  return MMSYSERR_ERROR;
531 }
#define WAVE_FORMAT_48S16
Definition: winmm_test.h:23
#define WAVE_FORMAT_1M08
Definition: mmsystem.h:206
#define WAVE_FORMAT_96S08
Definition: winmm_test.h:25
#define WAVE_FORMAT_48S08
Definition: winmm_test.h:21
#define WAVE_FORMAT_4M16
Definition: mmsystem.h:216
#define WARN(fmt,...)
Definition: debug.h:111
#define WAVECAPS_VOLUME
Definition: mmsystem.h:200
static BOOL WAVEMAP_IsData(const WAVEMAPDATA *wm)
Definition: wavemap.c:70
#define WAVE_FORMAT_1S08
Definition: mmsystem.h:207
UINT WINAPI waveOutGetDevCapsW(UINT_PTR uDeviceID, LPWAVEOUTCAPSW lpCaps, UINT uSize)
Definition: winmm.c:2176
#define WAVECAPS_LRVOLUME
Definition: mmsystem.h:201
#define WAVE_FORMAT_2M08
Definition: mmsystem.h:210
#define WAVE_FORMAT_4S16
Definition: mmsystem.h:217
#define WAVE_FORMAT_2M16
Definition: mmsystem.h:212
#define WAVE_FORMAT_96S16
Definition: winmm_test.h:27
#define WAVE_FORMAT_4S08
Definition: mmsystem.h:215
#define WAVE_FORMAT_48M16
Definition: winmm_test.h:22
UINT WINAPI waveOutGetNumDevs(void)
Definition: winmm.c:2140
#define WAVE_FORMAT_2S16
Definition: mmsystem.h:213
#define TRACE(s)
Definition: solgame.cpp:4
union tagWAVEMAPDATA::@465 u
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define MMSYSERR_ERROR
Definition: mmsystem.h:97
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WAVE_FORMAT_4M08
Definition: mmsystem.h:214
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
WCHAR szPname[MAXPNAMELEN]
Definition: mmsystem.h:1039
#define WAVE_FORMAT_1S16
Definition: mmsystem.h:209
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define MMSYSERR_BADDEVICEID
Definition: mmsystem.h:98
#define ERR(fmt,...)
Definition: debug.h:109
MMVERSION vDriverVersion
Definition: mmsystem.h:1038
#define WAVE_FORMAT_96M08
Definition: winmm_test.h:24
#define lstrcpyW
Definition: compat.h:414
#define WAVE_FORMAT_2S08
Definition: mmsystem.h:211
unsigned short UINT16
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50
Definition: name.c:38
#define WAVE_FORMAT_1M16
Definition: mmsystem.h:208
#define WAVE_FORMAT_96M16
Definition: winmm_test.h:26
struct tagWAVEMAPDATA::@465::@466 out
#define WAVE_FORMAT_48M08
Definition: winmm_test.h:20

Referenced by WAVEMAP_wodMessage().

◆ wodGetPosition()

static DWORD wodGetPosition ( WAVEMAPDATA wom,
LPMMTIME  lpTime,
DWORD  dwParam2 
)
static

Definition at line 433 of file wavemap.c.

434 {
435  DWORD val;
436  MMTIME timepos;
437  TRACE("(%p %p %08x)\n", wom, lpTime, dwParam2);
438 
439  timepos = *lpTime;
440 
441  /* For TIME_MS, we're going to recalculate using TIME_BYTES */
442  if (lpTime->wType == TIME_MS)
443  timepos.wType = TIME_BYTES;
444 
445  /* This can change timepos.wType if the requested type is not supported */
446  val = waveOutGetPosition(wom->u.out.hInnerWave, &timepos, dwParam2);
447 
448  if (timepos.wType == TIME_BYTES)
449  {
450  DWORD dwInnerSamplesPerOuter = wom->nSamplesPerSecInner / wom->nSamplesPerSecOuter;
451  if (dwInnerSamplesPerOuter > 0)
452  {
453  DWORD dwInnerBytesPerSample = wom->avgSpeedInner / wom->nSamplesPerSecInner;
454  DWORD dwInnerBytesPerOuterSample = dwInnerBytesPerSample * dwInnerSamplesPerOuter;
455  DWORD remainder = 0;
456 
457  /* If we are up sampling (going from lower sample rate to higher),
458  ** we need to make a special accommodation for times when we've
459  ** written a partial output sample. This happens frequently
460  ** to us because we use msacm to do our up sampling, and it
461  ** will up sample on an unaligned basis.
462  ** For example, if you convert a 2 byte wide 8,000 'outer'
463  ** buffer to a 2 byte wide 48,000 inner device, you would
464  ** expect 2 bytes of input to produce 12 bytes of output.
465  ** Instead, msacm will produce 8 bytes of output.
466  ** But reporting our position as 1 byte of output is
467  ** nonsensical; the output buffer position needs to be
468  ** aligned on outer sample size, and aggressively rounded up.
469  */
470  remainder = timepos.u.cb % dwInnerBytesPerOuterSample;
471  if (remainder > 0)
472  {
473  timepos.u.cb -= remainder;
474  timepos.u.cb += dwInnerBytesPerOuterSample;
475  }
476  }
477 
478  lpTime->u.cb = MulDiv(timepos.u.cb, wom->avgSpeedOuter, wom->avgSpeedInner);
479 
480  /* Once we have the TIME_BYTES right, we can easily convert to TIME_MS */
481  if (lpTime->wType == TIME_MS)
482  lpTime->u.ms = MulDiv(lpTime->u.cb, 1000, wom->avgSpeedOuter);
483  else
484  lpTime->wType = TIME_BYTES;
485  }
486  else if (lpTime->wType == TIME_SAMPLES && timepos.wType == TIME_SAMPLES)
487  lpTime->u.sample = MulDiv(timepos.u.sample, wom->nSamplesPerSecOuter, wom->nSamplesPerSecInner);
488  else
489  /* other time types don't require conversion */
490  lpTime->u = timepos.u;
491 
492  return val;
493 }
UINT WINAPI waveOutGetPosition(HWAVEOUT hWaveOut, LPMMTIME lpTime, UINT uSize)
Definition: winmm.c:2416
DWORD cb
Definition: mmsystem.h:969
UINT wType
Definition: mmsystem.h:965
#define TIME_SAMPLES
Definition: mmsystem.h:29
GLuint GLfloat * val
Definition: glext.h:7180
double __cdecl remainder(double, double)
DWORD sample
Definition: mmsystem.h:968
#define TRACE(s)
Definition: solgame.cpp:4
union tagWAVEMAPDATA::@465 u
union mmtime_tag::@2937 u
#define TIME_MS
Definition: mmsystem.h:28
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD avgSpeedInner
Definition: wavemap.c:64
DWORD nSamplesPerSecInner
Definition: wavemap.c:67
#define TIME_BYTES
Definition: mmsystem.h:30
DWORD avgSpeedOuter
Definition: wavemap.c:63
struct tagWAVEMAPDATA::@465::@466 out
DWORD ms
Definition: mmsystem.h:967
#define MulDiv(x, y, z)
Definition: gdifloat.h:86
DWORD nSamplesPerSecOuter
Definition: wavemap.c:66

Referenced by WAVEMAP_wodMessage().

◆ wodGetVolume()

static DWORD wodGetVolume ( UINT  wDevID,
WAVEMAPDATA wom,
LPDWORD  lpVol 
)
static

Definition at line 533 of file wavemap.c.

534 {
535  TRACE("(%04x %p %p)\n",wDevID, wom, lpVol);
536 
537  if (WAVEMAP_IsData(wom))
538  return waveOutGetVolume(wom->u.out.hInnerWave, lpVol);
539  return MMSYSERR_NOERROR;
540 }
static BOOL WAVEMAP_IsData(const WAVEMAPDATA *wm)
Definition: wavemap.c:70
UINT WINAPI waveOutGetVolume(HWAVEOUT hWaveOut, LPDWORD lpdw)
Definition: winmm.c:2488
#define TRACE(s)
Definition: solgame.cpp:4
union tagWAVEMAPDATA::@465 u
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
struct tagWAVEMAPDATA::@465::@466 out

Referenced by WAVEMAP_wodMessage().

◆ wodMapperReconfigure()

static DWORD wodMapperReconfigure ( WAVEMAPDATA wom,
DWORD  dwParam1,
DWORD  dwParam2 
)
static

Definition at line 608 of file wavemap.c.

609 {
610  FIXME("(%p %08x %08x) stub!\n", wom, dwParam1, dwParam2);
611 
612  return MMSYSERR_NOERROR;
613 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96

Referenced by WAVEMAP_wodMessage().

◆ wodMapperStatus()

static DWORD wodMapperStatus ( WAVEMAPDATA wom,
DWORD  flags,
LPVOID  ptr 
)
static

Definition at line 579 of file wavemap.c.

580 {
581  UINT id;
583 
584  TRACE("(%p %08x %p)\n",wom, flags, ptr);
585 
586  switch (flags) {
588  ret = waveOutGetID(wom->u.out.hInnerWave, &id);
589  *(LPDWORD)ptr = id;
590  break;
592  FIXME("Unsupported flag=%d\n", flags);
593  *(LPDWORD)ptr = 0; /* FIXME ?? */
594  break;
596  FIXME("Unsupported flag=%d\n", flags);
597  /* ptr points to a WAVEFORMATEX struct - before or after streaming ? */
598  *(LPDWORD)ptr = 0;
599  break;
600  default:
601  FIXME("Unsupported flag=%d\n", flags);
602  *(LPDWORD)ptr = 0;
603  break;
604  }
605  return ret;
606 }
#define WAVEOUT_MAPPER_STATUS_FORMAT
Definition: mmddk.h:131
#define FIXME(fmt,...)
Definition: debug.h:110
static PVOID ptr
Definition: dispmode.c:27
#define TRACE(s)
Definition: solgame.cpp:4
union tagWAVEMAPDATA::@465 u
unsigned long DWORD
Definition: ntddk_ex.h:95
#define MMSYSERR_NOTSUPPORTED
Definition: mmsystem.h:104
GLbitfield flags
Definition: glext.h:7161
int ret
#define LPDWORD
Definition: nt_native.h:46
#define WAVEOUT_MAPPER_STATUS_DEVICE
Definition: mmddk.h:129
UINT WINAPI waveOutGetID(HWAVEOUT hWaveOut, UINT *lpuDeviceID)
Definition: winmm.c:2523
unsigned int UINT
Definition: ndis.h:50
GLenum GLuint id
Definition: glext.h:5579
#define WAVEOUT_MAPPER_STATUS_MAPPED
Definition: mmddk.h:130
struct tagWAVEMAPDATA::@465::@466 out

Referenced by WAVEMAP_wodMessage().

◆ wodOpen()

static DWORD wodOpen ( DWORD_PTR lpdwUser,
LPWAVEOPENDESC  lpDesc,
DWORD  dwFlags 
)
static

Definition at line 152 of file wavemap.c.

153 {
154  UINT ndlo, ndhi;
155  UINT i;
156  WAVEMAPDATA* wom = HeapAlloc(GetProcessHeap(), 0, sizeof(WAVEMAPDATA));
157  DWORD res;
158 
159  TRACE("(%p %p %08x)\n", lpdwUser, lpDesc, dwFlags);
160 
161  if (!wom) {
162  WARN("no memory\n");
163  return MMSYSERR_NOMEM;
164  }
165 
166  ndhi = waveOutGetNumDevs();
167  if (dwFlags & WAVE_MAPPED) {
168  if (lpDesc->uMappedDeviceID >= ndhi) {
169  WARN("invalid parameter: dwFlags WAVE_MAPPED\n");
170  HeapFree(GetProcessHeap(), 0, wom);
171  return MMSYSERR_INVALPARAM;
172  }
173  ndlo = lpDesc->uMappedDeviceID;
174  ndhi = ndlo + 1;
175  dwFlags &= ~WAVE_MAPPED;
176  } else {
177  ndlo = 0;
178  }
179  wom->self = wom;
180  wom->dwCallback = lpDesc->dwCallback;
181  wom->dwFlags = dwFlags;
182  wom->dwClientInstance = lpDesc->dwInstance;
183  wom->u.out.hOuterWave = (HWAVEOUT)lpDesc->hWave;
184  wom->avgSpeedOuter = wom->avgSpeedInner = lpDesc->lpFormat->nAvgBytesPerSec;
186 
187  for (i = ndlo; i < ndhi; i++) {
188  /* if no ACM stuff is involved, no need to handle callbacks at this
189  * level, this will be done transparently
190  */
191  if (waveOutOpen(&wom->u.out.hInnerWave, i, lpDesc->lpFormat,
194  wom->hAcmStream = 0;
195  goto found;
196  }
197  }
198 
199  if ((dwFlags & WAVE_FORMAT_DIRECT) == 0) {
200  WAVEFORMATEX wfx;
201 
203  wfx.cbSize = 0; /* normally, this field is not used for PCM format, just in case */
204  /* try some ACM stuff */
205 
206 #define TRY(sps,bps) wfx.nSamplesPerSec = (sps); wfx.wBitsPerSample = (bps); \
207  switch (res=wodOpenHelper(wom, i, lpDesc, &wfx, dwFlags | WAVE_FORMAT_DIRECT)) { \
208  case MMSYSERR_NOERROR: wom->avgSpeedInner = wfx.nAvgBytesPerSec; wom->nSamplesPerSecInner = wfx.nSamplesPerSec; goto found; \
209  case WAVERR_BADFORMAT: break; \
210  default: goto error; \
211  }
212 
213  if (lpDesc->lpFormat->wFormatTag != WAVE_FORMAT_PCM) {
214  /* Format changed so keep sample rate and number of channels
215  * the same and just change the bit depth
216  */
217  for (i = ndlo; i < ndhi; i++) {
219  wfx.nChannels = lpDesc->lpFormat->nChannels;
220  TRY(wfx.nSamplesPerSec, 16);
221  TRY(wfx.nSamplesPerSec, 8);
222  }
223  } else {
224  /* Our resampling algorithm is quite primitive so first try
225  * to just change the bit depth and number of channels
226  */
227  for (i = ndlo; i < ndhi; i++) {
229  wfx.nChannels = lpDesc->lpFormat->nChannels;
230  TRY(wfx.nSamplesPerSec, 16);
231  TRY(wfx.nSamplesPerSec, 8);
232  wfx.nChannels ^= 3;
233  TRY(wfx.nSamplesPerSec, 16);
234  TRY(wfx.nSamplesPerSec, 8);
235  }
236 
237  for (i = ndlo; i < ndhi; i++) {
238  /* first try with same stereo/mono option as source */
239  wfx.nChannels = lpDesc->lpFormat->nChannels;
240  TRY(96000, 16);
241  TRY(48000, 16);
242  TRY(44100, 16);
243  TRY(22050, 16);
244  TRY(11025, 16);
245 
246  /* 2^3 => 1, 1^3 => 2, so if stereo, try mono (and the other way around) */
247  wfx.nChannels ^= 3;
248  TRY(96000, 16);
249  TRY(48000, 16);
250  TRY(44100, 16);
251  TRY(22050, 16);
252  TRY(11025, 16);
253 
254  /* first try with same stereo/mono option as source */
255  wfx.nChannels = lpDesc->lpFormat->nChannels;
256  TRY(96000, 8);
257  TRY(48000, 8);
258  TRY(44100, 8);
259  TRY(22050, 8);
260  TRY(11025, 8);
261 
262  /* 2^3 => 1, 1^3 => 2, so if stereo, try mono (and the other way around) */
263  wfx.nChannels ^= 3;
264  TRY(96000, 8);
265  TRY(48000, 8);
266  TRY(44100, 8);
267  TRY(22050, 8);
268  TRY(11025, 8);
269  }
270  }
271 #undef TRY
272  }
273 
274  HeapFree(GetProcessHeap(), 0, wom);
275  WARN("ret = WAVERR_BADFORMAT\n");
276  return WAVERR_BADFORMAT;
277 
278 found:
279  if (dwFlags & WAVE_FORMAT_QUERY) {
280  *lpdwUser = 0L;
281  HeapFree(GetProcessHeap(), 0, wom);
282  } else {
283  *lpdwUser = (DWORD_PTR)wom;
284  }
285  return MMSYSERR_NOERROR;
286 error:
287  HeapFree(GetProcessHeap(), 0, wom);
288  if (res==ACMERR_NOTPOSSIBLE) {
289  WARN("ret = WAVERR_BADFORMAT\n");
290  return WAVERR_BADFORMAT;
291  }
292  WARN("ret = 0x%08x\n", res);
293  return res;
294 }
#define WAVERR_BADFORMAT
Definition: mmsystem.h:176
#define WAVE_FORMAT_QUERY
Definition: mmsystem.h:188
#define DWORD_PTR
Definition: treelist.c:76
#define error(str)
Definition: mkdosfs.c:1605
DWORD nAvgBytesPerSec
Definition: mmreg.h:81
DWORD dwCallback
Definition: mmddk.h:400
WORD nChannels
Definition: mmreg.h:79
#define WARN(fmt,...)
Definition: debug.h:111
#define TRY(sps, bps)
#define CALLBACK_TYPEMASK
Definition: mmsystem.h:146
UINT uMappedDeviceID
Definition: mmddk.h:402
#define WAVE_FORMAT_DIRECT
Definition: mmsystem.h:191
#define MMSYSERR_NOMEM
Definition: mmsystem.h:103
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define WAVE_FORMAT_PCM
Definition: constants.h:425
#define CALLBACK_FUNCTION
Definition: mmsystem.h:150
DWORD dwFlags
Definition: wavemap.c:61
UINT WINAPI waveOutGetNumDevs(void)
Definition: winmm.c:2140
DWORD nSamplesPerSec
Definition: audioclient.idl:42
HWAVE hWave
Definition: mmddk.h:398
static void CALLBACK wodCallback(HWAVEOUT hWave, UINT uMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
Definition: wavemap.c:79
#define TRACE(s)
Definition: solgame.cpp:4
union tagWAVEMAPDATA::@465 u
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
struct tagWAVEMAPDATA * self
Definition: wavemap.c:46
LPWAVEFORMATEX lpFormat
Definition: mmddk.h:399
#define for
Definition: utility.h:88
unsigned long DWORD
Definition: ntddk_ex.h:95
WORD wFormatTag
Definition: mmreg.h:78
static const WCHAR L[]
Definition: oid.c:1250
DWORD dwInstance
Definition: mmddk.h:401
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
DWORD avgSpeedInner
Definition: wavemap.c:64
uint32_t DWORD_PTR
Definition: typedefs.h:64
#define ACMERR_NOTPOSSIBLE
Definition: msacm.h:36
DWORD_PTR dwCallback
Definition: wavemap.c:59
DWORD nSamplesPerSecInner
Definition: wavemap.c:67
MMRESULT WINAPI waveOutOpen(LPHWAVEOUT lphWaveOut, UINT uDeviceID, LPCWAVEFORMATEX lpFormat, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD dwFlags)
Definition: winmm.c:2249
#define MMSYSERR_INVALPARAM
Definition: mmsystem.h:107
#define WAVE_MAPPED
Definition: mmsystem.h:190
DWORD_PTR dwClientInstance
Definition: wavemap.c:60
unsigned int UINT
Definition: ndis.h:50
DWORD nSamplesPerSec
Definition: mmreg.h:80
GLuint res
Definition: glext.h:9613
DWORD avgSpeedOuter
Definition: wavemap.c:63
struct tagWAVEMAPDATA::@465::@466 out
#define HeapFree(x, y, z)
Definition: compat.h:402
DWORD nSamplesPerSecOuter
Definition: wavemap.c:66

Referenced by WAVEMAP_wodMessage().

◆ wodOpenHelper()

static DWORD wodOpenHelper ( WAVEMAPDATA wom,
UINT  idx,
LPWAVEOPENDESC  lpDesc,
LPWAVEFORMATEX  lpwfx,
DWORD  dwFlags 
)
static

Definition at line 123 of file wavemap.c.

126 {
127  DWORD ret;
128 
129  TRACE("(%p %04x %p %p %08x)\n", wom, idx, lpDesc, lpwfx, dwFlags);
130 
131  /* destination is always PCM, so the formulas below apply */
132  lpwfx->nBlockAlign = (lpwfx->nChannels * lpwfx->wBitsPerSample) / 8;
133  lpwfx->nAvgBytesPerSec = lpwfx->nSamplesPerSec * lpwfx->nBlockAlign;
134  if (dwFlags & WAVE_FORMAT_QUERY) {
135  ret = acmStreamOpen(NULL, 0, lpDesc->lpFormat, lpwfx, NULL, 0L, 0L, ACM_STREAMOPENF_QUERY);
136  } else {
137  ret = acmStreamOpen(&wom->hAcmStream, 0, lpDesc->lpFormat, lpwfx, NULL, 0L, 0L, 0L);
138  }
139  if (ret == MMSYSERR_NOERROR) {
140  ret = waveOutOpen(&wom->u.out.hInnerWave, idx, lpwfx,
144  acmStreamClose(wom->hAcmStream, 0);
145  wom->hAcmStream = 0;
146  }
147  }
148  TRACE("ret = %08x\n", ret);
149  return ret;
150 }
#define WAVE_FORMAT_QUERY
Definition: mmsystem.h:188
DWORD nAvgBytesPerSec
Definition: mmreg.h:81
WORD nChannels
Definition: mmreg.h:79
HACMSTREAM hAcmStream
Definition: wavemap.c:57
#define CALLBACK_TYPEMASK
Definition: mmsystem.h:146
#define CALLBACK_FUNCTION
Definition: mmsystem.h:150
unsigned int idx
Definition: utils.c:41
smooth NULL
Definition: ftsmooth.c:416
static void CALLBACK wodCallback(HWAVEOUT hWave, UINT uMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
Definition: wavemap.c:79
#define TRACE(s)
Definition: solgame.cpp:4
union tagWAVEMAPDATA::@465 u
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
LPWAVEFORMATEX lpFormat
Definition: mmddk.h:399
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
static const WCHAR L[]
Definition: oid.c:1250
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
uint32_t DWORD_PTR
Definition: typedefs.h:64
MMRESULT WINAPI waveOutOpen(LPHWAVEOUT lphWaveOut, UINT uDeviceID, LPCWAVEFORMATEX lpFormat, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD dwFlags)
Definition: winmm.c:2249
MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pwfxSrc, PWAVEFORMATEX pwfxDst, PWAVEFILTER pwfltr, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen)
Definition: stream.c:149
DWORD nSamplesPerSec
Definition: mmreg.h:80
WORD nBlockAlign
Definition: mmreg.h:82
WORD wBitsPerSample
Definition: mmreg.h:83
struct tagWAVEMAPDATA::@465::@466 out
#define ACM_STREAMOPENF_QUERY
Definition: msacm.h:213
MMRESULT WINAPI acmStreamClose(HACMSTREAM has, DWORD fdwClose)
Definition: stream.c:65

◆ wodPause()

static DWORD wodPause ( WAVEMAPDATA wom)
static

Definition at line 551 of file wavemap.c.

552 {
553  TRACE("(%p)\n",wom);
554 
555  return waveOutPause(wom->u.out.hInnerWave);
556 }
#define TRACE(s)
Definition: solgame.cpp:4
union tagWAVEMAPDATA::@465 u
UINT WINAPI waveOutPause(HWAVEOUT hWaveOut)
Definition: winmm.c:2374
struct tagWAVEMAPDATA::@465::@466 out

Referenced by WAVEMAP_wodMessage().

◆ wodPrepare()

static DWORD wodPrepare ( WAVEMAPDATA wom,
LPWAVEHDR  lpWaveHdrSrc,
DWORD  dwParam2 
)
static

Definition at line 349 of file wavemap.c.

350 {
351  PACMSTREAMHEADER ash;
352  DWORD size;
353  DWORD dwRet;
354  LPWAVEHDR lpWaveHdrDst;
355 
356  TRACE("(%p %p %08x)\n", wom, lpWaveHdrSrc, dwParam2);
357 
358  if (!wom->hAcmStream)
359  return waveOutPrepareHeader(wom->u.out.hInnerWave, lpWaveHdrSrc, dwParam2);
360 
362  WARN("acmStreamSize failed\n");
363  return MMSYSERR_ERROR;
364  }
365 
366  ash = HeapAlloc(GetProcessHeap(), 0, sizeof(ACMSTREAMHEADER) + sizeof(WAVEHDR) + size);
367  if (ash == NULL) {
368  WARN("no memory\n");
369  return MMSYSERR_NOMEM;
370  }
371 
372  ash->cbStruct = sizeof(*ash);
373  ash->fdwStatus = 0L;
374  ash->dwUser = (DWORD_PTR)lpWaveHdrSrc;
375  ash->pbSrc = (LPBYTE)lpWaveHdrSrc->lpData;
376  ash->cbSrcLength = lpWaveHdrSrc->dwBufferLength;
377  /* ash->cbSrcLengthUsed */
378  ash->dwSrcUser = lpWaveHdrSrc->dwUser; /* FIXME ? */
379  ash->pbDst = (LPBYTE)ash + sizeof(ACMSTREAMHEADER) + sizeof(WAVEHDR);
380  ash->cbDstLength = size;
381  /* ash->cbDstLengthUsed */
382  ash->dwDstUser = 0; /* FIXME ? */
383  dwRet = acmStreamPrepareHeader(wom->hAcmStream, ash, 0L);
384  if (dwRet != MMSYSERR_NOERROR) {
385  WARN("acmStreamPrepareHeader failed\n");
386  goto errCleanUp;
387  }
388 
389  lpWaveHdrDst = (LPWAVEHDR)((LPSTR)ash + sizeof(ACMSTREAMHEADER));
390  lpWaveHdrDst->lpData = (LPSTR)ash->pbDst;
391  lpWaveHdrDst->dwBufferLength = size; /* conversion is not done yet */
392  lpWaveHdrDst->dwFlags = 0;
393  lpWaveHdrDst->dwLoops = 0;
394  dwRet = waveOutPrepareHeader(wom->u.out.hInnerWave, lpWaveHdrDst, sizeof(*lpWaveHdrDst));
395  if (dwRet != MMSYSERR_NOERROR) {
396  WARN("waveOutPrepareHeader failed\n");
397  goto errCleanUp;
398  }
399 
400  lpWaveHdrSrc->reserved = (DWORD_PTR)ash;
401  lpWaveHdrSrc->dwFlags = WHDR_PREPARED;
402  TRACE("=> (0)\n");
403  return MMSYSERR_NOERROR;
404 errCleanUp:
405  TRACE("=> (%d)\n", dwRet);
406  HeapFree(GetProcessHeap(), 0, ash);
407  return dwRet;
408 }
DWORD cbDstLength
Definition: msacm.h:558
#define DWORD_PTR
Definition: treelist.c:76
LPBYTE pbSrc
Definition: msacm.h:553
struct wavehdr_tag * LPWAVEHDR
#define WARN(fmt,...)
Definition: debug.h:111
HACMSTREAM hAcmStream
Definition: wavemap.c:57
DWORD_PTR dwDstUser
Definition: msacm.h:560
LPSTR lpData
Definition: mmsystem.h:1014
char * LPSTR
Definition: xmlstorage.h:182
UINT WINAPI waveOutPrepareHeader(HWAVEOUT hWaveOut, WAVEHDR *lpWaveOutHdr, UINT uSize)
Definition: winmm.c:2280
DWORD dwLoops
Definition: mmsystem.h:1019
DWORD cbSrcLength
Definition: msacm.h:554
#define MMSYSERR_NOMEM
Definition: mmsystem.h:103
unsigned char * LPBYTE
Definition: typedefs.h:53
DWORD dwFlags
Definition: mmsystem.h:1018
smooth NULL
Definition: ftsmooth.c:416
LPBYTE pbDst
Definition: msacm.h:557
DWORD cbStruct
Definition: msacm.h:550
#define TRACE(s)
Definition: solgame.cpp:4
union tagWAVEMAPDATA::@465 u
GLsizeiptr size
Definition: glext.h:5919
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define MMSYSERR_ERROR
Definition: mmsystem.h:97
#define ACM_STREAMSIZEF_SOURCE
Definition: msacm.h:217
unsigned long DWORD
Definition: ntddk_ex.h:95
struct _ACMSTREAMHEADER ACMSTREAMHEADER
static const WCHAR L[]
Definition: oid.c:1250
DWORD dwBufferLength
Definition: mmsystem.h:1015
DWORD_PTR dwSrcUser
Definition: msacm.h:556
DWORD_PTR dwUser
Definition: msacm.h:552
DWORD fdwStatus
Definition: msacm.h:551
#define WHDR_PREPARED
Definition: mmsystem.h:194
DWORD_PTR dwUser
Definition: mmsystem.h:1017
MMRESULT WINAPI acmStreamPrepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash, DWORD fdwPrepare)
Definition: stream.c:299
MMRESULT WINAPI acmStreamSize(HACMSTREAM has, DWORD cbInput, LPDWORD pdwOutputBytes, DWORD fdwSize)
Definition: stream.c:394
DWORD_PTR reserved
Definition: mmsystem.h:1021
struct tagWAVEMAPDATA::@465::@466 out
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by WAVEMAP_wodMessage().

◆ wodReset()

static DWORD wodReset ( WAVEMAPDATA wom)
static

Definition at line 565 of file wavemap.c.

566 {
567  TRACE("(%p)\n",wom);
568 
569  return waveOutReset(wom->u.out.hInnerWave);
570 }
#define TRACE(s)
Definition: solgame.cpp:4
union tagWAVEMAPDATA::@465 u
struct tagWAVEMAPDATA::@465::@466 out
UINT WINAPI waveOutReset(HWAVEOUT hWaveOut)
Definition: winmm.c:2388

Referenced by WAVEMAP_wodMessage().

◆ wodRestart()

static DWORD wodRestart ( WAVEMAPDATA wom)
static

Definition at line 558 of file wavemap.c.

559 {
560  TRACE("(%p)\n",wom);
561 
562  return waveOutRestart(wom->u.out.hInnerWave);
563 }
#define TRACE(s)
Definition: solgame.cpp:4
union tagWAVEMAPDATA::@465 u
UINT WINAPI waveOutRestart(HWAVEOUT hWaveOut)
Definition: winmm.c:2402
struct tagWAVEMAPDATA::@465::@466 out

Referenced by WAVEMAP_wodMessage().

◆ wodSetVolume()

static DWORD wodSetVolume ( UINT  wDevID,
WAVEMAPDATA wom,
DWORD  vol 
)
static

Definition at line 542 of file wavemap.c.

543 {
544  TRACE("(%04x %p %08x)\n",wDevID, wom, vol);
545 
546  if (WAVEMAP_IsData(wom))
547  return waveOutSetVolume(wom->u.out.hInnerWave, vol);
548  return MMSYSERR_NOERROR;
549 }
static BOOL WAVEMAP_IsData(const WAVEMAPDATA *wm)
Definition: wavemap.c:70
UINT WINAPI waveOutSetVolume(HWAVEOUT hWaveOut, DWORD dw)
Definition: winmm.c:2508
#define TRACE(s)
Definition: solgame.cpp:4
union tagWAVEMAPDATA::@465 u
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
struct tagWAVEMAPDATA::@465::@466 out

Referenced by WAVEMAP_wodMessage().

◆ wodUnprepare()

static DWORD wodUnprepare ( WAVEMAPDATA wom,
LPWAVEHDR  lpWaveHdrSrc,
DWORD  dwParam2 
)
static

Definition at line 410 of file wavemap.c.

411 {
412  PACMSTREAMHEADER ash;
413  LPWAVEHDR lpWaveHdrDst;
414  DWORD dwRet1, dwRet2;
415 
416  TRACE("(%p %p %08x)\n", wom, lpWaveHdrSrc, dwParam2);
417 
418  if (!wom->hAcmStream) {
419  return waveOutUnprepareHeader(wom->u.out.hInnerWave, lpWaveHdrSrc, dwParam2);
420  }
421  ash = (PACMSTREAMHEADER)lpWaveHdrSrc->reserved;
422  dwRet1 = acmStreamUnprepareHeader(wom->hAcmStream, ash, 0L);
423 
424  lpWaveHdrDst = (LPWAVEHDR)((LPSTR)ash + sizeof(ACMSTREAMHEADER));
425  dwRet2 = waveOutUnprepareHeader(wom->u.out.hInnerWave, lpWaveHdrDst, sizeof(*lpWaveHdrDst));
426 
427  HeapFree(GetProcessHeap(), 0, ash);
428 
429  lpWaveHdrSrc->dwFlags &= ~WHDR_PREPARED;
430  return (dwRet1 == MMSYSERR_NOERROR) ? dwRet2 : dwRet1;
431 }
struct wavehdr_tag * LPWAVEHDR
HACMSTREAM hAcmStream
Definition: wavemap.c:57
char * LPSTR
Definition: xmlstorage.h:182
DWORD dwFlags
Definition: mmsystem.h:1018
MMRESULT WINAPI acmStreamUnprepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash, DWORD fdwUnprepare)
Definition: stream.c:449
#define TRACE(s)
Definition: solgame.cpp:4
union tagWAVEMAPDATA::@465 u
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define GetProcessHeap()
Definition: compat.h:403
unsigned long DWORD
Definition: ntddk_ex.h:95
struct _ACMSTREAMHEADER ACMSTREAMHEADER
static const WCHAR L[]
Definition: oid.c:1250
UINT WINAPI waveOutUnprepareHeader(HWAVEOUT hWaveOut, LPWAVEHDR lpWaveOutHdr, UINT uSize)
Definition: winmm.c:2310
#define WHDR_PREPARED
Definition: mmsystem.h:194
DWORD_PTR reserved
Definition: mmsystem.h:1021
struct _ACMSTREAMHEADER * PACMSTREAMHEADER
struct tagWAVEMAPDATA::@465::@466 out
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by WAVEMAP_wodMessage().

◆ wodWrite()

static DWORD wodWrite ( WAVEMAPDATA wom,
LPWAVEHDR  lpWaveHdrSrc,
DWORD  dwParam2 
)
static

Definition at line 314 of file wavemap.c.

315 {
316  PACMSTREAMHEADER ash;
317  LPWAVEHDR lpWaveHdrDst;
318 
319  TRACE("(%p %p %08x)\n", wom, lpWaveHdrSrc, dwParam2);
320 
321  if (!wom->hAcmStream) {
322  return waveOutWrite(wom->u.out.hInnerWave, lpWaveHdrSrc, dwParam2);
323  }
324 
325  lpWaveHdrSrc->dwFlags |= WHDR_INQUEUE;
326  ash = (PACMSTREAMHEADER)lpWaveHdrSrc->reserved;
327  /* acmStreamConvert will actually check that the new size is less than initial size */
328  ash->cbSrcLength = lpWaveHdrSrc->dwBufferLength;
329  if (acmStreamConvert(wom->hAcmStream, ash, 0L) != MMSYSERR_NOERROR) {
330  WARN("acmStreamConvert failed\n");
331  return MMSYSERR_ERROR;
332  }
333 
334  lpWaveHdrDst = (LPWAVEHDR)((LPSTR)ash + sizeof(ACMSTREAMHEADER));
335  if (ash->cbSrcLength > ash->cbSrcLengthUsed)
336  FIXME("Not all src buffer has been written, expect bogus sound\n");
337  else if (ash->cbSrcLength < ash->cbSrcLengthUsed)
338  ERR("Codec has read more data than it is allowed to\n");
339 
340  if (ash->cbDstLengthUsed == 0) {
341  /* something went wrong in decoding */
342  FIXME("Got 0 length\n");
343  return MMSYSERR_ERROR;
344  }
345  lpWaveHdrDst->dwBufferLength = ash->cbDstLengthUsed;
346  return waveOutWrite(wom->u.out.hInnerWave, lpWaveHdrDst, sizeof(*lpWaveHdrDst));
347 }
struct wavehdr_tag * LPWAVEHDR
#define WARN(fmt,...)
Definition: debug.h:111
HACMSTREAM hAcmStream
Definition: wavemap.c:57
DWORD cbSrcLengthUsed
Definition: msacm.h:555
char * LPSTR
Definition: xmlstorage.h:182
DWORD cbDstLengthUsed
Definition: msacm.h:559
DWORD cbSrcLength
Definition: msacm.h:554
DWORD dwFlags
Definition: mmsystem.h:1018
#define FIXME(fmt,...)
Definition: debug.h:110
#define TRACE(s)
Definition: solgame.cpp:4
union tagWAVEMAPDATA::@465 u
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define MMSYSERR_ERROR
Definition: mmsystem.h:97
if(!(yy_init))
Definition: macro.lex.yy.c:714
struct _ACMSTREAMHEADER ACMSTREAMHEADER
UINT WINAPI waveOutWrite(HWAVEOUT hWaveOut, LPWAVEHDR lpWaveOutHdr, UINT uSize)
Definition: winmm.c:2344
static const WCHAR L[]
Definition: oid.c:1250
DWORD dwBufferLength
Definition: mmsystem.h:1015
#define ERR(fmt,...)
Definition: debug.h:109
#define WHDR_INQUEUE
Definition: mmsystem.h:197
DWORD_PTR reserved
Definition: mmsystem.h:1021
struct _ACMSTREAMHEADER * PACMSTREAMHEADER
struct tagWAVEMAPDATA::@465::@466 out
MMRESULT WINAPI acmStreamConvert(HACMSTREAM has, PACMSTREAMHEADER pash, DWORD fdwConvert)
Definition: stream.c:89

Referenced by WAVEMAP_wodMessage().

Variable Documentation

◆ oss

struct WINE_WAVEMAP* oss = NULL
static

Definition at line 1190 of file wavemap.c.

Referenced by to_string(), WAVEMAP_drvClose(), and WAVEMAP_drvOpen().