hydrogen 1.1.1
PatternList Class Reference

PatternList is a collection of patterns. More...

#include <PatternList.h>

Inheritance diagram for PatternList:
Object AudioEngineLocking

Public Member Functions

 PatternList ()
 constructor More...
 
 ~PatternList ()
 destructor More...
 
 PatternList (PatternList *other)
 copy constructor More...
 
int size () const
 returns the numbers of patterns More...
 
void operator<< (Pattern *new_pattern)
 add a pattern to the list More...
 
Patternoperator[] (int idx)
 get a pattern from the list More...
 
void add (Pattern *pattern)
 add a pattern to the list More...
 
void insert (int idx, Pattern *pattern)
 insert a pattern into the list More...
 
Patternget (int idx)
 get a pattern from the list More...
 
const Patternget (int idx) const
 
Patterndel (int idx)
 remove the pattern at a given index, does not delete it More...
 
Patterndel (Pattern *pattern)
 remove a pattern from the list, does not delete it More...
 
int index (const Pattern *pattern)
 get the index of the pattern within the patterns More...
 
Patternreplace (int idx, Pattern *pattern)
 replace the pattern at a given index with a new one More...
 
void clear ()
 empty the pattern list More...
 
void set_to_old ()
 mark all patterns as old More...
 
Patternfind (const QString &name)
 find a pattern within the patterns More...
 
void swap (int idx_a, int idx_b)
 swap the patterns of two different indexes More...
 
void move (int idx_a, int idx_b)
 move a pattern from a position to another More...
 
void flattened_virtual_patterns_compute ()
 call compute_flattened_virtual_patterns on each pattern More...
 
void virtual_pattern_del (Pattern *pattern)
 call del_virtual_pattern on each pattern More...
 
bool check_name (QString patternName, Pattern *ignore=NULL)
 check if a pattern with name patternName already exists in this list More...
 
QString find_unused_pattern_name (QString sourceName, Pattern *ignore=NULL)
 find unused patternName More...
 
int longest_pattern_length ()
 Get the length of the longest pattern in the list. More...
 
QString toQString (const QString &sPrefix, bool bShort=true) const override
 Formatted string version for debugging purposes. More...
 
- Public Member Functions inherited from Object
 ~Object ()
 destructor More...
 
 Object (const Object &obj)
 copy constructor More...
 
 Object (const char *class_name)
 constructor More...
 
const char * class_name () const
 return the class name More...
 
virtual QString toQString (const QString &sPrefix, bool bShort=true) const
 Formatted string version for debugging purposes. More...
 
void Print (bool bShort=true) const
 Prints content of toQString() via DEBUGLOG. More...
 
- Public Member Functions inherited from AudioEngineLocking
void setNeedsLock (bool bNeedsLock)
 The audio processing thread can modify some PatternLists. More...
 
 AudioEngineLocking ()
 

Private Attributes

std::vector< Pattern * > __patterns
 the list of patterns More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Object
static void set_count (bool flag)
 enable/disable class instances counting More...
 
static bool count_active ()
 return true if class instances counting is enabled More...
 
static unsigned objects_count ()
 return the number of objects More...
 
static void write_objects_map_to (std::ostream &out)
 output the full objects map to a given ostream More...
 
static void write_objects_map_to_cerr ()
 output objects map to stderr More...
 
static int bootstrap (Logger *logger, bool count=false)
 must be called before any Object instantiation ! More...
 
static Loggerlogger ()
 return the logger instance More...
 
- Static Public Attributes inherited from Object
static QString sPrintIndention = " "
 String used to format the debugging string output of some core classes. More...
 
- Protected Member Functions inherited from AudioEngineLocking
void assertAudioEngineLocked () const
 Assert that the AudioEngine lock is held if needed. More...
 
- Static Protected Attributes inherited from Object
static Logger__logger = nullptr
 logger instance pointer More...
 

Detailed Description

PatternList is a collection of patterns.

Constructor & Destructor Documentation

◆ PatternList() [1/2]

constructor

◆ ~PatternList()

destructor

◆ PatternList() [2/2]

PatternList ( PatternList other)

copy constructor

Parameters
other

Member Function Documentation

◆ add()

void add ( Pattern pattern)

add a pattern to the list

Parameters
patterna pointer to the pattern to add

◆ check_name()

bool check_name ( QString  patternName,
Pattern ignore = NULL 
)

check if a pattern with name patternName already exists in this list

Parameters
patternNamename of a pattern to check
ignoreoptional pattern in the list to ignore

◆ clear()

void clear ( )
inline

empty the pattern list

◆ del() [1/2]

Pattern * del ( int  idx)

remove the pattern at a given index, does not delete it

Parameters
idxthe index
Returns
a pointer to the removed pattern

◆ del() [2/2]

Pattern * del ( Pattern pattern)

remove a pattern from the list, does not delete it

Parameters
patternthe pattern to be removed
Returns
a pointer to the removed pattern, 0 if not found

◆ find()

Pattern * find ( const QString &  name)

find a pattern within the patterns

Parameters
namethe name of the pattern to find
Returns
0 if not found

◆ find_unused_pattern_name()

QString find_unused_pattern_name ( QString  sourceName,
Pattern ignore = NULL 
)

find unused patternName

Parameters
sourceNamebase name to start with
ignoreoptional pattern in the list to ignore

◆ flattened_virtual_patterns_compute()

void flattened_virtual_patterns_compute ( )

call compute_flattened_virtual_patterns on each pattern

◆ get() [1/2]

Pattern * get ( int  idx)

get a pattern from the list

Parameters
idxthe index to get the pattern from

◆ get() [2/2]

const Pattern * get ( int  idx) const

◆ index()

int index ( const Pattern pattern)

get the index of the pattern within the patterns

Parameters
patterna pointer to the pattern to find
Returns
-1 if not found

◆ insert()

void insert ( int  idx,
Pattern pattern 
)

insert a pattern into the list

Parameters
idxthe index to insert the pattern at
patterna pointer to the pattern to add

◆ longest_pattern_length()

int longest_pattern_length ( )

Get the length of the longest pattern in the list.

Returns
pattern length in ticks, -1 if list is empty

◆ move()

void move ( int  idx_a,
int  idx_b 
)

move a pattern from a position to another

Parameters
idx_athe start index
idx_bthe finish index

◆ operator<<()

void operator<< ( Pattern new_pattern)
inline

add a pattern to the list

Parameters
new_patterna pointer to the pattern to add

◆ operator[]()

Pattern * operator[] ( int  idx)
inline

get a pattern from the list

Parameters
idxthe index to get the pattern from

◆ replace()

Pattern * replace ( int  idx,
Pattern pattern 
)

replace the pattern at a given index with a new one

Parameters
idxthe index
patternthe new pattern to insert
Returns
a pointer to the removed pattern, 0 if index out of bounds

◆ set_to_old()

void set_to_old ( )

mark all patterns as old

◆ size()

int size ( ) const
inline

returns the numbers of patterns

◆ swap()

void swap ( int  idx_a,
int  idx_b 
)

swap the patterns of two different indexes

Parameters
idx_athe first index
idx_bthe second index

◆ 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 Object.

◆ virtual_pattern_del()

void virtual_pattern_del ( Pattern pattern)

call del_virtual_pattern on each pattern

Parameters
patternthe pattern to remove where it's found

Field Documentation

◆ __patterns

std::vector<Pattern*> __patterns
private

the list of patterns