wine-bass/bass/bass_main.c

1349 lines
44 KiB
C
Raw Normal View History

2023-03-10 02:23:12 +07:00
/*
* bass.dll
*
*/
#include "bass_dll.h"
#include <stdarg.h>
#include <stdlib.h>
#include <pthread.h>
#include <unistd.h>
WINE_DEFAULT_DEBUG_CHANNEL(bass);
#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:", tid); \
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(X) {\
PRINT(X); \
return X; \
}
#define BASS_START(X) {\
PRINT2("start:" BASS_STRINGIFY(X)); \
}
/*
static char FILEBUFFF2[256];
static char FILEBUFFF[256];
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;
BOOL __stdcall wine_bass_user_data_add_ex(DWORD key, DWORD altKey, void *val) {
return FALSE;
pthread_mutex_lock(&WINE_BASS_DATA_STORAGE.mutex);
BOOL ret = TRUE;
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 {
WINE_BASS_DATA_STORAGE.data = realloc(WINE_BASS_DATA_STORAGE.data, 2 * WINE_BASS_DATA_STORAGE.capacity * sizeof(UserDataEntry));
}
}
if (!WINE_BASS_DATA_STORAGE.data) {
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;
}
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(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);
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 BASS_BASS_Apply3D(void) {
BASS_START(BASS_Apply3D(void));
BASS_RETURN(BASS_Apply3D());
}
/******************************************************************
* BASS_ChannelBytes2Seconds (BASS.2)
*
*
*/
double __stdcall BASS_BASS_ChannelBytes2Seconds(DWORD handle, WIN_QWORD pos) {
BASS_START(BASS_ChannelBytes2Seconds(DWORD handle, WIN_QWORD pos));
BASS_RETURN(BASS_ChannelBytes2Seconds(handle, pos));
}
/******************************************************************
* BASS_ChannelFlags (BASS.3)
*
*
*/
DWORD __stdcall BASS_BASS_ChannelFlags(DWORD handle, DWORD flags, DWORD mask) {
BASS_START(BASS_ChannelFlags(DWORD handle, DWORD flags, DWORD mask));
BASS_RETURN(BASS_ChannelFlags(handle, flags, mask));
}
/******************************************************************
* BASS_ChannelGet3DAttributes (BASS.4)
*
*
*/
BOOL __stdcall BASS_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_RETURN(BASS_ChannelGet3DAttributes(handle, mode, min, max, iangle, oangle, outvol));
}
/******************************************************************
* BASS_ChannelGet3DPosition (BASS.5)
*
*
*/
BOOL __stdcall BASS_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_RETURN(BASS_ChannelGet3DPosition(handle, pos, orient, vel));
}
/******************************************************************
* BASS_ChannelGetAttribute (BASS.6)
*
*
*/
BOOL __stdcall BASS_BASS_ChannelGetAttribute(DWORD handle, DWORD attrib, float * value) {
BASS_START(BASS_ChannelGetAttribute(DWORD handle, DWORD attrib, float * value));
BASS_RETURN(BASS_ChannelGetAttribute(handle, attrib, value));
}
/******************************************************************
* BASS_ChannelGetAttributeEx (BASS.7)
*
*
*/
DWORD __stdcall BASS_BASS_ChannelGetAttributeEx(DWORD handle, DWORD attrib, void * value, DWORD size) {
BASS_START(BASS_ChannelGetAttributeEx(DWORD handle, DWORD attrib, void * value, DWORD size));
BASS_RETURN(BASS_ChannelGetAttributeEx(handle, attrib, value, size));
}
/******************************************************************
* BASS_ChannelGetData (BASS.8)
*
*
*/
DWORD __stdcall BASS_BASS_ChannelGetData(DWORD handle, void * buffer, DWORD length) {
BASS_START(BASS_ChannelGetData(DWORD handle, void * buffer, DWORD length));
PRINT3("ChannelGetData %u %p %u", handle, buffer, length);
DWORD ret = BASS_ChannelGetData(handle, buffer, length);
PRINT3("ChannelGetData %u %p %u ret %u", handle, buffer, length, ret);
PRINT2("end:" BASS_STRINGIFY(BASS_ChannelGetData(DWORD handle, void * buffer, DWORD length))); \
return ret;
}
/******************************************************************
* BASS_ChannelGetDevice (BASS.9)
*
*
*/
DWORD __stdcall BASS_BASS_ChannelGetDevice(DWORD handle) {
BASS_START(BASS_ChannelGetDevice(DWORD handle));
BASS_RETURN(BASS_ChannelGetDevice(handle));
}
/******************************************************************
* BASS_ChannelGetInfo (BASS.10)
*
*
*/
BOOL __stdcall BASS_BASS_ChannelGetInfo(DWORD handle, WIN_BASS_CHANNELINFO * info) {
BASS_START(BASS_ChannelGetInfo(DWORD handle, WIN_BASS_CHANNELINFO * info));
BASS_RETURN(BASS_ChannelGetInfo(handle, info));
}
/******************************************************************
* BASS_ChannelGetLength (BASS.11)
*
*
*/
WIN_QWORD __stdcall BASS_BASS_ChannelGetLength(DWORD handle, DWORD mode) {
BASS_START(BASS_ChannelGetLength(DWORD handle, DWORD mode));
BASS_RETURN(BASS_ChannelGetLength(handle, mode));
}
/******************************************************************
* BASS_ChannelGetLevel (BASS.12)
*
*
*/
DWORD __stdcall BASS_BASS_ChannelGetLevel(DWORD handle) {
BASS_START(BASS_ChannelGetLevel(DWORD handle));
BASS_RETURN(BASS_ChannelGetLevel(handle));
}
/******************************************************************
* BASS_ChannelGetLevelEx (BASS.13)
*
*
*/
BOOL __stdcall BASS_BASS_ChannelGetLevelEx(DWORD handle, float * levels, float length, DWORD flags) {
BASS_START(BASS_ChannelGetLevelEx(DWORD handle, float * levels, float length, DWORD flags));
BASS_RETURN(BASS_ChannelGetLevelEx(handle, levels, length, flags));
}
/******************************************************************
* BASS_ChannelGetPosition (BASS.14)
*
*
*/
WIN_QWORD __stdcall BASS_BASS_ChannelGetPosition(DWORD handle, DWORD mode) {
BASS_START(BASS_ChannelGetPosition(DWORD handle, DWORD mode));
BASS_RETURN(BASS_ChannelGetPosition(handle, mode));
}
/******************************************************************
* BASS_ChannelGetTags (BASS.15)
*
*
*/
const char * __stdcall BASS_BASS_ChannelGetTags(DWORD handle, DWORD tags) {
BASS_START(BASS_ChannelGetTags(DWORD handle, DWORD tags));
BASS_RETURN(BASS_ChannelGetTags(handle, tags));
}
/******************************************************************
* BASS_ChannelIsActive (BASS.16)
*
*
*/
DWORD __stdcall BASS_BASS_ChannelIsActive(DWORD handle) {
BASS_START(BASS_ChannelIsActive(DWORD handle));
BASS_RETURN(BASS_ChannelIsActive(handle));
}
/******************************************************************
* BASS_ChannelIsSliding (BASS.17)
*
*
*/
BOOL __stdcall BASS_BASS_ChannelIsSliding(DWORD handle, DWORD attrib) {
BASS_START(BASS_ChannelIsSliding(DWORD handle, DWORD attrib));
BASS_RETURN(BASS_ChannelIsSliding(handle, attrib));
}
/******************************************************************
* BASS_ChannelLock (BASS.18)
*
*
*/
BOOL __stdcall BASS_BASS_ChannelLock(DWORD handle, BOOL lock) {
BASS_START(BASS_ChannelLock(DWORD handle, BOOL lock));
BASS_RETURN(BASS_ChannelLock(handle, lock));
}
/******************************************************************
* BASS_ChannelPause (BASS.19)
*
*
*/
BOOL __stdcall BASS_BASS_ChannelPause(DWORD handle) {
BASS_START(BASS_ChannelPause(DWORD handle));
BASS_RETURN(BASS_ChannelPause(handle));
}
/******************************************************************
* BASS_ChannelPlay (BASS.20)
*
*
*/
BOOL __stdcall BASS_BASS_ChannelPlay(DWORD handle, BOOL restart) {
BASS_START(BASS_ChannelPlay(DWORD handle, BOOL restart));
BASS_RETURN(BASS_ChannelPlay(handle, restart));
}
/******************************************************************
* BASS_ChannelRemoveDSP (BASS.21)
*
*
*/
BOOL __stdcall BASS_BASS_ChannelRemoveDSP(DWORD handle, WIN_HDSP dsp) {
BASS_START(BASS_ChannelRemoveDSP(DWORD handle, WIN_HDSP dsp));
wine_bass_user_data_remove(dsp);
BASS_RETURN(BASS_ChannelRemoveDSP(handle, dsp));
}
/******************************************************************
* BASS_ChannelRemoveFX (BASS.22)
*
*
*/
BOOL __stdcall BASS_BASS_ChannelRemoveFX(DWORD handle, WIN_HFX fx) {
BASS_START(BASS_ChannelRemoveFX(DWORD handle, WIN_HFX fx));
BASS_RETURN(BASS_ChannelRemoveFX(handle, fx));
}
/******************************************************************
* BASS_ChannelRemoveLink (BASS.23)
*
*
*/
BOOL __stdcall BASS_BASS_ChannelRemoveLink(DWORD handle, DWORD chan) {
BASS_START(BASS_ChannelRemoveLink(DWORD handle, DWORD chan));
BASS_RETURN(BASS_ChannelRemoveLink(handle, chan));
}
/******************************************************************
* BASS_ChannelRemoveSync (BASS.24)
*
*
*/
BOOL __stdcall BASS_BASS_ChannelRemoveSync(DWORD handle, WIN_HSYNC sync) {
BASS_START(BASS_ChannelRemoveSync(DWORD handle, WIN_HSYNC sync));
wine_bass_user_data_remove(sync);
BASS_RETURN(BASS_ChannelRemoveSync(handle, sync));
}
/******************************************************************
* BASS_ChannelSeconds2Bytes (BASS.25)
*
*
*/
WIN_QWORD __stdcall BASS_BASS_ChannelSeconds2Bytes(DWORD handle, double pos) {
BASS_START(BASS_ChannelSeconds2Bytes(DWORD handle, double pos));
BASS_RETURN(BASS_ChannelSeconds2Bytes(handle, pos));
}
/******************************************************************
* BASS_ChannelSet3DAttributes (BASS.26)
*
*
*/
BOOL __stdcall BASS_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_RETURN(BASS_ChannelSet3DAttributes(handle, mode, min, max, iangle, oangle, outvol));
}
/******************************************************************
* BASS_ChannelSet3DPosition (BASS.27)
*
*
*/
BOOL __stdcall BASS_BASS_ChannelSet3DPosition(DWORD handle, WIN_BASS_3DVECTOR * pos, WIN_BASS_3DVECTOR * orient, WIN_BASS_3DVECTOR * vel) {
BASS_START(BASS_ChannelSet3DPosition(DWORD handle, WIN_BASS_3DVECTOR * pos, WIN_BASS_3DVECTOR * orient, WIN_BASS_3DVECTOR * vel));
BASS_RETURN(BASS_ChannelSet3DPosition(handle, pos, orient, vel));
}
/******************************************************************
* BASS_ChannelSetAttribute (BASS.28)
*
*
*/
BOOL __stdcall BASS_BASS_ChannelSetAttribute(DWORD handle, DWORD attrib, float value) {
BASS_START(BASS_ChannelSetAttribute(DWORD handle, DWORD attrib, float value));
BASS_RETURN(BASS_ChannelSetAttribute(handle, attrib, value));
}
/******************************************************************
* BASS_ChannelSetAttributeEx (BASS.29)
*
*
*/
BOOL __stdcall BASS_BASS_ChannelSetAttributeEx(DWORD handle, DWORD attrib, void * value, DWORD size) {
BASS_START(BASS_ChannelSetAttributeEx(DWORD handle, DWORD attrib, void * value, DWORD size));
BASS_RETURN(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, DWORD channel, void *buffer, DWORD length, void *user) {
DspUserData *user_new = user;
BASS_RETURN(user_new->proc(handle, channel, buffer, length, user_new->user));
}
void wine_bass_dspproc_wrapper_nouser(HDSP handle, DWORD channel, void *buffer, DWORD length, void *user) {
WIN_DSPPROC *proc = user;
BASS_RETURN(proc(handle, channel, buffer, length, NULL));
}
WIN_HDSP __stdcall BASS_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(BASS_ChannelSetDSP(handle, wine_bass_dspproc_wrapper_nouser, proc, priority));
}
}
/******************************************************************
* BASS_ChannelSetDevice (BASS.31)
*
*
*/
BOOL __stdcall BASS_BASS_ChannelSetDevice(DWORD handle, DWORD device) {
BASS_START(BASS_ChannelSetDevice(DWORD handle, DWORD device));
BASS_RETURN(BASS_ChannelSetDevice(handle, device));
}
/******************************************************************
* BASS_ChannelSetFX (BASS.32)
*
*
*/
WIN_HFX __stdcall BASS_BASS_ChannelSetFX(DWORD handle, DWORD type, int priority) {
BASS_START(BASS_ChannelSetFX(DWORD handle, DWORD type, int priority));
BASS_RETURN(BASS_ChannelSetFX(handle, type, priority));
}
/******************************************************************
* BASS_ChannelSetLink (BASS.33)
*
*
*/
BOOL __stdcall BASS_BASS_ChannelSetLink(DWORD handle, DWORD chan) {
BASS_START(BASS_ChannelSetLink(DWORD handle, DWORD chan));
BASS_RETURN(BASS_ChannelSetLink(handle, chan));
}
/******************************************************************
* BASS_ChannelSetPosition (BASS.34)
*
*
*/
BOOL __stdcall BASS_BASS_ChannelSetPosition(DWORD handle, WIN_QWORD pos, DWORD mode) {
BASS_START(BASS_ChannelSetPosition(DWORD handle, WIN_QWORD pos, DWORD mode));
BASS_RETURN(BASS_ChannelSetPosition(handle, pos, mode));
}
/******************************************************************
* BASS_ChannelSetSync (BASS.35)
*
*
*/
typedef struct {
WIN_SYNCPROC *proc;
void *user;
} SyncUserData;
void wine_bass_syncproc_wrapper(HSYNC handle, DWORD channel, DWORD data, void *user) {
SyncUserData *user_new = user;
BASS_RETURN(user_new->proc(handle, channel, data, user_new->user));
}
void wine_bass_syncproc_wrapper_nouser(HSYNC handle, DWORD channel, DWORD data, void *user) {
WIN_SYNCPROC *proc = user;
BASS_RETURN(proc(handle, channel, data, NULL));
}
WIN_HSYNC __stdcall BASS_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(BASS_ChannelSetSync(handle, type, param, wine_bass_syncproc_wrapper_nouser, proc));
}
}
/******************************************************************
* BASS_ChannelSlideAttribute (BASS.36)
*
*
*/
BOOL __stdcall BASS_BASS_ChannelSlideAttribute(DWORD handle, DWORD attrib, float value, DWORD time) {
BASS_START(BASS_ChannelSlideAttribute(DWORD handle, DWORD attrib, float value, DWORD time));
BASS_RETURN(BASS_ChannelSlideAttribute(handle, attrib, value, time));
}
/******************************************************************
* BASS_ChannelStop (BASS.37)
*
*
*/
BOOL __stdcall BASS_BASS_ChannelStop(DWORD handle) {
BASS_START(BASS_ChannelStop(DWORD handle));
wine_bass_user_data_remove(handle);
BASS_RETURN(BASS_ChannelStop(handle));
}
/******************************************************************
* BASS_ChannelUpdate (BASS.38)
*
*
*/
BOOL __stdcall BASS_BASS_ChannelUpdate(DWORD handle, DWORD length) {
BASS_START(BASS_ChannelUpdate(DWORD handle, DWORD length));
BASS_RETURN(BASS_ChannelUpdate(handle, length));
}
/******************************************************************
* BASS_ErrorGetCode (BASS.39)
*
*
*/
int __stdcall BASS_BASS_ErrorGetCode(void) {
BASS_START(BASS_ErrorGetCode(void));
int ret = BASS_ErrorGetCode();
if (ret)
WINE_ERR("BASS_ErrorGetCode() = %i", ret);
PRINT(BASS_ErrorGetCode);
return ret;
}
/******************************************************************
* BASS_FXGetParameters (BASS.40)
*
*
*/
BOOL __stdcall BASS_BASS_FXGetParameters(WIN_HFX handle, void * params) {
BASS_START(BASS_FXGetParameters(WIN_HFX handle, void * params));
BASS_RETURN(BASS_FXGetParameters(handle, params));
}
/******************************************************************
* BASS_FXReset (BASS.41)
*
*
*/
BOOL __stdcall BASS_BASS_FXReset(DWORD handle) {
BASS_START(BASS_FXReset(DWORD handle));
BASS_RETURN(BASS_FXReset(handle));
}
/******************************************************************
* BASS_FXSetParameters (BASS.42)
*
*
*/
BOOL __stdcall BASS_BASS_FXSetParameters(WIN_HFX handle, void * params) {
BASS_START(BASS_FXSetParameters(WIN_HFX handle, void * params));
BASS_RETURN(BASS_FXSetParameters(handle, params));
}
/******************************************************************
* BASS_FXSetPriority (BASS.43)
*
*
*/
BOOL __stdcall BASS_BASS_FXSetPriority(WIN_HFX handle, int priority) {
BASS_START(BASS_FXSetPriority(WIN_HFX handle, int priority));
BASS_RETURN(BASS_FXSetPriority(handle, priority));
}
/******************************************************************
* BASS_Free (BASS.44)
*
*
*/
BOOL __stdcall BASS_BASS_Free(void) {
BASS_START(BASS_Free(void));
wine_bass_user_data_free(&WINE_BASS_DATA_STORAGE);
BASS_RETURN(BASS_Free());
}
/******************************************************************
* BASS_Get3DFactors (BASS.45)
*
*
*/
BOOL __stdcall BASS_BASS_Get3DFactors(float * distf, float * rollf, float * doppf) {
BASS_START(BASS_Get3DFactors(float * distf, float * rollf, float * doppf));
BASS_RETURN(BASS_Get3DFactors(distf, rollf, doppf));
}
/******************************************************************
* BASS_Get3DPosition (BASS.46)
*
*
*/
BOOL __stdcall BASS_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_RETURN(BASS_Get3DPosition(pos, vel, front, top));
}
/******************************************************************
* BASS_GetCPU (BASS.47)
*
*
*/
float __stdcall BASS_BASS_GetCPU(void) {
BASS_START(BASS_GetCPU(void));
BASS_RETURN(BASS_GetCPU());
}
/******************************************************************
* BASS_GetConfig (BASS.48)
*
*
*/
DWORD __stdcall BASS_BASS_GetConfig(DWORD option) {
BASS_START(BASS_GetConfig(DWORD option));
BASS_RETURN(BASS_GetConfig(option));
}
/******************************************************************
* BASS_GetConfigPtr (BASS.49)
*
*
*/
const void * __stdcall BASS_BASS_GetConfigPtr(DWORD option) {
BASS_START(BASS_GetConfigPtr(DWORD option));
BASS_RETURN(BASS_GetConfigPtr(option));
}
/******************************************************************
* BASS_GetDSoundObject (BASS.50)
*
*
*/
void * __stdcall BASS_BASS_GetDSoundObject(DWORD object) {
BASS_START(BASS_GetDSoundObject(DWORD object));
WINE_FIXME("stub (there's no BASS_GetDSoundObject on Linux)");
BASS_RETURN(NULL);
}
/******************************************************************
* BASS_GetDevice (BASS.51)
*
*
*/
DWORD __stdcall BASS_BASS_GetDevice(void) {
BASS_START(BASS_GetDevice(void));
DWORD ret = BASS_GetDevice();
// WINE_TRACE("BASS_GetDevice() = %u", ret);
PRINT(BASS_GetDevice);
return ret;
}
/******************************************************************
* BASS_GetDeviceInfo (BASS.52)
*
*
*/
BOOL __stdcall BASS_BASS_GetDeviceInfo(DWORD device, WIN_BASS_DEVICEINFO * info) {
BASS_START(BASS_GetDeviceInfo(DWORD device, WIN_BASS_DEVICEINFO * info));
BOOL ret = BASS_GetDeviceInfo(device, info);
/*if (ret) {
WINE_TRACE("BASS_GetDeviceInfo(%u, ...) = { %s, %s, %u }", device, info->name, info->driver, info->flags);
} else {
WINE_TRACE("BASS_GetDeviceInfo(%u, ...) = 0", device);
}*/
PRINT(BASS_GetDeviceInfo);
return ret;
}
/******************************************************************
* BASS_GetEAXParameters (BASS.53)
*
*
*/
BOOL __stdcall BASS_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)");
BASS_RETURN(FALSE);
}
/******************************************************************
* BASS_GetInfo (BASS.54)
*
*
*/
BOOL __stdcall BASS_BASS_GetInfo(WIN_BASS_INFO * info) {
BASS_START(BASS_GetInfo(WIN_BASS_INFO * info));
BASS_RETURN(BASS_GetInfo(info));
}
/******************************************************************
* BASS_GetVersion (BASS.55)
*
*
*/
DWORD __stdcall BASS_BASS_GetVersion(void) {
BASS_START(BASS_GetVersion(void));
BASS_RETURN(BASS_GetVersion());
}
/******************************************************************
* BASS_GetVolume (BASS.56)
*
*
*/
float __stdcall BASS_BASS_GetVolume(void) {
BASS_START(BASS_GetVolume(void));
BASS_RETURN(BASS_GetVolume());
}
/******************************************************************
* BASS_Init (BASS.57)
*
*
*/
BOOL __stdcall BASS_BASS_Init(int device, DWORD freq, DWORD flags, HWND win, void * dsguid) {
BASS_START(BASS_Init(int device, DWORD freq, DWORD flags, HWND win, void * dsguid));
BOOL ret = BASS_Init(device, freq, flags, win, dsguid);
if (!ret) WINE_TRACE("BASS_Init(%d, %u, %u, %p, %p) = %u", device, freq, flags, win, dsguid, ret);
PRINT(BASS_Init);
return ret;
}
/******************************************************************
* BASS_IsStarted (BASS.58)
*
*
*/
DWORD __stdcall BASS_BASS_IsStarted(void) {
BASS_START(BASS_IsStarted(void));
BASS_RETURN(BASS_IsStarted());
}
/******************************************************************
* BASS_MusicFree (BASS.59)
*
*
*/
BOOL __stdcall BASS_BASS_MusicFree(WIN_HMUSIC handle) {
BASS_START(BASS_MusicFree(WIN_HMUSIC handle));
wine_bass_user_data_remove(handle);
BASS_RETURN(BASS_MusicFree(handle));
}
/******************************************************************
* BASS_MusicLoad (BASS.60)
*
*
*/
WIN_HMUSIC __stdcall BASS_BASS_MusicLoad(BOOL mem, void * file, WIN_QWORD offset, DWORD length, DWORD flags, DWORD freq) {
BASS_START(BASS_MusicLoad(BOOL mem, void * file, WIN_QWORD offset, DWORD length, DWORD flags, DWORD freq));
if (mem) {
BASS_RETURN(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(BASS_MusicLoad(mem, file, offset, length, flags, freq));
}
}
}
/******************************************************************
* BASS_Pause (BASS.61)
*
*
*/
BOOL __stdcall BASS_BASS_Pause(void) {
BASS_START(BASS_Pause(void));
BASS_RETURN(BASS_Pause());
}
/******************************************************************
* BASS_PluginFree (BASS.62)
*
*
*/
BOOL __stdcall BASS_BASS_PluginFree(WIN_HPLUGIN handle) {
BASS_START(BASS_PluginFree(WIN_HPLUGIN handle));
BASS_RETURN(BASS_PluginFree(handle));
}
/******************************************************************
* BASS_PluginGetInfo (BASS.63)
*
*
*/
const WIN_BASS_PLUGININFO * __stdcall BASS_BASS_PluginGetInfo(WIN_HPLUGIN handle) {
BASS_START(PLUGININFO * __stdcall BASS_BASS_PluginGetInfo(WIN_HPLUGIN handle));
BASS_RETURN(BASS_PluginGetInfo(handle));
}
/******************************************************************
* BASS_PluginLoad (BASS.64)
*
*
*/
WIN_HPLUGIN __stdcall BASS_BASS_PluginLoad(char * file, DWORD flags) {
BASS_START(BASS_PluginLoad(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(BASS_PluginLoad(file, flags));
}
/******************************************************************
* BASS_RecordFree (BASS.65)
*
*
*/
BOOL __stdcall BASS_BASS_RecordFree(void) {
BASS_START(BASS_RecordFree(void));
BASS_RETURN(BASS_RecordFree());
}
/******************************************************************
* BASS_RecordGetDevice (BASS.66)
*
*
*/
DWORD __stdcall BASS_BASS_RecordGetDevice(void) {
BASS_START(BASS_RecordGetDevice(void));
BASS_RETURN(BASS_RecordGetDevice());
}
/******************************************************************
* BASS_RecordGetDeviceInfo (BASS.67)
*
*
*/
BOOL __stdcall BASS_BASS_RecordGetDeviceInfo(DWORD device, WIN_BASS_DEVICEINFO * info) {
BASS_START(BASS_RecordGetDeviceInfo(DWORD device, WIN_BASS_DEVICEINFO * info));
BASS_RETURN(BASS_RecordGetDeviceInfo(device, info));
}
/******************************************************************
* BASS_RecordGetInfo (BASS.68)
*
*
*/
BOOL __stdcall BASS_BASS_RecordGetInfo(WIN_BASS_RECORDINFO * info) {
BASS_START(BASS_RecordGetInfo(WIN_BASS_RECORDINFO * info));
BASS_RETURN(BASS_RecordGetInfo(info));
}
/******************************************************************
* BASS_RecordGetInput (BASS.69)
*
*
*/
DWORD __stdcall BASS_BASS_RecordGetInput(int input, float * volume) {
BASS_START(BASS_RecordGetInput(int input, float * volume));
BASS_RETURN(BASS_RecordGetInput(input, volume));
}
/******************************************************************
* BASS_RecordGetInputName (BASS.70)
*
*
*/
const char * __stdcall BASS_BASS_RecordGetInputName(int input) {
BASS_START(BASS_RecordGetInputName(int input));
BASS_RETURN(BASS_RecordGetInputName(input));
}
/******************************************************************
* BASS_RecordInit (BASS.71)
*
*
*/
BOOL __stdcall BASS_BASS_RecordInit(int device) {
BASS_START(BASS_RecordInit(int device));
BASS_RETURN(BASS_RecordInit(device));
}
/******************************************************************
* BASS_RecordSetDevice (BASS.72)
*
*
*/
BOOL __stdcall BASS_BASS_RecordSetDevice(DWORD device) {
BASS_START(BASS_RecordSetDevice(DWORD device));
BASS_RETURN(BASS_RecordSetDevice(device));
}
/******************************************************************
* BASS_RecordSetInput (BASS.73)
*
*
*/
BOOL __stdcall BASS_BASS_RecordSetInput(int input, DWORD flags, float volume) {
BASS_START(BASS_RecordSetInput(int input, DWORD flags, float volume));
BASS_RETURN(BASS_RecordSetInput(input, flags, volume));
}
/******************************************************************
* BASS_RecordStart (BASS.74)
*
*
*/
typedef struct {
WIN_RECORDPROC *proc;
void *user;
} RecordUserData;
BOOL wine_bass_recordproc_wrapper(HRECORD handle, const void *buffer, DWORD length, void *user) {
RecordUserData *user_new = user;
BASS_RETURN(user_new->proc(handle, buffer, length, user_new->user));
}
BOOL wine_bass_recordproc_wrapper_nouser(HRECORD handle, const void *buffer, DWORD length, void *user) {
WIN_RECORDPROC *proc = user;
BASS_RETURN(proc(handle, buffer, length, NULL));
}
WIN_HRECORD __stdcall BASS_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(BASS_RecordStart(freq, chans, flags, wine_bass_recordproc_wrapper_nouser, proc));
}
}
/******************************************************************
* BASS_SampleCreate (BASS.75)
*
*
*/
WIN_HSAMPLE __stdcall BASS_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(BASS_SampleCreate(length, freq, chans, max, flags));
}
/******************************************************************
* BASS_SampleFree (BASS.76)
*
*
*/
BOOL __stdcall BASS_BASS_SampleFree(WIN_HSAMPLE handle) {
BASS_START(BASS_SampleFree(WIN_HSAMPLE handle));
wine_bass_user_data_remove(handle);
BASS_RETURN(BASS_SampleFree(handle));
}
/******************************************************************
* BASS_SampleGetChannel (BASS.77)
*
*
*/
DWORD __stdcall BASS_BASS_SampleGetChannel(WIN_HSAMPLE handle, DWORD flags) {
BASS_START(BASS_SampleGetChannel(WIN_HSAMPLE handle, DWORD flags));
BASS_RETURN(BASS_SampleGetChannel(handle, flags));
}
/******************************************************************
* BASS_SampleGetChannels (BASS.78)
*
*
*/
DWORD __stdcall BASS_BASS_SampleGetChannels(WIN_HSAMPLE handle, WIN_HCHANNEL * channels) {
BASS_START(BASS_SampleGetChannels(WIN_HSAMPLE handle, WIN_HCHANNEL * channels));
BASS_RETURN(BASS_SampleGetChannels(handle, channels));
}
/******************************************************************
* BASS_SampleGetData (BASS.79)
*
*
*/
BOOL __stdcall BASS_BASS_SampleGetData(WIN_HSAMPLE handle, void * buffer) {
BASS_START(BASS_SampleGetData(WIN_HSAMPLE handle, void * buffer));
BASS_RETURN(BASS_SampleGetData(handle, buffer));
}
/******************************************************************
* BASS_SampleGetInfo (BASS.80)
*
*
*/
BOOL __stdcall BASS_BASS_SampleGetInfo(WIN_HSAMPLE handle, WIN_BASS_SAMPLE * info) {
BASS_START(BASS_SampleGetInfo(WIN_HSAMPLE handle, WIN_BASS_SAMPLE * info));
BASS_RETURN(BASS_SampleGetInfo(handle, info));
}
/******************************************************************
* BASS_SampleLoad (BASS.81)
*
*
*/
WIN_HSAMPLE __stdcall BASS_BASS_SampleLoad(BOOL mem, void * file, WIN_QWORD offset, DWORD length, DWORD max, DWORD flags) {
BASS_START(BASS_SampleLoad(BOOL mem, void * file, WIN_QWORD offset, DWORD length, DWORD max, DWORD flags));
if (mem) {
BASS_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);
PRINT(BASS_SampleLoad);
return ret;
} else {
WINE_FIXME("BASS_SampleLoad: couldn't wine_get_unix_file_name!");
BASS_RETURN(BASS_SampleLoad(mem, file, offset, length, max, flags));
}
}
}
/******************************************************************
* BASS_SampleSetData (BASS.82)
*
*
*/
BOOL __stdcall BASS_BASS_SampleSetData(WIN_HSAMPLE handle, void * buffer) {
BASS_START(BASS_SampleSetData(WIN_HSAMPLE handle, void * buffer));
BASS_RETURN(BASS_SampleSetData(handle, buffer));
}
/******************************************************************
* BASS_SampleSetInfo (BASS.83)
*
*
*/
BOOL __stdcall BASS_BASS_SampleSetInfo(WIN_HSAMPLE handle, WIN_BASS_SAMPLE * info) {
BASS_START(BASS_SampleSetInfo(WIN_HSAMPLE handle, WIN_BASS_SAMPLE * info));
BASS_RETURN(BASS_SampleSetInfo(handle, info));
}
/******************************************************************
* BASS_SampleStop (BASS.84)
*
*
*/
BOOL __stdcall BASS_BASS_SampleStop(WIN_HSAMPLE handle) {
BASS_START(BASS_SampleStop(WIN_HSAMPLE handle));
BASS_RETURN(BASS_SampleStop(handle));
}
/******************************************************************
* BASS_Set3DFactors (BASS.85)
*
*
*/
BOOL __stdcall BASS_BASS_Set3DFactors(float distf, float rollf, float doppf) {
BASS_START(BASS_Set3DFactors(float distf, float rollf, float doppf));
BASS_RETURN(BASS_Set3DFactors(distf, rollf, doppf));
}
/******************************************************************
* BASS_Set3DPosition (BASS.86)
*
*
*/
BOOL __stdcall BASS_BASS_Set3DPosition(WIN_BASS_3DVECTOR * pos, WIN_BASS_3DVECTOR * vel, WIN_BASS_3DVECTOR * front, 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_RETURN(BASS_Set3DPosition(pos, vel, front, top));
}
/******************************************************************
* BASS_SetConfig (BASS.87)
*
*
*/
BOOL __stdcall BASS_BASS_SetConfig(DWORD option, DWORD value) {
BASS_START(BASS_SetConfig(DWORD option, DWORD value));
// WINE_TRACE("BASS_SetConfig(%u, %u)", option, value);
BASS_RETURN(BASS_SetConfig(option, value));
}
/******************************************************************
* BASS_SetConfigPtr (BASS.88)
*
*
*/
BOOL __stdcall BASS_BASS_SetConfigPtr(DWORD option, void * value) {
BASS_START(BASS_SetConfigPtr(DWORD option, void * value));
BASS_RETURN(BASS_SetConfigPtr(option, value));
}
/******************************************************************
* BASS_SetDevice (BASS.89)
*
*
*/
BOOL __stdcall BASS_BASS_SetDevice(DWORD device) {
BASS_START(BASS_SetDevice(DWORD device));
BASS_RETURN(BASS_SetDevice(device));
}
/******************************************************************
* BASS_SetEAXParameters (BASS.90)
*
*
*/
BOOL __stdcall BASS_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)");
BASS_RETURN(FALSE);
}
/******************************************************************
* BASS_SetVolume (BASS.91)
*
*
*/
BOOL __stdcall BASS_BASS_SetVolume(float volume) {
BASS_START(BASS_SetVolume(float volume));
BASS_RETURN(BASS_SetVolume(volume));
}
/******************************************************************
* BASS_Start (BASS.92)
*
*
*/
BOOL __stdcall BASS_BASS_Start(void) {
BASS_START(BASS_Start(void));
BASS_RETURN(BASS_Start());
}
/******************************************************************
* BASS_Stop (BASS.93)
*
*
*/
BOOL __stdcall BASS_BASS_Stop(void) {
BASS_START(BASS_Stop(void));
BASS_RETURN(BASS_Stop());
}
/******************************************************************
* BASS_StreamCreate (BASS.94)
*
*
*/
typedef struct {
WIN_STREAMPROC *proc;
void *user;
} StreamUserData;
DWORD wine_bass_streamproc_wrapper(HSTREAM handle, void *buffer, DWORD length, void *user) {
StreamUserData *user_new = user;
BASS_RETURN(user_new->proc(handle, buffer, length, user_new->user));
}
DWORD wine_bass_streamproc_wrapper_nouser(HSTREAM handle, void *buffer, DWORD length, void *user) {
WIN_STREAMPROC *proc = user;
BASS_RETURN(proc(handle, buffer, length, NULL));
}
WIN_HSTREAM __stdcall BASS_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(BASS_StreamCreate(freq, chans, flags, wine_bass_streamproc_wrapper_nouser, proc));
}
}
/******************************************************************
* BASS_StreamCreateFile (BASS.95)
*
*
*/
WIN_HSTREAM __stdcall BASS_BASS_StreamCreateFile(BOOL mem, void * file, WIN_QWORD offset, WIN_QWORD length, DWORD flags) {
BASS_START(BASS_StreamCreateFile(BOOL mem, void * file, WIN_QWORD offset, WIN_QWORD length, DWORD flags));
if (mem) {
BASS_RETURN(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(BASS_StreamCreateFile(mem, file, offset, length, flags));
}
}
}
/******************************************************************
* BASS_StreamCreateFileUser (BASS.96)
*
*
*/
typedef struct {
WIN_BASS_FILEPROCS procs;
void *user;
} FileUserData;
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);
BASS_RETURN(proc(user2));
}
QWORD wine_bass_fileproc_length_wrapper(void *user) {
FileUserData *user_new = user;
BASS_RETURN(user_new->procs.length(user_new->user));
}
DWORD wine_bass_fileproc_read_wrapper(void *buffer, DWORD length, void *user) {
FileUserData *user_new = user;
BASS_RETURN(user_new->procs.read(buffer, length, user_new->user));
}
BOOL wine_bass_fileproc_seek_wrapper(WIN_QWORD offset, void *user) {
FileUserData *user_new = user;
BASS_RETURN(user_new->procs.seek(offset, user_new->user));
}
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 BASS_BASS_StreamCreateFileUser(DWORD system, DWORD flags, WIN_BASS_FILEPROCS * proc, void * user) {
BASS_START(BASS_StreamCreateFileUser(DWORD system, DWORD flags, WIN_BASS_FILEPROCS * proc, void * user));
FileUserData *user_new = malloc(sizeof(FileUserData));
memcpy(&user_new->procs, proc, sizeof(WIN_BASS_FILEPROCS));
user_new->user = user;
WIN_HSTREAM ret = BASS_StreamCreateFileUser(system, flags, &WINE_FILE_PROC_WRAPPERS, user_new);
if (!ret) free(user_new);
PRINT(BASS_StreamCreateFileUser);
return ret;
}
/******************************************************************
* BASS_StreamCreateURL (BASS.97)
*
*
*/
typedef struct {
WIN_DOWNLOADPROC *proc;
void *user;
} DownloadUserData;
void wine_bass_downloadproc_wrapper(const void *buffer, DWORD length, void *user) {
DownloadUserData *user_new = user;
BASS_RETURN(user_new->proc(buffer, length, user_new->user));
}
void wine_bass_downloadproc_wrapper_nouser(const void *buffer, DWORD length, void *user) {
WIN_DOWNLOADPROC *proc = user;
BASS_RETURN(proc(buffer, length, NULL));
}
WIN_HSTREAM __stdcall BASS_BASS_StreamCreateURL(char * url, DWORD offset, DWORD flags, WIN_DOWNLOADPROC * proc, void * user) {
BASS_START(BASS_StreamCreateURL(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(BASS_StreamCreateURL(url, offset, flags, wine_bass_downloadproc_wrapper_nouser, proc));
}
}
/******************************************************************
* BASS_StreamFree (BASS.98)
*
*
*/
BOOL __stdcall BASS_BASS_StreamFree(WIN_HSTREAM handle) {
BASS_START(BASS_StreamFree(WIN_HSTREAM handle));
wine_bass_user_data_remove(handle);
BASS_RETURN(BASS_StreamFree(handle));
}
/******************************************************************
* BASS_StreamGetFilePosition (BASS.99)
*
*
*/
WIN_QWORD __stdcall BASS_BASS_StreamGetFilePosition(WIN_HSTREAM handle, DWORD mode) {
BASS_START(BASS_StreamGetFilePosition(WIN_HSTREAM handle, DWORD mode));
BASS_RETURN(BASS_StreamGetFilePosition(handle, mode));
}
/******************************************************************
* BASS_StreamPutData (BASS.100)
*
*
*/
DWORD __stdcall BASS_BASS_StreamPutData(WIN_HSTREAM handle, void * buffer, DWORD length) {
BASS_START(BASS_StreamPutData(WIN_HSTREAM handle, void * buffer, DWORD length));
BASS_RETURN(BASS_StreamPutData(handle, buffer, length));
}
/******************************************************************
* BASS_StreamPutFileData (BASS.101)
*
*
*/
DWORD __stdcall BASS_BASS_StreamPutFileData(WIN_HSTREAM handle, void * buffer, DWORD length) {
BASS_START(BASS_StreamPutFileData(WIN_HSTREAM handle, void * buffer, DWORD length));
BASS_RETURN(BASS_StreamPutFileData(handle, buffer, length));
}
/******************************************************************
* BASS_Update (BASS.102)
*
*
*/
BOOL __stdcall BASS_BASS_Update(DWORD length) {
BASS_START(BASS_Update(DWORD length));
BASS_RETURN(BASS_Update(length));
}