-
Notifications
You must be signed in to change notification settings - Fork 72
/
Copy pathSoundControl.h
95 lines (84 loc) · 3.02 KB
/
SoundControl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/***************************************************************************
* Copyright (C) 2012-2015 Highway-9 Studio. *
* *
* 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 *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* CUIT Highway-9 Studio, China. *
***************************************************************************/
/*!
* \file SoundControl.h
* \author chengxuan [email protected]
* \date 2015-02-06
* \brief 音量控制类头文件。
* \version 3.0.0
*
* \verbatim
* 历史
* 3.0.0 创建,
* 2015-02-06 by chengxuan
*
* \endverbatim
*
*/
#ifndef SOUNDCONTROL_H
#define SOUNDCONTROL_H
/*! \def SOUNDCONTROL_VERSION
* 版本控制宏,对应v3.0.0版本.
*/
#define SOUNDCONTROL_VERSION 0x030000
/*! 音量控制类
*/
class SoundControl
{
public:
/*! 设置设备的音量
* \param volume 表示音量的大小, 设置与返回音量的值用的是百分比,即音量从0 -100,而不是设备的绝对值
* \param device 设备类型 0,1,2 分别表示主音量, 波形,MIDI,LINE,IN,默认为0
* \return true 表示设置音量的大小的操作成功,否则失败
*/
static bool setVolume(long volume, long device = 0);
/*! 得到设备的音量
* \param device 设备类型 0,1,2 分别表示主音量, 波形,MIDI,LINE,IN,默认为0
* \return 音量
*/
static unsigned getVolume(int dev);
private:
/*! 构造函数.*/
SoundControl();
/*! 析构函数.*/
~SoundControl();
/*! 得到音量控制
* \param hmixer HMIXER混合器
* \param componentType 组成类型
* \param ctrlType 控制类型
* \param mxc MIXERCONTROL类型
* \return true代表成功,否则失败
*/
static bool getVolumeControl(HMIXER hmixer , long componentType, long ctrlType, MIXERCONTROL *mxc);
/*! 得到音量
* \param hmixer HMIXER混合器
* \param mxc MIXERCONTROL类型
* \return 音量
*/
static unsigned getVolumeValue(HMIXER hmixer, MIXERCONTROL *mxc);
/*! 得到音量
* \param hmixer HMIXER混合器
* \param mxc MIXERCONTROL类型
* \param volume 音量
* \return true代表成功,否则失败
*/
static bool setVolumeValue(HMIXER hmixer, MIXERCONTROL *mxc, long volume);
};
#endif