hydrogen 1.2.6
AudioEngineTests Class Reference

Defined in here since it requires access to methods and variables private to the AudioEngine class. More...

#include <AudioEngineTests.h>

Inheritance diagram for AudioEngineTests:
Object< AudioEngineTests > Base

Static Public Member Functions

static void testFrameToTickConversion ()
 Unit test checking for consistency when converting frames to ticks and back.
 
static void testHumanization ()
 Unit test checking that custom note properties take effect and that humanization works as expected.
 
static void testLoopMode ()
 Unit test checking that loop mode as well as deactivating it works.
 
static void testNoteEnqueuing ()
 Unit test checking that all notes in a song are picked up once.
 
static void testNoteEnqueuingTimeline ()
 Checks whether the order of notes enqueued and processed by the Sampler is consistent on tempo change.
 
static void testSongSizeChange ()
 Unit test checking consistency of transport position when playback was looped at least once and the song size is changed by toggling a pattern.
 
static void testSongSizeChangeInLoopMode ()
 Unit test checking consistency of transport position when playback was looped at least once and the song size is changed by toggling a pattern.
 
static void testTransportProcessing ()
 Unit test checking the incremental update of the transport position in audioEngine_process().
 
static void testTransportProcessingTimeline ()
 More detailed test of the transport and playhead integrity in case Timeline/tempo markers are involved.
 
static void testTransportRelocation ()
 Unit test checking the relocation of the transport position in audioEngine_process().
 
static void testUpdateTransportPosition ()
 Checks is reproducible and works even without any song set.
 
- 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 Private Member Functions

static void checkAudioConsistency (const std::vector< std::shared_ptr< Note > > oldNotes, const std::vector< std::shared_ptr< Note > > newNotes, const QString &sContext, int nPassedFrames, bool bTestAudio=true, float fPassedTicks=0.0)
 Takes two instances of Sampler::m_playingNotesQueue and checks whether matching notes have exactly nPassedFrames difference in their SelectedLayerInfo::SamplePosition.
 
static void checkTransportPosition (std::shared_ptr< TransportPosition > pPos, const QString &sContext)
 Checks the consistency of the transport position pPos by converting the current tick, frame, column, pattern start tick etc.
 
static std::vector< std::shared_ptr< Note > > copySongNoteQueue ()
 
static void mergeQueues (std::vector< std::shared_ptr< Note > > *noteList, std::vector< Note * > newNotes)
 
static void mergeQueues (std::vector< std::shared_ptr< Note > > *noteList, std::vector< std::shared_ptr< Note > > newNotes)
 Add every Note in newNotes not yet contained in noteList to the latter.
 
static int processTransport (const QString &sContext, int nFrames, long long *nLastLookahead, long long *nLastTransportFrame, long long *nTotalFrames, long *nLastPlayheadTick, double *fLastTickIntervalEnd, bool bCheckLookahead=true)
 
static void resetSampler (const QString &sContext)
 
static void throwException (const QString &sMsg)
 
static void toggleAndCheckConsistency (int nToggleColumn, int nToggleRow, const QString &sContext)
 Toggles the grid cell defined by nToggleColumn and nToggleRow twice and checks whether the transport position and the audio processing remains consistent.
 

Additional Inherited Members

- Public Member Functions inherited from Object< AudioEngineTests >
 Object ()
 
 Object (const Object< AudioEngineTests > &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.
 
- 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< AudioEngineTests >
 ~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

Defined in here since it requires access to methods and variables private to the AudioEngine class.

Definition at line 42 of file AudioEngineTests.h.

Member Function Documentation

◆ checkAudioConsistency()

void checkAudioConsistency ( const std::vector< std::shared_ptr< Note > > oldNotes,
const std::vector< std::shared_ptr< Note > > newNotes,
const QString & sContext,
int nPassedFrames,
bool bTestAudio = true,
float fPassedTicks = 0.0 )
staticprivate

Takes two instances of Sampler::m_playingNotesQueue and checks whether matching notes have exactly nPassedFrames difference in their SelectedLayerInfo::SamplePosition.

Definition at line 1647 of file AudioEngineTests.cpp.

◆ checkTransportPosition()

void checkTransportPosition ( std::shared_ptr< TransportPosition > pPos,
const QString & sContext )
staticprivate

Checks the consistency of the transport position pPos by converting the current tick, frame, column, pattern start tick etc.

into each other and comparing the results.

Parameters
pPosTransport position to check
sContextString identifying the calling function and used for logging

Definition at line 1582 of file AudioEngineTests.cpp.

◆ copySongNoteQueue()

std::vector< std::shared_ptr< Note > > copySongNoteQueue ( )
staticprivate

Definition at line 1764 of file AudioEngineTests.cpp.

◆ mergeQueues() [1/2]

void mergeQueues ( std::vector< std::shared_ptr< Note > > * noteList,
std::vector< Note * > newNotes )
staticprivate

Definition at line 1561 of file AudioEngineTests.cpp.

◆ mergeQueues() [2/2]

void mergeQueues ( std::vector< std::shared_ptr< Note > > * noteList,
std::vector< std::shared_ptr< Note > > newNotes )
staticprivate

Add every Note in newNotes not yet contained in noteList to the latter.

Definition at line 1539 of file AudioEngineTests.cpp.

◆ processTransport()

int processTransport ( const QString & sContext,
int nFrames,
long long * nLastLookahead,
long long * nLastTransportFrame,
long long * nTotalFrames,
long * nLastPlayheadTick,
double * fLastTickIntervalEnd,
bool bCheckLookahead = true )
staticprivate

Definition at line 534 of file AudioEngineTests.cpp.

◆ resetSampler()

void resetSampler ( const QString & sContext)
staticprivate

Definition at line 1956 of file AudioEngineTests.cpp.

◆ testFrameToTickConversion()

void testFrameToTickConversion ( )
static

Unit test checking for consistency when converting frames to ticks and back.

Definition at line 52 of file AudioEngineTests.cpp.

◆ testHumanization()

void testHumanization ( )
static

Unit test checking that custom note properties take effect and that humanization works as expected.

Definition at line 1219 of file AudioEngineTests.cpp.

◆ testLoopMode()

void testLoopMode ( )
static

Unit test checking that loop mode as well as deactivating it works.

Definition at line 433 of file AudioEngineTests.cpp.

◆ testNoteEnqueuing()

void testNoteEnqueuing ( )
static

Unit test checking that all notes in a song are picked up once.

Definition at line 838 of file AudioEngineTests.cpp.

◆ testNoteEnqueuingTimeline()

void testNoteEnqueuingTimeline ( )
static

Checks whether the order of notes enqueued and processed by the Sampler is consistent on tempo change.

Definition at line 1119 of file AudioEngineTests.cpp.

◆ testSongSizeChange()

void testSongSizeChange ( )
static

Unit test checking consistency of transport position when playback was looped at least once and the song size is changed by toggling a pattern.

Definition at line 702 of file AudioEngineTests.cpp.

◆ testSongSizeChangeInLoopMode()

void testSongSizeChangeInLoopMode ( )
static

Unit test checking consistency of transport position when playback was looped at least once and the song size is changed by toggling a pattern.

Definition at line 750 of file AudioEngineTests.cpp.

◆ testTransportProcessing()

void testTransportProcessing ( )
static

Unit test checking the incremental update of the transport position in audioEngine_process().

Definition at line 104 of file AudioEngineTests.cpp.

◆ testTransportProcessingTimeline()

void testTransportProcessingTimeline ( )
static

More detailed test of the transport and playhead integrity in case Timeline/tempo markers are involved.

Definition at line 297 of file AudioEngineTests.cpp.

◆ testTransportRelocation()

void testTransportRelocation ( )
static

Unit test checking the relocation of the transport position in audioEngine_process().

Definition at line 642 of file AudioEngineTests.cpp.

◆ testUpdateTransportPosition()

void testUpdateTransportPosition ( )
static

Checks is reproducible and works even without any song set.

Definition at line 1999 of file AudioEngineTests.cpp.

◆ throwException()

void throwException ( const QString & sMsg)
staticprivate

Definition at line 3054 of file AudioEngineTests.cpp.

◆ toggleAndCheckConsistency()

void toggleAndCheckConsistency ( int nToggleColumn,
int nToggleRow,
const QString & sContext )
staticprivate

Toggles the grid cell defined by nToggleColumn and nToggleRow twice and checks whether the transport position and the audio processing remains consistent.

Definition at line 1780 of file AudioEngineTests.cpp.