Use nknobs instead of sliders

This commit is contained in:
Nick Lanham 2012-02-22 11:39:59 +01:00
parent 3da6249e55
commit 3030202fa4
2 changed files with 13 additions and 8 deletions

View File

@ -2,10 +2,10 @@ BUNDLE = drmr.lv2
INSTALL_DIR = /usr/local/lib/lv2
CC=gcc
$(BUNDLE): manifest.ttl drmr.ttl drmr.so drmr_ui.so
$(BUNDLE): manifest.ttl drmr.ttl drmr.so drmr_ui.so knob.png
rm -rf $(BUNDLE)
mkdir $(BUNDLE)
cp manifest.ttl drmr.ttl drmr.so drmr_ui.so $(BUNDLE)
cp manifest.ttl drmr.ttl drmr.so drmr_ui.so knob.png $(BUNDLE)
drmr.so: drmr.c drmr_hydrogen.c
$(CC) -shared -Wall -fPIC -DPIC drmr.c drmr_hydrogen.c `pkg-config --cflags --libs lv2-plugin sndfile samplerate` -lexpat -lm -o drmr.so

View File

@ -20,6 +20,7 @@
#include "drmr.h"
#include "drmr_hydrogen.h"
#include "nknob.h"
#include "lv2/lv2plug.in/ns/extensions/ui/ui.h"
#define DRMR_UI_URI "http://github.com/nicklan/drmr#ui"
@ -88,26 +89,30 @@ static void fill_sample_table(DrMrUi* ui, int samples, char** names,GtkWidget**
gtk_frame_set_shadow_type(GTK_FRAME(frame),GTK_SHADOW_OUT);
hbox = gtk_hbox_new(false,0);
gain_slider = gtk_vscale_new_with_range(GAIN_MIN,6.0,1.0);
//gain_slider = gtk_vscale_new_with_range(GAIN_MIN,6.0,1.0);
gain_slider = n_knob_new_with_range(0.0,GAIN_MIN,6.0,1.0);
gtk_widget_set_has_tooltip(gain_slider,TRUE);
gtk_widget_set_size_request(gain_slider,-1,50);
g_object_set_qdata (G_OBJECT(gain_slider),ui->gain_quark,GINT_TO_POINTER(si));
if (gain_sliders) gain_sliders[si] = gain_slider;
gtk_range_set_inverted(GTK_RANGE(gain_slider),true);
gtk_scale_set_value_pos(GTK_SCALE(gain_slider),GTK_POS_BOTTOM);
//gtk_scale_set_value_pos(GTK_SCALE(gain_slider),GTK_POS_BOTTOM);
if (si < 32)
gtk_range_set_value(GTK_RANGE(gain_slider),ui->gain_vals[si]);
else // things are gross if we have > 32 samples, what to do?
gtk_range_set_value(GTK_RANGE(gain_slider),0.0);
g_signal_connect(G_OBJECT(gain_slider),"change-value",G_CALLBACK(gain_callback),ui);
gtk_scale_set_digits(GTK_SCALE(gain_slider),1);
gtk_scale_add_mark(GTK_SCALE(gain_slider),0.0,GTK_POS_RIGHT,"0 dB");
//gtk_scale_set_digits(GTK_SCALE(gain_slider),1);
//gtk_scale_add_mark(GTK_SCALE(gain_slider),0.0,GTK_POS_RIGHT,"0 dB");
// Hrmm, -inf label is at top in ardour for some reason
//gtk_scale_add_mark(GTK_SCALE(gain_slider),GAIN_MIN,GTK_POS_RIGHT,"-inf");
gain_label = gtk_label_new("Gain");
gain_vbox = gtk_vbox_new(false,0);
pan_slider = gtk_hscale_new_with_range(-1.0,1.0,0.1);
//pan_slider = gtk_hscale_new_with_range(-1.0,1.0,0.1);
pan_slider = n_knob_new_with_range(0.0,-1.0,1.0,0.1);
gtk_widget_set_has_tooltip(pan_slider,TRUE);
gtk_widget_set_size_request(pan_slider,50,-1);
if (pan_sliders) pan_sliders[si] = pan_slider;
if (si < 32)
@ -115,7 +120,7 @@ static void fill_sample_table(DrMrUi* ui, int samples, char** names,GtkWidget**
else
gtk_range_set_value(GTK_RANGE(pan_slider),0);
g_object_set_qdata (G_OBJECT(pan_slider),ui->pan_quark,GINT_TO_POINTER(si));
gtk_scale_add_mark(GTK_SCALE(pan_slider),0.0,GTK_POS_TOP,NULL);
//gtk_scale_add_mark(GTK_SCALE(pan_slider),0.0,GTK_POS_TOP,NULL);
g_signal_connect(G_OBJECT(pan_slider),"change-value",G_CALLBACK(pan_callback),ui);
pan_label = gtk_label_new("Pan");
pan_vbox = gtk_vbox_new(false,0);