1
0

basswasapi.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. /*
  2. BASSWASAPI 2.4 C/C++ header file
  3. Copyright (c) 2009-2017 Un4seen Developments Ltd.
  4. See the BASSWASAPI.CHM file for more detailed documentation
  5. */
  6. #ifndef BASSWASAPI_H
  7. #define BASSWASAPI_H
  8. #include "bass.h"
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. #ifndef BASSWASAPIDEF
  13. #define BASSWASAPIDEF(f) WINAPI f
  14. #endif
  15. // Additional error codes returned by BASS_ErrorGetCode
  16. #define BASS_ERROR_WASAPI 5000 // no WASAPI
  17. #define BASS_ERROR_WASAPI_BUFFER 5001 // buffer size is invalid
  18. // Device info structure
  19. typedef struct {
  20. const char *name;
  21. const char *id;
  22. DWORD type;
  23. DWORD flags;
  24. float minperiod;
  25. float defperiod;
  26. DWORD mixfreq;
  27. DWORD mixchans;
  28. } BASS_WASAPI_DEVICEINFO;
  29. typedef struct {
  30. DWORD initflags;
  31. DWORD freq;
  32. DWORD chans;
  33. DWORD format;
  34. DWORD buflen;
  35. float volmax;
  36. float volmin;
  37. float volstep;
  38. } BASS_WASAPI_INFO;
  39. // BASS_WASAPI_DEVICEINFO "type"
  40. #define BASS_WASAPI_TYPE_NETWORKDEVICE 0
  41. #define BASS_WASAPI_TYPE_SPEAKERS 1
  42. #define BASS_WASAPI_TYPE_LINELEVEL 2
  43. #define BASS_WASAPI_TYPE_HEADPHONES 3
  44. #define BASS_WASAPI_TYPE_MICROPHONE 4
  45. #define BASS_WASAPI_TYPE_HEADSET 5
  46. #define BASS_WASAPI_TYPE_HANDSET 6
  47. #define BASS_WASAPI_TYPE_DIGITAL 7
  48. #define BASS_WASAPI_TYPE_SPDIF 8
  49. #define BASS_WASAPI_TYPE_HDMI 9
  50. #define BASS_WASAPI_TYPE_UNKNOWN 10
  51. // BASS_WASAPI_DEVICEINFO flags
  52. #define BASS_DEVICE_ENABLED 1
  53. #define BASS_DEVICE_DEFAULT 2
  54. #define BASS_DEVICE_INIT 4
  55. #define BASS_DEVICE_LOOPBACK 8
  56. #define BASS_DEVICE_INPUT 16
  57. #define BASS_DEVICE_UNPLUGGED 32
  58. #define BASS_DEVICE_DISABLED 64
  59. // BASS_WASAPI_Init flags
  60. #define BASS_WASAPI_EXCLUSIVE 1
  61. #define BASS_WASAPI_AUTOFORMAT 2
  62. #define BASS_WASAPI_BUFFER 4
  63. #define BASS_WASAPI_EVENT 16
  64. #define BASS_WASAPI_SAMPLES 32
  65. #define BASS_WASAPI_DITHER 64
  66. // BASS_WASAPI_INFO "format"
  67. #define BASS_WASAPI_FORMAT_FLOAT 0
  68. #define BASS_WASAPI_FORMAT_8BIT 1
  69. #define BASS_WASAPI_FORMAT_16BIT 2
  70. #define BASS_WASAPI_FORMAT_24BIT 3
  71. #define BASS_WASAPI_FORMAT_32BIT 4
  72. // BASS_WASAPI_Set/GetVolume modes
  73. #define BASS_WASAPI_CURVE_DB 0
  74. #define BASS_WASAPI_CURVE_LINEAR 1
  75. #define BASS_WASAPI_CURVE_WINDOWS 2
  76. #define BASS_WASAPI_VOL_SESSION 8
  77. typedef DWORD (CALLBACK WASAPIPROC)(void *buffer, DWORD length, void *user);
  78. /* WASAPI callback function.
  79. buffer : Buffer containing the sample data
  80. length : Number of bytes
  81. user : The 'user' parameter given when calling BASS_WASAPI_Init
  82. RETURN : The number of bytes written (output devices), 0/1 = stop/continue (input devices) */
  83. typedef void (CALLBACK WASAPINOTIFYPROC)(DWORD notify, DWORD device, void *user);
  84. /* WASAPI device notification callback function.
  85. notify : The notification (BASS_WASAPI_NOTIFY_xxx)
  86. device : Device that the notification applies to
  87. user : The 'user' parameter given when calling BASS_WASAPI_SetNotify */
  88. // Device notifications
  89. #define BASS_WASAPI_NOTIFY_ENABLED 0
  90. #define BASS_WASAPI_NOTIFY_DISABLED 1
  91. #define BASS_WASAPI_NOTIFY_DEFOUTPUT 2
  92. #define BASS_WASAPI_NOTIFY_DEFINPUT 3
  93. #define BASS_WASAPI_NOTIFY_FAIL 0x100
  94. DWORD BASSWASAPIDEF(BASS_WASAPI_GetVersion)();
  95. BOOL BASSWASAPIDEF(BASS_WASAPI_SetNotify)(WASAPINOTIFYPROC *proc, void *user);
  96. BOOL BASSWASAPIDEF(BASS_WASAPI_GetDeviceInfo)(DWORD device, BASS_WASAPI_DEVICEINFO *info);
  97. float BASSWASAPIDEF(BASS_WASAPI_GetDeviceLevel)(DWORD device, int chan);
  98. BOOL BASSWASAPIDEF(BASS_WASAPI_SetDevice)(DWORD device);
  99. DWORD BASSWASAPIDEF(BASS_WASAPI_GetDevice)();
  100. DWORD BASSWASAPIDEF(BASS_WASAPI_CheckFormat)(DWORD device, DWORD freq, DWORD chans, DWORD flags);
  101. BOOL BASSWASAPIDEF(BASS_WASAPI_Init)(int device, DWORD freq, DWORD chans, DWORD flags, float buffer, float period, WASAPIPROC *proc, void *user);
  102. BOOL BASSWASAPIDEF(BASS_WASAPI_Free)();
  103. BOOL BASSWASAPIDEF(BASS_WASAPI_GetInfo)(BASS_WASAPI_INFO *info);
  104. float BASSWASAPIDEF(BASS_WASAPI_GetCPU)();
  105. BOOL BASSWASAPIDEF(BASS_WASAPI_Lock)(BOOL lock);
  106. BOOL BASSWASAPIDEF(BASS_WASAPI_Start)();
  107. BOOL BASSWASAPIDEF(BASS_WASAPI_Stop)(BOOL reset);
  108. BOOL BASSWASAPIDEF(BASS_WASAPI_IsStarted)();
  109. BOOL BASSWASAPIDEF(BASS_WASAPI_SetVolume)(DWORD mode, float volume);
  110. float BASSWASAPIDEF(BASS_WASAPI_GetVolume)(DWORD mode);
  111. BOOL BASSWASAPIDEF(BASS_WASAPI_SetMute)(DWORD mode, BOOL mute);
  112. BOOL BASSWASAPIDEF(BASS_WASAPI_GetMute)(DWORD mode);
  113. DWORD BASSWASAPIDEF(BASS_WASAPI_PutData)(void *buffer, DWORD length);
  114. DWORD BASSWASAPIDEF(BASS_WASAPI_GetData)(void *buffer, DWORD length);
  115. DWORD BASSWASAPIDEF(BASS_WASAPI_GetLevel)();
  116. BOOL BASSWASAPIDEF(BASS_WASAPI_GetLevelEx)(float *levels, float length, DWORD flags);
  117. #ifdef __cplusplus
  118. }
  119. #endif
  120. #endif