hydrogen 1.1.1
Hydrogen.cpp File Reference

Data Structures

struct  compare_pNotes
 

Namespaces

namespace  H2Core
 

Functions

void audioEngine_init ()
 Initialization of the H2Core::AudioEngine called in Hydrogen::Hydrogen(). More...
 
void audioEngine_destroy ()
 
int audioEngine_start (bool bLockEngine=false, unsigned nTotalFrames=0)
 If the audio engine is in state m_audioEngineState STATE_READY, this function will. More...
 
void audioEngine_stop (bool bLockEngine=false)
 If the audio engine is in state m_audioEngineState STATE_PLAYING, this function will. More...
 
void audioEngine_setSong (Song *pNewSong)
 Updates the global objects of the audioEngine according to new Song. More...
 
void audioEngine_removeSong ()
 Does the necessary cleanup of the global objects in the audioEngine. More...
 
static void audioEngine_noteOn (Note *note)
 
int audioEngine_process (uint32_t nframes, void *arg)
 Main audio processing function called by the audio drivers whenever there is work to do. More...
 
void audioEngine_clearNoteQueue ()
 
void audioEngine_process_checkBPMChanged (Song *pSong)
 Update the tick size based on the current tempo without affecting the current transport position. More...
 
void audioEngine_process_playNotes (unsigned long nframes)
 
void audioEngine_process_transport (unsigned nFrames)
 Updating the TransportInfo of the audio driver. More...
 
unsigned audioEngine_renderNote (Note *pNote, const unsigned &nBufferSize)
 
int audioEngine_updateNoteQueue (unsigned nFrames)
 Takes all notes from the current patterns, from the MIDI queue m_midiNoteQueue, and those triggered by the metronome and pushes them onto m_songNoteQueue for playback. More...
 
void audioEngine_prepNoteQueue ()
 
int findPatternInTick (int nTick, bool bLoopMode, int *pPatternStartTick)
 Find a PatternList corresponding to the supplied tick position nTick. More...
 
void audioEngine_seek (long long nFrames, bool bLoopMode=false)
 
void audioEngine_restartAudioDrivers ()
 Restart all audio and midi drivers by calling first audioEngine_stopAudioDrivers() and then audioEngine_startAudioDrivers(). More...
 
void audioEngine_startAudioDrivers ()
 Creation and initialization of all audio and MIDI drivers called in Hydrogen::Hydrogen(). More...
 
void audioEngine_stopAudioDrivers ()
 Stops all audio and MIDI drivers. More...
 
timeval currentTime2 ()
 Gets the current time. More...
 
int randomValue (int max)
 
float getGaussian (float z)
 
void audioEngine_raiseError (unsigned nErrorCode)
 
void audioEngine_process_clearAudioBuffers (uint32_t nFrames)
 Clear all audio buffers. More...
 
void audioEngine_setupLadspaFX ()
 
void audioEngine_renameJackPorts (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. More...
 
AudioOutput * createDriver (const QString &sDriver)
 Create an audio driver using audioEngine_process() as its argument based on the provided choice and calling their init() function to trigger their initialization. More...
 

Variables

float m_fMasterPeak_L = 0.0f
 Master peak (left channel) More...
 
float m_fMasterPeak_R = 0.0f
 Master peak (right channel) More...
 
float m_fProcessTime = 0.0f
 time used in process function More...
 
float m_fMaxProcessTime = 0.0f
 max ms usable in process with no xrun More...
 
float m_fNewBpmJTM = 120
 Fallback speed in beats per minute. More...
 
AudioOutput * m_pAudioDriver = nullptr
 Pointer to the current instance of the audio driver. More...
 
QMutex mutex_OutputPointer
 Mutex for locking the pointer to the audio output buffer, allowing multiple readers. More...
 
MidiInput * m_pMidiDriver = nullptr
 MIDI input. More...
 
MidiOutput * m_pMidiDriverOut = nullptr
 MIDI output. More...
 
std::priority_queue< Note *, std::deque< Note * >, compare_pNotes > m_songNoteQueue
 Song Note FIFO. More...
 
std::deque< Note * > m_midiNoteQueue
 Midi Note FIFO. More...
 
PatternList * m_pNextPatterns
 Patterns to be played next in Song::PATTERN_MODE. More...
 
bool m_bAppendNextPattern
 Add the next pattern to the list instead of replace. More...
 
bool m_bDeleteNextPattern
 Delete the next pattern from the list. More...
 
PatternList * m_pPlayingPatterns
 PatternList containing all Patterns currently played back. More...
 
int m_nSongPos
 Index of the current PatternList in the Song::m_pPatternGroupSequence. More...
 
int m_nSelectedPatternNumber
 Index of the pattern selected in the GUI or by a MIDI event. More...
 
int m_nSelectedInstrumentNumber
 Instrument currently focused/selected in the GUI. More...
 
Instrument * m_pMetronomeInstrument = nullptr
 Pointer to the metronome. More...
 
int m_audioEngineState = STATE_UNINITIALIZED
 Current state of the H2Core::AudioEngine. More...
 
float m_fFXPeak_L [MAX_FX]
 
float m_fFXPeak_R [MAX_FX]
 
int m_nPatternStartTick = -1
 Beginning of the current pattern in ticks. More...
 
unsigned int m_nPatternTickPosition = 0
 Ticks passed since the beginning of the current pattern. More...
 
int m_nSongSizeInTicks = 0
 Set to the total number of ticks in a Song in findPatternInTick() if Song::SONG_MODE is chosen and playback is at least in the second loop. More...
 
struct timeval m_currentTickTime
 Updated in audioEngine_updateNoteQueue(). More...
 
unsigned long m_nRealtimeFrames = 0
 Variable keeping track of the transport position in realtime. More...
 
unsigned int m_naddrealtimenotetickposition = 0