~ubuntu-branches/ubuntu/karmic/muse/karmic-proposed

« back to all changes in this revision

Viewing changes to globals.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Kobras
  • Date: 2002-04-23 17:28:23 UTC
  • Revision ID: james.westby@ubuntu.com-20020423172823-w8yplzr81a759xa3
Tags: upstream-0.5.2
Import upstream version 0.5.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//=========================================================
 
2
//  MusE
 
3
//  Linux Music Editor
 
4
//  $Id: globals.cpp,v 1.5 2002/02/28 09:02:25 muse Exp $
 
5
//
 
6
//  (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
 
7
//=========================================================
 
8
 
 
9
#include "globals.h"
 
10
#include <qpixmap.h>
 
11
#include "sf/sndfile.h"
 
12
#include <unistd.h>
 
13
 
 
14
Song* song;
 
15
Sequencer* seq;
 
16
MidiThread* midiThread;
 
17
AudioThread* audioThread;
 
18
AudioPrefetch* audioPrefetch;
 
19
 
 
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
 
24
int rtcTicks    = 4096;
 
25
int minMeter    = -60;
 
26
int minSlider   = -60;
 
27
int guiRefresh  = 20;
 
28
bool noAudio = false;
 
29
int configFontSize;
 
30
 
 
31
bool hIsB = true;             // call note h "b"
 
32
 
 
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 },
 
48
      };
 
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 },
 
57
 
 
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 },
 
65
      };
 
66
 
 
67
ClipList* waveClips;
 
68
SndFileList* sndFiles;
 
69
 
 
70
QString museGlobalLib("");
 
71
QString museGlobalShare("");
 
72
QString museUser("");
 
73
QString museProject("");
 
74
 
 
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;
 
83
 
 
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)",
 
88
      "All Files (*)",
 
89
      0
 
90
      };
 
91
const char* med_file_pattern[] = {
 
92
      "med Files (*.med *.med.gz *.med.bz2)",
 
93
      "All Files (*)",
 
94
      0
 
95
      };
 
96
const char* image_file_pattern[] = {
 
97
      "(*.jpg *.gif *.png)",
 
98
      "(*.jpg)",
 
99
      "(*.gif)",
 
100
      "(*.png)",
 
101
      "All Files (*)",
 
102
      0
 
103
      };
 
104
 
 
105
const char* ctrl_file_pattern[] = {
 
106
      "ctrl Files (*.ctrl *.ctrl.gz *.ctrl.bz2)",
 
107
      "All Files (*)",
 
108
      0
 
109
      };
 
110
 
 
111
QString scoreBg("");        // Background Pixmap Pathname for score canvas
 
112
 
 
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;
 
120
 
 
121
double beamWidth        = 3.0;
 
122
double beamSpacing      = 2.125;
 
123
double beamSlopeTrigger = 0.5;
 
124
 
 
125
int barsPage        = 4;
 
126
 
 
127
// QString family("lucida");
 
128
QString family("arial");
 
129
// QString family("Helvetica");
 
130
 
 
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);
 
139
 
 
140
Qt::ButtonState globalKeyState;
 
141
 
 
142
bool extendedMidi = true;
 
143
int midiDivision  = 384;      // division for midi export
 
144
 
 
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;
 
155
QAction* undoAction;
 
156
QAction* redoAction;
 
157
 
 
158
AudioMixerApp* audioMixer;
 
159
MusE* muse;
 
160
 
 
161
int extSyncPort = 1;
 
162
int deviceId    = 0x7f;       // �any� device
 
163
int mtcType     = 1;
 
164
MTC mtcOffset;
 
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;
 
172
 
 
173
int preMeasures = 2;
 
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;
 
188
 
 
189
bool rcEnable = false;
 
190
unsigned char rcStopNote = 28;
 
191
unsigned char rcRecordNote = 31;
 
192
unsigned char rcGotoLeftMarkNote = 33;
 
193
unsigned char rcPlayNote = 29;
 
194
 
 
195
uid_t euid, ruid;  // effective user id, real user id
 
196
 
 
197
//---------------------------------------------------------
 
198
//   doSetuid
 
199
//    Restore the effective UID to its original value.
 
200
//---------------------------------------------------------
 
201
 
 
202
void doSetuid()
 
203
      {
 
204
      int status;
 
205
 
 
206
#ifdef _POSIX_SAVED_IDS
 
207
      status = seteuid (euid);
 
208
#else
 
209
      status = setreuid (ruid, euid);
 
210
#endif
 
211
      if (status < 0) {
 
212
            fprintf(stderr, "Couldn't set uid.\n");
 
213
            }
 
214
      }
 
215
 
 
216
//---------------------------------------------------------
 
217
//   undoSetuid
 
218
//    Set the effective UID to the real UID.
 
219
//---------------------------------------------------------
 
220
 
 
221
void undoSetuid()
 
222
      {
 
223
      int status;
 
224
 
 
225
#ifdef _POSIX_SAVED_IDS
 
226
      status = seteuid (ruid);
 
227
#else
 
228
      status = setreuid (euid, ruid);
 
229
#endif
 
230
      if (status < 0) {
 
231
            fprintf (stderr, "Couldn't set uid.\n");
 
232
            exit (status);
 
233
            }
 
234
      }
 
235