hydrogen 1.2.3
CoreActionController.h
Go to the documentation of this file.
1/*
2 * Hydrogen
3 * Copyright(c) 2002-2008 by Alex >Comix< Cominu [comix@users.sourceforge.net]
4 * Copyright(c) 2008-2024 The hydrogen development team [hydrogen-devel@lists.sourceforge.net]
5 *
6 * http://www.hydrogen-music.org
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY, without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see https://www.gnu.org/licenses
20 *
21 */
22
23#ifndef CORE_ACTION_CONTROLLER_H
24#define CORE_ACTION_CONTROLLER_H
25
26#include <vector>
27#include <memory>
28
29#include <core/Object.h>
30#include <core/Basics/Song.h>
31
32namespace H2Core
33{
34 class Drumkit;
35 class Instrument;
36
38class CoreActionController : public H2Core::Object<CoreActionController> {
40
41 public:
44
45 bool setMasterVolume( float masterVolumeValue );
52 bool setStripVolume( int nStrip, float fVolumeValue, bool bSelectStrip );
59 bool setStripPan( int nStrip, float fValue, bool bSelectStrip );
66 bool setStripPanSym( int nStrip, float fValue, bool bSelectStrip );
67 bool setMetronomeIsActive( bool isActive );
68 bool setMasterIsMuted( bool isMuted );
69
70 bool setStripIsMuted( int nStrip, bool isMuted );
71 bool toggleStripIsMuted( int nStrip );
72
73 bool setStripIsSoloed( int nStrip, bool isSoloed );
74 bool toggleStripIsSoloed( int nStrip );
75
77
78 // -----------------------------------------------------------
79 // Actions required for session management.
80
99 bool newSong( const QString& songPath );
116 bool openSong( const QString& songPath, const QString& sRecoverSongPath = "" );
131 bool openSong( std::shared_ptr<Song> pSong, bool bRelinking = true );
137 bool saveSong();
151 bool saveSongAs( const QString& sNewFilename );
157 bool savePreferences();
169 bool quit();
170
171 // -----------------------------------------------------------
172 // Further OSC commands
173
185 bool activateTimeline( bool bActivate );
194 bool addTempoMarker( int nPosition, float fBpm );
205 bool deleteTempoMarker( int nPosition );
214 bool addTag( int nPosition, const QString& sText );
225 bool deleteTag( int nPosition );
237 bool activateJackTransport( bool bActivate );
249 bool activateJackTimebaseMaster( bool bActivate );
250
259 bool activateSongMode( bool bActivate );
267 bool activateLoopMode( bool bActivate );
280 bool setDrumkit( const QString& sDrumkit, bool bConditional = true );
293 bool setDrumkit( std::shared_ptr<Drumkit> pDrumkit, bool bConditional = true );
301 bool upgradeDrumkit( const QString& sDrumkitPath, const QString& sNewPath = "" );
302
315 bool validateDrumkit( const QString& sDrumkitPath, bool bCheckLegacyVersions = false );
332 bool extractDrumkit( const QString& sDrumkitPath, const QString& sTargetDir = "" );
341 bool locateToColumn( int nPatternGroup );
350 bool locateToTick( long nTick, bool bWithJackBroadcast = true );
351
358 bool newPattern( const QString& sPatternName );
368 bool openPattern( const QString& sPath, int nPatternNumber = -1 );
376 bool setPattern( Pattern* pPattern, int nPatternNumber );
383 bool removePattern( int nPatternNumber );
391 bool toggleGridCell( int nColumn, int nRow );
392
398 void updatePreferences();
399private:
401 bool sendStripVolumeFeedback( int nStrip );
404 bool sendStripIsMutedFeedback( int nStrip );
405 bool sendStripIsSoloedFeedback( int nStrip );
406 bool sendStripPanFeedback( int nStrip );
407 bool sendStripPanSymFeedback( int nStrip );
408
409 bool handleOutgoingControlChanges( std::vector<int> params, int nValue);
410 std::shared_ptr<Instrument> getStrip( int nStrip ) const;
411
412 // -----------------------------------------------------------
413 // Actions required for session management.
414
429 bool setSong( std::shared_ptr<Song> pSong, bool bRelinking = true );
430
447 std::shared_ptr<Drumkit> retrieveDrumkit( const QString& sDrumkitPath, bool* bIsCompressed,
448 QString* sDrumkitDir, QString* sTemporaryFolder );
458 void insertRecentFile( const QString sFilename );
459
461};
462
463}
464#endif
#define H2_OBJECT(name)
Definition Object.h:224
bool locateToColumn(int nPatternGroup)
Relocates transport to the beginning of a particular column/Pattern group.
bool setPattern(Pattern *pPattern, int nPatternNumber)
Opens a pattern to the current pattern list.
bool addTag(int nPosition, const QString &sText)
Adds a tag to the Timeline.
bool setSong(std::shared_ptr< Song > pSong, bool bRelinking=true)
Sets a H2Core::Song to be used by Hydrogen.
void updatePreferences()
In case a different preferences file was loaded with Hydrogen already fully set up this function refr...
bool openSong(const QString &songPath, const QString &sRecoverSongPath="")
Opens the H2Core::Song specified in songPath.
bool locateToTick(long nTick, bool bWithJackBroadcast=true)
Relocates transport to a particular tick.
bool deleteTempoMarker(int nPosition)
Delete a tempo marker from the Timeline.
std::shared_ptr< Instrument > getStrip(int nStrip) const
bool newPattern(const QString &sPatternName)
Creates an empty pattern and adds it to the pattern list.
bool newSong(const QString &songPath)
Create an empty H2Core::Song, which will be stored in songPath.
bool savePreferences()
Saves the current state of the H2Core::Preferences.
std::shared_ptr< Drumkit > retrieveDrumkit(const QString &sDrumkitPath, bool *bIsCompressed, QString *sDrumkitDir, QString *sTemporaryFolder)
Loads the drumkit specified in sDrumkitPath.
bool setStripVolume(int nStrip, float fVolumeValue, bool bSelectStrip)
bool activateSongMode(bool bActivate)
Switches between Song and Pattern mode of playback.
bool validateDrumkit(const QString &sDrumkitPath, bool bCheckLegacyVersions=false)
Checks whether the provided drumkit in sDrumkitPath can be found, can be loaded, and does comply with...
bool setDrumkit(const QString &sDrumkit, bool bConditional=true)
Wrapper around setDrumkit() that allows loading drumkits by name or path.
bool setStripPanSym(int nStrip, float fValue, bool bSelectStrip)
bool toggleGridCell(int nColumn, int nRow)
Fills or clears a specific grid cell in the SongEditor.
bool removePattern(int nPatternNumber)
Removes a pattern from the pattern list.
bool activateLoopMode(bool bActivate)
Toggle loop mode of playback.
bool upgradeDrumkit(const QString &sDrumkitPath, const QString &sNewPath="")
Upgrades the drumkit found at absolute path sDrumkitPath.
void insertRecentFile(const QString sFilename)
Add sFilename to the list of recent songs in Preferences::m_recentFiles.
bool activateJackTransport(bool bActivate)
(De)activates the usage of Jack transport.
bool setStripIsMuted(int nStrip, bool isMuted)
bool setMasterVolume(float masterVolumeValue)
bool activateTimeline(bool bActivate)
(De)activates the usage of the Timeline.
bool activateJackTimebaseMaster(bool bActivate)
(De)activates the usage of Jack timebase master.
bool setStripIsSoloed(int nStrip, bool isSoloed)
bool saveSongAs(const QString &sNewFilename)
Saves the current H2Core::Song to the path provided in sNewFilename.
bool extractDrumkit(const QString &sDrumkitPath, const QString &sTargetDir="")
Extracts the compressed .h2drumkit file in sDrumkitPath into sTargetDir.
bool saveSong()
Saves the current H2Core::Song.
bool deleteTag(int nPosition)
Delete a tag from the Timeline.
bool sendStripPanSymFeedback(int nStrip)
bool setStripPan(int nStrip, float fValue, bool bSelectStrip)
bool quit()
Triggers the shutdown of Hydrogen.
bool addTempoMarker(int nPosition, float fBpm)
Adds a tempo marker to the Timeline.
bool openPattern(const QString &sPath, int nPatternNumber=-1)
Opens a pattern from disk and adds it to the pattern list.
bool handleOutgoingControlChanges(std::vector< int > params, int nValue)
Pattern class is a Note container.
Definition Pattern.h:46