1 /* 2 * Hydrogen 3 * Copyright(c) 2017 by Sebastian Moors 4 * 5 * http://www.hydrogen-music.org 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 2 of the License, or 10 * (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY, without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * 21 */ 22 23 #ifndef CORE_ACTION_CONTROLLER_H 24 #define CORE_ACTION_CONTROLLER_H 25 26 #include <hydrogen/object.h> 27 28 namespace H2Core 29 { 30 31 class CoreActionController : public H2Core::Object { 32 H2_OBJECT 33 34 public: 35 CoreActionController(); 36 ~CoreActionController(); 37 38 void setMasterVolume( float masterVolumeValue ); 39 void setStripVolume( int nStrip, float masterVolumeValue ); 40 void setStripPan( int nStrip, float panValue ); 41 void setMetronomeIsActive( bool isActive ); 42 void setMasterIsMuted( bool isMuted ); 43 void setStripIsMuted( int nStrip, bool isMuted ); 44 void setStripIsSoloed( int nStrip, bool isSoloed ); 45 46 void initExternalControlInterfaces(); 47 void handleOutgoingControlChange( int param, int value); 48 49 // ----------------------------------------------------------- 50 // Actions required for session management. 51 52 /** 53 * Create an empty #Song, which will be stored in @a songPath. 54 * 55 * This will be done immediately and without saving 56 * the current #Song. All unsaved changes will be lost! In 57 * addition, the new song won't be saved by this function. You 58 * can do so using saveSong(). 59 * 60 * The intended use of this function for session 61 * management. Therefore, the function will *not* store the 62 * provided @a songPath in Preferences::m_lastSongFilename and 63 * Hydrogen won't resume with the corresponding song on 64 * restarting. 65 * 66 * \param songPath Absolute path to the .h2song file to be 67 * opened. 68 * \return true on success 69 */ 70 bool newSong( const QString& songPath ); 71 /** 72 * Opens the #Song specified in @a songPath. 73 * 74 * This will be done immediately and without saving 75 * the current #Song. All unsaved changes will be lost! 76 * 77 * The intended use of this function for session 78 * management. Therefore, the function will *not* store the 79 * provided @a songPath in Preferences::m_lastSongFilename and 80 * Hydrogen won't resume with the corresponding song on 81 * restarting. 82 * 83 * \param songPath Absolute path to the .h2song file to be 84 * opened. 85 * \return true on success 86 */ 87 bool openSong( const QString& songPath ); 88 /** 89 * Saves the current #Song. 90 * 91 * \return true on success 92 */ 93 bool saveSong(); 94 /** 95 * Saves the current #Song to the path provided in @a songPath. 96 * 97 * The intended use of this function for session 98 * management. Therefore, the function will *not* store the 99 * provided @a songPath in Preferences::m_lastSongFilename and 100 * Hydrogen won't resume with the corresponding song on 101 * restarting. 102 * 103 * \param songPath Absolute path to the file to store the 104 * current #Song in. 105 * \return true on success 106 */ 107 bool saveSongAs( const QString& songPath ); 108 /** 109 * Triggers the shutdown of Hydrogen. 110 * 111 * This will be done immediately and without saving the 112 * current #Song. All unsaved changes will be lost! 113 * 114 * The shutdown will be triggered in both the CLI and the GUI 115 * via the #H2Core::EVENT_QUIT event. 116 * 117 * \return true on success 118 */ 119 bool quit(); 120 121 // ----------------------------------------------------------- 122 // Helper functions 123 124 /** 125 * Checks the path of the .h2song provided via OSC. 126 * 127 * It will be checked whether @a songPath 128 * - is absolute 129 * - has the '.h2song' suffix 130 * - is writable (if it exists) 131 * 132 * \param songPath Absolute path to an .h2song file. 133 * \return true - if valid. 134 */ 135 bool isSongPathValid( const QString& songPath ); 136 137 private: 138 139 const int m_nDefaultMidiFeedbackChannel; 140 }; 141 142 } 143 #endif 144