native_midi.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. /* -*- mode: c; tab-width: 4; c-basic-offset: 4; c-file-style: "linux" -*- */
  2. //
  3. // Copyright (c) 2009-2011, Wei Mingzhi <whistler_wmz@users.sf.net>.
  4. // Copyright (c) 2011-2017, SDLPAL development team.
  5. // All rights reserved.
  6. //
  7. // This file is part of SDLPAL.
  8. //
  9. // SDLPAL is free software: you can redistribute it and/or modify
  10. // it under the terms of the GNU General Public License as published by
  11. // the Free Software Foundation, either version 3 of the License, or
  12. // (at your option) any later version.
  13. //
  14. // This program is distributed in the hope that it will be useful,
  15. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. // GNU General Public License for more details.
  18. //
  19. // You should have received a copy of the GNU General Public License
  20. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. //
  22. // native_midi.h: Header of native MIDI player for SDLPal.
  23. // @Author: Lou Yihua, 2017
  24. //
  25. #ifndef _NATIVE_MIDI_H_
  26. #define _NATIVE_MIDI_H_
  27. #include <SDL_rwops.h>
  28. typedef struct _NativeMidiSong NativeMidiSong;
  29. #ifdef __cplusplus
  30. extern "C"
  31. {
  32. #endif
  33. /*++
  34. Purpose:
  35. Check whether there is an available MIDI player.
  36. Parameters:
  37. None.
  38. Return value:
  39. Returns 1 for success and 0 for failure.
  40. --*/
  41. int native_midi_detect();
  42. /*++
  43. Purpose:
  44. Load the MIDI song from given file.
  45. Parameters:
  46. [IN] midifile - the MIDI file name.
  47. Return value:
  48. A NativeMidiSong object on success, NULL on failure.
  49. --*/
  50. NativeMidiSong *native_midi_loadsong(const char *midifile);
  51. /*++
  52. Purpose:
  53. Load the MIDI song from SDL_RWops stream.
  54. Parameters:
  55. [IN] rw - pointer to the SDL_RWops stream.
  56. Return value:
  57. A NativeMidiSong object on success, NULL on failure.
  58. --*/
  59. NativeMidiSong *native_midi_loadsong_RW(SDL_RWops *rw);
  60. /*++
  61. Purpose:
  62. Free a NativeMidiSong object returned from native_midi_loadsong_*.
  63. Parameters:
  64. [IN] song - the NativeMidiSong object.
  65. Return value:
  66. None.
  67. --*/
  68. void native_midi_freesong(NativeMidiSong *song);
  69. /*++
  70. Purpose:
  71. Start playing the MIDI.
  72. Parameters:
  73. [IN] song - the NativeMidiSong object.
  74. [IN] looping - whether the play should be automatically looped.
  75. Return value:
  76. None.
  77. --*/
  78. void native_midi_start(NativeMidiSong *song, int looping);
  79. /*++
  80. Purpose:
  81. Stop playing the MIDI.
  82. Parameters:
  83. [IN] song - the NativeMidiSong object.
  84. Return value:
  85. None.
  86. --*/
  87. void native_midi_stop(NativeMidiSong *song);
  88. /*++
  89. Purpose:
  90. Check whether the MIDI is now playing.
  91. Parameters:
  92. [IN] song - the NativeMidiSong object.
  93. Return value:
  94. Returns 1 if MIDI is now playing, and 0 otherwise.
  95. --*/
  96. int native_midi_active(NativeMidiSong *song);
  97. /*++
  98. Purpose:
  99. Set the volume for the MIDI playing.
  100. Parameters:
  101. [IN] song - the NativeMidiSong object.
  102. Return value:
  103. None.
  104. --*/
  105. void native_midi_setvolume(NativeMidiSong *song, int volume);
  106. /*++
  107. Purpose:
  108. Get the last error if any.
  109. Parameters:
  110. [IN] song - the NativeMidiSong object.
  111. Return value:
  112. None.
  113. --*/
  114. const char *native_midi_error(NativeMidiSong *song);
  115. #ifdef __cplusplus
  116. }
  117. #endif
  118. #endif /* _NATIVE_MIDI_H_ */