Skip to content

Removed the first recording button from SongEditor as it has no use #7899

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: feature/recording-stage-one
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/Editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ private slots:
///
/// \param record If set true, the editor's toolbar will contain record
/// buttons in addition to the play and stop buttons.
Editor(bool record = false, bool record_step = false);
Editor(bool record = false, bool recordAccompany = false, bool record_step = false);
~Editor() override = default;


Expand Down
1 change: 0 additions & 1 deletion include/Song.h
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,6 @@ class LMMS_EXPORT Song : public TrackContainer

public slots:
void playSong();
void record();
void playAndRecord();
void playPattern();
void playMidiClip( const lmms::MidiClip * midiClipToPlay, bool loop = true );
Expand Down
1 change: 0 additions & 1 deletion include/SongEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ class SongEditorWindow : public Editor

protected slots:
void play() override;
void record() override;
void recordAccompany() override;
void stop() override;

Expand Down
8 changes: 0 additions & 8 deletions src/core/Song.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -506,14 +506,6 @@ void Song::playSong()



void Song::record()
{
m_recording = true;
// TODO: Implement
}




void Song::playAndRecord()
{
Expand Down
52 changes: 28 additions & 24 deletions src/gui/editors/Editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ void Editor::toggleMaximize()
isMaximized() ? showNormal() : showMaximized();
}

Editor::Editor(bool record, bool stepRecord) :
Editor::Editor(bool record, bool recordAccompany, bool stepRecord) :
m_toolBar(new DropToolBar(this)),
m_playAction(nullptr),
m_recordAction(nullptr),
Expand All @@ -104,36 +104,40 @@ Editor::Editor(bool record, bool stepRecord) :
m_toolBar->widgetForAction(action)->setObjectName(objectName);
};

// Set up play and record actions
auto createConditionalButton = [this, &addButton](
bool condition,
QAction*& targetAction,
const char* iconName,
const QString& text,
const char* slot,
const QString& objectName
) {
if (condition) {
targetAction = new QAction(embed::getIconPixmap(iconName), text, this);
connect(targetAction, SIGNAL(triggered()), this, slot);
addButton(targetAction, objectName);
}
};

// Play action setup
m_playAction = new QAction(embed::getIconPixmap("play"), tr("Play (Space)"), this);
m_stopAction = new QAction(embed::getIconPixmap("stop"), tr("Stop (Space)"), this);
connect(m_playAction, SIGNAL(triggered()), this, SLOT(play()));
addButton(m_playAction, "playButton");

m_recordAction = new QAction(embed::getIconPixmap("record"), tr("Record"), this);
m_recordAccompanyAction = new QAction(embed::getIconPixmap("record_accompany"), tr("Record while playing"), this);
m_toggleStepRecordingAction = new QAction(embed::getIconPixmap("record_step_off"), tr("Toggle Step Recording"), this);
// Conditional record, recordAccompany and stepRecord setup
createConditionalButton(record, m_recordAction, "record", tr("Record"), SLOT(record()), "recordButton");
createConditionalButton(recordAccompany, m_recordAccompanyAction, "record_accompany", tr("Record while playing"), SLOT(recordAccompany()), "recordAccompanyButton");
createConditionalButton(stepRecord, m_toggleStepRecordingAction, "record_step_off", tr("Toggle Step Recording"), SLOT(toggleStepRecording()), "stepRecordButton");

// Set up connections
connect(m_playAction, SIGNAL(triggered()), this, SLOT(play()));
connect(m_recordAction, SIGNAL(triggered()), this, SLOT(record()));
connect(m_recordAccompanyAction, SIGNAL(triggered()), this, SLOT(recordAccompany()));
connect(m_toggleStepRecordingAction, SIGNAL(triggered()), this, SLOT(toggleStepRecording()));
// Stop action setup
m_stopAction = new QAction(embed::getIconPixmap("stop"), tr("Stop (Space)"), this);
connect(m_stopAction, SIGNAL(triggered()), this, SLOT(stop()));
addButton(m_stopAction, "stopButton");

// Shortcuts for actions setup
new QShortcut(Qt::Key_Space, this, SLOT(togglePlayStop()));
new QShortcut(QKeySequence(combine(Qt::SHIFT, Qt::Key_Space)), this, SLOT(togglePause()));
new QShortcut(QKeySequence(combine(Qt::SHIFT, Qt::Key_F11)), this, SLOT(toggleMaximize()));

// Add actions to toolbar
addButton(m_playAction, "playButton");
if (record)
{
addButton(m_recordAction, "recordButton");
addButton(m_recordAccompanyAction, "recordAccompanyButton");
}
if(stepRecord)
{
addButton(m_toggleStepRecordingAction, "stepRecordButton");
}
addButton(m_stopAction, "stopButton");
}

QAction *Editor::playAction() const
Expand Down
2 changes: 1 addition & 1 deletion src/gui/editors/PianoRoll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4728,7 +4728,7 @@ void PianoRoll::changeSnapMode()
}

PianoRollWindow::PianoRollWindow() :
Editor(true, true),
Editor(true, true, true),
m_editor(new PianoRoll())
{
setCentralWidget( m_editor );
Expand Down
15 changes: 2 additions & 13 deletions src/gui/editors/SongEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,7 @@ ComboBoxModel *SongEditor::snappingModel() const


SongEditorWindow::SongEditorWindow(Song* song) :
Editor(true, false),
Editor(false, true, false),
m_editor(new SongEditor(song)),
m_crtlAction( nullptr ),
m_snapSizeLabel( new QLabel( m_toolBar ) )
Expand All @@ -927,7 +927,6 @@ SongEditorWindow::SongEditorWindow(Song* song) :

// Set up buttons
m_playAction->setToolTip(tr("Play song (Space)"));
m_recordAction->setToolTip(tr("Record samples from Audio-device"));
m_recordAccompanyAction->setToolTip(tr("Record samples from Audio-device while playing song or pattern track"));
m_stopAction->setToolTip(tr( "Stop song (Space)" ));

Expand Down Expand Up @@ -1033,11 +1032,7 @@ SongEditorWindow::SongEditorWindow(Song* song) :
// disable the record buttons.
if (!Engine::audioEngine()->captureDeviceAvailable())
{
for (auto &recordAction : {m_recordAccompanyAction, m_recordAction})
{
recordAction->setEnabled(false);
recordAction->setToolTip(tr("Recording is unavailable: try connecting an input device or switching backend"));
}
m_recordAccompanyAction->setToolTip(tr("Recording is unavailable: try connecting an input device or switching backend"));
}
}

Expand Down Expand Up @@ -1099,12 +1094,6 @@ void SongEditorWindow::play()
}


void SongEditorWindow::record()
{
m_editor->m_song->record();
}




void SongEditorWindow::recordAccompany()
Expand Down