Diff of /trunk/src/LV2/gxamp.lv2/widget.cpp [2c6fb3] .. [0ed57a]  Maximize  Restore

  Switch to side-by-side view

--- a/trunk/src/LV2/gxamp.lv2/widget.cpp
+++ b/trunk/src/LV2/gxamp.lv2/widget.cpp
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose
- * 
+ *
  * 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 Software Foundation; either version 2 of the License, or
@@ -36,56 +36,56 @@
   m_bigknob.cp_set_value(mastergain);
   m_bigknob.set_show_value(false);
   m_bigknob.signal_value_changed().connect(sigc::mem_fun(*this,
-    &Widget::on_knob_value_changed));
-  
+      &Widget::on_knob_value_changed));
+
   m_bigknob1.cp_configure("KNOB", "PRE", -20, 20, 0.1);
   m_bigknob1.cp_set_value(pregain);
   m_bigknob1.set_show_value(false);
   m_bigknob1.signal_value_changed().connect(sigc::mem_fun(*this,
-    &Widget::on_knob1_value_changed));
-    
+      &Widget::on_knob1_value_changed));
+
   m_bigknob2.cp_configure("KNOB", "WETDRY", 1, 100, 1);
   m_bigknob2.cp_set_value(wet_dry);
   m_bigknob2.set_show_value(false);
   m_bigknob2.signal_value_changed().connect(sigc::mem_fun(*this,
-    &Widget::on_knob2_value_changed));
-    
+      &Widget::on_knob2_value_changed));
+
   m_bigknob3.cp_configure("KNOB", "DRIVE", 0.01, 1, 0.01);
   m_bigknob3.cp_set_value(drive);
   m_bigknob3.set_show_value(false);
   m_bigknob3.signal_value_changed().connect(sigc::mem_fun(*this,
-    &Widget::on_knob3_value_changed));
-     
+      &Widget::on_knob3_value_changed));
+
   m_smallknob1.cp_configure("KNOB", "mid", 0, 1, 0.01);
   m_smallknob1.cp_set_value(mid);
   m_smallknob1.set_show_value(false);
   m_smallknob1.signal_value_changed().connect(sigc::mem_fun(*this,
-    &Widget::on_knob4_value_changed));
-     
+      &Widget::on_knob4_value_changed));
+
   m_smallknob2.cp_configure("KNOB", "bass", 0, 1, 0.01);
   m_smallknob2.cp_set_value(bass);
   m_smallknob2.set_show_value(false);
   m_smallknob2.signal_value_changed().connect(sigc::mem_fun(*this,
-    &Widget::on_knob5_value_changed));
+      &Widget::on_knob5_value_changed));
 
   m_smallknob3.cp_configure("KNOB", "treble", 0, 1, 0.01);
   m_smallknob3.cp_set_value(treble);
   m_smallknob3.set_show_value(false);
   m_smallknob3.signal_value_changed().connect(sigc::mem_fun(*this,
-    &Widget::on_knob6_value_changed));
-    
+      &Widget::on_knob6_value_changed));
+
   m_smallknob4.cp_configure("KNOB", "clevel", 0.5, 5, 0.5);
   m_smallknob4.cp_set_value(clevel);
   m_smallknob4.set_show_value(false);
   m_smallknob4.signal_value_changed().connect(sigc::mem_fun(*this,
-    &Widget::on_knob7_value_changed));
-     
+      &Widget::on_knob7_value_changed));
+
   m_smallknob5.cp_configure("KNOB", "alevel", 0.5, 5, 0.5);
   m_smallknob5.cp_set_value(alevel);
   m_smallknob5.set_show_value(false);
   m_smallknob5.signal_value_changed().connect(sigc::mem_fun(*this,
-    &Widget::on_knob8_value_changed));
-    
+      &Widget::on_knob8_value_changed));
+
   Gxw::PaintBox *m_paintbox = new Gxw::PaintBox(Gtk::ORIENTATION_HORIZONTAL,12,false);
   m_paintbox->show();
   m_paintbox->set_border_width(18);
@@ -101,7 +101,7 @@
   m_paintbox->pack_start(m_vbox_);
   m_vbox_.pack_start(m_hbox1_);
   m_vbox_.pack_start(m_hbox_);
-  //m_vboxa.pack_start(m_vbox7);
+
   m_hbox1_.pack_start(m_vbox2_, Gtk::PACK_EXPAND_PADDING);
   m_hbox1_.pack_end(m_vbox7,Gtk::PACK_SHRINK);
   m_hbox1_.pack_end(m_vbox8,Gtk::PACK_SHRINK);
@@ -114,103 +114,110 @@
   m_vbox2.pack_start(m_vboxc, Gtk::PACK_EXPAND_PADDING);
   m_vbox2.pack_start( *Gtk::manage(new Gtk::Label("Distortion", 0)),Gtk::PACK_SHRINK);
   m_vbox2.pack_start( m_bigknob2,Gtk::PACK_SHRINK);
-  //m_vboxd.pack_start(m_vbox8);
-  m_vbox3.pack_start(m_vboxd, Gtk::PACK_EXPAND_PADDING); 
+
+  m_vbox3.pack_start(m_vboxd, Gtk::PACK_EXPAND_PADDING);
   m_vbox3.pack_start( *Gtk::manage(new Gtk::Label("Drive", 0)),Gtk::PACK_SHRINK);
   m_vbox3.pack_start( m_bigknob3,Gtk::PACK_SHRINK);
-  
+
   m_vbox4.pack_start(m_vboxe, Gtk::PACK_EXPAND_PADDING);
   m_vbox4.pack_start( *Gtk::manage(new Gtk::Label("mid", 0)),Gtk::PACK_SHRINK);
   m_vbox4.pack_start(m_smallknob1,Gtk::PACK_SHRINK);
   m_vbox4.pack_start(m_vboxee, Gtk::PACK_EXPAND_PADDING);
-  
+
   m_vbox5.pack_start(m_vboxf, Gtk::PACK_EXPAND_PADDING);
   m_vbox5.pack_start( *Gtk::manage(new Gtk::Label("bass", 0)),Gtk::PACK_SHRINK);
   m_vbox5.pack_start(m_smallknob2,Gtk::PACK_SHRINK);
   m_vbox5.pack_start(m_vboxff, Gtk::PACK_EXPAND_PADDING);
-   
+
   m_vbox6.pack_start(m_vboxg, Gtk::PACK_EXPAND_PADDING);
   m_vbox6.pack_start( *Gtk::manage(new Gtk::Label("treble", 0)),Gtk::PACK_SHRINK);
   m_vbox6.pack_start(m_smallknob3,Gtk::PACK_SHRINK);
   m_vbox6.pack_start(m_vboxgg, Gtk::PACK_EXPAND_PADDING);
-  
+
   m_vbox7.pack_start(m_vboxh, Gtk::PACK_EXPAND_PADDING);
   m_vbox7.pack_start( *Gtk::manage(new Gtk::Label("cabinet", 0)),Gtk::PACK_SHRINK);
   m_vbox7.pack_start(m_smallknob4,Gtk::PACK_SHRINK);
-  m_vbox7.pack_start(m_vboxhh, Gtk::PACK_EXPAND_PADDING);
-  
+
   m_vbox8.pack_start(m_vboxi, Gtk::PACK_EXPAND_PADDING);
   m_vbox8.pack_start( *Gtk::manage(new Gtk::Label("presence", 0)),Gtk::PACK_SHRINK);
   m_vbox8.pack_start(m_smallknob5,Gtk::PACK_SHRINK);
-  m_vbox8.pack_start(m_vboxii, Gtk::PACK_EXPAND_PADDING);
-  
+
   m_hbox_.pack_start(m_vbox1);
   m_hbox_.pack_start(m_vbox2);
   m_hbox_.pack_start(m_vbox3);
   m_hbox_.pack_start(m_vbox);
-  
-  //m_hbox.pack_start(m_vbox8);
+
   m_hbox.pack_start(m_vbox5);
   m_hbox.pack_start(m_vbox4);
   m_hbox.pack_start(m_vbox6);
-  //m_hbox.pack_start(m_vbox7);
+
   m_hbox.set_spacing(5);
   m_paintbox->pack_start(m_hbox);
-  
+
   show_all();
   set_size_request(-1,-1);
 }
 
-Widget::~Widget() {
- 
+Widget::~Widget()
+{
+
 }
 
 void Widget::set_value(uint32_t port_index,
-               uint32_t format,
-               const void * buffer)
-{
-  if ( format == 0 ) {
-    float value =  *(float *)buffer;
-      switch ( port_index )
-      {
-        case 0:
-            mastergain = value;
-            m_bigknob.cp_set_value(mastergain);
-            break;
-        case 1:
-            pregain = value;
-            m_bigknob1.cp_set_value(pregain);
-            break;
-        case 2:
-            wet_dry = value;
-            m_bigknob2.cp_set_value(wet_dry);
-            break;
-        case 3:
-            drive = value;
-            m_bigknob3.cp_set_value(drive);
-            break;
-        case 4:
-            mid = value;
-            m_smallknob1.cp_set_value(mid);
-            break;
-        case 5:
-            bass = value;
-            m_smallknob2.cp_set_value(bass);
-            break;
-        case 6:
-            treble = value;
-            m_smallknob3.cp_set_value(treble);
-            break;
-        case 7:
-            clevel = value;
-            m_smallknob4.cp_set_value(clevel);
-            break;
-        case 8:
-            alevel = value;
-            m_smallknob5.cp_set_value(alevel);
-            break;
+                       uint32_t format,
+                       const void * buffer)
+{
+  if ( format == 0 )
+    {
+      float value =  *(float *)buffer;
+      switch ((PortIndex)port_index )
+        {
+        case AMP_MASTERGAIN:
+          mastergain = value;
+          m_bigknob.cp_set_value(mastergain);
+          break;
+        case AMP_PREGAIN:
+          pregain = value;
+          m_bigknob1.cp_set_value(pregain);
+          break;
+        case AMP_WET_DRY:
+          wet_dry = value;
+          m_bigknob2.cp_set_value(wet_dry);
+          break;
+        case AMP_DRIVE:
+          drive = value;
+          m_bigknob3.cp_set_value(drive);
+          break;
+        case MID:
+          mid = value;
+          m_smallknob1.cp_set_value(mid);
+          break;
+        case BASS:
+          bass = value;
+          m_smallknob2.cp_set_value(bass);
+          break;
+        case TREBLE:
+          treble = value;
+          m_smallknob3.cp_set_value(treble);
+          break;
+        case CLevel:
+          clevel = value;
+          m_smallknob4.cp_set_value(clevel);
+          break;
+        case ALevel:
+          alevel = value;
+          m_smallknob5.cp_set_value(alevel);
+          break;
+        case AMP_OUTPUT:
+          break;
+        case AMP_INPUT:
+          break;
+        case AMP_CONTROL:
+          break;
+        case AMP_NOTIFY:
+          break;
+        }
     }
-  }
 }
 
 void Widget::on_knob_value_changed()
@@ -261,36 +268,28 @@
 void Widget::on_knob7_value_changed()
 {
   clevel = m_smallknob4.get_value();
-  //std::cout << "treble = " << treble << std::endl;
+  //std::cout << "treble = " << clevel << std::endl;
   write_function( controller, 7, sizeof(float), 0, (const void*)&clevel);
-  
-    uint32_t OBJ_BUF_SIZE = sizeof(uris)+1;
-    uint8_t obj_buf[OBJ_BUF_SIZE];
-	lv2_atom_forge_set_buffer(&forge, obj_buf, OBJ_BUF_SIZE);
-
-	LV2_Atom* msg = write_set_cab(&forge, &uris);
-
-	write_function(controller, 11, lv2_atom_total_size(msg),
-	          uris.atom_eventTransfer,
-	          msg);
-  
-  
+
+  uint32_t OBJ_BUF_SIZE = sizeof(uris)+1;
+  uint8_t obj_buf[OBJ_BUF_SIZE];
+  lv2_atom_forge_set_buffer(&forge, obj_buf, OBJ_BUF_SIZE);
+  LV2_Atom* msg = write_set_cab(&forge, &uris);
+  write_function(controller, 11, lv2_atom_total_size(msg),
+                 uris.atom_eventTransfer,
+                 msg);
 }
 void Widget::on_knob8_value_changed()
 {
   alevel = m_smallknob5.get_value();
-  //std::cout << "treble = " << treble << std::endl;
+  //std::cout << "treble = " << alevel << std::endl;
   write_function( controller, 8, sizeof(float), 0, (const void*)&alevel);
-  
-    uint32_t OBJ_BUF_SIZE = sizeof(uris)+1;
-    uint8_t obj_buf[OBJ_BUF_SIZE];
-	lv2_atom_forge_set_buffer(&forge, obj_buf, OBJ_BUF_SIZE);
-
-	LV2_Atom* msg = write_set_pre(&forge, &uris);
-
-	write_function(controller, 11, lv2_atom_total_size(msg),
-	          uris.atom_eventTransfer,
-	          msg);
-  
-  
-}
+
+  uint32_t OBJ_BUF_SIZE = sizeof(uris)+1;
+  uint8_t obj_buf[OBJ_BUF_SIZE];
+  lv2_atom_forge_set_buffer(&forge, obj_buf, OBJ_BUF_SIZE);
+  LV2_Atom* msg = write_set_pre(&forge, &uris);
+  write_function(controller, 11, lv2_atom_total_size(msg),
+                 uris.atom_eventTransfer,
+                 msg);
+}

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks