Chris@392
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@392
|
2
|
Chris@392
|
3 /*
|
Chris@392
|
4 Sonic Visualiser
|
Chris@392
|
5 An audio file viewer and annotation editor.
|
Chris@392
|
6 Centre for Digital Music, Queen Mary, University of London.
|
Chris@392
|
7 This file copyright 2006 Chris Cannam.
|
Chris@392
|
8
|
Chris@392
|
9 This program is free software; you can redistribute it and/or
|
Chris@392
|
10 modify it under the terms of the GNU General Public License as
|
Chris@392
|
11 published by the Free Software Foundation; either version 2 of the
|
Chris@392
|
12 License, or (at your option) any later version. See the file
|
Chris@392
|
13 COPYING included with this distribution for more information.
|
Chris@392
|
14 */
|
Chris@392
|
15
|
Chris@392
|
16 #ifndef _CSV_FORMAT_H_
|
Chris@392
|
17 #define _CSV_FORMAT_H_
|
Chris@392
|
18
|
Chris@392
|
19 #include <QString>
|
Chris@392
|
20 #include <QStringList>
|
Chris@392
|
21
|
Chris@392
|
22 class CSVFormat
|
Chris@392
|
23 {
|
Chris@392
|
24 public:
|
Chris@392
|
25 enum ModelType {
|
Chris@392
|
26 OneDimensionalModel,
|
Chris@392
|
27 TwoDimensionalModel,
|
Chris@628
|
28 TwoDimensionalModelWithDuration,
|
Chris@392
|
29 ThreeDimensionalModel
|
Chris@392
|
30 };
|
Chris@392
|
31
|
Chris@392
|
32 enum TimingType {
|
Chris@392
|
33 ExplicitTiming,
|
Chris@392
|
34 ImplicitTiming
|
Chris@392
|
35 };
|
Chris@628
|
36
|
Chris@628
|
37 enum DurationType {
|
Chris@628
|
38 Durations,
|
Chris@628
|
39 EndTimes
|
Chris@628
|
40 };
|
Chris@392
|
41
|
Chris@392
|
42 enum TimeUnits {
|
Chris@392
|
43 TimeSeconds,
|
Chris@392
|
44 TimeAudioFrames,
|
Chris@392
|
45 TimeWindows
|
Chris@392
|
46 };
|
Chris@392
|
47
|
Chris@392
|
48 CSVFormat(QString path); // guess format
|
Chris@392
|
49
|
Chris@392
|
50 CSVFormat() : // arbitrary defaults
|
Chris@392
|
51 m_modelType(TwoDimensionalModel),
|
Chris@392
|
52 m_timingType(ExplicitTiming),
|
Chris@628
|
53 m_durationType(Durations),
|
Chris@392
|
54 m_timeUnits(TimeSeconds),
|
Chris@392
|
55 m_separator(","),
|
Chris@392
|
56 m_sampleRate(44100),
|
Chris@392
|
57 m_windowSize(1024),
|
Chris@392
|
58 m_behaviour(QString::KeepEmptyParts)
|
Chris@392
|
59 { }
|
Chris@628
|
60
|
Chris@628
|
61 ModelType getModelType() const { return m_modelType; }
|
Chris@628
|
62 TimingType getTimingType() const { return m_timingType; }
|
Chris@628
|
63 DurationType getDurationType() const { return m_durationType; }
|
Chris@628
|
64 TimeUnits getTimeUnits() const { return m_timeUnits; }
|
Chris@628
|
65 QString getSeparator() const { return m_separator; }
|
Chris@628
|
66 size_t getSampleRate() const { return m_sampleRate; }
|
Chris@628
|
67 size_t getWindowSize() const { return m_windowSize; }
|
Chris@392
|
68
|
Chris@392
|
69 QString::SplitBehavior getSplitBehaviour() const { return m_behaviour; }
|
Chris@392
|
70
|
Chris@628
|
71 void setModelType(ModelType t) { m_modelType = t; }
|
Chris@628
|
72 void setTimingType(TimingType t) { m_timingType = t; }
|
Chris@628
|
73 void setDurationType(DurationType t) { m_durationType = t; }
|
Chris@628
|
74 void setTimeUnits(TimeUnits t) { m_timeUnits = t; }
|
Chris@628
|
75 void setSeparator(QString s) { m_separator = s; }
|
Chris@628
|
76 void setSampleRate(size_t r) { m_sampleRate = r; }
|
Chris@628
|
77 void setWindowSize(size_t s) { m_windowSize = s; }
|
Chris@392
|
78
|
Chris@392
|
79 void setSplitBehaviour(QString::SplitBehavior b) { m_behaviour = b; }
|
Chris@392
|
80
|
Chris@392
|
81 // only valid if constructor that guesses format was used:
|
Chris@392
|
82 QList<QStringList> getExample() const { return m_example; }
|
Chris@392
|
83 int getMaxExampleCols() const { return m_maxExampleCols; }
|
Chris@392
|
84
|
Chris@392
|
85 protected:
|
Chris@628
|
86 ModelType m_modelType;
|
Chris@628
|
87 TimingType m_timingType;
|
Chris@628
|
88 DurationType m_durationType;
|
Chris@628
|
89 TimeUnits m_timeUnits;
|
Chris@628
|
90 QString m_separator;
|
Chris@628
|
91 size_t m_sampleRate;
|
Chris@628
|
92 size_t m_windowSize;
|
Chris@392
|
93
|
Chris@392
|
94 QString::SplitBehavior m_behaviour;
|
Chris@392
|
95
|
Chris@392
|
96 QList<QStringList> m_example;
|
Chris@392
|
97 int m_maxExampleCols;
|
Chris@392
|
98 };
|
Chris@392
|
99
|
Chris@392
|
100 #endif
|