1 /* _______ ____ __ ___ ___ 2 * \ _ \ \ / \ / \ \ / / ' ' ' 3 * | | \ \ | | || | \/ | . . 4 * | | | | | | || ||\ /| | 5 * | | | | | | || || \/ | | ' ' ' 6 * | | | | | | || || | | . . 7 * | |_/ / \ \__// || | | 8 * /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque 9 * / \ 10 * / . \ 11 * internal/it.h - Internal stuff for IT playback / / \ \ 12 * and MOD/XM/S3M conversion. | < / \_ 13 * | \/ /\ / 14 * This header file provides access to the \_ / > / 15 * internal structure of DUMB, and is liable | \ / / 16 * to change, mutate or cease to exist at any | ' / 17 * moment. Include it at your own peril. \__/ 18 * 19 * ... 20 * 21 * Seriously. You don't need access to anything in this file. All right, you 22 * probably do actually. But if you use it, you will be relying on a specific 23 * version of DUMB, so please check DUMB_VERSION defined in dumb.h. Please 24 * contact the authors so that we can provide a public API for what you need. 25 */ 26 27 #ifndef INTERNAL_IT_H 28 #define INTERNAL_IT_H 29 30 31 32 #include <stddef.h> 33 34 35 36 /** TO DO: THINK ABOUT THE FOLLOWING: 37 38 sigdata->flags & IT_COMPATIBLE_GXX 39 40 Bit 5: On = Link Effect G's memory with Effect E/F. Also 41 Gxx with an instrument present will cause the 42 envelopes to be retriggered. If you change a 43 sample on a row with Gxx, it'll adjust the 44 frequency of the current note according to: 45 46 NewFrequency = OldFrequency * NewC5 / OldC5; 47 */ 48 49 50 51 /* These #defines are TEMPORARY. They are used to write alternative code to 52 * handle ambiguities in the format specification. The correct code in each 53 * case will be determined most likely by experimentation. 54 */ 55 #define STEREO_SAMPLES_COUNT_AS_TWO 56 #define INVALID_ORDERS_END_SONG 57 #define INVALID_NOTES_CAUSE_NOTE_CUT 58 #define SUSTAIN_LOOP_OVERRIDES_NORMAL_LOOP 59 #define VOLUME_OUT_OF_RANGE_SETS_MAXIMUM 60 61 62 63 #define SIGTYPE_IT DUMB_ID('I', 'T', ' ', ' ') 64 65 #define IT_SIGNATURE DUMB_ID('I', 'M', 'P', 'M') 66 #define IT_INSTRUMENT_SIGNATURE DUMB_ID('I', 'M', 'P', 'I') 67 #define IT_SAMPLE_SIGNATURE DUMB_ID('I', 'M', 'P', 'S') 68 69 70 71 /* 1 minute per 4 rows, each row 6 ticks; this is divided by the tempo to get 72 * the interval between ticks. 73 */ 74 #define TICK_TIME_DIVIDEND ((65536 * 60) / (4 * 6)) 75 76 77 78 /* I'm not going to try to explain this, because I didn't derive it very 79 * formally ;) 80 */ 81 /* #define AMIGA_DIVISOR ((float)(4.0 * 14317056.0)) */ 82 /* I believe the following one to be more accurate. */ 83 #define AMIGA_DIVISOR ((float)(8.0 * 7159090.5)) 84 85 86 87 typedef struct IT_MIDI IT_MIDI; 88 typedef struct IT_FILTER_STATE IT_FILTER_STATE; 89 typedef struct IT_ENVELOPE IT_ENVELOPE; 90 typedef struct IT_INSTRUMENT IT_INSTRUMENT; 91 typedef struct IT_SAMPLE IT_SAMPLE; 92 typedef struct IT_ENTRY IT_ENTRY; 93 typedef struct IT_PATTERN IT_PATTERN; 94 typedef struct IT_PLAYING_ENVELOPE IT_PLAYING_ENVELOPE; 95 typedef struct IT_PLAYING IT_PLAYING; 96 typedef struct IT_CHANNEL IT_CHANNEL; 97 typedef struct IT_CHECKPOINT IT_CHECKPOINT; 98 typedef struct IT_CALLBACKS IT_CALLBACKS; 99 100 101 102 struct IT_MIDI 103 { 104 unsigned char SFmacro[16][16]; // read these from 0x120 105 unsigned char SFmacrolen[16]; 106 unsigned short SFmacroz[16]; /* Bitfield; bit 0 set = z in first position */ 107 unsigned char Zmacro[128][16]; // read these from 0x320 108 unsigned char Zmacrolen[128]; 109 }; 110 111 112 113 struct IT_FILTER_STATE 114 { 115 sample_t currsample, prevsample; 116 }; 117 118 119 120 #define IT_ENVELOPE_ON 1 121 #define IT_ENVELOPE_LOOP_ON 2 122 #define IT_ENVELOPE_SUSTAIN_LOOP 4 123 #define IT_ENVELOPE_PITCH_IS_FILTER 128 124 125 struct IT_ENVELOPE 126 { 127 unsigned char flags; 128 unsigned char n_nodes; 129 unsigned char loop_start; 130 unsigned char loop_end; 131 unsigned char sus_loop_start; 132 unsigned char sus_loop_end; 133 signed char node_y[25]; 134 unsigned short node_t[25]; 135 }; 136 137 138 139 #define NNA_NOTE_CUT 0 140 #define NNA_NOTE_CONTINUE 1 141 #define NNA_NOTE_OFF 2 142 #define NNA_NOTE_FADE 3 143 144 #define DCT_OFF 0 145 #define DCT_NOTE 1 146 #define DCT_SAMPLE 2 147 #define DCT_INSTRUMENT 3 148 149 #define DCA_NOTE_CUT 0 150 #define DCA_NOTE_OFF 1 151 #define DCA_NOTE_FADE 2 152 153 struct IT_INSTRUMENT 154 { 155 unsigned char name[27]; 156 unsigned char filename[14]; 157 158 int fadeout; 159 160 IT_ENVELOPE volume_envelope; 161 IT_ENVELOPE pan_envelope; 162 IT_ENVELOPE pitch_envelope; 163 164 unsigned char new_note_action; 165 unsigned char dup_check_type; 166 unsigned char dup_check_action; 167 unsigned char pp_separation; 168 unsigned char pp_centre; 169 unsigned char global_volume; 170 unsigned char default_pan; 171 unsigned char random_volume; 172 unsigned char random_pan; 173 174 unsigned char filter_cutoff; 175 unsigned char filter_resonance; 176 177 unsigned char map_note[120]; 178 unsigned short map_sample[120]; 179 }; 180 181 182 183 #define IT_SAMPLE_EXISTS 1 184 #define IT_SAMPLE_16BIT 2 185 #define IT_SAMPLE_STEREO 4 186 #define IT_SAMPLE_LOOP 16 187 #define IT_SAMPLE_SUS_LOOP 32 188 #define IT_SAMPLE_PINGPONG_LOOP 64 189 #define IT_SAMPLE_PINGPONG_SUS_LOOP 128 190 191 #define IT_VIBRATO_SINE 0 192 #define IT_VIBRATO_SAWTOOTH 1 /* Ramp down */ 193 #define IT_VIBRATO_SQUARE 2 194 #define IT_VIBRATO_RANDOM 3 195 196 struct IT_SAMPLE 197 { 198 unsigned char name[29]; 199 unsigned char filename[14]; 200 unsigned char flags; 201 unsigned char global_volume; 202 unsigned char default_volume; 203 unsigned char default_pan; 204 /* default_pan: 205 * 0-255 for XM 206 * ignored for MOD 207 * otherwise, 0-64, and add 128 to enable 208 */ 209 210 long length; 211 long loop_start; 212 long loop_end; 213 long C5_speed; 214 long sus_loop_start; 215 long sus_loop_end; 216 217 unsigned char vibrato_speed; 218 unsigned char vibrato_depth; 219 unsigned char vibrato_rate; 220 unsigned char vibrato_waveform; 221 222 void *data; 223 }; 224 225 226 227 #define IT_ENTRY_NOTE 1 228 #define IT_ENTRY_INSTRUMENT 2 229 #define IT_ENTRY_VOLPAN 4 230 #define IT_ENTRY_EFFECT 8 231 232 #define IT_SET_END_ROW(entry) ((entry)->channel = 255) 233 #define IT_IS_END_ROW(entry) ((entry)->channel >= DUMB_IT_N_CHANNELS) 234 235 #define IT_NOTE_OFF 255 236 #define IT_NOTE_CUT 254 237 238 #define IT_ENVELOPE_SHIFT 8 239 240 #define IT_SURROUND 100 241 #define IT_IS_SURROUND(pan) ((pan) > 64) 242 #define IT_IS_SURROUND_SHIFTED(pan) ((pan) > 64 << IT_ENVELOPE_SHIFT) 243 244 #define IT_SET_SPEED 1 245 #define IT_JUMP_TO_ORDER 2 246 #define IT_BREAK_TO_ROW 3 247 #define IT_VOLUME_SLIDE 4 248 #define IT_PORTAMENTO_DOWN 5 249 #define IT_PORTAMENTO_UP 6 250 #define IT_TONE_PORTAMENTO 7 251 #define IT_VIBRATO 8 252 #define IT_TREMOR 9 253 #define IT_ARPEGGIO 10 254 #define IT_VOLSLIDE_VIBRATO 11 255 #define IT_VOLSLIDE_TONEPORTA 12 256 #define IT_SET_CHANNEL_VOLUME 13 257 #define IT_CHANNEL_VOLUME_SLIDE 14 258 #define IT_SET_SAMPLE_OFFSET 15 259 #define IT_PANNING_SLIDE 16 260 #define IT_RETRIGGER_NOTE 17 261 #define IT_TREMOLO 18 262 #define IT_S 19 263 #define IT_SET_SONG_TEMPO 20 264 #define IT_FINE_VIBRATO 21 265 #define IT_SET_GLOBAL_VOLUME 22 266 #define IT_GLOBAL_VOLUME_SLIDE 23 267 #define IT_SET_PANNING 24 268 #define IT_PANBRELLO 25 269 #define IT_MIDI_MACRO 26 //see MIDI.TXT 270 271 /* Some effects needed for XM compatibility */ 272 #define IT_XM_PORTAMENTO_DOWN 27 273 #define IT_XM_PORTAMENTO_UP 28 274 #define IT_XM_FINE_VOLSLIDE_DOWN 29 275 #define IT_XM_FINE_VOLSLIDE_UP 30 276 #define IT_XM_RETRIGGER_NOTE 31 277 #define IT_XM_KEY_OFF 32 278 #define IT_XM_SET_ENVELOPE_POSITION 33 279 280 #define IT_N_EFFECTS 34 281 282 /* These represent the top nibble of the command value. */ 283 #define IT_S_SET_FILTER 0 /* Greyed out in IT... */ 284 #define IT_S_SET_GLISSANDO_CONTROL 1 /* Greyed out in IT... */ 285 #define IT_S_FINETUNE 2 /* Greyed out in IT... */ 286 #define IT_S_SET_VIBRATO_WAVEFORM 3 287 #define IT_S_SET_TREMOLO_WAVEFORM 4 288 #define IT_S_SET_PANBRELLO_WAVEFORM 5 289 #define IT_S_FINE_PATTERN_DELAY 6 290 #define IT_S7 7 291 #define IT_S_SET_PAN 8 292 #define IT_S_SET_SURROUND_SOUND 9 293 #define IT_S_SET_HIGH_OFFSET 10 294 #define IT_S_PATTERN_LOOP 11 295 #define IT_S_DELAYED_NOTE_CUT 12 296 #define IT_S_NOTE_DELAY 13 297 #define IT_S_PATTERN_DELAY 14 298 #define IT_S_SET_MIDI_MACRO 15 299 300 /* 301 S0x Set filter 302 S1x Set glissando control 303 S2x Set finetune 304 305 306 S3x Set vibrato waveform to type x 307 S4x Set tremelo waveform to type x 308 S5x Set panbrello waveform to type x 309 Waveforms for commands S3x, S4x and S5x: 310 0: Sine wave 311 1: Ramp down 312 2: Square wave 313 3: Random wave 314 S6x Pattern delay for x ticks 315 S70 Past note cut 316 S71 Past note off 317 S72 Past note fade 318 S73 Set NNA to note cut 319 S74 Set NNA to continue 320 S75 Set NNA to note off 321 S76 Set NNA to note fade 322 S77 Turn off volume envelope 323 S78 Turn on volume envelope 324 S79 Turn off panning envelope 325 S7A Turn on panning envelope 326 S7B Turn off pitch envelope 327 S7C Turn on pitch envelope 328 S8x Set panning position 329 S91 Set surround sound 330 SAy Set high value of sample offset yxx00h 331 SB0 Set loopback point 332 SBx Loop x times to loopback point 333 SCx Note cut after x ticks 334 SDx Note delay for x ticks 335 SEx Pattern delay for x rows 336 SFx Set parameterised MIDI Macro 337 */ 338 339 struct IT_ENTRY 340 { 341 unsigned char channel; /* End of row if channel >= DUMB_IT_N_CHANNELS */ 342 unsigned char mask; 343 unsigned char note; 344 unsigned char instrument; 345 unsigned char volpan; 346 unsigned char effect; 347 unsigned char effectvalue; 348 }; 349 350 351 352 struct IT_PATTERN 353 { 354 int n_rows; 355 int n_entries; 356 IT_ENTRY *entry; 357 }; 358 359 360 361 #define IT_STEREO 1 362 #define IT_USE_INSTRUMENTS 4 363 #define IT_LINEAR_SLIDES 8 /* If not set, use Amiga slides */ 364 #define IT_OLD_EFFECTS 16 365 #define IT_COMPATIBLE_GXX 32 366 367 /* Make sure IT_WAS_AN_XM and IT_WAS_A_MOD aren't set accidentally */ 368 #define IT_REAL_FLAGS 63 369 370 #define IT_WAS_AN_XM 64 /* Set for both XMs and MODs */ 371 #define IT_WAS_A_MOD 128 372 373 #define IT_ORDER_END 255 374 #define IT_ORDER_SKIP 254 375 376 struct DUMB_IT_SIGDATA 377 { 378 unsigned char name[29]; 379 380 unsigned char *song_message; 381 382 int n_orders; 383 int n_instruments; 384 int n_samples; 385 int n_patterns; 386 387 int flags; 388 389 int global_volume; 390 int mixing_volume; 391 int speed; 392 int tempo; 393 int pan_separation; 394 395 unsigned char channel_pan[DUMB_IT_N_CHANNELS]; 396 unsigned char channel_volume[DUMB_IT_N_CHANNELS]; 397 398 unsigned char *order; 399 unsigned char restart_position; /* for XM compatiblity */ 400 401 IT_INSTRUMENT *instrument; 402 IT_SAMPLE *sample; 403 IT_PATTERN *pattern; 404 405 IT_MIDI *midi; 406 407 IT_CHECKPOINT *checkpoint; 408 }; 409 410 411 412 struct IT_PLAYING_ENVELOPE 413 { 414 int next_node; 415 int tick; 416 int value; 417 }; 418 419 420 421 #define IT_PLAYING_BACKGROUND 1 422 #define IT_PLAYING_SUSTAINOFF 2 423 #define IT_PLAYING_FADING 4 424 #define IT_PLAYING_DEAD 8 425 426 struct IT_PLAYING 427 { 428 int flags; 429 430 IT_CHANNEL *channel; 431 IT_SAMPLE *sample; 432 IT_INSTRUMENT *instrument; 433 IT_INSTRUMENT *env_instrument; 434 435 unsigned short sampnum; 436 unsigned char instnum; 437 438 unsigned char channel_volume; 439 440 unsigned char volume; 441 unsigned short pan; 442 443 unsigned char note; 444 445 unsigned char filter_cutoff; 446 unsigned char filter_resonance; 447 448 unsigned short true_filter_cutoff; /* These incorporate the filter envelope, and will not */ 449 unsigned char true_filter_resonance; /* be changed if they would be set to 127<<8 and 0. */ 450 451 unsigned char vibrato_speed; 452 unsigned char vibrato_depth; 453 unsigned char vibrato_n; /* May be specified twice: volpan & effect. */ 454 unsigned char vibrato_time; 455 456 unsigned char tremolo_speed; 457 unsigned char tremolo_depth; 458 unsigned char tremolo_time; 459 460 unsigned char sample_vibrato_time; 461 int sample_vibrato_depth; /* Starts at rate?0:depth, increases by rate */ 462 463 int slide; 464 float delta; 465 466 IT_PLAYING_ENVELOPE volume_envelope; 467 IT_PLAYING_ENVELOPE pan_envelope; 468 IT_PLAYING_ENVELOPE pitch_envelope; 469 470 int fadeoutcount; 471 472 IT_FILTER_STATE filter_state[2]; /* Left and right */ 473 474 DUMB_RESAMPLER resampler; 475 476 /* time_lost is used to emulate Impulse Tracker's sample looping 477 * characteristics. When time_lost is added to pos, the result represents 478 * the position in the theoretical version of the sample where all loops 479 * have been expanded. If this is stored, the resampling helpers will 480 * safely convert it for use with new loop boundaries. The situation is 481 * slightly more complicated if dir == -1 when the change takes place; we 482 * must reflect pos off the loop end point and set dir to 1 before 483 * proceeding. 484 */ 485 long time_lost; 486 }; 487 488 489 490 #define IT_CHANNEL_MUTED 1 491 492 struct IT_CHANNEL 493 { 494 int flags; 495 496 unsigned char volume; 497 signed char volslide; 498 signed char xm_volslide; 499 signed char panslide; 500 501 /* xm_volslide is used for volume slides done in the volume column in an 502 * XM file, since it seems the volume column slide is applied first, 503 * followed by clamping, followed by the effects column slide. IT does 504 * not exhibit this behaviour, so xm_volslide is maintained at zero. 505 */ 506 507 unsigned char pan; 508 unsigned short truepan; 509 510 unsigned char channelvolume; 511 signed char channelvolslide; 512 513 unsigned char instrument; 514 unsigned char note; 515 516 unsigned char SFmacro; 517 518 unsigned char filter_cutoff; 519 unsigned char filter_resonance; 520 521 unsigned char key_off_count; 522 unsigned char note_cut_count; 523 unsigned char note_delay_count; 524 IT_ENTRY *note_delay_entry; 525 526 int arpeggio; 527 unsigned char retrig; 528 unsigned char xm_retrig; 529 int retrig_tick; 530 531 unsigned char tremor; 532 unsigned char tremor_time; /* Bit 6 set if note on; bit 7 set if tremor active. */ 533 534 int portamento; 535 int toneporta; 536 unsigned char destnote; 537 538 /** WARNING - for neatness, should one or both of these be in the IT_PLAYING struct? */ 539 unsigned short sample; 540 unsigned char truenote; 541 542 unsigned char midi_state; 543 544 signed char lastvolslide; 545 unsigned char lastDKL; 546 unsigned char lastEF; /* Doubles as last portamento up for XM files */ 547 unsigned char lastG; 548 unsigned char lastHspeed; 549 unsigned char lastHdepth; 550 unsigned char lastRspeed; 551 unsigned char lastRdepth; 552 unsigned char lastI; 553 unsigned char lastJ; /* Doubles as last portamento down for XM files */ 554 unsigned char lastN; 555 unsigned char lastO; 556 unsigned char high_offset; 557 unsigned char lastP; 558 unsigned char lastQ; 559 unsigned char lastS; 560 unsigned char pat_loop_row; 561 unsigned char pat_loop_count; 562 unsigned char pat_loop_end_row; /* Used to catch infinite pattern loops */ 563 unsigned char lastW; 564 565 unsigned char xm_lastE1; 566 unsigned char xm_lastE2; 567 unsigned char xm_lastEA; 568 unsigned char xm_lastEB; 569 unsigned char xm_lastX1; 570 unsigned char xm_lastX2; 571 572 IT_PLAYING *playing; 573 }; 574 575 576 577 struct DUMB_IT_SIGRENDERER 578 { 579 DUMB_IT_SIGDATA *sigdata; 580 581 int n_channels; 582 583 unsigned char globalvolume; 584 signed char globalvolslide; 585 586 unsigned char tempo; 587 signed char temposlide; 588 589 IT_CHANNEL channel[DUMB_IT_N_CHANNELS]; 590 591 IT_PLAYING *playing[DUMB_IT_N_NNA_CHANNELS]; 592 593 int tick; 594 int speed; 595 int rowcount; 596 597 int order; /* Set to -1 if the song is terminated by a callback. */ 598 int row; 599 int processorder; 600 int processrow; 601 int breakrow; 602 int pat_loop_row; 603 604 int n_rows; 605 606 IT_ENTRY *entry_start; 607 IT_ENTRY *entry; 608 IT_ENTRY *entry_end; 609 610 long time_left; /* Time before the next tick is processed */ 611 int sub_time_left; 612 613 DUMB_CLICK_REMOVER **click_remover; 614 615 IT_CALLBACKS *callbacks; 616 }; 617 618 619 620 struct IT_CHECKPOINT 621 { 622 IT_CHECKPOINT *next; 623 long time; 624 DUMB_IT_SIGRENDERER *sigrenderer; 625 }; 626 627 628 629 struct IT_CALLBACKS 630 { 631 int (*loop)(void *data); 632 void *loop_data; 633 /* Return 1 to prevent looping; the music will terminate abruptly. If you 634 * want to make the music stop but allow samples to fade (beware, as they 635 * might not fade at all!), use dumb_it_sr_set_speed() and set the speed 636 * to 0. Note that xm_speed_zero() will not be called if you set the 637 * speed manually, and also that this will work for IT and S3M files even 638 * though the music can't stop in this way by itself. 639 */ 640 641 int (*xm_speed_zero)(void *data); 642 void *xm_speed_zero_data; 643 /* Return 1 to terminate the mod, without letting samples fade. */ 644 645 int (*midi)(void *data, int channel, unsigned char byte); 646 void *midi_data; 647 /* Return 1 to prevent DUMB from subsequently interpreting the MIDI bytes 648 * itself. In other words, return 1 if the Zxx macros in an IT file are 649 * controlling filters and shouldn't be. 650 */ 651 }; 652 653 654 655 void _dumb_it_end_sigrenderer(sigrenderer_t *sigrenderer); 656 void _dumb_it_unload_sigdata(sigdata_t *vsigdata); 657 658 extern DUH_SIGTYPE_DESC _dumb_sigtype_it; 659 660 661 662 #define XM_APPREGIO 0 663 #define XM_PORTAMENTO_UP 1 664 #define XM_PORTAMENTO_DOWN 2 665 #define XM_TONE_PORTAMENTO 3 666 #define XM_VIBRATO 4 667 #define XM_VOLSLIDE_TONEPORTA 5 668 #define XM_VOLSLIDE_VIBRATO 6 669 #define XM_TREMOLO 7 670 #define XM_SET_PANNING 8 671 #define XM_SAMPLE_OFFSET 9 672 #define XM_VOLUME_SLIDE 10 /* A */ 673 #define XM_POSITION_JUMP 11 /* B */ 674 #define XM_SET_CHANNEL_VOLUME 12 /* C */ 675 #define XM_PATTERN_BREAK 13 /* D */ 676 #define XM_E 14 /* E */ 677 #define XM_SET_TEMPO_BPM 15 /* F */ 678 #define XM_SET_GLOBAL_VOLUME 16 /* G */ 679 #define XM_GLOBAL_VOLUME_SLIDE 17 /* H */ 680 #define XM_KEY_OFF 20 /* K (undocumented) */ 681 #define XM_SET_ENVELOPE_POSITION 21 /* L */ 682 #define XM_PANNING_SLIDE 25 /* P */ 683 #define XM_MULTI_RETRIG 27 /* R */ 684 #define XM_TREMOR 29 /* T */ 685 #define XM_X 33 /* X */ 686 #define XM_N_EFFECTS (10+26) 687 688 #define XM_E_SET_FILTER 0x0 689 #define XM_E_FINE_PORTA_UP 0x1 690 #define XM_E_FINE_PORTA_DOWN 0x2 691 #define XM_E_SET_GLISSANDO_CONTROL 0x3 692 #define XM_E_SET_VIBRATO_CONTROL 0x4 693 #define XM_E_SET_FINETUNE 0x5 694 #define XM_E_SET_LOOP 0x6 695 #define XM_E_SET_TREMOLO_CONTROL 0x7 696 #define XM_E_RETRIG_NOTE 0x9 697 #define XM_E_FINE_VOLSLIDE_UP 0xA 698 #define XM_E_FINE_VOLSLIDE_DOWN 0xB 699 #define XM_E_NOTE_CUT 0xC 700 #define XM_E_NOTE_DELAY 0xD 701 #define XM_E_PATTERN_DELAY 0xE 702 703 #define XM_X_EXTRAFINE_PORTA_UP 1 704 #define XM_X_EXTRAFINE_PORTA_DOWN 2 705 706 /* To make my life a bit simpler during conversion, effect E:xy is converted 707 * to effect number EBASE+x:y. The same applies to effect X, and IT's S. That 708 * way, these effects can be manipulated like regular effects. 709 */ 710 #define EBASE (XM_N_EFFECTS) 711 #define XBASE (EBASE+16) 712 #define SBASE (IT_N_EFFECTS) 713 714 #define EFFECT_VALUE(x, y) (((x)<<4)|(y)) 715 #define HIGH(v) ((v)>>4) 716 #define LOW(v) ((v)&0x0F) 717 #define SET_HIGH(v, x) v = (((x)<<4)|((v)&0x0F)) 718 #define SET_LOW(v, y) v = (((v)&0xF0)|(y)) 719 #define BCD_TO_NORMAL(v) (HIGH(v)*10+LOW(v)) 720 721 722 723 #if 0 724 unsigned char **_dumb_malloc2(int w, int h); 725 void _dumb_free2(unsigned char **line); 726 #endif 727 728 void _dumb_it_xm_convert_effect(int effect, int value, IT_ENTRY *entry); 729 int _dumb_it_fix_invalid_orders(DUMB_IT_SIGDATA *sigdata); 730 731 732 733 #endif /* INTERNAL_IT_H */ 734