xref: /haiku/src/apps/midiplayer/MidiPlayerWindow.h (revision 579f1dbca962a2a03df54f69fdc6e9423f91f20e)
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 InitControls();
68 	void LoadSettings();
69 	void SaveSettings();
70 
71 	void LoadFile(entry_ref* ref);
72 	void StartSynth();
73 	void StopSynth();
74 
75 	static void _StopHook(int32 arg);
76 	void StopHook();
77 
78 	void OnPlayStop();
79 	void OnShowScope();
80 	void OnInputChanged(BMessage* msg);
81 	void OnReverb(reverb_mode mode);
82 	void OnVolume();
83 	void OnDrop(BMessage* msg);
84 
85 	ScopeView* scopeView;
86 	BCheckBox* showScope;
87 	BMenuField* inputMenu;
88 	BPopUpMenu* inputPopUp;
89 	BMenuItem* inputOff;
90 	BMenuField* reverbMenu;
91 	BMenuItem* reverbNone;
92 	BMenuItem* reverbCloset;
93 	BMenuItem* reverbGarage;
94 	BMenuItem* reverbIgor;
95 	BMenuItem* reverbCavern;
96 	BMenuItem* reverbDungeon;
97 	BSlider* volumeSlider;
98 	BButton* playButton;
99 
100 	bool playing;
101 	bool scopeEnabled;
102 	int32 inputId;
103 	reverb_mode reverb;
104 	int32 volume;
105 	float windowX;
106 	float windowY;
107 	BMidiSynthFile synth;
108 	SynthBridge* bridge;
109 	bool instrLoaded;
110 };
111 
112 #endif // MIDI_PLAYER_WINDOW_H
113