xref: /haiku/src/bin/desklink/MixerControl.h (revision 4466b89c65970de4c7236ac87faa2bee4589f413)
1 /*
2  * Copyright 2003-2009, Haiku, Inc.
3  * Distributed under the terms of the MIT license.
4  *
5  * Authors:
6  *		Jérôme Duval
7  *		François Revol
8  */
9 #ifndef MIXER_CONTROL_H
10 #define MIXER_CONTROL_H
11 
12 
13 #include <MediaRoster.h>
14 
15 class BParameterWeb;
16 class BContinuousParameter;
17 
18 
19 // The volume which choices
20 #define VOLUME_USE_MIXER		0 // default
21 #define VOLUME_USE_PHYS_OUTPUT	1
22 
23 
24 class MixerControl {
25 public:
26 							MixerControl(int32 volumeWhich = VOLUME_USE_MIXER);
27 							~MixerControl();
28 
29 			bool			Connect(int32 volumeWhich, float* _value = NULL,
30 								const char** _error = NULL);
31 			bool			Connected();
32 
33 			int32			VolumeWhich() const;
34 			float			Volume() const;
35 
36 			void			SetVolume(float volume);
37 			void			ChangeVolumeBy(float value);
38 
39 			float			Minimum() const { return fMin; }
40 			float			Maximum() const { return fMax; }
41 
42 			media_node		GainNode() { return fGainMediaNode; }
43 
44 private:
45 			void			_Disconnect();
46 
47 			int32			fVolumeWhich;
48 			media_node		fGainMediaNode;
49 			BParameterWeb*	fParameterWeb;
50 			BContinuousParameter* fMixerParameter;
51 			float			fMin;
52 			float			fMax;
53 			float			fStep;
54 };
55 
56 #endif	// MIXER_CONTROL_H
57