2 Copyright (C) 2000 Paul Barton-Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __midipp_mmc_h_h__
21 #define __midipp_mmc_h_h__
23 #include <sigc++/sigc++.h>
24 #include <midi++/types.h>
31 class MachineControl : public sigc::trackable
35 typedef byte CommandSignature[60];
36 typedef byte ResponseSignature[60];
41 cmdDeferredPlay = 0x3,
44 cmdRecordStrobe = 0x6,
51 cmdCommandErrorReset = 0xC,
54 cmdIllegalMackieJogStart = 0x20,
55 cmdIllegalMackieJogStop = 0x21,
58 cmdMaskedWrite = 0x41,
62 cmdVariablePlay = 0x45,
67 cmdAssignSystemMaster = 0x49,
68 cmdGeneratorCommand = 0x4A,
74 cmdDropFrameAdjust = 0x4F,
78 cmdCommandSegment = 0x53,
79 cmdDeferredVariablePlay = 0x54,
81 cmdRecordStrobeVariable = 0x55,
87 MachineControl (Port &port,
90 ResponseSignature &rs);
92 Port &port() { return _port; }
94 void set_device_id (byte id);
95 byte device_id () const { return _device_id; }
97 static bool is_mmc (byte *sysex_buf, size_t len);
99 /* Signals to connect to if you want to run "callbacks"
100 when certain MMC commands are received.
103 sigc::signal<void,MachineControl &> Stop;
104 sigc::signal<void,MachineControl &> Play;
105 sigc::signal<void,MachineControl &> DeferredPlay;
106 sigc::signal<void,MachineControl &> FastForward;
107 sigc::signal<void,MachineControl &> Rewind;
108 sigc::signal<void,MachineControl &> RecordStrobe;
109 sigc::signal<void,MachineControl &> RecordExit;
110 sigc::signal<void,MachineControl &> RecordPause;
111 sigc::signal<void,MachineControl &> Pause;
112 sigc::signal<void,MachineControl &> Eject;
113 sigc::signal<void,MachineControl &> Chase;
114 sigc::signal<void,MachineControl &> CommandErrorReset;
115 sigc::signal<void,MachineControl &> MmcReset;
117 sigc::signal<void,MachineControl &> JogStart;
118 sigc::signal<void,MachineControl &> JogStop;
120 sigc::signal<void,MachineControl &> Write;
121 sigc::signal<void,MachineControl &> MaskedWrite;
122 sigc::signal<void,MachineControl &> Read;
123 sigc::signal<void,MachineControl &> Update;
124 sigc::signal<void,MachineControl &> VariablePlay;
125 sigc::signal<void,MachineControl &> Search;
126 sigc::signal<void,MachineControl &> AssignSystemMaster;
127 sigc::signal<void,MachineControl &> GeneratorCommand;
128 sigc::signal<void,MachineControl &> MidiTimeCodeCommand;
129 sigc::signal<void,MachineControl &> Move;
130 sigc::signal<void,MachineControl &> Add;
131 sigc::signal<void,MachineControl &> Subtract;
132 sigc::signal<void,MachineControl &> DropFrameAdjust;
133 sigc::signal<void,MachineControl &> Procedure;
134 sigc::signal<void,MachineControl &> Event;
135 sigc::signal<void,MachineControl &> Group;
136 sigc::signal<void,MachineControl &> CommandSegment;
137 sigc::signal<void,MachineControl &> DeferredVariablePlay;
138 sigc::signal<void,MachineControl &> RecordStrobeVariable;
139 sigc::signal<void,MachineControl &> Wait;
140 sigc::signal<void,MachineControl &> Resume;
142 /* The second argument is the shuttle speed, the third is
143 true if the direction is "forwards", false for "reverse"
146 sigc::signal<void,MachineControl &,float,bool> Shuttle;
148 /* The second argument specifies the desired track record enabled
152 sigc::signal<void,MachineControl &,size_t,bool>
153 TrackRecordStatusChange;
155 /* The second argument points to a byte array containing
156 the locate target value in MMC Standard Time Code
157 format (5 bytes, roughly: hrs/mins/secs/frames/subframes)
160 sigc::signal<void,MachineControl &, const byte *> Locate;
162 /* The second argument is the number of steps to jump */
164 sigc::signal<void,MachineControl &, int> Step;
168 #define MMC_NTRACKS 48
170 /* MMC Information fields (think "registers") */
172 CommandSignature commandSignature;
173 ResponseSignature responseSignature;
178 byte commandErrorLevel;
180 byte motionControlTally;
186 bool trackRecordStatus[MMC_NTRACKS];
187 bool trackRecordReady[MMC_NTRACKS];
190 byte trackSyncMonitor;
191 byte trackInputMonitor;
193 byte playSpeedReference;
199 byte selectedTimeCode;
200 byte shortSelectedTimeCode;
202 byte selectedTimeCodeSource;
203 byte selectedTimeCodeUserbits;
204 byte selectedMasterCode;
205 byte requestedOffset;
208 byte shortSelectedMasterCode;
209 byte shortRequestedOffset;
210 byte shortActualOffset;
211 byte shortLockDeviation;
212 byte resolvedPlayMode;
214 byte generatorTimeCode;
215 byte shortGeneratorTimeCode;
216 byte generatorCommandTally;
218 byte generatorUserbits;
219 byte vitcInsertEnable;
220 byte midiTimeCodeInput;
221 byte shortMidiTimeCodeInput;
222 byte midiTimeCodeCommandTally;
223 byte midiTimeCodeSetUp;
240 byte procedureResponse;
242 byte responseSegment;
250 void process_mmc_message (Parser &p, byte *, size_t len);
252 int do_masked_write (byte *, size_t len);
253 int do_locate (byte *, size_t len);
254 int do_step (byte *, size_t len);
255 int do_shuttle (byte *, size_t len);
257 void write_track_record_ready (byte *, size_t len);
262 #endif /* __midipp_mmc_h_h__ */