comparison data/fft/FFTFileCacheWriter.cpp @ 550:107d3f3705c9

* Auto-close write-mode matrix files when all columns written
author Chris Cannam
date Thu, 05 Feb 2009 14:17:11 +0000
parents 3cc4b7cd2aa5
children f9cf4b49b08b
comparison
equal deleted inserted replaced
549:388afa99d537 550:107d3f3705c9
42 (fileBase, MatrixFile::WriteOnly, 42 (fileBase, MatrixFile::WriteOnly,
43 storageType == FFTCache::Compact ? sizeof(uint16_t) : sizeof(float), 43 storageType == FFTCache::Compact ? sizeof(uint16_t) : sizeof(float),
44 width, height * 2 + m_factorSize)) 44 width, height * 2 + m_factorSize))
45 { 45 {
46 std::cerr << "FFTFileCacheWriter: storage type is " << (storageType == FFTCache::Compact ? "Compact" : storageType == FFTCache::Polar ? "Polar" : "Rectangular") << ", size " << width << "x" << height << std::endl; 46 std::cerr << "FFTFileCacheWriter: storage type is " << (storageType == FFTCache::Compact ? "Compact" : storageType == FFTCache::Polar ? "Polar" : "Rectangular") << ", size " << width << "x" << height << std::endl;
47 m_mfc->setAutoClose(true);
47 m_writebuf = new char[(height * 2 + m_factorSize) * m_mfc->getCellSize()]; 48 m_writebuf = new char[(height * 2 + m_factorSize) * m_mfc->getCellSize()];
48 } 49 }
49 50
50 FFTFileCacheWriter::~FFTFileCacheWriter() 51 FFTFileCacheWriter::~FFTFileCacheWriter()
51 { 52 {
69 FFTFileCacheWriter::getHeight() const 70 FFTFileCacheWriter::getHeight() const
70 { 71 {
71 size_t mh = m_mfc->getHeight(); 72 size_t mh = m_mfc->getHeight();
72 if (mh > m_factorSize) return (mh - m_factorSize) / 2; 73 if (mh > m_factorSize) return (mh - m_factorSize) / 2;
73 else return 0; 74 else return 0;
75 }
76
77 bool
78 FFTFileCacheWriter::haveSetColumnAt(size_t x) const
79 {
80 return m_mfc->haveSetColumnAt(x);
74 } 81 }
75 82
76 void 83 void
77 FFTFileCacheWriter::setColumnAt(size_t x, float *mags, float *phases, float factor) 84 FFTFileCacheWriter::setColumnAt(size_t x, float *mags, float *phases, float factor)
78 { 85 {