hydrogen 1.2.5
SoundLibraryDatabase Class Reference

This class holds information about all installed soundlibrary items. More...

#include <SoundLibraryDatabase.h>

Inheritance diagram for SoundLibraryDatabase:
Object< SoundLibraryDatabase > Base

Public Member Functions

 SoundLibraryDatabase ()
 ~SoundLibraryDatabase ()
std::shared_ptr< DrumkitgetDrumkit (const QString &sDrumkitPath, bool bLoad=true)
 Retrieve a drumkit from the database.
const std::map< QString, std::shared_ptr< Drumkit > > getDrumkitDatabase () const
QStringList getPatternCategories () const
std::vector< std::shared_ptr< SoundLibraryInfo > > getPatternInfoVector () const
bool isPatternInstalled (const QString &sPatternName) const
void loadPatternFromDirectory (const QString &path)
void printPatterns () const
QString toQString (const QString &sPrefix="", bool bShort=true) const override
 Formatted string version for debugging purposes.
void update ()
void updateDrumkit (const QString &sDrumkitPath, bool bTriggerEvent=true)
void updateDrumkits (bool bTriggerEvent=true)
void updatePatterns (bool bTriggerEvent=true)
Public Member Functions inherited from Object< SoundLibraryDatabase >
 Object ()
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.

Private Attributes

QStringList m_customDrumkitPaths
 List of drumkits the user supplied via CLI or OSC command but couldn't be found in either the system's or user's drumkit folders.
std::map< QString, std::shared_ptr< Drumkit > > m_drumkitDatabase
QStringList m_patternCategories
std::vector< std::shared_ptr< SoundLibraryInfo > > m_patternInfoVector

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 Loggerlogger ()
 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< SoundLibraryDatabase >
 ~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

Detailed Description

This class holds information about all installed soundlibrary items.

This class organizes the metadata of all locally installed soundlibrary items.

Author
Sebastian Moors

Definition at line 47 of file SoundLibraryDatabase.h.

Constructor & Destructor Documentation

◆ SoundLibraryDatabase()

Definition at line 32 of file SoundLibraryDatabase.cpp.

◆ ~SoundLibraryDatabase()

Definition at line 37 of file SoundLibraryDatabase.cpp.

Member Function Documentation

◆ getDrumkit()

std::shared_ptr< Drumkit > getDrumkit ( const QString & sDrumkitPath,
bool bLoad = true )

Retrieve a drumkit from the database.

Parameters
sDrumkitPathAbsolute path to the drumkit directory (containing a drumkit.xml) file as unique identifier.
bLoadWhether the drumkit should be loaded into the datebase in case it is not present yet.

Definition at line 135 of file SoundLibraryDatabase.cpp.

◆ getDrumkitDatabase()

const std::map< QString, std::shared_ptr< Drumkit > > getDrumkitDatabase ( ) const
inline

Definition at line 74 of file SoundLibraryDatabase.h.

◆ getPatternCategories()

QStringList getPatternCategories ( ) const
inline

Definition at line 57 of file SoundLibraryDatabase.h.

◆ getPatternInfoVector()

std::vector< std::shared_ptr< SoundLibraryInfo > > getPatternInfoVector ( ) const
inline

Definition at line 54 of file SoundLibraryDatabase.h.

◆ isPatternInstalled()

bool isPatternInstalled ( const QString & sPatternName) const

Definition at line 52 of file SoundLibraryDatabase.cpp.

◆ loadPatternFromDirectory()

void loadPatternFromDirectory ( const QString & path)

Definition at line 209 of file SoundLibraryDatabase.cpp.

◆ printPatterns()

void printPatterns ( ) const

Definition at line 41 of file SoundLibraryDatabase.cpp.

◆ toQString()

QString toQString ( const QString & sPrefix = "",
bool bShort = true ) const
overridevirtual

Formatted string version for debugging purposes.

Parameters
sPrefixString prefix which will be added in front of every new line
bShortInstead of the whole content of all classes stored as members just a single unique identifier will be displayed without line breaks.
Returns
String presentation of current object.

Reimplemented from Base.

Definition at line 230 of file SoundLibraryDatabase.cpp.

◆ update()

void update ( )

Definition at line 62 of file SoundLibraryDatabase.cpp.

◆ updateDrumkit()

void updateDrumkit ( const QString & sDrumkitPath,
bool bTriggerEvent = true )

Definition at line 120 of file SoundLibraryDatabase.cpp.

◆ updateDrumkits()

void updateDrumkits ( bool bTriggerEvent = true)

Definition at line 71 of file SoundLibraryDatabase.cpp.

◆ updatePatterns()

void updatePatterns ( bool bTriggerEvent = true)

Definition at line 192 of file SoundLibraryDatabase.cpp.

Field Documentation

◆ m_customDrumkitPaths

QStringList m_customDrumkitPaths
private

List of drumkits the user supplied via CLI or OSC command but couldn't be found in either the system's or user's drumkit folders.

This drumkit might still be present an valid. But it would be lost upon updating when just checking the aforementioned folders.

Definition at line 106 of file SoundLibraryDatabase.h.

◆ m_drumkitDatabase

std::map<QString,std::shared_ptr<Drumkit> > m_drumkitDatabase
private

Definition at line 94 of file SoundLibraryDatabase.h.

◆ m_patternCategories

QStringList m_patternCategories
private

Definition at line 97 of file SoundLibraryDatabase.h.

◆ m_patternInfoVector

std::vector<std::shared_ptr<SoundLibraryInfo> > m_patternInfoVector
private

Definition at line 96 of file SoundLibraryDatabase.h.