| 1 | /* |
|---|
| 2 | * libjdkmidi-2004 C++ Class Library for MIDI |
|---|
| 3 | * |
|---|
| 4 | * Copyright (C) 2004 J.D. Koftinoff Software, Ltd. |
|---|
| 5 | * www.jdkoftinoff.com |
|---|
| 6 | * jeffk@jdkoftinoff.com |
|---|
| 7 | * |
|---|
| 8 | * *** RELEASED UNDER THE GNU GENERAL PUBLIC LICENSE (GPL) April 27, 2004 *** |
|---|
| 9 | * |
|---|
| 10 | * This program is free software; you can redistribute it and/or modify |
|---|
| 11 | * it under the terms of the GNU General Public License as published by |
|---|
| 12 | * the Free Software Foundation; either version 2 of the License, or |
|---|
| 13 | * (at your option) any later version. |
|---|
| 14 | * |
|---|
| 15 | * This program is distributed in the hope that it will be useful, |
|---|
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 18 | * GNU General Public License for more details. |
|---|
| 19 | * |
|---|
| 20 | * You should have received a copy of the GNU General Public License |
|---|
| 21 | * along with this program; if not, write to the Free Software |
|---|
| 22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 23 | */ |
|---|
| 24 | #ifndef JDKMIDI_SHOWCONTROL_H |
|---|
| 25 | #define JDKMIDI_SHOWCONTROL_H |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | #include "jdkmidi/sysex.h" |
|---|
| 30 | |
|---|
| 31 | namespace jdkmidi |
|---|
| 32 | { |
|---|
| 33 | // |
|---|
| 34 | // Hacked defines that really should just go away: |
|---|
| 35 | // |
|---|
| 36 | |
|---|
| 37 | // Simple macros to make Setter and Getter methods easier |
|---|
| 38 | // in an object. |
|---|
| 39 | // |
|---|
| 40 | // examples: |
|---|
| 41 | // |
|---|
| 42 | // _ATTRIBUTE(long,Position) |
|---|
| 43 | // |
|---|
| 44 | // would generate a private 'long Position;' |
|---|
| 45 | // a 'const long GetPosition() const;' method |
|---|
| 46 | // and a 'void SetPosition( long a );' method |
|---|
| 47 | // |
|---|
| 48 | // |
|---|
| 49 | // |
|---|
| 50 | // _ATTRIBUTE_REF( long, Position ) |
|---|
| 51 | // |
|---|
| 52 | // would generate a private 'long Position;' |
|---|
| 53 | // a 'const long &GetPosition() const;' method |
|---|
| 54 | // and a 'void SetPosition( const long &a );' method |
|---|
| 55 | // |
|---|
| 56 | // |
|---|
| 57 | // |
|---|
| 58 | // _ACCESS( double, DPosition, Position ) |
|---|
| 59 | // |
|---|
| 60 | // Is used to access an attribute with a different type. |
|---|
| 61 | // It would generate just the methods: |
|---|
| 62 | // 'double GetDPosition() const { return Position; } |
|---|
| 63 | // 'void SetDPosition( double a ) { Position=a; } |
|---|
| 64 | // |
|---|
| 65 | // |
|---|
| 66 | // _ACCESS_REF( double, DPosition, Position ) |
|---|
| 67 | // |
|---|
| 68 | // Is used to access an attribute with a different type. |
|---|
| 69 | // It would generate just the methods: |
|---|
| 70 | // 'const double &GetDPosition() const { return Position; } |
|---|
| 71 | // 'void SetDPosition( const double &a ) { Position=a; } |
|---|
| 72 | // |
|---|
| 73 | |
|---|
| 74 | #define _ATTRIBUTE( TYPE, NAME ) \ |
|---|
| 75 | public: \ |
|---|
| 76 | const TYPE Get##NAME() const \ |
|---|
| 77 | { return NAME; } \ |
|---|
| 78 | void Set##NAME( TYPE a ) \ |
|---|
| 79 | { NAME=a; } \ |
|---|
| 80 | private: \ |
|---|
| 81 | TYPE NAME |
|---|
| 82 | |
|---|
| 83 | |
|---|
| 84 | |
|---|
| 85 | #define _ATTRIBUTE_REF( TYPE, NAME ) \ |
|---|
| 86 | public: \ |
|---|
| 87 | const TYPE &Get##NAME() const \ |
|---|
| 88 | { return NAME; } \ |
|---|
| 89 | void Set##NAME( const TYPE & a )\ |
|---|
| 90 | { NAME=a; } \ |
|---|
| 91 | private: \ |
|---|
| 92 | TYPE NAME |
|---|
| 93 | |
|---|
| 94 | |
|---|
| 95 | #define _ACCESS( TYPE, NAME1, NAME2 ) \ |
|---|
| 96 | public: \ |
|---|
| 97 | const TYPE Get##NAME1() const \ |
|---|
| 98 | { return NAME2; } \ |
|---|
| 99 | void Set##NAME1( TYPE a ) \ |
|---|
| 100 | { NAME2=a; } |
|---|
| 101 | |
|---|
| 102 | |
|---|
| 103 | #define _ACCESS_REF( TYPE, NAME1, NAME2 )\ |
|---|
| 104 | public: \ |
|---|
| 105 | const TYPE &Get##NAME1() const \ |
|---|
| 106 | { return NAME2; } \ |
|---|
| 107 | void Set##NAME1( const TYPE &a )\ |
|---|
| 108 | { NAME2=a; } |
|---|
| 109 | |
|---|
| 110 | |
|---|
| 111 | |
|---|
| 112 | #define _PATTRIBUTE( TYPE, NAME ) \ |
|---|
| 113 | protected: \ |
|---|
| 114 | const TYPE *Get##NAME() const \ |
|---|
| 115 | { return NAME; } \ |
|---|
| 116 | void Set##NAME( TYPE *a ) \ |
|---|
| 117 | { NAME=a; } \ |
|---|
| 118 | private: \ |
|---|
| 119 | TYPE NAME |
|---|
| 120 | |
|---|
| 121 | |
|---|
| 122 | #define _PATTRIBUTE_REF( TYPE, NAME ) \ |
|---|
| 123 | protected: \ |
|---|
| 124 | const TYPE &Get##NAME() const \ |
|---|
| 125 | { return NAME; } \ |
|---|
| 126 | void Set##NAME( const TYPE & a )\ |
|---|
| 127 | { NAME=a; } \ |
|---|
| 128 | private: \ |
|---|
| 129 | TYPE NAME |
|---|
| 130 | |
|---|
| 131 | |
|---|
| 132 | #define _PACCESS( TYPE, NAME1, NAME2 ) \ |
|---|
| 133 | protected: \ |
|---|
| 134 | const TYPE Get##NAME1() const \ |
|---|
| 135 | { return NAME2; } \ |
|---|
| 136 | void Set##NAME1( const TYPE a ) \ |
|---|
| 137 | { NAME2=a; } |
|---|
| 138 | |
|---|
| 139 | |
|---|
| 140 | #define _PACCESS_REF( TYPE, NAME1, NAME2 )\ |
|---|
| 141 | protected: \ |
|---|
| 142 | const TYPE &Get##NAME1() const \ |
|---|
| 143 | { return NAME2; } \ |
|---|
| 144 | void Set##NAME1( const TYPE &a )\ |
|---|
| 145 | { NAME2=a; } |
|---|
| 146 | |
|---|
| 147 | |
|---|
| 148 | |
|---|
| 149 | class MIDICue |
|---|
| 150 | { |
|---|
| 151 | public: |
|---|
| 152 | MIDICue ( const MIDICue &c ) : v1 ( c.v1 ), v2 ( c.v2 ), v3 ( c.v3 ), num_values ( c.num_values ) {} |
|---|
| 153 | MIDICue() : v1 ( 0 ), num_values ( 1 ) {} |
|---|
| 154 | MIDICue ( ulong v1_ ) : v1 ( v1_ ),num_values ( 1 ) {} |
|---|
| 155 | MIDICue ( ulong v1_,ulong v2_ ) : v1 ( v1_ ),v2 ( v2_ ),num_values ( 2 ) {} |
|---|
| 156 | MIDICue ( ulong v1_,ulong v2_, ulong v3_ ) : v1 ( v1_ ),v2 ( v2_ ),v3 ( v3_ ),num_values ( 3 ) {} |
|---|
| 157 | |
|---|
| 158 | void Clear() |
|---|
| 159 | { |
|---|
| 160 | v1=0; |
|---|
| 161 | num_values=1; |
|---|
| 162 | } |
|---|
| 163 | operator ulong () const |
|---|
| 164 | { |
|---|
| 165 | return v1; |
|---|
| 166 | } |
|---|
| 167 | |
|---|
| 168 | const MIDICue &operator = ( const MIDICue &c ) |
|---|
| 169 | { |
|---|
| 170 | v1=c.v1; |
|---|
| 171 | v2=c.v2; |
|---|
| 172 | v3=c.v3; |
|---|
| 173 | num_values = c.num_values; |
|---|
| 174 | return *this; |
|---|
| 175 | } |
|---|
| 176 | |
|---|
| 177 | const MIDICue &operator = ( ulong v ) |
|---|
| 178 | { |
|---|
| 179 | v1=v; |
|---|
| 180 | num_values=1; |
|---|
| 181 | return *this; |
|---|
| 182 | } |
|---|
| 183 | |
|---|
| 184 | const bool operator == ( ulong v ) |
|---|
| 185 | { |
|---|
| 186 | return v1==v; |
|---|
| 187 | } |
|---|
| 188 | |
|---|
| 189 | const MIDICue &operator == ( const MIDICue &c ); |
|---|
| 190 | const bool operator != ( ulong v ) |
|---|
| 191 | { |
|---|
| 192 | return v1!=v; |
|---|
| 193 | } |
|---|
| 194 | const MIDICue &operator != ( const MIDICue &c ); |
|---|
| 195 | |
|---|
| 196 | |
|---|
| 197 | bool operator <= ( ulong v ) |
|---|
| 198 | { |
|---|
| 199 | return v1<=v; |
|---|
| 200 | } |
|---|
| 201 | |
|---|
| 202 | bool operator >= ( ulong v ) |
|---|
| 203 | { |
|---|
| 204 | return v1>=v; |
|---|
| 205 | } |
|---|
| 206 | |
|---|
| 207 | bool operator < ( ulong v ) |
|---|
| 208 | { |
|---|
| 209 | return v1<v; |
|---|
| 210 | } |
|---|
| 211 | |
|---|
| 212 | bool operator > ( ulong v ) |
|---|
| 213 | { |
|---|
| 214 | return v1>v; |
|---|
| 215 | } |
|---|
| 216 | |
|---|
| 217 | friend MIDICue operator - ( const MIDICue &c, const MIDICue &d ); |
|---|
| 218 | friend MIDICue operator - ( const MIDICue &c, ulong v ); |
|---|
| 219 | friend MIDICue operator - ( ulong v, const MIDICue &c ); |
|---|
| 220 | |
|---|
| 221 | friend MIDICue operator + ( const MIDICue &c, const MIDICue &d ); |
|---|
| 222 | friend MIDICue operator + ( const MIDICue &c, ulong v ); |
|---|
| 223 | friend MIDICue operator + ( ulong v, const MIDICue &c ); |
|---|
| 224 | |
|---|
| 225 | |
|---|
| 226 | ulong GetNumValues() const |
|---|
| 227 | { |
|---|
| 228 | return num_values; |
|---|
| 229 | } |
|---|
| 230 | ulong GetV1() const |
|---|
| 231 | { |
|---|
| 232 | return v1; |
|---|
| 233 | } |
|---|
| 234 | ulong GetV2() const |
|---|
| 235 | { |
|---|
| 236 | return v2; |
|---|
| 237 | } |
|---|
| 238 | ulong GetV3() const |
|---|
| 239 | { |
|---|
| 240 | return v3; |
|---|
| 241 | } |
|---|
| 242 | |
|---|
| 243 | void SetNumValues ( int a ) |
|---|
| 244 | { |
|---|
| 245 | num_values=a; |
|---|
| 246 | } |
|---|
| 247 | void SetV1 ( ulong a ) |
|---|
| 248 | { |
|---|
| 249 | v1=a; |
|---|
| 250 | } |
|---|
| 251 | void SetV2 ( ulong a ) |
|---|
| 252 | { |
|---|
| 253 | v2=a; |
|---|
| 254 | } |
|---|
| 255 | void SetV3 ( ulong a ) |
|---|
| 256 | { |
|---|
| 257 | v3=a; |
|---|
| 258 | } |
|---|
| 259 | protected: |
|---|
| 260 | ulong v1,v2,v3; |
|---|
| 261 | int num_values; |
|---|
| 262 | }; |
|---|
| 263 | |
|---|
| 264 | inline MIDICue operator - ( const MIDICue &c, const MIDICue &d ) |
|---|
| 265 | { |
|---|
| 266 | MIDICue result=c; |
|---|
| 267 | |
|---|
| 268 | result.v1 -= d.v1; |
|---|
| 269 | result.v2 -= d.v2; |
|---|
| 270 | result.v3 -= d.v3; |
|---|
| 271 | |
|---|
| 272 | return result; |
|---|
| 273 | } |
|---|
| 274 | |
|---|
| 275 | inline MIDICue operator - ( const MIDICue &c, ulong v ) |
|---|
| 276 | { |
|---|
| 277 | MIDICue result ( c ); |
|---|
| 278 | |
|---|
| 279 | result.v1 -= v; |
|---|
| 280 | return result; |
|---|
| 281 | } |
|---|
| 282 | |
|---|
| 283 | inline MIDICue operator - ( ulong v, const MIDICue &c ) |
|---|
| 284 | { |
|---|
| 285 | MIDICue result ( v - c.v1 ); |
|---|
| 286 | |
|---|
| 287 | return result; |
|---|
| 288 | } |
|---|
| 289 | |
|---|
| 290 | inline MIDICue operator + ( const MIDICue &c, const MIDICue &d ) |
|---|
| 291 | { |
|---|
| 292 | MIDICue result=c; |
|---|
| 293 | |
|---|
| 294 | result.v1 += d.v1; |
|---|
| 295 | result.v2 += d.v2; |
|---|
| 296 | result.v3 += d.v3; |
|---|
| 297 | |
|---|
| 298 | return result; |
|---|
| 299 | |
|---|
| 300 | } |
|---|
| 301 | |
|---|
| 302 | inline MIDICue operator + ( const MIDICue &c, ulong v ) |
|---|
| 303 | { |
|---|
| 304 | MIDICue result ( c ); |
|---|
| 305 | |
|---|
| 306 | result.v1 += v; |
|---|
| 307 | return result; |
|---|
| 308 | |
|---|
| 309 | } |
|---|
| 310 | |
|---|
| 311 | inline MIDICue operator + ( ulong v, const MIDICue &c ) |
|---|
| 312 | { |
|---|
| 313 | MIDICue result ( v + c.v1 ); |
|---|
| 314 | |
|---|
| 315 | return result; |
|---|
| 316 | } |
|---|
| 317 | |
|---|
| 318 | |
|---|
| 319 | |
|---|
| 320 | |
|---|
| 321 | enum MIDIShowCommand |
|---|
| 322 | { |
|---|
| 323 | MIDI_SC_GO = 0x01, |
|---|
| 324 | MIDI_SC_STOP = 0x02, |
|---|
| 325 | MIDI_SC_RESUME = 0x03, |
|---|
| 326 | MIDI_SC_TIMED_GO = 0x04, |
|---|
| 327 | MIDI_SC_LOAD = 0x05, |
|---|
| 328 | MIDI_SC_SET = 0x06, |
|---|
| 329 | MIDI_SC_FIRE = 0x07, |
|---|
| 330 | MIDI_SC_ALL_OFF = 0x08, |
|---|
| 331 | MIDI_SC_RESTORE = 0x09, |
|---|
| 332 | MIDI_SC_RESET = 0x0a, |
|---|
| 333 | MIDI_SC_GO_OFF = 0x0b, |
|---|
| 334 | MIDI_SC_GO_JAM = 0x10, |
|---|
| 335 | MIDI_SC_STANDBY_PLUS = 0x11, |
|---|
| 336 | MIDI_SC_STANDBY_MINUS = 0x12, |
|---|
| 337 | MIDI_SC_SEQUENCE_PLUS = 0x13, |
|---|
| 338 | MIDI_SC_SEQUENCE_MINUS = 0x14, |
|---|
| 339 | MIDI_SC_START_CLOCK = 0x15, |
|---|
| 340 | MIDI_SC_STOP_CLOCK = 0x16, |
|---|
| 341 | MIDI_SC_ZERO_CLOCK = 0x17, |
|---|
| 342 | MIDI_SC_SET_CLOCK = 0x18, |
|---|
| 343 | MIDI_SC_MTC_CHASE_ON = 0x19, |
|---|
| 344 | MIDI_SC_MTC_CHASE_OFF = 0x1a, |
|---|
| 345 | MIDI_SC_OPEN_Q_LIST = 0x1b, |
|---|
| 346 | MIDI_SC_CLOSE_Q_LIST = 0x1c, |
|---|
| 347 | MIDI_SC_OPEN_Q_PATH = 0x1d, |
|---|
| 348 | MIDI_SC_CLOSE_Q_PATH = 0x1e |
|---|
| 349 | }; |
|---|
| 350 | |
|---|
| 351 | |
|---|
| 352 | class MIDIShowControlPacket |
|---|
| 353 | { |
|---|
| 354 | public: |
|---|
| 355 | MIDIShowControlPacket(); |
|---|
| 356 | |
|---|
| 357 | void Put_Go() |
|---|
| 358 | { |
|---|
| 359 | Put_Simple0 ( MIDI_SC_GO ); |
|---|
| 360 | } |
|---|
| 361 | |
|---|
| 362 | void Put_Go ( const MIDICue & q_number ) |
|---|
| 363 | { |
|---|
| 364 | Put_Simple1 ( MIDI_SC_GO, q_number ); |
|---|
| 365 | } |
|---|
| 366 | |
|---|
| 367 | void Put_Go ( const MIDICue & q_number, const MIDICue & q_list ) |
|---|
| 368 | { |
|---|
| 369 | Put_Simple2 ( MIDI_SC_GO, q_number, q_list ); |
|---|
| 370 | } |
|---|
| 371 | |
|---|
| 372 | void Put_Go ( const MIDICue & q_number, const MIDICue & q_list, const MIDICue & q_path ) |
|---|
| 373 | { |
|---|
| 374 | Put_Simple3 ( MIDI_SC_GO, q_number, q_list, q_path ); |
|---|
| 375 | } |
|---|
| 376 | |
|---|
| 377 | void Put_Stop() |
|---|
| 378 | { |
|---|
| 379 | Put_Simple0 ( MIDI_SC_STOP ); |
|---|
| 380 | } |
|---|
| 381 | |
|---|
| 382 | void Put_Stop ( const MIDICue & q_number ) |
|---|
| 383 | { |
|---|
| 384 | Put_Simple1 ( MIDI_SC_STOP, q_number ); |
|---|
| 385 | } |
|---|
| 386 | |
|---|
| 387 | void Put_Stop ( const MIDICue & q_number, const MIDICue & q_list ) |
|---|
| 388 | { |
|---|
| 389 | Put_Simple2 ( MIDI_SC_STOP, q_number, q_list ); |
|---|
| 390 | } |
|---|
| 391 | |
|---|
| 392 | void Put_Stop ( const MIDICue & q_number, const MIDICue & q_list, const MIDICue & q_path ) |
|---|
| 393 | { |
|---|
| 394 | Put_Simple3 ( MIDI_SC_STOP, q_number, q_list, q_path ); |
|---|
| 395 | } |
|---|
| 396 | |
|---|
| 397 | |
|---|
| 398 | void Put_Resume() |
|---|
| 399 | { |
|---|
| 400 | Put_Simple0 ( MIDI_SC_RESUME ); |
|---|
| 401 | } |
|---|
| 402 | |
|---|
| 403 | void Put_Resume ( const MIDICue & q_number ) |
|---|
| 404 | { |
|---|
| 405 | Put_Simple1 ( MIDI_SC_RESUME, q_number ); |
|---|
| 406 | } |
|---|
| 407 | |
|---|
| 408 | void Put_Resume ( const MIDICue & q_number, const MIDICue & q_list ) |
|---|
| 409 | { |
|---|
| 410 | Put_Simple2 ( MIDI_SC_RESUME, q_number, q_list ); |
|---|
| 411 | } |
|---|
| 412 | |
|---|
| 413 | void Put_Resume ( const MIDICue & q_number, const MIDICue & q_list, const MIDICue & q_path ) |
|---|
| 414 | { |
|---|
| 415 | Put_Simple3 ( MIDI_SC_RESUME, q_number, q_list, q_path ); |
|---|
| 416 | } |
|---|
| 417 | |
|---|
| 418 | |
|---|
| 419 | void Put_TimedGo ( |
|---|
| 420 | uchar hr, uchar mn, uchar sc, uchar fr, uchar ff |
|---|
| 421 | ) |
|---|
| 422 | { |
|---|
| 423 | Put_Simple0 ( MIDI_SC_TIMED_GO ); |
|---|
| 424 | SetHours ( hr ); |
|---|
| 425 | SetMinutes ( mn ); |
|---|
| 426 | SetSeconds ( sc ); |
|---|
| 427 | SetFrames ( fr ); |
|---|
| 428 | SetFractFrames ( ff ); |
|---|
| 429 | SetHasTime ( true ); |
|---|
| 430 | } |
|---|
| 431 | |
|---|
| 432 | void Put_TimedGo ( |
|---|
| 433 | uchar hr, uchar mn, uchar sc, uchar fr, uchar ff, |
|---|
| 434 | const MIDICue & q_number |
|---|
| 435 | ) |
|---|
| 436 | { |
|---|
| 437 | Put_Simple1 ( MIDI_SC_TIMED_GO, q_number ); |
|---|
| 438 | SetHours ( hr ); |
|---|
| 439 | SetMinutes ( mn ); |
|---|
| 440 | SetSeconds ( sc ); |
|---|
| 441 | SetFrames ( fr ); |
|---|
| 442 | SetFractFrames ( ff ); |
|---|
| 443 | SetHasTime ( true ); |
|---|
| 444 | } |
|---|
| 445 | |
|---|
| 446 | void Put_TimedGo ( |
|---|
| 447 | uchar hr, uchar mn, uchar sc, uchar fr, uchar ff, |
|---|
| 448 | const MIDICue & q_number, const MIDICue & q_list |
|---|
| 449 | ) |
|---|
| 450 | { |
|---|
| 451 | Put_Simple2 ( MIDI_SC_TIMED_GO, q_number, q_list ); |
|---|
| 452 | SetHours ( hr ); |
|---|
| 453 | SetMinutes ( mn ); |
|---|
| 454 | SetSeconds ( sc ); |
|---|
| 455 | SetFrames ( fr ); |
|---|
| 456 | SetFractFrames ( ff ); |
|---|
| 457 | SetHasTime ( true ); |
|---|
| 458 | } |
|---|
| 459 | |
|---|
| 460 | void Put_TimedGo ( |
|---|
| 461 | uchar hr, uchar mn, uchar sc, uchar fr, uchar ff, |
|---|
| 462 | const MIDICue & q_number, const MIDICue & q_list, const MIDICue & q_path |
|---|
| 463 | ) |
|---|
| 464 | { |
|---|
| 465 | Put_Simple3 ( MIDI_SC_TIMED_GO, q_number, q_list, q_path ); |
|---|
| 466 | SetHours ( hr ); |
|---|
| 467 | SetMinutes ( mn ); |
|---|
| 468 | SetSeconds ( sc ); |
|---|
| 469 | SetFrames ( fr ); |
|---|
| 470 | SetFractFrames ( ff ); |
|---|
| 471 | SetHasTime ( true ); |
|---|
| 472 | } |
|---|
| 473 | |
|---|
| 474 | |
|---|
| 475 | void Put_Load ( const MIDICue & q_number ) |
|---|
| 476 | { |
|---|
| 477 | Put_Simple1 ( MIDI_SC_LOAD, q_number ); |
|---|
| 478 | } |
|---|
| 479 | |
|---|
| 480 | void Put_Load ( const MIDICue & q_number, const MIDICue & q_list ) |
|---|
| 481 | { |
|---|
| 482 | Put_Simple2 ( MIDI_SC_LOAD, q_number, q_list ); |
|---|
| 483 | } |
|---|
| 484 | |
|---|
| 485 | void Put_Load ( const MIDICue & q_number, const MIDICue & q_list, const MIDICue & q_path ) |
|---|
| 486 | { |
|---|
| 487 | Put_Simple3 ( MIDI_SC_LOAD, q_number, q_list, q_path ); |
|---|
| 488 | } |
|---|
| 489 | |
|---|
| 490 | |
|---|
| 491 | void Put_Set ( ulong ctrl_num, ulong ctrl_val ) |
|---|
| 492 | { |
|---|
| 493 | Put_Simple0 ( MIDI_SC_SET ); |
|---|
| 494 | SetControlNum ( ctrl_num ); |
|---|
| 495 | SetControlVal ( ctrl_val ); |
|---|
| 496 | } |
|---|
| 497 | |
|---|
| 498 | void Put_Set ( |
|---|
| 499 | ulong ctrl_num, |
|---|
| 500 | ulong ctrl_val, |
|---|
| 501 | uchar hr, uchar mn, uchar sc, uchar fr, uchar ff |
|---|
| 502 | ) |
|---|
| 503 | { |
|---|
| 504 | Put_Simple0 ( MIDI_SC_SET ); |
|---|
| 505 | SetControlNum ( ctrl_num ); |
|---|
| 506 | SetControlVal ( ctrl_val ); |
|---|
| 507 | SetHours ( hr ); |
|---|
| 508 | SetMinutes ( mn ); |
|---|
| 509 | SetSeconds ( sc ); |
|---|
| 510 | SetFrames ( fr ); |
|---|
| 511 | SetFractFrames ( ff ); |
|---|
| 512 | SetHasTime ( true ); |
|---|
| 513 | } |
|---|
| 514 | |
|---|
| 515 | |
|---|
| 516 | void Put_Fire ( uchar macro_num ) |
|---|
| 517 | { |
|---|
| 518 | Put_Simple0 ( MIDI_SC_ALL_OFF ); |
|---|
| 519 | SetMacroNum ( macro_num ); |
|---|
| 520 | } |
|---|
| 521 | |
|---|
| 522 | void Put_AllOff() |
|---|
| 523 | { |
|---|
| 524 | Put_Simple0 ( MIDI_SC_ALL_OFF ); |
|---|
| 525 | } |
|---|
| 526 | |
|---|
| 527 | void Put_Restore() |
|---|
| 528 | { |
|---|
| 529 | Put_Simple0 ( MIDI_SC_RESTORE ); |
|---|
| 530 | } |
|---|
| 531 | |
|---|
| 532 | void Put_Reset() |
|---|
| 533 | { |
|---|
| 534 | Put_Simple0 ( MIDI_SC_RESET ); |
|---|
| 535 | } |
|---|
| 536 | |
|---|
| 537 | void Put_GoOff() |
|---|
| 538 | { |
|---|
| 539 | Put_Simple0 ( MIDI_SC_GO_OFF ); |
|---|
| 540 | } |
|---|
| 541 | |
|---|
| 542 | void Put_GoOff ( const MIDICue & q_number ) |
|---|
| 543 | { |
|---|
| 544 | Put_Simple1 ( MIDI_SC_GO_OFF,q_number ); |
|---|
| 545 | } |
|---|
| 546 | |
|---|
| 547 | void Put_GoOff ( const MIDICue & q_number, const MIDICue & q_list ) |
|---|
| 548 | { |
|---|
| 549 | Put_Simple2 ( MIDI_SC_GO_OFF, q_number, q_list ); |
|---|
| 550 | } |
|---|
| 551 | |
|---|
| 552 | void Put_GoOff ( const MIDICue & q_number, const MIDICue & q_list, const MIDICue & q_path ) |
|---|
| 553 | { |
|---|
| 554 | Put_Simple3 ( MIDI_SC_GO_OFF, q_number, q_list, q_path ); |
|---|
| 555 | } |
|---|
| 556 | |
|---|
| 557 | void Put_GoJam() |
|---|
| 558 | { |
|---|
| 559 | Put_Simple0 ( MIDI_SC_GO_JAM ); |
|---|
| 560 | } |
|---|
| 561 | |
|---|
| 562 | void Put_GoJam ( const MIDICue & q_number ) |
|---|
| 563 | { |
|---|
| 564 | Put_Simple1 ( MIDI_SC_GO_JAM, q_number ); |
|---|
| 565 | } |
|---|
| 566 | |
|---|
| 567 | void Put_GoJam ( const MIDICue & q_number, const MIDICue & q_list ) |
|---|
| 568 | { |
|---|
| 569 | Put_Simple2 ( MIDI_SC_GO_JAM, q_number, q_list ); |
|---|
| 570 | } |
|---|
| 571 | |
|---|
| 572 | void Put_GoJam ( const MIDICue & q_number, const MIDICue & q_list, const MIDICue & q_path ) |
|---|
| 573 | { |
|---|
| 574 | Put_Simple3 ( MIDI_SC_GO_JAM, q_number, q_list, q_path ); |
|---|
| 575 | } |
|---|
| 576 | |
|---|
| 577 | |
|---|
| 578 | void Put_StandbyPlus() |
|---|
| 579 | { |
|---|
| 580 | Put_Simple0 ( MIDI_SC_STANDBY_PLUS ); |
|---|
| 581 | } |
|---|
| 582 | |
|---|
| 583 | void Put_StandbyPlus ( const MIDICue & q_list ) |
|---|
| 584 | { |
|---|
| 585 | Put_Simple0 ( MIDI_SC_STANDBY_PLUS ); |
|---|
| 586 | SetQList ( q_list ); |
|---|
| 587 | SetHasQList ( true ); |
|---|
| 588 | } |
|---|
| 589 | void Put_StandbyMinus() |
|---|
| 590 | { |
|---|
| 591 | Put_Simple0 ( MIDI_SC_STANDBY_MINUS ); |
|---|
| 592 | } |
|---|
| 593 | |
|---|
| 594 | void Put_StandbyMinus ( const MIDICue & q_list ) |
|---|
| 595 | { |
|---|
| 596 | Put_Simple0 ( MIDI_SC_STANDBY_MINUS ); |
|---|
| 597 | SetQList ( q_list ); |
|---|
| 598 | SetHasQList ( true ); |
|---|
| 599 | } |
|---|
| 600 | |
|---|
| 601 | void Put_SequencePlus() |
|---|
| 602 | { |
|---|
| 603 | Put_Simple0 ( MIDI_SC_SEQUENCE_PLUS ); |
|---|
| 604 | } |
|---|
| 605 | |
|---|
| 606 | void Put_SequencePlus ( const MIDICue & q_list ) |
|---|
| 607 | { |
|---|
| 608 | Put_Simple0 ( MIDI_SC_SEQUENCE_PLUS ); |
|---|
| 609 | SetQList ( q_list ); |
|---|
| 610 | SetHasQList ( true ); |
|---|
| 611 | } |
|---|
| 612 | |
|---|
| 613 | void Put_SequenceMinus() |
|---|
| 614 | { |
|---|
| 615 | Put_Simple0 ( MIDI_SC_SEQUENCE_MINUS ); |
|---|
| 616 | } |
|---|
| 617 | |
|---|
| 618 | void Put_SequenceMinus ( const MIDICue & q_list ) |
|---|
| 619 | { |
|---|
| 620 | Put_Simple0 ( MIDI_SC_SEQUENCE_MINUS ); |
|---|
| 621 | SetQList ( q_list ); |
|---|
| 622 | SetHasQList ( true ); |
|---|
| 623 | } |
|---|
| 624 | |
|---|
| 625 | void Put_StartClock() |
|---|
| 626 | { |
|---|
| 627 | Put_Simple0 ( MIDI_SC_START_CLOCK ); |
|---|
| 628 | } |
|---|
| 629 | |
|---|
| 630 | void Put_StartClock ( const MIDICue & q_list ) |
|---|
| 631 | { |
|---|
| 632 | Put_Simple0 ( MIDI_SC_START_CLOCK ); |
|---|
| 633 | SetQList ( q_list ); |
|---|
| 634 | SetHasQList ( true ); |
|---|
| 635 | } |
|---|
| 636 | |
|---|
| 637 | void Put_StopClock() |
|---|
| 638 | { |
|---|
| 639 | Put_Simple0 ( MIDI_SC_STOP_CLOCK ); |
|---|
| 640 | } |
|---|
| 641 | |
|---|
| 642 | void Put_StopClock ( const MIDICue & q_list ) |
|---|
| 643 | { |
|---|
| 644 | Put_Simple0 ( MIDI_SC_STOP_CLOCK ); |
|---|
| 645 | SetQList ( q_list ); |
|---|
| 646 | SetHasQList ( true ); |
|---|
| 647 | } |
|---|
| 648 | |
|---|
| 649 | void Put_ZeroClock() |
|---|
| 650 | { |
|---|
| 651 | Put_Simple0 ( MIDI_SC_ZERO_CLOCK ); |
|---|
| 652 | } |
|---|
| 653 | |
|---|
| 654 | void Put_ZeroClock ( const MIDICue & q_list ) |
|---|
| 655 | { |
|---|
| 656 | Put_Simple0 ( MIDI_SC_ZERO_CLOCK ); |
|---|
| 657 | SetQList ( q_list ); |
|---|
| 658 | SetHasQList ( true ); |
|---|
| 659 | } |
|---|
| 660 | |
|---|
| 661 | void Put_SetClock ( |
|---|
| 662 | uchar hr, uchar mn, uchar sc, uchar fr, uchar ff |
|---|
| 663 | ) |
|---|
| 664 | { |
|---|
| 665 | Put_Simple0 ( MIDI_SC_SET_CLOCK ); |
|---|
| 666 | SetHours ( hr ); |
|---|
| 667 | SetMinutes ( mn ); |
|---|
| 668 | SetSeconds ( sc ); |
|---|
| 669 | SetFrames ( fr ); |
|---|
| 670 | SetFractFrames ( ff ); |
|---|
| 671 | SetHasTime ( true ); |
|---|
| 672 | } |
|---|
| 673 | |
|---|
| 674 | void Put_SetClock ( |
|---|
| 675 | uchar hr, uchar mn, uchar sc, uchar fr, uchar ff, |
|---|
| 676 | const MIDICue & q_list |
|---|
| 677 | ) |
|---|
| 678 | { |
|---|
| 679 | Put_Simple0 ( MIDI_SC_SET_CLOCK ); |
|---|
| 680 | SetHours ( hr ); |
|---|
| 681 | SetMinutes ( mn ); |
|---|
| 682 | SetSeconds ( sc ); |
|---|
| 683 | SetFrames ( fr ); |
|---|
| 684 | SetFractFrames ( ff ); |
|---|
| 685 | SetHasTime ( true ); |
|---|
| 686 | SetQList ( q_list ); |
|---|
| 687 | SetHasQList ( true ); |
|---|
| 688 | } |
|---|
| 689 | |
|---|
| 690 | |
|---|
| 691 | void Put_MTCChaseOn() |
|---|
| 692 | { |
|---|
| 693 | Put_Simple0 ( MIDI_SC_MTC_CHASE_ON ); |
|---|
| 694 | } |
|---|
| 695 | |
|---|
| 696 | void Put_MTCChaseOn ( const MIDICue & q_list ) |
|---|
| 697 | { |
|---|
| 698 | Put_Simple0 ( MIDI_SC_MTC_CHASE_ON ); |
|---|
| 699 | SetQList ( q_list ); |
|---|
| 700 | SetHasQList ( true ); |
|---|
| 701 | } |
|---|
| 702 | void Put_MTCChaseOff() |
|---|
| 703 | { |
|---|
| 704 | Put_Simple0 ( MIDI_SC_MTC_CHASE_OFF ); |
|---|
| 705 | } |
|---|
| 706 | |
|---|
| 707 | void Put_MTCChaseOff ( const MIDICue & q_list ) |
|---|
| 708 | { |
|---|
| 709 | Put_Simple0 ( MIDI_SC_MTC_CHASE_OFF ); |
|---|
| 710 | SetQList ( q_list ); |
|---|
| 711 | SetHasQList ( true ); |
|---|
| 712 | } |
|---|
| 713 | |
|---|
| 714 | void Put_OpenQList ( const MIDICue & q_list ) |
|---|
| 715 | { |
|---|
| 716 | Put_Simple0 ( MIDI_SC_OPEN_Q_LIST ); |
|---|
| 717 | SetQList ( q_list ); |
|---|
| 718 | SetHasQList ( true ); |
|---|
| 719 | } |
|---|
| 720 | |
|---|
| 721 | void Put_CloseQList ( const MIDICue & q_list ) |
|---|
| 722 | { |
|---|
| 723 | Put_Simple0 ( MIDI_SC_CLOSE_Q_LIST ); |
|---|
| 724 | SetQList ( q_list ); |
|---|
| 725 | SetHasQList ( true ); |
|---|
| 726 | } |
|---|
| 727 | |
|---|
| 728 | void Put_OpenQPath ( const MIDICue & q_path ) |
|---|
| 729 | { |
|---|
| 730 | Put_Simple0 ( MIDI_SC_OPEN_Q_PATH ); |
|---|
| 731 | SetQPath ( q_path ); |
|---|
| 732 | SetHasQPath ( true ); |
|---|
| 733 | } |
|---|
| 734 | |
|---|
| 735 | void Put_CloseQPath ( const MIDICue & q_path ) |
|---|
| 736 | { |
|---|
| 737 | Put_Simple0 ( MIDI_SC_CLOSE_Q_PATH ); |
|---|
| 738 | SetQPath ( q_path ); |
|---|
| 739 | SetHasQPath ( true ); |
|---|
| 740 | } |
|---|
| 741 | |
|---|
| 742 | bool ParseEntireSysEx ( const MIDISystemExclusive *e ); |
|---|
| 743 | bool StoreToSysEx ( MIDISystemExclusive *e ) const; |
|---|
| 744 | protected: |
|---|
| 745 | bool StoreTime ( MIDISystemExclusive *e ) const; |
|---|
| 746 | bool ParseTime ( const MIDISystemExclusive *e, int *pos ); |
|---|
| 747 | bool Store3Param ( MIDISystemExclusive *e ) const; |
|---|
| 748 | bool Parse3Param ( const MIDISystemExclusive *e, int *pos ); |
|---|
| 749 | bool StoreSet ( MIDISystemExclusive *e ) const; |
|---|
| 750 | bool ParseSet ( const MIDISystemExclusive *e,int *pos ); |
|---|
| 751 | bool StoreFire ( MIDISystemExclusive *e ) const; |
|---|
| 752 | bool ParseFire ( const MIDISystemExclusive *e, int *pos ); |
|---|
| 753 | bool StoreQPath ( MIDISystemExclusive *e ) const; |
|---|
| 754 | bool ParseQPath ( const MIDISystemExclusive *e, int *pos ); |
|---|
| 755 | bool StoreQList ( MIDISystemExclusive *e ) const; |
|---|
| 756 | bool ParseQList ( const MIDISystemExclusive *e, int *pos ); |
|---|
| 757 | bool StoreAscii ( MIDISystemExclusive *e, const char *str ) const; |
|---|
| 758 | |
|---|
| 759 | bool StoreAsciiNum ( MIDISystemExclusive *e, const MIDICue & num ) const; |
|---|
| 760 | bool ParseAsciiNum ( const MIDISystemExclusive *e, int *pos, MIDICue *num ); |
|---|
| 761 | bool ParseAsciiNum ( const MIDISystemExclusive *e, int *pos, ulong *num ); |
|---|
| 762 | |
|---|
| 763 | void ClearVariableStuff(); |
|---|
| 764 | |
|---|
| 765 | void Put_Simple0 ( MIDIShowCommand cmd ) |
|---|
| 766 | { |
|---|
| 767 | ClearVariableStuff(); |
|---|
| 768 | SetCommand ( cmd ); |
|---|
| 769 | } |
|---|
| 770 | |
|---|
| 771 | |
|---|
| 772 | void Put_Simple1 ( |
|---|
| 773 | MIDIShowCommand cmd, |
|---|
| 774 | const MIDICue & q_number |
|---|
| 775 | ) |
|---|
| 776 | { |
|---|
| 777 | ClearVariableStuff(); |
|---|
| 778 | SetCommand ( cmd ); |
|---|
| 779 | SetQNumber ( q_number ); |
|---|
| 780 | SetHasQNumber ( true ); |
|---|
| 781 | } |
|---|
| 782 | |
|---|
| 783 | |
|---|
| 784 | void Put_Simple2 ( |
|---|
| 785 | MIDIShowCommand cmd, |
|---|
| 786 | const MIDICue & q_number, |
|---|
| 787 | const MIDICue & q_list |
|---|
| 788 | ) |
|---|
| 789 | { |
|---|
| 790 | ClearVariableStuff(); |
|---|
| 791 | SetCommand ( cmd ); |
|---|
| 792 | SetQNumber ( q_number ); |
|---|
| 793 | SetHasQNumber ( true ); |
|---|
| 794 | SetQList ( q_list ); |
|---|
| 795 | SetHasQList ( true ); |
|---|
| 796 | } |
|---|
| 797 | |
|---|
| 798 | |
|---|
| 799 | void Put_Simple3 ( |
|---|
| 800 | MIDIShowCommand cmd, |
|---|
| 801 | const MIDICue & q_number, |
|---|
| 802 | const MIDICue & q_list, |
|---|
| 803 | const MIDICue & q_path |
|---|
| 804 | ) |
|---|
| 805 | { |
|---|
| 806 | ClearVariableStuff(); |
|---|
| 807 | SetCommand ( cmd ); |
|---|
| 808 | SetQNumber ( q_number ); |
|---|
| 809 | SetHasQNumber ( true ); |
|---|
| 810 | SetQList ( q_list ); |
|---|
| 811 | SetHasQList ( true ); |
|---|
| 812 | SetQPath ( q_path ); |
|---|
| 813 | SetHasQPath ( true ); |
|---|
| 814 | } |
|---|
| 815 | |
|---|
| 816 | |
|---|
| 817 | _ATTRIBUTE ( uchar, DeviceId ); |
|---|
| 818 | _ATTRIBUTE ( uchar, CommandFmt ); |
|---|
| 819 | _ATTRIBUTE ( MIDIShowCommand, Command ); |
|---|
| 820 | _ATTRIBUTE ( bool, HasTime ); |
|---|
| 821 | _ATTRIBUTE ( bool, HasQNumber ); |
|---|
| 822 | _ATTRIBUTE ( bool, HasQList ); |
|---|
| 823 | _ATTRIBUTE ( bool, HasQPath ); |
|---|
| 824 | _ATTRIBUTE ( uchar, Hours ); |
|---|
| 825 | _ATTRIBUTE ( uchar, Minutes ); |
|---|
| 826 | _ATTRIBUTE ( uchar, Seconds ); |
|---|
| 827 | _ATTRIBUTE ( uchar, Frames ); |
|---|
| 828 | _ATTRIBUTE ( uchar, FractFrames ); |
|---|
| 829 | |
|---|
| 830 | _ATTRIBUTE_REF ( MIDICue, QNumber ); |
|---|
| 831 | _ATTRIBUTE_REF ( MIDICue, QList ); |
|---|
| 832 | _ATTRIBUTE_REF ( MIDICue, QPath ); |
|---|
| 833 | |
|---|
| 834 | _ATTRIBUTE ( ulong, Val1 ); |
|---|
| 835 | _ATTRIBUTE ( ulong, Val2 ); |
|---|
| 836 | |
|---|
| 837 | _ACCESS ( ulong, MacroNum, Val1 ); |
|---|
| 838 | _ACCESS ( ulong, ControlNum, Val1 ); |
|---|
| 839 | _ACCESS ( ulong, ControlVal, Val2 ); |
|---|
| 840 | }; |
|---|
| 841 | |
|---|
| 842 | // unlearn the brain damage |
|---|
| 843 | #undef _ATTRIBUTE |
|---|
| 844 | #undef _ATTRIBUTE_REF |
|---|
| 845 | #undef _ACCESS |
|---|
| 846 | #undef _ACCESS_REF |
|---|
| 847 | #undef _PATTRIBUTE |
|---|
| 848 | #undef _PATTRIBUTE_REF |
|---|
| 849 | #undef _PACCESS |
|---|
| 850 | #undef _PACCESS_REF |
|---|
| 851 | |
|---|
| 852 | } |
|---|
| 853 | |
|---|
| 854 | #endif |
|---|