diff data/model/ReadOnlyWaveFileModel.cpp @ 1751:77543124651b by-id

Overhaul PlayParameters bits
author Chris Cannam
date Thu, 04 Jul 2019 18:04:21 +0100
parents 70e172e6cc59
children 6d09d68165a4
line wrap: on
line diff
--- a/data/model/ReadOnlyWaveFileModel.cpp	Thu Jul 04 14:30:48 2019 +0100
+++ b/data/model/ReadOnlyWaveFileModel.cpp	Thu Jul 04 18:04:21 2019 +0100
@@ -21,12 +21,12 @@
 #include "system/System.h"
 
 #include "base/Preferences.h"
+#include "base/PlayParameterRepository.h"
 
 #include <QFileInfo>
 #include <QTextStream>
 
 #include <iostream>
-//#include <unistd.h>
 #include <cmath>
 #include <sndfile.h>
 
@@ -85,6 +85,9 @@
     if (m_reader) setObjectName(m_reader->getTitle());
     if (objectName() == "") setObjectName(QFileInfo(m_path).fileName());
     if (isOK()) fillCache();
+    
+    PlayParameterRepository::getInstance()->addPlayable
+        (getId().untyped, this);
 }
 
 ReadOnlyWaveFileModel::ReadOnlyWaveFileModel(FileSource source, AudioFileReader *reader) :
@@ -106,10 +109,16 @@
     if (m_reader) setObjectName(m_reader->getTitle());
     if (objectName() == "") setObjectName(QFileInfo(m_path).fileName());
     fillCache();
+    
+    PlayParameterRepository::getInstance()->addPlayable
+        (getId().untyped, this);
 }
 
 ReadOnlyWaveFileModel::~ReadOnlyWaveFileModel()
 {
+    PlayParameterRepository::getInstance()->removePlayable
+        (getId().untyped);
+    
     m_exiting = true;
     if (m_fillThread) m_fillThread->wait();
     if (m_myReader) delete m_reader;