|
hydrogen 1.2.6
|
#include <CoreActionController.h>
Public Member Functions | |
| CoreActionController () | |
| ~CoreActionController () | |
| bool | activateJackTimebaseControl (bool bActivate) |
| (Un)registers Hydrogen as JACK Timebaes constroller. | |
| 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 | clearInstrumentInPattern (int nInstrumentNumber, int nPatternNumber=-1) |
| Deletes all notes for instrument pInstrument in a specified pattern. | |
| 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="", QString *pInstalledPath=nullptr, bool *pEncodingIssuesDetected=nullptr) |
| Extracts the compressed .h2drumkit file in sDrumkitPath into sTargetDir. | |
| bool | handleNote (int nNote, float fVelocity, bool bNoteOff=false) |
| Handle an incoming note event, e.g. | |
| 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 | setInstrumentPitch (int nInstrument, float fValue) |
| 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 | logBacktrace () const |
| Print the current stack at point into the debug log. | |
| 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, bool *pLegacyFormatEncountered) |
| 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 |
| static bool | bLogColors = true |
Definition at line 38 of file CoreActionController.h.
Definition at line 53 of file CoreActionController.cpp.
| ~CoreActionController | ( | ) |
Definition at line 58 of file CoreActionController.cpp.
| bool activateJackTimebaseControl | ( | bool | bActivate | ) |
(Un)registers Hydrogen as JACK Timebaes constroller.
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 873 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 848 of file CoreActionController.cpp.
| bool activateLoopMode | ( | bool | bActivate | ) |
Toggle loop mode of playback.
| bActivate | If true - activates loop mode. |
Definition at line 936 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 both JACK audio driver and an external Timebase controller (see Hydrogen::getJackTimebaseState()).
| bActivate | If true - activate or if false - deactivate. |
Definition at line 743 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 812 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 765 of file CoreActionController.cpp.
| bool clearInstrumentInPattern | ( | int | nInstrumentNumber, |
| int | nPatternNumber = -1 ) |
Deletes all notes for instrument pInstrument in a specified pattern.
| nInstrumentNumber | target instrument |
| nPatternNumber | index of the target pattern in Song::m_pPatternList in the current song. If set to -1, the currently selected pattern will be used instead. |
Definition at line 1612 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 831 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 790 of file CoreActionController.cpp.
| bool extractDrumkit | ( | const QString & | sDrumkitPath, |
| const QString & | sTargetDir = "", | ||
| QString * | pInstalledPath = nullptr, | ||
| bool * | pEncodingIssuesDetected = nullptr ) |
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. |
| pInstalledPath | Will contain the actual name of the folder the kit was installed to. In most cases this will coincide with a folder within sTargetPath named like the kit itself. But in case the system does not support UTF-8 encoding and sTargetPath contains characters other than those whitelisted in Filesystem::removeUtf8Characters, those might be omitted and the directory and files created using libarchive might differ. |
| pEncodingIssuesDetected | will be set to true in case at least one filepath of extracted kit had to be altered in order to not run into UTF-8 issues. |
Definition at line 1341 of file CoreActionController.cpp.
|
private |
Definition at line 452 of file CoreActionController.cpp.
| bool handleNote | ( | int | nNote, |
| float | fVelocity, | ||
| bool | bNoteOff = false ) |
Handle an incoming note event, e.g.
a MIDI or OSC NOTE_ON or NOTE_OFF as well as virtual keyboard stroke.
| nNote | determines which note will be triggered and is defined between [36,127] inspired by the General MIDI standard. |
| fVelocity | how "hard" the note was triggered. |
| bNoteOff | whether note should trigger or stop sound. |
Definition at line 1732 of file CoreActionController.cpp.
|
private |
Definition at line 431 of file CoreActionController.cpp.
| bool initExternalControlInterfaces | ( | ) |
Definition at line 467 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 1828 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 1393 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 1424 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 1444 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 516 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 1450 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 554 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 589 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 737 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 1504 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. |
| pLegacyFormatEncountered | will be set to true is any of the XML elements requires legacy format support and left untouched otherwise. |
Definition at line 1226 of file CoreActionController.cpp.
| bool savePreferences | ( | ) |
Saves the current state of the H2Core::Preferences.
Definition at line 726 of file CoreActionController.cpp.
| bool saveSong | ( | ) |
Saves the current H2Core::Song.
Definition at line 636 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 692 of file CoreActionController.cpp.
|
private |
Definition at line 323 of file CoreActionController.cpp.
|
private |
Definition at line 243 of file CoreActionController.cpp.
|
private |
Definition at line 301 of file CoreActionController.cpp.
|
private |
Definition at line 349 of file CoreActionController.cpp.
|
private |
Definition at line 377 of file CoreActionController.cpp.
|
private |
Definition at line 404 of file CoreActionController.cpp.
|
private |
|
private |
Definition at line 271 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 981 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 994 of file CoreActionController.cpp.
| bool setInstrumentPitch | ( | int | nInstrument, |
| float | fValue ) |
Definition at line 97 of file CoreActionController.cpp.
| bool setMasterIsMuted | ( | bool | isMuted | ) |
Definition at line 126 of file CoreActionController.cpp.
| bool setMasterVolume | ( | float | masterVolumeValue | ) |
Definition at line 62 of file CoreActionController.cpp.
| bool setMetronomeIsActive | ( | bool | isActive | ) |
Definition at line 119 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 1474 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 607 of file CoreActionController.cpp.
| bool setStripIsMuted | ( | int | nStrip, |
| bool | isMuted ) |
Definition at line 153 of file CoreActionController.cpp.
| bool setStripIsSoloed | ( | int | nStrip, |
| bool | isSoloed ) |
Definition at line 180 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 198 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 221 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 76 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 1650 of file CoreActionController.cpp.
| bool toggleStripIsMuted | ( | int | nStrip | ) |
Definition at line 143 of file CoreActionController.cpp.
| bool toggleStripIsSoloed | ( | int | nStrip | ) |
Definition at line 170 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 1813 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 1045 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 1177 of file CoreActionController.cpp.
|
private |
Definition at line 503 of file CoreActionController.h.