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_over.c 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /*
  2. * sound_over.c
  3. * Duality
  4. *
  5. * Copyright (C) 2025 Thomas Buck <thomas@xythobuz.de>
  6. *
  7. * Based on examples from gbdk-2020:
  8. * https://github.com/gbdk-2020/gbdk-2020/blob/develop/gbdk-lib/examples/gb/sound/sound.c
  9. *
  10. * And the docs for the DMG APU:
  11. * https://gbdev.io/pandocs/Audio_Registers.html
  12. *
  13. * This program is free software: you can redistribute it and/or modify
  14. * it under the terms of the GNU General Public License as published by
  15. * the Free Software Foundation, either version 3 of the License, or
  16. * (at your option) any later version.
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU General Public License for more details.
  22. *
  23. * See <http://www.gnu.org/licenses/>.
  24. */
  25. #include "banks.h"
  26. #include "sound_over.h"
  27. BANKREF(sound_over)
  28. const enum notes over_notes[] = {
  29. // fanfare
  30. /*
  31. C3, C3, C3, C3, Ab2, Ab2, Bb2, Bb2,
  32. C3, C3, SIL, Bb2, C3, C3, SIL, SIL,
  33. */
  34. // repeat
  35. Ab4, C5, Ab4, F4, Ab4, Ab4, Ab4, C5,
  36. Ab4, F4, Ab4, Bb4, C5, Bb4, Ab4, F4,
  37. A4, C5, A4, F4, A4, A4, A4, C5,
  38. A4, F4, A4, Bb4, C5, Bb4, A4, F4,
  39. Ab4, C5, Ab4, F4, Ab4, Ab4, Ab4, C5,
  40. Ab4, F4, Ab4, Bb4, C5, Bb4, Ab4, F4,
  41. Ab4, C5, Ab4, E4, Ab4, Ab4, Ab4, C5,
  42. Ab4, E4, Ab4, Bb4, C5, Bb4, Ab4, E4,
  43. Ab4, C5, Ab4, F4, Ab4, Ab4, Ab4, C5,
  44. Ab4, F4, Ab4, Bb4, C5, Bb4, Ab4, F4,
  45. A4, C5, A4, F4, A4, A4, A4, C5,
  46. A4, F4, A4, Bb4, C5, Bb4, A4, F4,
  47. Bb4, Db5, Bb4, Gb4, Bb4, Bb4, Bb4, Db5,
  48. Bb4, Gb4, Bb4, C5, Db5, C5, Bb4, Gb4,
  49. Bb4, Db5, Bb4, Gb4, Bb4, Bb4, Bb4, Db5,
  50. Bb4, Gb4, Bb4, C5, Db5, C5, Bb4, Gb4,
  51. Bb4, D5, Bb4, G4, Bb4, Bb4, Bb4, D5,
  52. Bb4, G4, Bb4, C5, D5, C5, Bb4, G4,
  53. Bb4, D5, Bb4, G4, Bb4, Bb4, Bb4, D5,
  54. Bb4, G4, Bb4, C5, D5, C5, Bb4, G4,
  55. // repeat
  56. Ab4, C5, Ab4, F4, Ab4, Ab4, Ab4, C5,
  57. Ab4, F4, Ab4, Bb4, C5, Bb4, Ab4, F4,
  58. A4, C5, A4, F4, A4, A4, A4, C5,
  59. A4, F4, A4, Bb4, C5, Bb4, A4, F4,
  60. Ab4, C5, Ab4, F4, Ab4, Ab4, Ab4, C5,
  61. Ab4, F4, Ab4, Bb4, C5, Bb4, Ab4, F4,
  62. Ab4, C5, Ab4, E4, Ab4, Ab4, Ab4, C5,
  63. Ab4, E4, Ab4, Bb4, C5, Bb4, Ab4, E4,
  64. Ab4, C5, Ab4, F4, Ab4, Ab4, Ab4, C5,
  65. Ab4, F4, Ab4, Bb4, C5, Bb4, Ab4, F4,
  66. A4, C5, A4, F4, A4, A4, A4, C5,
  67. A4, F4, A4, Bb4, C5, Bb4, A4, F4,
  68. Bb4, Db5, Bb4, Gb4, Bb4, Bb4, Bb4, Db5,
  69. Bb4, Gb4, Bb4, C5, Db5, C5, Bb4, Gb4,
  70. Bb4, Db5, Bb4, Gb4, Bb4, Bb4, Bb4, Db5,
  71. Bb4, Gb4, Bb4, C5, Db5, C5, Bb4, Gb4,
  72. Bb4, D5, Bb4, G4, Bb4, Bb4, Bb4, D5,
  73. Bb4, G4, Bb4, C5, D5, C5, Bb4, G4,
  74. Bb4, Dd5, Bb4, G4, Bb4, Bb4, Bb4, D5,
  75. Bb4, G4, Bb4, C5, D5, C5, Bb4, G4,
  76. // end
  77. SILENCE, SILENCE, SILENCE, SILENCE,
  78. SILENCE, SILENCE, SILENCE, SILENCE,
  79. SILENCE, SILENCE, SILENCE, SILENCE,
  80. SILENCE, SILENCE, SILENCE, SILENCE,
  81. END
  82. };
  83. #define DRUM_LOOP \
  84. dKi, dSI, dSI, dSI, dSI, dSI, dKi, dSI, \
  85. dSn, dSI, dSI, dSI, dKi, dSI, dSI, dSI \
  86. const enum drums over_drums[] = {
  87. DRUM_LOOP,
  88. DRUM_LOOP,
  89. DRUM_LOOP,
  90. DRUM_LOOP,
  91. DRUM_LOOP,
  92. DRUM_LOOP,
  93. DRUM_LOOP,
  94. DRUM_LOOP,
  95. DRUM_LOOP,
  96. DRUM_LOOP,
  97. DRUM_LOOP,
  98. DRUM_LOOP,
  99. DRUM_LOOP,
  100. DRUM_LOOP,
  101. DRUM_LOOP,
  102. DRUM_LOOP,
  103. DRUM_LOOP,
  104. DRUM_LOOP,
  105. DRUM_LOOP,
  106. DRUM_LOOP,
  107. dSI, dSI, dSI, dSI, dSI, dSI, dSI, dSI,
  108. dSI, dSI, dSI, dSI, dSI, dSI, dSI, dSI,
  109. dEND
  110. };
  111. const struct music music_over = {
  112. .notes = over_notes,
  113. .drums = over_drums,
  114. .duration = 120,
  115. };