25#include <core/config.h>
133 void setSong ( std::shared_ptr<Song> newSong,
bool bRelinking =
true );
152 int getColumnForTick(
long nTick,
bool bLoopMode,
long* pPatternStartTick )
const;
306 bool bNeedsLock =
true,
307 bool bForce =
false );
375 double fCompressionLevel = 0.0 );
491 QString
toQString(
const QString& sPrefix =
"",
bool bShort =
true )
const override;
The audio engine deals with two distinct TransportPosition.
Base abstract class for audio output classes.
bool isTimelineEnabled() const
Convenience function checking whether using the Timeline tempo is set in the Preferences,...
GUIState m_GUIState
Specifies whether the Qt5 GUI is active.
bool getIsExportSessionActive() const
void setMode(Song::Mode mode)
Wrapper around Song::setMode() which also triggers EVENT_SONG_MODE_ACTIVATION and should be used by a...
bool m_bExportSessionIsActive
void initBeatcounter()
Auxiliary function setting a bunch of global variables.
JackAudioDriver::Timebase getJackTimebaseState() const
std::shared_ptr< Timeline > m_pTimeline
Local instance of the Timeline object.
int getHihatOpenness() const
bool getSessionDrumkitNeedsRelinking() const
void midi_noteOn(Note *note)
void setLastMidiEventParameter(int nParam)
int m_nSelectedPatternNumber
Index of the pattern selected in the GUI or by a MIDI event.
Hydrogen()
Constructor, entry point, and initialization of the Hydrogen application.
long getTickForColumn(int nColumn) const
Get the total number of ticks passed up to a nColumn / pattern group.
int m_nStartOffset
ms default 0
Tempo
Specifies where the AudioEngine does get its current tempo updates from.
@ Timeline
Only tempo markers on the Timeline are considered.
@ Jack
Hydrogen will disregard all internal tempo settings and uses the ones provided by the JACK server ins...
@ Song
BeatCounter, TapTempo, OSC and MIDI commands as well as the BPM widget in the PlayerControl are used ...
bool hasJackAudioDriver() const
void sequencer_stop()
Stop the internal sequencer.
void recreateOscServer()
Destroys and recreates the OscServer singleton in order to adopt a new OSC port.
void renameJackPorts(std::shared_ptr< Song > pSong)
Calls audioEngine_renameJackPorts() if Preferences::m_bJackTrackOuts is set to true.
~Hydrogen()
Destructor taking care of most of the clean up.
std::shared_ptr< Song > getSong() const
Get the current song.
int m_nSelectedInstrumentNumber
Instrument currently focused/selected in the GUI.
void toggleNextPattern(int nPatternNumber)
Wrapper around AudioEngine::toggleNextPattern().
QString getLastLoadedDrumkitPath() const
std::list< std::shared_ptr< Instrument > > __instrument_death_row
Deleting instruments too soon leads to potential crashes.
void removeInstrument(int nInstrumentNumber)
Delete an Instrument.
void setIsTimelineActivated(bool bEnabled)
Wrapper around both Song::setIsTimelineActivated (recent) and Preferences::setUseTimelinebpm() (forme...
int m_nInstrumentLookupTable[MAX_INSTRUMENTS]
midi lookuptable
bool addRealtimeNote(int instrument, float velocity, bool noteoff=false, int msg1=0)
int getSelectedInstrumentNumber() const
void setPatternMode(Song::PatternMode mode)
Wrapper around Song::setPatternMode() which also triggers EVENT_STACKED_MODE_ACTIVATION and should be...
void onTapTempoAccelEvent()
Song::ActionMode getActionMode() const
bool isUnderSessionManagement() const
void setTimeline(std::shared_ptr< Timeline >)
void setSong(std::shared_ptr< Song > newSong, bool bRelinking=true)
Sets the current song __song to newSong.
MidiInput * getMidiInput() const
Used to display midi driver info.
bool flushAndAddNextPattern(int nPatternNumber)
Wrapper around AudioEngine::flushAndAddNextPattern().
void setbeatsToCount(int beatstocount)
Updates m_nbeatsToCount.
void previewInstrument(std::shared_ptr< Instrument > pInstr)
GUIState
Specifies the state of the Qt GUI.
@ notReady
There is a GUI but it is not ready yet (during startup).
@ unavailable
No GUI available.
@ ready
There is a working GUI.
Song::PlaybackTrack getPlaybackTrackState() const
Wrapper around Song::getPlaybackTrackState().
int m_nLastRecordedMIDINoteTick
Onset of the recorded last in addRealtimeNote().
float m_ntaktoMeterCompute
beatcounter note length
std::shared_ptr< Song > __song
Pointer to the current song.
void setTapTempo(float fInterval)
Tempo getTempoSource() const
int getColumnForTick(long nTick, bool bLoopMode, long *pPatternStartTick) const
Find a PatternList/column corresponding to the supplied tick position nTick.
double m_nBeatDiffs[16]
beat diff
Song::Mode getMode() const
int getSelectedPatternNumber() const
static void create_instance()
Creates all the instances used within Hydrogen in the right order.
void updateVirtualPatterns()
Processes the patterns added to any virtual ones in the PatternList of the current Song and ensure bo...
void setSelectedInstrumentNumber(int nInstrument, bool bTriggerEvent=true)
std::shared_ptr< Timeline > getTimeline() const
SoundLibraryDatabase * m_pSoundLibraryDatabase
void mutePlaybackTrack(const bool bMuted)
Wrapper around Song::setPlaybackTrackEnabled().
AudioEngine * m_pAudioEngine
Central instance of the audio engine.
MidiMessage::Event m_lastMidiEvent
Cache last incoming MIDI event to be used in MidiSenseWidget.
static Hydrogen * get_instance()
Returns the current Hydrogen instance __instance.
void previewSample(Sample *pSample)
Song::PatternMode getPatternMode() const
static Hydrogen * __instance
Static reference to the Hydrogen singleton.
void __kill_instruments()
void updateSelectedPattern(bool bNeedsLock=true)
Updates the selected pattern to the one recorded note will be inserted to.
float getJackTimebaseControllerBpm() const
void setIsPatternEditorLocked(bool bValue)
MidiOutput * getMidiOutput() const
void setGUIState(const GUIState state)
void startExportSong(const QString &filename)
Export a song to a wav file.
int m_nTempoChangeCounter
count tempochanges for timeArray
int m_nbeatsToCount
beatcounter beats to count
bool getSessionIsExported() const
int m_nEventCount
beatcounter event
AudioEngine * getAudioEngine() const
void setNoteLength(float notelength)
void releaseJackTimebaseControl()
Calling JackAudioDriver::releaseTimebaseControl() directly from the GUI.
void setLastMidiEvent(MidiMessage::Event event)
int getLastMidiEventParameter() const
void setSessionIsExported(bool bIsExported)
std::shared_ptr< Instrument > getSelectedInstrument() const
int m_nHihatOpenness
Controls the instrument selection within a hihat group.
@ UNKNOWN_DRIVER
The provided input in createDriver() does not match any of the choices for H2Core::Preferences::Audio...
@ ERROR_STARTING_DRIVER
Unable to connect the audio driver stored in H2Core::AudioEngine::m_pAudioDriver in audioEngine_start...
@ JACK_CANNOT_ACTIVATE_CLIENT
@ JACK_ERROR_IN_PORT_REGISTER
Unable to register output ports for the JACK client using jack_port_register() (jack/jack....
@ OSC_CANNOT_CONNECT_TO_PORT
Unable to start the OSC server with the given port number.
@ JACK_CANNOT_CLOSE_CLIENT
The client of Hydrogen can not be disconnected from the JACK server using jack_client_close() (jack/j...
@ JACK_CANNOT_CONNECT_OUTPUT_PORT
Unable to connect either the JackAudioDriver::output_port_1 and the JackAudioDriver::output_port_name...
int m_nLastMidiEventParameter
void loadPlaybackTrack(QString sFilename)
Wrapper function for loading the playback track.
AudioOutput * getAudioOutput() const
Used to display audio driver info.
void setIsModified(bool bIsModified)
Wrapper around Song::setIsModified() that checks whether a song is set.
void initJackTimebaseControl()
Calling JackAudioDriver::initTimebaseControl() directly from the GUI.
void addInstrumentToDeathRow(std::shared_ptr< Instrument > pInstr)
Add pInstr to __instrument_death_row and triggers __kill_instruments().
bool instrumentHasNotes(std::shared_ptr< Instrument > pInst)
Test if an Instrument has some Note in the Pattern (used to test before deleting an Instrument)
QString toQString(const QString &sPrefix="", bool bShort=true) const override
Formatted string version for debugging purposes.
void setSessionDrumkitNeedsRelinking(bool bNeedsRelinking)
bool m_bSessionDrumkitNeedsRelinking
When using Hydrogen with session management it tries to keep all central files within a session folde...
bool isPatternEditorLocked() const
Convenience function checking whether using the Pattern Editor is locked in the song settings and the...
void setActionMode(Song::ActionMode mode)
Wrapper around Song::setActionMode() which also triggers EVENT_ACTION_MODE_CHANGE and should be used ...
void setSelectedPatternNumber(int nPat, bool bNeedsLock=true, bool bForce=false)
Sets m_nSelectedPatternNumber.
SoundLibraryDatabase * getSoundLibraryDatabase() const
bool hasJackTransport() const
void toggleOscServer(bool bEnable)
Starts/stops the OSC server.
bool getIsModified() const
Wrapper around Song::getIsModified() that checks whether a song is set.
bool startExportSession(int nSampleRate, int nSampleDepth, double fCompressionLevel=0.0)
timeval m_CurrentTime
timeval
QString getLastLoadedDrumkitName() const
CoreActionController * getCoreActionController() const
void setHihatOpenness(int nValue)
Song::Mode m_oldEngineMode
ms default 0
CoreActionController * m_pCoreActionController
Local instance of the CoreActionController object.
void raiseError(unsigned nErrorCode)
int m_nBeatCount
beatcounter beat to count
void sequencer_play()
Start the internal sequencer.
MidiMessage::Event getLastMidiEvent() const
Last received midi message.
GUIState getGUIState() const
bool m_bSessionIsExported
Indicates whether NSM session is saved or exported when entering the CoreActionController::saveSong()...
void recalculateRubberband(float fBpm)
Recalculates all Samples using RubberBand for a specific tempo fBpm.
Timebase
Whether Hydrogen or another program is in Timebase control.
Event
Subset of incoming MIDI events that will be handled by Hydrogen.
A note plays an associated instrument with a velocity left and right pan.
ActionMode
Defines the type of user interaction experienced in the SongEditor.
PlaybackTrack
Determines the state of the Playback track with respect to audio processing.
PatternMode
Determines how patterns will be added to AudioEngine::m_pPlayingPatterns if transport is in Song::Mod...
This class holds information about all installed soundlibrary items.
#define MAX_INSTRUMENTS
Maximum number of instruments allowed in Hydrogen.