comparison data/fileio/CSVFormat.h @ 628:001db550bd48

* Add option to import time+duration (or time+endtime) from CSV files (importing to Region layers) * Fix ffwd/rwd in Region layers so as to behave like time-value layers
author Chris Cannam
date Thu, 08 Jul 2010 14:22:28 +0000
parents 183ee2a55fc7
children 35499d48a5d1
comparison
equal deleted inserted replaced
627:080d8bdd8762 628:001db550bd48
23 { 23 {
24 public: 24 public:
25 enum ModelType { 25 enum ModelType {
26 OneDimensionalModel, 26 OneDimensionalModel,
27 TwoDimensionalModel, 27 TwoDimensionalModel,
28 TwoDimensionalModelWithDuration,
28 ThreeDimensionalModel 29 ThreeDimensionalModel
29 }; 30 };
30 31
31 enum TimingType { 32 enum TimingType {
32 ExplicitTiming, 33 ExplicitTiming,
33 ImplicitTiming 34 ImplicitTiming
35 };
36
37 enum DurationType {
38 Durations,
39 EndTimes
34 }; 40 };
35 41
36 enum TimeUnits { 42 enum TimeUnits {
37 TimeSeconds, 43 TimeSeconds,
38 TimeAudioFrames, 44 TimeAudioFrames,
42 CSVFormat(QString path); // guess format 48 CSVFormat(QString path); // guess format
43 49
44 CSVFormat() : // arbitrary defaults 50 CSVFormat() : // arbitrary defaults
45 m_modelType(TwoDimensionalModel), 51 m_modelType(TwoDimensionalModel),
46 m_timingType(ExplicitTiming), 52 m_timingType(ExplicitTiming),
53 m_durationType(Durations),
47 m_timeUnits(TimeSeconds), 54 m_timeUnits(TimeSeconds),
48 m_separator(","), 55 m_separator(","),
49 m_sampleRate(44100), 56 m_sampleRate(44100),
50 m_windowSize(1024), 57 m_windowSize(1024),
51 m_behaviour(QString::KeepEmptyParts) 58 m_behaviour(QString::KeepEmptyParts)
52 { } 59 { }
53 60
54 ModelType getModelType() const { return m_modelType; } 61 ModelType getModelType() const { return m_modelType; }
55 TimingType getTimingType() const { return m_timingType; } 62 TimingType getTimingType() const { return m_timingType; }
56 TimeUnits getTimeUnits() const { return m_timeUnits; } 63 DurationType getDurationType() const { return m_durationType; }
57 QString getSeparator() const { return m_separator; } 64 TimeUnits getTimeUnits() const { return m_timeUnits; }
58 size_t getSampleRate() const { return m_sampleRate; } 65 QString getSeparator() const { return m_separator; }
59 size_t getWindowSize() const { return m_windowSize; } 66 size_t getSampleRate() const { return m_sampleRate; }
67 size_t getWindowSize() const { return m_windowSize; }
60 68
61 QString::SplitBehavior getSplitBehaviour() const { return m_behaviour; } 69 QString::SplitBehavior getSplitBehaviour() const { return m_behaviour; }
62 70
63 void setModelType(ModelType t) { m_modelType = t; } 71 void setModelType(ModelType t) { m_modelType = t; }
64 void setTimingType(TimingType t) { m_timingType = t; } 72 void setTimingType(TimingType t) { m_timingType = t; }
65 void setTimeUnits(TimeUnits t) { m_timeUnits = t; } 73 void setDurationType(DurationType t) { m_durationType = t; }
66 void setSeparator(QString s) { m_separator = s; } 74 void setTimeUnits(TimeUnits t) { m_timeUnits = t; }
67 void setSampleRate(size_t r) { m_sampleRate = r; } 75 void setSeparator(QString s) { m_separator = s; }
68 void setWindowSize(size_t s) { m_windowSize = s; } 76 void setSampleRate(size_t r) { m_sampleRate = r; }
77 void setWindowSize(size_t s) { m_windowSize = s; }
69 78
70 void setSplitBehaviour(QString::SplitBehavior b) { m_behaviour = b; } 79 void setSplitBehaviour(QString::SplitBehavior b) { m_behaviour = b; }
71 80
72 // only valid if constructor that guesses format was used: 81 // only valid if constructor that guesses format was used:
73 QList<QStringList> getExample() const { return m_example; } 82 QList<QStringList> getExample() const { return m_example; }
74 int getMaxExampleCols() const { return m_maxExampleCols; } 83 int getMaxExampleCols() const { return m_maxExampleCols; }
75 84
76 protected: 85 protected:
77 ModelType m_modelType; 86 ModelType m_modelType;
78 TimingType m_timingType; 87 TimingType m_timingType;
79 TimeUnits m_timeUnits; 88 DurationType m_durationType;
80 QString m_separator; 89 TimeUnits m_timeUnits;
81 size_t m_sampleRate; 90 QString m_separator;
82 size_t m_windowSize; 91 size_t m_sampleRate;
92 size_t m_windowSize;
83 93
84 QString::SplitBehavior m_behaviour; 94 QString::SplitBehavior m_behaviour;
85 95
86 QList<QStringList> m_example; 96 QList<QStringList> m_example;
87 int m_maxExampleCols; 97 int m_maxExampleCols;