Skip to content

Commit

Permalink
Master WAV output
Browse files Browse the repository at this point in the history
  • Loading branch information
excln committed Apr 11, 2017
1 parent 86e92e2 commit 23eb143
Show file tree
Hide file tree
Showing 10 changed files with 830 additions and 126 deletions.
17 changes: 17 additions & 0 deletions src/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "ExternalViewer.h"
#include "ExternalViewerTools.h"
#include "EditConfig.h"
#include "MasterOutDialog.h"


const char* MainWindow::SettingsGroup = "MainWindow";
Expand Down Expand Up @@ -66,6 +67,11 @@ MainWindow::MainWindow(QSettings *settings)
SharedUIHelper::RegisterGlobalShortcut(actionFileSaveAs);
QObject::connect(actionFileSaveAs, SIGNAL(triggered()), this, SLOT(FileSaveAs()));

actionFileMasterOut = new QAction(tr("Export WAV..."), this);
actionFileMasterOut->setShortcut(Qt::ShiftModifier + Qt::Key_F5);
SharedUIHelper::RegisterGlobalShortcut(actionFileMasterOut);
QObject::connect(actionFileMasterOut, SIGNAL(triggered(bool)), this, SLOT(MasterOut()));

actionFileQuit = new QAction(tr("Quit"), this);
#ifdef Q_OS_WIN
actionFileQuit->setShortcut(Qt::ControlModifier + Qt::Key_Q);
Expand Down Expand Up @@ -242,6 +248,8 @@ MainWindow::MainWindow(QSettings *settings)
menuFile->addSeparator();
menuFile->addAction(actionFileSave);
menuFile->addAction(actionFileSaveAs);
menuFile->addSeparator();
menuFile->addAction(actionFileMasterOut);
#ifdef Q_OS_WIN
menuFile->addSeparator();
menuFile->addAction(actionFileQuit);
Expand Down Expand Up @@ -569,6 +577,15 @@ void MainWindow::FileSaveAs()
}
}

void MainWindow::MasterOut()
{
if (!document)
return;
auto dialog = new MasterOutDialog(document, this);
dialog->exec();
delete dialog;
}

void MainWindow::closeEvent(QCloseEvent *event)
{
if (closing){
Expand Down
2 changes: 2 additions & 0 deletions src/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ class MainWindow : public QMainWindow
QAction *actionFileOpen;
QAction *actionFileSave;
QAction *actionFileSaveAs;
QAction *actionFileMasterOut;
QAction *actionFileQuit;

QAction *actionEditUndo;
Expand Down Expand Up @@ -184,6 +185,7 @@ private slots:
void FileOpen(QString path);
void FileSave();
void FileSaveAs();
void MasterOut();
void EditUndo();
void EditRedo();
void EditPreferences();
Expand Down
13 changes: 13 additions & 0 deletions src/MasterCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ void MasterCache::WorkerComplete(MasterCacheWorkerBase *worker)
workers.remove(worker);
workersMutex.unlock();
worker->deleteLater();
if (workers.isEmpty()){
emit Complete();
}
}
}

Expand Down Expand Up @@ -170,6 +173,16 @@ QPair<int, QAudioBuffer::S32F> MasterCache::GetData(int position)
return QPair<int, QAudioBuffer::S32F>(i->first, f);
}

QVector<QAudioBuffer::S32F> MasterCache::GetAllData() const
{
return data;
}

bool MasterCache::IsComplete() const
{
return workers.isEmpty();
}




Expand Down
5 changes: 4 additions & 1 deletion src/MasterCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,14 @@ private slots:

void GetData(int position, std::function<bool(int, QAudioBuffer::S32F)> f);
QPair<int, QAudioBuffer::S32F> GetData(int position);
QVector<QAudioBuffer::S32F> GetAllData() const;

bool IsComplete() const;

signals:
void Cleared();
void RegionUpdated(int position, int length);

void Complete();
};


Expand Down
Loading

0 comments on commit 23eb143

Please sign in to comment.