comparison data/model/WritableWaveFileModel.cpp @ 1742:52705a328b34 by-id

Rejig ById so as to put everything in a single pool, so that at the core you can go from numeric id (untyped) to anything the object can be dynamic_cast to. Useful for building other abstractions like PlayParameter-type registrations that don't know about e.g. Models. Probably some more tweaking needed. Also add tests
author Chris Cannam
date Fri, 28 Jun 2019 17:36:30 +0100
parents 601851995f4b
children 77543124651b
comparison
equal deleted inserted replaced
1741:9d82b164f264 1742:52705a328b34
95 // Temp dir is exclusive to this run of the application, 95 // Temp dir is exclusive to this run of the application,
96 // so the filename only needs to be unique within that - 96 // so the filename only needs to be unique within that -
97 // model ID should be ok 97 // model ID should be ok
98 QDir dir(TempDirectory::getInstance()->getPath()); 98 QDir dir(TempDirectory::getInstance()->getPath());
99 path = dir.filePath(QString("written_%1.wav") 99 path = dir.filePath(QString("written_%1.wav")
100 .arg(getId().toString())); 100 .arg(getId().untyped));
101 } catch (const DirectoryCreationFailed &f) { 101 } catch (const DirectoryCreationFailed &f) {
102 SVCERR << "WritableWaveFileModel: Failed to create temporary directory" << endl; 102 SVCERR << "WritableWaveFileModel: Failed to create temporary directory" << endl;
103 return; 103 return;
104 } 104 }
105 } 105 }
126 126
127 // Temp dir is exclusive to this run of the application, so 127 // Temp dir is exclusive to this run of the application, so
128 // the filename only needs to be unique within that 128 // the filename only needs to be unique within that
129 QDir dir(TempDirectory::getInstance()->getPath()); 129 QDir dir(TempDirectory::getInstance()->getPath());
130 m_temporaryPath = dir.filePath(QString("prenorm_%1.wav") 130 m_temporaryPath = dir.filePath(QString("prenorm_%1.wav")
131 .arg(getId().toString())); 131 .arg(getId().untyped));
132 132
133 m_temporaryWriter = new WavFileWriter 133 m_temporaryWriter = new WavFileWriter
134 (m_temporaryPath, m_sampleRate, m_channels, 134 (m_temporaryPath, m_sampleRate, m_channels,
135 WavFileWriter::WriteToTarget); 135 WavFileWriter::WriteToTarget);
136 136