当前位置:编程学习 > C/C++ >>

一个控制音量大小的类

 

 

  在编写多媒体应用软件时,经常要用到音量控制,此类就给你提供了一个很方便的

音量处理方法。

 

 该类提供了如下几个公用接口。(在文件IVolume.h中)。

 

 bool    IsAvailable() - Says whether the volume controling is possible

 void    Enable() - Enables the line of the volume control

 void    Disable() - Disables the line of the volume control

 DWORD   GetVolumeMetric() - Retrieves the granularity of volume

 DWORD   GetMinimalVolume() - Retrieves the minimal volume that can be set

 DWORD   GetMaximalVolume() - Retrieves the maximal volume that can be set

 DWORD   GetCurrentVolume() - Retrieve the current volume

 void    SetCurrentVolume( DWORD dwValue ) - Set the volume

 

并且,最后一个函数允许注册一个用户定义的回调函数,用来处理音量改变的通知消息。

  void    RegisterNotificationSink( PONMICVOULUMECHANGE, DWORD )

 

这个接口通过VolumeOutMaster (VolumeOutMaster.h/cpp), CVolumeOutWave (VolumeOutWave.h/cpp)

和 CVolumeInXXX (VolumeInXXX.h/cpp)类来执行。

 

使用这些类非常简单,在源代码的压缩文件里有很详细的使用说明,在此不在赘述。

 

 

 

补充:软件开发 , C语言 ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,