annotate Plugins/Input/amidi-plug/i_configure.c @ 1315:c7b3996a123f trunk

[svn] - chase encoding patch removal
author nenolod
date Mon, 19 Jun 2006 23:00:03 -0700
parents bc14606391fc
children b0590e16329f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
522
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
1 /*
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
2 *
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
3 * Author: Giacomo Lozito <james@develia.org>, (C) 2005-2006
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
4 *
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
5 * This program is free software; you can redistribute it and/or modify it
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
6 * under the terms of the GNU General Public License as published by the
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
7 * Free Software Foundation; either version 2 of the License, or (at your
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
8 * option) any later version.
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
9 *
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful, but
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
13 * General Public License for more details.
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
14 *
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License along
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
16 * with this program; if not, write to the Free Software Foundation, Inc.,
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
17 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
18 *
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
19 */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
20
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
21
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
22 #include "i_configure.h"
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
23
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
24 /* internals */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
25 void i_configure_upd_portlist( void );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
26 void i_configure_upd_mixercardlist( void );
525
6e332a32d2f5 [svn] amidi-plug: do not try to guess the correct alsa port from alsa-lib version if there's not a wavetable hw synth available
giacomo
parents: 522
diff changeset
27 gchar * i_configure_read_seq_ports_default( void );
522
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
28 gboolean i_configure_ev_checktoggle( GtkTreeModel * , GtkTreePath * , GtkTreeIter * , gpointer );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
29 void i_configure_ev_changetoggle( GtkCellRendererToggle * , gchar * , gpointer );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
30
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
31
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
32 void i_configure_gui( GSList * wports , GSList * scards )
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
33 {
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
34 GtkWidget *configwin_vbox;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
35 GtkWidget *port_lv, *port_lv_sw, *port_frame;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
36 GtkWidget *mixer_card_cmb_evbox, *mixer_card_cmb, *mixer_vbox, *mixer_frame;
805
b8b9d7f5d371 [svn] update amidi-plug towards 0.2; bug fixes and a new option (midi length pre-calculation)
giacomo
parents: 525
diff changeset
37 GtkWidget *advanced_precalc_checkbt, *advanced_vbox, *advanced_frame;
522
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
38 GtkWidget *hseparator, *hbuttonbox, *button_ok, *button_cancel;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
39 GtkListStore *port_liststore, *mixer_card_liststore;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
40 GtkTreeIter iter;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
41 GtkTreeSelection *port_lv_sel;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
42 GtkCellRenderer *port_lv_toggle_rndr, *port_lv_text_rndr, *mixer_card_cmb_text_rndr;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
43 GtkTreeViewColumn *port_lv_toggle_col, *port_lv_portnum_col;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
44 GtkTreeViewColumn *port_lv_clientname_col, *port_lv_portname_col;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
45 gchar **portstring_from_cfg = NULL;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
46
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
47 if ( amidiplug_gui_prefs.config_win )
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
48 return;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
49
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
50 if ( strlen( amidiplug_cfg.seq_writable_ports ) > 0 )
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
51 portstring_from_cfg = g_strsplit( amidiplug_cfg.seq_writable_ports , "," , 0 );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
52
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
53 amidiplug_gui_prefs.config_win = gtk_window_new( GTK_WINDOW_TOPLEVEL );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
54 gtk_window_set_type_hint( GTK_WINDOW(amidiplug_gui_prefs.config_win), GDK_WINDOW_TYPE_HINT_DIALOG );
860
ee25017cb472 [svn] amidi-plug: completed merge with 0.2 changes
giacomo
parents: 805
diff changeset
55 gtk_window_set_title( GTK_WINDOW(amidiplug_gui_prefs.config_win), _("AMIDI-Plug - configuration") );
522
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
56 gtk_container_set_border_width( GTK_CONTAINER(amidiplug_gui_prefs.config_win), 10 );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
57 g_signal_connect( G_OBJECT(amidiplug_gui_prefs.config_win) ,
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
58 "destroy" , G_CALLBACK(i_configure_ev_destroy) , NULL );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
59
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
60 configwin_vbox = gtk_vbox_new( FALSE , 0 );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
61 gtk_container_add( GTK_CONTAINER(amidiplug_gui_prefs.config_win) , configwin_vbox );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
62
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
63 port_liststore = gtk_list_store_new( LISTPORT_N_COLUMNS, G_TYPE_BOOLEAN, G_TYPE_STRING ,
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
64 G_TYPE_STRING , G_TYPE_STRING , G_TYPE_POINTER );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
65
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
66 /* append ALSA MIDI ports */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
67 while ( wports != NULL )
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
68 {
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
69 gint i = 0;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
70 gboolean toggled = FALSE;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
71 data_bucket_t * portinfo = (data_bucket_t *)wports->data;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
72 GString * portstring = g_string_new("");
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
73 G_STRING_PRINTF( portstring , "%i:%i" ,
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
74 portinfo->bint[0] , portinfo->bint[1] );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
75 gtk_list_store_append( port_liststore , &iter );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
76
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
77 /* in the existing configuration there may be previously selected ports */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
78 if ( portstring_from_cfg )
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
79 {
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
80 /* check if current row contains a port selected by user */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
81 for ( i = 0 ; portstring_from_cfg[i] != NULL ; i++ )
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
82 {
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
83 /* if it's one of the selected ports, toggle its checkbox */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
84 if ( !strcmp( portstring->str, portstring_from_cfg[i] ) )
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
85 toggled = TRUE;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
86 }
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
87 }
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
88
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
89 gtk_list_store_set( port_liststore , &iter ,
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
90 LISTPORT_TOGGLE_COLUMN , toggled ,
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
91 LISTPORT_PORTNUM_COLUMN , portstring->str ,
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
92 LISTPORT_CLIENTNAME_COLUMN , portinfo->bcharp[0] ,
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
93 LISTPORT_PORTNAME_COLUMN , portinfo->bcharp[1] ,
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
94 LISTPORT_POINTER_COLUMN , portinfo , -1 );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
95
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
96 g_string_free( portstring , TRUE );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
97 /* on with next */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
98 wports = wports->next;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
99 }
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
100
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
101 /* this string array is not needed anymore */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
102 g_strfreev( portstring_from_cfg );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
103
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
104 port_lv = gtk_tree_view_new_with_model( GTK_TREE_MODEL(port_liststore) );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
105 amidiplug_gui_prefs.port_treeview = port_lv;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
106 g_object_unref( port_liststore );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
107 port_lv_toggle_rndr = gtk_cell_renderer_toggle_new();
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
108 gtk_cell_renderer_toggle_set_radio( GTK_CELL_RENDERER_TOGGLE(port_lv_toggle_rndr) , FALSE );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
109 gtk_cell_renderer_toggle_set_active( GTK_CELL_RENDERER_TOGGLE(port_lv_toggle_rndr) , TRUE );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
110 g_signal_connect( port_lv_toggle_rndr , "toggled" ,
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
111 G_CALLBACK(i_configure_ev_changetoggle) , port_liststore );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
112 port_lv_text_rndr = gtk_cell_renderer_text_new();
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
113 port_lv_toggle_col = gtk_tree_view_column_new_with_attributes( "", port_lv_toggle_rndr,
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
114 "active", LISTPORT_TOGGLE_COLUMN, NULL );
860
ee25017cb472 [svn] amidi-plug: completed merge with 0.2 changes
giacomo
parents: 805
diff changeset
115 port_lv_portnum_col = gtk_tree_view_column_new_with_attributes( _("Port"), port_lv_text_rndr,
522
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
116 "text", LISTPORT_PORTNUM_COLUMN, NULL );
860
ee25017cb472 [svn] amidi-plug: completed merge with 0.2 changes
giacomo
parents: 805
diff changeset
117 port_lv_clientname_col = gtk_tree_view_column_new_with_attributes( _("Client name"), port_lv_text_rndr,
522
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
118 "text", LISTPORT_CLIENTNAME_COLUMN, NULL );
860
ee25017cb472 [svn] amidi-plug: completed merge with 0.2 changes
giacomo
parents: 805
diff changeset
119 port_lv_portname_col = gtk_tree_view_column_new_with_attributes( _("Port name"), port_lv_text_rndr,
522
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
120 "text", LISTPORT_PORTNAME_COLUMN, NULL );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
121 gtk_tree_view_append_column( GTK_TREE_VIEW(port_lv), port_lv_toggle_col );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
122 gtk_tree_view_append_column( GTK_TREE_VIEW(port_lv), port_lv_portnum_col );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
123 gtk_tree_view_append_column( GTK_TREE_VIEW(port_lv), port_lv_clientname_col );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
124 gtk_tree_view_append_column( GTK_TREE_VIEW(port_lv), port_lv_portname_col );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
125
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
126 port_lv_sel = gtk_tree_view_get_selection( GTK_TREE_VIEW(port_lv) );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
127 gtk_tree_selection_set_mode( GTK_TREE_SELECTION(port_lv_sel) , GTK_SELECTION_SINGLE );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
128
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
129 port_lv_sw = gtk_scrolled_window_new( NULL , NULL );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
130 gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(port_lv_sw),
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
131 GTK_POLICY_NEVER, GTK_POLICY_NEVER );
860
ee25017cb472 [svn] amidi-plug: completed merge with 0.2 changes
giacomo
parents: 805
diff changeset
132 port_frame = gtk_frame_new( _("ALSA output ports") );
522
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
133
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
134 gtk_container_add( GTK_CONTAINER(port_lv_sw) , port_lv );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
135 gtk_container_set_border_width( GTK_CONTAINER(port_lv_sw) , 5 );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
136 gtk_container_add( GTK_CONTAINER(port_frame) , port_lv_sw );
805
b8b9d7f5d371 [svn] update amidi-plug towards 0.2; bug fixes and a new option (midi length pre-calculation)
giacomo
parents: 525
diff changeset
137 gtk_box_pack_start( GTK_BOX(configwin_vbox) , port_frame , TRUE , TRUE , 2 );
522
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
138
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
139 /**********************/
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
140 /*** MIXER SETTINGS ***/
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
141 mixer_card_liststore = gtk_list_store_new( LISTMIXER_N_COLUMNS , G_TYPE_STRING , G_TYPE_INT ,
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
142 G_TYPE_INT , G_TYPE_STRING );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
143 mixer_card_cmb = gtk_combo_box_new_with_model( GTK_TREE_MODEL(mixer_card_liststore) );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
144 amidiplug_gui_prefs.mixercard_combo = mixer_card_cmb;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
145 /* fill models with sound cards and relative mixer controls */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
146 while ( scards != NULL )
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
147 {
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
148 data_bucket_t * cardinfo = (data_bucket_t *)scards->data;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
149 GString * desc_cardmix_string = g_string_new( "" );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
150 GSList * mixctl_list = cardinfo->bpointer[0];
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
151 while ( mixctl_list != NULL )
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
152 {
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
153 data_bucket_t * mixctlinfo = (data_bucket_t *)mixctl_list->data;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
154 G_STRING_PRINTF( desc_cardmix_string , "%s - ctl: %s (ID %i)" , cardinfo->bcharp[0] ,
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
155 mixctlinfo->bcharp[0] , mixctlinfo->bint[0] );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
156 gtk_list_store_append( mixer_card_liststore , &iter );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
157 gtk_list_store_set( mixer_card_liststore , &iter ,
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
158 LISTMIXER_DESC_COLUMN , desc_cardmix_string->str ,
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
159 LISTMIXER_CARDID_COLUMN , cardinfo->bint[0] ,
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
160 LISTMIXER_MIXCTLID_COLUMN , mixctlinfo->bint[0] ,
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
161 LISTMIXER_MIXCTLNAME_COLUMN , mixctlinfo->bcharp[0] , -1 );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
162 /* check if this corresponds to the value previously selected by user */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
163 if ( ( cardinfo->bint[0] == amidiplug_cfg.mixer_card_id ) &&
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
164 ( !strcasecmp( mixctlinfo->bcharp[0] , amidiplug_cfg.mixer_control_name ) ) &&
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
165 ( mixctlinfo->bint[0] == amidiplug_cfg.mixer_control_id ) )
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
166 gtk_combo_box_set_active_iter( GTK_COMBO_BOX(mixer_card_cmb) , &iter );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
167 mixctl_list = mixctl_list->next;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
168 }
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
169 g_string_free( desc_cardmix_string , TRUE );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
170 /* on with next */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
171 scards = scards->next;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
172 }
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
173 /* free the instance of liststore, we already have one in the combo box */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
174 g_object_unref( mixer_card_liststore );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
175 /* create renderer to display text in the mixer combo box */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
176 mixer_card_cmb_text_rndr = gtk_cell_renderer_text_new();
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
177 gtk_cell_layout_pack_start( GTK_CELL_LAYOUT(mixer_card_cmb) , mixer_card_cmb_text_rndr , TRUE );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
178 gtk_cell_layout_add_attribute( GTK_CELL_LAYOUT(mixer_card_cmb) , mixer_card_cmb_text_rndr , "text" , 0 );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
179
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
180 /* the event box is needed to display a tooltip for the mixer combo box */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
181 mixer_card_cmb_evbox = gtk_event_box_new();
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
182 gtk_container_add( GTK_CONTAINER(mixer_card_cmb_evbox) , mixer_card_cmb );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
183 mixer_vbox = gtk_vbox_new( FALSE , 0 );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
184 gtk_container_set_border_width( GTK_CONTAINER(mixer_vbox) , 5 );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
185 gtk_box_pack_start( GTK_BOX(mixer_vbox) , mixer_card_cmb_evbox , TRUE , TRUE , 0 );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
186
860
ee25017cb472 [svn] amidi-plug: completed merge with 0.2 changes
giacomo
parents: 805
diff changeset
187 mixer_frame = gtk_frame_new( _("Mixer settings") );
522
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
188 gtk_container_add( GTK_CONTAINER(mixer_frame) , mixer_vbox );
805
b8b9d7f5d371 [svn] update amidi-plug towards 0.2; bug fixes and a new option (midi length pre-calculation)
giacomo
parents: 525
diff changeset
189 gtk_box_pack_start( GTK_BOX(configwin_vbox) , mixer_frame , TRUE , TRUE , 2 );
b8b9d7f5d371 [svn] update amidi-plug towards 0.2; bug fixes and a new option (midi length pre-calculation)
giacomo
parents: 525
diff changeset
190
b8b9d7f5d371 [svn] update amidi-plug towards 0.2; bug fixes and a new option (midi length pre-calculation)
giacomo
parents: 525
diff changeset
191 /*************************/
b8b9d7f5d371 [svn] update amidi-plug towards 0.2; bug fixes and a new option (midi length pre-calculation)
giacomo
parents: 525
diff changeset
192 /*** ADVANCED SETTINGS ***/
b8b9d7f5d371 [svn] update amidi-plug towards 0.2; bug fixes and a new option (midi length pre-calculation)
giacomo
parents: 525
diff changeset
193 advanced_vbox = gtk_vbox_new( FALSE , 0 );
b8b9d7f5d371 [svn] update amidi-plug towards 0.2; bug fixes and a new option (midi length pre-calculation)
giacomo
parents: 525
diff changeset
194 gtk_container_set_border_width( GTK_CONTAINER(advanced_vbox) , 5 );
b8b9d7f5d371 [svn] update amidi-plug towards 0.2; bug fixes and a new option (midi length pre-calculation)
giacomo
parents: 525
diff changeset
195
860
ee25017cb472 [svn] amidi-plug: completed merge with 0.2 changes
giacomo
parents: 805
diff changeset
196 advanced_precalc_checkbt = gtk_check_button_new_with_label( _("pre-calculate length of MIDI files in playlist") );
805
b8b9d7f5d371 [svn] update amidi-plug towards 0.2; bug fixes and a new option (midi length pre-calculation)
giacomo
parents: 525
diff changeset
197 amidiplug_gui_prefs.precalc_checkbt = advanced_precalc_checkbt;
b8b9d7f5d371 [svn] update amidi-plug towards 0.2; bug fixes and a new option (midi length pre-calculation)
giacomo
parents: 525
diff changeset
198 if ( amidiplug_cfg.length_precalc_enable )
b8b9d7f5d371 [svn] update amidi-plug towards 0.2; bug fixes and a new option (midi length pre-calculation)
giacomo
parents: 525
diff changeset
199 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(advanced_precalc_checkbt) , TRUE );
b8b9d7f5d371 [svn] update amidi-plug towards 0.2; bug fixes and a new option (midi length pre-calculation)
giacomo
parents: 525
diff changeset
200 gtk_box_pack_start( GTK_BOX(advanced_vbox) , advanced_precalc_checkbt , TRUE , TRUE , 0 );
b8b9d7f5d371 [svn] update amidi-plug towards 0.2; bug fixes and a new option (midi length pre-calculation)
giacomo
parents: 525
diff changeset
201
860
ee25017cb472 [svn] amidi-plug: completed merge with 0.2 changes
giacomo
parents: 805
diff changeset
202 advanced_frame = gtk_frame_new( _("Advanced settings") );
805
b8b9d7f5d371 [svn] update amidi-plug towards 0.2; bug fixes and a new option (midi length pre-calculation)
giacomo
parents: 525
diff changeset
203 gtk_container_add( GTK_CONTAINER(advanced_frame) , advanced_vbox );
b8b9d7f5d371 [svn] update amidi-plug towards 0.2; bug fixes and a new option (midi length pre-calculation)
giacomo
parents: 525
diff changeset
204 gtk_box_pack_start( GTK_BOX(configwin_vbox) , advanced_frame , TRUE , TRUE , 2 );
b8b9d7f5d371 [svn] update amidi-plug towards 0.2; bug fixes and a new option (midi length pre-calculation)
giacomo
parents: 525
diff changeset
205
522
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
206
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
207 /* horizontal separator and buttons */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
208 hseparator = gtk_hseparator_new();
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
209 gtk_box_pack_start( GTK_BOX(configwin_vbox) , hseparator , FALSE , FALSE , 4 );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
210 hbuttonbox = gtk_hbutton_box_new();
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
211 gtk_button_box_set_layout( GTK_BUTTON_BOX(hbuttonbox) , GTK_BUTTONBOX_END );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
212 button_cancel = gtk_button_new_from_stock( GTK_STOCK_CANCEL );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
213 g_signal_connect( G_OBJECT(button_cancel) , "clicked" , G_CALLBACK(i_configure_ev_bcancel) , NULL );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
214 gtk_container_add( GTK_CONTAINER(hbuttonbox) , button_cancel );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
215 button_ok = gtk_button_new_from_stock( GTK_STOCK_OK );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
216 g_signal_connect( G_OBJECT(button_ok) , "clicked" , G_CALLBACK(i_configure_ev_bok) , NULL );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
217 gtk_container_add( GTK_CONTAINER(hbuttonbox) , button_ok );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
218 gtk_box_pack_start( GTK_BOX(configwin_vbox) , hbuttonbox , FALSE , FALSE , 0 );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
219
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
220 /* tooltips */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
221 amidiplug_gui_prefs.config_tips = gtk_tooltips_new();
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
222 gtk_tooltips_set_tip( GTK_TOOLTIPS(amidiplug_gui_prefs.config_tips) , port_lv ,
860
ee25017cb472 [svn] amidi-plug: completed merge with 0.2 changes
giacomo
parents: 805
diff changeset
223 _("* Select ALSA output ports *\n"
522
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
224 "MIDI events will be sent to the ports selected here. At least one "
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
225 "port must be selected in order to play MIDI with AMIDI-Plug. Unless "
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
226 "you know what you're doing, you'll probably want to use the "
860
ee25017cb472 [svn] amidi-plug: completed merge with 0.2 changes
giacomo
parents: 805
diff changeset
227 "wavetable synthesizer ports.") , "" );
522
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
228 gtk_tooltips_set_tip( GTK_TOOLTIPS(amidiplug_gui_prefs.config_tips) , mixer_card_cmb_evbox ,
860
ee25017cb472 [svn] amidi-plug: completed merge with 0.2 changes
giacomo
parents: 805
diff changeset
229 _("* Select ALSA mixer control *\n"
522
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
230 "AMIDI-Plug outputs directly through ALSA, it doesn't use effect "
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
231 "and ouput plugins from the player. While playing with AMIDI-Plug, "
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
232 "the player volume will manipulate the control you select here. "
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
233 "Unless you know what you're doing, you'll probably want to select "
860
ee25017cb472 [svn] amidi-plug: completed merge with 0.2 changes
giacomo
parents: 805
diff changeset
234 "the Synth control here.") , "" );
ee25017cb472 [svn] amidi-plug: completed merge with 0.2 changes
giacomo
parents: 805
diff changeset
235 gtk_tooltips_set_tip( GTK_TOOLTIPS(amidiplug_gui_prefs.config_tips) , advanced_precalc_checkbt ,
ee25017cb472 [svn] amidi-plug: completed merge with 0.2 changes
giacomo
parents: 805
diff changeset
236 _("* Pre-calculate MIDI length *\n"
ee25017cb472 [svn] amidi-plug: completed merge with 0.2 changes
giacomo
parents: 805
diff changeset
237 "If this option is enabled, AMIDI-Plug will calculate the MIDI file "
ee25017cb472 [svn] amidi-plug: completed merge with 0.2 changes
giacomo
parents: 805
diff changeset
238 "length as soon as the player requests it, instead of doing that only "
ee25017cb472 [svn] amidi-plug: completed merge with 0.2 changes
giacomo
parents: 805
diff changeset
239 "when the the MIDI file is being played. In example, MIDI length "
ee25017cb472 [svn] amidi-plug: completed merge with 0.2 changes
giacomo
parents: 805
diff changeset
240 "will be calculated straight after adding MIDI files in a playlist. "
ee25017cb472 [svn] amidi-plug: completed merge with 0.2 changes
giacomo
parents: 805
diff changeset
241 "Disable this option if you want faster playlist loading (when a lot "
ee25017cb472 [svn] amidi-plug: completed merge with 0.2 changes
giacomo
parents: 805
diff changeset
242 "of MIDI files are added), enable it to display more information "
ee25017cb472 [svn] amidi-plug: completed merge with 0.2 changes
giacomo
parents: 805
diff changeset
243 "in the playlist straight after loading.") , "" );
522
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
244
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
245 gtk_widget_show_all( amidiplug_gui_prefs.config_win );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
246 }
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
247
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
248
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
249 void i_configure_upd_portlist( void )
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
250 {
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
251 GtkTreeModel * liststore;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
252 GString *wp = g_string_new( "" );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
253 /* get the model of the port list control */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
254 liststore = gtk_tree_view_get_model( GTK_TREE_VIEW(amidiplug_gui_prefs.port_treeview) );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
255 /* after the following foreach, wp contains a comma-separated list of selected ports */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
256 gtk_tree_model_foreach( liststore , i_configure_ev_checktoggle , wp );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
257 /* free previous */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
258 g_free( amidiplug_cfg.seq_writable_ports );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
259 /* update point amidiplug_cfg.seq_writable_ports
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
260 so it points to the new list of ports */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
261 amidiplug_cfg.seq_writable_ports = g_strdup( wp->str );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
262 /* not needed anymore */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
263 g_string_free( wp , TRUE );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
264 return;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
265 }
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
266
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
267
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
268 void i_configure_upd_mixercardlist( void )
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
269 {
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
270 GtkTreeModel * liststore;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
271 GtkTreeIter iter;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
272 /* get the model of the card-mixer list control */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
273 liststore = gtk_combo_box_get_model( GTK_COMBO_BOX(amidiplug_gui_prefs.mixercard_combo) );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
274 /* get the selected item */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
275 if ( gtk_combo_box_get_active_iter( GTK_COMBO_BOX(amidiplug_gui_prefs.mixercard_combo) , &iter ) )
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
276 {
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
277 /* free previous */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
278 g_free( amidiplug_cfg.mixer_control_name );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
279 /* update amidiplug_cfg.mixer_card_id and amidiplug_cfg.mixer_control_name */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
280 gtk_tree_model_get( GTK_TREE_MODEL(liststore) , &iter ,
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
281 LISTMIXER_CARDID_COLUMN , &amidiplug_cfg.mixer_card_id ,
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
282 LISTMIXER_MIXCTLID_COLUMN , &amidiplug_cfg.mixer_control_id ,
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
283 LISTMIXER_MIXCTLNAME_COLUMN , &amidiplug_cfg.mixer_control_name , -1 );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
284 }
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
285 return;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
286 }
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
287
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
288
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
289 gboolean i_configure_ev_checktoggle( GtkTreeModel * model , GtkTreePath * path ,
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
290 GtkTreeIter * iter , gpointer wpp )
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
291 {
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
292 gboolean toggled = FALSE;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
293 gchar * portstring;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
294 GString * wps = wpp;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
295 gtk_tree_model_get ( model , iter ,
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
296 LISTPORT_TOGGLE_COLUMN , &toggled ,
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
297 LISTPORT_PORTNUM_COLUMN , &portstring , -1 );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
298 /* check if the row points to an enabled port */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
299 if ( toggled )
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
300 {
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
301 /* if this is not the first port added to wp, use comma as separator */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
302 if ( wps->str[0] != '\0' ) g_string_append_c( wps , ',' );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
303 g_string_append( wps , portstring );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
304 }
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
305 g_free( portstring );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
306 return FALSE;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
307 }
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
308
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
309
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
310 void i_configure_ev_changetoggle( GtkCellRendererToggle * rdtoggle ,
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
311 gchar * path_str , gpointer data )
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
312 {
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
313 GtkTreeModel *model = (GtkTreeModel *)data;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
314 GtkTreeIter iter;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
315 GtkTreePath *path = gtk_tree_path_new_from_string( path_str );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
316 gboolean toggled;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
317
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
318 gtk_tree_model_get_iter( model , &iter , path );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
319 gtk_tree_model_get( model , &iter , LISTPORT_TOGGLE_COLUMN , &toggled , -1);
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
320
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
321 toggled ^= 1;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
322 gtk_list_store_set( GTK_LIST_STORE(model), &iter , LISTPORT_TOGGLE_COLUMN , toggled , -1);
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
323
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
324 gtk_tree_path_free (path);
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
325 }
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
326
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
327
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
328 void i_configure_ev_destroy( void )
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
329 {
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
330 g_object_unref( amidiplug_gui_prefs.config_tips );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
331 amidiplug_gui_prefs.config_tips = NULL;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
332 amidiplug_gui_prefs.config_win = NULL;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
333 }
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
334
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
335
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
336 void i_configure_ev_bcancel( void )
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
337 {
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
338 gtk_widget_destroy(amidiplug_gui_prefs.config_win);
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
339 }
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
340
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
341
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
342 void i_configure_ev_bok( void )
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
343 {
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
344 /* update amidiplug_cfg.seq_writable_ports
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
345 using the selected values from the port list */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
346 i_configure_upd_portlist();
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
347
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
348 /* update amidiplug_cfg.mixer_card_id and amidiplug_cfg.mixer_control_name
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
349 using the selected values from the card-mixer combo list */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
350 i_configure_upd_mixercardlist();
805
b8b9d7f5d371 [svn] update amidi-plug towards 0.2; bug fixes and a new option (midi length pre-calculation)
giacomo
parents: 525
diff changeset
351
b8b9d7f5d371 [svn] update amidi-plug towards 0.2; bug fixes and a new option (midi length pre-calculation)
giacomo
parents: 525
diff changeset
352 /* update amidiplug_cfg.length_precalc_enable using
b8b9d7f5d371 [svn] update amidi-plug towards 0.2; bug fixes and a new option (midi length pre-calculation)
giacomo
parents: 525
diff changeset
353 the check control in the advanced settings frame */
b8b9d7f5d371 [svn] update amidi-plug towards 0.2; bug fixes and a new option (midi length pre-calculation)
giacomo
parents: 525
diff changeset
354 if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(amidiplug_gui_prefs.precalc_checkbt) ) )
b8b9d7f5d371 [svn] update amidi-plug towards 0.2; bug fixes and a new option (midi length pre-calculation)
giacomo
parents: 525
diff changeset
355 amidiplug_cfg.length_precalc_enable = 1;
b8b9d7f5d371 [svn] update amidi-plug towards 0.2; bug fixes and a new option (midi length pre-calculation)
giacomo
parents: 525
diff changeset
356 else
b8b9d7f5d371 [svn] update amidi-plug towards 0.2; bug fixes and a new option (midi length pre-calculation)
giacomo
parents: 525
diff changeset
357 amidiplug_cfg.length_precalc_enable = 0;
522
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
358
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
359 /* save settings */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
360 i_configure_cfg_save();
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
361
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
362 gtk_widget_destroy(amidiplug_gui_prefs.config_win);
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
363 }
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
364
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
365
525
6e332a32d2f5 [svn] amidi-plug: do not try to guess the correct alsa port from alsa-lib version if there's not a wavetable hw synth available
giacomo
parents: 522
diff changeset
366 gchar * i_configure_read_seq_ports_default( void )
522
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
367 {
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
368 FILE * fp = NULL;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
369 /* first try, get seq ports from proc on card0 */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
370 fp = fopen( "/proc/asound/card0/wavetableD1" , "rb" );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
371 if ( fp )
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
372 {
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
373 gchar buffer[100];
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
374 while ( !feof( fp ) )
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
375 {
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
376 fgets( buffer , 100 , fp );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
377 if (( strlen( buffer ) > 11 ) && ( !strncasecmp( buffer , "addresses: " , 11 ) ))
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
378 {
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
379 /* change spaces between ports (65:0 65:1 65:2 ...)
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
380 into commas (65:0,65:1,65:2,...) */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
381 g_strdelimit( &buffer[11] , " " , ',' );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
382 /* remove lf and cr from the end of the string */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
383 g_strdelimit( &buffer[11] , "\r\n" , '\0' );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
384 /* ready to go */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
385 DEBUGMSG( "init, default values for seq ports detected: %s\n" , &buffer[11] );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
386 fclose( fp );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
387 return g_strdup( &buffer[11] );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
388 }
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
389 }
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
390 fclose( fp );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
391 }
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
392
525
6e332a32d2f5 [svn] amidi-plug: do not try to guess the correct alsa port from alsa-lib version if there's not a wavetable hw synth available
giacomo
parents: 522
diff changeset
393 /* second option: do not set ports at all, let the user
6e332a32d2f5 [svn] amidi-plug: do not try to guess the correct alsa port from alsa-lib version if there's not a wavetable hw synth available
giacomo
parents: 522
diff changeset
394 select the right ones in the nice preferences dialog :) */
6e332a32d2f5 [svn] amidi-plug: do not try to guess the correct alsa port from alsa-lib version if there's not a wavetable hw synth available
giacomo
parents: 522
diff changeset
395 return g_strdup( "" );
522
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
396 }
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
397
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
398
525
6e332a32d2f5 [svn] amidi-plug: do not try to guess the correct alsa port from alsa-lib version if there's not a wavetable hw synth available
giacomo
parents: 522
diff changeset
399 void i_configure_cfg_read( void )
522
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
400 {
1015
bc14606391fc [svn] - don't use XMMS ConfigFile interface here
nenolod
parents: 860
diff changeset
401 ConfigDb *cfgfile;
bc14606391fc [svn] - don't use XMMS ConfigFile interface here
nenolod
parents: 860
diff changeset
402 cfgfile = bmp_cfg_db_open();
522
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
403
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
404 if (!cfgfile)
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
405 {
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
406 /* use defaults */
525
6e332a32d2f5 [svn] amidi-plug: do not try to guess the correct alsa port from alsa-lib version if there's not a wavetable hw synth available
giacomo
parents: 522
diff changeset
407 amidiplug_cfg.seq_writable_ports = i_configure_read_seq_ports_default();
522
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
408 amidiplug_cfg.mixer_card_id = 0;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
409 amidiplug_cfg.mixer_control_name = g_strdup( "Synth" );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
410 amidiplug_cfg.mixer_control_id = 0;
805
b8b9d7f5d371 [svn] update amidi-plug towards 0.2; bug fixes and a new option (midi length pre-calculation)
giacomo
parents: 525
diff changeset
411 amidiplug_cfg.length_precalc_enable = 0;
522
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
412 }
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
413 else
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
414 {
1015
bc14606391fc [svn] - don't use XMMS ConfigFile interface here
nenolod
parents: 860
diff changeset
415 if ( !bmp_cfg_db_get_string( cfgfile , "amidi-plug" , "writable_ports" , &amidiplug_cfg.seq_writable_ports ) )
525
6e332a32d2f5 [svn] amidi-plug: do not try to guess the correct alsa port from alsa-lib version if there's not a wavetable hw synth available
giacomo
parents: 522
diff changeset
416 amidiplug_cfg.seq_writable_ports = i_configure_read_seq_ports_default(); /* default value */
522
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
417
1015
bc14606391fc [svn] - don't use XMMS ConfigFile interface here
nenolod
parents: 860
diff changeset
418 if ( !bmp_cfg_db_get_int( cfgfile , "amidi-plug" , "mixer_card_id" , &amidiplug_cfg.mixer_card_id ) )
522
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
419 amidiplug_cfg.mixer_card_id = 0; /* default value */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
420
1015
bc14606391fc [svn] - don't use XMMS ConfigFile interface here
nenolod
parents: 860
diff changeset
421 if ( !bmp_cfg_db_get_string( cfgfile , "amidi-plug" , "mixer_control_name" , &amidiplug_cfg.mixer_control_name ) )
522
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
422 amidiplug_cfg.mixer_control_name = g_strdup( "Synth" ); /* default value */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
423
1015
bc14606391fc [svn] - don't use XMMS ConfigFile interface here
nenolod
parents: 860
diff changeset
424 if ( !bmp_cfg_db_get_int( cfgfile , "amidi-plug" , "mixer_control_id" , &amidiplug_cfg.mixer_control_id ) )
522
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
425 amidiplug_cfg.mixer_control_id = 0; /* default value */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
426
1015
bc14606391fc [svn] - don't use XMMS ConfigFile interface here
nenolod
parents: 860
diff changeset
427 if ( !bmp_cfg_db_get_int( cfgfile , "amidi-plug" , "length_precalc_enable" , &amidiplug_cfg.length_precalc_enable ) )
805
b8b9d7f5d371 [svn] update amidi-plug towards 0.2; bug fixes and a new option (midi length pre-calculation)
giacomo
parents: 525
diff changeset
428 amidiplug_cfg.length_precalc_enable = 0; /* default value */
b8b9d7f5d371 [svn] update amidi-plug towards 0.2; bug fixes and a new option (midi length pre-calculation)
giacomo
parents: 525
diff changeset
429
1015
bc14606391fc [svn] - don't use XMMS ConfigFile interface here
nenolod
parents: 860
diff changeset
430 bmp_cfg_db_close(cfgfile);
522
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
431 }
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
432 }
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
433
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
434
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
435 void i_configure_cfg_save( void )
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
436 {
1015
bc14606391fc [svn] - don't use XMMS ConfigFile interface here
nenolod
parents: 860
diff changeset
437 ConfigDb *cfgfile;
bc14606391fc [svn] - don't use XMMS ConfigFile interface here
nenolod
parents: 860
diff changeset
438 cfgfile = bmp_cfg_db_open();
522
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
439
1015
bc14606391fc [svn] - don't use XMMS ConfigFile interface here
nenolod
parents: 860
diff changeset
440 bmp_cfg_db_set_string( cfgfile , "amidi-plug" , "writable_ports" , amidiplug_cfg.seq_writable_ports );
bc14606391fc [svn] - don't use XMMS ConfigFile interface here
nenolod
parents: 860
diff changeset
441 bmp_cfg_db_set_int( cfgfile , "amidi-plug" , "mixer_card_id" , amidiplug_cfg.mixer_card_id );
bc14606391fc [svn] - don't use XMMS ConfigFile interface here
nenolod
parents: 860
diff changeset
442 bmp_cfg_db_set_string( cfgfile , "amidi-plug" , "mixer_control_name" , amidiplug_cfg.mixer_control_name );
bc14606391fc [svn] - don't use XMMS ConfigFile interface here
nenolod
parents: 860
diff changeset
443 bmp_cfg_db_set_int( cfgfile , "amidi-plug" , "mixer_control_id" , amidiplug_cfg.mixer_control_id );
bc14606391fc [svn] - don't use XMMS ConfigFile interface here
nenolod
parents: 860
diff changeset
444 bmp_cfg_db_set_int( cfgfile , "amidi-plug" , "length_precalc_enable" , amidiplug_cfg.length_precalc_enable );
522
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
445
1015
bc14606391fc [svn] - don't use XMMS ConfigFile interface here
nenolod
parents: 860
diff changeset
446 bmp_cfg_db_close(cfgfile);
522
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
447 }