~ubuntu-branches/debian/jessie/bristol/jessie

« back to all changes in this revision

Viewing changes to brighton/brighton.c

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2009-11-10 12:21:04 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20091110122104-432yau0haobyl122
Tags: 0.40.6-1
* Adopting this (Closes: #546954).
* Create new bristol-data runtime package, it will contain application's
  architecture-indipendent data files.
* Drop all patches, now useless.
* Switch to debhelper 7.
* debian/copyright: Update according to DEP-5 spec.
* debian/bristol.1: Fix little spelling mistake.
* Replace patch system, from dpatch to quilt.
* Add 01-spelling_errors.patch patch to fix spelling-error-in-binary.
* debian/rules: dh_makeshlibs doesn't touch shlibs/symbols file, libraries
  under /usr/lib/bristol/ are private.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
 
2
2
/*
3
3
 *  Diverse Bristol audio routines.
4
 
 *  Copyright (c) by Nick Copeland <nickycopeland@hotmail.com> 1996,2008
 
4
 *  Copyright (c) by Nick Copeland <nickycopeland@hotmail.com> 1996,2009
5
5
 *
6
6
 *
7
7
 *   This program is free software; you can redistribute it and/or modify
20
20
 *
21
21
 */
22
22
 
23
 
 
24
23
#include <signal.h>
25
24
#include <stdio.h>
26
25
#include <stdlib.h>
78
77
extern brightonApp bme700App;
79
78
extern brightonApp bmApp;
80
79
extern brightonApp sidApp;
 
80
extern brightonApp sid2App;
81
81
 
82
82
#define BRIGHTON_BIT99APP (BRISTOL_SYNTHCOUNT + 1)
83
83
 
101
101
int sampleRate = 44100;
102
102
int sampleCount = 256;
103
103
int mwt = 50000;
104
 
int activeSense = 1000;
105
 
int activeSensePeriod = 3000;
 
104
int activeSense = 2000;
 
105
int activeSensePeriod = 15000;
 
106
 
 
107
static char *BRISTOL_DEF_HOST = "localhost";
106
108
 
107
109
extern int brightonMidiInput(bristolMidiMsg *);
108
110
 
118
120
int
119
121
main(int argc, char **argv)
120
122
{
121
 
        int argCount = 1, midiHandle = -1, midiFD = -1, i, j, asc = 0;
 
123
        int argCount = 1, midiHandle = -1, cFD = -1, midiFD = -1, i, j, asc = 0;
122
124
        pthread_t thread;
123
125
        bristolMidiMsg msg;
124
126
 
143
145
        global.synths->notepref = 0;
144
146
        global.synths->notetrig = 0;
145
147
        global.port = -1;
 
148
        global.host = BRISTOL_DEF_HOST;
146
149
 
147
150
        synthesisers[BRISTOL_MINI] = &miniApp;
148
151
        synthesisers[BRISTOL_PROPHET] = &prophetApp;
185
188
        synthesisers[BRISTOL_BME700] = &bme700App;
186
189
        synthesisers[BRISTOL_BASSMAKER] = &bmApp;
187
190
        synthesisers[BRISTOL_SID_M1] = &sidApp;
 
191
        synthesisers[BRISTOL_SID_M2] = &sid2App;
188
192
 
189
193
        global.synths->location = 0;
190
194
 
 
195
        if ((argc > 1) && (strcmp(argv[1], "-summary") == 0))
 
196
        {
 
197
                printf("%s", summarytext);
 
198
                exit(0);
 
199
        }
 
200
 
 
201
 
191
202
        if (argc < 2) {
192
203
                printf("You probably prefer to use the startBristol script.\n");
193
204
                exit(1);
445
456
 
446
457
                if ((strcmp(argv[argCount], "-scale") == 0) && (argCount < argc))
447
458
                {
 
459
                        if ((strcmp(argv[argCount + 1], "fs") == 0)
 
460
                                || (strcmp(argv[argCount + 1], "fullscreen") == 0))
 
461
                        {
 
462
                                aliastype = 5;
 
463
                                scale = 100.0;
 
464
                                argCount++;
 
465
                                continue;
 
466
                        }
448
467
                        if ((scale = atof(argv[argCount + 1])) > 0)
449
468
                        {
450
469
                                if ((scale > 1.1) || (scale < 0.9))
543
562
                if (strcmp(argv[argCount], "-mono") == 0)
544
563
                        global.synths->voices = 1;
545
564
 
546
 
                if (strcmp(argv[argCount], "-mididbg") == 0)
547
 
                        global.synths->flags |= MIDI_DEBUG;
 
565
                if (strcmp(argv[argCount], "-mididbg2") == 0)
 
566
                        global.synths->flags |= REQ_MIDI_DEBUG2;
 
567
                if ((strcmp(argv[argCount], "-mididbg") == 0)
 
568
                        || (strcmp(argv[argCount], "-mididbg1") == 0))
 
569
                        global.synths->flags |= REQ_MIDI_DEBUG;
548
570
 
549
571
                if ((strcmp(argv[argCount], "-midinrp") == 0)
550
572
                        || (strcmp(argv[argCount], "-nrp") == 0))
582
604
                                global.port = atoi(argv[++argCount]);
583
605
                }
584
606
 
 
607
                if (strcmp(argv[argCount], "-host") == 0)
 
608
                        global.host = argv[++argCount];
 
609
 
585
610
                if (strcmp(argv[argCount], "-lwf") == 0)
586
611
                        global.synths->lwf = 1;
587
612
 
768
793
                }
769
794
 
770
795
                if ((strcmp(argv[argCount], "-sid") == 0)
 
796
                        || (strcmp(argv[argCount], "-sidney") == 0))
 
797
                {
 
798
                        global.synths->synthtype = BRISTOL_SID_M1;
 
799
                        global.synths->voices = 1;
 
800
                        global.synths->notepref = 2;
 
801
                        global.synths->notetrig = 1;
 
802
                        antialias = 0.5;
 
803
                        aliastype = 1;
 
804
                        opacity = 50;
 
805
                }
 
806
 
 
807
                if ((strcmp(argv[argCount], "-sid2") == 0)
 
808
                        || (strcmp(argv[argCount], "-melbourne") == 0)
 
809
                        || (strcmp(argv[argCount], "-canberra") == 0)
 
810
                        || (strcmp(argv[argCount], "-perth") == 0)
 
811
                        || (strcmp(argv[argCount], "-resid") == 0)
771
812
                        || (strcmp(argv[argCount], "-asid") == 0)
772
 
                        || (strcmp(argv[argCount], "-resid") == 0)
773
 
                        || (strcmp(argv[argCount], "-sidney") == 0)
774
813
                        || (strcmp(argv[argCount], "-acid") == 0))
775
814
                {
776
 
                        global.synths->synthtype = BRISTOL_SID_M1;
 
815
                        global.synths->synthtype = BRISTOL_SID_M2;
777
816
                        global.synths->voices = 1;
778
817
                        global.synths->notepref = 2;
779
818
                        global.synths->notetrig = 1;
 
819
                        antialias = 0.5;
 
820
                        aliastype = 1;
780
821
                        opacity = 50;
781
822
                }
782
823
 
1013
1054
 
1014
1055
        /*
1015
1056
         * Here we should open an ALSA SEQ interface. We want to get an index back
1016
 
         * and pass that to the event handler for selection.
 
1057
         * and pass that to the event handler for selection. This should not really
 
1058
         * be a SEQ interface, it should depend on the flags given to the GUI.
1017
1059
         */
1018
1060
        if (global.libtest != 1)
1019
1061
        {
1020
1062
                if ((midiHandle = bristolMidiOpen("brighton",
1021
1063
                        BRISTOL_CONN_SEQ|BRISTOL_DUPLEX,
1022
1064
                        -1, BRISTOL_REQ_NSX, brightonMidiInput, &global)) < 0)
1023
 
                {
1024
1065
                        printf("Error opening midi device %s\n", "0.0");
1025
 
                }
1026
1066
 
1027
1067
                midiFD = bristolGetMidiFD(midiHandle);
 
1068
//              cFD = bristolMidiDupFD(global.controlfd, BRISTOL_REQ_NSX,
 
1069
//                       brightonMidiInput, &global);
 
1070
//              cFD = bristolGetMidiFD(cFD);
1028
1071
 
1029
 
                printf("opened GUI midi handle: %i, fd %i\n", midiHandle, midiFD);
 
1072
                printf("opened GUI midi handles: %i, %i\n", midiFD, cFD);
1030
1073
        }
1031
1074
 
1032
1075
        brightonReadConfiguration(global.synths->win,
1068
1111
                 * this into a separate thread and using a semaphore since the 'busy'
1069
1112
                 * waiting is ugly.
1070
1113
                 */
1071
 
                if (midiHandle >= 0)
1072
 
                        bristolMidiDevRead(midiHandle, &msg);
 
1114
//              bristolMidiDevRead(cFD, &msg);
 
1115
                bristolMidiDevRead(midiFD, &msg);
1073
1116
 
1074
1117
                if (i == 0)
1075
1118
                        usleep(mwt);
1151
1194
        if (id)
1152
1195
                brightonRemoveInterface(id);
1153
1196
        cleanupBristol();
1154
 
        exit(0);
 
1197
        exit(4);
1155
1198
}
1156
1199
 
1157
1200
void