Merge remote-tracking branch 'upstream/master'
This commit is contained in:
10
AUTHORS
10
AUTHORS
@@ -1 +1,11 @@
|
||||
Tomasz Moń <desowin@gmail.com>
|
||||
Stephen Rigler <riglersc@gmail.com>
|
||||
Jaco Kroon <jaco@kroon.co.za>
|
||||
Rafael Moreno <laocanfei@yahoo.com>
|
||||
Andrew O. Shadoura <bugzilla@tut.by>
|
||||
Andreas Karajannis <aakara13@googlemail.com>
|
||||
Miklos Aubert <miklos.aubert@gmail.com>
|
||||
Jonathan A. Tice <jonandtice@gmail.com>
|
||||
John Hammen <jhammen@gmail.com>
|
||||
Ahmed Toulan <thelinuxer@gmail.com>
|
||||
Tim LaBerge <tlaberge@visi.com>
|
||||
|
||||
2
README
2
README
@@ -1,4 +1,4 @@
|
||||
Requirments: alsa, gtk+, glib, expat
|
||||
Requirments: alsa, gtk+, glib, expat, libxml-2
|
||||
|
||||
Getting started guide:
|
||||
-to compile: make
|
||||
|
||||
1
TODO
1
TODO
@@ -2,5 +2,4 @@
|
||||
-handling presets (saving, exporting to xml patches)
|
||||
-buildsystem (install knob.png to share dir, don't use inline knob pixbuf)
|
||||
-various fixes to MIDI IN messages handling
|
||||
-ask user which device to use if more than one DigiTech device is found
|
||||
-optimizations
|
||||
|
||||
29
gdigi.c
29
gdigi.c
@@ -1058,6 +1058,8 @@ static gboolean request_who_am_i(unsigned char *device_id, unsigned char *family
|
||||
*device_id = data->str[8];
|
||||
*family_id = data->str[9];
|
||||
*product_id = data->str[10];
|
||||
g_message("I am device id %d family %d product id %d.",
|
||||
*device_id, *family_id, *product_id);
|
||||
g_string_free(data, TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
@@ -1122,18 +1124,14 @@ static gint get_digitech_devices(GList **devices)
|
||||
{
|
||||
gint card_num = -1;
|
||||
gint number = 0;
|
||||
snd_card_next(&card_num);
|
||||
|
||||
while (card_num > -1) {
|
||||
while (!snd_card_next(&card_num) && (card_num > -1)) {
|
||||
char* name;
|
||||
snd_card_get_longname(card_num, &name);
|
||||
gint count = strspn(name,"DigiTech");
|
||||
if (count > 0)
|
||||
{
|
||||
if (strspn(name,"DigiTech") > 0) {
|
||||
number++;
|
||||
*devices = g_list_append(*devices, GINT_TO_POINTER(card_num));
|
||||
}
|
||||
snd_card_next(&card_num);
|
||||
}
|
||||
|
||||
return number;
|
||||
@@ -1161,13 +1159,24 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
if (device_port == NULL) {
|
||||
/* port not given explicitly in commandline - search for devices */
|
||||
GList *devices = NULL;
|
||||
if (get_digitech_devices(&devices) <= 0) {
|
||||
g_message("Couldn't find DigiTech devices!");
|
||||
GList *devices = NULL;
|
||||
GList *device = NULL;
|
||||
int num_devices = 0;
|
||||
int chosen_device = 0;
|
||||
if ((num_devices = get_digitech_devices(&devices)) <= 0) {
|
||||
g_message("Couldn't find any DigiTech devices!");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (num_devices > 1) {
|
||||
chosen_device = select_device_dialog(devices);
|
||||
if (chosen_device < 0) {
|
||||
show_error_message(NULL, "No device chosen");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
device = g_list_nth(devices, chosen_device);
|
||||
device_port = g_strdup_printf("hw:%d,0,0",
|
||||
GPOINTER_TO_INT(devices->data));
|
||||
GPOINTER_TO_INT(device->data));
|
||||
g_list_free(devices);
|
||||
g_message("Found device %s", device_port);
|
||||
} else {
|
||||
|
||||
68
gui.c
68
gui.c
@@ -17,6 +17,7 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib-object.h>
|
||||
#include <string.h>
|
||||
#include <alsa/asoundlib.h>
|
||||
#include "gdigi.h"
|
||||
#include "gui.h"
|
||||
#include "effects.h"
|
||||
@@ -840,10 +841,21 @@ static void action_show_about_dialog_cb(GtkAction *action)
|
||||
{
|
||||
static const gchar * const authors[] = {
|
||||
"Tomasz Moń <desowin@gmail.com>",
|
||||
"Stephen Rigler <riglersc@gmail.com>",
|
||||
"Jaco Kroon <jaco@kroon.co.za>",
|
||||
"Rafael Moreno <laocanfei@yahoo.com>",
|
||||
"Andrew O. Shadoura <bugzilla@tut.by>",
|
||||
"Andreas Karajannis <aakara13@googlemail.com>",
|
||||
"Miklos Aubert <miklos.aubert@gmail.com>",
|
||||
"Jonathan A. Tice <jonandtice@gmail.com>",
|
||||
"John Hammen <jhammen@gmail.com>",
|
||||
"Ahmed Toulan <thelinuxer@gmail.com>",
|
||||
"Tim LaBerge <tlaberge@visi.com>",
|
||||
NULL
|
||||
};
|
||||
static const gchar copyright[] = "Copyright \xc2\xa9 2009 Tomasz Moń";
|
||||
static const gchar website[] = "http://desowin.org/gdigi/";
|
||||
static const gchar version[] = "0.3.0";
|
||||
|
||||
GtkWidget *window = g_object_get_data(G_OBJECT(action), "window");
|
||||
|
||||
@@ -851,6 +863,10 @@ static void action_show_about_dialog_cb(GtkAction *action)
|
||||
"authors", authors,
|
||||
"copyright", copyright,
|
||||
"website", website,
|
||||
"license-type", GTK_LICENSE_GPL_3_0,
|
||||
"wrap-license", TRUE,
|
||||
"program-name", "gdigi",
|
||||
"version", version,
|
||||
NULL);
|
||||
}
|
||||
|
||||
@@ -1339,3 +1355,55 @@ gboolean unsupported_device_dialog(Device **device)
|
||||
gtk_widget_destroy(dialog);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* \param devices List containing the available Digitech devices.
|
||||
*
|
||||
* Displays dialogbox for choosing a device.
|
||||
*
|
||||
* \return Index of the selected device or -1 on failure.
|
||||
**/
|
||||
gint select_device_dialog (GList *devices)
|
||||
{
|
||||
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *label;
|
||||
GtkWidget *combo_box;
|
||||
GtkWidget *vbox;
|
||||
GList *device;
|
||||
|
||||
dialog = gtk_dialog_new_with_buttons("Select Digitech device",
|
||||
NULL, GTK_DIALOG_MODAL,
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
|
||||
NULL);
|
||||
|
||||
vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
|
||||
|
||||
label = gtk_label_new("You have multiple Digitech devices, select one.\n");
|
||||
gtk_container_add(GTK_CONTAINER(vbox), label);
|
||||
|
||||
combo_box = gtk_combo_box_text_new();
|
||||
device = g_list_first(devices);
|
||||
do {
|
||||
char *name;
|
||||
|
||||
snd_card_get_longname(GPOINTER_TO_INT(device->data), &name);
|
||||
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(combo_box), NULL, name);
|
||||
|
||||
} while ((device = g_list_next(device)));
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(vbox), combo_box);
|
||||
|
||||
gtk_widget_show_all(vbox);
|
||||
if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
|
||||
gint number = gtk_combo_box_get_active(GTK_COMBO_BOX(combo_box));
|
||||
if (number != -1) {
|
||||
gtk_widget_destroy(dialog);
|
||||
return (number);
|
||||
}
|
||||
}
|
||||
|
||||
gtk_widget_destroy(dialog);
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user