xref: /haiku/src/add-ons/media/media-add-ons/mixer/MixerSettings.h (revision fef6144999c2fa611f59ee6ffe6dd7999501385c)
1 #ifndef _MIXER_SETTINGS_H
2 #define _MIXER_SETTINGS_H
3 
4 #include <Message.h>
5 
6 class MixerInput;
7 class MixerOutput;
8 
9 #define MAX_INPUT_SETTINGS	50
10 
11 class MixerSettings
12 {
13 public:
14 	MixerSettings();
15 	~MixerSettings();
16 
17 	void	SetSettingsFile(const char *file);
18 
19 	bool	AttenuateOutput();
20 	void	SetAttenuateOutput(bool yesno);
21 
22 	bool	NonLinearGainSlider();
23 	void	SetNonLinearGainSlider(bool yesno);
24 
25 	bool	UseBalanceControl();
26 	void	SetUseBalanceControl(bool yesno);
27 
28 	bool	AllowOutputChannelRemapping();
29 	void	SetAllowOutputChannelRemapping(bool yesno);
30 
31 	bool	AllowInputChannelRemapping();
32 	void	SetAllowInputChannelRemapping(bool yesno);
33 
34 	int		InputGainControls();
35 	void	SetInputGainControls(int value);
36 
37 	int		ResamplingAlgorithm();
38 	void	SetResamplingAlgorithm(int value);
39 
40 	bool	RefuseOutputFormatChange();
41 	void	SetRefuseOutputFormatChange(bool yesno);
42 
43 	bool	RefuseInputFormatChange();
44 	void	SetRefuseInputFormatChange(bool yesno);
45 
46 	void	SaveConnectionSettings(MixerInput *input);
47 	void	LoadConnectionSettings(MixerInput *input);
48 
49 	void	SaveConnectionSettings(MixerOutput *output);
50 	void	LoadConnectionSettings(MixerOutput *output);
51 
52 protected:
53 
54 	void	StartDeferredSave();
55 	void	StopDeferredSave();
56 
57 	void	Save();
58 	void	Load();
59 
60 	static int32 _save_thread_(void *arg);
61 	void 	SaveThread();
62 
63 	BLocker		*fLocker;
64 	BPath		*fSettingsFile;
65 
66 	volatile bool		fSettingsDirty;
67 	volatile bigtime_t	fSettingsLastChange;
68 	volatile thread_id	fSaveThread;
69 	volatile sem_id		fSaveThreadWaitSem;
70 	volatile bool		fSaveThreadRunning;
71 
72 	struct settings
73 	{
74 		bool	AttenuateOutput;
75 		bool	NonLinearGainSlider;
76 		bool	UseBalanceControl;
77 		bool	AllowOutputChannelRemapping;
78 		bool	AllowInputChannelRemapping;
79 		int		InputGainControls;
80 		int		ResamplingAlgorithm;
81 		bool	RefuseOutputFormatChange;
82 		bool	RefuseInputFormatChange;
83 	};
84 
85 	volatile settings	fSettings;
86 
87 	BMessage fOutputSetting;
88 	BMessage fInputSetting[MAX_INPUT_SETTINGS];
89 };
90 
91 #endif //_MIXER_SETTINGS_H
92