Moved DataType into it's own class (resolved a name clash on ARDOUR::MIDI
authorDavid Robillard <d@drobilla.net>
Tue, 1 Aug 2006 21:33:25 +0000 (21:33 +0000)
committerDavid Robillard <d@drobilla.net>
Tue, 1 Aug 2006 21:33:25 +0000 (21:33 +0000)
which was a show stopper for gcc 3.3)
Also fixed a few warnings in fft_graph.cc

git-svn-id: svn://localhost/ardour2/trunk@739 d708f5d6-7413-0410-9779-e7cbd77b26cf

13 files changed:
gtk2_ardour/fft_graph.cc
gtk2_ardour/pan_automation_time_axis.cc
libs/ardour/ardour/audioengine.h
libs/ardour/ardour/buffer.h
libs/ardour/ardour/io.h
libs/ardour/ardour/route.h
libs/ardour/ardour/track.h
libs/ardour/ardour/types.h
libs/ardour/audioengine.cc
libs/ardour/auditioner.cc
libs/ardour/io.cc
libs/ardour/route.cc
libs/ardour/session.cc

index 7c8b4b4095a0f47d6154f082e77e8b0a711c0fcd..367dc54b7c11acb55234194dbd4140fdb64c6a23 100644 (file)
@@ -234,11 +234,11 @@ FFTGraph::draw_scales(Glib::RefPtr<Gdk::Window> window)
                while (_logScale[logscale_pos] < position_on_scale)
                        logscale_pos++;
                
-               int coord = v_margin + 1.0 + position_on_scale;
+               int coord = (int)(v_margin + 1.0 + position_on_scale);
                
                int SR = 44100;
 
-               int rate_at_pos = (double)(SR/2) * (double)logscale_pos / (double)_dataSize;
+               int rate_at_pos = (int)((double)(SR/2) * (double)logscale_pos / (double)_dataSize);
                
                char buf[32];
                snprintf(buf,32,"%dhz",rate_at_pos);
index de1fae1732d35fa6cba19aee00515b45f95921dd..fcef6f812c9e45bdb6e420fec3085f6449ae00f5 100644 (file)
@@ -105,7 +105,7 @@ void
 PanAutomationTimeAxisView::add_line (AutomationLine& line)
 {
        char buf[32];
-       snprintf(buf,32,"Line %d",lines.size()+1);
+       snprintf(buf,32,"Line %ld",lines.size()+1);
        multiline_selector.append_text(buf);
 
        if (lines.empty()) {
index 81370e379c4746d38f92f85da20f5af6fd89c47e..e7500fc7a2e2d17c7f7dd7d0ac545aedec4f9727 100644 (file)
@@ -35,6 +35,7 @@
 #include <jack/jack.h>
 #include <jack/transport.h>
 #include <ardour/types.h>
+#include <ardour/data_type.h>
 
 namespace ARDOUR {
 
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)
index 35b20f655e7725514f3c3d0677917b5015344c71..b116a58b97bbd6a32e63be0f0a5cecb56b812b59 100644 (file)
@@ -39,6 +39,7 @@
 #include <ardour/state_manager.h>
 #include <ardour/curve.h>
 #include <ardour/types.h>
+#include <ardour/data_type.h>
 
 using std::string;
 using std::vector;
@@ -67,7 +68,7 @@ class IO : public Stateful, public ARDOUR::StateManager
        IO (Session&, string name, 
            int input_min = -1, int input_max = -1, 
            int output_min = -1, int output_max = -1,
-               DataType default_type = AUDIO);
+               DataType default_type = DataType::AUDIO);
 
        virtual ~IO();
 
@@ -116,8 +117,8 @@ class IO : public Stateful, public ARDOUR::StateManager
        Connection *input_connection() const { return _input_connection; }
        Connection *output_connection() const { return _output_connection; }
 
-       int add_input_port (string source, void *src, DataType type = NIL);
-       int add_output_port (string destination, void *src, DataType type = NIL);
+       int add_input_port (string source, void *src, DataType type = DataType::NIL);
+       int add_output_port (string destination, void *src, DataType type = DataType::NIL);
 
        int remove_input_port (Port *, void *src);
        int remove_output_port (Port *, void *src);
index ea4a2374d4dc0e875b4a61c276ca33be47531a3e..8271c1cf6ab02b3abe20cd791bb235f73b786c91 100644 (file)
@@ -70,7 +70,7 @@ class Route : public IO
 
 
        Route (Session&, std::string name, int input_min, int input_max, int output_min, int output_max,
-              Flag flags = Flag(0), DataType default_type = AUDIO);
+              Flag flags = Flag(0), DataType default_type = DataType::AUDIO);
        
        Route (Session&, const XMLNode&);
        virtual ~Route();
index 707ead157343b44219f04c510845793ef04a0c10..f16e9d29d93ce4a7d0a18daa459d0bf8e831ba98 100644 (file)
@@ -31,7 +31,7 @@ class RouteGroup;
 class Track : public Route
 {
   public:
-       Track (Session&, string name, Route::Flag f = Route::Flag (0), TrackMode m = Normal, DataType default_type = AUDIO);
+       Track (Session&, string name, Route::Flag f = Route::Flag (0), TrackMode m = Normal, DataType default_type = DataType::AUDIO);
 
        virtual ~Track ();
        
@@ -91,7 +91,7 @@ class Track : public Route
        sigc::signal<void> FreezeChange;
 
   protected:
-       Track (Session& sess, const XMLNode& node, DataType default_type = AUDIO);
+       Track (Session& sess, const XMLNode& node, DataType default_type = DataType::AUDIO);
 
        virtual XMLNode& state (bool full) = 0;
 
index e073b413bb5f6f064c249348921e56dee4c45e9f..b2230f12d7ba4c78a56965c746fad708e126d9cc 100644 (file)
@@ -193,7 +193,7 @@ namespace ARDOUR {
                Splice
        };
 
-        enum RegionPoint { 
+       enum RegionPoint { 
            Start,
            End,
            SyncPoint
@@ -243,12 +243,6 @@ namespace ARDOUR {
            PeakDatum min;
            PeakDatum max;
        };
-
-       enum DataType {
-               NIL = 0,
-               AUDIO,
-               MIDI
-       };
 }
 
 std::istream& operator>>(std::istream& o, ARDOUR::SampleFormat& sf);
index 5618c7ef5f20819ec7c4cae23702d8272de24272..982a7c5971cb0fa0c718444fd6e32a97d608aeb1 100644 (file)
@@ -401,7 +401,7 @@ AudioEngine::register_input_port (DataType type, const string& portname)
        }
 
        jack_port_t *p = jack_port_register (_jack, portname.c_str(),
-               Buffer::type_to_jack_type(type), JackPortIsInput, 0);
+               type.to_jack_type(), JackPortIsInput, 0);
 
        if (p) {
 
@@ -435,7 +435,7 @@ AudioEngine::register_output_port (DataType type, const string& portname)
        jack_port_t *p;
 
        if ((p = jack_port_register (_jack, portname.c_str(),
-               Buffer::type_to_jack_type(type), JackPortIsOutput, 0)) != 0) {
+               type.to_jack_type(), JackPortIsOutput, 0)) != 0) {
                Port *newport = new Port (p);
                ports.insert (ports.begin(), newport);
                return newport;
index 81f64d26717364bb830c66317b87c002d006d354..e48f103b9fb976b57e7bebd512d0ddaddea41ea0 100644 (file)
@@ -27,6 +27,7 @@
 #include <ardour/auditioner.h>
 #include <ardour/audioplaylist.h>
 #include <ardour/panner.h>
+#include <ardour/data_type.h>
 
 using namespace std;
 using namespace ARDOUR;
@@ -44,12 +45,12 @@ Auditioner::Auditioner (Session& s)
        defer_pan_reset ();
 
        if (left.length()) {
-               add_output_port (left, this, AUDIO);
+               add_output_port (left, this, DataType::AUDIO);
        }
 
        if (right.length()) {
                audio_diskstream().add_channel();
-               add_output_port (right, this, AUDIO);
+               add_output_port (right, this, DataType::AUDIO);
        }
 
        allow_pan_reset ();
index a70bf8abd32f28c7f33bd5568aa831c0999d9307..2dfd735a6b28150edc93703c09c577fa20a9123b 100644 (file)
@@ -797,7 +797,7 @@ IO::add_output_port (string destination, void* src, DataType type)
        Port* our_port;
        char name[64];
 
-       if (type == NIL)
+       if (type == DataType::NIL)
                type = _default_type;
 
        {
@@ -909,7 +909,7 @@ IO::add_input_port (string source, void* src, DataType type)
        Port* our_port;
        char name[64];
        
-       if (type == NIL)
+       if (type == DataType::NIL)
                type = _default_type;
 
        {
index effb8432d15171269f032802b1f1118cc54ccdb4..b47981a47eff732c1025dd838eb33c368ec441c1 100644 (file)
@@ -1333,7 +1333,7 @@ Route::state(bool full_state)
                node->add_property("flags", buf);
        }
        
-       node->add_property("default-type", Buffer::type_to_string(_default_type));
+       node->add_property("default-type", _default_type.to_string());
 
        node->add_property("active", _active?"yes":"no");
        node->add_property("muted", _muted?"yes":"no");
@@ -1510,8 +1510,8 @@ Route::set_state (const XMLNode& node)
        }
        
        if ((prop = node.property ("default-type")) != 0) {
-               _default_type = Buffer::type_from_string(prop->value());
-               assert(_default_type != NIL);
+               _default_type = DataType(prop->value());
+               assert(_default_type != DataType::NIL);
        }
 
        if ((prop = node.property ("phase-invert")) != 0) {
index 45afdf479fdde63bf18e81d45a553fd98584be6d..63797c4edd57f1abed205d0e463a9756eab03c9a 100644 (file)
@@ -64,6 +64,7 @@
 #include <ardour/crossfade.h>
 #include <ardour/playlist.h>
 #include <ardour/click.h>
+#include <ardour/data_type.h>
 
 #ifdef HAVE_LIBLO
 #include <ardour/osc.h>
@@ -1807,7 +1808,7 @@ Session::new_audio_route (int input_channels, int output_channels)
        } while (n < (UINT_MAX-1));
 
        try {
-               shared_ptr<Route> bus (new Route (*this, bus_name, -1, -1, -1, -1, Route::Flag(0), AUDIO));
+               shared_ptr<Route> bus (new Route (*this, bus_name, -1, -1, -1, -1, Route::Flag(0), DataType::AUDIO));
 
                if (bus->ensure_io (input_channels, output_channels, false, this)) {
                        error << string_compose (_("cannot configure %1 in/%2 out configuration for new audio track"),