xref: /haiku/src/apps/midiplayer/MidiPlayerWindow.h (revision 3cb015b1ee509d69c643506e8ff573808c86dcfc)
1 /*
2  * Copyright (c) 2004 Matthijs Hollemans
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20  * DEALINGS IN THE SOFTWARE.
21  */
22 
23 #ifndef MIDI_PLAYER_WINDOW_H
24 #define MIDI_PLAYER_WINDOW_H
25 
26 #include <InterfaceKit.h>
27 #include <MidiSynthFile.h>
28 
29 #define SETTINGS_FILE "/boot/home/config/settings/MidiPlayerSettings"
30 
31 enum
32 {
33 	MSG_PLAY_STOP = 1000,
34 	MSG_SHOW_SCOPE,
35 	MSG_INPUT_CHANGED,
36 	MSG_REVERB_NONE,
37 	MSG_REVERB_CLOSET,
38 	MSG_REVERB_GARAGE,
39 	MSG_REVERB_IGOR,
40 	MSG_REVERB_CAVERN,
41 	MSG_REVERB_DUNGEON,
42 	MSG_VOLUME,
43 };
44 
45 class ScopeView;
46 class SynthBridge;
47 
48 class MidiPlayerWindow : public BWindow
49 {
50 public:
51 
52 	MidiPlayerWindow();
53 	virtual ~MidiPlayerWindow();
54 
55 	virtual bool QuitRequested();
56 	virtual void MessageReceived(BMessage* msg);
57 	virtual void FrameMoved(BPoint origin);
58 	virtual void MenusBeginning();
59 
60 private:
61 
62 	typedef BWindow super;
63 
64 	void CreateInputMenu();
65 	void CreateReverbMenu();
66 	void CreateViews();
67 	void CenterOnScreen();
68 	void InitControls();
69 	void LoadSettings();
70 	void SaveSettings();
71 
72 	void LoadFile(entry_ref* ref);
73 	void StartSynth();
74 	void StopSynth();
75 
76 	static void _StopHook(int32 arg);
77 	void StopHook();
78 
79 	void OnPlayStop();
80 	void OnShowScope();
81 	void OnInputChanged(BMessage* msg);
82 	void OnReverb(reverb_mode mode);
83 	void OnVolume();
84 	void OnDrop(BMessage* msg);
85 
86 	ScopeView* scopeView;
87 	BCheckBox* showScope;
88 	BMenuField* inputMenu;
89 	BPopUpMenu* inputPopUp;
90 	BMenuItem* inputOff;
91 	BMenuField* reverbMenu;
92 	BMenuItem* reverbNone;
93 	BMenuItem* reverbCloset;
94 	BMenuItem* reverbGarage;
95 	BMenuItem* reverbIgor;
96 	BMenuItem* reverbCavern;
97 	BMenuItem* reverbDungeon;
98 	BSlider* volumeSlider;
99 	BButton* playButton;
100 
101 	bool playing;
102 	bool scopeEnabled;
103 	int32 inputId;
104 	reverb_mode reverb;
105 	int32 volume;
106 	float windowX;
107 	float windowY;
108 	BMidiSynthFile synth;
109 	SynthBridge* bridge;
110 	bool instrLoaded;
111 };
112 
113 #endif // MIDI_PLAYER_WINDOW_H
114