15 bool bFailedGetProcAddress =
false;
31 if (bFailedGetProcAddress)
33 ERR(
"CMultimediaBackend::ctor: One or more entry points to WinMM functions not found\n");
64 ERR(
"CMultimediaBackend::Initialize: No waveform-audio output devices detected\n");
68 DWORD dwWaveOutDeviceID;
74 LogError(__func__,
"waveOutMessage failed", mmres);
76 if (dwWaveOutDeviceID == (
DWORD)-1)
78 TRACE(
"CMultimediaBackend::Initialize: No default output device was assigned, falling back to the first device\n");
79 dwWaveOutDeviceID = 0;
86 LogError(__func__,
"mixerGetID failed", mmres);
90 ERR(
" Not providing fallback to the first mixer device.\n");
101 LogError(__func__,
"mixerOpen failed", mmres);
112 LogError(__func__,
"mixerGetLineInfoW failed", mmres);
130 LogError(__func__,
"mixerGetLineControlsW failed retrieving Master Mute control", mmres);
141 LogError(__func__,
"mixerGetLineControlsW failed retrieving Master Volume control", mmres);
151 TRACE(
"CMultimediaBackend::Initialize: Master controls configured successfully:\n"
152 " Master Mute dwControlID: %lu; Master Volume dwControlID %lu\n"
153 " Master Volume channels: %lu; Master Volume value range: %lu-%lu\n",
163 WARN(
"CMultimediaBackend::Mute: WinMM functions unavailable; cannot (un)mute sound. Check the prior class constructor calls\n");
188 WARN(
"CMultimediaBackend: WinMM functions unavailable; cannot %s volume. Check the prior class constructor calls\n",
189 direction == APPCOMMAND_VOLUME_DOWN ?
"decrease" :
"increase");
211 LogError(__func__,
"mixerSetControlDetails failed unmuting Master Volume", mmres);
219 bool bEitherCeiling = [&]()
225 if (mxcdVolume[
i].dwValue > dwValue)
229 return direction == APPCOMMAND_VOLUME_DOWN
236 TRACE(
"CMultimediaBackend::AdjustVolume: Volume boundary hit, no action\n");
252 else if (
direction == APPCOMMAND_VOLUME_UP)
265 TRACE(
"CMultimediaBackend::AdjustVolume: Volume values were updated:\n");
267 TRACE(
" Channel %lu volume: %lu\n",
i, mxcdVolume[
i].dwValue);
271 LogError(__func__,
"mixerSetControlDetails failed updating Master Volume control details", mmres);
283 DWORD dwLoudestChIdx = 0;
288 if (pmxcdVolume[
i].dwValue < dwHighestVolume)
292 dwHighestVolume = pmxcdVolume[dwLoudestChIdx].dwValue;
301 TRACE(
"CMultimediaBackend::CalculateSteps: All channels were at minimum volume, steps will be unchanged\n");
304 else if (
i == dwLoudestChIdx || (pmxcdVolume[
i].dwValue == dwHighestVolume))
307 TRACE(
"CMultimediaBackend::CalculateSteps: Channel %lu is the loudest, volume step will be %lu\n",
i,
m_pdwChannelSteps[
i]);
311 if (dwHighestVolume > 0)
313 float dwStepRatio = (
float)pmxcdVolume[
i].dwValue / dwHighestVolume;
330 ERR(
"CMultimediaBackend::%s: %: %lu (%S)\n", pszFunctionName, pszMessage, mmres, pszWinMMErrText);
340 if (mxcdVolume ==
NULL)
342 ERR(
"CMultimediaBackend::GetCurrentVolume: HeapAlloc failed, requested %lu bytes\n",
m_dwMasterChannels *
sizeof(*mxcdVolume));
348 pmxcd->cbDetails =
sizeof(*mxcdVolume);
349 pmxcd->paDetails = mxcdVolume;
#define UlongToHandle(ul)
_In_ ULONG _In_ BOOLEAN LogError
#define HeapFree(x, y, z)
static void cleanup(void)
_ACRTIMP double __cdecl ceil(double)
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
#define DRVM_MAPPER_PREFERRED_GET
#define MIXERLINE_COMPONENTTYPE_DST_SPEAKERS
#define MIXER_OBJECTF_MIXER
struct tMIXERCONTROLDETAILS_UNSIGNED * PMIXERCONTROLDETAILS_UNSIGNED
#define MIXER_OBJECTF_WAVEOUT
#define MIXER_SETCONTROLDETAILSF_VALUE
#define MIXER_GETCONTROLDETAILSF_VALUE
#define MMSYSERR_NODRIVER
#define MIXERCONTROL_CONTROLTYPE_VOLUME
#define MIXER_GETLINEINFOF_COMPONENTTYPE
#define MIXER_GETLINECONTROLSF_ONEBYTYPE
#define MIXER_OBJECTF_HMIXER
#define MIXERCONTROL_CONTROLTYPE_MUTE
static float(__cdecl *square_half_float)(float x
union tagMIXERCONTROLW::@3447 Bounds