comparison main/main.cpp @ 127:fbd09fcda469

* doc updates
author Chris Cannam
date Fri, 30 Mar 2007 17:16:48 +0000
parents a45733cc3939
children 20ec0c6d4a97
comparison
equal deleted inserted replaced
126:8d31c8e9c820 127:fbd09fcda469
32 #include <QIcon> 32 #include <QIcon>
33 #include <QSessionManager> 33 #include <QSessionManager>
34 34
35 #include <iostream> 35 #include <iostream>
36 #include <signal.h> 36 #include <signal.h>
37
38 /*! \mainpage Sonic Visualiser
39
40 \section interesting Summary of interesting classes
41
42 - Data models: Model and subclasses, e.g. WaveFileModel
43
44 - Graphical layers: Layer and subclasses, displayed on View and its
45 subclass widgets.
46
47 - Main window class, document class, and file parser: MainWindow,
48 Document, SVFileReader
49
50 - Turning one model (e.g. audio) into another (e.g. more audio, or a
51 curve extracted from it): Transform and subclasses
52
53 - Creating the plugins used by transforms: RealTimePluginFactory,
54 FeatureExtractionPluginFactory
55
56 - File reading and writing code: AudioFileReader and subclasses,
57 WavFileWriter, DataFileReader, SVFileReader
58
59 - FFT calculation and cacheing: FFTModel, FFTDataServer
60
61 - Widgets that show groups of editable properties: PropertyBox for
62 layer properties (contained in a PropertyStack), PluginParameterBox
63 for plugins (contained in a PluginParameterDialog)
64
65 - Audio playback: AudioCallbackPlaySource and subclasses,
66 AudioCallbackPlayTarget and subclasses, AudioGenerator
67
68 \section model Data sources: the Model hierarchy
69
70 A Model is something containing, or knowing how to obtain, data.
71
72 For example, WaveFileModel is a model that knows how to get data
73 from an audio file; SparseTimeValueModel is a model containing
74 editable "curve" data.
75
76 Models typically subclass one of a number of abstract subclasses of
77 Model. For example, WaveFileModel subclasses DenseTimeValueModel,
78 which describes an interface for models that have a value at each
79 time point for a given sampling resolution. (Note that
80 WaveFileModel does not actually read the files itself: it uses
81 AudioFileReader classes for that. It just makes data from the
82 files available in a Model.) SparseTimeValueModel uses the
83 SparseModel template class, which provides most of the
84 implementation for models that contain a series of points of some
85 sort -- also used by NoteModel, TextModel, and
86 SparseOneDimensionalModel.
87
88 Everything that goes on the screen originates from a model, via a
89 layer (see below). The models are contained in a Document object.
90 There is no containment hierarchy or ordering of models in the
91 document. One model is the main model, which defines the sample
92 rate for playback.
93
94 A model may also be marked as a "derived" model, which means it was
95 generated from another model using some transform (feature
96 extraction or effect plugin, etc) -- the idea being that they can
97 be re-generated using the same transform if a new source model is
98 loaded.
99
100 \section layer Things that can display data: the Layer hierarchy
101
102 A Layer is something that knows how to draw parts of a model onto a
103 timeline.
104
105 For example, WaveformLayer is a layer which draws waveforms, based
106 on WaveFileModel; TimeValueLayer draws curves, based on
107 SparseTimeValueModel; SpectrogramLayer draws spectrograms, based on
108 WaveFileModel (via FFTModel).
109
110 The most basic functions of a layer are: to draw itself onto a
111 Pane, against a timeline on the x axis; and to permit user
112 interaction. If you were thinking of adding the capability to
113 display a new sort of something, then you would want to add a new
114 layer type. (You may also need a new model type, depending on
115 whether any existing model can capture the data you need.)
116 Depending on the sort of data in question, there are various
117 existing layers that might be appropriate to start from -- for
118 example, a layer that displays images that the user has imported
119 and associated with particular times might have something in common
120 with the existing TextLayer which displays pieces of text that are
121 associated with particular times.
122
123 Although layers are visual objects, they are contained in the
124 Document in Sonic Visualiser rather than being managed together
125 with display widgets. The Sonic Visualiser file format has
126 separate data and layout sections, and the layers are defined in
127 the data section and then referred to in the layout section which
128 determines which layers may go on which panes (see Pane below).
129
130 Once a layer class is defined, some basic data about it needs to be
131 set up in the LayerFactory class, and then it will appear in the
132 menus and so on on the main window.
133
134 \section view Widgets that are used to show layers: The View hierarchy
135
136 A View is a widget that displays a stack of layers. The most
137 important subclass is Pane, the widget that is used to show most of
138 the data in the main window of Sonic Visualiser.
139
140 All a pane really does is contain a set of layers and get them to
141 render themselves (one on top of the other, with the topmost layer
142 being the one that is currently interacted with), cache the
143 results, negotiate user interaction with them, and so on. This is
144 generally fiddly, if not especially interesting. Panes are
145 strictly layout objects and are not stored in the Document class;
146 instead the MainWindow contains a PaneStack widget (the widget that
147 takes up most of Sonic Visualiser's main window) which contains a
148 set of panes stacked vertically.
149
150 Another View subclass is Overview, which is the widget that
151 contains that green waveform showing the entire file at the bottom
152 of the window.
153
154 */
37 155
38 static QMutex cleanupMutex; 156 static QMutex cleanupMutex;
39 157
40 static void 158 static void
41 signalHandler(int /* signal */) 159 signalHandler(int /* signal */)