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.
 
 
 
 
 
 

70 lines
1.7 KiB

  1. #ifndef PORTMIDI_MOCK_H
  2. #define PORTMIDI_MOCK_H
  3. #define PORTMIDI_INCLUDED
  4. #include "../src/packages/common/IZ_common.h"
  5. typedef i32 PmDeviceID;
  6. typedef void PortMidiStream;
  7. typedef i32 PmTimestamp;
  8. typedef PmTimestamp (*PmTimeProcPtr)(void *time_info);
  9. typedef i32 PmMessage;
  10. typedef struct {
  11. PmMessage message;
  12. PmTimestamp timestamp;
  13. } PmEvent;
  14. typedef struct {
  15. int structVersion; /**< @brief this internal structure version */
  16. const char *interf; /**< @brief underlying MIDI API, e.g.
  17. "MMSystem" or "DirectX" */
  18. char *name; /**< @brief device name, e.g. "USB MidiSport 1x1" */
  19. int input; /**< @brief true iff input is available */
  20. int output; /**< @brief true iff output is available */
  21. int opened; /**< @brief used by generic PortMidi for error checking */
  22. int is_virtual; /**< @brief true iff this is/was a virtual device */
  23. } PmDeviceInfo;
  24. #define PmStream PortMidiStream
  25. static PmDeviceInfo MOCK_DEVICE_INFO = {
  26. .output = 1,
  27. .input = 1,
  28. .name = "Mock MIDI Device",
  29. .interf = "MMSystem",
  30. .is_virtual = 0,
  31. .opened = 0,
  32. .structVersion = 1,
  33. };
  34. mock(Pm_Initialize) i32 Pm_Initialize(void) {
  35. mock_return(Pm_Initialize) 0;
  36. }
  37. mock(Pm_GetDeviceInfo) const PmDeviceInfo* Pm_GetDeviceInfo(PmDeviceID id) {
  38. mock_return(Pm_GetDeviceInfo) &MOCK_DEVICE_INFO;
  39. }
  40. mock(Pm_OpenInput) i32 Pm_OpenInput(
  41. PortMidiStream** stream,
  42. PmDeviceID inputDevice,
  43. void* inputDriverInfo,
  44. i32 bufferSize,
  45. PmTimeProcPtr time_proc,
  46. void* time_info
  47. ) {
  48. mock_return(Pm_OpenInput) 0;
  49. }
  50. mock(Pm_Close) i32 Pm_Close(PortMidiStream* stream) {
  51. mock_return(Pm_Close) 0;
  52. }
  53. #define MOCK_OPEN_MIDI_DEVICES 1
  54. mock(Pm_CountDevices) i32 Pm_CountDevices(void) {
  55. mock_return(Pm_CountDevices) MOCK_OPEN_MIDI_DEVICES;
  56. }
  57. #endif