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.
21 #ifndef __midipp_mmc_h_h__
22 #define __midipp_mmc_h_h__
24 #include <sigc++/sigc++.h>
25 #include <midi++/types.h>
32 class MachineControl : public sigc::trackable
36 typedef byte CommandSignature[60];
37 typedef byte ResponseSignature[60];
42 cmdDeferredPlay = 0x3,
45 cmdRecordStrobe = 0x6,
52 cmdCommandErrorReset = 0xC,
55 cmdIllegalMackieJogStart = 0x20,
56 cmdIllegalMackieJogStop = 0x21,
59 cmdMaskedWrite = 0x41,
63 cmdVariablePlay = 0x45,
68 cmdAssignSystemMaster = 0x49,
69 cmdGeneratorCommand = 0x4A,
75 cmdDropFrameAdjust = 0x4F,
79 cmdCommandSegment = 0x53,
80 cmdDeferredVariablePlay = 0x54,
82 cmdRecordStrobeVariable = 0x55,
88 MachineControl (Port &port,
91 ResponseSignature &rs);
93 Port &port() { return _port; }
95 void set_device_id (byte id);
96 static bool is_mmc (byte *sysex_buf, size_t len);
98 /* Signals to connect to if you want to run "callbacks"
99 when certain MMC commands are received.
102 sigc::signal<void,MachineControl &> Stop;
103 sigc::signal<void,MachineControl &> Play;
104 sigc::signal<void,MachineControl &> DeferredPlay;
105 sigc::signal<void,MachineControl &> FastForward;
106 sigc::signal<void,MachineControl &> Rewind;
107 sigc::signal<void,MachineControl &> RecordStrobe;
108 sigc::signal<void,MachineControl &> RecordExit;
109 sigc::signal<void,MachineControl &> RecordPause;
110 sigc::signal<void,MachineControl &> Pause;
111 sigc::signal<void,MachineControl &> Eject;
112 sigc::signal<void,MachineControl &> Chase;
113 sigc::signal<void,MachineControl &> CommandErrorReset;
114 sigc::signal<void,MachineControl &> MmcReset;
116 sigc::signal<void,MachineControl &> JogStart;
117 sigc::signal<void,MachineControl &> JogStop;
119 sigc::signal<void,MachineControl &> Write;
120 sigc::signal<void,MachineControl &> MaskedWrite;
121 sigc::signal<void,MachineControl &> Read;
122 sigc::signal<void,MachineControl &> Update;
123 sigc::signal<void,MachineControl &> VariablePlay;
124 sigc::signal<void,MachineControl &> Search;
125 sigc::signal<void,MachineControl &> AssignSystemMaster;
126 sigc::signal<void,MachineControl &> GeneratorCommand;
127 sigc::signal<void,MachineControl &> MidiTimeCodeCommand;
128 sigc::signal<void,MachineControl &> Move;
129 sigc::signal<void,MachineControl &> Add;
130 sigc::signal<void,MachineControl &> Subtract;
131 sigc::signal<void,MachineControl &> DropFrameAdjust;
132 sigc::signal<void,MachineControl &> Procedure;
133 sigc::signal<void,MachineControl &> Event;
134 sigc::signal<void,MachineControl &> Group;
135 sigc::signal<void,MachineControl &> CommandSegment;
136 sigc::signal<void,MachineControl &> DeferredVariablePlay;
137 sigc::signal<void,MachineControl &> RecordStrobeVariable;
138 sigc::signal<void,MachineControl &> Wait;
139 sigc::signal<void,MachineControl &> Resume;
141 /* The second argument is the shuttle speed, the third is
142 true if the direction is "forwards", false for "reverse"
145 sigc::signal<void,MachineControl &,float,bool> Shuttle;
147 /* The second argument specifies the desired track record enabled
151 sigc::signal<void,MachineControl &,size_t,bool>
152 TrackRecordStatusChange;
154 /* The second argument points to a byte array containing
155 the locate target value in MMC Standard Time Code
156 format (5 bytes, roughly: hrs/mins/secs/frames/subframes)
159 sigc::signal<void,MachineControl &, const byte *> Locate;
161 /* The second argument is the number of steps to jump */
163 sigc::signal<void,MachineControl &, int> Step;
167 #define MMC_NTRACKS 48
169 /* MMC Information fields (think "registers") */
171 CommandSignature commandSignature;
172 ResponseSignature responseSignature;
177 byte commandErrorLevel;
179 byte motionControlTally;
185 bool trackRecordStatus[MMC_NTRACKS];
186 bool trackRecordReady[MMC_NTRACKS];
189 byte trackSyncMonitor;
190 byte trackInputMonitor;
192 byte playSpeedReference;
198 byte selectedTimeCode;
199 byte shortSelectedTimeCode;
201 byte selectedTimeCodeSource;
202 byte selectedTimeCodeUserbits;
203 byte selectedMasterCode;
204 byte requestedOffset;
207 byte shortSelectedMasterCode;
208 byte shortRequestedOffset;
209 byte shortActualOffset;
210 byte shortLockDeviation;
211 byte resolvedPlayMode;
213 byte generatorTimeCode;
214 byte shortGeneratorTimeCode;
215 byte generatorCommandTally;
217 byte generatorUserbits;
218 byte vitcInsertEnable;
219 byte midiTimeCodeInput;
220 byte shortMidiTimeCodeInput;
221 byte midiTimeCodeCommandTally;
222 byte midiTimeCodeSetUp;
239 byte procedureResponse;
241 byte responseSegment;
249 void process_mmc_message (Parser &p, byte *, size_t len);
251 int do_masked_write (byte *, size_t len);
252 int do_locate (byte *, size_t len);
253 int do_step (byte *, size_t len);
254 int do_shuttle (byte *, size_t len);
256 void write_track_record_ready (byte *, size_t len);
261 #endif /* __midipp_mmc_h_h__ */