summaryrefslogtreecommitdiff
path: root/media-sound/seq24/files/seq24-0.9.2-lash-fix.patch
blob: 8b0efadb7b55fe8edd707d27a5cb1d923747aa5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
Upstream fix for segfault when built with lash support.
https://bugs.launchpad.net/seq24/+bug/696371

=== modified file 'src/lash.cpp'
--- old/src/lash.cpp
+++ new/src/lash.cpp
@@ -29,17 +29,9 @@
 lash::lash(int *argc, char ***argv)
 {
 #ifdef LASH_SUPPORT
-   m_lash_args = lash_extract_args(argc, argv);
-#endif // LASH_SUPPORT
-}
-
-
-void lash::init(perform* perform)
-{
-#ifdef LASH_SUPPORT
-    m_perform = perform;
-
-    m_client = lash_init(m_lash_args, PACKAGE_NAME,
+    m_perform = NULL;
+
+    m_client = lash_init(lash_extract_args(argc, argv), PACKAGE_NAME,
             LASH_Config_File, LASH_PROTOCOL(2, 0));
 
     if (m_client == NULL) {
@@ -65,9 +57,10 @@
 
 
 void
-lash::start()
+lash::start(perform* perform)
 {
 #ifdef LASH_SUPPORT
+    m_perform = perform;
     /* Process any LASH events every 250 msec (arbitrarily chosen interval) */
     Glib::signal_timeout().connect(sigc::mem_fun(*this, &lash::process_events), 250);
 #endif // LASH_SUPPORT

=== modified file 'src/lash.h'
--- old/src/lash.h
+++ new/src/lash.h
@@ -43,7 +43,6 @@
 #ifdef LASH_SUPPORT
     perform       *m_perform;
     lash_client_t *m_client;
-    lash_args_t *m_lash_args;
 
     bool process_events();
     void handle_event(lash_event_t* conf);
@@ -54,13 +53,12 @@
 public:
     lash(int *argc, char ***argv);
 
-    void init(perform* perform);
     void set_alsa_client_id(int id);
-    void start();
+    void start(perform* perform);
 };
 
 
-/* global lash driver, defined in seq24.cpp */
+/* global lash driver, defined in seq24.cpp and used in midibus.cpp*/
 extern lash *lash_driver;
 
 

=== modified file 'src/midibus.cpp'
--- old/src/midibus.cpp
+++ new/src/midibus.cpp
@@ -877,11 +877,11 @@
 
     /* set up our clients queue */
     m_queue = snd_seq_alloc_queue( m_alsa_seq );
-#endif
 #ifdef LASH_SUPPORT
 	/* notify lash of our client ID so it can restore connections */
 	lash_driver->set_alsa_client_id(snd_seq_client_id(m_alsa_seq));
 #endif
+#endif
 }
 
 

=== modified file 'src/perform.cpp'
--- old/src/perform.cpp
+++ new/src/perform.cpp
@@ -1342,6 +1342,7 @@
             stats_last_clock_us= (last.tv_sec * 1000000) + (last.tv_nsec / 1000);
 #else
         /* get start time position */
+        /* timeGetTime() returns a "DWORD" type (= unsigned long)*/
         last = timeGetTime();
 
         if ( global_stats )

=== modified file 'src/seq24.cpp'
--- old/src/seq24.cpp
+++ new/src/seq24.cpp
@@ -108,12 +108,66 @@
      * GTK+. */
     Gtk::Main kit(argc, argv);
 
-    /* Init the lash driver (strips lash specific command line
-     * arguments, but does not connect to daemon) */
+    /*prepare global MIDI definitions*/
+    for ( int i=0; i<c_maxBuses; i++ )
+    {
+        for ( int j=0; j<16; j++ )
+            global_user_midi_bus_definitions[i].instrument[j] = -1;
+    }
+
+    for ( int i=0; i<c_max_instruments; i++ )
+    {
+        for ( int j=0; j<128; j++ )
+            global_user_instrument_definitions[i].controllers_active[j] = false;
+    }
+
+
+    /* Init the lash driver (strip lash specific command line
+     * arguments and connect to daemon) */
 #ifdef LASH_SUPPORT
     lash_driver = new lash(&argc, &argv);
 #endif
 
+    /* the main performance object */
+    /* lash must be initialized here because mastermidibus uses the global
+     * lash_driver variable*/
+    perform p;
+
+    /* read user preferences files */
+    if ( getenv( HOME ) != NULL )
+    {
+        Glib::ustring home( getenv( HOME ));
+        last_used_dir = home;
+        Glib::ustring total_file = home + SLASH + config_filename;
+        
+        if (Glib::file_test(total_file, Glib::FILE_TEST_EXISTS))
+        {
+            printf( "Reading [%s]\n", total_file.c_str());
+
+            optionsfile options( total_file );
+
+            if ( !options.parse( &p ) ){
+                printf( "Error Reading [%s]\n", total_file.c_str());
+            }
+        }
+
+        total_file = home + SLASH + user_filename;
+        if (Glib::file_test(total_file, Glib::FILE_TEST_EXISTS))
+        {
+            printf( "Reading [%s]\n", total_file.c_str());
+
+            userfile user( total_file );
+
+            if ( !user.parse( &p ) ){
+                printf( "Error Reading [%s]\n", total_file.c_str());
+            }
+        }
+
+    }
+    else
+        printf( "Error calling getenv( \"%s\" )\n", HOME );
+
+
     /* parse parameters */
     int c;
 
@@ -229,65 +283,14 @@
     } /* end while */
 
 
-    /*prepare global MIDI definitions*/
-    for ( int i=0; i<c_maxBuses; i++ )
-    {
-        for ( int j=0; j<16; j++ )
-            global_user_midi_bus_definitions[i].instrument[j] = -1;
-    }
-
-    for ( int i=0; i<c_max_instruments; i++ )
-    {
-        for ( int j=0; j<128; j++ )
-            global_user_instrument_definitions[i].controllers_active[j] = false;
-    }
-
-
-    /* the main performance object */
-    perform p;
-
-    p_font_renderer = new font();
-
-
-    if ( getenv( HOME ) != NULL )
-    {
-        Glib::ustring home( getenv( HOME ));
-        last_used_dir = home;
-        Glib::ustring total_file = home + SLASH + config_filename;
-        
-        if (Glib::file_test(total_file, Glib::FILE_TEST_EXISTS))
-        {
-            printf( "Reading [%s]\n", total_file.c_str());
-
-            optionsfile options( total_file );
-
-            if ( !options.parse( &p ) ){
-                printf( "Error Reading [%s]\n", total_file.c_str());
-            }
-        }
-
-        total_file = home + SLASH + user_filename;
-        if (Glib::file_test(total_file, Glib::FILE_TEST_EXISTS))
-        {
-            printf( "Reading [%s]\n", total_file.c_str());
-
-            userfile user( total_file );
-
-            if ( !user.parse( &p ) ){
-                printf( "Error Reading [%s]\n", total_file.c_str());
-            }
-        }
-
-    }
-    else
-        printf( "Error calling getenv( \"%s\" )\n", HOME );
-
     p.init();
     p.launch_input_thread();
     p.launch_output_thread();
     p.init_jack();
 
 
+    p_font_renderer = new font();
+
     mainwnd seq24_window( &p );
     if (optind < argc)
     {
@@ -299,8 +302,7 @@
 
     /* connect to lash daemon and poll events*/
 #ifdef LASH_SUPPORT
-    lash_driver->init(&p);
-    lash_driver->start();
+    lash_driver->start(&p);
 #endif
     kit.run(seq24_window);