GameBoy (Color) port of the GTA San Andreas arcade game Duality
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

sound.h 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. * sound.h
  3. * Duality
  4. *
  5. * Copyright (C) 2025 Thomas Buck <thomas@xythobuz.de>
  6. *
  7. * This program is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation, either version 3 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * See <http://www.gnu.org/licenses/>.
  18. */
  19. #ifndef __SOUND_H__
  20. #define __SOUND_H__
  21. #include <gbdk/platform.h>
  22. enum notes {
  23. C0 = 0, Cd0, D0, Dd0, E0, F0, Fd0, G0, Gd0, A0, Ad0, B0, // 0 .. 11
  24. C1, Cd1, D1, Dd1, E1, F1, Fd1, G1, Gd1, A1, Ad1, B1, // 12 .. 23
  25. C2, Cd2, D2, Dd2, E2, F2, Fd2, G2, Gd2, A2, Ad2, B2, // 24 .. 35
  26. C3, Cd3, D3, Dd3, E3, F3, Fd3, G3, Gd3, A3, Ad3, B3, // 36 .. 47
  27. C4, Cd4, D4, Dd4, E4, F4, Fd4, G4, Gd4, A4, Ad4, B4, // 48 .. 59
  28. C5, Cd5, D5, Dd5, E5, F5, Fd5, G5, Gd5, A5, Ad5, B5, // 60 .. 71
  29. SILENCE, END, SIL = SILENCE, // 72 .. 73
  30. Db0 = Cd0, Eb0 = Dd0, Ed0 = F0,
  31. Fb0 = E0, Gb0 = Fd0, Ab0 = Gd0, Bb0 = Ad0,
  32. Cb1 = B0, Db1 = Cd1, Eb1 = Dd1, Ed1 = F1,
  33. Fb1 = E1, Gb1 = Fd1, Ab1 = Gd1, Bb1 = Ad1,
  34. Cb2 = B1, Db2 = Cd2, Eb2 = Dd2, Ed2 = F2,
  35. Fb2 = E2, Gb2 = Fd2, Ab2 = Gd2, Bb2 = Ad2,
  36. Cb3 = B2, Db3 = Cd3, Eb3 = Dd3, Ed3 = F3,
  37. Fb3 = E3, Gb3 = Fd3, Ab3 = Gd3, Bb3 = Ad3,
  38. Cb4 = B3, Db4 = Cd4, Eb4 = Dd4, Ed4 = F4,
  39. Fb4 = E4, Gb4 = Fd4, Ab4 = Gd4, Bb4 = Ad4,
  40. Cb5 = B4, Db5 = Cd5, Eb5 = Dd5, Ed5 = F5,
  41. Fb5 = E5, Gb5 = Fd5, Ab5 = Gd5, Bb5 = Ad5,
  42. };
  43. enum drums {
  44. dKick = 0, dSnare,
  45. dSilence,
  46. dKi = dKick, dSn = dSnare,
  47. dSI = dSilence,
  48. dEND,
  49. };
  50. struct music {
  51. enum notes * const notes;
  52. enum drums * const drums;
  53. uint16_t duration;
  54. };
  55. void snd_init(void) BANKED;
  56. void snd_music_off(void) BANKED;
  57. void snd_menu_music(void) BANKED;
  58. void snd_game_music(void) BANKED;
  59. void snd_gameover_music(void) BANKED;
  60. void snd_play(void);
  61. void snd_explode(void) BANKED;
  62. BANKREF_EXTERN(sound)
  63. #endif // __SOUND_H__