bassasio.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. /*
  2. BASSASIO 1.4 C/C++ header file
  3. Copyright (c) 2005-2023 Un4seen Developments Ltd.
  4. See the BASSASIO.CHM file for more detailed documentation
  5. */
  6. #ifndef BASSASIO_H
  7. #define BASSASIO_H
  8. #ifdef _WIN32
  9. #include <wtypes.h>
  10. #else
  11. typedef void *GUID;
  12. typedef void *HWND;
  13. #endif
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. #ifndef BASSASIODEF
  18. #define BASSASIODEF(f) WINAPI f
  19. #endif
  20. #define BASSASIOVERSION 0x104 // API version
  21. // error codes returned by BASS_ASIO_ErrorGetCode
  22. #define BASS_OK 0 // all is OK
  23. #define BASS_ERROR_FILEOPEN 2 // can't open the file
  24. #define BASS_ERROR_DRIVER 3 // can't find a free/valid driver
  25. #define BASS_ERROR_HANDLE 5 // invalid handle
  26. #define BASS_ERROR_FORMAT 6 // unsupported sample format
  27. #define BASS_ERROR_INIT 8 // BASS_ASIO_Init has not been successfully called
  28. #define BASS_ERROR_START 9 // BASS_ASIO_Start has/hasn't been called
  29. #define BASS_ERROR_ALREADY 14 // already initialized/started
  30. #define BASS_ERROR_NOCHAN 18 // no channels are enabled
  31. #define BASS_ERROR_ILLPARAM 20 // an illegal parameter was specified
  32. #define BASS_ERROR_DEVICE 23 // illegal device number
  33. #define BASS_ERROR_NOTAVAIL 37 // not available
  34. #define BASS_ERROR_UNKNOWN -1 // some other mystery error
  35. // BASS_ASIO_Init flags
  36. #define BASS_ASIO_THREAD 1 // host driver in dedicated thread
  37. #define BASS_ASIO_JOINORDER 2 // order joined channels by when they were joined
  38. // device info structure
  39. typedef struct {
  40. const char *name; // description
  41. const char *driver; // driver
  42. } BASS_ASIO_DEVICEINFO;
  43. typedef struct {
  44. char name[32]; // driver name
  45. DWORD version; // driver version
  46. DWORD inputs; // number of inputs
  47. DWORD outputs; // number of outputs
  48. DWORD bufmin; // minimum buffer length
  49. DWORD bufmax; // maximum buffer length
  50. DWORD bufpref; // preferred/default buffer length
  51. int bufgran; // buffer length granularity
  52. DWORD initflags; // BASS_ASIO_Init "flags" parameter
  53. } BASS_ASIO_INFO;
  54. typedef struct {
  55. DWORD group;
  56. DWORD format; // sample format (BASS_ASIO_FORMAT_xxx)
  57. char name[32]; // channel name
  58. } BASS_ASIO_CHANNELINFO;
  59. // sample formats
  60. #define BASS_ASIO_FORMAT_16BIT 16 // 16-bit integer
  61. #define BASS_ASIO_FORMAT_24BIT 17 // 24-bit integer
  62. #define BASS_ASIO_FORMAT_32BIT 18 // 32-bit integer
  63. #define BASS_ASIO_FORMAT_FLOAT 19 // 32-bit floating-point
  64. #define BASS_ASIO_FORMAT_32BIT16 24 // 32-bit integer with 16-bit alignment
  65. #define BASS_ASIO_FORMAT_32BIT18 25 // 32-bit integer with 18-bit alignment
  66. #define BASS_ASIO_FORMAT_32BIT20 26 // 32-bit integer with 20-bit alignment
  67. #define BASS_ASIO_FORMAT_32BIT24 27 // 32-bit integer with 24-bit alignment
  68. #define BASS_ASIO_FORMAT_DSD_LSB 32 // DSD (LSB 1st)
  69. #define BASS_ASIO_FORMAT_DSD_MSB 33 // DSD (MSB 1st)
  70. #define BASS_ASIO_FORMAT_DITHER 0x100 // flag: apply dither when converting from floating-point to integer
  71. // BASS_ASIO_ChannelReset flags
  72. #define BASS_ASIO_RESET_ENABLE 1 // disable channel
  73. #define BASS_ASIO_RESET_JOIN 2 // unjoin channel
  74. #define BASS_ASIO_RESET_PAUSE 4 // unpause channel
  75. #define BASS_ASIO_RESET_FORMAT 8 // reset sample format to native format
  76. #define BASS_ASIO_RESET_RATE 16 // reset sample rate to device rate
  77. #define BASS_ASIO_RESET_VOLUME 32 // reset volume to 1.0
  78. #define BASS_ASIO_RESET_JOINED 0x10000 // apply to joined channels too
  79. // BASS_ASIO_ChannelIsActive return values
  80. #define BASS_ASIO_ACTIVE_DISABLED 0
  81. #define BASS_ASIO_ACTIVE_ENABLED 1
  82. #define BASS_ASIO_ACTIVE_PAUSED 2
  83. typedef DWORD(CALLBACK ASIOPROC)(BOOL input, DWORD channel, void *buffer, DWORD length, void *user);
  84. /* ASIO channel callback function.
  85. input : Input? else output
  86. channel: Channel number
  87. buffer : Buffer containing the sample data
  88. length : Number of bytes
  89. user : The 'user' parameter given when calling BASS_ASIO_ChannelEnable
  90. RETURN : The number of bytes written (ignored with input channels) */
  91. typedef void(CALLBACK ASIONOTIFYPROC)(DWORD notify, void *user);
  92. /* Driver notification callback function.
  93. notify : The notification (BASS_ASIO_NOTIFY_xxx)
  94. user : The 'user' parameter given when calling BASS_ASIO_SetNotify */
  95. // driver notifications
  96. #define BASS_ASIO_NOTIFY_RATE 1 // sample rate change
  97. #define BASS_ASIO_NOTIFY_RESET 2 // reset (reinitialization) request
  98. // BASS_ASIO_ChannelGetLevel flags
  99. #define BASS_ASIO_LEVEL_RMS 0x1000000
  100. DWORD BASSASIODEF(BASS_ASIO_GetVersion)();
  101. BOOL BASSASIODEF(BASS_ASIO_SetUnicode)(BOOL unicode);
  102. DWORD BASSASIODEF(BASS_ASIO_ErrorGetCode)();
  103. BOOL BASSASIODEF(BASS_ASIO_GetDeviceInfo)(DWORD device, BASS_ASIO_DEVICEINFO *info);
  104. DWORD BASSASIODEF(BASS_ASIO_AddDevice)(const GUID *clsid, const char *driver, const char *name);
  105. BOOL BASSASIODEF(BASS_ASIO_SetDevice)(DWORD device);
  106. DWORD BASSASIODEF(BASS_ASIO_GetDevice)();
  107. BOOL BASSASIODEF(BASS_ASIO_Init)(int device, DWORD flags);
  108. BOOL BASSASIODEF(BASS_ASIO_Free)();
  109. BOOL BASSASIODEF(BASS_ASIO_Lock)(BOOL lock);
  110. BOOL BASSASIODEF(BASS_ASIO_SetNotify)(ASIONOTIFYPROC *proc, void *user);
  111. BOOL BASSASIODEF(BASS_ASIO_ControlPanel)();
  112. BOOL BASSASIODEF(BASS_ASIO_GetInfo)(BASS_ASIO_INFO *info);
  113. BOOL BASSASIODEF(BASS_ASIO_CheckRate)(double rate);
  114. BOOL BASSASIODEF(BASS_ASIO_SetRate)(double rate);
  115. double BASSASIODEF(BASS_ASIO_GetRate)();
  116. BOOL BASSASIODEF(BASS_ASIO_Start)(DWORD buflen, DWORD threads);
  117. BOOL BASSASIODEF(BASS_ASIO_Stop)();
  118. BOOL BASSASIODEF(BASS_ASIO_IsStarted)();
  119. DWORD BASSASIODEF(BASS_ASIO_GetLatency)(BOOL input);
  120. float BASSASIODEF(BASS_ASIO_GetCPU)();
  121. BOOL BASSASIODEF(BASS_ASIO_Monitor)(int input, DWORD output, DWORD gain, DWORD state, DWORD pan);
  122. BOOL BASSASIODEF(BASS_ASIO_SetDSD)(BOOL dsd);
  123. BOOL BASSASIODEF(BASS_ASIO_Future)(DWORD selector, void *param);
  124. BOOL BASSASIODEF(BASS_ASIO_ChannelGetInfo)(BOOL input, DWORD channel, BASS_ASIO_CHANNELINFO *info);
  125. BOOL BASSASIODEF(BASS_ASIO_ChannelReset)(BOOL input, int channel, DWORD flags);
  126. BOOL BASSASIODEF(BASS_ASIO_ChannelEnable)(BOOL input, DWORD channel, ASIOPROC *proc, void *user);
  127. BOOL BASSASIODEF(BASS_ASIO_ChannelEnableMirror)(DWORD channel, BOOL input2, DWORD channel2);
  128. BOOL BASSASIODEF(BASS_ASIO_ChannelEnableBASS)(BOOL input, DWORD channel, DWORD handle, BOOL join);
  129. BOOL BASSASIODEF(BASS_ASIO_ChannelJoin)(BOOL input, DWORD channel, int channel2);
  130. BOOL BASSASIODEF(BASS_ASIO_ChannelPause)(BOOL input, DWORD channel);
  131. DWORD BASSASIODEF(BASS_ASIO_ChannelIsActive)(BOOL input, DWORD channel);
  132. BOOL BASSASIODEF(BASS_ASIO_ChannelSetFormat)(BOOL input, DWORD channel, DWORD format);
  133. DWORD BASSASIODEF(BASS_ASIO_ChannelGetFormat)(BOOL input, DWORD channel);
  134. BOOL BASSASIODEF(BASS_ASIO_ChannelSetRate)(BOOL input, DWORD channel, double rate);
  135. double BASSASIODEF(BASS_ASIO_ChannelGetRate)(BOOL input, DWORD channel);
  136. BOOL BASSASIODEF(BASS_ASIO_ChannelSetVolume)(BOOL input, int channel, float volume);
  137. float BASSASIODEF(BASS_ASIO_ChannelGetVolume)(BOOL input, int channel);
  138. float BASSASIODEF(BASS_ASIO_ChannelGetLevel)(BOOL input, DWORD channel);
  139. #ifdef __cplusplus
  140. }
  141. #endif
  142. #endif