summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/canvas.cc11
-rw-r--r--src/filelist.cc7
2 files changed, 18 insertions, 0 deletions
diff --git a/src/canvas.cc b/src/canvas.cc
index b9356d6..5542332 100644
--- a/src/canvas.cc
+++ b/src/canvas.cc
@@ -92,11 +92,22 @@ void Canvas::load(QString file)
mipmap = NULL;
}
+ if(file == "")
+ {
+ // Just clear the canvas
+ updateWav();
+ update();
+ return;
+ }
+
SF_INFO sf_info;
SNDFILE *fh = sf_open(file.toStdString().c_str(), SFM_READ, &sf_info);
if(!fh)
{
printf("Canvas load error '%s'\n", file.toStdString().c_str());
+ // Just clear the canvas
+ updateWav();
+ update();
return;
}
diff --git a/src/filelist.cc b/src/filelist.cc
index 7b2ec2b..b9b1462 100644
--- a/src/filelist.cc
+++ b/src/filelist.cc
@@ -475,6 +475,12 @@ void FileList::removeFile()
{
auto audiofile_ids = instrument.getAudioFileList();
auto audiofile_id = audiofile_ids.begin() + currentIndex().row();
+ auto& audiofile = instrument.getAudioFile(*audiofile_id);
+ if(instrument.getMasterFile() == audiofile.getAbsoluteFile())
+ {
+ emit masterFileChanged(""); // Clear canvas
+ }
+
instrument.deleteAudioFile(*audiofile_id);
//emit fileRemoved(file, name);
@@ -490,5 +496,6 @@ void FileList::removeAllFiles()
}
reset();
+ emit masterFileChanged(""); // Clear canvas
emit allFilesRemoved();
}