00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ 00002 00003 /* 00004 Sonic Visualiser 00005 An audio file viewer and annotation editor. 00006 Centre for Digital Music, Queen Mary, University of London. 00007 This file copyright 2007 QMUL. 00008 00009 This program is free software; you can redistribute it and/or 00010 modify it under the terms of the GNU General Public License as 00011 published by the Free Software Foundation; either version 2 of the 00012 License, or (at your option) any later version. See the file 00013 COPYING included with this distribution for more information. 00014 */ 00015 00016 #ifndef _MATCH_FILE_READER_H_ 00017 #define _MATCH_FILE_READER_H_ 00018 00019 #include <vector> 00020 #include <QString> 00021 00022 class QFile; 00023 class Model; 00024 00025 class Alignment 00026 { 00027 public: 00028 Alignment(); 00029 00030 typedef std::vector<int> FrameArray; 00031 00032 double thisHopTime; 00033 double refHopTime; 00034 00035 FrameArray thisIndex; 00036 FrameArray refIndex; 00037 00038 double fromReference(double) const; 00039 double toReference(double) const; 00040 00042 void setMainModel(Model *m) { m_mainModel = m; } 00043 bool isMainModel(Model *m) const { return m == m_mainModel; } 00044 00045 int search(const FrameArray &arr, int val) const; 00046 00047 protected: 00048 Model *m_mainModel; 00049 }; 00050 00051 class MatchFileReader 00052 { 00053 public: 00054 MatchFileReader(QString path); 00055 virtual ~MatchFileReader(); 00056 00057 virtual bool isOK() const; 00058 virtual QString getError() const; 00059 virtual Alignment load() const; 00060 00061 protected: 00062 QFile *m_file; 00063 QString m_error; 00064 }; 00065 00066 #endif 00067
1.5.1