diff options
author | David Robillard <d@drobilla.net> | 2006-07-06 19:45:23 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2006-07-06 19:45:23 +0000 |
commit | edd841895b873b14c4aa814a80de5dc20ff30618 (patch) | |
tree | de3be7bb47c9314f63a73552c3cbd470cead50a4 /libs/ardour/ardour | |
parent | 22c20ab6f215c0ab24702a479aa6821c25a7d058 (diff) |
Loading/Saving of sessions containing MIDI tracks and/or busses
git-svn-id: svn://localhost/ardour2/branches/midi@667 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/ardour')
-rw-r--r-- | libs/ardour/ardour/buffer.h | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/libs/ardour/ardour/buffer.h b/libs/ardour/ardour/buffer.h index 5171f50697..f0ad3be67e 100644 --- a/libs/ardour/ardour/buffer.h +++ b/libs/ardour/ardour/buffer.h @@ -29,6 +29,10 @@ namespace ARDOUR { +/* Yes, this is a bit of a mess right now. I'll clean it up when everything + * using it works out.. */ + + /** A buffer of recordable/playable data. * * This is a datatype-agnostic base class for all buffers (there are no @@ -60,13 +64,17 @@ public: size_t size() const { return _size; } /** Type of this buffer. - * Based on this you can cast a Buffer* to the desired type. */ + * Based on this you can static cast a Buffer* to the desired type. */ virtual Type type() const { return _type; } /** Jack type (eg JACK_DEFAULT_AUDIO_TYPE) */ const char* jack_type() const { return type_to_jack_type(type()); } - /** Separate for creating ports (before a buffer exists to call jack_type on) */ + /** String type as saved in session XML files (eg "audio" or "midi") */ + const char* type_string() const { return type_to_string(type()); } + + /* The below static methods need to be separate from the above methods + * because the conversion is needed in places where there's no Buffer */ static const char* type_to_jack_type(Type t) { switch (t) { case AUDIO: return JACK_DEFAULT_AUDIO_TYPE; @@ -74,6 +82,24 @@ public: default: return ""; } } + + static const char* type_to_string(Type t) { + switch (t) { + case AUDIO: return "audio"; + case MIDI: return "midi"; + default: return "unknown"; // reeeally shouldn't ever happen + } + } + + /** Used for loading from XML (route default types etc) */ + static Type type_from_string(const string& str) { + if (str == "audio") + return AUDIO; + else if (str == "midi") + return MIDI; + else + return NIL; + } protected: Type _type; @@ -82,7 +108,7 @@ protected: }; -/* Since we only have two types, templates aren't worth it, yet.. */ +/* Inside every class with a type in it's name is a template waiting to get out... */ /** Buffer containing 32-bit floating point (audio) data. */ |