lbajardsilogic@0: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ lbajardsilogic@0: lbajardsilogic@0: /* lbajardsilogic@0: Sonic Visualiser lbajardsilogic@0: An audio file viewer and annotation editor. lbajardsilogic@0: Centre for Digital Music, Queen Mary, University of London. lbajardsilogic@0: This file copyright 2006 Chris Cannam. lbajardsilogic@0: lbajardsilogic@0: This program is free software; you can redistribute it and/or lbajardsilogic@0: modify it under the terms of the GNU General Public License as lbajardsilogic@0: published by the Free Software Foundation; either version 2 of the lbajardsilogic@0: License, or (at your option) any later version. See the file lbajardsilogic@0: COPYING included with this distribution for more information. lbajardsilogic@0: */ lbajardsilogic@0: lbajardsilogic@0: #ifndef _WAV_FILE_READER_H_ lbajardsilogic@0: #define _WAV_FILE_READER_H_ lbajardsilogic@0: lbajardsilogic@0: #include "AudioFileReader.h" lbajardsilogic@0: lbajardsilogic@0: #include lbajardsilogic@0: #include lbajardsilogic@0: lbajardsilogic@0: #include lbajardsilogic@0: lbajardsilogic@0: class WavFileReader : public AudioFileReader lbajardsilogic@0: { lbajardsilogic@0: public: lbajardsilogic@0: WavFileReader(QString path, bool fileUpdating = false); lbajardsilogic@0: virtual ~WavFileReader(); lbajardsilogic@0: lbajardsilogic@0: virtual QString getError() const { return m_error; } lbajardsilogic@0: lbajardsilogic@0: /** lbajardsilogic@0: * Must be safe to call from multiple threads with different lbajardsilogic@0: * arguments on the same object at the same time. lbajardsilogic@0: */ lbajardsilogic@0: virtual void getInterleavedFrames(size_t start, size_t count, lbajardsilogic@0: SampleBlock &frames) const; lbajardsilogic@0: lbajardsilogic@0: static void getSupportedExtensions(std::set &extensions); lbajardsilogic@0: lbajardsilogic@0: bool isUpdating() const { return m_updating; } lbajardsilogic@0: lbajardsilogic@0: void updateFrameCount(); lbajardsilogic@0: void updateDone(); lbajardsilogic@0: lbajardsilogic@0: protected: lbajardsilogic@0: SF_INFO m_fileInfo; lbajardsilogic@0: SNDFILE *m_file; lbajardsilogic@0: lbajardsilogic@0: QString m_path; lbajardsilogic@0: QString m_error; lbajardsilogic@0: lbajardsilogic@0: mutable QMutex m_mutex; lbajardsilogic@0: mutable float *m_buffer; lbajardsilogic@0: mutable size_t m_bufsiz; lbajardsilogic@0: mutable size_t m_lastStart; lbajardsilogic@0: mutable size_t m_lastCount; lbajardsilogic@0: lbajardsilogic@0: bool m_updating; lbajardsilogic@0: }; lbajardsilogic@0: lbajardsilogic@0: #endif