 void gate_isr();
 void switch_isr();
 
+void save_click_callback();
+void adsr_scroll_callback_0(int delta);
+void adsr_scroll_callback_1(int delta);
+void adsr_scroll_callback_2(int delta);
+void adsr_scroll_callback_3(int delta);
+void adsr_scroll_callback_4(int delta);
+void adsr_scroll_callback_5(int delta);
+void adsr_scroll_callback_6(int delta);
+void adsr_scroll_callback_7(int delta);
+
 class DU_ADSR_Function : public DUINO_Function {
  public:
   DU_ADSR_Function() : DUINO_Function(0b10111100) { }
   
   virtual void setup()
   {
+    // build widget hierarchy
+    container_outer_ = new DUINO_WidgetContainer<2>(DUINO_Widget::DoubleClick, 1);
+    widget_save_ = new DUINO_DisplayWidget(121, 0, 7, 7);
+    widget_save_->attach_click_callback(save_click_callback);
+    container_outer_->attach_child(widget_save_, 0);
+    container_adsr_ = new DUINO_WidgetContainer<8>(DUINO_Widget::Click);
+    for (uint8_t i = 0; i < 4; ++i)
+    {
+      widgets_adsr_[i] = new DUINO_DisplayWidget(11 * i + 2, 55, 7, 9);
+      widgets_adsr_[i + 4] = new DUINO_DisplayWidget(11 * i + 86, 55, 7, 9);
+      container_adsr_->attach_child(widgets_adsr_[i], i);
+      container_adsr_->attach_child(widgets_adsr_[i + 4], i + 4);
+    }
+    container_outer_->attach_child(container_adsr_, 1);
+    widgets_adsr_[0]->attach_scroll_callback(adsr_scroll_callback_0);
+    widgets_adsr_[1]->attach_scroll_callback(adsr_scroll_callback_1);
+    widgets_adsr_[2]->attach_scroll_callback(adsr_scroll_callback_2);
+    widgets_adsr_[3]->attach_scroll_callback(adsr_scroll_callback_3);
+    widgets_adsr_[4]->attach_scroll_callback(adsr_scroll_callback_4);
+    widgets_adsr_[5]->attach_scroll_callback(adsr_scroll_callback_5);
+    widgets_adsr_[6]->attach_scroll_callback(adsr_scroll_callback_6);
+    widgets_adsr_[7]->attach_scroll_callback(adsr_scroll_callback_7);
+
     env = 0;
     gate_time = 0;
     release_time = 0;
-    selected = 0;
-    saving = false;
     last_selected_env = 0;
     last_gate = false;
 

  }
}

void setup()
{
  gate = retrigger = false;

 */

#include <du-ino_function.h>
#include <du-ino_widgets.h>
#include <avr/pgmspace.h>

#define ENV_PEAK              10.0 // V
