Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @brief Handles voice key-off triggered by gate
- * @param part Target part
- */
- static inline void
- koffCheck( SndDrvPart *part )
- {
- // If gate already triggered, skip
- if ( part->ngo == 0 ) return;
- if ( --part->ngo == 0 || part->ngc == 2 )
- {
- u8 *adx = part->add; // Local copy of part->add
- u8 ptx = part->ptc; // Local copy of part->ptc
- while ( 1 )
- {
- u8 cmd = *adx;
- // Check for pattern end
- if ( cmd == 0x00 )
- {
- // If end of pattern, trigger key-off
- if ( ptx == 0 ) break;
- ptx--;
- if ( ptx == 0 ) adx = part->adt;
- else adx = part->adp;
- continue;
- }
- // If not end of pattern, try to find a note or command
- else if ( cmd < NOTE_BASE )
- {
- int i;
- for ( i = 0; i < 128; i++ )
- {
- cmd = *( adx + i );
- // If not note params, break
- if ( cmd >= note_c00 ) break;
- }
- // If nothing was found, just trigger key-off
- if ( i == 128 ) break;
- }
- // If tie note, skip key-off
- if ( cmd == note_tie ) return;
- // If command is to play pattern, set adx to start of pattern
- else if ( cmd == PATX + CMD_BASE )
- adx = gft + read16( *++adx );
- // If any other command, skip past it
- else if ( cmd >= CMD_BASE )
- adx += spfp[ cmd - CMD_BASE ];
- // If anything else, trigger key-off
- else break;
- }
- // Trigger key-off for voice
- dsp->kof |= keyd;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement