Moved DataType into it's own class (resolved a name clash on ARDOUR::MIDI
[ardour.git] / libs / ardour / ardour / buffer.h
index 3e4a119710917b640b5dfb641690cb10c749f3ff..8a88802ecb1c25b88bf92dca9bf3ea6c25edfaf6 100644 (file)
@@ -1,6 +1,5 @@
 /*
     Copyright (C) 2006 Paul Davis 
-    Written by Dave Robillard, 2006
     
     This program is free software; you can redistribute it and/or modify it
     under the terms of the GNU General Public License as published by the Free
@@ -24,7 +23,7 @@
 #include <cstdlib> // for posix_memalign
 #include <cassert>
 #include <ardour/types.h>
-#include <jack/jack.h>
+#include <ardour/data_type.h>
 
 namespace ARDOUR {
 
@@ -60,44 +59,7 @@ public:
 
        /** Type of this buffer.
         * Based on this you can static cast a Buffer* to the desired type. */
-       virtual DataType type() const { return _type; }
-
-       /** Jack type (eg JACK_DEFAULT_AUDIO_TYPE) */
-       const char* jack_type() const { return type_to_jack_type(type()); }
-       
-       /** 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.
-        * These should probably live somewhere else...
-        */
-
-       static const char* type_to_jack_type(DataType t) {
-               switch (t) {
-                       case AUDIO: return JACK_DEFAULT_AUDIO_TYPE;
-                       //case MIDI:  return JACK_DEFAULT_MIDI_TYPE;
-                       default:    return "";
-               }
-       }
-       
-       static const char* type_to_string(DataType 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 DataType type_from_string(const string& str) {
-               if (str == "audio")
-                       return AUDIO;
-               else if (str == "midi")
-                       return MIDI;
-               else
-                       return NIL;
-       }
+       DataType type() const { return _type; }
 
 protected:
        DataType _type;
@@ -114,7 +76,7 @@ class AudioBuffer : public Buffer
 {
 public:
        AudioBuffer(size_t capacity)
-               : Buffer(AUDIO, capacity)
+               : Buffer(DataType::AUDIO, capacity)
                , _data(NULL)
        {
                _size = capacity; // For audio buffers, size = capacity (always)