Skip to content

Instantly share code, notes, and snippets.

Created March 29, 2011 16:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/892698 to your computer and use it in GitHub Desktop.
Save anonymous/892698 to your computer and use it in GitHub Desktop.
struct CAsioCallbacks
{
extern(C)
{
void function(DriverInfo) CsetDriverInfo;
DriverInfo function() CgetDriverInfo;
// CAsio.cpp
ASIOError function(ASIODriverInfo *info) CASIOInit;
ASIOError function() CASIOExit;
ASIOError function() CASIOStart;
ASIOError function() CASIOStop;
ASIOError function(int *numInputChannels, int *numOutputChannels) CASIOGetChannels;
ASIOError function(int *inputLatency, int *outputLatency) CASIOGetLatencies;
ASIOError function(int *minSize, int *maxSize, int *preferredSize, int *granularity) CASIOGetBufferSize;
ASIOError function(ASIOSampleRate sampleRate) CASIOCanSampleRate;
ASIOError function(ASIOSampleRate *currentRate) CASIOGetSampleRate;
ASIOError function(ASIOSampleRate sampleRate) CASIOSetSampleRate;
ASIOError function(ASIOClockSource *clocks, int *numSources) CASIOGetClockSources;
ASIOError function(int reference) CASIOSetClockSource;
ASIOError function(ASIOSamples *sPos, ASIOTimeStamp *tStamp) CASIOGetSamplePosition;
ASIOError function(ASIOChannelInfo *info) CASIOGetChannelInfo;
ASIOError function(ASIOBufferInfo *bufferInfos, int numChannels, int bufferSize, ASIOCallbacks *callbacks) CASIOCreateBuffers;
ASIOError function() CASIODisposeBuffers;
ASIOError function() CASIOControlPanel;
ASIOError function(int selector, void *opt) CASIOFuture;
ASIOError function() CASIOOutputReady;
// CAsiodrivers.cpp
bool function(char *name) CloadAsioDriver;
bool function(char *name) CAsioDrivers_getCurrentDriverName;
int function(char **names, long maxDrivers) CAsioDrivers_getDriverNames;
bool function(char *name) CAsioDrivers_loadDriver;
void function() CAsioDrivers_removeCurrentDriver;
// CAsiolist.cpp
int function(char *clsidstr,char *dllpath,int dllpathsize) CfindDrvPath;
LPASIODRVSTRUCT function(HKEY hkey,char *keyname,int drvID,LPASIODRVSTRUCT lpdrv) CnewDrvStruct;
void function(LPASIODRVSTRUCT lpdrv) CdeleteDrvStruct;
LPASIODRVSTRUCT function(int drvID,LPASIODRVSTRUCT lpdrv) CgetDrvStruct;
int function() CAsioDriverList_asioGetNumDev;
int function(int drvID,LPVOID *asiodrv) CAsioDriverList_asioOpenDriver;
int function(int drvID) CAsioDriverList_asioCloseDriver;
int function(int drvID, char *drvname, int drvnamesize) CAsioDriverList_asioGetDriverName;
int function(int drvID, char *dllpath, int dllpathsize) CAsioDriverList_asioGetDriverPath;
int function(int drvID, CLSID *clsid) CAsioDriverList_asioGetDriverCLSID;
int function() CExecuteMain;
bool function(CLSID clsid, LPVOID* asiodrv) CAsioLoadDriver2;
}
}
// Generated Class
class AsioLoader
{
typeof(CAsioCallbacks.CsetDriverInfo) CsetDriverInfo;
typeof(CAsioCallbacks.CgetDriverInfo) CgetDriverInfo;
typeof(CAsioCallbacks.CASIOInit) CASIOInit;
typeof(CAsioCallbacks.CASIOExit) CASIOExit;
typeof(CAsioCallbacks.CASIOStart) CASIOStart;
typeof(CAsioCallbacks.CASIOStop) CASIOStop;
typeof(CAsioCallbacks.CASIOGetChannels) CASIOGetChannels;
typeof(CAsioCallbacks.CASIOGetLatencies) CASIOGetLatencies;
typeof(CAsioCallbacks.CASIOGetBufferSize) CASIOGetBufferSize;
typeof(CAsioCallbacks.CASIOCanSampleRate) CASIOCanSampleRate;
typeof(CAsioCallbacks.CASIOGetSampleRate) CASIOGetSampleRate;
typeof(CAsioCallbacks.CASIOSetSampleRate) CASIOSetSampleRate;
typeof(CAsioCallbacks.CASIOGetClockSources) CASIOGetClockSources;
typeof(CAsioCallbacks.CASIOSetClockSource) CASIOSetClockSource;
typeof(CAsioCallbacks.CASIOGetSamplePosition) CASIOGetSamplePosition;
typeof(CAsioCallbacks.CASIOGetChannelInfo) CASIOGetChannelInfo;
typeof(CAsioCallbacks.CASIOCreateBuffers) CASIOCreateBuffers;
typeof(CAsioCallbacks.CASIODisposeBuffers) CASIODisposeBuffers;
typeof(CAsioCallbacks.CASIOControlPanel) CASIOControlPanel;
typeof(CAsioCallbacks.CASIOFuture) CASIOFuture;
typeof(CAsioCallbacks.CASIOOutputReady) CASIOOutputReady;
typeof(CAsioCallbacks.CloadAsioDriver) CloadAsioDriver;
typeof(CAsioCallbacks.CAsioDrivers_getCurrentDriverName) CAsioDrivers_getCurrentDriverName;
typeof(CAsioCallbacks.CAsioDrivers_getDriverNames) CAsioDrivers_getDriverNames;
typeof(CAsioCallbacks.CAsioDrivers_loadDriver) CAsioDrivers_loadDriver;
typeof(CAsioCallbacks.CAsioDrivers_removeCurrentDriver) CAsioDrivers_removeCurrentDriver;
typeof(CAsioCallbacks.CfindDrvPath) CfindDrvPath;
typeof(CAsioCallbacks.CnewDrvStruct) CnewDrvStruct;
typeof(CAsioCallbacks.CdeleteDrvStruct) CdeleteDrvStruct;
typeof(CAsioCallbacks.CgetDrvStruct) CgetDrvStruct;
typeof(CAsioCallbacks.CAsioDriverList_asioGetNumDev) CAsioDriverList_asioGetNumDev;
typeof(CAsioCallbacks.CAsioDriverList_asioOpenDriver) CAsioDriverList_asioOpenDriver;
typeof(CAsioCallbacks.CAsioDriverList_asioCloseDriver) CAsioDriverList_asioCloseDriver;
typeof(CAsioCallbacks.CAsioDriverList_asioGetDriverName) CAsioDriverList_asioGetDriverName;
typeof(CAsioCallbacks.CAsioDriverList_asioGetDriverPath) CAsioDriverList_asioGetDriverPath;
typeof(CAsioCallbacks.CAsioDriverList_asioGetDriverCLSID) CAsioDriverList_asioGetDriverCLSID;
typeof(CAsioCallbacks.CExecuteMain) CExecuteMain;
typeof(CAsioCallbacks.CAsioLoadDriver2) CAsioLoadDriver2;
this()
{
CsetDriverInfo = cast(typeof(CsetDriverInfo)) dll.getSymbol("CsetDriverInfo");
if (CsetDriverInfo is null) throw new Exception("Failed to load: CsetDriverInfo");
CgetDriverInfo = cast(typeof(CgetDriverInfo)) dll.getSymbol("CgetDriverInfo");
if (CgetDriverInfo is null) throw new Exception("Failed to load: CgetDriverInfo");
CASIOInit = cast(typeof(CASIOInit)) dll.getSymbol("CASIOInit");
if (CASIOInit is null) throw new Exception("Failed to load: CASIOInit");
CASIOExit = cast(typeof(CASIOExit)) dll.getSymbol("CASIOExit");
if (CASIOExit is null) throw new Exception("Failed to load: CASIOExit");
CASIOStart = cast(typeof(CASIOStart)) dll.getSymbol("CASIOStart");
if (CASIOStart is null) throw new Exception("Failed to load: CASIOStart");
CASIOStop = cast(typeof(CASIOStop)) dll.getSymbol("CASIOStop");
if (CASIOStop is null) throw new Exception("Failed to load: CASIOStop");
CASIOGetChannels = cast(typeof(CASIOGetChannels)) dll.getSymbol("CASIOGetChannels");
if (CASIOGetChannels is null) throw new Exception("Failed to load: CASIOGetChannels");
CASIOGetLatencies = cast(typeof(CASIOGetLatencies)) dll.getSymbol("CASIOGetLatencies");
if (CASIOGetLatencies is null) throw new Exception("Failed to load: CASIOGetLatencies");
CASIOGetBufferSize = cast(typeof(CASIOGetBufferSize)) dll.getSymbol("CASIOGetBufferSize");
if (CASIOGetBufferSize is null) throw new Exception("Failed to load: CASIOGetBufferSize");
CASIOCanSampleRate = cast(typeof(CASIOCanSampleRate)) dll.getSymbol("CASIOCanSampleRate");
if (CASIOCanSampleRate is null) throw new Exception("Failed to load: CASIOCanSampleRate");
CASIOGetSampleRate = cast(typeof(CASIOGetSampleRate)) dll.getSymbol("CASIOGetSampleRate");
if (CASIOGetSampleRate is null) throw new Exception("Failed to load: CASIOGetSampleRate");
CASIOSetSampleRate = cast(typeof(CASIOSetSampleRate)) dll.getSymbol("CASIOSetSampleRate");
if (CASIOSetSampleRate is null) throw new Exception("Failed to load: CASIOSetSampleRate");
CASIOGetClockSources = cast(typeof(CASIOGetClockSources)) dll.getSymbol("CASIOGetClockSources");
if (CASIOGetClockSources is null) throw new Exception("Failed to load: CASIOGetClockSources");
CASIOSetClockSource = cast(typeof(CASIOSetClockSource)) dll.getSymbol("CASIOSetClockSource");
if (CASIOSetClockSource is null) throw new Exception("Failed to load: CASIOSetClockSource");
CASIOGetSamplePosition = cast(typeof(CASIOGetSamplePosition)) dll.getSymbol("CASIOGetSamplePosition");
if (CASIOGetSamplePosition is null) throw new Exception("Failed to load: CASIOGetSamplePosition");
CASIOGetChannelInfo = cast(typeof(CASIOGetChannelInfo)) dll.getSymbol("CASIOGetChannelInfo");
if (CASIOGetChannelInfo is null) throw new Exception("Failed to load: CASIOGetChannelInfo");
CASIOCreateBuffers = cast(typeof(CASIOCreateBuffers)) dll.getSymbol("CASIOCreateBuffers");
if (CASIOCreateBuffers is null) throw new Exception("Failed to load: CASIOCreateBuffers");
CASIODisposeBuffers = cast(typeof(CASIODisposeBuffers)) dll.getSymbol("CASIODisposeBuffers");
if (CASIODisposeBuffers is null) throw new Exception("Failed to load: CASIODisposeBuffers");
CASIOControlPanel = cast(typeof(CASIOControlPanel)) dll.getSymbol("CASIOControlPanel");
if (CASIOControlPanel is null) throw new Exception("Failed to load: CASIOControlPanel");
CASIOFuture = cast(typeof(CASIOFuture)) dll.getSymbol("CASIOFuture");
if (CASIOFuture is null) throw new Exception("Failed to load: CASIOFuture");
CASIOOutputReady = cast(typeof(CASIOOutputReady)) dll.getSymbol("CASIOOutputReady");
if (CASIOOutputReady is null) throw new Exception("Failed to load: CASIOOutputReady");
CloadAsioDriver = cast(typeof(CloadAsioDriver)) dll.getSymbol("CloadAsioDriver");
if (CloadAsioDriver is null) throw new Exception("Failed to load: CloadAsioDriver");
CAsioDrivers_getCurrentDriverName = cast(typeof(CAsioDrivers_getCurrentDriverName)) dll.getSymbol("CAsioDrivers_getCurrentDriverName");
if (CAsioDrivers_getCurrentDriverName is null) throw new Exception("Failed to load: CAsioDrivers_getCurrentDriverName");
CAsioDrivers_getDriverNames = cast(typeof(CAsioDrivers_getDriverNames)) dll.getSymbol("CAsioDrivers_getDriverNames");
if (CAsioDrivers_getDriverNames is null) throw new Exception("Failed to load: CAsioDrivers_getDriverNames");
CAsioDrivers_loadDriver = cast(typeof(CAsioDrivers_loadDriver)) dll.getSymbol("CAsioDrivers_loadDriver");
if (CAsioDrivers_loadDriver is null) throw new Exception("Failed to load: CAsioDrivers_loadDriver");
CAsioDrivers_removeCurrentDriver = cast(typeof(CAsioDrivers_removeCurrentDriver)) dll.getSymbol("CAsioDrivers_removeCurrentDriver");
if (CAsioDrivers_removeCurrentDriver is null) throw new Exception("Failed to load: CAsioDrivers_removeCurrentDriver");
CfindDrvPath = cast(typeof(CfindDrvPath)) dll.getSymbol("CfindDrvPath");
if (CfindDrvPath is null) throw new Exception("Failed to load: CfindDrvPath");
CnewDrvStruct = cast(typeof(CnewDrvStruct)) dll.getSymbol("CnewDrvStruct");
if (CnewDrvStruct is null) throw new Exception("Failed to load: CnewDrvStruct");
CdeleteDrvStruct = cast(typeof(CdeleteDrvStruct)) dll.getSymbol("CdeleteDrvStruct");
if (CdeleteDrvStruct is null) throw new Exception("Failed to load: CdeleteDrvStruct");
CgetDrvStruct = cast(typeof(CgetDrvStruct)) dll.getSymbol("CgetDrvStruct");
if (CgetDrvStruct is null) throw new Exception("Failed to load: CgetDrvStruct");
CAsioDriverList_asioGetNumDev = cast(typeof(CAsioDriverList_asioGetNumDev)) dll.getSymbol("CAsioDriverList_asioGetNumDev");
if (CAsioDriverList_asioGetNumDev is null) throw new Exception("Failed to load: CAsioDriverList_asioGetNumDev");
CAsioDriverList_asioOpenDriver = cast(typeof(CAsioDriverList_asioOpenDriver)) dll.getSymbol("CAsioDriverList_asioOpenDriver");
if (CAsioDriverList_asioOpenDriver is null) throw new Exception("Failed to load: CAsioDriverList_asioOpenDriver");
CAsioDriverList_asioCloseDriver = cast(typeof(CAsioDriverList_asioCloseDriver)) dll.getSymbol("CAsioDriverList_asioCloseDriver");
if (CAsioDriverList_asioCloseDriver is null) throw new Exception("Failed to load: CAsioDriverList_asioCloseDriver");
CAsioDriverList_asioGetDriverName = cast(typeof(CAsioDriverList_asioGetDriverName)) dll.getSymbol("CAsioDriverList_asioGetDriverName");
if (CAsioDriverList_asioGetDriverName is null) throw new Exception("Failed to load: CAsioDriverList_asioGetDriverName");
CAsioDriverList_asioGetDriverPath = cast(typeof(CAsioDriverList_asioGetDriverPath)) dll.getSymbol("CAsioDriverList_asioGetDriverPath");
if (CAsioDriverList_asioGetDriverPath is null) throw new Exception("Failed to load: CAsioDriverList_asioGetDriverPath");
CAsioDriverList_asioGetDriverCLSID = cast(typeof(CAsioDriverList_asioGetDriverCLSID)) dll.getSymbol("CAsioDriverList_asioGetDriverCLSID");
if (CAsioDriverList_asioGetDriverCLSID is null) throw new Exception("Failed to load: CAsioDriverList_asioGetDriverCLSID");
CExecuteMain = cast(typeof(CExecuteMain)) dll.getSymbol("CExecuteMain");
if (CExecuteMain is null) throw new Exception("Failed to load: CExecuteMain");
CAsioLoadDriver2 = cast(typeof(CAsioLoadDriver2)) dll.getSymbol("CAsioLoadDriver2");
if (CAsioLoadDriver2 is null) throw new Exception("Failed to load: CAsioLoadDriver2");
}
// Wrappers
void setDriverInfo(DriverInfo var_1)
{
CsetDriverInfo(var_1);
}
DriverInfo getDriverInfo()
{
return CgetDriverInfo();
}
ASIOError ASIOInit(ASIODriverInfo* var_1)
{
auto result = CASIOInit(var_1);
switch (result)
{
case ASE_OK:
case ASE_SUCCESS:
return 0;
default:
throw new Exception("Failure");
}
}
ASIOError ASIOExit()
{
auto result = CASIOExit();
switch (result)
{
case ASE_OK:
case ASE_SUCCESS:
return 0;
default:
throw new Exception("Failure");
}
}
ASIOError ASIOStart()
{
auto result = CASIOStart();
switch (result)
{
case ASE_OK:
case ASE_SUCCESS:
return 0;
default:
throw new Exception("Failure");
}
}
ASIOError ASIOStop()
{
auto result = CASIOStop();
switch (result)
{
case ASE_OK:
case ASE_SUCCESS:
return 0;
default:
throw new Exception("Failure");
}
}
ASIOError ASIOGetChannels(int* var_1, int* var_2)
{
auto result = CASIOGetChannels(var_1, var_2);
switch (result)
{
case ASE_OK:
case ASE_SUCCESS:
return 0;
default:
throw new Exception("Failure");
}
}
ASIOError ASIOGetLatencies(int* var_1, int* var_2)
{
auto result = CASIOGetLatencies(var_1, var_2);
switch (result)
{
case ASE_OK:
case ASE_SUCCESS:
return 0;
default:
throw new Exception("Failure");
}
}
ASIOError ASIOGetBufferSize(int* var_1, int* var_2, int* var_3, int* var_4)
{
auto result = CASIOGetBufferSize(var_1, var_2, var_3, var_4);
switch (result)
{
case ASE_OK:
case ASE_SUCCESS:
return 0;
default:
throw new Exception("Failure");
}
}
ASIOError ASIOCanSampleRate(double var_1)
{
auto result = CASIOCanSampleRate(var_1);
switch (result)
{
case ASE_OK:
case ASE_SUCCESS:
return 0;
default:
throw new Exception("Failure");
}
}
ASIOError ASIOGetSampleRate(double* var_1)
{
auto result = CASIOGetSampleRate(var_1);
switch (result)
{
case ASE_OK:
case ASE_SUCCESS:
return 0;
default:
throw new Exception("Failure");
}
}
ASIOError ASIOSetSampleRate(double var_1)
{
auto result = CASIOSetSampleRate(var_1);
switch (result)
{
case ASE_OK:
case ASE_SUCCESS:
return 0;
default:
throw new Exception("Failure");
}
}
ASIOError ASIOGetClockSources(ASIOClockSource* var_1, int* var_2)
{
auto result = CASIOGetClockSources(var_1, var_2);
switch (result)
{
case ASE_OK:
case ASE_SUCCESS:
return 0;
default:
throw new Exception("Failure");
}
}
ASIOError ASIOSetClockSource(int var_1)
{
auto result = CASIOSetClockSource(var_1);
switch (result)
{
case ASE_OK:
case ASE_SUCCESS:
return 0;
default:
throw new Exception("Failure");
}
}
ASIOError ASIOGetSamplePosition(ASIOSamples* var_1, ASIOTimeStamp* var_2)
{
auto result = CASIOGetSamplePosition(var_1, var_2);
switch (result)
{
case ASE_OK:
case ASE_SUCCESS:
return 0;
default:
throw new Exception("Failure");
}
}
ASIOError ASIOGetChannelInfo(ASIOChannelInfo* var_1)
{
auto result = CASIOGetChannelInfo(var_1);
switch (result)
{
case ASE_OK:
case ASE_SUCCESS:
return 0;
default:
throw new Exception("Failure");
}
}
ASIOError ASIOCreateBuffers(ASIOBufferInfo* var_1, int var_2, int var_3, ASIOCallbacks* var_4)
{
auto result = CASIOCreateBuffers(var_1, var_2, var_3, var_4);
switch (result)
{
case ASE_OK:
case ASE_SUCCESS:
return 0;
default:
throw new Exception("Failure");
}
}
ASIOError ASIODisposeBuffers()
{
auto result = CASIODisposeBuffers();
switch (result)
{
case ASE_OK:
case ASE_SUCCESS:
return 0;
default:
throw new Exception("Failure");
}
}
ASIOError ASIOControlPanel()
{
auto result = CASIOControlPanel();
switch (result)
{
case ASE_OK:
case ASE_SUCCESS:
return 0;
default:
throw new Exception("Failure");
}
}
ASIOError ASIOFuture(int var_1, void* var_2)
{
auto result = CASIOFuture(var_1, var_2);
switch (result)
{
case ASE_OK:
case ASE_SUCCESS:
return 0;
default:
throw new Exception("Failure");
}
}
ASIOError ASIOOutputReady()
{
auto result = CASIOOutputReady();
switch (result)
{
case ASE_OK:
case ASE_SUCCESS:
return 0;
default:
throw new Exception("Failure");
}
}
bool loadAsioDriver(char* var_1)
{
return CloadAsioDriver(var_1);
}
bool AsioDrivers_getCurrentDriverName(char* var_1)
{
return CAsioDrivers_getCurrentDriverName(var_1);
}
int AsioDrivers_getDriverNames(char** var_1, long var_2)
{
return CAsioDrivers_getDriverNames(var_1, var_2);
}
bool AsioDrivers_loadDriver(char* var_1)
{
return CAsioDrivers_loadDriver(var_1);
}
void AsioDrivers_removeCurrentDriver()
{
CAsioDrivers_removeCurrentDriver();
}
int findDrvPath(char* var_1, char* var_2, int var_3)
{
return CfindDrvPath(var_1, var_2, var_3);
}
asiodrvstruct * newDrvStruct(HANDLE var_1, char* var_2, int var_3, asiodrvstruct* var_4)
{
return CnewDrvStruct(var_1, var_2, var_3, var_4);
}
void deleteDrvStruct(asiodrvstruct* var_1)
{
CdeleteDrvStruct(var_1);
}
asiodrvstruct * getDrvStruct(int var_1, asiodrvstruct* var_2)
{
return CgetDrvStruct(var_1, var_2);
}
int AsioDriverList_asioGetNumDev()
{
return CAsioDriverList_asioGetNumDev();
}
int AsioDriverList_asioOpenDriver(int var_1, void** var_2)
{
return CAsioDriverList_asioOpenDriver(var_1, var_2);
}
int AsioDriverList_asioCloseDriver(int var_1)
{
return CAsioDriverList_asioCloseDriver(var_1);
}
int AsioDriverList_asioGetDriverName(int var_1, char* var_2, int var_3)
{
return CAsioDriverList_asioGetDriverName(var_1, var_2, var_3);
}
int AsioDriverList_asioGetDriverPath(int var_1, char* var_2, int var_3)
{
return CAsioDriverList_asioGetDriverPath(var_1, var_2, var_3);
}
int AsioDriverList_asioGetDriverCLSID(int var_1, const (GUID)* var_2)
{
return CAsioDriverList_asioGetDriverCLSID(var_1, var_2);
}
int ExecuteMain()
{
return CExecuteMain();
}
bool AsioLoadDriver2(const (GUID)var_1, void** var_2)
{
return CAsioLoadDriver2(var_1, var_2);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment