24#include <core/config.h>
31#include <QtCore/QFile>
32#include <QtCore/QFileInfo>
33#include <QtCore/QCoreApplication>
35#include <QRegularExpression>
42#define LOCAL_DATA_PATH "data/"
44#define DEMOS "demo_songs/"
46#define DRUMKITS "drumkits/"
49#define PATTERNS "patterns/"
50#define PLAYLISTS "playlists/"
51#define PLUGINS "plugins/"
52#define REPOSITORIES "repositories/"
53#define SCRIPTS "scripts/"
55#define THEMES "themes/"
56#define TMP "hydrogen/"
62#define CLICK_SAMPLE "click.wav"
63#define EMPTY_SAMPLE "emptySample.wav"
64#define DEFAULT_SONG "DefaultSong"
65#define EMPTY_SONG_BASE "emptySong"
66#define USR_CONFIG "hydrogen.conf"
67#define SYS_CONFIG "hydrogen.default.conf"
68#define LOG_FILE "hydrogen.log"
69#define DRUMKIT_XML "drumkit.xml"
70#define DRUMKIT_XSD "drumkit.xsd"
71#define DRUMPAT_XSD "drumkit_pattern.xsd"
72#define DRUMKIT_DEFAULT_KIT "GMRockKit"
73#define PLAYLIST_XSD "playlist.xsd"
75#define AUTOSAVE "autosave"
77#define UNTITLED_SONG "Untitled Song"
78#define UNTITLED_PLAYLIST "untitled.h2playlist"
81#define PATTERN_FILTER "*.h2pattern"
82#define PLAYLIST_FILTER "*.h2playlist"
83#define SONG_FILTER "*.h2song"
84#define THEME_FILTER "*.h2theme"
128#ifdef H2CORE_HAVE_FLAC_SUPPORT
132#ifdef H2CORE_HAVE_OPUS_SUPPORT
135#ifdef H2CORE_HAVE_MP3_SUPPORT
176 const QString sPathLower = sPath.toLower();
177 if ( sPathLower.endsWith(
"aiff" ) ) {
180 else if ( sPathLower.endsWith(
"au" ) ) {
183 else if ( sPathLower.endsWith(
"caf" ) ) {
186 else if ( sPathLower.endsWith(
"flac" ) ) {
189 else if ( sPathLower.endsWith(
"mp3" ) ) {
192 else if ( sPathLower.endsWith(
"ogg" ) ) {
195 else if ( sPathLower.endsWith(
"opus" ) ) {
198 else if ( sPathLower.endsWith(
"voc" ) ) {
201 else if ( sPathLower.endsWith(
"w64" ) ) {
204 else if ( sPathLower.endsWith(
"wav" ) ) {
208 ERRORLOG( QString(
"Unknown suffix in [%1]" ).arg( sPath ) );
215 const QString& sUsrDataPath,
216 const QString& sUserConfigPath,
217 const QString& sLogFile )
226 assert( QCoreApplication::instance() !=
nullptr );
229#ifdef H2CORE_HAVE_BUNDLE
231 __sys_data_path = QCoreApplication::applicationDirPath().append(
"/../Resources/data/" ) ;
233 __sys_data_path = QCoreApplication::applicationDirPath().append(
"/data/" ) ;
235 __usr_data_path = QDir::homePath().append(
"/Library/Application Support/Hydrogen/data/" );
238 __sys_data_path = QCoreApplication::applicationDirPath().append(
"/data/" ) ;
242#ifdef H2CORE_HAVE_APPIMAGE
250 if ( ! sSysDataPath.isEmpty() ) {
251 INFOLOG( QString(
"Using custom system data folder [%1]" )
252 .arg( sSysDataPath ) );
260 if ( ! sUsrDataPath.isEmpty() ) {
261 INFOLOG( QString(
"Using custom user data folder [%1]" )
262 .arg( sUsrDataPath ) );
270 if ( ! sUserConfigPath.isEmpty() ) {
271 INFOLOG( QString(
"Using custom user-level config file [%1]" )
272 .arg( sUserConfigPath ) );
276 if ( ! sLogFile.isEmpty() ) {
287 char* ladspaPath = getenv(
"LADSPA_PATH" );
289 INFOLOG(
"Found LADSPA_PATH environment variable" );
290 QString sLadspaPath = QString::fromLocal8Bit( ladspaPath );
292 while ( ( pos = sLadspaPath.indexOf(
":" ) ) != -1 ) {
293 QString sPath = sLadspaPath.left( pos );
295 sLadspaPath = sLadspaPath.mid( pos + 1, sLadspaPath.length() );
300 __ladspa_paths << QFileInfo( QCoreApplication::applicationDirPath(),
"/../Resources/plugins" ).canonicalFilePath();
301 __ladspa_paths << QFileInfo(
"/Library/Audio/Plug-Ins/LADSPA/" ).canonicalFilePath();
302 __ladspa_paths << QFileInfo( QDir::homePath(),
"/Library/Audio/Plug-Ins/LADSPA" ).canonicalFilePath();
304 __ladspa_paths << QFileInfo(
"/usr/lib/ladspa" ).canonicalFilePath();
305 __ladspa_paths << QFileInfo(
"/usr/local/lib/ladspa" ).canonicalFilePath();
306 __ladspa_paths << QFileInfo(
"/usr/lib64/ladspa" ).canonicalFilePath();
307 __ladspa_paths << QFileInfo(
"/usr/local/lib64/ladspa" ).canonicalFilePath();
327 QFileInfo fi( path );
329 QFileInfo folder( path.left( path.lastIndexOf(
"/" ) ) );
330 if( !folder.isDir() ) {
332 ERRORLOG( QString(
"%1 is not a directory" ).arg( folder.fileName() ) );
336 if( !folder.isWritable() ) {
338 ERRORLOG( QString(
"%1 is not writable" ).arg( folder.fileName() ) );
344 if( ( perms &
is_dir ) && !fi.isDir() ) {
346 ERRORLOG( QString(
"%1 is not a directory" ).arg( path ) );
350 if( ( perms &
is_file ) && !fi.isFile() ) {
352 ERRORLOG( QString(
"%1 is not a file" ).arg( path ) );
356 if( ( perms &
is_readable ) && !fi.isReadable() ) {
358 ERRORLOG( QString(
"%1 is not readable" ).arg( path ) );
362 if( ( perms &
is_writable ) && !fi.isWritable() ) {
364 ERRORLOG( QString(
"%1 is not writable" ).arg( path ) );
370 ERRORLOG( QString(
"%1 is not executable" ).arg( path ) );
408 if ( !QDir(
"/" ).mkpath( QDir( path ).absolutePath() ) ) {
409 ERRORLOG( QString(
"unable to create directory : %1" ).arg( path ) );
417 if ( !QDir( path ).exists() ) {
419 INFOLOG( QString(
"create user directory : %1" ).arg( path ) );
421 if ( create && !QDir(
"/" ).mkpath( path ) ) {
422 ERRORLOG( QString(
"unable to create user directory : %1" ).arg( path ) );
432 ERRORLOG( QString(
"unable to write to %1" ).arg( dst ) );
436 if ( !file.open( QIODevice::WriteOnly ) ) {
437 ERRORLOG( QString(
"unable to write to %1" ).arg( dst ) );
440 const auto contentUtf8 = content.toUtf8();
441 file.write( contentUtf8.data() );
450 WARNINGLOG( QString(
"do not overwrite %1 with %2 as it already exists" ).arg( dst ).arg( src ) );
454 ERRORLOG( QString(
"unable to copy %1 to %2, %1 is not readable" ).arg( src ).arg( dst ) );
458 ERRORLOG( QString(
"unable to copy %1 to %2, %2 is not writable" ).arg( src ).arg( dst ) );
462 INFOLOG( QString(
"copy %1 to %2" ).arg( src ).arg( dst ) );
468 rm( dst,
true, bSilent );
471 return QFile::copy( src, dst );
478 bool ret = file.remove();
480 ERRORLOG( QString(
"unable to remove file %1" ).arg( path ) );
485 ERRORLOG( QString(
"%1 is neither a file nor a directory ?!?!" ).arg( path ) );
490 bool ret = dir.rmdir( path );
492 ERRORLOG( QString(
"unable to remove dir %1 without recursive argument, maybe it is not empty?" ).arg( path ) );
496 return rm_fr( path, bSilent );
502 INFOLOG( QString(
"Removing [%1] recursively" ).arg( path ) );
507 QFileInfoList entries = dir.entryInfoList( QDir::NoDotAndDotDot | QDir::AllEntries );
508 for (
int idx = 0; ( ( idx < entries.size() ) && ret ); idx++ ) {
509 QFileInfo entryInfo = entries[idx];
510 if ( entryInfo.isDir() && !entryInfo.isSymLink() ) {
511 ret =
rm_fr( entryInfo.absoluteFilePath(), bSilent );
513 QFile file( entryInfo.absoluteFilePath() );
514 if ( !file.remove() ) {
515 ERRORLOG( QString(
"unable to remove %1" ).arg( entryInfo.absoluteFilePath() ) );
520 if ( !dir.rmdir( dir.absolutePath() ) ) {
521 ERRORLOG( QString(
"unable to remove %1" ).arg( dir.absolutePath() ) );
622 if ( nIterations > 1000 ) {
623 ERRORLOG(
"That's a bit much. Something is wrong in here." );
713 if ( dk_name.isEmpty() ) {
761 return QDir::tempPath() +
"/" +
TMP;
766 QString validBase = base;
768 QRegularExpression(
"[\\\\|\\/|\\*|\\,|\\$|:|=|@|!|\\^|&|\\?|\"|'|>|<|\\||%|:]+" ) );
770 QFileInfo f( validBase );
771 QString templateName(
tmp_dir() +
"/" );
772 if ( f.suffix().isEmpty() ) {
773 templateName += validBase.left( 20 );
775 templateName += f.completeBaseName().left( 20 ) +
"-XXXXXX." + f.suffix();
777 QTemporaryFile file( templateName);
778 file.setAutoRemove(
false );
781 return file.fileName();
788 QStringList possible = QDir( path ).entryList( QDir::Dirs | QDir::Readable | QDir::NoDotAndDotDot );
789 foreach (
const QString& dk, possible ) {
793 ERRORLOG( QString(
"drumkit %1 is not usable" ).arg( dk ) );
838 int nIndexMatch = -1;
843 const auto drumkitFolders = QStringList()
847 QString sSamplePathCleaned( sSamplePath );
853 sSamplePathCleaned = QString( sSamplePathCleaned ).replace(
"\\",
"/" );
859 sSamplePathCleaned = QString( sSamplePathCleaned ).replace(
"//",
"/" );
861 for (
const auto& ssFolder : drumkitFolders ) {
862 if ( sSamplePathCleaned.startsWith( ssFolder ) ) {
863 nIndexMatch = sSamplePathCleaned.indexOf(
864 "/", ssFolder.size() ) + 1;
869 if ( nIndexMatch >= 0 ) {
871 QString sShortenedPath = sSamplePathCleaned.right(
872 sSamplePathCleaned.size() - nIndexMatch );
874 return std::move( sShortenedPath );
892#ifdef H2CORE_HAVE_OSC
900 QString sDrumkitPath = QString(
"%1/%2" )
905 QFileInfo drumkitPathInfo( sDrumkitPath );
906 if ( drumkitPathInfo.isSymLink() ) {
907 sDrumkitPath = drumkitPathInfo.symLinkTarget();
912 QString sDrumkitXMLPath = QString(
"%1/%2" )
913 .arg( sDrumkitPath ).arg(
"drumkit.xml" );
915 QString sSessionDrumkitName(
"seemsLikeTheKitCouldNotBeRetrievedFromTheDatabase" );
917 if ( pSoundLibraryDatabase !=
nullptr ) {
918 auto pDrumkit = pSoundLibraryDatabase->getDrumkit( sDrumkitPath );
919 if ( pDrumkit !=
nullptr ) {
920 sSessionDrumkitName = pDrumkit->get_name();
924 if ( dk_name == sSessionDrumkitName ) {
928 else if ( ! bSilent ) {
929 NsmClient::printError( QString(
"Local drumkit [%1] name [%2] and the one stored in .h2song file [%3] do not match!" )
930 .arg( sDrumkitXMLPath )
931 .arg( sSessionDrumkitName )
951 ERRORLOG( QString(
"drumkit [%1] not found using lookup type [%2]" )
953 .arg(
static_cast<int>(lookup)));
971 ERRORLOG( QString(
"drumkit %1 not found with lookup mode [%2]" )
972 .arg( dk_name ).arg(
static_cast<int>(lookup) ) );
977#ifdef H2CORE_HAVE_OSC
979 if ( pHydrogen !=
nullptr &&
980 pHydrogen->isUnderSessionManagement() ) {
984 QFileInfo
info( dk_path );
985 if (
info.isRelative() ) {
986 QString sAbsoluteDrumkitPath = QString(
"%1%2" )
989 .arg( dk_path.right( dk_path.size() - 1 ) );
991 QFileInfo infoAbs( sAbsoluteDrumkitPath );
992 if ( infoAbs.isSymLink() ) {
993 sAbsoluteDrumkitPath = infoAbs.symLinkTarget();
1014 return dk_path +
"." +
1015 QDateTime::currentDateTime().toString(
"yyyy-MM-dd_hh-mm-ss" ) +
".bak";
1021 return QDir(
patterns_dir() ).entryList( QDir::Dirs | QDir::Readable | QDir::NoDotAndDotDot );
1031 return QDir( path ).entryList( QStringList(
PATTERN_FILTER ), QDir::Files | QDir::Readable | QDir::NoDotAndDotDot );
1037 return QDir(
songs_dir() ).entryList( QStringList(
SONG_FILTER ), QDir::Files | QDir::Readable | QDir::NoDotAndDotDot );
1043 foreach (
const QString& str,
song_list() ) {
1053 return QDir(
songs_dir() ).exists( sg_name );
1058 QFileInfo songFileInfo = QFileInfo( sSongPath );
1060 if ( !songFileInfo.isAbsolute() ) {
1061 ERRORLOG( QString(
"Error: Unable to handle path [%1]. Please provide an absolute file path!" )
1066 if ( songFileInfo.exists() ) {
1067 if ( !songFileInfo.isReadable() ) {
1068 ERRORLOG( QString(
"Unable to handle path [%1]. You must have permissions to read the file!" )
1072 if ( !songFileInfo.isWritable() ) {
1073 WARNINGLOG( QString(
"You don't have permissions to write to the Song found in path [%1]. It will be opened as read-only (no autosave)." )
1077 }
else if ( bCheckExistance ) {
1078 ERRORLOG( QString(
"Provided song [%1] does not exist" ).arg( sSongPath ) );
1082 if ( songFileInfo.suffix() !=
"h2song" ) {
1083 ERRORLOG( QString(
"Unable to handle path [%1]. The provided file must have the suffix '.h2song'!" )
1094 QString sValidName( sPath );
1095 sValidName.replace(
" ",
"_" );
1097 QRegularExpression(
"[\\\\|\\/|\\*|\\,|\\$|:|=|@|!|\\^|&|\\?|\"|'|>|<|\\||%|:]+" ) );
1104 return QDir(
sys_theme_dir() ).entryList( QStringList(
THEME_FILTER ), QDir::Files | QDir::Readable | QDir::NoDotAndDotDot ) +
1125 INFOLOG( QString(
"Internationalization dir : %1" ).arg(
i18n_dir() ) );
1146 if ( QFile( sFilename ).exists() ) {
1147 return QFileInfo( sFilename ).absoluteFilePath();
1149 else if ( ! bSilent ) {
1150 ___ERRORLOG( QString(
"File [%1] not found" ).arg( sFilename ) );
1157#ifdef H2CORE_HAVE_OSC
1159 if ( pHydrogen !=
nullptr &&
1160 pHydrogen->isUnderSessionManagement() ) {
1162 QFileInfo
info( sPath );
1163 if (
info.isRelative() ) {
1164 return QString(
"%1%2" )
1167 .arg( sPath.right( sPath.size() - 1 ) );
1195 const QStringList legacyDirSubfolders =
1196 legacyDir.entryList( QDir::Dirs | QDir::NoDotAndDotDot,
1197 QDir::Name | QDir::Reversed );
1199 QStringList drumkitXSDs;
1200 for (
const auto& ffolder : legacyDirSubfolders ) {
1201 const QDir folder( legacyDir.filePath( ffolder ) );
1208 return std::move( drumkitXSDs );
1212#ifdef H2CORE_HAVE_APPIMAGE
1214 if ( sDrumkitPath.isEmpty() ) {
1215 ERRORLOG(
"Can not reroute empty drumkit paths" );
1222 const QString sAbsolutePath = QDir( sDrumkitPath ).absolutePath();
1223 QString sResult = sAbsolutePath;
1227 const QStringList systemPrefixes = {
"/tmp" };
1231 bool bIsForeignSystemKit =
false;
1232 for (
const auto& ssPrefix : systemPrefixes ) {
1233 if ( sAbsolutePath.startsWith( ssPrefix ) &&
1235 bIsForeignSystemKit =
true;
1239 if ( bIsForeignSystemKit ) {
1240 const QStringList pathComponents = sAbsolutePath.split(
"/" );
1241 if ( pathComponents.size() > 2 ) {
1242 const QString sNewPath = QString(
"%1%2/%3" )
1244 .arg( pathComponents[ pathComponents.size() - 2 ] )
1245 .arg( pathComponents[ pathComponents.size() - 1 ] );
1247 INFOLOG( QString(
"Rerouting system kit: [%1] -> [%2]" )
1248 .arg( sDrumkitPath )
1254 ERRORLOG( QString(
"Unable to replace drumkit path [%1]" )
1255 .arg( sDrumkitPath ) );
1261 return sDrumkitPath;
1266 QString sCleaned( sEncodedString );
1267 return sCleaned.remove(
1268 QRegularExpression(
"[^a-zA-Z0-9._/\\s()\\[\\]\\&\\+\\-]" ) );
#define CLICK_SAMPLE
Sound of metronome beat.
#define DRUMKIT_DEFAULT_KIT
#define UNTITLED_PLAYLIST
static Logger * logger()
return the logger instance
static EventQueue * get_instance()
Returns a pointer to the current EventQueue singleton stored in __instance.
void push_event(const EventType type, const int nValue)
Queues the next event into the EventQueue.
static QStringList song_list()
returns a list of existing songs
static QString __usr_cfg_path
the path to the user config file
static bool file_copy(const QString &src, const QString &dst, bool overwrite=false, bool bSilent=false)
copy a source file to a destination
static QString scripts_dir()
returns user scripts path
static const QString patterns_filter_name
static QString playlist_xsd_path()
returns the path to the playlist pattern XSD (xml schema definition) file
static QString validateFilePath(const QString &sPath)
Takes an arbitrary path, replaces white spaces by underscores and removes all characters apart from l...
static QString demos_dir()
returns system demos path
static QString song_path(const QString &sg_name)
returns user song path, add file extension
static QString ensure_session_compatibility(const QString &sPath)
If Hydrogen is under session management, we support for paths relative to the session folder.
static QString sys_data_path()
returns system data path
static bool dir_readable(const QString &path, bool silent=false)
returns true if the given path is a readable regular directory
static std::vector< AudioFormat > m_supportedAudioFormats
static QString cache_dir()
returns user cache path
static const QString patterns_ext
static bool drumkit_exists(const QString &dk_name)
returns true if the drumkit exists within usable system or user drumkits
static bool check_usr_paths()
returns true if the user path is consistent
static const QString scripts_filter_name
static QString removeUtf8Characters(const QString &sEncodedString)
Removes all characters not within the Latin-1 range of sEncodedString.
static bool file_executable(const QString &path, bool silent=false)
returns true if the given path is an existing executable regular file
static AudioFormat AudioFormatFromSuffix(const QString &sFile, bool bSilent=false)
Determines the audio format of the provided filename or path based on its suffix.
static bool isSongPathValid(const QString &sSongPath, bool bCheckExistance=false)
Checks the path pointing to a .h2song.
static bool drumkit_valid(const QString &dk_path)
returns true if the path contains a usable drumkit
static QString playlist_path(const QString &pl_name)
returns user playlist path, add file extension
static QStringList drumkit_list(const QString &path)
static bool check_permissions(const QString &path, const int perms, bool silent)
static QString usr_config_path()
static QString songs_dir()
returns user songs path
static QString pattern_xsd_path()
returns the path to the pattern XSD (xml schema definition) file
static const QString themes_ext
static QString playlists_dir()
returns user playlist path
static DrumkitType determineDrumkitType(const QString &sPath)
static QString usr_click_file_path()
returns click file path from user directory if exists, otherwise from system
static bool bootstrap(Logger *logger, const QString &sSysDataPath="", const QString &sUsrDataPath="", const QString &sUserConfigFile="", const QString &sLogFile="")
check user and system filesystem usability
static QString empty_sample_path()
returns system empty sample file path
static QStringList playlist_list()
returns a list of existing playlists
static QString absolute_path(const QString &sFilename, bool bSilent=false)
Convert a direct to an absolute path.
static QString plugins_dir()
returns user plugins path
static bool file_writable(const QString &path, bool silent=false)
returns true if the given path is a possibly writable file (may exist or not)
static QStringList theme_list()
static QString usr_drumkits_dir()
returns user drumkits path
static QString untitled_song_name()
returns untitled song name
static bool check_sys_paths()
returns true if the system path is consistent
static QStringList ladspa_paths()
returns user ladspa paths
static QStringList drumkit_xsd_legacy_paths()
static QStringList pattern_list()
returns a list of existing patterns
static QString sys_drumkits_dir()
returns system drumkits path
static bool rm(const QString &path, bool recursive=false, bool bSilent=false)
remove a path
static QString drumkit_backup_path(const QString &dk_path)
Create a backup path from a drumkit path.
static QStringList song_list_cleared()
returns a list of existing songs, excluding the autosaved one
static QString usr_theme_dir()
static QString drumkit_xsd_path()
returns the path to the drumkit XSD (xml schema definition) file
static QString doc_dir()
returns documentation path
static const QString scripts_ext
static QStringList usr_drumkit_list()
returns list of usable user drumkits ( see Filesystem::drumkit_list )
static QString repositories_cache_dir()
returns user repository cache path
static QString prepare_sample_path(const QString &sFilePath)
Returns the basename if the given path is under an existing user or system drumkit path,...
static bool rm_fr(const QString &path, bool bSilent=false)
recursively remove a path
static bool dir_writable(const QString &path, bool silent=false)
returns true if the given path is a writable regular directory
static QString img_dir()
returns gui image path
static QString rerouteDrumkitPath(const QString &sDrumkitPath)
Reroutes stored drumkit paths pointing to a temporary AppImage system data folder to the current AppI...
static bool file_exists(const QString &path, bool silent=false)
returns true if the given path is an existing regular file
static QString __usr_data_path
the path to the user files
static const std::vector< AudioFormat > & supportedAudioFormats()
Which format is supported is determined by the libsndfile version Hydrogen is linked against during c...
static QString empty_song_path()
Provides the full path to the current empty song.
AudioFormat
All audio file formats supported by Hydrogen.
Lookup
Whenever a drumkit is loaded by name a collision between a user and a system drumkit carrying the sam...
@ system
Only search the system drumkits.
@ stacked
First, looks in the system drumkits and, afterwards, in the user drumkits.
@ user
Only search the user drumkits.
static QString drumkit_dir_search(const QString &dk_name, Lookup lookup)
returns the directory holding the named drumkit searching within user then system drumkits
static QString m_sPreferencesOverwritePath
If this variable is non-empty, its content will be used as an alternative to store and load the prefe...
static QString click_file_path()
Returns a string containing the path to the click.wav file used in the metronome.
static QStringList sys_drumkit_list()
returns list of usable system drumkits ( see Filesystem::drumkit_list )
static QString drumkit_path_search(const QString &dk_name, Lookup lookup=Lookup::stacked, bool bSilent=false)
Returns the path to a H2Core::Drumkit folder.
static const QString playlists_filter_name
static QString sys_config_path()
returns system config path
static bool mkdir(const QString &path)
create a path
static QString drumkit_file(const QString &dk_path)
returns the path to the xml file within a supposed drumkit path
static QStringList pattern_drumkits()
returns a list of existing drumkit sub dir into the patterns directory
static QString __sys_data_path
Path to the system files set in Filesystem::bootstrap().
static QString pattern_path(const QString &dk_name, const QString &p_name)
returns user patterns path, add file extension
static QString __usr_log_path
the path to the log file
static bool write_to_file(const QString &dst, const QString &content)
writes to a file
static Logger * __logger
a pointer to the logger
static const QString playlist_ext
static QString i18n_dir()
returns internationalization path
static const QString songs_filter_name
static QString xsd_legacy_dir()
static QString tmp_dir()
returns temp path
DrumkitType
Determines were to find a kit and whether it is writable by the current user.
@ SessionReadWrite
Kit was loaded via a NSM session, OSC command, or CLI option, only persist for the current Hydrogen s...
@ User
Kit was installed by the user, is automatically loaded, and most probably writable.
@ System
Kit was installed with Hydrogen, is automatically loaded, and most probably readonly.
@ SessionReadOnly
Kit was loaded via a NSM session, OSC command, or CLI option, only persist for the current Hydrogen s...
static void info()
send current settings information to logger with INFO severity
static QString usr_data_path()
returns user data path
static QString log_file_path()
returns the full path (including filename) of the logfile
static QString drumkit_usr_path(const QString &dk_name)
returns path for a drumkit within user drumkit path
static const QString drumkit_ext
static const QString themes_filter_name
static const QString songs_ext
static QString sys_theme_dir()
static bool path_usable(const QString &path, bool create=true, bool silent=false)
returns true if the path is a readable and writable regular directory, create if it not exists
static QString AudioFormatToSuffix(const AudioFormat &format, bool bSilent=false)
Converts format to the default lower case suffix of the format.
static QString drumkit_xml()
Returns filename and extension of the expected drumkit file.
static QString drumkit_xsd()
returns the drumkit XSD (xml schema definition) name
static QString tmp_file_path(const QString &base)
touch a temporary file under tmp_dir() and return it's path.
static QString default_song_name()
Default option to offer the user when saving an empty song to disk.
static QString xsd_dir()
returns system xsd path
static bool song_exists(const QString &sg_name)
returns true if the song file exists
static QStringList __ladspa_paths
paths to laspa plugins
static QString untitled_playlist_file_name()
returns untitled playlist file name
static bool file_readable(const QString &path, bool silent=false)
returns true if the given path is an existing readable regular file
static bool dir_exists(const QString &path, bool silent=false)
returns true if the given path is a regular directory
static QString drumkit_default_kit()
static QString patterns_dir()
returns user patterns path
static Hydrogen * get_instance()
Returns the current Hydrogen instance __instance.
SoundLibraryDatabase * getSoundLibraryDatabase() const
Class for writing logs to the console.
static void printError(const QString &msg)
Custom function to print a colored error message.
static NsmClient * get_instance()
#define H2_SYS_PATH
Path of the configuration files of Hydrogen in the system.
#define H2_USR_PATH
Path of the configuration files of Hydrogen in the user home.
@ EVENT_UPDATE_SONG
Event triggering HydrogenApp::updateSongEvent() whenever the Song was changed outside of the GUI,...