1
//=========================================================
4
// $Id: globals.cpp,v 1.5 2002/02/28 09:02:25 muse Exp $
6
// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
7
//=========================================================
11
#include "sf/sndfile.h"
16
MidiThread* midiThread;
17
AudioThread* audioThread;
18
AudioPrefetch* audioPrefetch;
20
bool alsaFound = false;
21
int division = 384; // internal division (ticks/quarternote)
22
volatile int sampleRate = 44100;
23
volatile int segmentSize = 512; // segmentSize in samples
31
bool hIsB = true; // call note h "b"
33
const char sharpTab[14][7] = {
34
{ 0, 3, -1, 2, 5, 1, 4 },
35
{ 0, 3, -1, 2, 5, 1, 4 },
36
{ 0, 3, -1, 2, 5, 1, 4 },
37
{ 0, 3, -1, 2, 5, 1, 4 },
38
{ 2, 5, 1, 4, 7, 3, 6 },
39
{ 2, 5, 1, 4, 7, 3, 6 },
40
{ 2, 5, 1, 4, 7, 3, 6 },
41
{ 4, 0, 3, -1, 2, 5, 1 },
42
{ 7, 3, 6, 2, 5, 1, 4 },
43
{ 5, 8, 4, 7, 3, 6, 2 },
44
{ 3, 6, 2, 5, 1, 4, 7 },
45
{ 1, 4, 0, 3, 6, 2, 5 },
46
{ 6, 2, 5, 1, 4, 0, 3 },
47
{ 0, 3, -1, 2, 5, 1, 4 },
49
const char flatTab[14][7] = {
50
{ 4, 1, 5, 2, 6, 3, 7 },
51
{ 4, 1, 5, 2, 6, 3, 7 },
52
{ 4, 1, 5, 2, 6, 3, 7 },
53
{ 4, 1, 5, 2, 6, 3, 7 },
54
{ 6, 3, 7, 4, 8, 5, 9 },
55
{ 6, 3, 7, 4, 8, 5, 9 },
56
{ 6, 3, 7, 4, 8, 5, 9 },
58
{ 1, 5, 2, 6, 3, 7, 4 },
59
{ 4, 1, 5, 2, 6, 3, 7 },
60
{ 2, 6, 3, 7, 4, 8, 5 },
61
{ 7, 4, 1, 5, 2, 6, 3 },
62
{ 5, 2, 6, 3, 7, 4, 8 },
63
{ 3, 0, 4, 1, 5, 2, 6 },
64
{ 4, 1, 5, 2, 6, 3, 7 },
68
SndFileList* sndFiles;
70
QString museGlobalLib("");
71
QString museGlobalShare("");
73
QString museProject("");
75
bool debugMode = false;
76
bool debugMsg = false;
77
bool debugSync = false;
78
bool midiInputTrace = false;
79
bool midiOutputTrace = false;
80
bool realTimeScheduling = false;
81
int realTimePriority = 50;
82
bool lockMemory = false;
84
const char* midi_file_pattern[] = {
85
"Midi/Kar (*.mid *.kar *.mid.gz *.mid.bz2)",
86
"Midi (*.mid *.mid.gz *.mid.bz2)",
87
"Karaoke (*.kar *.kar.gz *.kar.bz2)",
91
const char* med_file_pattern[] = {
92
"med Files (*.med *.med.gz *.med.bz2)",
96
const char* image_file_pattern[] = {
97
"(*.jpg *.gif *.png)",
105
const char* ctrl_file_pattern[] = {
106
"ctrl Files (*.ctrl *.ctrl.gz *.ctrl.bz2)",
111
QString scoreBg(""); // Background Pixmap Pathname for score canvas
113
double paperWidth = 210.0; // mm
114
double paperHeight = 297.0;
115
double topMargin = 10.0;
116
double bottomMargin = 10.0;
117
double leftMargin = 10.0;
118
double rightMargin = 10.0;
119
double printScale = 1.0;
121
double beamWidth = 3.0;
122
double beamSpacing = 2.125;
123
double beamSlopeTrigger = 0.5;
127
// QString family("lucida");
128
QString family("arial");
129
// QString family("Helvetica");
131
QFont font0("arial", 12, QFont::Normal);
132
//QFont font1("arial", 8, QFont::Normal);
133
QFont font1("arial", 10, QFont::Normal);
134
QFont font2("arial", 10, QFont::Normal);
135
QFont font3("lucida", 10, QFont::Bold);
136
//QFont font4("arial", 8, QFont::Bold);
137
QFont font4("arial", 10, QFont::Normal);
138
QFont font5("Lucidatypewriter", 14, QFont::Bold);
140
Qt::ButtonState globalKeyState;
142
bool extendedMidi = true;
143
int midiDivision = 384; // division for midi export
145
// Midi Filter Parameter
146
int midiInputPorts = 0; // receive from all devices
147
int midiInputChannel = 0; // receive all channel
148
int midiRecordType = 0; // receive all events
149
int midiThruType = 0; // transmit all events
150
int midiFilterCtrl1 = 0;
151
int midiFilterCtrl2 = 0;
152
int midiFilterCtrl3 = 0;
153
int midiFilterCtrl4 = 0;
154
QActionGroup* undoRedo;
158
AudioMixerApp* audioMixer;
162
int deviceId = 0x7f; // �any� device
165
BValue extSyncFlag(0, "extSync"); // false - MASTER, true - SLAVE
166
bool genMTCSync = false; // output MTC Sync
167
bool genMCSync = false; // output MidiClock Sync
168
bool genMMC = false; // output Midi Machine Control
169
bool acceptMTC = false;
170
bool acceptMC = true;
171
bool acceptMMC = true;
174
unsigned char measureClickNote = 63;
175
unsigned char measureClickVelo = 127;
176
unsigned char beatClickNote = 63;
177
unsigned char beatClickVelo = 70;
178
unsigned char clickChan = 9;
179
unsigned char clickPort = 0;
180
bool precountEnableFlag = true;
181
bool precountFromMastertrackFlag = true;
182
int precountSigZ = 4;
183
int precountSigN = 4;
184
bool precountPrerecord = false;
185
bool precountPreroll = false;
186
bool midiClickFlag = true;
187
bool audioClickFlag = false;
189
bool rcEnable = false;
190
unsigned char rcStopNote = 28;
191
unsigned char rcRecordNote = 31;
192
unsigned char rcGotoLeftMarkNote = 33;
193
unsigned char rcPlayNote = 29;
195
uid_t euid, ruid; // effective user id, real user id
197
//---------------------------------------------------------
199
// Restore the effective UID to its original value.
200
//---------------------------------------------------------
206
#ifdef _POSIX_SAVED_IDS
207
status = seteuid (euid);
209
status = setreuid (ruid, euid);
212
fprintf(stderr, "Couldn't set uid.\n");
216
//---------------------------------------------------------
218
// Set the effective UID to the real UID.
219
//---------------------------------------------------------
225
#ifdef _POSIX_SAVED_IDS
226
status = seteuid (ruid);
228
status = setreuid (euid, ruid);
231
fprintf (stderr, "Couldn't set uid.\n");