2 Copyright (C) 2002 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __ardour_types_h__
21 #define __ardour_types_h__
23 #ifndef __STDC_FORMAT_MACROS
24 #define __STDC_FORMAT_MACROS /* PRI<foo>; C++ requires explicit requesting of these */
29 #include <boost/shared_ptr.hpp>
32 #include <jack/types.h>
33 #include <jack/midiport.h>
34 #include "control_protocol/timecode.h"
37 #include "ardour/bbt_time.h"
51 typedef jack_default_audio_sample_t Sample;
54 typedef uint32_t layer_t;
55 typedef uint64_t microseconds_t;
56 typedef uint32_t nframes_t;
57 typedef int64_t nframes64_t;
60 /** "Session frames", frames relative to the session timeline.
61 * Everything related to transport position etc. should be of this type.
62 * We might want to make this a compile time option for 32-bitters who
63 * don't want to pay for extremely long session times they don't need...
65 typedef int64_t sframes_t;
66 typedef int64_t framepos_t;
67 /* any offset from a framepos_t, measured in audio frames */
68 typedef int64_t frameoffset_t;
69 /* any count of audio frames */
70 typedef int64_t framecnt_t;
74 ConfigurationChanged = 0x1,
75 ConnectionsChanged = 0x2
79 OverlapNone, // no overlap
80 OverlapInternal, // the overlap is 100% with the object
81 OverlapStart, // overlap covers start, but ends within
82 OverlapEnd, // overlap begins within and covers end
83 OverlapExternal // overlap extends to (at least) begin+end
86 OverlapType coverage (nframes_t start_a, nframes_t end_a,
87 nframes_t start_b, nframes_t end_b);
90 * XXX: I don't think/hope these hex values matter anymore.
96 PluginAutomation = 0x4,
98 MuteAutomation = 0x10,
99 MidiCCAutomation = 0x20,
100 MidiPgmChangeAutomation = 0x21,
101 MidiPitchBenderAutomation = 0x22,
102 MidiChannelPressureAutomation = 0x23,
103 MidiSystemExclusiveAutomation = 0x24,
104 FadeInAutomation = 0x40,
105 FadeOutAutomation = 0x80,
106 EnvelopeAutomation = 0x100
116 std::string auto_state_to_string (AutoState);
117 AutoState string_to_auto_state (std::string);
124 std::string auto_style_to_string (AutoStyle);
125 AutoStyle string_to_auto_style (std::string);
151 AllChannels = 0, ///< Pass through all channel information unmodified
152 FilterChannels, ///< Ignore events on certain channels
153 ForceChannel ///< Force all events to a certain channel
162 enum TimecodeFormat {
185 Timecode::Time timecode;
193 AnyTime() { type = Frames; frames = 0; }
201 AudioRange (nframes_t s, nframes_t e, uint32_t i) : start (s), end (e) , id (i) {}
203 nframes_t length() { return end - start + 1; }
205 bool operator== (const AudioRange& other) const {
206 return start == other.start && end == other.end && id == other.id;
209 bool equal (const AudioRange& other) const {
210 return start == other.start && end == other.end;
213 OverlapType coverage (nframes_t s, nframes_t e) const {
214 return ARDOUR::coverage (start, end, s, e);
223 MusicRange (BBT_Time& s, BBT_Time& e, uint32_t i)
224 : start (s), end (e), id (i) {}
226 bool operator== (const MusicRange& other) const {
227 return start == other.start && end == other.end && id == other.id;
230 bool equal (const MusicRange& other) const {
231 return start == other.start && end == other.end;
236 Slowest = 6.6dB/sec falloff at update rate of 40ms
237 Slow = 6.8dB/sec falloff at update rate of 40ms
242 MeterFalloffSlowest = 1,
243 MeterFalloffSlow = 2,
244 MeterFalloffMedium = 3,
245 MeterFalloffFast = 4,
246 MeterFalloffFaster = 5,
247 MeterFalloffFastest = 6
253 MeterHoldMedium = 100,
293 enum CrossfadeModel {
304 enum ListenPosition {
309 enum AutoConnectOption {
311 AutoConnectPhysical = 0x1,
312 AutoConnectMaster = 0x2
315 struct InterThreadInfo {
316 InterThreadInfo () : done (false), cancel (false), progress (0), thread (0) {}
319 volatile bool cancel;
320 volatile float progress;
330 enum CDMarkerFormat {
347 typedef Sample PeakDatum;
372 enum ShuttleBehaviour {
382 typedef std::vector<boost::shared_ptr<Source> > SourceList;
392 struct TimeFXRequest : public InterThreadInfo {
394 : time_fraction(0), pitch_fraction(0),
395 quick_seek(false), antialias(false), opts(0) {}
397 float pitch_fraction;
402 int opts; // really RubberBandStretcher::Options
405 typedef std::list<nframes64_t> AnalysisFeatureList;
407 typedef std::list<boost::shared_ptr<Route> > RouteList;
410 typedef std::vector<boost::shared_ptr<Bundle> > BundleList;
428 struct CleanupReport {
429 std::vector<std::string> paths;
433 /** A struct used to describe changes to processors in a route.
434 * This is useful because objects that respond to a change in processors
435 * can optimise what work they do based on details of what has changed.
437 struct RouteProcessorChange {
440 MeterPointChange = 0x1
443 RouteProcessorChange () : type (GeneralChange), meter_visibly_changed (true)
446 RouteProcessorChange (Type t) : type (t), meter_visibly_changed (true)
449 RouteProcessorChange (Type t, bool m) : type (t), meter_visibly_changed (m)
452 /** type of change; "GeneralChange" means anything could have changed */
454 /** true if, when a MeterPointChange has occurred, the change is visible to the user */
455 bool meter_visibly_changed;
459 AutoConnectOption input_ac; /* override the RC config for input auto-connection */
460 AutoConnectOption output_ac; /* override the RC config for output auto-connection */
461 uint32_t master_out_channels; /* how many channels for the master bus */
462 uint32_t requested_physical_in; /* now many of the available physical inputs to consider usable */
463 uint32_t requested_physical_out; /* now many of the available physical inputs to consider usable */
466 } // namespace ARDOUR
469 /* these cover types declared above in this header. See enums.cc
473 std::istream& operator>>(std::istream& o, ARDOUR::SampleFormat& sf);
474 std::istream& operator>>(std::istream& o, ARDOUR::HeaderFormat& sf);
475 std::istream& operator>>(std::istream& o, ARDOUR::AutoConnectOption& sf);
476 std::istream& operator>>(std::istream& o, ARDOUR::EditMode& sf);
477 std::istream& operator>>(std::istream& o, ARDOUR::MonitorModel& sf);
478 std::istream& operator>>(std::istream& o, ARDOUR::RemoteModel& sf);
479 std::istream& operator>>(std::istream& o, ARDOUR::ListenPosition& sf);
480 std::istream& operator>>(std::istream& o, ARDOUR::LayerModel& sf);
481 std::istream& operator>>(std::istream& o, ARDOUR::CrossfadeModel& sf);
482 std::istream& operator>>(std::istream& o, ARDOUR::SyncSource& sf);
483 std::istream& operator>>(std::istream& o, ARDOUR::ShuttleBehaviour& sf);
484 std::istream& operator>>(std::istream& o, ARDOUR::ShuttleUnits& sf);
485 std::istream& operator>>(std::istream& o, ARDOUR::TimecodeFormat& sf);
486 std::istream& operator>>(std::istream& o, ARDOUR::DenormalModel& sf);
487 std::istream& operator>>(std::istream& o, ARDOUR::WaveformScale& sf);
488 std::istream& operator>>(std::istream& o, ARDOUR::WaveformShape& sf);
490 std::ostream& operator<<(std::ostream& o, const ARDOUR::SampleFormat& sf);
491 std::ostream& operator<<(std::ostream& o, const ARDOUR::HeaderFormat& sf);
492 std::ostream& operator<<(std::ostream& o, const ARDOUR::AutoConnectOption& sf);
493 std::ostream& operator<<(std::ostream& o, const ARDOUR::EditMode& sf);
494 std::ostream& operator<<(std::ostream& o, const ARDOUR::MonitorModel& sf);
495 std::ostream& operator<<(std::ostream& o, const ARDOUR::RemoteModel& sf);
496 std::ostream& operator<<(std::ostream& o, const ARDOUR::ListenPosition& sf);
497 std::ostream& operator<<(std::ostream& o, const ARDOUR::LayerModel& sf);
498 std::ostream& operator<<(std::ostream& o, const ARDOUR::CrossfadeModel& sf);
499 std::ostream& operator<<(std::ostream& o, const ARDOUR::SyncSource& sf);
500 std::ostream& operator<<(std::ostream& o, const ARDOUR::ShuttleBehaviour& sf);
501 std::ostream& operator<<(std::ostream& o, const ARDOUR::ShuttleUnits& sf);
502 std::ostream& operator<<(std::ostream& o, const ARDOUR::TimecodeFormat& sf);
503 std::ostream& operator<<(std::ostream& o, const ARDOUR::DenormalModel& sf);
504 std::ostream& operator<<(std::ostream& o, const ARDOUR::WaveformScale& sf);
505 std::ostream& operator<<(std::ostream& o, const ARDOUR::WaveformShape& sf);
507 static inline ARDOUR::nframes64_t
508 session_frame_to_track_frame (ARDOUR::nframes64_t session_frame, double speed)
510 return (ARDOUR::nframes64_t)( (double)session_frame * speed );
513 static inline ARDOUR::nframes64_t
514 track_frame_to_session_frame (ARDOUR::nframes64_t track_frame, double speed)
516 return (ARDOUR::nframes64_t)( (double)track_frame / speed );
519 /* for now, break the rules and use "using" to make these "global" */
521 using ARDOUR::nframes_t;
522 using ARDOUR::nframes64_t;
525 #endif /* __ardour_types_h__ */