Add asio lib.
This commit is contained in:
parent
3215043f0d
commit
c5e8f1dca7
42 changed files with 8450 additions and 0 deletions
|
|
@ -0,0 +1,9 @@
|
|||
LIBRARY ASIOSample
|
||||
DESCRIPTION 'ASIO Sample Driver'
|
||||
PROTMODE
|
||||
EXPORTS
|
||||
DllMain
|
||||
DllGetClassObject
|
||||
DllCanUnloadNow
|
||||
DllRegisterServer
|
||||
DllUnregisterServer
|
||||
23
src/hostapi/asio/ASIOSDK/driver/asiosample/asiosample.txt
Normal file
23
src/hostapi/asio/ASIOSDK/driver/asiosample/asiosample.txt
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
Asiosample
|
||||
|
||||
This sample driver illustrates the implementation of an ASIO driver.
|
||||
|
||||
|
||||
|
||||
Windows notes:
|
||||
|
||||
For Windows a COM implementation is provided. The final driver can be
|
||||
installed in the system by dragging the asiosample.dll onto the
|
||||
regsvr32.exe in the windows\system directory.
|
||||
|
||||
It is normal that the LNK4104 warning is issued for the following 4
|
||||
exported symbols:
|
||||
|
||||
DllGetClassObject
|
||||
DllCanUnloadNow
|
||||
DllRegisterServer
|
||||
DllUnregisterServer
|
||||
|
||||
|
||||
Macintosh notes:
|
||||
The supplied project is created with CodeWarrior Pro 5.
|
||||
|
|
@ -0,0 +1,151 @@
|
|||
# Microsoft Developer Studio Project File - Name="asiosample" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
||||
CFG=asiosample - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "asiosample.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "asiosample.mak" CFG="asiosample - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "asiosample - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "asiosample - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "asiosample - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\Common" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:windows /dll /machine:I386
|
||||
|
||||
!ELSEIF "$(CFG)" == "asiosample - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /G5 /MTd /W3 /Gm /GX /Zi /Od /I "..\..\..\Common" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /GZ /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "asiosample - Win32 Release"
|
||||
# Name "asiosample - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\asiosample.def
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\asiosmpl.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\common\combase.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\common\dllentry.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\common\register.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\wintimer.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\common\asio.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\Asiodrvr.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\asiosmpl.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\common\asiosys.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\common\combase.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\common\iasiodrv.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
|
|
@ -0,0 +1,629 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="asiosample"
|
||||
ProjectGUID="{D514DF49-CE45-4F09-9BAD-8FDA4BEF4DE3}"
|
||||
RootNamespace="asiosample"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
<Platform
|
||||
Name="x64"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
MkTypLibCompatible="true"
|
||||
SuppressStartupBanner="true"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\Debug/asiosample.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\..\Common"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="odbc32.lib odbccp32.lib winmm.lib"
|
||||
OutputFile="$(PlatformName)\$(ConfigurationName)\asiosample.dll"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="true"
|
||||
ModuleDefinitionFile="..\asiosample.def"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|x64"
|
||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
MkTypLibCompatible="true"
|
||||
SuppressStartupBanner="true"
|
||||
TargetEnvironment="3"
|
||||
TypeLibraryName=".\Debug/asiosample.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\..\Common"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="odbc32.lib odbccp32.lib winmm.lib"
|
||||
OutputFile="$(PlatformName)\$(ConfigurationName)\asiosample.dll"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="true"
|
||||
ModuleDefinitionFile="..\asiosample.def"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
MkTypLibCompatible="true"
|
||||
SuppressStartupBanner="true"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\Release/asiosample.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..\..\Common"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="true"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="odbc32.lib odbccp32.lib winmm.lib"
|
||||
OutputFile="$(PlatformName)\$(ConfigurationName)\asiosample.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
ModuleDefinitionFile="..\asiosample.def"
|
||||
SubSystem="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|x64"
|
||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
MkTypLibCompatible="true"
|
||||
SuppressStartupBanner="true"
|
||||
TargetEnvironment="3"
|
||||
TypeLibraryName=".\Release/asiosample.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..\..\Common"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="true"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="odbc32.lib odbccp32.lib winmm.lib"
|
||||
OutputFile="$(PlatformName)\$(ConfigurationName)\asiosample.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
ModuleDefinitionFile="..\asiosample.def"
|
||||
SubSystem="2"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\asiosample.def"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\asiosmpl.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\common\combase.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\common\dllentry.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\common\register.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\wintimer.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\..\common\asio.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Common\Asiodrvr.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\asiosmpl.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\common\asiosys.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\common\combase.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\common\iasiodrv.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
660
src/hostapi/asio/ASIOSDK/driver/asiosample/asiosmpl.cpp
Normal file
660
src/hostapi/asio/ASIOSDK/driver/asiosample/asiosmpl.cpp
Normal file
|
|
@ -0,0 +1,660 @@
|
|||
/*
|
||||
Steinberg Audio Stream I/O API
|
||||
(c) 1996, Steinberg Soft- und Hardware GmbH
|
||||
charlie (May 1996)
|
||||
|
||||
asiosmpl.cpp
|
||||
|
||||
sample implementation of asio. can be set to simulate input with some
|
||||
stupid oscillators.
|
||||
this driver doesn't output sound at all...
|
||||
timing is done via the extended time manager on the mac, and
|
||||
a simple thread on pc.
|
||||
you may test various configurations by changing the kNumInputs/Outputs,
|
||||
and kBlockFrames. note that when using wave generation, as i/o is not optimized
|
||||
at all, it moves quite a bit of memory, too many i/o channels may make it
|
||||
pretty slow.
|
||||
|
||||
if you use this file as a template, make sure to resolve places where the
|
||||
search string !!! can be found...
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "asiosmpl.h"
|
||||
//#include "virtape.h"
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
|
||||
// extern
|
||||
void getNanoSeconds(ASIOTimeStamp *time);
|
||||
|
||||
// local
|
||||
|
||||
double AsioSamples2double (ASIOSamples* samples);
|
||||
|
||||
static const double twoRaisedTo32 = 4294967296.;
|
||||
static const double twoRaisedTo32Reciprocal = 1. / twoRaisedTo32;
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
// on windows, we do the COM stuff.
|
||||
|
||||
#if WINDOWS
|
||||
#include "windows.h"
|
||||
#include "mmsystem.h"
|
||||
|
||||
// class id. !!! NOTE: !!! you will obviously have to create your own class id!
|
||||
// {188135E1-D565-11d2-854F-00A0C99F5D19}
|
||||
CLSID IID_ASIO_DRIVER = { 0x188135e1, 0xd565, 0x11d2, { 0x85, 0x4f, 0x0, 0xa0, 0xc9, 0x9f, 0x5d, 0x19 } };
|
||||
|
||||
CFactoryTemplate g_Templates[1] = {
|
||||
{L"ASIOSAMPLE", &IID_ASIO_DRIVER, AsioSample::CreateInstance}
|
||||
};
|
||||
int g_cTemplates = sizeof(g_Templates) / sizeof(g_Templates[0]);
|
||||
|
||||
CUnknown* AsioSample::CreateInstance (LPUNKNOWN pUnk, HRESULT *phr)
|
||||
{
|
||||
return (CUnknown*)new AsioSample (pUnk,phr);
|
||||
};
|
||||
|
||||
STDMETHODIMP AsioSample::NonDelegatingQueryInterface (REFIID riid, void ** ppv)
|
||||
{
|
||||
if (riid == IID_ASIO_DRIVER)
|
||||
{
|
||||
return GetInterface (this, ppv);
|
||||
}
|
||||
return CUnknown::NonDelegatingQueryInterface (riid, ppv);
|
||||
}
|
||||
|
||||
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// Register ASIO Driver
|
||||
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
extern LONG RegisterAsioDriver (CLSID,char *,char *,char *,char *);
|
||||
extern LONG UnregisterAsioDriver (CLSID,char *,char *);
|
||||
|
||||
//
|
||||
// Server registration, called on REGSVR32.EXE "the dllname.dll"
|
||||
//
|
||||
HRESULT _stdcall DllRegisterServer()
|
||||
{
|
||||
LONG rc;
|
||||
char errstr[128];
|
||||
|
||||
rc = RegisterAsioDriver (IID_ASIO_DRIVER,"ASIOSample.dll","ASIO Sample Driver","ASIO Sample","Apartment");
|
||||
|
||||
if (rc) {
|
||||
memset(errstr,0,128);
|
||||
sprintf(errstr,"Register Server failed ! (%d)",rc);
|
||||
MessageBox(0,(LPCTSTR)errstr,(LPCTSTR)"ASIO sample Driver",MB_OK);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
//
|
||||
// Server unregistration
|
||||
//
|
||||
HRESULT _stdcall DllUnregisterServer()
|
||||
{
|
||||
LONG rc;
|
||||
char errstr[128];
|
||||
|
||||
rc = UnregisterAsioDriver (IID_ASIO_DRIVER,"ASIOSample.dll","ASIO Sample Driver");
|
||||
|
||||
if (rc) {
|
||||
memset(errstr,0,128);
|
||||
sprintf(errstr,"Unregister Server failed ! (%d)",rc);
|
||||
MessageBox(0,(LPCTSTR)errstr,(LPCTSTR)"ASIO Korg1212 I/O Driver",MB_OK);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------------------
|
||||
AsioSample::AsioSample (LPUNKNOWN pUnk, HRESULT *phr)
|
||||
: CUnknown("ASIOSAMPLE", pUnk, phr)
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
|
||||
#else
|
||||
|
||||
// when not on windows, we derive from AsioDriver
|
||||
AsioSample::AsioSample () : AsioDriver ()
|
||||
|
||||
#endif
|
||||
{
|
||||
long i;
|
||||
|
||||
blockFrames = kBlockFrames;
|
||||
inputLatency = blockFrames; // typically
|
||||
outputLatency = blockFrames * 2;
|
||||
// typically blockFrames * 2; try to get 1 by offering direct buffer
|
||||
// access, and using asioPostOutput for lower latency
|
||||
samplePosition = 0;
|
||||
sampleRate = 44100.;
|
||||
milliSeconds = (long)((double)(kBlockFrames * 1000) / sampleRate);
|
||||
active = false;
|
||||
started = false;
|
||||
timeInfoMode = false;
|
||||
tcRead = false;
|
||||
for (i = 0; i < kNumInputs; i++)
|
||||
{
|
||||
inputBuffers[i] = 0;
|
||||
inMap[i] = 0;
|
||||
}
|
||||
#if TESTWAVES
|
||||
sawTooth = sineWave = 0;
|
||||
#endif
|
||||
for (i = 0; i < kNumOutputs; i++)
|
||||
{
|
||||
outputBuffers[i] = 0;
|
||||
outMap[i] = 0;
|
||||
}
|
||||
callbacks = 0;
|
||||
activeInputs = activeOutputs = 0;
|
||||
toggle = 0;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
AsioSample::~AsioSample ()
|
||||
{
|
||||
stop ();
|
||||
outputClose ();
|
||||
inputClose ();
|
||||
disposeBuffers ();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
void AsioSample::getDriverName (char *name)
|
||||
{
|
||||
strcpy (name, "Sample ASIO");
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
long AsioSample::getDriverVersion ()
|
||||
{
|
||||
return 0x00000001L;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
void AsioSample::getErrorMessage (char *string)
|
||||
{
|
||||
strcpy (string, errorMessage);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
ASIOBool AsioSample::init (void* sysRef)
|
||||
{
|
||||
sysRef = sysRef;
|
||||
if (active)
|
||||
return true;
|
||||
strcpy (errorMessage, "ASIO Driver open Failure!");
|
||||
if (inputOpen ())
|
||||
{
|
||||
if (outputOpen ())
|
||||
{
|
||||
active = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
timerOff (); // de-activate 'hardware'
|
||||
|
||||
outputClose ();
|
||||
inputClose ();
|
||||
return false;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
ASIOError AsioSample::start ()
|
||||
{
|
||||
if (callbacks)
|
||||
{
|
||||
started = false;
|
||||
samplePosition = 0;
|
||||
theSystemTime.lo = theSystemTime.hi = 0;
|
||||
toggle = 0;
|
||||
|
||||
timerOn (); // activate 'hardware'
|
||||
started = true;
|
||||
|
||||
return ASE_OK;
|
||||
}
|
||||
return ASE_NotPresent;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
ASIOError AsioSample::stop ()
|
||||
{
|
||||
started = false;
|
||||
timerOff (); // de-activate 'hardware'
|
||||
return ASE_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
ASIOError AsioSample::getChannels (long *numInputChannels, long *numOutputChannels)
|
||||
{
|
||||
*numInputChannels = kNumInputs;
|
||||
*numOutputChannels = kNumOutputs;
|
||||
return ASE_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
ASIOError AsioSample::getLatencies (long *_inputLatency, long *_outputLatency)
|
||||
{
|
||||
*_inputLatency = inputLatency;
|
||||
*_outputLatency = outputLatency;
|
||||
return ASE_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
ASIOError AsioSample::getBufferSize (long *minSize, long *maxSize,
|
||||
long *preferredSize, long *granularity)
|
||||
{
|
||||
*minSize = *maxSize = *preferredSize = blockFrames; // allow this size only
|
||||
*granularity = 0;
|
||||
return ASE_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
ASIOError AsioSample::canSampleRate (ASIOSampleRate sampleRate)
|
||||
{
|
||||
if (sampleRate == 44100. || sampleRate == 48000.) // allow these rates only
|
||||
return ASE_OK;
|
||||
return ASE_NoClock;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
ASIOError AsioSample::getSampleRate (ASIOSampleRate *sampleRate)
|
||||
{
|
||||
*sampleRate = this->sampleRate;
|
||||
return ASE_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
ASIOError AsioSample::setSampleRate (ASIOSampleRate sampleRate)
|
||||
{
|
||||
if (sampleRate != 44100. && sampleRate != 48000.)
|
||||
return ASE_NoClock;
|
||||
if (sampleRate != this->sampleRate)
|
||||
{
|
||||
this->sampleRate = sampleRate;
|
||||
asioTime.timeInfo.sampleRate = sampleRate;
|
||||
asioTime.timeInfo.flags |= kSampleRateChanged;
|
||||
milliSeconds = (long)((double)(kBlockFrames * 1000) / this->sampleRate);
|
||||
if (callbacks && callbacks->sampleRateDidChange)
|
||||
callbacks->sampleRateDidChange (this->sampleRate);
|
||||
}
|
||||
return ASE_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
ASIOError AsioSample::getClockSources (ASIOClockSource *clocks, long *numSources)
|
||||
{
|
||||
// internal
|
||||
clocks->index = 0;
|
||||
clocks->associatedChannel = -1;
|
||||
clocks->associatedGroup = -1;
|
||||
clocks->isCurrentSource = ASIOTrue;
|
||||
strcpy(clocks->name, "Internal");
|
||||
*numSources = 1;
|
||||
return ASE_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
ASIOError AsioSample::setClockSource (long index)
|
||||
{
|
||||
if (!index)
|
||||
{
|
||||
asioTime.timeInfo.flags |= kClockSourceChanged;
|
||||
return ASE_OK;
|
||||
}
|
||||
return ASE_NotPresent;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
ASIOError AsioSample::getSamplePosition (ASIOSamples *sPos, ASIOTimeStamp *tStamp)
|
||||
{
|
||||
tStamp->lo = theSystemTime.lo;
|
||||
tStamp->hi = theSystemTime.hi;
|
||||
if (samplePosition >= twoRaisedTo32)
|
||||
{
|
||||
sPos->hi = (unsigned long)(samplePosition * twoRaisedTo32Reciprocal);
|
||||
sPos->lo = (unsigned long)(samplePosition - (sPos->hi * twoRaisedTo32));
|
||||
}
|
||||
else
|
||||
{
|
||||
sPos->hi = 0;
|
||||
sPos->lo = (unsigned long)samplePosition;
|
||||
}
|
||||
return ASE_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
ASIOError AsioSample::getChannelInfo (ASIOChannelInfo *info)
|
||||
{
|
||||
if (info->channel < 0 || (info->isInput ? info->channel >= kNumInputs : info->channel >= kNumOutputs))
|
||||
return ASE_InvalidParameter;
|
||||
#if WINDOWS
|
||||
info->type = ASIOSTInt16LSB;
|
||||
#else
|
||||
info->type = ASIOSTInt16MSB;
|
||||
#endif
|
||||
info->channelGroup = 0;
|
||||
info->isActive = ASIOFalse;
|
||||
long i;
|
||||
if (info->isInput)
|
||||
{
|
||||
for (i = 0; i < activeInputs; i++)
|
||||
{
|
||||
if (inMap[i] == info->channel)
|
||||
{
|
||||
info->isActive = ASIOTrue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < activeOutputs; i++)
|
||||
{
|
||||
if (outMap[i] == info->channel)
|
||||
{
|
||||
info->isActive = ASIOTrue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
strcpy(info->name, "Sample ");
|
||||
return ASE_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
ASIOError AsioSample::createBuffers (ASIOBufferInfo *bufferInfos, long numChannels,
|
||||
long bufferSize, ASIOCallbacks *callbacks)
|
||||
{
|
||||
ASIOBufferInfo *info = bufferInfos;
|
||||
long i;
|
||||
bool notEnoughMem = false;
|
||||
|
||||
activeInputs = 0;
|
||||
activeOutputs = 0;
|
||||
blockFrames = bufferSize;
|
||||
for (i = 0; i < numChannels; i++, info++)
|
||||
{
|
||||
if (info->isInput)
|
||||
{
|
||||
if (info->channelNum < 0 || info->channelNum >= kNumInputs)
|
||||
goto error;
|
||||
inMap[activeInputs] = info->channelNum;
|
||||
inputBuffers[activeInputs] = new short[blockFrames * 2]; // double buffer
|
||||
if (inputBuffers[activeInputs])
|
||||
{
|
||||
info->buffers[0] = inputBuffers[activeInputs];
|
||||
info->buffers[1] = inputBuffers[activeInputs] + blockFrames;
|
||||
}
|
||||
else
|
||||
{
|
||||
info->buffers[0] = info->buffers[1] = 0;
|
||||
notEnoughMem = true;
|
||||
}
|
||||
activeInputs++;
|
||||
if (activeInputs > kNumInputs)
|
||||
{
|
||||
error:
|
||||
disposeBuffers();
|
||||
return ASE_InvalidParameter;
|
||||
}
|
||||
}
|
||||
else // output
|
||||
{
|
||||
if (info->channelNum < 0 || info->channelNum >= kNumOutputs)
|
||||
goto error;
|
||||
outMap[activeOutputs] = info->channelNum;
|
||||
outputBuffers[activeOutputs] = new short[blockFrames * 2]; // double buffer
|
||||
if (outputBuffers[activeOutputs])
|
||||
{
|
||||
info->buffers[0] = outputBuffers[activeOutputs];
|
||||
info->buffers[1] = outputBuffers[activeOutputs] + blockFrames;
|
||||
}
|
||||
else
|
||||
{
|
||||
info->buffers[0] = info->buffers[1] = 0;
|
||||
notEnoughMem = true;
|
||||
}
|
||||
activeOutputs++;
|
||||
if (activeOutputs > kNumOutputs)
|
||||
{
|
||||
activeOutputs--;
|
||||
disposeBuffers();
|
||||
return ASE_InvalidParameter;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (notEnoughMem)
|
||||
{
|
||||
disposeBuffers();
|
||||
return ASE_NoMemory;
|
||||
}
|
||||
|
||||
this->callbacks = callbacks;
|
||||
if (callbacks->asioMessage (kAsioSupportsTimeInfo, 0, 0, 0))
|
||||
{
|
||||
timeInfoMode = true;
|
||||
asioTime.timeInfo.speed = 1.;
|
||||
asioTime.timeInfo.systemTime.hi = asioTime.timeInfo.systemTime.lo = 0;
|
||||
asioTime.timeInfo.samplePosition.hi = asioTime.timeInfo.samplePosition.lo = 0;
|
||||
asioTime.timeInfo.sampleRate = sampleRate;
|
||||
asioTime.timeInfo.flags = kSystemTimeValid | kSamplePositionValid | kSampleRateValid;
|
||||
|
||||
asioTime.timeCode.speed = 1.;
|
||||
asioTime.timeCode.timeCodeSamples.lo = asioTime.timeCode.timeCodeSamples.hi = 0;
|
||||
asioTime.timeCode.flags = kTcValid | kTcRunning ;
|
||||
}
|
||||
else
|
||||
timeInfoMode = false;
|
||||
return ASE_OK;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
ASIOError AsioSample::disposeBuffers()
|
||||
{
|
||||
long i;
|
||||
|
||||
callbacks = 0;
|
||||
stop();
|
||||
for (i = 0; i < activeInputs; i++)
|
||||
delete inputBuffers[i];
|
||||
activeInputs = 0;
|
||||
for (i = 0; i < activeOutputs; i++)
|
||||
delete outputBuffers[i];
|
||||
activeOutputs = 0;
|
||||
return ASE_OK;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
ASIOError AsioSample::controlPanel()
|
||||
{
|
||||
return ASE_NotPresent;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
ASIOError AsioSample::future (long selector, void* opt) // !!! check properties
|
||||
{
|
||||
ASIOTransportParameters* tp = (ASIOTransportParameters*)opt;
|
||||
switch (selector)
|
||||
{
|
||||
case kAsioEnableTimeCodeRead: tcRead = true; return ASE_SUCCESS;
|
||||
case kAsioDisableTimeCodeRead: tcRead = false; return ASE_SUCCESS;
|
||||
case kAsioSetInputMonitor: return ASE_SUCCESS; // for testing!!!
|
||||
case kAsioCanInputMonitor: return ASE_SUCCESS; // for testing!!!
|
||||
case kAsioCanTimeInfo: return ASE_SUCCESS;
|
||||
case kAsioCanTimeCode: return ASE_SUCCESS;
|
||||
}
|
||||
return ASE_NotPresent;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
// private methods
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
// input
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
bool AsioSample::inputOpen ()
|
||||
{
|
||||
#if TESTWAVES
|
||||
sineWave = new short[blockFrames];
|
||||
if (!sineWave)
|
||||
{
|
||||
strcpy (errorMessage, "ASIO Sample Driver: Out of Memory!");
|
||||
return false;
|
||||
}
|
||||
makeSine (sineWave);
|
||||
|
||||
sawTooth = new short[blockFrames];
|
||||
if (!sawTooth)
|
||||
{
|
||||
strcpy(errorMessage, "ASIO Sample Driver: Out of Memory!");
|
||||
return false;
|
||||
}
|
||||
makeSaw(sawTooth);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
#if TESTWAVES
|
||||
|
||||
#include <math.h>
|
||||
|
||||
const double pi = 0.3141592654;
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
void AsioSample::makeSine (short *wave)
|
||||
{
|
||||
double frames = (double)blockFrames;
|
||||
double i, f = (pi * 2.) / frames;
|
||||
|
||||
for (i = 0; i < frames; i++)
|
||||
*wave++ = (short)((double)0x7fff * sin(f * i));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
void AsioSample::makeSaw(short *wave)
|
||||
{
|
||||
double frames = (double)blockFrames;
|
||||
double i, f = 2. / frames;
|
||||
|
||||
for (i = 0; i < frames; i++)
|
||||
*wave++ = (short)((double)0x7fff * (-1. + f * i));
|
||||
}
|
||||
#endif
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
void AsioSample::inputClose ()
|
||||
{
|
||||
#if TESTWAVES
|
||||
if (sineWave)
|
||||
delete sineWave;
|
||||
sineWave = 0;
|
||||
if (sawTooth)
|
||||
delete sawTooth;
|
||||
sawTooth = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
void AsioSample::input()
|
||||
{
|
||||
#if TESTWAVES
|
||||
long i;
|
||||
short *in = 0;
|
||||
|
||||
for (i = 0; i < activeInputs; i++)
|
||||
{
|
||||
in = inputBuffers[i];
|
||||
if (in)
|
||||
{
|
||||
if (toggle)
|
||||
in += blockFrames;
|
||||
if ((i & 1) && sawTooth)
|
||||
memcpy(in, sawTooth, (unsigned long)(blockFrames * 2));
|
||||
else if (sineWave)
|
||||
memcpy(in, sineWave, (unsigned long)(blockFrames * 2));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// output
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
bool AsioSample::outputOpen()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
void AsioSample::outputClose ()
|
||||
{
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
void AsioSample::output ()
|
||||
{
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
void AsioSample::bufferSwitch ()
|
||||
{
|
||||
if (started && callbacks)
|
||||
{
|
||||
getNanoSeconds(&theSystemTime); // latch system time
|
||||
input();
|
||||
output();
|
||||
samplePosition += blockFrames;
|
||||
if (timeInfoMode)
|
||||
bufferSwitchX ();
|
||||
else
|
||||
callbacks->bufferSwitch (toggle, ASIOFalse);
|
||||
toggle = toggle ? 0 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
// asio2 buffer switch
|
||||
void AsioSample::bufferSwitchX ()
|
||||
{
|
||||
getSamplePosition (&asioTime.timeInfo.samplePosition, &asioTime.timeInfo.systemTime);
|
||||
long offset = toggle ? blockFrames : 0;
|
||||
if (tcRead)
|
||||
{ // Create a fake time code, which is 10 minutes ahead of the card's sample position
|
||||
// Please note that for simplicity here time code will wrap after 32 bit are reached
|
||||
asioTime.timeCode.timeCodeSamples.lo = asioTime.timeInfo.samplePosition.lo + 600.0 * sampleRate;
|
||||
asioTime.timeCode.timeCodeSamples.hi = 0;
|
||||
}
|
||||
callbacks->bufferSwitchTimeInfo (&asioTime, toggle, ASIOFalse);
|
||||
asioTime.timeInfo.flags &= ~(kSampleRateChanged | kClockSourceChanged);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
ASIOError AsioSample::outputReady ()
|
||||
{
|
||||
return ASE_NotPresent;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
double AsioSamples2double (ASIOSamples* samples)
|
||||
{
|
||||
double a = (double)(samples->lo);
|
||||
if (samples->hi)
|
||||
a += (double)(samples->hi) * twoRaisedTo32;
|
||||
return a;
|
||||
}
|
||||
|
||||
148
src/hostapi/asio/ASIOSDK/driver/asiosample/asiosmpl.h
Normal file
148
src/hostapi/asio/ASIOSDK/driver/asiosample/asiosmpl.h
Normal file
|
|
@ -0,0 +1,148 @@
|
|||
/*
|
||||
Steinberg Audio Stream I/O API
|
||||
(c) 1999, Steinberg Soft- und Hardware GmbH
|
||||
|
||||
asiosmpl.h
|
||||
|
||||
test implementation of asio
|
||||
*/
|
||||
|
||||
#ifndef _asiosmpl_
|
||||
#define _asiosmpl_
|
||||
|
||||
#include "asiosys.h"
|
||||
|
||||
#define TESTWAVES 1
|
||||
// when true, will feed the left input (to host) with
|
||||
// a sine wave, and the right one with a sawtooth
|
||||
|
||||
enum
|
||||
{
|
||||
kBlockFrames = 256,
|
||||
kNumInputs = 16,
|
||||
kNumOutputs = 16
|
||||
};
|
||||
|
||||
#if WINDOWS
|
||||
|
||||
#include "rpc.h"
|
||||
#include "rpcndr.h"
|
||||
#ifndef COM_NO_WINDOWS_H
|
||||
#include <windows.h>
|
||||
#include "ole2.h"
|
||||
#endif
|
||||
|
||||
#include "combase.h"
|
||||
#include "iasiodrv.h"
|
||||
|
||||
class AsioSample : public IASIO, public CUnknown
|
||||
{
|
||||
public:
|
||||
AsioSample(LPUNKNOWN pUnk, HRESULT *phr);
|
||||
~AsioSample();
|
||||
|
||||
DECLARE_IUNKNOWN
|
||||
//STDMETHODIMP QueryInterface(REFIID riid, void **ppv) { \
|
||||
// return GetOwner()->QueryInterface(riid,ppv); \
|
||||
//}; \
|
||||
//STDMETHODIMP_(ULONG) AddRef() { \
|
||||
// return GetOwner()->AddRef(); \
|
||||
//}; \
|
||||
//STDMETHODIMP_(ULONG) Release() { \
|
||||
// return GetOwner()->Release(); \
|
||||
//};
|
||||
|
||||
// Factory method
|
||||
static CUnknown *CreateInstance(LPUNKNOWN pUnk, HRESULT *phr);
|
||||
// IUnknown
|
||||
virtual HRESULT STDMETHODCALLTYPE NonDelegatingQueryInterface(REFIID riid,void **ppvObject);
|
||||
#else
|
||||
|
||||
#include "asiodrvr.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
class AsioSample : public AsioDriver
|
||||
{
|
||||
public:
|
||||
AsioSample ();
|
||||
~AsioSample ();
|
||||
#endif
|
||||
|
||||
ASIOBool init (void* sysRef);
|
||||
void getDriverName (char *name); // max 32 bytes incl. terminating zero
|
||||
long getDriverVersion ();
|
||||
void getErrorMessage (char *string); // max 128 bytes incl.
|
||||
|
||||
ASIOError start ();
|
||||
ASIOError stop ();
|
||||
|
||||
ASIOError getChannels (long *numInputChannels, long *numOutputChannels);
|
||||
ASIOError getLatencies (long *inputLatency, long *outputLatency);
|
||||
ASIOError getBufferSize (long *minSize, long *maxSize,
|
||||
long *preferredSize, long *granularity);
|
||||
|
||||
ASIOError canSampleRate (ASIOSampleRate sampleRate);
|
||||
ASIOError getSampleRate (ASIOSampleRate *sampleRate);
|
||||
ASIOError setSampleRate (ASIOSampleRate sampleRate);
|
||||
ASIOError getClockSources (ASIOClockSource *clocks, long *numSources);
|
||||
ASIOError setClockSource (long index);
|
||||
|
||||
ASIOError getSamplePosition (ASIOSamples *sPos, ASIOTimeStamp *tStamp);
|
||||
ASIOError getChannelInfo (ASIOChannelInfo *info);
|
||||
|
||||
ASIOError createBuffers (ASIOBufferInfo *bufferInfos, long numChannels,
|
||||
long bufferSize, ASIOCallbacks *callbacks);
|
||||
ASIOError disposeBuffers ();
|
||||
|
||||
ASIOError controlPanel ();
|
||||
ASIOError future (long selector, void *opt);
|
||||
ASIOError outputReady ();
|
||||
|
||||
void bufferSwitch ();
|
||||
long getMilliSeconds () {return milliSeconds;}
|
||||
|
||||
private:
|
||||
friend void myTimer();
|
||||
|
||||
bool inputOpen ();
|
||||
#if TESTWAVES
|
||||
void makeSine (short *wave);
|
||||
void makeSaw (short *wave);
|
||||
#endif
|
||||
void inputClose ();
|
||||
void input ();
|
||||
|
||||
bool outputOpen ();
|
||||
void outputClose ();
|
||||
void output ();
|
||||
|
||||
void timerOn ();
|
||||
void timerOff ();
|
||||
void bufferSwitchX ();
|
||||
|
||||
double samplePosition;
|
||||
double sampleRate;
|
||||
ASIOCallbacks *callbacks;
|
||||
ASIOTime asioTime;
|
||||
ASIOTimeStamp theSystemTime;
|
||||
short *inputBuffers[kNumInputs * 2];
|
||||
short *outputBuffers[kNumOutputs * 2];
|
||||
#if TESTWAVES
|
||||
short *sineWave, *sawTooth;
|
||||
#endif
|
||||
long inMap[kNumInputs];
|
||||
long outMap[kNumOutputs];
|
||||
long blockFrames;
|
||||
long inputLatency;
|
||||
long outputLatency;
|
||||
long activeInputs;
|
||||
long activeOutputs;
|
||||
long toggle;
|
||||
long milliSeconds;
|
||||
bool active, started;
|
||||
bool timeInfoMode, tcRead;
|
||||
char errorMessage[128];
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
15
src/hostapi/asio/ASIOSDK/driver/asiosample/macnanosecs.cpp
Normal file
15
src/hostapi/asio/ASIOSDK/driver/asiosample/macnanosecs.cpp
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#include "asio.h"
|
||||
#include <Timer.h>
|
||||
|
||||
void getNanoSeconds(ASIOTimeStamp *time);
|
||||
|
||||
static const double twoRaisedTo32 = 4294967296.;
|
||||
|
||||
void getNanoSeconds(ASIOTimeStamp *time)
|
||||
{
|
||||
UnsignedWide ys;
|
||||
Microseconds(&ys);
|
||||
double r = 1000. * ((double)ys.hi * twoRaisedTo32 + (double)ys.lo);
|
||||
time->hi = (unsigned long)(r / twoRaisedTo32);
|
||||
time->lo = (unsigned long)(r - (double)time->hi * twoRaisedTo32);
|
||||
}
|
||||
52
src/hostapi/asio/ASIOSDK/driver/asiosample/mactimer.cpp
Normal file
52
src/hostapi/asio/ASIOSDK/driver/asiosample/mactimer.cpp
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
Steinberg Audio Stream I/O API
|
||||
(c) 1996, Steinberg Soft- und Hardware GmbH
|
||||
charlie (May 1996)
|
||||
|
||||
asiosmpl.cpp
|
||||
|
||||
sample implementation of asio.
|
||||
time manager irq
|
||||
**** mac os specific ****
|
||||
*/
|
||||
|
||||
#include <macheaders.h>
|
||||
#include <Timer.h>
|
||||
#include <string.h>
|
||||
#include "asiosmpl.h"
|
||||
|
||||
static TMTask myTmTask;
|
||||
static bool tmTaskOn = false;
|
||||
static AsioSample *theSound = 0;
|
||||
|
||||
void myTimer();
|
||||
void myTimer()
|
||||
{
|
||||
if(theSound)
|
||||
theSound->bufferSwitch();
|
||||
PrimeTime((QElemPtr)&myTmTask, theSound->milliSeconds);
|
||||
}
|
||||
|
||||
void AsioSample::timerOn()
|
||||
{
|
||||
theSound = this; // for irq
|
||||
if(!tmTaskOn)
|
||||
{
|
||||
memset(&myTmTask, 0, sizeof(TMTask));
|
||||
myTmTask.tmAddr = NewTimerProc(myTimer);
|
||||
myTmTask.tmWakeUp = 0;
|
||||
tmTaskOn = true;
|
||||
InsXTime((QElemPtr)&myTmTask);
|
||||
PrimeTime((QElemPtr)&myTmTask, theSound->milliSeconds);
|
||||
}
|
||||
}
|
||||
|
||||
void AsioSample::timerOff()
|
||||
{
|
||||
if(tmTaskOn)
|
||||
{
|
||||
RmvTime((QElemPtr)&myTmTask);
|
||||
tmTaskOn = false;
|
||||
}
|
||||
theSound = 0;
|
||||
}
|
||||
6
src/hostapi/asio/ASIOSDK/driver/asiosample/makesamp.cpp
Normal file
6
src/hostapi/asio/ASIOSDK/driver/asiosample/makesamp.cpp
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#include "asiosmpl.h"
|
||||
|
||||
AsioDriver *getDriver()
|
||||
{
|
||||
return new AsioSample();
|
||||
}
|
||||
55
src/hostapi/asio/ASIOSDK/driver/asiosample/wintimer.cpp
Normal file
55
src/hostapi/asio/ASIOSDK/driver/asiosample/wintimer.cpp
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
#include <windows.h>
|
||||
#include "asiosmpl.h"
|
||||
|
||||
static DWORD __stdcall ASIOThread (void *param);
|
||||
static HANDLE ASIOThreadHandle = 0;
|
||||
static bool done = false;
|
||||
const double twoRaisedTo32 = 4294967296.;
|
||||
|
||||
AsioSample* theDriver = 0;
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
void getNanoSeconds (ASIOTimeStamp* ts)
|
||||
{
|
||||
double nanoSeconds = (double)((unsigned long)timeGetTime ()) * 1000000.;
|
||||
ts->hi = (unsigned long)(nanoSeconds / twoRaisedTo32);
|
||||
ts->lo = (unsigned long)(nanoSeconds - (ts->hi * twoRaisedTo32));
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
void AsioSample::timerOn ()
|
||||
{
|
||||
theDriver = this;
|
||||
DWORD asioId;
|
||||
done = false;
|
||||
ASIOThreadHandle = CreateThread (0, 0, &ASIOThread, 0, 0, &asioId);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
void AsioSample::timerOff ()
|
||||
{
|
||||
done = true;
|
||||
if (ASIOThreadHandle)
|
||||
WaitForSingleObject(ASIOThreadHandle, 1000);
|
||||
ASIOThreadHandle = 0;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
static DWORD __stdcall ASIOThread (void *param)
|
||||
{
|
||||
do
|
||||
{
|
||||
if (theDriver)
|
||||
{
|
||||
theDriver->bufferSwitch ();
|
||||
Sleep (theDriver->getMilliSeconds ());
|
||||
}
|
||||
else
|
||||
{
|
||||
double a = 1000. / 44100.;
|
||||
Sleep ((long)(a * (double)kBlockFrames));
|
||||
|
||||
}
|
||||
} while (!done);
|
||||
return 0;
|
||||
}
|
||||
Loading…
Reference in a new issue