/* * bass.dll * */ #include "bass_dll.h" #include #include #include #include WINE_DEFAULT_DEBUG_CHANNEL(bass); static LIN_BOOL wine_bass_first_call_done = FALSE; static void wine_bass_first_call(void) { if (wine_bass_first_call_done) return; wine_bass_first_call_done = TRUE; #if BASSDLLVER <= BASSDLLVER_2415 BASS_SetConfig(BASS_CONFIG_DEV_DEFAULT, FALSE); #endif #if BASSDLLVER <= BASSDLLVER_2416 BASS_SetConfig(BASS_CONFIG_REC_DEFAULT, FALSE); #endif } static inline const char *wine_bass_error_string(int code) { switch (code) { case BASS_OK: return ""; case BASS_ERROR_MEM: return "BASS_ERROR_MEM:"; case BASS_ERROR_FILEOPEN: return "BASS_ERROR_FILEOPEN:"; case BASS_ERROR_DRIVER: return "BASS_ERROR_DRIVER:"; case BASS_ERROR_BUFLOST: return "BASS_ERROR_BUFLOST:"; case BASS_ERROR_HANDLE: return "BASS_ERROR_HANDLE:"; case BASS_ERROR_FORMAT: return "BASS_ERROR_FORMAT:"; case BASS_ERROR_POSITION: return "BASS_ERROR_POSITION:"; case BASS_ERROR_INIT: return "BASS_ERROR_INIT:"; case BASS_ERROR_START: return "BASS_ERROR_START:"; case BASS_ERROR_SSL: return "BASS_ERROR_SSL:"; case BASS_ERROR_REINIT: return "BASS_ERROR_REINIT:"; case BASS_ERROR_ALREADY: return "BASS_ERROR_ALREADY:"; case BASS_ERROR_NOTAUDIO: return "BASS_ERROR_NOTAUDIO:"; case BASS_ERROR_NOCHAN: return "BASS_ERROR_NOCHAN:"; case BASS_ERROR_ILLTYPE: return "BASS_ERROR_ILLTYPE:"; case BASS_ERROR_ILLPARAM: return "BASS_ERROR_ILLPARAM:"; case BASS_ERROR_NO3D: return "BASS_ERROR_NO3D:"; case BASS_ERROR_NOEAX: return "BASS_ERROR_NOEAX:"; case BASS_ERROR_DEVICE: return "BASS_ERROR_DEVICE:"; case BASS_ERROR_NOPLAY: return "BASS_ERROR_NOPLAY:"; case BASS_ERROR_FREQ: return "BASS_ERROR_FREQ:"; case BASS_ERROR_NOTFILE: return "BASS_ERROR_NOTFILE:"; case BASS_ERROR_NOHW: return "BASS_ERROR_NOHW:"; case BASS_ERROR_EMPTY: return "BASS_ERROR_EMPTY:"; case BASS_ERROR_NONET: return "BASS_ERROR_NONET:"; case BASS_ERROR_CREATE: return "BASS_ERROR_CREATE:"; case BASS_ERROR_NOFX: return "BASS_ERROR_NOFX:"; case BASS_ERROR_NOTAVAIL: return "BASS_ERROR_NOTAVAIL:"; case BASS_ERROR_DECODE: return "BASS_ERROR_DECODE:"; case BASS_ERROR_DX: return "BASS_ERROR_DX:"; case BASS_ERROR_TIMEOUT: return "BASS_ERROR_TIMEOUT:"; case BASS_ERROR_FILEFORM: return "BASS_ERROR_FILEFORM:"; case BASS_ERROR_SPEAKER: return "BASS_ERROR_SPEAKER:"; case BASS_ERROR_VERSION: return "BASS_ERROR_VERSION:"; case BASS_ERROR_CODEC: return "BASS_ERROR_CODEC:"; case BASS_ERROR_ENDED: return "BASS_ERROR_ENDED:"; case BASS_ERROR_BUSY: return "BASS_ERROR_BUSY:"; case BASS_ERROR_UNSTREAMABLE: return "BASS_ERROR_UNSTREAMABLE:"; case BASS_ERROR_PROTOCOL: return "BASS_ERROR_PROTOCOL:"; case BASS_ERROR_DENIED: return "BASS_ERROR_DENIED:"; default: return "BASS_ERROR_UNKNOWN:"; } } #define STATIC_ASSERT3(COND,MSG) typedef char static_assertion_##MSG[(!!(COND))*2-1] #define STATIC_ASSERT2(X,L) STATIC_ASSERT3(X, at_line_##L) #define STATIC_ASSERT1(X,L) STATIC_ASSERT2(X, L) #define STATIC_ASSERT(X) STATIC_ASSERT1(X, __LINE__) #define STATIC_ASSERT_BASIC(X) _Static_assert(X, "static assertion failed") STATIC_ASSERT_BASIC(sizeof(double) == 8); STATIC_ASSERT_BASIC(sizeof(WIN_QWORD) == sizeof(LIN_QWORD)); STATIC_ASSERT_BASIC(sizeof(DWORD) == sizeof(LIN_DWORD)); STATIC_ASSERT_BASIC(sizeof(WORD) == sizeof(LIN_WORD)); STATIC_ASSERT_BASIC(sizeof(BYTE) == sizeof(LIN_BYTE)); STATIC_ASSERT_BASIC(sizeof(BOOL) == sizeof(LIN_BOOL)); STATIC_ASSERT_BASIC(sizeof(WIN_HCHANNEL) == sizeof(HCHANNEL)); STATIC_ASSERT_BASIC(sizeof(WIN_BASS_RECORDINFO) == sizeof(BASS_RECORDINFO)); STATIC_ASSERT_BASIC(sizeof(WIN_BASS_SAMPLE) == sizeof(BASS_SAMPLE)); STATIC_ASSERT_BASIC(sizeof(WIN_BASS_PLUGININFO) == sizeof(BASS_PLUGININFO)); STATIC_ASSERT_BASIC(sizeof(WIN_BASS_PLUGINFORM) == sizeof(BASS_PLUGINFORM)); STATIC_ASSERT_BASIC(sizeof(WIN_BASS_INFO) == sizeof(BASS_INFO)); STATIC_ASSERT_BASIC(sizeof(WIN_BASS_DEVICEINFO) == sizeof(BASS_DEVICEINFO)); STATIC_ASSERT_BASIC(sizeof(WIN_BASS_CHANNELINFO) == sizeof(BASS_CHANNELINFO)); STATIC_ASSERT_BASIC(sizeof(WIN_BASS_3DVECTOR) == sizeof(BASS_3DVECTOR)); // this is only supported as a compiler extension (in both clang and gcc), and issues a warning that seemingly CAN'T be disabled // uncomment the following line to enable the checks //#define BASS_CHECK_LAYOUT #ifdef BASS_CHECK_LAYOUT STATIC_ASSERT(&((WIN_BASS_3DVECTOR*)NULL)->x == &((BASS_3DVECTOR*)NULL)->x); STATIC_ASSERT(&((WIN_BASS_3DVECTOR*)NULL)->y == &((BASS_3DVECTOR*)NULL)->y); STATIC_ASSERT(&((WIN_BASS_3DVECTOR*)NULL)->z == &((BASS_3DVECTOR*)NULL)->z); STATIC_ASSERT(&((WIN_BASS_CHANNELINFO*)NULL)->freq == &((BASS_CHANNELINFO*)NULL)->freq); STATIC_ASSERT(&((WIN_BASS_CHANNELINFO*)NULL)->chans == &((BASS_CHANNELINFO*)NULL)->chans); STATIC_ASSERT(&((WIN_BASS_CHANNELINFO*)NULL)->flags == &((BASS_CHANNELINFO*)NULL)->flags); STATIC_ASSERT(&((WIN_BASS_CHANNELINFO*)NULL)->ctype == &((BASS_CHANNELINFO*)NULL)->ctype); STATIC_ASSERT(&((WIN_BASS_CHANNELINFO*)NULL)->origres == &((BASS_CHANNELINFO*)NULL)->origres); STATIC_ASSERT(&((WIN_BASS_CHANNELINFO*)NULL)->plugin == &((BASS_CHANNELINFO*)NULL)->plugin); STATIC_ASSERT(&((WIN_BASS_CHANNELINFO*)NULL)->sample == &((BASS_CHANNELINFO*)NULL)->sample); STATIC_ASSERT(&((WIN_BASS_CHANNELINFO*)NULL)->filename == &((BASS_CHANNELINFO*)NULL)->filename); STATIC_ASSERT(&((WIN_BASS_DEVICEINFO*)NULL)->name == &((BASS_DEVICEINFO*)NULL)->name); STATIC_ASSERT(&((WIN_BASS_DEVICEINFO*)NULL)->driver == &((BASS_DEVICEINFO*)NULL)->driver); STATIC_ASSERT((LIN_DWORD*)&((WIN_BASS_DEVICEINFO*)NULL)->flags == &((BASS_DEVICEINFO*)NULL)->flags); STATIC_ASSERT((LIN_DWORD*)&((WIN_BASS_INFO*)NULL)->flags == &((BASS_INFO*)NULL)->flags); STATIC_ASSERT((LIN_DWORD*)&((WIN_BASS_INFO*)NULL)->hwsize == &((BASS_INFO*)NULL)->hwsize); STATIC_ASSERT((LIN_DWORD*)&((WIN_BASS_INFO*)NULL)->hwfree == &((BASS_INFO*)NULL)->hwfree); STATIC_ASSERT((LIN_DWORD*)&((WIN_BASS_INFO*)NULL)->freesam == &((BASS_INFO*)NULL)->freesam); STATIC_ASSERT((LIN_DWORD*)&((WIN_BASS_INFO*)NULL)->free3d == &((BASS_INFO*)NULL)->free3d); STATIC_ASSERT((LIN_DWORD*)&((WIN_BASS_INFO*)NULL)->minrate == &((BASS_INFO*)NULL)->minrate); STATIC_ASSERT((LIN_DWORD*)&((WIN_BASS_INFO*)NULL)->maxrate == &((BASS_INFO*)NULL)->maxrate); STATIC_ASSERT((LIN_BOOL*)&((WIN_BASS_INFO*)NULL)->eax == &((BASS_INFO*)NULL)->eax); STATIC_ASSERT((LIN_DWORD*)&((WIN_BASS_INFO*)NULL)->minbuf == &((BASS_INFO*)NULL)->minbuf); STATIC_ASSERT((LIN_DWORD*)&((WIN_BASS_INFO*)NULL)->dsver == &((BASS_INFO*)NULL)->dsver); STATIC_ASSERT((LIN_DWORD*)&((WIN_BASS_INFO*)NULL)->latency == &((BASS_INFO*)NULL)->latency); STATIC_ASSERT((LIN_DWORD*)&((WIN_BASS_INFO*)NULL)->initflags == &((BASS_INFO*)NULL)->initflags); STATIC_ASSERT((LIN_DWORD*)&((WIN_BASS_INFO*)NULL)->speakers == &((BASS_INFO*)NULL)->speakers); STATIC_ASSERT((LIN_DWORD*)&((WIN_BASS_INFO*)NULL)->freq == &((BASS_INFO*)NULL)->freq); STATIC_ASSERT((LIN_DWORD*)&((WIN_BASS_RECORDINFO*)NULL)->flags == &((BASS_RECORDINFO*)NULL)->flags); STATIC_ASSERT((LIN_DWORD*)&((WIN_BASS_RECORDINFO*)NULL)->formats == &((BASS_RECORDINFO*)NULL)->formats); STATIC_ASSERT((LIN_DWORD*)&((WIN_BASS_RECORDINFO*)NULL)->inputs == &((BASS_RECORDINFO*)NULL)->inputs); STATIC_ASSERT((LIN_BOOL*)&((WIN_BASS_RECORDINFO*)NULL)->singlein == &((BASS_RECORDINFO*)NULL)->singlein); STATIC_ASSERT((LIN_DWORD*)&((WIN_BASS_RECORDINFO*)NULL)->freq == &((BASS_RECORDINFO*)NULL)->freq); STATIC_ASSERT((LIN_DWORD*)&((WIN_BASS_SAMPLE*)NULL)->freq == &((BASS_SAMPLE*)NULL)->freq); STATIC_ASSERT(&((WIN_BASS_SAMPLE*)NULL)->volume == &((BASS_SAMPLE*)NULL)->volume); STATIC_ASSERT(&((WIN_BASS_SAMPLE*)NULL)->pan == &((BASS_SAMPLE*)NULL)->pan); STATIC_ASSERT((LIN_DWORD*)&((WIN_BASS_SAMPLE*)NULL)->flags == &((BASS_SAMPLE*)NULL)->flags); STATIC_ASSERT((LIN_DWORD*)&((WIN_BASS_SAMPLE*)NULL)->length == &((BASS_SAMPLE*)NULL)->length); STATIC_ASSERT((LIN_DWORD*)&((WIN_BASS_SAMPLE*)NULL)->max == &((BASS_SAMPLE*)NULL)->max); STATIC_ASSERT((LIN_DWORD*)&((WIN_BASS_SAMPLE*)NULL)->origres == &((BASS_SAMPLE*)NULL)->origres); STATIC_ASSERT((LIN_DWORD*)&((WIN_BASS_SAMPLE*)NULL)->chans == &((BASS_SAMPLE*)NULL)->chans); STATIC_ASSERT((LIN_DWORD*)&((WIN_BASS_SAMPLE*)NULL)->mingap == &((BASS_SAMPLE*)NULL)->mingap); STATIC_ASSERT((LIN_DWORD*)&((WIN_BASS_SAMPLE*)NULL)->mode3d == &((BASS_SAMPLE*)NULL)->mode3d); STATIC_ASSERT(&((WIN_BASS_SAMPLE*)NULL)->mindist == &((BASS_SAMPLE*)NULL)->mindist); STATIC_ASSERT(&((WIN_BASS_SAMPLE*)NULL)->maxdist == &((BASS_SAMPLE*)NULL)->maxdist); STATIC_ASSERT((LIN_DWORD*)&((WIN_BASS_SAMPLE*)NULL)->iangle == &((BASS_SAMPLE*)NULL)->iangle); STATIC_ASSERT((LIN_DWORD*)&((WIN_BASS_SAMPLE*)NULL)->oangle == &((BASS_SAMPLE*)NULL)->oangle); STATIC_ASSERT(&((WIN_BASS_SAMPLE*)NULL)->outvol == &((BASS_SAMPLE*)NULL)->outvol); STATIC_ASSERT((LIN_DWORD*)&((WIN_BASS_SAMPLE*)NULL)->vam == &((BASS_SAMPLE*)NULL)->vam); STATIC_ASSERT((LIN_DWORD*)&((WIN_BASS_SAMPLE*)NULL)->priority == &((BASS_SAMPLE*)NULL)->priority); STATIC_ASSERT((LIN_DWORD*)&((WIN_BASS_PLUGININFO*)NULL)->version == &((BASS_PLUGININFO*)NULL)->version); STATIC_ASSERT((LIN_DWORD*)&((WIN_BASS_PLUGININFO*)NULL)->formatc == &((BASS_PLUGININFO*)NULL)->formatc); STATIC_ASSERT((const BASS_PLUGINFORM**)&((WIN_BASS_PLUGININFO*)NULL)->formats == &((BASS_PLUGININFO*)NULL)->formats); STATIC_ASSERT(&((WIN_BASS_PLUGINFORM*)NULL)->exts == &((BASS_PLUGINFORM*)NULL)->exts); STATIC_ASSERT(&((WIN_BASS_PLUGINFORM*)NULL)->name == &((BASS_PLUGINFORM*)NULL)->name); STATIC_ASSERT((LIN_DWORD*)&((WIN_BASS_PLUGINFORM*)NULL)->ctype == &((BASS_PLUGINFORM*)NULL)->ctype); #endif #define BASS_STRINGIFY(S) #S #define PRINT2(X) {\ pthread_mutex_lock(&FILE_MUTEX); \ while (!filkdwkowe) filkdwkowe = fopen("/tmp/bass.txt", "w"); \ pid_t tid = GetCurrentThreadId(); \ sprintf(FILEBUFFF, "%d:%s", tid, wine_bass_error_string(BASS_ErrorGetCode())); \ fwrite(FILEBUFFF, strlen(FILEBUFFF), 1, filkdwkowe); \ fwrite(X, strlen(X), 1, filkdwkowe); \ ZEROOOOO = '\n'; \ fwrite(&ZEROOOOO, 1, 1, filkdwkowe); \ fflush(filkdwkowe); \ pthread_mutex_unlock(&FILE_MUTEX); \ } #define PRINT(X) \ PRINT2(BASS_STRINGIFY(X)); #define PRINT3(X, ...) {\ sprintf(FILEBUFFF2, X, __VA_ARGS__); \ PRINT2(FILEBUFFF2);\ } #define BASS_RETURN(T, X) {\ T ret = X; \ PRINT(X); \ return ret; \ } #define BASS_RETURNBOOL(X) {\ LIN_BOOL ret = X; \ PRINT(X); \ return ret ? TRUE : FALSE; \ } #define BASS_RETURNVOID(X) {\ X; \ PRINT(X); \ return; \ } #define BASS_START(X) {\ wine_bass_first_call(); \ /*PRINT2("start:" BASS_STRINGIFY(X));*/ \ } static char FILEBUFFF2[8192]; static char FILEBUFFF[8192]; static char ZEROOOOO = '\n'; static pthread_mutex_t FILE_MUTEX; static FILE *filkdwkowe; typedef struct { DWORD key; DWORD altKey; void *val; DWORD freeAge; } UserDataEntry; typedef struct { size_t count; size_t capacity; UserDataEntry *data; pthread_mutex_t mutex; } UserDataStorage; static UserDataStorage WINE_BASS_DATA_STORAGE; LIN_BOOL __stdcall wine_bass_user_data_add_ex(DWORD key, DWORD altKey, void *val) { return FALSE; pthread_mutex_lock(&WINE_BASS_DATA_STORAGE.mutex); LIN_BOOL ret = 1; if (WINE_BASS_DATA_STORAGE.count == WINE_BASS_DATA_STORAGE.capacity) { if (WINE_BASS_DATA_STORAGE.capacity == 0) { WINE_BASS_DATA_STORAGE.data = malloc(64 * sizeof(UserDataEntry)); WINE_BASS_DATA_STORAGE.capacity = 64; } else { void *new = realloc(WINE_BASS_DATA_STORAGE.data, 2 * WINE_BASS_DATA_STORAGE.capacity * sizeof(UserDataEntry)); if (new) { WINE_BASS_DATA_STORAGE.data = new; WINE_BASS_DATA_STORAGE.capacity *= 2; } } } if (!WINE_BASS_DATA_STORAGE.data || WINE_BASS_DATA_STORAGE.count == WINE_BASS_DATA_STORAGE.capacity) { goto CLEANUP; } UserDataEntry entry = { .key = key, .altKey = altKey, .val = val, .freeAge = 0, }; WINE_BASS_DATA_STORAGE.data[WINE_BASS_DATA_STORAGE.count] = entry; ++WINE_BASS_DATA_STORAGE.count; CLEANUP: pthread_mutex_unlock(&WINE_BASS_DATA_STORAGE.mutex); return ret; } LIN_BOOL wine_bass_user_data_add(DWORD key, void *val) { return wine_bass_user_data_add_ex(key, 0, val); } static inline void wine_bass_user_data_cleanup() { // around 400kb // why? to (almost) make sure I don't accidentally nuke anything if (WINE_BASS_DATA_STORAGE.count > 16384) { UserDataEntry *end = &WINE_BASS_DATA_STORAGE.data[WINE_BASS_DATA_STORAGE.count]; for (UserDataEntry *entry = WINE_BASS_DATA_STORAGE.data; entry < end; ++entry) { // only remove 8192 oldest entries while (entry->freeAge > 8192) { free(entry->val); if (WINE_BASS_DATA_STORAGE.count > 1) { *entry = WINE_BASS_DATA_STORAGE.data[WINE_BASS_DATA_STORAGE.count - 1]; } else { entry->freeAge = 0; } --WINE_BASS_DATA_STORAGE.count; --end; } } } } void wine_bass_user_data_remove(DWORD key) { return; pthread_mutex_lock(&WINE_BASS_DATA_STORAGE.mutex); UserDataEntry *end = &WINE_BASS_DATA_STORAGE.data[WINE_BASS_DATA_STORAGE.count]; for (UserDataEntry *entry = WINE_BASS_DATA_STORAGE.data; entry < end; ++entry) { if (entry->freeAge || (entry->key == key || entry->altKey == key)) { ++entry->freeAge; } } wine_bass_user_data_cleanup(); pthread_mutex_unlock(&WINE_BASS_DATA_STORAGE.mutex); } void __stdcall wine_bass_user_data_remove_ex(DWORD key, DWORD altKey) { return; pthread_mutex_lock(&WINE_BASS_DATA_STORAGE.mutex); UserDataEntry *end = &WINE_BASS_DATA_STORAGE.data[WINE_BASS_DATA_STORAGE.count]; for (UserDataEntry *entry = WINE_BASS_DATA_STORAGE.data; entry < end; ++entry) { if (entry->freeAge || (entry->key == key && entry->altKey == altKey)) { ++entry->freeAge; } } wine_bass_user_data_cleanup(); pthread_mutex_unlock(&WINE_BASS_DATA_STORAGE.mutex); } void wine_bass_user_data_free(UserDataStorage *store) { return; pthread_mutex_lock(&WINE_BASS_DATA_STORAGE.mutex); WINE_BASS_DATA_STORAGE.capacity = 0; WINE_BASS_DATA_STORAGE.count = 0; free(WINE_BASS_DATA_STORAGE.data); WINE_BASS_DATA_STORAGE.data = NULL; pthread_mutex_unlock(&WINE_BASS_DATA_STORAGE.mutex); } static inline char *wine_bass_to_linux_filename(const void *file, DWORD flags) { char *ret = NULL; if (flags & BASS_UNICODE) { const WCHAR *filename = file; ret = wine_get_unix_file_name(filename); } else { const char *filename = file; int lenA = lstrlenA(filename); int lenW = MultiByteToWideChar(CP_ACP, 0, filename, lenA, NULL, 0); if (lenW > 0) { WCHAR *filename16 = malloc(lenW * 2); memset(filename16, 0, lenW * 2); if (filename16) { MultiByteToWideChar(CP_ACP, 0, filename, lenA, filename16, lenW); ret = wine_get_unix_file_name(filename16); free(filename16); } } } return ret; } /****************************************************************** * BASS_Apply3D (BASS.1) * * */ void __stdcall WIN_BASS_Apply3D(void) { BASS_START(BASS_Apply3D(void)); BASS_RETURNVOID(BASS_Apply3D()); } /****************************************************************** * BASS_ChannelBytes2Seconds (BASS.2) * * */ double __stdcall WIN_BASS_ChannelBytes2Seconds(DWORD handle, WIN_QWORD pos) { BASS_START(BASS_ChannelBytes2Seconds(DWORD handle, WIN_QWORD pos)); double ret = 0.0; ret = BASS_ChannelBytes2Seconds(handle, pos); if (ret >= 0.0) { const unsigned char *tmp = (void*)&ret; PRINT3("BASS_ChannelBytes2Seconds(%u, %lu) = %f[%02x%02x%02x%02x%02x%02x%02x%02x]", handle, pos, ret, (int)tmp[0], (int)tmp[1], (int)tmp[2], (int)tmp[3], (int)tmp[4], (int)tmp[5], (int)tmp[6], (int)tmp[7] ); } else { PRINT3("BASS_ChannelBytes2Seconds(%u, %lu) failed!!", handle, pos); } return ret; } /****************************************************************** * BASS_ChannelFlags (BASS.3) * * */ DWORD __stdcall WIN_BASS_ChannelFlags(DWORD handle, DWORD flags, DWORD mask) { BASS_START(BASS_ChannelFlags(DWORD handle, DWORD flags, DWORD mask)); BASS_RETURN(LIN_DWORD, BASS_ChannelFlags(handle, flags, mask)); } /****************************************************************** * BASS_ChannelGet3DAttributes (BASS.4) * * */ BOOL __stdcall WIN_BASS_ChannelGet3DAttributes(DWORD handle, DWORD * mode, float * min, float * max, DWORD * iangle, DWORD * oangle, float * outvol) { BASS_START(BASS_ChannelGet3DAttributes(DWORD handle, DWORD * mode, float * min, float * max, DWORD * iangle, DWORD * oangle, float * outvol)); BASS_RETURNBOOL(BASS_ChannelGet3DAttributes(handle, (LIN_DWORD*)mode, min, max, (LIN_DWORD*)iangle, (LIN_DWORD*)oangle, outvol)); } /****************************************************************** * BASS_ChannelGet3DPosition (BASS.5) * * */ BOOL __stdcall WIN_BASS_ChannelGet3DPosition(DWORD handle, WIN_BASS_3DVECTOR * pos, WIN_BASS_3DVECTOR * orient, WIN_BASS_3DVECTOR * vel) { BASS_START(BASS_ChannelGet3DPosition(DWORD handle, WIN_BASS_3DVECTOR * pos, WIN_BASS_3DVECTOR * orient, WIN_BASS_3DVECTOR * vel)); BASS_RETURNBOOL(BASS_ChannelGet3DPosition(handle, (BASS_3DVECTOR*)pos, (BASS_3DVECTOR*)orient, (BASS_3DVECTOR*)vel)); } /****************************************************************** * BASS_ChannelGetAttribute (BASS.6) * * */ const char *wine_bass_attrib_name(DWORD attrib) { switch (attrib) { case BASS_ATTRIB_BITRATE: return "BASS_ATTRIB_BITRATE"; case BASS_ATTRIB_BUFFER: return "BASS_ATTRIB_BUFFER"; case BASS_ATTRIB_CPU: return "BASS_ATTRIB_CPU"; case BASS_ATTRIB_DOWNLOADPROC: return "BASS_ATTRIB_DOWNLOADPROC"; case BASS_ATTRIB_EAXMIX: return "BASS_ATTRIB_EAXMIX"; case BASS_ATTRIB_FREQ: return "BASS_ATTRIB_FREQ"; case BASS_ATTRIB_GRANULE: return "BASS_ATTRIB_GRANULE"; case BASS_ATTRIB_MUSIC_ACTIVE: return "BASS_ATTRIB_MUSIC_ACTIVE"; case BASS_ATTRIB_MUSIC_AMPLIFY: return "BASS_ATTRIB_MUSIC_AMPLIFY"; case BASS_ATTRIB_MUSIC_BPM: return "BASS_ATTRIB_MUSIC_BPM"; case BASS_ATTRIB_MUSIC_PANSEP: return "BASS_ATTRIB_MUSIC_PANSEP"; case BASS_ATTRIB_MUSIC_PSCALER: return "BASS_ATTRIB_MUSIC_PSCALER"; case BASS_ATTRIB_MUSIC_SPEED: return "BASS_ATTRIB_MUSIC_SPEED"; case BASS_ATTRIB_MUSIC_VOL_CHAN: return "BASS_ATTRIB_MUSIC_VOL_CHAN"; case BASS_ATTRIB_MUSIC_VOL_GLOBAL: return "BASS_ATTRIB_MUSIC_VOL_GLOBAL"; case BASS_ATTRIB_MUSIC_VOL_INST: return "BASS_ATTRIB_MUSIC_VOL_INST"; case BASS_ATTRIB_NET_RESUME: return "BASS_ATTRIB_NET_RESUME"; case BASS_ATTRIB_NOBUFFER: return "BASS_ATTRIB_NOBUFFER"; case BASS_ATTRIB_NORAMP: return "BASS_ATTRIB_NORAMP"; case BASS_ATTRIB_PAN: return "BASS_ATTRIB_PAN"; case BASS_ATTRIB_PUSH_LIMIT: return "BASS_ATTRIB_PUSH_LIMIT"; case BASS_ATTRIB_SCANINFO: return "BASS_ATTRIB_SCANINFO"; case BASS_ATTRIB_SRC: return "BASS_ATTRIB_SRC"; case BASS_ATTRIB_TAIL: return "BASS_ATTRIB_TAIL"; case BASS_ATTRIB_USER: return "BASS_ATTRIB_USER"; case BASS_ATTRIB_VBR: return "BASS_ATTRIB_VBR"; case BASS_ATTRIB_VOL: return "BASS_ATTRIB_VOL"; case BASS_ATTRIB_VOLDSP: return "BASS_ATTRIB_VOLDSP"; case BASS_ATTRIB_VOLDSP_PRIORITY: return "BASS_ATTRIB_VOLDSP_PRIORITY"; // from bass_fx case 0x10000: return "BASSFX_ATTRIB_TEMPO"; case 0x10001: return "BASSFX_ATTRIB_TEMPO_PITCH"; case 0x10002: return "BASSFX_ATTRIB_TEMPO_FREQ"; case 0x10010: return "BASSFX_ATTRIB_TEMPO_OPTION_USE_AA_FILTER"; case 0x10011: return "BASSFX_ATTRIB_TEMPO_OPTION_AA_FILTER_LENGTH"; case 0x10012: return "BASSFX_ATTRIB_TEMPO_OPTION_USE_QUICKALGO"; case 0x10013: return "BASSFX_ATTRIB_TEMPO_OPTION_SEQUENCE_MS"; case 0x10014: return "BASSFX_ATTRIB_TEMPO_OPTION_SEEKWINDOW_MS"; case 0x10015: return "BASSFX_ATTRIB_TEMPO_OPTION_OVERLAP_MS"; case 0x10016: return "BASSFX_ATTRIB_TEMPO_OPTION_PREVENT_CLICK"; case 0x11010: return "BASSFX_ATTRIB_REVERSE_DIR"; default: return NULL; } } BOOL __stdcall WIN_BASS_ChannelGetAttribute(DWORD handle, DWORD attrib, float * value) { BASS_START(BASS_ChannelGetAttribute(DWORD handle, DWORD attrib, float * value)); LIN_BOOL ret = BASS_ChannelGetAttribute(handle, attrib, value); const char *name = wine_bass_attrib_name(attrib); if (ret && value) { if (name) { PRINT3("BASS_ChannelGetAttribute(%u, %s) = %f", handle, name, *value); } else { PRINT3("BASS_ChannelGetAttribute(%u, %u) = %f", handle, attrib, *value); } } else { if (name) { PRINT3("BASS_ChannelGetAttribute(%u, %s) failed!", handle, name); } else { PRINT3("BASS_ChannelGetAttribute(%u, %u) failed!", handle, attrib); } } return ret ? TRUE : FALSE; } /****************************************************************** * BASS_ChannelGetAttributeEx (BASS.7) * * */ DWORD __stdcall WIN_BASS_ChannelGetAttributeEx(DWORD handle, DWORD attrib, void * value, DWORD size) { BASS_START(BASS_ChannelGetAttributeEx(DWORD handle, DWORD attrib, void * value, DWORD size)); BASS_RETURN(LIN_DWORD, BASS_ChannelGetAttributeEx(handle, attrib, value, size)); } /****************************************************************** * BASS_ChannelGetData (BASS.8) * * */ DWORD wine_bass_length_flags(DWORD length, char *flags) { flags[0] = '\0'; DWORD n = length; if (BASS_DATA_FLOAT & n) { n &= ~BASS_DATA_FLOAT; strcat(flags, "|BASS_DATA_FLOAT"); } if (BASS_DATA_FFT32768 & n) { n &= ~BASS_DATA_FFT32768; strcat(flags, "|BASS_DATA_FFT32768"); } if (BASS_DATA_FFT16384 & n) { n &= ~BASS_DATA_FFT16384; strcat(flags, "|BASS_DATA_FFT16384"); } if (BASS_DATA_FFT8192 & n) { n &= ~BASS_DATA_FFT8192; strcat(flags, "|BASS_DATA_FFT8192"); } if (BASS_DATA_FFT4096 & n) { n &= ~BASS_DATA_FFT4096; strcat(flags, "|BASS_DATA_FFT4096"); } if (BASS_DATA_FFT2048 & n) { n &= ~BASS_DATA_FFT2048; strcat(flags, "|BASS_DATA_FFT2048"); } if (BASS_DATA_FFT1024 & n) { n &= ~BASS_DATA_FFT1024; strcat(flags, "|BASS_DATA_FFT1024"); } if (BASS_DATA_FFT512 & n) { n &= ~BASS_DATA_FFT512; strcat(flags, "|BASS_DATA_FFT512"); } if (BASS_DATA_FFT256 & n) { n &= ~BASS_DATA_FFT256; strcat(flags, "|BASS_DATA_FFT256"); } if (BASS_DATA_FFT_COMPLEX & n) { n &= ~BASS_DATA_FFT_COMPLEX; strcat(flags, "|BASS_DATA_FFT_COMPLEX"); } if (BASS_DATA_FFT_INDIVIDUAL & n) { n &= ~BASS_DATA_FFT_INDIVIDUAL; strcat(flags, "|BASS_DATA_FFT_INDIVIDUAL"); } if (BASS_DATA_FFT_NOWINDOW & n) { n &= ~BASS_DATA_FFT_NOWINDOW; strcat(flags, "|BASS_DATA_FFT_NOWINDOW"); } if (BASS_DATA_FFT_NYQUIST & n) { n &= ~BASS_DATA_FFT_NYQUIST; strcat(flags, "|BASS_DATA_FFT_NYQUIST"); } if (BASS_DATA_FFT_REMOVEDC & n) { n &= ~BASS_DATA_FFT_REMOVEDC; strcat(flags, "|BASS_DATA_FFT_REMOVEDC"); } if (BASS_DATA_NOREMOVE & n) { n &= ~BASS_DATA_NOREMOVE; strcat(flags, "|BASS_DATA_NOREMOVE"); } if (BASS_DATA_AVAILABLE & n) { n &= ~BASS_DATA_AVAILABLE; strcat(flags, "|BASS_DATA_AVAILABLE"); } return n; } DWORD __stdcall WIN_BASS_ChannelGetData(DWORD handle, void * buffer, DWORD length) { BASS_START(BASS_ChannelGetData(DWORD handle, void * buffer, DWORD length)); char buf[512]; DWORD bytes = wine_bass_length_flags(length, buf); DWORD ret = BASS_ChannelGetData(handle, buffer, length); if (bytes || !buf[0]) { PRINT3("ChannelGetData(%u, %p, %u%s) = %u", handle, buffer, bytes, buf, ret); } else { PRINT3("ChannelGetData(%u, %p, %s) = %u", handle, buffer, &buf[1], ret); } return ret; } /****************************************************************** * BASS_ChannelGetDevice (BASS.9) * * */ DWORD __stdcall WIN_BASS_ChannelGetDevice(DWORD handle) { BASS_START(BASS_ChannelGetDevice(DWORD handle)); BASS_RETURN(LIN_DWORD, BASS_ChannelGetDevice(handle)); } /****************************************************************** * BASS_ChannelGetInfo (BASS.10) * * */ BOOL __stdcall WIN_BASS_ChannelGetInfo(DWORD handle, WIN_BASS_CHANNELINFO * info) { BASS_START(BASS_ChannelGetInfo(DWORD handle, WIN_BASS_CHANNELINFO * info)); LIN_BOOL ret = BASS_ChannelGetInfo(handle, (BASS_CHANNELINFO*)info); if (ret && info && info->filename) { info->filename = wine_bass_to_linux_filename(info->filename, info->flags); if (info->filename) wine_bass_user_data_add(handle, (void*)info->filename); else ret = FALSE; } if (ret) { PRINT3("BASS_ChannelGetInfo(%u, ...) = { freq: %u, chans: %u, flags: %u, ctype: %u, origres: %u, plugin: %u, sample: %u, filename: %s }", handle, info->freq, info->chans, info->flags, info->ctype, info->origres, info->plugin, info->sample, info->filename ); } else { PRINT3("BASS_ChannelGetInfo(%u, ...) failed!", handle); } return ret ? TRUE : FALSE; } /****************************************************************** * BASS_ChannelGetLength (BASS.11) * * */ WIN_QWORD __stdcall WIN_BASS_ChannelGetLength(DWORD handle, DWORD mode) { BASS_START(BASS_ChannelGetLength(DWORD handle, DWORD mode)); WIN_QWORD ret = BASS_ChannelGetLength(handle, mode); PRINT3("BASS_ChannelGetLength(%u, %u) = %lu", handle, mode, ret); return ret; } /****************************************************************** * BASS_ChannelGetLevel (BASS.12) * * */ DWORD __stdcall WIN_BASS_ChannelGetLevel(DWORD handle) { BASS_START(BASS_ChannelGetLevel(DWORD handle)); DWORD ret = BASS_ChannelGetLevel(handle); PRINT3("BASS_ChannelGetLevel(%u) = MAKEWORD(%u, %u)", handle, LOWORD(ret), HIWORD(ret)); return ret; } /****************************************************************** * BASS_ChannelGetLevelEx (BASS.13) * * */ BOOL __stdcall WIN_BASS_ChannelGetLevelEx(DWORD handle, float * levels, float length, DWORD flags) { BASS_START(BASS_ChannelGetLevelEx(DWORD handle, float * levels, float length, DWORD flags)); BASS_RETURNBOOL(BASS_ChannelGetLevelEx(handle, levels, length, flags)); } /****************************************************************** * BASS_ChannelGetPosition (BASS.14) * * */ const char *wine_bass_get_mode_name(DWORD mode) { switch (mode) { case BASS_POS_BYTE: return "BASS_POS_BYTE"; case BASS_POS_MUSIC_ORDER: return "BASS_POS_MUSIC_ORDER"; case BASS_POS_OGG: return "BASS_POS_OGG"; case BASS_POS_END: return "BASS_POS_END"; case BASS_POS_LOOP: return "BASS_POS_LOOP"; case BASS_POS_FLUSH: return "BASS_POS_FLUSH"; case BASS_POS_RESET: return "BASS_POS_RESET"; case BASS_POS_RELATIVE: return "BASS_POS_RELATIVE"; case BASS_POS_INEXACT: return "BASS_POS_INEXACT"; case BASS_POS_DECODE: return "BASS_POS_DECODE"; case BASS_POS_DECODETO: return "BASS_POS_DECODETO"; case BASS_POS_SCAN: return "BASS_POS_SCAN"; default: return NULL; } } WIN_QWORD __stdcall WIN_BASS_ChannelGetPosition(DWORD handle, DWORD mode) { BASS_START(BASS_ChannelGetPosition(DWORD handle, DWORD mode)); WIN_QWORD ret = BASS_ChannelGetPosition(handle, mode); { const char *name = wine_bass_get_mode_name(mode); if (name) { PRINT3("BASS_ChannelGetPosition(%u, %s) = %lu", handle, name, ret); } else { PRINT3("BASS_ChannelGetPosition(%u, %u) = %lu", handle, mode, ret); } } return ret; } /****************************************************************** * BASS_ChannelGetTags (BASS.15) * * */ const char * __stdcall WIN_BASS_ChannelGetTags(DWORD handle, DWORD tags) { BASS_START(BASS_ChannelGetTags(DWORD handle, DWORD tags)); BASS_RETURN(const char*, BASS_ChannelGetTags(handle, tags)); } /****************************************************************** * BASS_ChannelIsActive (BASS.16) * * */ DWORD __stdcall WIN_BASS_ChannelIsActive(DWORD handle) { BASS_START(BASS_ChannelIsActive(DWORD handle)); DWORD ret = BASS_ChannelIsActive(handle); PRINT3("BASS_ChannelIsActive(%u) = %u", handle, ret); return ret; } /****************************************************************** * BASS_ChannelIsSliding (BASS.17) * * */ BOOL __stdcall WIN_BASS_ChannelIsSliding(DWORD handle, DWORD attrib) { BASS_START(BASS_ChannelIsSliding(DWORD handle, DWORD attrib)); BASS_RETURNBOOL(BASS_ChannelIsSliding(handle, attrib)); } /****************************************************************** * BASS_ChannelLock (BASS.18) * * */ BOOL __stdcall WIN_BASS_ChannelLock(DWORD handle, BOOL lock) { BASS_START(BASS_ChannelLock(DWORD handle, BOOL lock)); BASS_RETURNBOOL(BASS_ChannelLock(handle, lock)); } /****************************************************************** * BASS_ChannelPause (BASS.19) * * */ BOOL __stdcall WIN_BASS_ChannelPause(DWORD handle) { BASS_START(BASS_ChannelPause(DWORD handle)); BASS_RETURNBOOL(BASS_ChannelPause(handle)); } /****************************************************************** * BASS_ChannelPlay (BASS.20) * * */ BOOL __stdcall WIN_BASS_ChannelPlay(DWORD handle, BOOL restart) { BASS_START(BASS_ChannelPlay(DWORD handle, BOOL restart)); LIN_BOOL ret = BASS_ChannelPlay(handle, restart); DWORD retu = ret ? 1 : 0; PRINT3("BASS_ChannelPlay(%u, %u) = %u", handle, restart, retu); return ret ? TRUE : FALSE; } /****************************************************************** * BASS_ChannelRemoveDSP (BASS.21) * * */ BOOL __stdcall WIN_BASS_ChannelRemoveDSP(DWORD handle, WIN_HDSP dsp) { BASS_START(BASS_ChannelRemoveDSP(DWORD handle, WIN_HDSP dsp)); wine_bass_user_data_remove(dsp); BASS_RETURNBOOL(BASS_ChannelRemoveDSP(handle, dsp)); } /****************************************************************** * BASS_ChannelRemoveFX (BASS.22) * * */ BOOL __stdcall WIN_BASS_ChannelRemoveFX(DWORD handle, WIN_HFX fx) { BASS_START(BASS_ChannelRemoveFX(DWORD handle, WIN_HFX fx)); BASS_RETURNBOOL(BASS_ChannelRemoveFX(handle, fx)); } /****************************************************************** * BASS_ChannelRemoveLink (BASS.23) * * */ BOOL __stdcall WIN_BASS_ChannelRemoveLink(DWORD handle, DWORD chan) { BASS_START(BASS_ChannelRemoveLink(DWORD handle, DWORD chan)); BASS_RETURNBOOL(BASS_ChannelRemoveLink(handle, chan)); } /****************************************************************** * BASS_ChannelRemoveSync (BASS.24) * * */ BOOL __stdcall WIN_BASS_ChannelRemoveSync(DWORD handle, WIN_HSYNC sync) { BASS_START(BASS_ChannelRemoveSync(DWORD handle, WIN_HSYNC sync)); wine_bass_user_data_remove(sync); BASS_RETURNBOOL(BASS_ChannelRemoveSync(handle, sync)); } /****************************************************************** * BASS_ChannelSeconds2Bytes (BASS.25) * * */ WIN_QWORD __stdcall WIN_BASS_ChannelSeconds2Bytes(DWORD handle, double pos) { BASS_START(BASS_ChannelSeconds2Bytes(DWORD handle, double pos)); BASS_RETURN(LIN_QWORD, BASS_ChannelSeconds2Bytes(handle, pos)); } /****************************************************************** * BASS_ChannelSet3DAttributes (BASS.26) * * */ BOOL __stdcall WIN_BASS_ChannelSet3DAttributes(DWORD handle, int mode, float min, float max, int iangle, int oangle, float outvol) { BASS_START(BASS_ChannelSet3DAttributes(DWORD handle, int mode, float min, float max, int iangle, int oangle, float outvol)); BASS_RETURNBOOL(BASS_ChannelSet3DAttributes(handle, mode, min, max, iangle, oangle, outvol)); } /****************************************************************** * BASS_ChannelSet3DPosition (BASS.27) * * */ BOOL __stdcall WIN_BASS_ChannelSet3DPosition(DWORD handle, const WIN_BASS_3DVECTOR * pos, const WIN_BASS_3DVECTOR * orient, const WIN_BASS_3DVECTOR * vel) { BASS_START(BASS_ChannelSet3DPosition(DWORD handle, WIN_BASS_3DVECTOR * pos, WIN_BASS_3DVECTOR * orient, WIN_BASS_3DVECTOR * vel)); BASS_RETURNBOOL(BASS_ChannelSet3DPosition(handle, (BASS_3DVECTOR*)pos, (BASS_3DVECTOR*)orient, (BASS_3DVECTOR*)vel)); } /****************************************************************** * BASS_ChannelSetAttribute (BASS.28) * * */ BOOL __stdcall WIN_BASS_ChannelSetAttribute(DWORD handle, DWORD attrib, float value) { BASS_START(BASS_ChannelSetAttribute(DWORD handle, DWORD attrib, float value)); LIN_BOOL ret = BASS_ChannelSetAttribute(handle, attrib, value); { const char *name = wine_bass_attrib_name(attrib); const char *success = ret ? "" : " failed!"; if (name) { PRINT3("BASS_ChannelSetAttribute(%u, %s, %f)%s", handle, name, value, success); } else { PRINT3("BASS_ChannelSetAttribute(%u, %u, %f)%s", handle, attrib, value, success); } } return ret ? TRUE : FALSE; } /****************************************************************** * BASS_ChannelSetAttributeEx (BASS.29) * * */ BOOL __stdcall WIN_BASS_ChannelSetAttributeEx(DWORD handle, DWORD attrib, void * value, DWORD size) { BASS_START(BASS_ChannelSetAttributeEx(DWORD handle, DWORD attrib, void * value, DWORD size)); BASS_RETURNBOOL(BASS_ChannelSetAttributeEx(handle, attrib, value, size)); } /****************************************************************** * BASS_ChannelSetDSP (BASS.30) * * */ typedef struct { WIN_DSPPROC *proc; void *user; } DspUserData; void wine_bass_dspproc_wrapper(HDSP handle, LIN_DWORD channel, void *buffer, LIN_DWORD length, void *user) { DspUserData *user_new = user; BASS_RETURNVOID(user_new->proc(handle, channel, buffer, length, user_new->user)); } void wine_bass_dspproc_wrapper_nouser(HDSP handle, LIN_DWORD channel, void *buffer, LIN_DWORD length, void *user) { WIN_DSPPROC *proc = user; BASS_RETURNVOID(proc(handle, channel, buffer, length, NULL)); } WIN_HDSP __stdcall WIN_BASS_ChannelSetDSP(DWORD handle, WIN_DSPPROC * proc, void * user, int priority) { BASS_START(BASS_ChannelSetDSP(DWORD handle, WIN_DSPPROC * proc, void * user, int priority)); if (user) { DspUserData *user_new = malloc(sizeof(DspUserData)); user_new->proc = proc; user_new->user = user; WIN_HDSP ret = BASS_ChannelSetDSP(handle, wine_bass_dspproc_wrapper, user_new, priority); if (ret) wine_bass_user_data_add_ex(ret, handle, user_new); else free(user_new); PRINT(BASS_ChannelSetDSP); return ret; } else { BASS_RETURN(HDSP, BASS_ChannelSetDSP(handle, wine_bass_dspproc_wrapper_nouser, proc, priority)); } } /****************************************************************** * BASS_ChannelSetDevice (BASS.31) * * */ BOOL __stdcall WIN_BASS_ChannelSetDevice(DWORD handle, DWORD device) { BASS_START(BASS_ChannelSetDevice(DWORD handle, DWORD device)); BASS_RETURNBOOL(BASS_ChannelSetDevice(handle, device)); } /****************************************************************** * BASS_ChannelSetFX (BASS.32) * * */ WIN_HFX __stdcall WIN_BASS_ChannelSetFX(DWORD handle, DWORD type, int priority) { BASS_START(BASS_ChannelSetFX(DWORD handle, DWORD type, int priority)); BASS_RETURN(HFX, BASS_ChannelSetFX(handle, type, priority)); } /****************************************************************** * BASS_ChannelSetLink (BASS.33) * * */ BOOL __stdcall WIN_BASS_ChannelSetLink(DWORD handle, DWORD chan) { BASS_START(BASS_ChannelSetLink(DWORD handle, DWORD chan)); BASS_RETURNBOOL(BASS_ChannelSetLink(handle, chan)); } /****************************************************************** * BASS_ChannelSetPosition (BASS.34) * * */ BOOL __stdcall WIN_BASS_ChannelSetPosition(DWORD handle, WIN_QWORD pos, DWORD mode) { BASS_START(BASS_ChannelSetPosition(DWORD handle, WIN_QWORD pos, DWORD mode)); BASS_RETURNBOOL(BASS_ChannelSetPosition(handle, pos, mode)); } /****************************************************************** * BASS_ChannelSetSync (BASS.35) * * */ typedef struct { WIN_SYNCPROC *proc; void *user; } SyncUserData; void wine_bass_syncproc_wrapper(HSYNC handle, LIN_DWORD channel, LIN_DWORD data, void *user) { SyncUserData *user_new = user; BASS_RETURNVOID(user_new->proc(handle, channel, data, user_new->user)); } void wine_bass_syncproc_wrapper_nouser(HSYNC handle, LIN_DWORD channel, LIN_DWORD data, void *user) { WIN_SYNCPROC *proc = user; BASS_RETURNVOID(proc(handle, channel, data, NULL)); } WIN_HSYNC __stdcall WIN_BASS_ChannelSetSync(DWORD handle, DWORD type, WIN_QWORD param, WIN_SYNCPROC * proc, void * user) { BASS_START(BASS_ChannelSetSync(DWORD handle, DWORD type, WIN_QWORD param, WIN_SYNCPROC * proc, void * user)); if (user) { SyncUserData *user_new = malloc(sizeof(SyncUserData)); user_new->proc = proc; user_new->user = user; WIN_HSYNC ret = BASS_ChannelSetSync(handle, type, param, wine_bass_syncproc_wrapper, user_new); if (ret) wine_bass_user_data_add_ex(ret, handle, user_new); else free(user_new); PRINT(BASS_ChannelSetSync); return ret; } else { BASS_RETURN(HSYNC, BASS_ChannelSetSync(handle, type, param, wine_bass_syncproc_wrapper_nouser, proc)); } } /****************************************************************** * BASS_ChannelSlideAttribute (BASS.36) * * */ BOOL __stdcall WIN_BASS_ChannelSlideAttribute(DWORD handle, DWORD attrib, float value, DWORD time) { BASS_START(BASS_ChannelSlideAttribute(DWORD handle, DWORD attrib, float value, DWORD time)); BASS_RETURNBOOL(BASS_ChannelSlideAttribute(handle, attrib, value, time)); } /****************************************************************** * BASS_ChannelStop (BASS.37) * * */ BOOL __stdcall WIN_BASS_ChannelStop(DWORD handle) { BASS_START(BASS_ChannelStop(DWORD handle)); wine_bass_user_data_remove(handle); BASS_RETURNBOOL(BASS_ChannelStop(handle)); } /****************************************************************** * BASS_ChannelUpdate (BASS.38) * * */ BOOL __stdcall WIN_BASS_ChannelUpdate(DWORD handle, DWORD length) { BASS_START(BASS_ChannelUpdate(DWORD handle, DWORD length)); BASS_RETURNBOOL(BASS_ChannelUpdate(handle, length)); } /****************************************************************** * BASS_ErrorGetCode (BASS.39) * * */ int __stdcall WIN_BASS_ErrorGetCode(void) { BASS_START(BASS_ErrorGetCode(void)); int ret = BASS_ErrorGetCode(); if (ret) { // WINE_ERR("BASS_ErrorGetCode() = %i", ret); } PRINT3("BASS_ErrorGetCode() = %i", ret); return ret; } /****************************************************************** * BASS_FXGetParameters (BASS.40) * * */ BOOL __stdcall WIN_BASS_FXGetParameters(WIN_HFX handle, void * params) { BASS_START(BASS_FXGetParameters(WIN_HFX handle, void * params)); BASS_RETURNBOOL(BASS_FXGetParameters(handle, params)); } /****************************************************************** * BASS_FXReset (BASS.41) * * */ BOOL __stdcall WIN_BASS_FXReset(DWORD handle) { BASS_START(BASS_FXReset(DWORD handle)); BASS_RETURNBOOL(BASS_FXReset(handle)); } /****************************************************************** * BASS_FXSetParameters (BASS.42) * * */ BOOL __stdcall WIN_BASS_FXSetParameters(WIN_HFX handle, const void * params) { BASS_START(BASS_FXSetParameters(WIN_HFX handle, void * params)); BASS_RETURNBOOL(BASS_FXSetParameters(handle, params)); } /****************************************************************** * BASS_FXSetPriority (BASS.43) * * */ BOOL __stdcall WIN_BASS_FXSetPriority(WIN_HFX handle, int priority) { BASS_START(BASS_FXSetPriority(WIN_HFX handle, int priority)); BASS_RETURNBOOL(BASS_FXSetPriority(handle, priority)); } /****************************************************************** * BASS_Free (BASS.44) * * */ BOOL __stdcall WIN_BASS_Free(void) { BASS_START(BASS_Free(void)); wine_bass_user_data_free(&WINE_BASS_DATA_STORAGE); BASS_RETURNBOOL(BASS_Free()); } /****************************************************************** * BASS_Get3DFactors (BASS.45) * * */ BOOL __stdcall WIN_BASS_Get3DFactors(float * distf, float * rollf, float * doppf) { BASS_START(BASS_Get3DFactors(float * distf, float * rollf, float * doppf)); BASS_RETURNBOOL(BASS_Get3DFactors(distf, rollf, doppf)); } /****************************************************************** * BASS_Get3DPosition (BASS.46) * * */ BOOL __stdcall WIN_BASS_Get3DPosition(WIN_BASS_3DVECTOR * pos, WIN_BASS_3DVECTOR * vel, WIN_BASS_3DVECTOR * front, WIN_BASS_3DVECTOR * top) { BASS_START(BASS_Get3DPosition(WIN_BASS_3DVECTOR * pos, WIN_BASS_3DVECTOR * vel, WIN_BASS_3DVECTOR * front, WIN_BASS_3DVECTOR * top)); BASS_RETURNBOOL(BASS_Get3DPosition((BASS_3DVECTOR*)pos, (BASS_3DVECTOR*)vel, (BASS_3DVECTOR*)front, (BASS_3DVECTOR*)top)); } /****************************************************************** * BASS_GetCPU (BASS.47) * * */ float __stdcall WIN_BASS_GetCPU(void) { BASS_START(BASS_GetCPU(void)); BASS_RETURN(float, BASS_GetCPU()); } /****************************************************************** * BASS_GetConfig (BASS.48) * * */ DWORD __stdcall WIN_BASS_GetConfig(DWORD option) { BASS_START(BASS_GetConfig(DWORD option)); BASS_RETURN(LIN_DWORD, BASS_GetConfig(option)); } /****************************************************************** * BASS_GetConfigPtr (BASS.49) * * */ #if BASSDLLVER >= BASSDLLVER_2417 const #endif void * __stdcall WIN_BASS_GetConfigPtr(DWORD option) { BASS_START(BASS_GetConfigPtr(DWORD option)); BASS_RETURN( #if BASSDLLVER >= BASSDLLVER_2417 const #endif void*, #if BASSDLLVER <= BASSDLLVER_2415 (void*) #endif BASS_GetConfigPtr(option)); } /****************************************************************** * BASS_GetDSoundObject (BASS.50) * * */ void * __stdcall WIN_BASS_GetDSoundObject(DWORD object) { BASS_START(BASS_GetDSoundObject(DWORD object)); WINE_FIXME("stub (there's no BASS_GetDSoundObject on Linux)"); return NULL; } /****************************************************************** * BASS_GetDevice (BASS.51) * * */ DWORD __stdcall WIN_BASS_GetDevice(void) { BASS_START(BASS_GetDevice(void)); DWORD ret = BASS_GetDevice(); // WINE_TRACE("BASS_GetDevice() = %u", ret); PRINT3("BASS_GetDevice() = %u", ret); return ret; } /****************************************************************** * BASS_GetDeviceInfo (BASS.52) * * */ BOOL __stdcall WIN_BASS_GetDeviceInfo(DWORD device, WIN_BASS_DEVICEINFO * info) { BASS_START(BASS_GetDeviceInfo(DWORD device, WIN_BASS_DEVICEINFO * info)); LIN_BOOL ret = BASS_GetDeviceInfo(device, (BASS_DEVICEINFO*)info); if (ret) { PRINT3("BASS_GetDeviceInfo(%u, ...) = { name: %s, driver: %s, flags: %u }", device, info->name, info->driver, info->flags); } else { PRINT3("BASS_GetDeviceInfo(%u, ...) failed!", device); } return ret ? TRUE : FALSE; } /****************************************************************** * BASS_GetEAXParameters (BASS.53) * * */ #if BASSDLLVER <= BASSDLLVER_2415 BOOL __stdcall WIN_BASS_GetEAXParameters(DWORD * env, float * vol, float * decay, float * damp) { BASS_START(BASS_GetEAXParameters(DWORD * env, float * vol, float * decay, float * damp)); WINE_FIXME("stub (there's no BASS_GetEAXParameters on Linux)"); return FALSE; } #endif /****************************************************************** * BASS_GetInfo (BASS.54) * * */ BOOL __stdcall WIN_BASS_GetInfo(WIN_BASS_INFO * info) { BASS_START(BASS_GetInfo(WIN_BASS_INFO * info)); LIN_BOOL ret = BASS_GetInfo((BASS_INFO*)info); if (ret) { PRINT3("BASS_GetInfo(...) = { flags: %u, minbuf: %u, latency: %u, initflags: %u, speakers: %u, freq: %u }", info->flags, info->minbuf, info->latency, info->initflags, info->speakers, info->freq); } else { PRINT2("BASS_GetInfo failed!"); } return ret ? TRUE : FALSE; } /****************************************************************** * BASS_GetVersion (BASS.55) * * */ DWORD __stdcall WIN_BASS_GetVersion(void) { BASS_START(BASS_GetVersion(void)); BASS_RETURN(LIN_DWORD, BASS_GetVersion()); } /****************************************************************** * BASS_GetVolume (BASS.56) * * */ float __stdcall WIN_BASS_GetVolume(void) { BASS_START(BASS_GetVolume(void)); BASS_RETURN(float, BASS_GetVolume()); } /****************************************************************** * BASS_Init (BASS.57) * * */ BOOL __stdcall WIN_BASS_Init(int device, DWORD freq, DWORD flags, HWND win, const #if BASSDLLVER <= BASSDLLVER_2415 GUID #elif BASSDLLVER >= BASSDLLVER_2417 void #endif *dsguid) { BASS_START(BASS_Init(int device, DWORD freq, DWORD flags, HWND win, const void * dsguid)); DWORD origFlags = flags; if (flags & BASS_DEVICE_DSOUND) { flags &= ~BASS_DEVICE_DSOUND; } LIN_BOOL ret = BASS_Init(device, freq, flags, 0, dsguid); DWORD retu = ret ? 1 : 0; PRINT3("BASS_Init(%d, %u, %u, %p, %p) = %u", device, freq, origFlags, win, dsguid, retu); return ret ? TRUE : FALSE; } /****************************************************************** * BASS_IsStarted (BASS.58) * * */ #if BASSDLLVER <= BASSDLLVER_2415 BOOL #elif BASSDLLVER >= BASSDLLVER_2417 DWORD #endif __stdcall WIN_BASS_IsStarted(void) { BASS_START(BASS_IsStarted(void)); DWORD ret = BASS_IsStarted(); PRINT3("BASS_IsStarted() = %u", ret); return ret #if BASSDLLVER <= BASSDLLVER_2415 ? TRUE : FALSE #endif ; } /****************************************************************** * BASS_MusicFree (BASS.59) * * */ BOOL __stdcall WIN_BASS_MusicFree(WIN_HMUSIC handle) { BASS_START(BASS_MusicFree(WIN_HMUSIC handle)); wine_bass_user_data_remove(handle); BASS_RETURNBOOL(BASS_MusicFree(handle)); } /****************************************************************** * BASS_MusicLoad (BASS.60) * * */ WIN_HMUSIC __stdcall WIN_BASS_MusicLoad(BOOL mem, const void * file, WIN_QWORD offset, DWORD length, DWORD flags, DWORD freq) { BASS_START(BASS_MusicLoad(BOOL mem, const void * file, WIN_QWORD offset, DWORD length, DWORD flags, DWORD freq)); if (mem) { BASS_RETURN(HMUSIC, BASS_MusicLoad(mem, file, offset, length, flags, freq)); } else { char *linuxname = wine_bass_to_linux_filename(file, flags); if (linuxname) { DWORD flags2 = flags & ~BASS_UNICODE; WIN_HSTREAM ret = BASS_MusicLoad(mem, linuxname, offset, length, flags2, freq); if (linuxname) RtlFreeHeap(GetProcessHeap(), 0, linuxname); PRINT(BASS_MusicLoad); return ret; } else { WINE_FIXME("BASS_MusicLoad: couldn't wine_get_unix_file_name!"); BASS_RETURN(HMUSIC, BASS_MusicLoad(mem, file, offset, length, flags, freq)); } } } /****************************************************************** * BASS_Pause (BASS.61) * * */ BOOL __stdcall WIN_BASS_Pause(void) { BASS_START(BASS_Pause(void)); BASS_RETURNBOOL(BASS_Pause()); } /****************************************************************** * BASS_PluginFree (BASS.62) * * */ BOOL __stdcall WIN_BASS_PluginFree(WIN_HPLUGIN handle) { BASS_START(BASS_PluginFree(WIN_HPLUGIN handle)); BASS_RETURNBOOL(BASS_PluginFree(handle)); } /****************************************************************** * BASS_PluginGetInfo (BASS.63) * * */ const WIN_BASS_PLUGININFO * __stdcall WIN_BASS_PluginGetInfo(WIN_HPLUGIN handle) { BASS_START(PLUGININFO * __stdcall WIN_BASS_PluginGetInfo(WIN_HPLUGIN handle)); BASS_RETURN(const WIN_BASS_PLUGININFO*, (const WIN_BASS_PLUGININFO*)BASS_PluginGetInfo(handle)); } /****************************************************************** * BASS_PluginLoad (BASS.64) * * */ WIN_HPLUGIN __stdcall WIN_BASS_PluginLoad(const char * file, DWORD flags) { BASS_START(BASS_PluginLoad(const char * file, DWORD flags)); if (flags & BASS_UNICODE) WINE_FIXME("BASS_PluginLoad: This might not work!"); if (flags & BASS_PLUGIN_PROC) WINE_FIXME("BASS_PluginLoad: Using BASS_PLUGIN_PROC! This will most likely result in a crash!"); else WINE_FIXME("BASS_PluginLoad: loading %s. This might not work!", file); BASS_RETURN(HPLUGIN, BASS_PluginLoad(file, flags)); } /****************************************************************** * BASS_RecordFree (BASS.65) * * */ BOOL __stdcall WIN_BASS_RecordFree(void) { BASS_START(BASS_RecordFree(void)); BASS_RETURNBOOL(BASS_RecordFree()); } /****************************************************************** * BASS_RecordGetDevice (BASS.66) * * */ DWORD __stdcall WIN_BASS_RecordGetDevice(void) { BASS_START(BASS_RecordGetDevice(void)); BASS_RETURN(LIN_DWORD, BASS_RecordGetDevice()); } /****************************************************************** * BASS_RecordGetDeviceInfo (BASS.67) * * */ BOOL __stdcall WIN_BASS_RecordGetDeviceInfo(DWORD device, WIN_BASS_DEVICEINFO * info) { BASS_START(BASS_RecordGetDeviceInfo(DWORD device, WIN_BASS_DEVICEINFO * info)); BASS_RETURNBOOL(BASS_RecordGetDeviceInfo(device, (BASS_DEVICEINFO*)info)); } /****************************************************************** * BASS_RecordGetInfo (BASS.68) * * */ BOOL __stdcall WIN_BASS_RecordGetInfo(WIN_BASS_RECORDINFO * info) { BASS_START(BASS_RecordGetInfo(WIN_BASS_RECORDINFO * info)); BASS_RETURNBOOL(BASS_RecordGetInfo((BASS_RECORDINFO*)info)); } /****************************************************************** * BASS_RecordGetInput (BASS.69) * * */ DWORD __stdcall WIN_BASS_RecordGetInput(int input, float * volume) { BASS_START(BASS_RecordGetInput(int input, float * volume)); BASS_RETURN(LIN_DWORD, BASS_RecordGetInput(input, volume)); } /****************************************************************** * BASS_RecordGetInputName (BASS.70) * * */ const char * __stdcall WIN_BASS_RecordGetInputName(int input) { BASS_START(BASS_RecordGetInputName(int input)); BASS_RETURN(const char*, BASS_RecordGetInputName(input)); } /****************************************************************** * BASS_RecordInit (BASS.71) * * */ BOOL __stdcall WIN_BASS_RecordInit(int device) { BASS_START(BASS_RecordInit(int device)); BASS_RETURNBOOL(BASS_RecordInit(device)); } /****************************************************************** * BASS_RecordSetDevice (BASS.72) * * */ BOOL __stdcall WIN_BASS_RecordSetDevice(DWORD device) { BASS_START(BASS_RecordSetDevice(DWORD device)); BASS_RETURNBOOL(BASS_RecordSetDevice(device)); } /****************************************************************** * BASS_RecordSetInput (BASS.73) * * */ BOOL __stdcall WIN_BASS_RecordSetInput(int input, DWORD flags, float volume) { BASS_START(BASS_RecordSetInput(int input, DWORD flags, float volume)); BASS_RETURNBOOL(BASS_RecordSetInput(input, flags, volume)); } /****************************************************************** * BASS_RecordStart (BASS.74) * * */ typedef struct { WIN_RECORDPROC *proc; void *user; } RecordUserData; LIN_BOOL wine_bass_recordproc_wrapper(HRECORD handle, const void *buffer, LIN_DWORD length, void *user) { RecordUserData *user_new = user; PRINT(user_new->proc(handle, buffer, length, user_new->user)); BOOL ret = user_new->proc(handle, buffer, length, user_new->user); return ret ? 1 : 0; } LIN_BOOL wine_bass_recordproc_wrapper_nouser(HRECORD handle, const void *buffer, LIN_DWORD length, void *user) { WIN_RECORDPROC *proc = user; PRINT(proc(handle, buffer, length, NULL)); BOOL ret = proc(handle, buffer, length, NULL); return ret ? 1 : 0; } WIN_HRECORD __stdcall WIN_BASS_RecordStart(DWORD freq, DWORD chans, DWORD flags, WIN_RECORDPROC * proc, void * user) { BASS_START(BASS_RecordStart(DWORD freq, DWORD chans, DWORD flags, WIN_RECORDPROC * proc, void * user)); if (user) { RecordUserData *user_new = malloc(sizeof(RecordUserData)); user_new->proc = proc; user_new->user = user; WIN_HRECORD ret = BASS_RecordStart(freq, chans, flags, wine_bass_recordproc_wrapper, user_new); if (ret) wine_bass_user_data_add(ret, user_new); else free(user_new); PRINT(BASS_RecordStart); return ret; } else { BASS_RETURN(HRECORD, BASS_RecordStart(freq, chans, flags, wine_bass_recordproc_wrapper_nouser, proc)); } } /****************************************************************** * BASS_SampleCreate (BASS.75) * * */ WIN_HSAMPLE __stdcall WIN_BASS_SampleCreate(DWORD length, DWORD freq, DWORD chans, DWORD max, DWORD flags) { BASS_START(BASS_SampleCreate(DWORD length, DWORD freq, DWORD chans, DWORD max, DWORD flags)); BASS_RETURN(HSAMPLE, BASS_SampleCreate(length, freq, chans, max, flags)); } /****************************************************************** * BASS_SampleFree (BASS.76) * * */ BOOL __stdcall WIN_BASS_SampleFree(WIN_HSAMPLE handle) { BASS_START(BASS_SampleFree(WIN_HSAMPLE handle)); wine_bass_user_data_remove(handle); BASS_RETURNBOOL(BASS_SampleFree(handle)); } /****************************************************************** * BASS_SampleGetChannel (BASS.77) * * */ DWORD __stdcall WIN_BASS_SampleGetChannel(WIN_HSAMPLE handle, #if BASSDLLVER <= BASSDLLVER_2415 BOOL onlynew #elif BASSDLLVER >= BASSDLLVER_2417 DWORD flags #endif ) { BASS_START(BASS_SampleGetChannel(WIN_HSAMPLE handle, DWORD flags)); #if BASSDLLVER <= BASSDLLVER_2415 DWORD flags = 0; if (onlynew) flags |= BASS_SAMCHAN_NEW; #endif BASS_RETURN(LIN_DWORD, BASS_SampleGetChannel(handle, flags)); } /****************************************************************** * BASS_SampleGetChannels (BASS.78) * * */ DWORD __stdcall WIN_BASS_SampleGetChannels(WIN_HSAMPLE handle, WIN_HCHANNEL * channels) { BASS_START(BASS_SampleGetChannels(WIN_HSAMPLE handle, WIN_HCHANNEL * channels)); BASS_RETURN(LIN_DWORD, BASS_SampleGetChannels(handle, (HCHANNEL*)channels)); } /****************************************************************** * BASS_SampleGetData (BASS.79) * * */ BOOL __stdcall WIN_BASS_SampleGetData(WIN_HSAMPLE handle, void * buffer) { BASS_START(BASS_SampleGetData(WIN_HSAMPLE handle, void * buffer)); BASS_RETURNBOOL(BASS_SampleGetData(handle, buffer)); } /****************************************************************** * BASS_SampleGetInfo (BASS.80) * * */ BOOL __stdcall WIN_BASS_SampleGetInfo(WIN_HSAMPLE handle, WIN_BASS_SAMPLE * info) { BASS_START(BASS_SampleGetInfo(WIN_HSAMPLE handle, WIN_BASS_SAMPLE * info)); BASS_RETURNBOOL(BASS_SampleGetInfo(handle, (BASS_SAMPLE*)info)); } /****************************************************************** * BASS_SampleLoad (BASS.81) * * */ WIN_HSAMPLE __stdcall WIN_BASS_SampleLoad(BOOL mem, const void * file, WIN_QWORD offset, DWORD length, DWORD max, DWORD flags) { BASS_START(BASS_SampleLoad(BOOL mem, const void * file, WIN_QWORD offset, DWORD length, DWORD max, DWORD flags)); if (mem) { PRINT3("BASS_SampleLoad(mem=1, flags=%u)", flags); return BASS_SampleLoad(mem, file, offset, length, max, flags); } else { char *linuxname = wine_bass_to_linux_filename(file, flags); if (linuxname) { DWORD flags2 = flags & ~BASS_UNICODE; WIN_HSAMPLE ret = BASS_SampleLoad(mem, linuxname, offset, length, max, flags2); if (linuxname) RtlFreeHeap(GetProcessHeap(), 0, linuxname); PRINT3("BASS_SampleLoad(mem=0, fn=%s, flags=%u)", linuxname, flags); return ret; } else { WINE_FIXME("BASS_SampleLoad: couldn't wine_get_unix_file_name!"); BASS_RETURN(HSAMPLE, BASS_SampleLoad(mem, file, offset, length, max, flags)); } } } /****************************************************************** * BASS_SampleSetData (BASS.82) * * */ BOOL __stdcall WIN_BASS_SampleSetData(WIN_HSAMPLE handle, const void * buffer) { BASS_START(BASS_SampleSetData(WIN_HSAMPLE handle, void * buffer)); BASS_RETURNBOOL(BASS_SampleSetData(handle, buffer)); } /****************************************************************** * BASS_SampleSetInfo (BASS.83) * * */ BOOL __stdcall WIN_BASS_SampleSetInfo(WIN_HSAMPLE handle, const WIN_BASS_SAMPLE * info) { BASS_START(BASS_SampleSetInfo(WIN_HSAMPLE handle, const WIN_BASS_SAMPLE * info)); BASS_RETURNBOOL(BASS_SampleSetInfo(handle, (BASS_SAMPLE*)info)); } /****************************************************************** * BASS_SampleStop (BASS.84) * * */ BOOL __stdcall WIN_BASS_SampleStop(WIN_HSAMPLE handle) { BASS_START(BASS_SampleStop(WIN_HSAMPLE handle)); BASS_RETURNBOOL(BASS_SampleStop(handle)); } /****************************************************************** * BASS_Set3DFactors (BASS.85) * * */ BOOL __stdcall WIN_BASS_Set3DFactors(float distf, float rollf, float doppf) { BASS_START(BASS_Set3DFactors(float distf, float rollf, float doppf)); BASS_RETURNBOOL(BASS_Set3DFactors(distf, rollf, doppf)); } /****************************************************************** * BASS_Set3DPosition (BASS.86) * * */ BOOL __stdcall WIN_BASS_Set3DPosition(const WIN_BASS_3DVECTOR * pos, const WIN_BASS_3DVECTOR * vel, const WIN_BASS_3DVECTOR * front, const WIN_BASS_3DVECTOR * top) { BASS_START(BASS_Set3DPosition(WIN_BASS_3DVECTOR * pos, WIN_BASS_3DVECTOR * vel, WIN_BASS_3DVECTOR * front, WIN_BASS_3DVECTOR * top)); BASS_RETURNBOOL(BASS_Set3DPosition((BASS_3DVECTOR*)pos, (BASS_3DVECTOR*)vel, (BASS_3DVECTOR*)front, (BASS_3DVECTOR*)top)); } /****************************************************************** * BASS_SetConfig (BASS.87) * * */ STATIC_ASSERT_BASIC(BASS_CONFIG_IOS_MIXAUDIO == BASS_CONFIG_IOS_SESSION); static inline const char *wine_bass_option_name(DWORD option, BOOL *thread) { if (option & BASS_CONFIG_THREAD) { option &= ~BASS_CONFIG_THREAD; *thread = TRUE; } else { *thread = FALSE; } switch (option) { case BASS_CONFIG_3DALGORITHM: return "BASS_CONFIG_3DALGORITHM"; case BASS_CONFIG_AIRPLAY: return "BASS_CONFIG_AIRPLAY"; case BASS_CONFIG_AM_DISABLE: return "BASS_CONFIG_AM_DISABLE"; case BASS_CONFIG_ANDROID_AAUDIO: return "BASS_CONFIG_ANDROID_AAUDIO"; case BASS_CONFIG_ANDROID_SESSIONID: return "BASS_CONFIG_ANDROID_SESSIONID"; case BASS_CONFIG_ANDROID_JAVAVM: return "BASS_CONFIG_ANDROID_JAVAVM"; case BASS_CONFIG_ASYNCFILE_BUFFER: return "BASS_CONFIG_ASYNCFILE_BUFFER"; case BASS_CONFIG_BUFFER: return "BASS_CONFIG_BUFFER"; case BASS_CONFIG_CURVE_PAN: return "BASS_CONFIG_CURVE_PAN"; case BASS_CONFIG_CURVE_VOL: return "BASS_CONFIG_CURVE_VOL"; case BASS_CONFIG_DEV_BUFFER: return "BASS_CONFIG_DEV_BUFFER"; case BASS_CONFIG_DEV_DEFAULT: return "BASS_CONFIG_DEV_DEFAULT"; case BASS_CONFIG_DEV_NONSTOP: return "BASS_CONFIG_DEV_NONSTOP"; case BASS_CONFIG_DEV_PERIOD: return "BASS_CONFIG_DEV_PERIOD"; case 70: return "BASS_CONFIG_DEV_TIMEOUT"; case BASS_CONFIG_FILENAME: return "BASS_CONFIG_FILENAME"; case BASS_CONFIG_FLOAT: return "BASS_CONFIG_FLOAT"; case BASS_CONFIG_FLOATDSP: return "BASS_CONFIG_FLOATDSP"; case BASS_CONFIG_GVOL_MUSIC: return "BASS_CONFIG_GVOL_MUSIC"; case BASS_CONFIG_GVOL_SAMPLE: return "BASS_CONFIG_GVOL_SAMPLE"; case BASS_CONFIG_GVOL_STREAM: return "BASS_CONFIG_GVOL_STREAM"; case BASS_CONFIG_HANDLES: return "BASS_CONFIG_HANDLES"; case BASS_CONFIG_IOS_MIXAUDIO: return "BASS_CONFIG_IOS_MIXAUDIO/BASS_CONFIG_IOS_SESSION"; case BASS_CONFIG_IOS_NOCATEGORY: return "BASS_CONFIG_IOS_NOCATEGORY"; case BASS_CONFIG_IOS_NOTIFY: return "BASS_CONFIG_IOS_NOTIFY"; case BASS_CONFIG_IOS_SPEAKER: return "BASS_CONFIG_IOS_SPEAKER"; case BASS_CONFIG_LIBSSL: return "BASS_CONFIG_LIBSSL"; case BASS_CONFIG_MF_DISABLE: return "BASS_CONFIG_MF_DISABLE"; case BASS_CONFIG_MF_VIDEO: return "BASS_CONFIG_MF_VIDEO"; case 68: return "BASS_CONFIG_MP3_OLDGAPS"; case BASS_CONFIG_MUSIC_VIRTUAL: return "BASS_CONFIG_MUSIC_VIRTUAL"; case BASS_CONFIG_NET_AGENT: return "BASS_CONFIG_NET_AGENT"; case BASS_CONFIG_NET_BUFFER: return "BASS_CONFIG_NET_BUFFER"; case BASS_CONFIG_NET_META: return "BASS_CONFIG_NET_META"; case BASS_CONFIG_NET_PASSIVE: return "BASS_CONFIG_NET_PASSIVE"; case BASS_CONFIG_NET_PLAYLIST: return "BASS_CONFIG_NET_PLAYLIST"; case BASS_CONFIG_NET_PLAYLIST_DEPTH: return "BASS_CONFIG_NET_PLAYLIST_DEPTH"; case BASS_CONFIG_NET_PROXY: return "BASS_CONFIG_NET_PROXY"; case BASS_CONFIG_NET_PREBUF: return "BASS_CONFIG_NET_PREBUF"; case BASS_CONFIG_NET_PREBUF_WAIT: return "BASS_CONFIG_NET_PREBUF_WAIT"; case BASS_CONFIG_NET_READTIMEOUT: return "BASS_CONFIG_NET_READTIMEOUT"; case BASS_CONFIG_NET_RESTRATE: return "BASS_CONFIG_NET_RESTRATE"; case BASS_CONFIG_NET_SEEK: return "BASS_CONFIG_NET_SEEK"; case BASS_CONFIG_NET_TIMEOUT: return "BASS_CONFIG_NET_TIMEOUT"; case BASS_CONFIG_NORAMP: return "BASS_CONFIG_NORAMP"; case BASS_CONFIG_OGG_PRESCAN: return "BASS_CONFIG_OGG_PRESCAN"; case BASS_CONFIG_PAUSE_NOPLAY: return "BASS_CONFIG_PAUSE_NOPLAY"; case BASS_CONFIG_REC_BUFFER: return "BASS_CONFIG_REC_BUFFER"; case BASS_CONFIG_REC_DEFAULT: return "BASS_CONFIG_REC_DEFAULT"; case BASS_CONFIG_REC_LOOPBACK: return "BASS_CONFIG_REC_LOOPBACK"; case BASS_CONFIG_REC_WASAPI: return "BASS_CONFIG_REC_WASAPI"; case BASS_CONFIG_SAMPLE_ONEHANDLE: return "BASS_CONFIG_SAMPLE_ONEHANDLE"; case BASS_CONFIG_SRC: return "BASS_CONFIG_SRC"; case BASS_CONFIG_SRC_SAMPLE: return "BASS_CONFIG_SRC_SAMPLE"; case BASS_CONFIG_UNICODE: return "BASS_CONFIG_UNICODE"; case BASS_CONFIG_UPDATEPERIOD: return "BASS_CONFIG_UPDATEPERIOD"; case BASS_CONFIG_UPDATETHREADS: return "BASS_CONFIG_UPDATETHREADS"; case BASS_CONFIG_VERIFY: return "BASS_CONFIG_VERIFY"; case BASS_CONFIG_VERIFY_NET: return "BASS_CONFIG_VERIFY_NET"; case BASS_CONFIG_VISTA_SPEAKERS: return "BASS_CONFIG_VISTA_SPEAKERS"; case BASS_CONFIG_VISTA_TRUEPOS: return "BASS_CONFIG_VISTA_TRUEPOS"; case BASS_CONFIG_WASAPI_PERSIST: return "BASS_CONFIG_WASAPI_PERSIST"; default: return NULL; } } BOOL __stdcall WIN_BASS_SetConfig(DWORD option, DWORD value) { BASS_START(BASS_SetConfig(DWORD option, DWORD value)); LIN_BOOL ret; switch (option) { case BASS_CONFIG_MF_DISABLE: WINE_FIXME("stub: BASS_CONFIG_MF_DISABLE not supported!"); return TRUE; case BASS_CONFIG_MF_VIDEO: WINE_FIXME("stub: BASS_CONFIG_MF_VIDEO not supported!"); return TRUE; case BASS_CONFIG_REC_WASAPI: WINE_FIXME("stub: BASS_CONFIG_REC_WASAPI not supported!"); return TRUE; case BASS_CONFIG_WASAPI_PERSIST: WINE_FIXME("stub: BASS_CONFIG_WASAPI_PERSIST not supported!"); return TRUE; default: ret = BASS_SetConfig(option, value); { LIN_BOOL thread; const char *name = wine_bass_option_name(option, &thread); DWORD retu = ret ? 1 : 0; if (name) { const char *threads = thread ? "|BASS_CONFIG_THREAD" : ""; PRINT3("BASS_SetConfig(%s%s, %u) = %u", name, threads, value, retu); } else { PRINT3("BASS_SetConfig(%u, %u) = %u", option, value, retu); } } return ret ? TRUE : FALSE; } } /****************************************************************** * BASS_SetConfigPtr (BASS.88) * * */ BOOL __stdcall WIN_BASS_SetConfigPtr(DWORD option, const void * value) { BASS_START(BASS_SetConfigPtr(DWORD option, const void * value)); BASS_RETURNBOOL(BASS_SetConfigPtr(option, value)); } /****************************************************************** * BASS_SetDevice (BASS.89) * * */ BOOL __stdcall WIN_BASS_SetDevice(DWORD device) { BASS_START(BASS_SetDevice(DWORD device)); BASS_RETURNBOOL(BASS_SetDevice(device)); } /****************************************************************** * BASS_SetEAXParameters (BASS.90) * * */ #if BASSDLLVER <= BASSDLLVER_2415 BOOL __stdcall WIN_BASS_SetEAXParameters(int env, float vol, float decay, float damp) { BASS_START(BASS_SetEAXParameters(int env, float vol, float decay, float damp)); WINE_FIXME("stub (there's no BASS_SetEAXParameters on Linux)"); return FALSE; } #endif /****************************************************************** * BASS_SetVolume (BASS.91) * * */ BOOL __stdcall WIN_BASS_SetVolume(float volume) { BASS_START(BASS_SetVolume(float volume)); BASS_RETURNBOOL(BASS_SetVolume(volume)); } /****************************************************************** * BASS_Start (BASS.92) * * */ BOOL __stdcall WIN_BASS_Start(void) { BASS_START(BASS_Start(void)); BASS_RETURNBOOL(BASS_Start()); } /****************************************************************** * BASS_Stop (BASS.93) * * */ BOOL __stdcall WIN_BASS_Stop(void) { BASS_START(BASS_Stop(void)); BASS_RETURNBOOL(BASS_Stop()); } /****************************************************************** * BASS_StreamCreate (BASS.94) * * */ typedef struct { WIN_STREAMPROC *proc; void *user; } StreamUserData; LIN_DWORD wine_bass_streamproc_wrapper(HSTREAM handle, void *buffer, LIN_DWORD length, void *user) { StreamUserData *user_new = user; BASS_RETURN(DWORD, user_new->proc(handle, buffer, length, user_new->user)); } LIN_DWORD wine_bass_streamproc_wrapper_nouser(HSTREAM handle, void *buffer, LIN_DWORD length, void *user) { WIN_STREAMPROC *proc = user; BASS_RETURN(DWORD, proc(handle, buffer, length, NULL)); } WIN_HSTREAM __stdcall WIN_BASS_StreamCreate(DWORD freq, DWORD chans, DWORD flags, WIN_STREAMPROC * proc, void * user) { BASS_START(BASS_StreamCreate(DWORD freq, DWORD chans, DWORD flags, WIN_STREAMPROC * proc, void * user)); if (user) { StreamUserData *user_new = malloc(sizeof(StreamUserData)); user_new->proc = proc; user_new->user = user; WIN_HSTREAM ret = BASS_StreamCreate(freq, chans, flags, wine_bass_streamproc_wrapper, user_new); if (ret) wine_bass_user_data_add(ret, user_new); else free(user_new); PRINT(BASS_StreamCreate); return ret; } else { BASS_RETURN(HSTREAM, BASS_StreamCreate(freq, chans, flags, wine_bass_streamproc_wrapper_nouser, proc)); } } /****************************************************************** * BASS_StreamCreateFile (BASS.95) * * */ WIN_HSTREAM __stdcall WIN_BASS_StreamCreateFile(BOOL mem, const void * file, WIN_QWORD offset, WIN_QWORD length, DWORD flags) { BASS_START(BASS_StreamCreateFile(BOOL mem, const void * file, WIN_QWORD offset, WIN_QWORD length, DWORD flags)); if (mem) { BASS_RETURN(HSTREAM, BASS_StreamCreateFile(mem, file, offset, length, flags)); } else { char *linuxname = wine_bass_to_linux_filename(file, flags); if (linuxname) { DWORD flags2 = flags & ~BASS_UNICODE; WIN_HSTREAM ret = BASS_StreamCreateFile(mem, linuxname, offset, length, flags2); if (linuxname) RtlFreeHeap(GetProcessHeap(), 0, linuxname); PRINT(BASS_StreamCreateFile); return ret; } else { WINE_FIXME("BASS_StreamCreateFile: couldn't wine_get_unix_file_name!"); BASS_RETURN(HSTREAM, BASS_StreamCreateFile(mem, file, offset, length, flags)); } } } /****************************************************************** * BASS_StreamCreateFileUser (BASS.96) * * */ typedef struct { WIN_BASS_FILEPROCS procs; WIN_QWORD current_pos; WIN_QWORD max_length; void *user; } FileUserData; static FILE *fileproc_file; void wine_bass_fileproc_close_wrapper(void *user) { FileUserData *user_new = user; WIN_FILECLOSEPROC *proc = user_new->procs.close; void *user2 = user_new->user; free(user_new); if (fileproc_file) fclose(fileproc_file); fileproc_file = NULL; PRINT3("file->close(%p)", user2); return proc(user2); } LIN_QWORD wine_bass_fileproc_length_wrapper(void *user) { FileUserData *user_new = user; LIN_QWORD ret = user_new->procs.length(user_new->user); PRINT3("file->length(%p) = %lu", user_new->user, ret); if (user_new->max_length == -1 && ret && fileproc_file) { PRINT2("check succeeded"); user_new->max_length = ret; LIN_QWORD tmp = ret; if (user_new->procs.seek(0, user_new->user)) { PRINT2("check2 succeeded"); char *buf = malloc(ret); char *buf2 = buf; char *bufend = &buf[ret]; while ((buf2 += user_new->procs.read(buf2, bufend - buf2, user_new->user)) != bufend); tmp = ret; if (user_new->procs.seek(0, user_new->user)) { while (tmp -= fwrite(buf, 1, tmp, fileproc_file)); fclose(fileproc_file); PRINT2("check3 succeeded"); fileproc_file = NULL; } else { ret = 0; } free(buf); } else { char buf[8192]; memset(buf, 0, 8192); while (tmp) { size_t to_write = tmp > 8192 ? 8192 : tmp; tmp -= fwrite(buf, 1, to_write, fileproc_file); } fseek(fileproc_file, 0, SEEK_CUR); } } return ret; } LIN_DWORD wine_bass_fileproc_read_wrapper(void *buffer, LIN_DWORD length, void *user) { FileUserData *user_new = user; LIN_DWORD max_length = user_new->max_length <= user_new->current_pos ? 0 : user_new->max_length - user_new->current_pos; DWORD actual_length = length > max_length ? max_length : length; DWORD ret = user_new->procs.read(buffer, actual_length, user_new->user); PRINT3("file->read(%p)(%p, %u) = %u / wrote at pos %lu", user_new->user, buffer, length, ret, user_new->current_pos); user_new->current_pos += ret; if (fileproc_file) fwrite(buffer, ret, 1, fileproc_file); return ret; } LIN_BOOL wine_bass_fileproc_seek_wrapper(LIN_QWORD offset, void *user) { FileUserData *user_new = user; LIN_BOOL ret = user_new->procs.seek(offset, user_new->user); DWORD retu = ret ? 1 : 0; PRINT3("file->seek(%p)(%lu) = %u", user_new->user, offset, retu); if (ret) { user_new->current_pos = offset; if (fileproc_file) fseek(fileproc_file, offset, SEEK_SET); } return ret ? TRUE : FALSE; } static BASS_FILEPROCS WINE_FILE_PROC_WRAPPERS = { .close = wine_bass_fileproc_close_wrapper, .length = wine_bass_fileproc_length_wrapper, .read = wine_bass_fileproc_read_wrapper, .seek = wine_bass_fileproc_seek_wrapper, }; WIN_HSTREAM __stdcall WIN_BASS_StreamCreateFileUser(DWORD system, DWORD flags, const WIN_BASS_FILEPROCS * proc, void * user) { if (!proc && !user) BASS_RETURN(HSTREAM, BASS_StreamCreateFileUser(system, flags, NULL, NULL)); BASS_START(BASS_StreamCreateFileUser(DWORD system, DWORD flags, const WIN_BASS_FILEPROCS * proc, void * user)); FileUserData *user_new = malloc(sizeof(FileUserData)); user_new->procs = *proc; user_new->user = user; user_new->current_pos = 0; user_new->max_length = -1; fileproc_file = fopen("/tmp/bass_file.bin", "wb"); WIN_HSTREAM ret = BASS_StreamCreateFileUser(system, flags, &WINE_FILE_PROC_WRAPPERS, user_new); if (!ret) free(user_new); PRINT3("BASS_StreamCreateFileUser(%u, %u, %p, %p) = %u", system, flags, proc, user, ret); return ret; } /****************************************************************** * BASS_StreamCreateURL (BASS.97) * * */ typedef struct { WIN_DOWNLOADPROC *proc; void *user; } DownloadUserData; void wine_bass_downloadproc_wrapper(const void *buffer, LIN_DWORD length, void *user) { DownloadUserData *user_new = user; BASS_RETURNVOID(user_new->proc(buffer, length, user_new->user)); } void wine_bass_downloadproc_wrapper_nouser(const void *buffer, LIN_DWORD length, void *user) { WIN_DOWNLOADPROC *proc = user; BASS_RETURNVOID(proc(buffer, length, NULL)); } WIN_HSTREAM __stdcall WIN_BASS_StreamCreateURL(const char * url, DWORD offset, DWORD flags, WIN_DOWNLOADPROC * proc, void * user) { BASS_START(BASS_StreamCreateURL(const char * url, DWORD offset, DWORD flags, WIN_DOWNLOADPROC * proc, void * user)); if (user) { DownloadUserData *user_new = malloc(sizeof(DownloadUserData)); user_new->proc = proc; user_new->user = user; WIN_HSTREAM ret = BASS_StreamCreateURL(url, offset, flags, wine_bass_downloadproc_wrapper, user_new); if (ret) wine_bass_user_data_add(ret, user_new); else free(user_new); PRINT(BASS_StreamCreateUrl); return ret; } else { BASS_RETURN(HSTREAM, BASS_StreamCreateURL(url, offset, flags, wine_bass_downloadproc_wrapper_nouser, proc)); } } /****************************************************************** * BASS_StreamFree (BASS.98) * * */ BOOL __stdcall WIN_BASS_StreamFree(WIN_HSTREAM handle) { BASS_START(BASS_StreamFree(WIN_HSTREAM handle)); wine_bass_user_data_remove(handle); BASS_RETURNBOOL(BASS_StreamFree(handle)); } /****************************************************************** * BASS_StreamGetFilePosition (BASS.99) * * */ WIN_QWORD __stdcall WIN_BASS_StreamGetFilePosition(WIN_HSTREAM handle, DWORD mode) { BASS_START(BASS_StreamGetFilePosition(WIN_HSTREAM handle, DWORD mode)); BASS_RETURN(LIN_QWORD, BASS_StreamGetFilePosition(handle, mode)); } /****************************************************************** * BASS_StreamPutData (BASS.100) * * */ DWORD __stdcall WIN_BASS_StreamPutData(WIN_HSTREAM handle, const void * buffer, DWORD length) { BASS_START(BASS_StreamPutData(WIN_HSTREAM handle, const void * buffer, DWORD length)); BASS_RETURN(LIN_QWORD, BASS_StreamPutData(handle, buffer, length)); } /****************************************************************** * BASS_StreamPutFileData (BASS.101) * * */ DWORD __stdcall WIN_BASS_StreamPutFileData(WIN_HSTREAM handle, const void * buffer, DWORD length) { BASS_START(BASS_StreamPutFileData(WIN_HSTREAM handle, const void * buffer, DWORD length)); BASS_RETURN(LIN_DWORD, BASS_StreamPutFileData(handle, buffer, length)); } /****************************************************************** * BASS_Update (BASS.102) * * */ BOOL __stdcall WIN_BASS_Update(DWORD length) { BASS_START(BASS_Update(DWORD length)); BASS_RETURNBOOL(BASS_Update(length)); }