waveOutSetVolume

MSDN上说:

MMRESULT waveOutSetVolume(
  HWAVEOUT hwo,  
  DWORD dwVolume 
);

Parameters

hwo

Handle to an open waveform-audio output device. This parameter can also be a device identifier.

dwVolume

New volume setting. The low-order word contains the left-channel volume setting, and the high-order word contains the right-channel setting. A value of 0xFFFF represents full volume, and a value of 0x0000 is silence.

If a device does not support both left and right volume control, the low-order word of dwVolume specifies the volume level, and the high-order word is ignored.

 

{
    waveOutSetVolume(hwo, dwVolume);
    waveOutClose(hwo);
    break;
}

 

而VLC里面有这么两句:

static int VolumeGet( aout_instance_t * p_aout, audio_volume_t * pi_volume )
{
    DWORD i_waveout_vol;

#ifdef UNDER_CE
    waveOutGetVolume( 0, &i_waveout_vol );
#else
    waveOutGetVolume( p_aout->output.p_sys->h_waveout, &i_waveout_vol );
#endif

    i_waveout_vol &= 0xFFFF;
    *pi_volume = p_aout->output.i_volume =
        (i_waveout_vol * AOUT_VOLUME_MAX + 0xFFFF /*rounding*/) / 2 / 0xFFFF;
    return 0;
}
static int VolumeSet( aout_instance_t * p_aout, audio_volume_t i_volume )
{
    unsigned long i_waveout_vol = i_volume * 0xFFFF * 2 / AOUT_VOLUME_MAX;
    i_waveout_vol |= (i_waveout_vol << 16);

#ifdef UNDER_CE
    waveOutSetVolume( 0, i_waveout_vol );
#else
    waveOutSetVolume( p_aout->output.p_sys->h_waveout, i_waveout_vol );
#endif

    p_aout->output.i_volume = i_volume;
    return 0;
}

 

转载于:https://www.cnblogs.com/zzugyl/archive/2013/02/22/2922078.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值