2D Run-and-gun shooter inspired by One Man's Doomsday, Counter-Strike, and Metal Slug.
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.
 
 
 
 
 
 

98 lines
1.6 KiB

  1. #ifndef IZ_MIDI_H
  2. #define IZ_MIDI_H
  3. #include <SDL_stdinc.h>
  4. #include <string.h>
  5. #ifndef PORTMIDI_INCLUDED
  6. #define PORTMIDI_INCLUDED
  7. #include <portmidi.h>
  8. #endif
  9. #include <minIni.h>
  10. #include "IZ_action.h"
  11. #include "../util/IZ_midi.h"
  12. #define MIDI_EVENT_BUFFER_SIZE 1024
  13. typedef struct {
  14. PmDeviceID device_id;
  15. u8 channel;
  16. IZ_MIDINote control_mapping[CONTROLS];
  17. } IZ_MIDIInputConfig;
  18. typedef struct {
  19. IZ_MIDIInputConfig config;
  20. const PmDeviceInfo* device_info;
  21. PmStream* stream;
  22. PmEvent event_buffer[MIDI_EVENT_BUFFER_SIZE];
  23. i32 midi_events_count;
  24. } IZ_MIDIInputState;
  25. static const IZ_MIDIInputState IZ_MIDI_INPUT_DEFAULT_STATE[IZ_PLAYERS] = {
  26. {
  27. .config = {
  28. .control_mapping = {
  29. 70,
  30. 72,
  31. 71,
  32. 69,
  33. 65,
  34. 64,
  35. 48,
  36. 49,
  37. 50,
  38. 51,
  39. 52,
  40. 53,
  41. 54,
  42. 55,
  43. 56,
  44. 57,
  45. },
  46. .device_id = 0,
  47. .channel = 0,
  48. },
  49. .event_buffer = {},
  50. .stream = NULL,
  51. .device_info = NULL,
  52. },
  53. {
  54. .config = {
  55. .control_mapping = {
  56. 70,
  57. 72,
  58. 71,
  59. 69,
  60. 65,
  61. 64,
  62. 48,
  63. 49,
  64. 50,
  65. 51,
  66. 52,
  67. 53,
  68. 54,
  69. 55,
  70. 56,
  71. 57,
  72. },
  73. .device_id = 1,
  74. .channel = 1,
  75. },
  76. .event_buffer = {},
  77. .stream = NULL,
  78. .device_info = NULL,
  79. },
  80. };
  81. IZ_ProcedureResult IZ_MIDIInputSaveConfig(IZ_MIDIInputState(*)[IZ_PLAYERS], const char*);
  82. void IZ_MIDIInputHandleEvents(IZ_MIDIInputState(*)[IZ_PLAYERS], IZ_Action(*)[IZ_PLAYERS], PmEvent);
  83. IZ_ProcedureResult IZ_MIDIInputInitialize(IZ_MIDIInputState(*)[IZ_PLAYERS], const char*, u8, const char*[]);
  84. void IZ_MIDIInputTeardown(IZ_MIDIInputState(*)[IZ_PLAYERS]);
  85. #endif