~ubuntu-branches/debian/stretch/bristol/stretch

« back to all changes in this revision

Viewing changes to bin/startBristol.in

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2010-04-23 09:49:32 UTC
  • mfrom: (1.2.1 upstream) (6.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20100423094932-btfvxmt11hv8dj4p
Tags: 0.60.0-4
* Switch back to deb format 1.0, bug#578693 has been fixed.
* Refresh and improvements, another attempt to fix FTBFS on
  hppa,sparc,s390.
* Drop debian/patches/02-implicit_pointer_conversion.patch patch,
  applied upstream.
* Patch to fix FTBFS on hurd-i386.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
args=$*
5
5
 
6
6
engine=1
 
7
cli=0
7
8
gui=1
8
9
quiet=0
9
10
verbose=0
11
12
declare -x JACK_START_SERVER=1
12
13
midi=seq
13
14
HELP=0
 
15
README=0
14
16
PORT=5028
 
17
valgrind=0
 
18
 
 
19
execme=1
 
20
liblist=0
 
21
 
 
22
engstatus=0
 
23
guistatus=0
15
24
 
16
25
RATE=44100
17
 
DRIVER=-alsa
 
26
DRIVER=@DEFAULT_AUDIO_FLAG@
18
27
COUNT=256
19
28
 
20
29
LOGO=no
26
35
 
27
36
showhelp()
28
37
{
 
38
        if [ $HELP -eq 3 ]; then
 
39
                brighton -V
 
40
                exit 0
 
41
        fi
29
42
        if [ $HELP -eq 2 ]; then
30
 
                brighton -V
 
43
                brighton -h | less
31
44
                exit 0
32
45
        fi
33
46
        if [ $verbose = 1 ]; then
38
51
                echo
39
52
                echo "startBristol [-explorer|-mini|-memory|-hammond|-b3|-dx|-axxe|-odyssey|-2600|-mono|-poly|-juno|-prophet|-pro10|-pro52|-mixer|-vox|-rhodes|-rhodesbass|-obx|-obxa|-aks|<others>] [-oss|-alsa|-jack] [[-help|-h] [-verbose|-v]]"
40
53
                echo
41
 
                echo "Try 'startBristol -v -h' for more verbose help output on device configuration."
 
54
                echo "Try 'startBristol -v|-h' for more verbose help output on device configuration."
 
55
                echo
 
56
                echo "Try 'startBristol -readme' for very verbose output"
 
57
                echo "Try 'startBristol -readme -mini' for info on specific emulator"
42
58
                echo
43
59
                echo "Try 'startBristol -b3' or 'startBristol -jack', for example, if you are unsure."
44
60
                echo
108
124
                brighton -summary
109
125
                exit 0
110
126
        fi
 
127
        if [ $index = "-console" ]; then
 
128
                declare -x BRISTOL_LOG_CONSOLE=true
 
129
        fi
 
130
        if [ $index = "-cli" ]; then
 
131
                cli=1
 
132
                exec=0
 
133
                declare -x BRISTOL_LOG_CONSOLE=true
 
134
        fi
 
135
        if [ $index = "-exec" ]; then
 
136
                execme=0
 
137
        fi
 
138
        if [ $index = "-valgrind" ]; then
 
139
                valgrind=1
 
140
        fi
 
141
        if [ $index = "-debug" ]; then
 
142
                liblist=1
 
143
        fi
 
144
        if [ $index = "-liblist" ]; then
 
145
                liblist=1
 
146
        fi
111
147
        if [ $index = "-master" ]; then
112
148
                engine=0
113
149
        fi
117
153
        if [ $index = "-gui" ]; then
118
154
                gui=0
119
155
        fi
 
156
        if [ $index = "-readme" ]; then
 
157
                README=1
 
158
        fi
120
159
        if [ $index = "-v" ]; then
121
 
                verbose=1
 
160
                HELP=2
122
161
        fi
123
162
        if [ $index = "--v" ]; then
124
 
                verbose=1
 
163
                HELP=2
125
164
        fi
126
165
        if [ $index = "-verbose" ]; then
127
166
                verbose=1
130
169
                verbose=1
131
170
        fi
132
171
        if [ $index = "-V" ]; then
133
 
                HELP=2
 
172
                HELP=3
134
173
        fi
135
174
        if [ $index = "-logo" ]; then
136
175
                LOGO=yes
137
176
        fi
138
177
        if [ $index = "-h" ]; then
139
 
                HELP=1
 
178
                HELP=2
140
179
        fi
141
180
        if [ $index = "--h" ]; then
142
 
                HELP=1
 
181
                HELP=2
143
182
        fi
144
183
        if [ $index = "-help" ]; then
145
 
                HELP=1
 
184
                HELP=2
146
185
        fi
147
186
        if [ $index = "--help" ]; then
148
 
                HELP=1
 
187
                HELP=2
149
188
        fi
150
189
        if [ $index = "-libtest" ]; then
151
190
                engine=0
156
195
        if [ $index = "-q" ]; then
157
196
                quiet=1
158
197
        fi
 
198
        if [ $index = "-jsmuuid" ]; then
 
199
                declare -x BRISTOL_AUTOCONN=false
 
200
        fi
159
201
        if [ $index = "-jack" ]; then
160
202
                jack=1
161
203
                COUNT=1024
162
204
                DRIVER=-jack
163
205
        fi
 
206
        if [ $index = "-audio" ]; then
 
207
                shift
 
208
                DRIVER=-$1
 
209
        fi
164
210
        if [ $index = "-alsa" ]; then
165
211
                jack=0
166
212
                DRIVER=-alsa
202
248
# user has a .jackdrc use that, otherwise use /etc/jackdrc
203
249
#
204
250
if [ ${DRIVER} == "-jack" ]; then 
 
251
        jack=1
205
252
        JACKPARAMS=`bristoljackstats 2>&1 | awk '/JACKSTATS/'`
206
253
 
207
254
        if [ $? == 0 ]; then
219
266
                #
220
267
                # See if the process is running
221
268
                #
 
269
                # We should replace this with pgrep and do it for this user - if the
 
270
                # daemon is running with other rights we may not be able to connect.
 
271
                #
222
272
                JACKD=`ps ax | grep -w jackd | grep -vw grep` 
223
273
 
224
274
                #
266
316
declare -x SLAB_HOME=$BRISTOL
267
317
declare -x BRIGHTON=$BRISTOL
268
318
 
269
 
declare -x LD_LIBRARY_PATH=/usr/lib:/usr/local/lib:${LD_LIBRARY_PATH}:${BRISTOL}/lib
 
319
declare -x LD_LIBRARY_PATH=/usr/local/lib:usr/lib:${LD_LIBRARY_PATH}:${BRISTOL}/lib
270
320
 
271
321
declare PATH=${PATH}:$BRISTOL/bin:/usr/local/bin
272
322
 
 
323
if [ ${README} -ge 1 ]; then
 
324
        brighton $args | less
 
325
        exit 0
 
326
fi
 
327
 
273
328
if [ ${HELP} -ge 1 ]; then
274
329
        showhelp
275
330
fi
295
350
fi
296
351
 
297
352
if [ ${LOGO} == "yes" ]; then
298
 
 
299
 
#
300
 
# Just to make sure
301
 
#
302
 
echo
303
 
echo "Bristol is about to start."
304
 
echo
305
 
echo "This program is totally unrelated to ANY of the companies that produced"
306
 
echo "the original instruments emulated by bristol, and none of the original"
307
 
echo "manufacturers in ANY way endorse this product."
308
 
echo
309
 
 
310
 
sleep 1
 
353
        #
 
354
        # Just to make sure
 
355
        #
 
356
        echo
 
357
        echo "Bristol is about to start."
 
358
        echo
 
359
        echo "This program is totally unrelated to ANY of the companies that produced"
 
360
        echo "the original instruments emulated by bristol, and none of the original"
 
361
        echo "manufacturers in ANY way endorse this product."
 
362
        echo
 
363
 
 
364
        sleep 1
 
365
fi
 
366
 
 
367
if [ ${liblist} != 0 ]; then
 
368
        echo
 
369
        echo '*** bristol libraries ***'
 
370
        echo
 
371
        ldd `which bristol`
 
372
        echo '*** brighton libraries ***'
 
373
        echo
 
374
        ldd `which brighton`
 
375
        echo
311
376
fi
312
377
 
313
378
#
316
381
#
317
382
if [ $engine = 1 ]; then
318
383
        echo checking availability of TCP port $PORT
319
 
        netstat -taln | grep $PORT > /dev/null
 
384
        netstat -taln | awk '{print $4}' | grep -w $PORT > /dev/null
320
385
        while [ $? = 0 ]; do
321
386
                echo -n "port looked busy, trying "
322
387
                PORT=`expr $PORT + 1`
331
396
fi
332
397
 
333
398
#
334
 
# the bristol engine has flags for -oss or -alsa drivers, -preload buffers of
335
 
# -count samples:
336
 
#       bristol -preload 4 -count 256 [-oss]
 
399
# Start up the GUI
337
400
#
338
 
if [ $engine = 1 ]; then
 
401
if [ $cli = 1 ]; then
 
402
        if [ $engine = 1 ]; then
 
403
                bristol -rate ${RATE} -count ${COUNT} $args -port $PORT &
 
404
        fi
 
405
        brighton $args -port ${PORT}
 
406
else
339
407
        if [ $gui = 1 ]; then
340
 
                if [ $quiet = 0 ]; then
341
 
                        bristol -rate ${RATE} -count ${COUNT} $args -port $PORT &
342
 
                else
343
 
                        bristol -rate ${RATE} -count ${COUNT} $args -port $PORT > /dev/null 2>&1 &
344
 
                fi
345
 
        else
346
 
                if [ $quiet = 0 ]; then
347
 
                        bristol -rate ${RATE} -count ${COUNT} $args -port $PORT
348
 
                else
349
 
                        bristol -rate ${RATE} -count ${COUNT} $args -port $PORT > /dev/null 2>&1
350
 
                fi
351
 
        fi
352
 
        sleep 1
353
 
fi
354
 
 
 
408
                if [ $engine = 1 ]; then
 
409
                        if [ $quiet = 0 ]; then
 
410
                                brighton $args -port ${PORT} &
 
411
                        else
 
412
                                brighton $args -port ${PORT} > /dev/null 2>&1 &
 
413
                        fi
 
414
                else
 
415
                        if [ $quiet = 0 ]; then
 
416
                                if [ $execme = 0 ]; then
 
417
                                        if [ $valgrind = 0 ]; then
 
418
                                                brighton $args -port ${PORT}
 
419
                                        else
 
420
                                                valgrind --leak-check=full -v --show-reachable=yes --track-origins=yes brighton $args -port ${PORT}
 
421
                                        fi
 
422
                                else
 
423
                                        exec brighton $args -port ${PORT}
 
424
                                fi
 
425
                                guistatus=$?
 
426
                        else
 
427
                                if [ $execme = 0 ]; then
 
428
                                        brighton $args -port ${PORT} > /dev/null 2>&1
 
429
                                else
 
430
                                        exec brighton $args -port ${PORT} > /dev/null 2>&1
 
431
                                fi
 
432
                                guistatus=$?
 
433
                        fi
 
434
                fi
 
435
        fi
 
436
 
 
437
        #
 
438
        # the bristol engine has flags for -oss or -alsa drivers, -preload buffers of
 
439
        # -count samples:
 
440
        #       bristol -preload 4 -count 256 [-oss]
 
441
        #
 
442
        if [ $engine = 1 ]; then
 
443
                if [ $quiet = 0 ]; then
 
444
                        if [ $valgrind = 0 ]; then
 
445
                                if [ $execme = 0 ]; then
 
446
                                        bristol -rate ${RATE} -count ${COUNT} $args -port $PORT
 
447
                                        engstatus=$?
 
448
                                else
 
449
                                        exec bristol -rate ${RATE} -count ${COUNT} $args -port $PORT
 
450
                                fi
 
451
                        else
 
452
                                valgrind --leak-check=full -v --show-reachable=yes --track-origins=yes bristol -rate ${RATE} -count ${COUNT} $args -port $PORT
 
453
                                engstatus=$?
 
454
                        fi
 
455
                else
 
456
                        if [ $execme = 0 ]; then
 
457
                                bristol -rate ${RATE} -count ${COUNT} $args -port $PORT > /dev/null 2>&1
 
458
                        else
 
459
                                exec bristol -rate ${RATE} -count ${COUNT} $args -port $PORT > /dev/null 2>&1
 
460
                        fi
 
461
                        engstatus=$?
 
462
                fi
 
463
        fi
 
464
fi
 
465
 
 
466
# Make sure we have the children returned, prevents ugly delayed output
 
467
if [ $engine = 1 ]; then
 
468
        wait % >/dev/null 2>&1
 
469
fi
355
470
if [ $gui = 1 ]; then
356
 
        if [ $quiet = 0 ]; then
357
 
                brighton $args -engine -port ${PORT}
358
 
        else
359
 
                brighton $args -engine -port ${PORT} > /dev/null 2>&1
360
 
        fi
361
 
fi
362
 
 
363
 
# Make sure we have the children returned, prevents ugly delayed output
364
 
if [ $engine = 1 ]; then
365
471
        wait % >/dev/null 2>&1
366
472
fi
 
473
 
 
474
sleep 1
 
475
 
 
476
 exit `expr $engstatus + $guistatus`
367
477