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 16 class BContinuousParameter; 17 class BParameter; 18 class BParameterWeb; 19 20 // The volume which choices 21 #define VOLUME_USE_MIXER 0 // default 22 #define VOLUME_USE_PHYS_OUTPUT 1 23 24 25 class MixerControl { 26 public: 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 48 private: 49 void _Disconnect(); 50 51 int32 fVolumeWhich; 52 media_node fGainMediaNode; 53 BParameterWeb* fParameterWeb; 54 BContinuousParameter* fMixerParameter; 55 BParameter* fMuteParameter; 56 float fMin; 57 float fMax; 58 float fStep; 59 }; 60 61 #endif // MIXER_CONTROL_H 62