comparison data/model/WritableWaveFileModel.cpp @ 316:3a6725f285d6

* Make RemoteFile far more pervasive, and use it for local files as well so that we can handle both transparently. Make it shallow copy with reference counting, so it can be used by value without having to worry about the cache file lifetime. Use RemoteFile for MainWindow file-open functions, etc
author Chris Cannam
date Thu, 18 Oct 2007 15:31:20 +0000
parents 70a232b1f12a
children c324d410b096
comparison
equal deleted inserted replaced
315:96ef9746c560 316:3a6725f285d6
58 delete m_writer; 58 delete m_writer;
59 m_writer = 0; 59 m_writer = 0;
60 return; 60 return;
61 } 61 }
62 62
63 m_reader = new WavFileReader(m_writer->getPath(), true); 63 RemoteFile source(m_writer->getPath());
64
65 m_reader = new WavFileReader(source, true);
64 if (!m_reader->getError().isEmpty()) { 66 if (!m_reader->getError().isEmpty()) {
65 std::cerr << "WritableWaveFileModel: Error in creating wave file reader" << std::endl; 67 std::cerr << "WritableWaveFileModel: Error in creating wave file reader" << std::endl;
66 delete m_reader; 68 delete m_reader;
67 m_reader = 0; 69 m_reader = 0;
68 return; 70 return;
69 } 71 }
70 72
71 m_model = new WaveFileModel(m_writer->getPath(), m_reader); 73 m_model = new WaveFileModel(source, m_reader);
72 if (!m_model->isOK()) { 74 if (!m_model->isOK()) {
73 std::cerr << "WritableWaveFileModel: Error in creating wave file model" << std::endl; 75 std::cerr << "WritableWaveFileModel: Error in creating wave file model" << std::endl;
74 delete m_model; 76 delete m_model;
75 m_model = 0; 77 m_model = 0;
76 delete m_reader; 78 delete m_reader;