3
* Diverse Bristol audio routines.
4
* Copyright (c) by Nick Copeland <nickycopeland@hotmail.com> 1996,2010
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 3 of the License, or
10
* (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, see <http://www.gnu.org/licenses/>.
24
#include "bristolmidi.h"
26
extern int bristolPressureEvent();
31
sendOnePressure(int mh, int client, int value)
33
bristolPressureEvent(mh, client, 0, value);
37
sendOneNRP(int mh, int client, int nrp, int value)
41
cc = (nrp >> 7) & 0x7f;
43
vc = (value >> 7) & 0x7f;
46
// printf("sending %i %i %i %i\n", cc, cf, vc, vf);
48
bristolMidiControl(mh, client, 0, MIDI_GM_NRP, cc);
49
bristolMidiControl(mh, client, 0, MIDI_GM_NRP_F, cf);
50
bristolMidiControl(mh, client, 0, MIDI_GM_DATAENTRY, vc);
51
bristolMidiControl(mh, client, 0, MIDI_GM_DATAENTRY_F, vf);
53
// bristolMidiControl(mh, client, 0, MIDI_GM_NRP, 127);
54
// bristolMidiControl(mh, client, 0, MIDI_GM_NRP_F, 127);
58
sendManyNRP(int mh, int client, int nrp, int step, int delay)
62
for (count = 0; count < 16384; count+=128)
64
sendOneNRP(mh, client, 13, count);
67
for (; count >= 0; count-=128)
69
sendOneNRP(mh, client, 13, count);
75
main(int argc, char *argv[])
77
int mh, client = 128, argCount = 1;
78
int count = 0x7fffffff;
81
char *device = "bristolng";
83
if ((argc > 1) && ((strcmp(argv[argCount], "-help") == 0)
84
|| (strcmp(argv[argCount], "--help") == 0)))
86
printf("%s: this is for bristol SQA testing, it only streams note events\n\
87
%s [-target <id = 128>] [-cycle <0-2>] [-count <n>] [-rate <ms>]\n",
93
while (argc > argCount) {
94
if ((strcmp(argv[argCount], "-rate") == 0) && (argCount < argc))
96
if ((rate = atoi(argv[argCount + 1])) < 0)
102
if ((strcmp(argv[argCount], "-target") == 0) && (argCount < argc))
104
if ((client = atoi(argv[argCount + 1])) < 0)
109
if ((strcmp(argv[argCount], "-count") == 0) && (argCount < argc))
111
if ((count = atoi(argv[argCount + 1])) < 0)
116
if ((strcmp(argv[argCount], "-cycle") == 0) && (argCount < argc))
118
cycle = atoi(argv[argCount + 1]);
125
printf("Target %i, count %i, cycle %i\n", client, count, cycle);
127
if ((mh = bristolMidiOpen(device, BRISTOL_CONN_SEQ|BRISTOL_WRONLY,
128
-1, BRISTOL_REQ_ALL, NULL, NULL)) < 0)
130
printf("%s: could not open midi connection\n", argv[0]);
134
sendOnePressure(mh, client, 64);
137
sendOneNRP(mh, client, 13, 1);
139
sendManyNRP(mh, client, 13, 256, 1000);
140
sendManyNRP(mh, client, 13, 256, 1000);
141
sendManyNRP(mh, client, 13, 256, 1000);
142
sendManyNRP(mh, client, 13, 256, 1000);
143
sendManyNRP(mh, client, 13, 256, 1000);
144
sendManyNRP(mh, client, 13, 256, 1000);
145
sendManyNRP(mh, client, 13, 256, 1000);
146
sendManyNRP(mh, client, 13, 256, 1000);