2D Run-and-gun shooter inspired by One Man's Doomsday, Counter-Strike, and Metal Slug.
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 
 
 

97 satır
1.6 KiB

  1. #ifndef IZ_MIDI_H
  2. #define IZ_MIDI_H
  3. #include <string.h>
  4. #include <portmidi.h>
  5. #include <midi-utils.h>
  6. #include <ini-config.h>
  7. #include "../../stdinc/IZ_string.h"
  8. #include "../../stdinc/IZ_stdlib.h"
  9. #include "IZ_action.h"
  10. #define MIDI_EVENT_BUFFER_SIZE 1024
  11. typedef struct {
  12. PmDeviceID device_id;
  13. u8 channel;
  14. u8 control_mapping[IZ_CONTROLS];
  15. } IZ_MIDIInputConfig;
  16. typedef struct {
  17. IZ_MIDIInputConfig config;
  18. const PmDeviceInfo* device_info;
  19. PmStream* stream;
  20. PmEvent event_buffer[MIDI_EVENT_BUFFER_SIZE];
  21. i32 midi_events_count;
  22. } IZ_MIDIInputState;
  23. static const IZ_MIDIInputState IZ_MIDI_INPUT_DEFAULT_STATE[IZ_PLAYERS] = {
  24. {
  25. .config = {
  26. .control_mapping = {
  27. 70,
  28. 72,
  29. 71,
  30. 69,
  31. 65,
  32. 64,
  33. 48,
  34. 49,
  35. 50,
  36. 51,
  37. 52,
  38. 53,
  39. 54,
  40. 55,
  41. 56,
  42. 57,
  43. },
  44. .device_id = 0,
  45. .channel = 0,
  46. },
  47. .event_buffer = {},
  48. .stream = NULL,
  49. .device_info = NULL,
  50. },
  51. #if IZ_PLAYERS > 1
  52. {
  53. .config = {
  54. .control_mapping = {
  55. 70,
  56. 72,
  57. 71,
  58. 69,
  59. 65,
  60. 64,
  61. 48,
  62. 49,
  63. 50,
  64. 51,
  65. 52,
  66. 53,
  67. 54,
  68. 55,
  69. 56,
  70. 57,
  71. },
  72. .device_id = 1,
  73. .channel = 1,
  74. },
  75. .event_buffer = {},
  76. .stream = NULL,
  77. .device_info = NULL,
  78. },
  79. #endif
  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