63 std::shared_ptr<Song> pSong = pHydrogen->
getSong();
67 setWindowTitle( tr(
"Song Editor" ) );
71 pBackPanel->setObjectName(
"SongEditorBackPanel" );
73 pBackPanel->
setPixmap(
"/songEditor/bg_topPanel.png" );
78 pCommonStrings->getTimelineBigButton(),
false, QSize(),
79 pCommonStrings->getTimelineEnabled() );
86 pCommonStrings->getTimelineDisabledTimebaseListener() );
91 pCommonStrings->getTimelineDisabledPatternMode() );
101 Button *newPatBtn =
new Button( pBackPanel, QSize( 25, 21 ),
Button::Type::Push,
"plus.svg",
"",
false, QSize( 15, 15 ), tr(
"Create new pattern") );
102 newPatBtn->move( 64, 25 );
103 connect( newPatBtn, SIGNAL( clicked() ),
this, SLOT(
newPatBtnClicked() ) );
107 "down.svg",
"",
false, QSize( 7, 7 ),
108 tr(
"Move the selected pattern down"),
false,
true, 2 );
114 "up.svg",
"",
false, QSize( 7, 7 ),
115 tr(
"Move the selected pattern up"),
false,
true, 2 );
141 "",
false, QSize( 21, 17 ),
142 pCommonStrings->getPatternEditorLocked(),
150 "lock_open.svg",
"",
false,
152 pCommonStrings->getPatternEditorLocked(),
176 "",
false, QSize( 17, 13 ),
177 tr(
"selected pattern mode"),
186 "multiple_layers.svg",
"",
false,
188 tr(
"stacked pattern mode"),
198 if ( pHydrogen->
getSong() ==
nullptr ||
210 m_pHScrollBar->setObjectName(
"SongEditorPanel HScrollBar" );
221 connect( pZoomOutBtn, SIGNAL( clicked() ),
this, SLOT(
zoomInBtnClicked() ) );
240 pCommonStrings->getBigMuteButton(),
241 true, QSize(), tr(
"Mute playback track" ),
273 QHBoxLayout *pHZoomLayout =
new QHBoxLayout();
274 pHZoomLayout->setSpacing( 0 );
275 pHZoomLayout->setContentsMargins( 0, 0, 0, 0 );
279 pHZoomLayout->addWidget( pZoomInBtn );
280 pHZoomLayout->addWidget( pZoomOutBtn );
282 QWidget *pHScrollbarPanel =
new QWidget();
283 pHScrollbarPanel->setLayout( pHZoomLayout );
372 m_pVScrollBar->setObjectName(
"SongEditorPanel VScrollBar" );
385 QGridLayout *pGridLayout =
new QGridLayout();
386 pGridLayout->setSpacing( 0 );
387 pGridLayout->setContentsMargins( 0, 0, 0, 0 );
389 pGridLayout->addWidget( pBackPanel, 0, 0 );
396 Qt::AlignVCenter | Qt::AlignRight );
397 pGridLayout->addWidget( pHScrollbarPanel, 3, 1 );
403 this->setLayout( pGridLayout );
404 QPalette defaultPalette;
405 defaultPalette.setColor( QPalette::Window, QColor( 58, 62, 72 ) );
406 this->setPalette( defaultPalette );
434 auto pAudioEngine = pHydrogen->getAudioEngine();
435 std::shared_ptr<Song> pSong = pHydrogen->getSong();
453 int nPlayHeadPosition = pAudioEngine->getTransportPosition()->getColumn() *
459 int nIncrement = 100;
460 if ( nIncrement > std::round(
static_cast<float>(nWidth) / 3 ) ) {
461 nIncrement = std::round(
static_cast<float>(nWidth) / 3 );
466 if ( nPlayHeadPosition > ( x + nWidth - std::floor(
static_cast<float>( nIncrement ) / 2 ) ) ) {
469 else if ( nPlayHeadPosition < x ) {
493 float fNewPeak_L = pInstrument->get_peak_l();
494 pInstrument->set_peak_l( 0.0f );
496 float fNewPeak_R = pInstrument->get_peak_r();
497 pInstrument->set_peak_r( 0.0f );
504 if ( fNewPeak_L >= fOldPeak_L) {
510 if ( fNewPeak_R >= fOldPeak_R) {
520 static bool inside =
false;
532 static bool inside =
false;
550 auto pSong = pHydrogen->getSong();
565 auto pSong = pHydrogen->getSong();
577 auto pSong = pHydrogen->getSong();
601 auto pPlaybackCompo = pHydrogen->getAudioEngine()->getSampler()->
602 getPlaybackTrackInstrument()->get_components()->front();
621 std::shared_ptr<Song> pSong = pHydrogen->
getSong();
622 PatternList *pPatternList = pSong->getPatternList();
626 if ( pDialog->exec() == QDialog::Accepted ) {
629 nRow = pPatternList->
size();
668 std::shared_ptr<Song> pSong = pHydrogen->
getSong();
669 PatternList *pPatternList = pSong->getPatternList();
688 if ( QMessageBox::information(
690 tr(
"Warning, this will erase your pattern sequence.\nAre you sure?"),
691 QMessageBox::Ok | QMessageBox::Cancel,
692 QMessageBox::Cancel ) == QMessageBox::Cancel ) {
707 auto pAudioEngine = pHydrogen->getAudioEngine();
709 std::vector<PatternList*> *pPatternGroupsVect = pHydrogen->getSong()->getPatternGroupVector();
710 for (uint i = 0; i < pPatternGroupsVect->size(); i++) {
711 PatternList *pPatternList = (*pPatternGroupsVect)[i];
712 pPatternList->
clear();
715 pPatternGroupsVect->clear();
718 pHydrogen->getSong()->readTempPatternList( filename );
719 pHydrogen->updateSongSize();
720 pHydrogen->updateSelectedPattern(
false );
721 pAudioEngine->unlock();
779 if ( pHydrogen->isPatternEditorLocked() ) {
783 if ( pHydrogen->getAudioEngine()->getState() ==
882 auto pSong = pHydrogen->getSong();
883 if ( pHydrogen->getAudioEngine()->getState() ==
885 pHydrogen->sequencer_stop();
888 QString sPath, sFilename;
890 if ( ! pSong->getPlaybackTrackFilename().isEmpty() ) {
891 QFileInfo fileInfo( pSong->getPlaybackTrackFilename() );
892 sFilename = pSong->getPlaybackTrackFilename();
893 sPath = fileInfo.absoluteDir().absolutePath();
900 sPath = QDir::homePath();
907 QStringList filenameList;
909 if ( pFileBrowser->exec() == QDialog::Accepted ) {
914 if ( sFilename.isEmpty() ||
923 if( filenameList.size() != 3 ) {
927 if ( filenameList[2].isEmpty() ) {
931 pHydrogen->loadPlaybackTrack( filenameList[2] );
940 if ( pHydrogen->getSong() ==
nullptr ||
983 auto pSong = pHydrogen->getSong();
985 if ( pSong ==
nullptr ) {
990 const float fNewValue = std::round( pFader->
getValue() * 100 ) / 100;
992 if ( pSong->getPlaybackTrackVolume() != fNewValue ) {
993 pSong->setPlaybackTrackVolume( fNewValue );
995 tr(
"Playback volume set to" )
996 .append( QString(
" [%1]" ).arg( fNewValue ) ),
997 "SongEditorPanel:PlaybackTrackVolume" );
1007 if ( pHydrogen->getSelectedPatternNumber() == -1 ) {
1014 * nGridHeight + nGridHeight/2 ),
1065 pCommonStrings->getTimelineDisabledTimebaseListener() );
1068 m_pTimelineBtn->setToolTip( pCommonStrings->getTimelineEnabled() );
1077 m_pTimelineBtn->setToolTip( pCommonStrings->getTimelineDisabledPatternMode() );
1081 m_pTimelineBtn->setToolTip( pCommonStrings->getTimelineEnabled() );
1099 if ( ! pHydrogen->isTimelineEnabled() &&
m_pTimelineBtn->isChecked() ) {
1101 }
else if ( pHydrogen->isTimelineEnabled() && !
m_pTimelineBtn->isChecked() ) {
1119 QString sMessage = QString(
"%1 = %2" )
1120 .arg( pCommonStrings->getTimelineBigButton() )
1121 .arg( bActive ? pCommonStrings->getStatusOn() : pCommonStrings->getStatusOff() );
1143 QString sMessage = QString(
"%1 = %2" )
1144 .arg( pCommonStrings->getTimelineBigButton() )
1145 .arg( bEnabled ? pCommonStrings->getStatusEnabled() :
1146 pCommonStrings->getStatusDisabled() );
1163 int nPatternInView = -1;
#define RIGHT_HERE
Macro intended to be used for the logging of the locking of the H2Core::AudioEngine.
This dialog is used to preview audiofiles.
QString getSelectedDirectory()
QStringList getSelectedFiles()
static constexpr int m_nMinimumHeight
@ Vertical
Only used for the playback track in the SongEditorPanel.
@ Playing
Transport is rolling.
Sampler * getSampler() const
static bool dir_readable(const QString &path, bool silent=false)
returns true if the given path is a readable regular directory
static QString tmp_file_path(const QString &base)
touch a temporary file under tmp_dir() and return it's path.
JackAudioDriver::Timebase getJackTimebaseState() const
std::shared_ptr< Song > getSong() const
Get the current song.
void setIsTimelineActivated(bool bEnabled)
Wrapper around both Song::setIsTimelineActivated (recent) and Preferences::setUseTimelinebpm() (forme...
Song::ActionMode getActionMode() const
Song::PlaybackTrack getPlaybackTrackState() const
Wrapper around Song::getPlaybackTrackState().
Song::Mode getMode() const
int getSelectedPatternNumber() const
void mutePlaybackTrack(const bool bMuted)
Wrapper around Song::setPlaybackTrackEnabled().
static Hydrogen * get_instance()
Returns the current Hydrogen instance __instance.
void setIsPatternEditorLocked(bool bValue)
AudioEngine * getAudioEngine() const
void setIsModified(bool bIsModified)
Wrapper around Song::setIsModified() that checks whether a song is set.
bool isPatternEditorLocked() const
Convenience function checking whether using the Pattern Editor is locked in the song settings and the...
@ Listener
An external program is Timebase controller and Hydrogen will disregard all tempo markers on the Timel...
static Timebase TimebaseFromInt(int nState)
PatternList is a collection of patterns.
void clear()
empty the pattern list
int size() const
returns the numbers of patterns
Pattern class is a Note container.
const QString & get_info() const
get the category of the pattern
const QString & get_name() const
set the category of the pattern
const QString & get_category() const
set the length of the pattern
Manager for User Preferences File (singleton)
float getMixerFalloffSpeed()
void setShowAutomationArea(bool value)
static Preferences * get_instance()
Returns a pointer to the current Preferences singleton stored in __instance.
void setShowPlaybackTrack(bool val)
void setSongEditorGridWidth(unsigned value)
bool showInstrumentPeaks()
void setSongEditorGridHeight(unsigned value)
bool getShowAutomationArea()
bool getShowPlaybackTrack() const
void setLastOpenPlaybackTrackDirectory(QString sPath)
QString getLastOpenPlaybackTrackDirectory() const
std::shared_ptr< Instrument > getPlaybackTrackInstrument() const
@ selectMode
Holding a pressed left mouse key will draw a rectangle to select a group of Notes.
@ drawMode
Holding a pressed left mouse key will draw/delete patterns in all grid cells encountered.
@ Unavailable
No proper playback track file set yet.
@ Muted
Valid file set but the playback track is muted via the GUI.
@ Stacked
An arbitrary number of pattern can be played.
@ Selected
Only one pattern - the one currently selected in the GUI - will be played back.
void addEventListener(EventListener *pListener)
static HydrogenApp * get_instance()
Returns the instance of HydrogenApp class.
std::shared_ptr< CommonStrings > getCommonStrings()
QUndoStack * m_pUndoStack
void showStatusBarMessage(const QString &sMessage, const QString &sCaller="")
void preferencesChanged(H2Core::Preferences::Changes changes)
Propagates a change in the Preferences through the GUI.
Pattern Properties Dialog.
static constexpr int nPlayheadWidth
void updateAll()
Update and redraw all...
Button * m_pPlaySelectedMultipleBtn
void timelineBtnClicked()
virtual void playbackTrackChangedEvent() override
QScrollArea * m_pPlaybackTrackScrollView
virtual void timelineActivationEvent() override
QScrollArea * m_pPositionRulerScrollView
Button * m_pViewTimelineBtn
void updatePositionRuler()
void setTimelineEnabled(bool bEnabled)
SongEditorPanel(QWidget *parent)
static const int m_nPatternListWidth
QScrollArea * m_pEditorScrollView
void viewTimelineBtnClicked()
void faderChanged(WidgetWithInput *pRef)
QStackedWidget * m_pWidgetStack
void updatePlayHeadPosition()
void newPatBtnClicked()
Create a new pattern.
void hScrollTo(int value)
void restoreGroupVector(QString filename)
virtual void stateChangedEvent(H2Core::AudioEngine::State) override
void editPlaybackTrackBtnClicked()
void toggleAutomationAreaVisibility()
void downBtnClicked()
Move down a pattern in the patternList.
QScrollBar * m_pHScrollBar
void highlightPatternEditorLocked(bool bUseRedBackground)
Turns the background color of m_pPatternEditorLockedBtn red to signal the user her last action was no...
SongEditorPositionRuler * m_pPositionRuler
virtual void resizeEvent(QResizeEvent *ev) override
bool getTimelineActive() const
void upBtnClicked()
Move up a pattern in the patternList.
virtual void patternModifiedEvent() override
void automationPathPointRemoved(float x, float y)
void activateSelectMode(bool bActivate)
QScrollBar * m_pVScrollBar
bool getTimelineEnabled() const
virtual void stackedModeActivationEvent(int) override
virtual void songModeActivationEvent() override
Button * m_pPatternEditorLockedBtn
void activateStackedMode(bool bActivate)
Used by the shotlist during automated generation of images for the manual.
void resyncExternalScrollBar()
void setTimelineActive(bool bActive)
Button * m_pPlaySelectedSingleBtn
Fader * m_pPlaybackTrackFader
Button * m_pViewPlaybackBtn
SongEditor * m_pSongEditor
QScrollArea * m_pAutomationPathScrollView
void updatePlaybackTrackIfNecessary()
virtual void playingPatternsChangedEvent() override
virtual void updateSongEvent(int) override
LCDCombo * m_pAutomationCombo
Button * m_pClearPatternSeqBtn
void vScrollTo(int value)
QScrollArea * m_pPatternListScrollView
Button * m_pSelectionModeBtn
Button * m_pMutePlaybackBtn
AutomationPathView * m_pAutomationPathView
void updatePlaybackFaderPeaks()
static constexpr int m_nMinimumHeight
SongEditorPatternList * m_pPatternList
void viewPlaybackTrackBtnClicked()
Button * m_pEditPlaybackBtn
virtual void selectedPatternChangedEvent() override
virtual void gridCellToggledEvent() override
void automationPathPointMoved(float ox, float oy, float tx, float ty)
virtual void patternEditorLockedEvent() override
virtual void jackTimebaseStateChangedEvent(int nState) override
void automationPathPointAdded(float x, float y)
bool m_bLastIsTimelineActivated
Button * m_pPatternEditorUnlockedBtn
PlaybackTrackWaveDisplay * m_pPlaybackTrackWaveDisplay
virtual void actionModeChangeEvent(int nValue) override
Updates the associated buttons if the action mode was changed within the core.
Song editor pattern list.
void onPreferencesChanged(H2Core::Preferences::Changes changes)
void onPreferencesChanged(H2Core::Preferences::Changes changes)