|
hydrogen 1.2.3
|
#include <CoreActionController.h>
Public Member Functions | |
| CoreActionController () | |
| ~CoreActionController () | |
| bool | activateJackTimebaseMaster (bool bActivate) |
| (De)activates the usage of Jack timebase master. | |
| bool | activateJackTransport (bool bActivate) |
| (De)activates the usage of Jack transport. | |
| bool | activateLoopMode (bool bActivate) |
| Toggle loop mode of playback. | |
| bool | activateSongMode (bool bActivate) |
| Switches between Song and Pattern mode of playback. | |
| bool | activateTimeline (bool bActivate) |
| (De)activates the usage of the Timeline. | |
| bool | addTag (int nPosition, const QString &sText) |
| Adds a tag to the Timeline. | |
| bool | addTempoMarker (int nPosition, float fBpm) |
| Adds a tempo marker to the Timeline. | |
| bool | deleteTag (int nPosition) |
| Delete a tag from the Timeline. | |
| bool | deleteTempoMarker (int nPosition) |
| Delete a tempo marker from the Timeline. | |
| bool | extractDrumkit (const QString &sDrumkitPath, const QString &sTargetDir="") |
| Extracts the compressed .h2drumkit file in sDrumkitPath into sTargetDir. | |
| bool | initExternalControlInterfaces () |
| bool | locateToColumn (int nPatternGroup) |
| Relocates transport to the beginning of a particular column/Pattern group. | |
| bool | locateToTick (long nTick, bool bWithJackBroadcast=true) |
| Relocates transport to a particular tick. | |
| 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 | openPattern (const QString &sPath, int nPatternNumber=-1) |
| Opens a pattern from disk and adds it to the pattern list. | |
| bool | openSong (const QString &songPath, const QString &sRecoverSongPath="") |
| Opens the H2Core::Song specified in songPath. | |
| bool | openSong (std::shared_ptr< Song > pSong, bool bRelinking=true) |
| Opens the H2Core::Song specified in songPath. | |
| bool | quit () |
| Triggers the shutdown of Hydrogen. | |
| bool | removePattern (int nPatternNumber) |
| Removes a pattern from the pattern list. | |
| bool | savePreferences () |
| Saves the current state of the H2Core::Preferences. | |
| bool | saveSong () |
| Saves the current H2Core::Song. | |
| bool | saveSongAs (const QString &sNewFilename) |
| Saves the current H2Core::Song to the path provided in sNewFilename. | |
| bool | setDrumkit (const QString &sDrumkit, bool bConditional=true) |
| Wrapper around setDrumkit() that allows loading drumkits by name or path. | |
| bool | setDrumkit (std::shared_ptr< Drumkit > pDrumkit, bool bConditional=true) |
| Sets Drumkit pDrumkit as the one used in the current #Song. | |
| bool | setMasterIsMuted (bool isMuted) |
| bool | setMasterVolume (float masterVolumeValue) |
| bool | setMetronomeIsActive (bool isActive) |
| bool | setPattern (Pattern *pPattern, int nPatternNumber) |
| Opens a pattern to the current pattern list. | |
| bool | setStripIsMuted (int nStrip, bool isMuted) |
| bool | setStripIsSoloed (int nStrip, bool isSoloed) |
| bool | setStripPan (int nStrip, float fValue, bool bSelectStrip) |
| bool | setStripPanSym (int nStrip, float fValue, bool bSelectStrip) |
| bool | setStripVolume (int nStrip, float fVolumeValue, bool bSelectStrip) |
| bool | toggleGridCell (int nColumn, int nRow) |
| Fills or clears a specific grid cell in the SongEditor. | |
| bool | toggleStripIsMuted (int nStrip) |
| bool | toggleStripIsSoloed (int nStrip) |
| void | updatePreferences () |
| In case a different preferences file was loaded with Hydrogen already fully set up this function refreshes all corresponding values and informs the GUI. | |
| bool | upgradeDrumkit (const QString &sDrumkitPath, const QString &sNewPath="") |
| Upgrades the drumkit found at absolute path sDrumkitPath. | |
| 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 the current XSD definition. | |
Public Member Functions inherited from Object< CoreActionController > | |
| Object () | |
| Object (const Object< CoreActionController > &other) | |
Public Member Functions inherited from Base | |
| Base () | |
| Base (const Base &other) | |
| virtual const char * | class_name () const |
| void | Print (bool bShort=true) const |
| Prints content of toQString() via DEBUGLOG. | |
| virtual QString | toQString (const QString &sPrefix="", bool bShort=true) const |
| Formatted string version for debugging purposes. | |
Private Member Functions | |
| std::shared_ptr< Instrument > | getStrip (int nStrip) const |
| bool | handleOutgoingControlChanges (std::vector< int > params, int nValue) |
| void | insertRecentFile (const QString sFilename) |
| Add sFilename to the list of recent songs in Preferences::m_recentFiles. | |
| std::shared_ptr< Drumkit > | retrieveDrumkit (const QString &sDrumkitPath, bool *bIsCompressed, QString *sDrumkitDir, QString *sTemporaryFolder) |
| Loads the drumkit specified in sDrumkitPath. | |
| bool | sendMasterIsMutedFeedback () |
| bool | sendMasterVolumeFeedback () |
| bool | sendMetronomeIsActiveFeedback () |
| bool | sendStripIsMutedFeedback (int nStrip) |
| bool | sendStripIsSoloedFeedback (int nStrip) |
| bool | sendStripPanFeedback (int nStrip) |
| bool | sendStripPanSymFeedback (int nStrip) |
| bool | sendStripVolumeFeedback (int nStrip) |
| bool | setSong (std::shared_ptr< Song > pSong, bool bRelinking=true) |
| Sets a H2Core::Song to be used by Hydrogen. | |
Private Attributes | |
| const int | m_nDefaultMidiFeedbackChannel |
Additional Inherited Members | |
Static Public Member Functions inherited from Base | |
| static const char * | _class_name () |
| return the class name | |
| static QString | base_clock (const QString &sMsg) |
| Measures the current time and stores it in __last_clock. | |
| static QString | base_clock_in (const QString &sMsg) |
| static int | bootstrap (Logger *logger, bool count=false) |
| must be called before any Object instantiation ! | |
| static bool | count_active () |
| static int | getAliveObjectCount () |
| static object_map_t | getObjectMap () |
| static Logger * | logger () |
| return the logger instance | |
| static int | objects_count () |
| static void | printObjectMapDiff (object_map_t map) |
| Creates the difference between a snapshot of the object map and its current state and prints it to std::cout. | |
| static void | set_count (bool flag) |
| enable/disable class instances counting | |
| static void | write_objects_map_to (std::ostream &out, object_map_t *map=nullptr) |
| output the full objects map to a given ostream | |
| static void | write_objects_map_to_cerr () |
| output objects map to stderr | |
Static Public Attributes inherited from Base | |
| static QString | sPrintIndention = " " |
| String used to format the debugging string output of some core classes. | |
Protected Member Functions inherited from Object< CoreActionController > | |
| ~Object () | |
Protected Member Functions inherited from Base | |
| ~Base () | |
Static Protected Member Functions inherited from Base | |
| static void | registerClass (const char *name, const atomic_obj_cpt_t *counters) |
Static Protected Attributes inherited from Base | |
| static bool | __count = false |
| should we count class instances | |
| static timeval | __last_clock = { 0, 0 } |
| static Logger * | __logger = nullptr |
Definition at line 38 of file CoreActionController.h.
Definition at line 51 of file CoreActionController.cpp.
| ~CoreActionController | ( | ) |
Definition at line 56 of file CoreActionController.cpp.
| bool activateJackTimebaseMaster | ( | bool | bActivate | ) |
(De)activates the usage of Jack timebase master.
Note that this function will fail if Jack is not used as audio driver.
| bActivate | If true - activate or if false - deactivate. |
Definition at line 857 of file CoreActionController.cpp.
| bool activateJackTransport | ( | bool | bActivate | ) |
(De)activates the usage of Jack transport.
Note that this function will fail if Jack is not used as audio driver.
| bActivate | If true - activate or if false - deactivate. |
Definition at line 832 of file CoreActionController.cpp.
| bool activateLoopMode | ( | bool | bActivate | ) |
Toggle loop mode of playback.
| bActivate | If true - activates loop mode. |
Definition at line 921 of file CoreActionController.cpp.
| bool activateSongMode | ( | bool | bActivate | ) |
| bool activateTimeline | ( | bool | bActivate | ) |
(De)activates the usage of the Timeline.
Note that this function will fail in the presence of the Jack audio driver and an external timebase master (see Hydrogen::getJackTimebaseState()).
| bActivate | If true - activate or if false - deactivate. |
Definition at line 728 of file CoreActionController.cpp.
| bool addTag | ( | int | nPosition, |
| const QString & | sText ) |
Adds a tag to the Timeline.
| nPosition | Location of the tag in bars. |
| sText | Message associated with the tag. |
Definition at line 796 of file CoreActionController.cpp.
| bool addTempoMarker | ( | int | nPosition, |
| float | fBpm ) |
Adds a tempo marker to the Timeline.
| nPosition | Location of the tempo marker in bars. |
| fBpm | Speed associated with the tempo marker. |
Definition at line 749 of file CoreActionController.cpp.
| bool deleteTag | ( | int | nPosition | ) |
Delete a tag from the Timeline.
If no tag is present at nPosition, the function will return true as well.
| nPosition | Location of the tag in bars. |
Definition at line 815 of file CoreActionController.cpp.
| bool deleteTempoMarker | ( | int | nPosition | ) |
Delete a tempo marker from the Timeline.
If no Tempo marker is present at nPosition, the function will return true as well.
| nPosition | Location of the tempo marker in bars. |
Definition at line 774 of file CoreActionController.cpp.
| bool extractDrumkit | ( | const QString & | sDrumkitPath, |
| const QString & | sTargetDir = "" ) |
Extracts the compressed .h2drumkit file in sDrumkitPath into sTargetDir.
The function does not automatically load the extracted kit into the current Hydrogen session in case a custom sTargetDir was supplied. To do so, the name of the folder contained in the tarball is required (might differ from the name of the tarball) and it is not easily obtained.
| sDrumkitPath | Tar-compressed drumkit with .h2drumkit extension |
| sTargetDir | Folder to extract the drumkit to. If the folder is not present yet, it will be created. If left empty, the drumkit will be installed to the users drumkit data folder. |
Definition at line 1330 of file CoreActionController.cpp.
|
private |
Definition at line 428 of file CoreActionController.cpp.
|
private |
Definition at line 407 of file CoreActionController.cpp.
| bool initExternalControlInterfaces | ( | ) |
Definition at line 443 of file CoreActionController.cpp.
|
private |
Add sFilename to the list of recent songs in Preferences::m_recentFiles.
The function will also take care of removing any duplicates in the list in case sFilename is already present.
| sFilename | New song to be added on top of the list. |
Definition at line 1683 of file CoreActionController.cpp.
| bool locateToColumn | ( | int | nPatternGroup | ) |
Relocates transport to the beginning of a particular column/Pattern group.
| nPatternGroup | Position of the Song provided as the index of a particular pattern group (starting at zero). |
Definition at line 1371 of file CoreActionController.cpp.
| bool locateToTick | ( | long | nTick, |
| bool | bWithJackBroadcast = true ) |
Relocates transport to a particular tick.
| nTick | Destination |
| bWithJackBroadcast | Relocate not using the AudioEngine directly but using the JACK server. |
Definition at line 1402 of file CoreActionController.cpp.
| bool newPattern | ( | const QString & | sPatternName | ) |
Creates an empty pattern and adds it to the pattern list.
| sPath | Name for the created pattern. |
Definition at line 1422 of file CoreActionController.cpp.
| bool newSong | ( | const QString & | songPath | ) |
Create an empty H2Core::Song, which will be stored in songPath.
This will be done immediately and without saving the current H2Core::Song. All unsaved changes will be lost! In addition, the new song won't be saved by this function. You can do so using saveSong().
The intended use of this function for session management. Therefore, the function will not store the provided songPath in Preferences::m_lastSongFilename and Hydrogen won't resume with the corresponding song on restarting.
| songPath | Absolute path to the .h2song file to be opened. |
Definition at line 492 of file CoreActionController.cpp.
| bool openPattern | ( | const QString & | sPath, |
| int | nPatternNumber = -1 ) |
Opens a pattern from disk and adds it to the pattern list.
| sPath | Absolute path to an existing .h2pattern file. |
| nPatternNumber | Row the pattern will be added to. If set to -1, the pattern will be appended at the end of the pattern list. |
Definition at line 1428 of file CoreActionController.cpp.
| bool openSong | ( | const QString & | songPath, |
| const QString & | sRecoverSongPath = "" ) |
Opens the H2Core::Song specified in songPath.
This will be done immediately and without saving the current H2Core::Song. All unsaved changes will be lost!
| songPath | Absolute path to the .h2song file to be opened. |
| sRecoverSongPath | If set to a value other than "", the corresponding path will be used to load the song and the latter is assigned songPath as Song::m_sFilename afterwards. Using this mechanism the GUI can use an autosave backup file to load a song without the core having to do some string magic to retrieve the original name. |
Definition at line 530 of file CoreActionController.cpp.
| bool openSong | ( | std::shared_ptr< Song > | pSong, |
| bool | bRelinking = true ) |
Opens the H2Core::Song specified in songPath.
This will be done immediately and without saving the current H2Core::Song. All unsaved changes will be lost!
| pSong | New Song. |
| bRelinking | Whether the drumkit last loaded should be relinked when under session management. This flag is used to distinguish between the regular load of a song file within a session and its replacement by another song (which requires an update of the linked drumkit). |
Definition at line 565 of file CoreActionController.cpp.
| bool quit | ( | ) |
Triggers the shutdown of Hydrogen.
This will be done immediately and without saving the current H2Core::Song. All unsaved changes will be lost!
The shutdown will be triggered in both the CLI and the GUI via the H2Core::EVENT_QUIT event.
Definition at line 713 of file CoreActionController.cpp.
| bool removePattern | ( | int | nPatternNumber | ) |
Removes a pattern from the pattern list.
| nPatternNumber | Specifies the position/row of the pattern. |
Definition at line 1482 of file CoreActionController.cpp.
|
private |
Loads the drumkit specified in sDrumkitPath.
| sDrumkitPath | Can be either an absolute path to a folder containing a drumkit file (drumkit.xml), an absolute path to a drumkit file itself, or an absolute file to a compressed drumkit (.h2drumkit). |
| bIsCompressed | Stores whether the drumkit was provided as a compressed .h2drumkit file |
| sDrumkitDir | Stores the folder containing the drumkit file. If a compressed drumkit was provided, this will point to a temporary folder. |
| sTemporaryFolder | Root path of a temporary folder containing the extracted drumkit in case sDrumkitPath pointed to a compressed .h2drumkit file. |
Definition at line 1238 of file CoreActionController.cpp.
| bool savePreferences | ( | ) |
Saves the current state of the H2Core::Preferences.
Definition at line 702 of file CoreActionController.cpp.
| bool saveSong | ( | ) |
Saves the current H2Core::Song.
Definition at line 612 of file CoreActionController.cpp.
| bool saveSongAs | ( | const QString & | sNewFilename | ) |
Saves the current H2Core::Song to the path provided in sNewFilename.
The intended use of this function for session management. Therefore, the function will not store the provided sNewFilename in H2Core::Preferences::m_lastSongFilename and Hydrogen won't resume with the corresponding song on restarting.
| sNewFilename | Absolute path to the file to store the current H2Core::Song in. |
Definition at line 668 of file CoreActionController.cpp.
|
private |
Definition at line 299 of file CoreActionController.cpp.
|
private |
Definition at line 219 of file CoreActionController.cpp.
|
private |
Definition at line 277 of file CoreActionController.cpp.
|
private |
Definition at line 325 of file CoreActionController.cpp.
|
private |
Definition at line 353 of file CoreActionController.cpp.
|
private |
Definition at line 380 of file CoreActionController.cpp.
|
private |
|
private |
Definition at line 247 of file CoreActionController.cpp.
| bool setDrumkit | ( | const QString & | sDrumkit, |
| bool | bConditional = true ) |
Wrapper around setDrumkit() that allows loading drumkits by name or path.
The function tries to retrieve the #Drumkit from cache (#SoundLibraryDatabase) first and loads it from disk in case this fails.
| sDrumkit | Can be either the name of a #Drumkit or a relative or absolute path pointing to it. |
| bConditional | Whether to remove all redundant H2Core::Instrument regardless of their content. |
Definition at line 966 of file CoreActionController.cpp.
| bool setDrumkit | ( | std::shared_ptr< Drumkit > | pDrumkit, |
| bool | bConditional = true ) |
Sets Drumkit pDrumkit as the one used in the current #Song.
The loading will overwrite the #InstrumentList of the current #Song with the one found in pDrumkit (among other things) and also can be used to reset the parameters of the current drumkit to its default values.
| pDrumkit | Full-fledged H2Core::Drumkit to load. |
| bConditional | Whether to remove all redundant H2Core::Instrument regardless of their content. |
Definition at line 979 of file CoreActionController.cpp.
| bool setMasterIsMuted | ( | bool | isMuted | ) |
Definition at line 102 of file CoreActionController.cpp.
| bool setMasterVolume | ( | float | masterVolumeValue | ) |
Definition at line 60 of file CoreActionController.cpp.
| bool setMetronomeIsActive | ( | bool | isActive | ) |
Definition at line 95 of file CoreActionController.cpp.
| bool setPattern | ( | Pattern * | pPattern, |
| int | nPatternNumber ) |
Opens a pattern to the current pattern list.
@param pPattern pattern to be added. @param nPatternNumber Row the pattern will be added to. @return bool true on success
Definition at line 1452 of file CoreActionController.cpp.
|
private |
Sets a H2Core::Song to be used by Hydrogen.
This will be done immediately and without saving the current H2Core::Song. All unsaved changes will be lost!
| pSong | Pointer to the H2Core::Song to set. |
| bRelinking | Whether the drumkit last loaded should be relinked when under session management. This flag is used to distinguish between the regular load of a song file within a session and its replacement by another song (which requires an update of the linked drumkit). |
Definition at line 583 of file CoreActionController.cpp.
| bool setStripIsMuted | ( | int | nStrip, |
| bool | isMuted ) |
Definition at line 129 of file CoreActionController.cpp.
| bool setStripIsSoloed | ( | int | nStrip, |
| bool | isSoloed ) |
Definition at line 156 of file CoreActionController.cpp.
| bool setStripPan | ( | int | nStrip, |
| float | fValue, | ||
| bool | bSelectStrip ) |
| nStrip | Instrument which to set the pan for. |
| fValue | New pan. |
| bSelectStrip | Whether the corresponding instrument should be selected. |
Definition at line 174 of file CoreActionController.cpp.
| bool setStripPanSym | ( | int | nStrip, |
| float | fValue, | ||
| bool | bSelectStrip ) |
| nStrip | Instrument which to set the pan for. |
| fValue | New pan. range in [-1;1] => symmetric respect to 0 |
| bSelectStrip | Whether the corresponding instrument should be selected. |
Definition at line 197 of file CoreActionController.cpp.
| bool setStripVolume | ( | int | nStrip, |
| float | fVolumeValue, | ||
| bool | bSelectStrip ) |
| nStrip | Instrument which to set the volume for. |
| fVolumeValue | New volume. |
| bSelectStrip | Whether the corresponding instrument should be selected. |
Definition at line 74 of file CoreActionController.cpp.
| bool toggleGridCell | ( | int | nColumn, |
| int | nRow ) |
Fills or clears a specific grid cell in the SongEditor.
| nColumn | column of the pattern. |
| nRow | row of the pattern. |
Definition at line 1590 of file CoreActionController.cpp.
| bool toggleStripIsMuted | ( | int | nStrip | ) |
Definition at line 119 of file CoreActionController.cpp.
| bool toggleStripIsSoloed | ( | int | nStrip | ) |
Definition at line 146 of file CoreActionController.cpp.
| void updatePreferences | ( | ) |
In case a different preferences file was loaded with Hydrogen already fully set up this function refreshes all corresponding values and informs the GUI.
Definition at line 1668 of file CoreActionController.cpp.
| bool upgradeDrumkit | ( | const QString & | sDrumkitPath, |
| const QString & | sNewPath = "" ) |
Upgrades the drumkit found at absolute path sDrumkitPath.
If sNewPath is missing, the drumkit will be upgraded in place and a backup file will be created in order to not overwrite the existing state.
Definition at line 1030 of file CoreActionController.cpp.
| 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 the current XSD definition.
| sDrumkitPath | Can be either an absolute path to a folder containing a drumkit file (drumkit.xml), an absolute path to a drumkit file itself, or an absolute file to a compressed drumkit (.h2drumkit). |
| bCheckLegacyVersions | Whether just the current XSD definition or also all previous versions should be checked. |
Definition at line 1161 of file CoreActionController.cpp.
|
private |
Definition at line 460 of file CoreActionController.h.