1 /* 2 * Copyright (c) 2004 Matthijs Hollemans 3 * Copyright (c) 2008-2014 Haiku, Inc. All rights reserved. 4 * 5 * Permission is hereby granted, free of charge, to any person obtaining a 6 * copy of this software and associated documentation files (the "Software"), 7 * to deal in the Software without restriction, including without limitation 8 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 * and/or sell copies of the Software, and to permit persons to whom the 10 * Software is furnished to do so, subject to the following conditions: 11 * 12 * The above copyright notice and this permission notice shall be included in 13 * all copies or substantial portions of the Software. 14 * 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21 * DEALINGS IN THE SOFTWARE. 22 */ 23 #ifndef _MIDI_PLAYER_WINDOW_H 24 #define _MIDI_PLAYER_WINDOW_H 25 26 27 #include <InterfaceKit.h> 28 #include <MidiSynthFile.h> 29 30 31 #define SETTINGS_FILE "/boot/home/config/settings/MidiPlayerSettings" 32 33 34 enum 35 { 36 MSG_PLAY_STOP = 1000, 37 MSG_SHOW_SCOPE, 38 MSG_INPUT_CHANGED, 39 MSG_REVERB_NONE, 40 MSG_REVERB_CLOSET, 41 MSG_REVERB_GARAGE, 42 MSG_REVERB_IGOR, 43 MSG_REVERB_CAVERN, 44 MSG_REVERB_DUNGEON, 45 MSG_VOLUME, 46 }; 47 48 49 class ScopeView; 50 class SynthBridge; 51 52 class MidiPlayerWindow : public BWindow { 53 public: 54 MidiPlayerWindow(); 55 virtual ~MidiPlayerWindow(); 56 57 virtual bool QuitRequested(); 58 virtual void MessageReceived(BMessage* message); 59 virtual void FrameMoved(BPoint origin); 60 virtual void MenusBeginning(); 61 62 private: 63 typedef BWindow super; 64 65 void CreateInputMenu(); 66 void CreateReverbMenu(); 67 void CreateViews(); 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* message); 82 void OnReverb(reverb_mode mode); 83 void OnVolume(); 84 void OnDrop(BMessage* message); 85 86 ScopeView* fScopeView; 87 BCheckBox* fShowScopeCheckBox; 88 BMenuField* fInputMenuField; 89 BPopUpMenu* fInputPopUpMenu; 90 BMenuItem* fInputOffMenuItem; 91 BMenuField* fReverbMenuField; 92 BMenuItem* fReverbNoneMenuItem; 93 BMenuItem* fReverbClosetMenuItem; 94 BMenuItem* fReverbGarageMenuItem; 95 BMenuItem* fReverbIgorMenuItem; 96 BMenuItem* fReverbCavern; 97 BMenuItem* fReverbDungeon; 98 BSlider* fVolumeSlider; 99 BButton* fPlayButton; 100 101 bool fIsPlaying; 102 bool fScopeEnabled; 103 int32 fInputId; 104 reverb_mode fReverbMode; 105 int32 fVolume; 106 float fWindowX; 107 float fWindowY; 108 BMidiSynthFile fMidiSynthFile; 109 SynthBridge* fSynthBridge; 110 bool fInstrumentLoaded; 111 }; 112 113 114 #endif // _MIDI_PLAYER_WINDOW_H 115