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_receive_device_id (byte id);
95 void set_send_device_id (byte id);
96 byte receive_device_id () const { return _receive_device_id; }
97 byte send_device_id () const { return _send_device_id; }
99 static bool is_mmc (byte *sysex_buf, size_t len);
101 /* Signals to connect to if you want to run "callbacks"
102 when certain MMC commands are received.
105 sigc::signal<void,MachineControl &> Stop;
106 sigc::signal<void,MachineControl &> Play;
107 sigc::signal<void,MachineControl &> DeferredPlay;
108 sigc::signal<void,MachineControl &> FastForward;
109 sigc::signal<void,MachineControl &> Rewind;
110 sigc::signal<void,MachineControl &> RecordStrobe;
111 sigc::signal<void,MachineControl &> RecordExit;
112 sigc::signal<void,MachineControl &> RecordPause;
113 sigc::signal<void,MachineControl &> Pause;
114 sigc::signal<void,MachineControl &> Eject;
115 sigc::signal<void,MachineControl &> Chase;
116 sigc::signal<void,MachineControl &> CommandErrorReset;
117 sigc::signal<void,MachineControl &> MmcReset;
119 sigc::signal<void,MachineControl &> JogStart;
120 sigc::signal<void,MachineControl &> JogStop;
122 sigc::signal<void,MachineControl &> Write;
123 sigc::signal<void,MachineControl &> MaskedWrite;
124 sigc::signal<void,MachineControl &> Read;
125 sigc::signal<void,MachineControl &> Update;
126 sigc::signal<void,MachineControl &> VariablePlay;
127 sigc::signal<void,MachineControl &> Search;
128 sigc::signal<void,MachineControl &> AssignSystemMaster;
129 sigc::signal<void,MachineControl &> GeneratorCommand;
130 sigc::signal<void,MachineControl &> MidiTimeCodeCommand;
131 sigc::signal<void,MachineControl &> Move;
132 sigc::signal<void,MachineControl &> Add;
133 sigc::signal<void,MachineControl &> Subtract;
134 sigc::signal<void,MachineControl &> DropFrameAdjust;
135 sigc::signal<void,MachineControl &> Procedure;
136 sigc::signal<void,MachineControl &> Event;
137 sigc::signal<void,MachineControl &> Group;
138 sigc::signal<void,MachineControl &> CommandSegment;
139 sigc::signal<void,MachineControl &> DeferredVariablePlay;
140 sigc::signal<void,MachineControl &> RecordStrobeVariable;
141 sigc::signal<void,MachineControl &> Wait;
142 sigc::signal<void,MachineControl &> Resume;
144 /* The second argument is the shuttle speed, the third is
145 true if the direction is "forwards", false for "reverse"
148 sigc::signal<void,MachineControl &,float,bool> Shuttle;
150 /* The second argument specifies the desired track record enabled
154 sigc::signal<void,MachineControl &,size_t,bool>
155 TrackRecordStatusChange;
157 /* The second argument points to a byte array containing
158 the locate target value in MMC Standard Time Code
159 format (5 bytes, roughly: hrs/mins/secs/frames/subframes)
162 sigc::signal<void,MachineControl &, const byte *> Locate;
164 /* The second argument is the number of steps to jump */
166 sigc::signal<void,MachineControl &, int> Step;
170 #define MMC_NTRACKS 48
172 /* MMC Information fields (think "registers") */
174 CommandSignature commandSignature;
175 ResponseSignature responseSignature;
180 byte commandErrorLevel;
182 byte motionControlTally;
188 bool trackRecordStatus[MMC_NTRACKS];
189 bool trackRecordReady[MMC_NTRACKS];
192 byte trackSyncMonitor;
193 byte trackInputMonitor;
195 byte playSpeedReference;
201 byte selectedTimeCode;
202 byte shortSelectedTimeCode;
204 byte selectedTimeCodeSource;
205 byte selectedTimeCodeUserbits;
206 byte selectedMasterCode;
207 byte requestedOffset;
210 byte shortSelectedMasterCode;
211 byte shortRequestedOffset;
212 byte shortActualOffset;
213 byte shortLockDeviation;
214 byte resolvedPlayMode;
216 byte generatorTimeCode;
217 byte shortGeneratorTimeCode;
218 byte generatorCommandTally;
220 byte generatorUserbits;
221 byte vitcInsertEnable;
222 byte midiTimeCodeInput;
223 byte shortMidiTimeCodeInput;
224 byte midiTimeCodeCommandTally;
225 byte midiTimeCodeSetUp;
242 byte procedureResponse;
244 byte responseSegment;
249 byte _receive_device_id;
250 byte _send_device_id;
253 void process_mmc_message (Parser &p, byte *, size_t len);
255 int do_masked_write (byte *, size_t len);
256 int do_locate (byte *, size_t len);
257 int do_step (byte *, size_t len);
258 int do_shuttle (byte *, size_t len);
260 void write_track_record_ready (byte *, size_t len);
265 #endif /* __midipp_mmc_h_h__ */