/*****************************************************************************
* waveout.c : Windows waveOut plugin for vlc
*****************************************************************************
- * Copyright (C) 2001 VideoLAN
+ * Copyright (C) 2001 the VideoLAN team
* $Id$
*
* Authors: Gildas Bazin <gbazin@videolan.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*****************************************************************************/
#ifdef UNDER_CE
# define DWORD_PTR DWORD
+# ifdef waveOutGetDevCaps
+# undef waveOutGetDevCaps
+ MMRESULT WINAPI waveOutGetDevCaps(UINT, LPWAVEOUTCAPS, UINT);
+# endif
#endif
#ifndef WAVE_FORMAT_IEEE_FLOAT
}
else
{
+ WAVEOUTCAPS wocaps;
+
if( val.i_int == AOUT_VAR_5_1 )
{
p_aout->output.output.i_physical_channels
aout_VolumeSoftInit( p_aout );
- p_aout->output.pf_volume_infos = VolumeInfos;
- p_aout->output.pf_volume_get = VolumeGet;
- p_aout->output.pf_volume_set = VolumeSet;
+ /* Check for hardware volume support */
+ if( waveOutGetDevCaps( (UINT_PTR)p_aout->output.p_sys->h_waveout,
+ &wocaps, sizeof(wocaps) ) == MMSYSERR_NOERROR &&
+ wocaps.dwSupport & WAVECAPS_VOLUME )
+ {
+ DWORD i_dummy;
+ if( waveOutGetVolume( p_aout->output.p_sys->h_waveout, &i_dummy )
+ == MMSYSERR_NOERROR )
+ {
+ p_aout->output.pf_volume_infos = VolumeInfos;
+ p_aout->output.pf_volume_get = VolumeGet;
+ p_aout->output.pf_volume_set = VolumeSet;
+ }
+ }
}
}
/*****************************************************************************
- * WaveOutThread: this thread will capture play notification events.
+ * WaveOutThread: this thread will capture play notification events.
*****************************************************************************
* We use this thread to feed new audio samples to the sound card because
* we are not authorized to use waveOutWrite() directly in the waveout
i_waveout_vol &= 0xFFFF;
*pi_volume = p_aout->output.i_volume =
- i_waveout_vol * AOUT_VOLUME_MAX / 2 / 0xFFFF;
+ (i_waveout_vol * AOUT_VOLUME_MAX + 0xFFFF /*rounding*/) / 2 / 0xFFFF;
return 0;
}