1/*
2 * Copyright 2003-2013, Haiku, Inc.
3 * Distributed under the terms of the MIT license.
4 *
5 * Authors:
6 *		J��r��me Duval
7 *		Fran��ois Revol
8 *		Puck Meerburg, puck@puckipedia.nl
9 */
10#ifndef MIXER_CONTROL_H
11#define MIXER_CONTROL_H
12
13
14#include <MediaRoster.h>
15
16class BContinuousParameter;
17class BParameter;
18class BParameterWeb;
19
20// The volume which choices
21#define VOLUME_USE_MIXER		0 // default
22#define VOLUME_USE_PHYS_OUTPUT	1
23
24
25class MixerControl {
26public:
27							MixerControl(int32 volumeWhich = VOLUME_USE_MIXER);
28							~MixerControl();
29
30			bool			Connect(int32 volumeWhich, float* _value = NULL,
31								const char** _error = NULL);
32			bool			Connected();
33
34			int32			VolumeWhich() const;
35			float			Volume() const;
36
37			void			SetVolume(float volume);
38			void			ChangeVolumeBy(float value);
39
40			void			SetMute(bool muted);
41			bool			Mute();
42
43			float			Minimum() const { return fMin; }
44			float			Maximum() const { return fMax; }
45
46			media_node		GainNode() { return fGainMediaNode; }
47			media_node		MuteNode() { return fMuteMediaNode; }
48
49private:
50			void			_Disconnect();
51
52			int32			fVolumeWhich;
53			media_node		fGainMediaNode;
54			media_node		fMuteMediaNode;
55			BParameterWeb*	fParameterWeb;
56			BContinuousParameter* fMixerParameter;
57			BParameter*		fMuteParameter;
58			float			fMin;
59			float			fMax;
60			float			fStep;
61			BMediaRoster*	fRoster;
62};
63
64#endif	// MIXER_CONTROL_H
65