event.c 647 B

12345678910111213141516171819202122232425262728293031
  1. #include "event.h"
  2. void set_note(TrackerSongPatternStep* step, uint8_t note)
  3. {
  4. step->note &= 0x80;
  5. step->note |= (note & 0x7f);
  6. }
  7. void set_instrument(TrackerSongPatternStep* step, uint8_t inst)
  8. {
  9. step->note &= 0x7f;
  10. step->inst_vol &= 0x0f;
  11. step->note |= ((inst & 0x10) << 3);
  12. step->inst_vol |= ((inst & 0xf) << 4);
  13. }
  14. void set_volume(TrackerSongPatternStep* step, uint8_t vol)
  15. {
  16. step->command &= 0x7fff;
  17. step->inst_vol &= 0xf0;
  18. step->command |= ((vol & 0x10) << 11);
  19. step->inst_vol |= (vol & 0xf);
  20. }
  21. void set_command(TrackerSongPatternStep* step, uint16_t command)
  22. {
  23. step->command &= 0x8000;
  24. step->command |= command & (0x7fff);
  25. }