|
hydrogen 1.2.6
|
The audio engine deals with two distinct TransportPosition. More...
#include <AudioEngine.h>
Data Structures | |
| struct | _locker_struct |
| struct | compare_pNotes |
| Song Note FIFO. More... | |
Public Types | |
| enum class | State { Uninitialized = 1 , Initialized = 2 , Prepared = 3 , Ready = 4 , Playing = 5 , Testing = 6 } |
Public Member Functions | |
| AudioEngine () | |
| ~AudioEngine () | |
| void | assertLocked (const QString &sClass, const char *sFunction, const QString &sMsg) |
| Assert that the calling thread is the current holder of the AudioEngine lock. | |
| void | clearNextPatterns () |
| AudioOutput * | createAudioDriver (const Preferences::AudioDriver &driver) |
| Create an audio driver using audioEngine_process() as its argument based on the provided choice and calling their init() function to trigger their initialization. | |
| void | flushAndAddNextPattern (int nPatternNumber) |
| Add pattern nPatternNumber to #m_pNextPatterns as well as the whole content of #m_pPlayingPatterns. | |
| AudioOutput * | getAudioDriver () const |
| float | getElapsedTime () const |
| int | getEnqueuedNotesNumber () const |
| Returns the size of m_songNoteQueue. | |
| long long | getLeadLagInFrames (double fTick) |
| Calculates lead lag factor (in frames) relative to the transport position fTick. | |
| float | getMasterPeak_L () const |
| float | getMasterPeak_R () const |
| float | getMaxProcessTime () const |
| std::shared_ptr< Instrument > | getMetronomeInstrument () const |
| MidiInput * | getMidiDriver () const |
| MidiOutput * | getMidiOutDriver () const |
| float | getNextBpm () const |
| const PatternList * | getNextPatterns () const |
| const PatternList * | getPlayingPatterns () const |
| float | getProcessTime () const |
| long long | getRealtimeFrame () const |
| Sampler * | getSampler () const |
| double | getSongSizeInTicks () const |
| State | getState () const |
| Synth * | getSynth () const |
| const std::shared_ptr< TransportPosition > | getTransportPosition () const |
| bool | isEndOfSongReached (std::shared_ptr< TransportPosition > pPos) const |
| void | lock (const char *file, unsigned int line, const char *function) |
| Mutex locking of the AudioEngine. | |
| void | makeTrackPorts (std::shared_ptr< Song > pSong) |
| void | noteOn (Note *note) |
| void | play () |
| Marks the audio engine to be started during the next call of the audioEngine_process() callback function. | |
| void | raiseError (unsigned nErrorCode) |
| void | removePlayingPattern (Pattern *pPattern) |
| void | renameJackPorts (std::shared_ptr< Song > pSong) |
| Hands the provided Song to JackAudioDriver::makeTrackOutputs() if pSong is not a null pointer and the audio driver m_pAudioDriver is an instance of the JackAudioDriver. | |
| void | restartAudioDrivers () |
| void | setMasterPeak_L (float value) |
| void | setMasterPeak_R (float value) |
| void | setNextBpm (float fNextBpm) |
| Stores the new speed into a separate variable which will be adopted during the next processing cycle. | |
| void | setupLadspaFX () |
| void | startAudioDrivers () |
| Creation and initialization of all audio and MIDI drivers called in Hydrogen::Hydrogen(). | |
| void | stop () |
| Marks the audio engine to be stopped during the next call of the audioEngine_process() callback function. | |
| void | stopAudioDrivers () |
| Stops all audio and MIDI drivers. | |
| void | toggleNextPattern (int nPatternNumber) |
| Add pattern nPatternNumber to #m_pNextPatterns or deletes it in case it is already present. | |
| QString | toQString (const QString &sPrefix="", bool bShort=true) const override |
| Formatted string version for debugging purposes. | |
| bool | tryLock (const char *file, unsigned int line, const char *function) |
| Mutex locking of the AudioEngine. | |
| bool | tryLockFor (std::chrono::microseconds duration, const char *file, unsigned int line, const char *function) |
| Mutex locking of the AudioEngine. | |
| void | unlock () |
| Mutex unlocking of the AudioEngine. | |
| void | updatePlayingPatterns () |
| Update the list of currently played patterns associated with m_pTransportPosition and m_pQueuingPosition. | |
| void | updateSongSize () |
| Function to be called every time the length of the current song does change, e.g. | |
| void | updateVirtualPatterns () |
Public Member Functions inherited from Object< AudioEngine > | |
| Object () | |
| Object (const Object< AudioEngine > &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. | |
Static Public Member Functions | |
| static int | audioEngine_process (uint32_t nframes, void *arg) |
| Main audio processing function called by the audio drivers whenever there is work to do. | |
| static double | computeDoubleTickSize (const int nSampleRate, const float fBpm, const int nResolution) |
| static float | computeTickSize (const int nSampleRate, const float fBpm, const int nResolution) |
| Calculates the number of frames that make up a tick. | |
| static float | getBpmAtColumn (int nColumn) |
| static double | getLeadLagInTicks () |
| Maximum lead lag factor in ticks. | |
| static QString | StateToQString (const State &state) |
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 | |
| static constexpr float | fHumanizePitchSD = 0.4 |
| Maximum value the standard deviation of the Gaussian distribution the random pitch contribution will be drawn from can take. | |
| static constexpr float | fHumanizeTimingSD = 0.3 |
| Maximum value the standard deviation of the Gaussian distribution the random pitch contribution will be drawn from can take. | |
| static constexpr float | fHumanizeVelocitySD = 0.2 |
| Maximum value the standard deviation of the Gaussian distribution the random velocity contribution will be drawn from can take. | |
| static constexpr int | nMaxTimeHumanize = 2000 |
| Maximum time (in frames) a note's position can be off due to the humanization (lead-lag). | |
Static Public Attributes inherited from Base | |
| static QString | sPrintIndention = " " |
| String used to format the debugging string output of some core classes. | |
Private Member Functions | |
| void | calculateTransportOffsetOnBpmChange (std::shared_ptr< TransportPosition > pTransportPosition) |
| void | clearAudioBuffers (uint32_t nFrames) |
| Clear all audio buffers. | |
| void | clearNoteQueues () |
| double | coarseGrainTick (double fTick) |
| Ideally we just floor the provided tick. | |
| long long | computeTickInterval (double *fTickStart, double *fTickEnd, unsigned nIntervalLengthInFrames) |
| QString | getDriverNames () const |
| State | getNextState () const |
| void | handleDriverChange () |
| The audio driver was changed what possible changed the tick size - which depends on both the sample rate - too. | |
| void | handleLoopModeChanged () |
| In order to properly support H2Core::Song::LoopMode::Finishing - transport was already looped a couple of times and the user is pressing the loop button again to deactivate loop mode - we have to capture the number of loops already applied. | |
| void | handleSelectedPattern () |
| Keeps the selected pattern in line with the one the transport position resides in while in Song::Mode::Song. | |
| void | handleSongModeChanged () |
| Called whenever Hydrogen switches from Song::Mode::Song into Song::Mode::Pattern or the other way around. | |
| void | handleSongSizeChange () |
| Updates all notes in m_songNoteQueue to be still valid after a change in song size. | |
| void | handleTempoChange () |
| Updates all notes in m_songNoteQueue and m_midiNoteQueue to be still valid after a tempo change. | |
| void | handleTimelineChange () |
| Updates the transport states and all notes in m_songNoteQueue and m_midiNoteQueue after adding or deleting a TempoMarker or enabling/disabling the Timeline. | |
| void | incrementTransportPosition (uint32_t nFrames) |
| void | locate (const double fTick, bool bWithJackBroadcast=true) |
| void | locateToFrame (const long long nFrame) |
| Version of the locate() function intended to be directly used by frame-based audio drivers / servers. | |
| void | processAudio (uint32_t nFrames) |
| void | processPlayNotes (unsigned long nframes) |
| void | removeSong () |
| void | reset (bool bWithJackBroadcast=true) |
| void | resetOffsets () |
| void | setNextState (State state) |
| void | setRealtimeFrame (long long nFrame) |
| void | setSong (std::shared_ptr< Song >pNewSong) |
| void | setState (State state) |
| void | startPlayback () |
| void | stopPlayback () |
| void | updateBpmAndTickSize (std::shared_ptr< TransportPosition > pTransportPosition) |
| void | updateNoteQueue (unsigned nIntervalLengthInFrames) |
| Takes all notes from the currently playing patterns, from the MIDI queue m_midiNoteQueue, and those triggered by the metronome and pushes them onto m_songNoteQueue for playback. | |
| void | updatePatternTransportPosition (double fTick, long long nFrame, std::shared_ptr< TransportPosition > pPos) |
| void | updatePlayingPatternsPos (std::shared_ptr< TransportPosition > pPos) |
| void | updateSongTransportPosition (double fTick, long long nFrame, std::shared_ptr< TransportPosition > pPos) |
| void | updateTransportPosition (double fTick, long long nFrame, std::shared_ptr< TransportPosition > pPos) |
Private Attributes | |
| audioProcessCallback | m_AudioProcessCallback |
| bool | m_bLookaheadApplied |
| std::timed_mutex | m_EngineMutex |
| Mutex for synchronizing the access to the Song object and the AudioEngine. | |
| float | m_fFXPeak_L [MAX_FX] |
| float | m_fFXPeak_R [MAX_FX] |
| float | m_fLadspaTime |
| double | m_fLastTickEnd |
| float | m_fMasterPeak_L |
| float | m_fMasterPeak_R |
| float | m_fMaxProcessTime |
| float | m_fNextBpm |
| float | m_fProcessTime |
| double | m_fSongSizeInTicks |
| Set to the total number of ticks in a Song. | |
| std::thread::id | m_LockingThread |
| Thread ID of the current holder of the AudioEngine lock. | |
| std::deque< Note * > | m_midiNoteQueue |
| Midi Note FIFO. | |
| QMutex | m_MutexOutputPointer |
| Mutex for locking the pointer to the audio output buffer, allowing multiple readers. | |
| State | m_nextState |
| State assigned during the next call to processTransport(). | |
| int | m_nLoopsDone |
| Indicates how many loops the transport already did when the user presses the Loop button again. | |
| long long | m_nRealtimeFrame |
| Variable keeping track of the transport position in realtime. | |
| AudioOutput * | m_pAudioDriver |
| EventQueue * | m_pEventQueue |
| struct H2Core::AudioEngine::_locker_struct | m_pLocker |
| std::shared_ptr< Instrument > | m_pMetronomeInstrument |
| Pointer to the metronome. | |
| MidiInput * | m_pMidiDriver |
| MidiOutput * | m_pMidiDriverOut |
| std::shared_ptr< TransportPosition > | m_pQueuingPosition |
| Sampler * | m_pSampler |
| Synth * | m_pSynth |
| std::shared_ptr< TransportPosition > | m_pTransportPosition |
| std::priority_queue< Note *, std::deque< Note * >, compare_pNotes > | m_songNoteQueue |
| State | m_state |
| Current state of the H2Core::AudioEngine. | |
Friends | |
| class | AudioEngineTests |
| bool | CoreActionController::activateLoopMode (bool) |
| bool | CoreActionController::activateSongMode (bool) |
| bool | CoreActionController::addTempoMarker (int, float) |
| Uses handleTimelineChange() | |
| bool | CoreActionController::deleteTempoMarker (int) |
| Uses handleTimelineChange() | |
| bool | CoreActionController::locateToTick (long nTick, bool) |
| int | FakeDriver::connect () |
| Is allowed to set m_state to State::Ready via setState() | |
| void | Hydrogen::removeSong () |
| Is allowed to call removeSong(). | |
| void | Hydrogen::setIsTimelineActivated (bool) |
| Uses handleTimelineChange() | |
| void | Hydrogen::setSong (std::shared_ptr< Song > pSong, bool bRelinking) |
| Is allowed to call setSong(). | |
| void | Hydrogen::updateSelectedPattern (bool) |
| Is allowed to use locate() to directly set the position in frames as well as to used setColumn and setPatternTickPos to move the arrow in the SongEditorPositionRuler even when playback is stopped. | |
| class | JackAudioDriver |
Additional Inherited Members | |
Protected Member Functions inherited from Object< AudioEngine > | |
| ~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 |
The audio engine deals with two distinct TransportPosition.
The first (and most important one) is m_pTransportPosition which indicated the current position of the audio rendering and playhead as well as all patterns associated with it. This is also the one other parts of Hydrogen are concerned with.
The second one is m_pQueuingPosition which is only used internally. It is one lookahead ahead of m_pTransportPosition, used for inserting notes into the song queue, and required in order to supported lead and lag of notes. Formerly, this second transport state was trimmed to a couple of variables making its update less expensive. However, this showed to be quite error prone as things tend to went out of sync.
All tick information (apart from note handling in updateNoteQueue()) are handled as double internally. But due to historical reasons the GUI and the remainder of the core only access a version of the current tick rounded to integer.
Definition at line 98 of file AudioEngine.h.
|
strong |
| Enumerator | |
|---|---|
| Uninitialized | Not even the constructors have been called. |
| Initialized | Not ready, but most pointers are now valid or NULL. |
| Prepared | Drivers are set up, but not ready to process audio. |
| Ready | Ready to process audio. |
| Playing | Transport is rolling. |
| Testing | State used during the unit tests of the AudioEngine. Transport is not rolling but when calling a function of the process cycle it is ensured all its code and subsequent functions will be executed. |
Definition at line 103 of file AudioEngine.h.
| AudioEngine | ( | ) |
Definition at line 96 of file AudioEngine.cpp.
| ~AudioEngine | ( | ) |
Definition at line 148 of file AudioEngine.cpp.
| void assertLocked | ( | const QString & | sClass, |
| const char * | sFunction, | ||
| const QString & | sMsg ) |
Assert that the calling thread is the current holder of the AudioEngine lock.
Definition at line 3053 of file AudioEngine.cpp.
|
static |
Main audio processing function called by the audio drivers whenever there is work to do.
| nframes | Buffersize. |
| arg | Unused. |
Definition at line 1415 of file AudioEngine.cpp.
|
private |
Definition at line 812 of file AudioEngine.cpp.
|
private |
Clear all audio buffers.
Definition at line 860 of file AudioEngine.cpp.
| void clearNextPatterns | ( | ) |
Definition at line 2172 of file AudioEngine.cpp.
|
private |
Definition at line 1400 of file AudioEngine.cpp.
|
private |
Ideally we just floor the provided tick.
When relocating to a specific tick, it's converted counterpart is stored as the transport position in frames, which is then used to calculate the tick start again. These conversions back and forth can introduce rounding error that get larger for larger tick numbers and could result in a computed start tick of 86753.999999934 when transport was relocated to 86754. As we do not want to cover notes prior to our current transport position, we have to account for such rounding errors.
Definition at line 2467 of file AudioEngine.cpp.
|
static |
Definition at line 384 of file AudioEngine.cpp.
|
private |
Definition at line 2371 of file AudioEngine.cpp.
|
static |
Calculates the number of frames that make up a tick.
Definition at line 377 of file AudioEngine.cpp.
| AudioOutput * createAudioDriver | ( | const Preferences::AudioDriver & | driver | ) |
Create an audio driver using audioEngine_process() as its argument based on the provided choice and calling their init() function to trigger their initialization.
For a listing of all possible choices, please see H2Core::Preferences::AudioDriver.
| driver | Specific audio driver. |
Definition at line 904 of file AudioEngine.cpp.
| void flushAndAddNextPattern | ( | int | nPatternNumber | ) |
Add pattern nPatternNumber to #m_pNextPatterns as well as the whole content of #m_pPlayingPatterns.
After the next call to updatePlayingPatterns() only nPatternNumber will be left playing.
Definition at line 2177 of file AudioEngine.cpp.
|
inline |
Definition at line 790 of file AudioEngine.h.
|
static |
Definition at line 1174 of file AudioEngine.cpp.
|
private |
Definition at line 2964 of file AudioEngine.cpp.
| float getElapsedTime | ( | ) | const |
Definition at line 393 of file AudioEngine.cpp.
|
inline |
Returns the size of m_songNoteQueue.
Required to not end unit tests prematurely.
Definition at line 822 of file AudioEngine.h.
| long long getLeadLagInFrames | ( | double | fTick | ) |
Calculates lead lag factor (in frames) relative to the transport position fTick.
During the humanization the onset of a Note will be moved Note::__lead_lag times the value calculated by this function.
Definition at line 2790 of file AudioEngine.cpp.
|
static |
Maximum lead lag factor in ticks.
During humanization the onset of a Note will be moved Note::__lead_lag times the value calculated by this function.
Definition at line 2786 of file AudioEngine.cpp.
|
inline |
Definition at line 759 of file AudioEngine.h.
|
inline |
Definition at line 767 of file AudioEngine.h.
|
inline |
Definition at line 775 of file AudioEngine.h.
|
inline |
Definition at line 819 of file AudioEngine.h.
|
inline |
Definition at line 794 of file AudioEngine.h.
|
inline |
Definition at line 798 of file AudioEngine.h.
|
inline |
Definition at line 810 of file AudioEngine.h.
| const PatternList * getNextPatterns | ( | ) | const |
Definition at line 2815 of file AudioEngine.cpp.
|
inlineprivate |
Definition at line 783 of file AudioEngine.h.
| const PatternList * getPlayingPatterns | ( | ) | const |
Definition at line 2808 of file AudioEngine.cpp.
|
inline |
Definition at line 771 of file AudioEngine.h.
|
inline |
Definition at line 802 of file AudioEngine.h.
| Sampler * getSampler | ( | ) | const |
Definition at line 181 of file AudioEngine.cpp.
|
inline |
Definition at line 816 of file AudioEngine.h.
|
inline |
Definition at line 779 of file AudioEngine.h.
| Synth * getSynth | ( | ) | const |
Definition at line 187 of file AudioEngine.cpp.
|
inline |
Definition at line 813 of file AudioEngine.h.
|
private |
The audio driver was changed what possible changed the tick size - which depends on both the sample rate - too.
Thus, all frame-based variables might have become invalid.
Definition at line 1164 of file AudioEngine.cpp.
|
private |
In order to properly support H2Core::Song::LoopMode::Finishing - transport was already looped a couple of times and the user is pressing the loop button again to deactivate loop mode - we have to capture the number of loops already applied.
Definition at line 1155 of file AudioEngine.cpp.
|
private |
Keeps the selected pattern in line with the one the transport position resides in while in Song::Mode::Song.
If multiple patterns are present in the current column, the pattern recorded notes will be inserted in (bottom-most one) will be used.
Definition at line 1262 of file AudioEngine.cpp.
|
private |
Called whenever Hydrogen switches from Song::Mode::Song into Song::Mode::Pattern or the other way around.
Definition at line 1296 of file AudioEngine.cpp.
|
private |
Updates all notes in m_songNoteQueue to be still valid after a change in song size.
Definition at line 2310 of file AudioEngine.cpp.
|
private |
Updates all notes in m_songNoteQueue and m_midiNoteQueue to be still valid after a tempo change.
Definition at line 2278 of file AudioEngine.cpp.
|
private |
Updates the transport states and all notes in m_songNoteQueue and m_midiNoteQueue after adding or deleting a TempoMarker or enabling/disabling the Timeline.
If the Timeline is activated, adding or removing a TempoMarker does effectively has the same effects as a relocation with respect to the transport position in frames. It's tick counterpart, however, is not affected. This function ensures they are in sync again.
Definition at line 2241 of file AudioEngine.cpp.
|
private |
Definition at line 503 of file AudioEngine.cpp.
| bool isEndOfSongReached | ( | std::shared_ptr< TransportPosition > | pPos | ) | const |
Definition at line 524 of file AudioEngine.cpp.
|
private |
Definition at line 407 of file AudioEngine.cpp.
|
private |
Version of the locate() function intended to be directly used by frame-based audio drivers / servers.
| nFrame | Next position in frames. If the provided number is larger than the song length and loop mode is enabled, computeTickFromFrame() will wrap it. |
Definition at line 459 of file AudioEngine.cpp.
| void lock | ( | const char * | file, |
| unsigned int | line, | ||
| const char * | function ) |
Mutex locking of the AudioEngine.
Lock the AudioEngine for exclusive access by this thread.
Easy usage: Use the RIGHT_HERE macro like this...
More complex usage: The parameters file and function need to be pointers to null-terminated strings that are persistent for the entire session. This does not include the return value of std::string::c_str(), or QString::toLocal8Bit().data().
Tracing the locks: Enable the Logger::AELockTracing logging level. When you do, there will be a performance penalty because the strings will be converted to a QString. At the moment, you'll have to do that with your debugger.
Notes: The order of the parameters match GCC's implementation of the assert() macros.
| file | File the locking occurs in. |
| line | Line of the file the locking occurs in. |
| function | Function the locking occurs in. |
Definition at line 193 of file AudioEngine.cpp.
| void makeTrackPorts | ( | std::shared_ptr< Song > | pSong | ) |
Definition at line 538 of file AudioEngine.cpp.
| void noteOn | ( | Note * | note | ) |
Definition at line 2724 of file AudioEngine.cpp.
| void play | ( | ) |
Marks the audio engine to be started during the next call of the audioEngine_process() callback function.
If the JACK audio driver is used, a request to start transport is send to the JACK server instead.
Definition at line 2742 of file AudioEngine.cpp.
|
private |
Definition at line 1582 of file AudioEngine.cpp.
|
inlineprivate |
Definition at line 1308 of file AudioEngine.cpp.
| void raiseError | ( | unsigned | nErrorCode | ) |
Definition at line 1257 of file AudioEngine.cpp.
| void removePlayingPattern | ( | Pattern * | pPattern | ) |
Definition at line 2015 of file AudioEngine.cpp.
|
private |
Definition at line 1745 of file AudioEngine.cpp.
| void renameJackPorts | ( | std::shared_ptr< Song > | pSong | ) |
Hands the provided Song to JackAudioDriver::makeTrackOutputs() if pSong is not a null pointer and the audio driver m_pAudioDriver is an instance of the JackAudioDriver.
| pSong | Song for which per-track output ports should be generated. |
|
private |
Definition at line 339 of file AudioEngine.cpp.
|
private |
Definition at line 486 of file AudioEngine.cpp.
| void restartAudioDrivers | ( | ) |
Definition at line 1142 of file AudioEngine.cpp.
|
inline |
Definition at line 755 of file AudioEngine.h.
|
inline |
Definition at line 763 of file AudioEngine.h.
| void setNextBpm | ( | float | fNextBpm | ) |
Stores the new speed into a separate variable which will be adopted during the next processing cycle.
Setting this variable requires the audio engine to be locked! (Else, tempo handling within audioEngine_process() might be inconsistent and cause the playhead to glitch).
Definition at line 1683 of file AudioEngine.cpp.
|
inlineprivate |
Definition at line 786 of file AudioEngine.h.
|
inlineprivate |
Definition at line 806 of file AudioEngine.h.
Definition at line 1698 of file AudioEngine.cpp.
|
private |
Definition at line 1678 of file AudioEngine.cpp.
| void setupLadspaFX | ( | ) |
Definition at line 1233 of file AudioEngine.cpp.
| void startAudioDrivers | ( | ) |
Creation and initialization of all audio and MIDI drivers called in Hydrogen::Hydrogen().
Definition at line 1024 of file AudioEngine.cpp.
|
private |
Definition at line 312 of file AudioEngine.cpp.
|
static |
Definition at line 2822 of file AudioEngine.cpp.
| void stop | ( | ) |
Marks the audio engine to be stopped during the next call of the audioEngine_process() callback function.
If the JACK audio driver is used, a request to stop transport is send to the JACK server instead.
Definition at line 2762 of file AudioEngine.cpp.
| void stopAudioDrivers | ( | ) |
Stops all audio and MIDI drivers.
Definition at line 1103 of file AudioEngine.cpp.
|
private |
Definition at line 326 of file AudioEngine.cpp.
| void toggleNextPattern | ( | int | nPatternNumber | ) |
Add pattern nPatternNumber to #m_pNextPatterns or deletes it in case it is already present.
Definition at line 2152 of file AudioEngine.cpp.
|
overridevirtual |
Formatted string version for debugging purposes.
| sPrefix | String prefix which will be added in front of every new line |
| bShort | Instead of the whole content of all classes stored as members just a single unique identifier will be displayed without line breaks. |
Reimplemented from Base.
Definition at line 2841 of file AudioEngine.cpp.
| bool tryLock | ( | const char * | file, |
| unsigned int | line, | ||
| const char * | function ) |
Mutex locking of the AudioEngine.
This function is equivalent to lock() but returns false immediaely if the lock cannot be obtained immediately.
| file | File the locking occurs in. |
| line | Line of the file the locking occurs in. |
| function | Function the locking occurs in. |
Definition at line 222 of file AudioEngine.cpp.
| bool tryLockFor | ( | std::chrono::microseconds | duration, |
| const char * | file, | ||
| unsigned int | line, | ||
| const char * | function ) |
Mutex locking of the AudioEngine.
This function is equivalent to lock() but will only wait for a given period of time. If the lock cannot be acquired in this time, it will return false.
| duration | Time (in microseconds) to wait for the lock. |
| file | File the locking occurs in. |
| line | Line of the file the locking occurs in. |
| function | Function the locking occurs in. |
Definition at line 256 of file AudioEngine.cpp.
| void unlock | ( | ) |
Mutex unlocking of the AudioEngine.
Unlocks the AudioEngine to allow other threads access, and leaves #__locker untouched.
Definition at line 295 of file AudioEngine.cpp.
|
private |
Definition at line 724 of file AudioEngine.cpp.
|
private |
Takes all notes from the currently playing patterns, from the MIDI queue m_midiNoteQueue, and those triggered by the metronome and pushes them onto m_songNoteQueue for playback.
Definition at line 2477 of file AudioEngine.cpp.
|
private |
Definition at line 607 of file AudioEngine.cpp.
| void updatePlayingPatterns | ( | ) |
Update the list of currently played patterns associated with m_pTransportPosition and m_pQueuingPosition.
This works in three different ways.
Definition at line 2031 of file AudioEngine.cpp.
|
private |
Definition at line 2036 of file AudioEngine.cpp.
| void updateSongSize | ( | ) |
Function to be called every time the length of the current song does change, e.g.
by toggling a pattern or altering its length.
It will adjust both the current transport information as well as the note queues in order to prevent any glitches.
Definition at line 1765 of file AudioEngine.cpp.
|
private |
Definition at line 648 of file AudioEngine.cpp.
|
private |
Definition at line 556 of file AudioEngine.cpp.
| void updateVirtualPatterns | ( | ) |
Definition at line 2219 of file AudioEngine.cpp.
|
friend |
Definition at line 477 of file AudioEngine.h.
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
Is allowed to set m_state to State::Ready via setState()
|
friend |
Is allowed to call removeSong().
|
friend |
|
friend |
Is allowed to call setSong().
|
friend |
Is allowed to use locate() to directly set the position in frames as well as to used setColumn and setPatternTickPos to move the arrow in the SongEditorPositionRuler even when playback is stopped.
|
friend |
Definition at line 478 of file AudioEngine.h.
|
staticconstexpr |
Maximum value the standard deviation of the Gaussian distribution the random pitch contribution will be drawn from can take.
The actual standard deviation used during processing is this value multiplied with Instrument::__random_pitch_factor of the instrument associated with the particular Note.
Definition at line 152 of file AudioEngine.h.
|
staticconstexpr |
Maximum value the standard deviation of the Gaussian distribution the random pitch contribution will be drawn from can take.
The actual standard deviation used during processing is this value multiplied with Instrument::__random_pitch_factor of the instrument associated with the particular Note.
Definition at line 162 of file AudioEngine.h.
|
staticconstexpr |
Maximum value the standard deviation of the Gaussian distribution the random velocity contribution will be drawn from can take.
The actual standard deviation used during processing is this value multiplied with Song::m_fHumanizeVelocityValue.
Definition at line 142 of file AudioEngine.h.
|
private |
Definition at line 681 of file AudioEngine.h.
|
private |
Definition at line 699 of file AudioEngine.h.
|
private |
Mutex for synchronizing the access to the Song object and the AudioEngine.
It can be used lock the access using either lock() or try_lock() and to unlock it via unlock(). It is initialized in AudioEngine() and not explicitly exited.
Definition at line 627 of file AudioEngine.h.
|
private |
Definition at line 609 of file AudioEngine.h.
|
private |
Definition at line 610 of file AudioEngine.h.
|
private |
Definition at line 653 of file AudioEngine.h.
|
private |
Definition at line 698 of file AudioEngine.h.
|
private |
Definition at line 614 of file AudioEngine.h.
|
private |
Definition at line 617 of file AudioEngine.h.
|
private |
Definition at line 652 of file AudioEngine.h.
|
private |
Definition at line 697 of file AudioEngine.h.
|
private |
Definition at line 651 of file AudioEngine.h.
|
private |
Set to the total number of ticks in a Song.
Definition at line 659 of file AudioEngine.h.
|
private |
Thread ID of the current holder of the AudioEngine lock.
Definition at line 643 of file AudioEngine.h.
|
private |
Midi Note FIFO.
Definition at line 690 of file AudioEngine.h.
|
private |
Mutex for locking the pointer to the audio output buffer, allowing multiple readers.
When locking this and the AudioEngine, always lock the AudioEngine first using AudioEngine::lock() or AudioEngine::try_lock(). Always use a QMutexLocker to lock this mutex.
Definition at line 638 of file AudioEngine.h.
|
private |
State assigned during the next call to processTransport().
This is used to start and stop the audio engine.
Definition at line 679 of file AudioEngine.h.
|
private |
Indicates how many loops the transport already did when the user presses the Loop button again.
Definition at line 703 of file AudioEngine.h.
|
private |
Variable keeping track of the transport position in realtime.
Even if the audio engine is stopped, the variable will be incremented (as audioEngine_process() would do at the beginning of each cycle) to support realtime keyboard and MIDI event timing.
Definition at line 669 of file AudioEngine.h.
|
private |
Definition at line 603 of file AudioEngine.h.
|
private |
Definition at line 606 of file AudioEngine.h.
|
private |
|
private |
Pointer to the metronome.
Definition at line 695 of file AudioEngine.h.
|
private |
Definition at line 604 of file AudioEngine.h.
|
private |
Definition at line 605 of file AudioEngine.h.
|
private |
Definition at line 656 of file AudioEngine.h.
|
private |
Definition at line 601 of file AudioEngine.h.
|
private |
Definition at line 602 of file AudioEngine.h.
|
private |
Definition at line 655 of file AudioEngine.h.
|
private |
Definition at line 689 of file AudioEngine.h.
|
private |
Current state of the H2Core::AudioEngine.
Definition at line 674 of file AudioEngine.h.
|
staticconstexpr |
Maximum time (in frames) a note's position can be off due to the humanization (lead-lag).
Definition at line 167 of file AudioEngine.h.