Renamed all output files to conform to a consistent standard (pcsx2pg-vtlb-dev.exe / SPU2ghz-Pg / etc). Namely, the Dev builds of pcsx2 are now clearly marked, and Public builds are naked: pcsx2pg-vtlb.exe.

Changed all the PPr's in the plugin names to "Pg."  Dunno why I did PP in the first place.  I must have had sand in my eye.

Removed ASIO code from spu2ghz - the driver model is way too overly complicated and now that XA2 is stable it would have been of little use even if it had ever worked right.  OH yeah, and no more const error on compile under some revisions of DXSDK.  Yay! :D

git-svn-id: http://pcsx2-playground.googlecode.com/svn/trunk@563 a6443dda-0b58-4228-96e9-037be469359c
This commit is contained in:
Jake.Stine 2009-01-08 01:59:51 +00:00 committed by Gregory Hainaut
parent 41524a03f6
commit a20ceb0bcb
33 changed files with 29 additions and 4813 deletions

View File

@ -2,7 +2,7 @@
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="9.00" Version="9.00"
Name="pcsx2" Name="pcsx2pg"
ProjectGUID="{1CEFD830-2B76-4596-A4EE-BCD7280A60BD}" ProjectGUID="{1CEFD830-2B76-4596-A4EE-BCD7280A60BD}"
RootNamespace="pcsx2" RootNamespace="pcsx2"
TargetFrameworkVersion="131072" TargetFrameworkVersion="131072"
@ -74,7 +74,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
OutputFile="&quot;$(OutDir)\pcsx2-vm.exe&quot;" OutputFile="&quot;$(OutDir)\$(ProjectName)-vm-dev.exe&quot;"
/> />
<Tool <Tool
Name="VCALinkTool" Name="VCALinkTool"
@ -156,7 +156,7 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386" AdditionalOptions="/MACHINE:I386"
OutputFile="&quot;$(OutDir)\pcsx2d-vm.exe&quot;" OutputFile="&quot;$(OutDir)\$(ProjectName)-vm-dbg.exe&quot;"
LinkIncremental="2" LinkIncremental="2"
/> />
<Tool <Tool
@ -239,7 +239,7 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386" AdditionalOptions="/MACHINE:I386"
OutputFile="&quot;$(OutDir)\pcsx2d-vtlb.exe&quot;" OutputFile="&quot;$(OutDir)\$(ProjectName)-vtlb-dbg.exe&quot;"
LinkIncremental="2" LinkIncremental="2"
/> />
<Tool <Tool
@ -334,7 +334,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
OutputFile="&quot;$(OutDir)\pcsx2-vtlb.exe&quot;" OutputFile="&quot;$(OutDir)\$(ProjectName)-vtlb-dev.exe&quot;"
/> />
<Tool <Tool
Name="VCALinkTool" Name="VCALinkTool"
@ -417,7 +417,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
OutputFile="&quot;$(OutDir)\pcsx2r-vm.exe&quot;" OutputFile="&quot;$(OutDir)\$(ProjectName)-vm.exe&quot;"
ProgramDatabaseFile="&quot;$(TargetDir)$(TargetName).pdb&quot;" ProgramDatabaseFile="&quot;$(TargetDir)$(TargetName).pdb&quot;"
/> />
<Tool <Tool
@ -501,7 +501,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
OutputFile="&quot;$(OutDir)\pcsx2r-vtlb.exe&quot;" OutputFile="&quot;$(OutDir)\$(ProjectName)-vtlb.exe&quot;"
ProgramDatabaseFile="&quot;$(TargetDir)$(TargetName).pdb&quot;" ProgramDatabaseFile="&quot;$(TargetDir)$(TargetName).pdb&quot;"
/> />
<Tool <Tool

View File

@ -22,6 +22,9 @@
// and it's usually user error, but in this case I'm pretty sure I found one. // and it's usually user error, but in this case I'm pretty sure I found one.
// So put your c++ exception code in WinSysExec.cpp. It's better that way. :D (air) // So put your c++ exception code in WinSysExec.cpp. It's better that way. :D (air)
// Disabled warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
#pragma warning(disable:4530)
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "win32.h" #include "win32.h"
@ -50,9 +53,6 @@
#include "implement.h" // pthreads-win32 defines for startup/shutdown #include "implement.h" // pthreads-win32 defines for startup/shutdown
// Disabled warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
#pragma warning(disable:4530)
bool AccBreak = false; bool AccBreak = false;
unsigned int langsMax; unsigned int langsMax;

View File

@ -47,9 +47,9 @@ char *methods[] = {
}; };
#ifdef _DEBUG #ifdef _DEBUG
char *LibName = "Linuz/PP Iso CDVD (Debug) "; char *LibName = "Linuz/Pg Iso CDVD (Debug) ";
#else #else
char *LibName = "Linuz/PP Iso CDVD "; char *LibName = "Linuz/Pg Iso CDVD ";
#endif #endif
const unsigned char version = PS2E_CDVD_VERSION; const unsigned char version = PS2E_CDVD_VERSION;

View File

@ -2,7 +2,7 @@
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="9.00" Version="9.00"
Name="CDVDiso" Name="CDVDiso-Pg"
ProjectGUID="{5F78E90B-BD22-47B1-9CA5-7A80F4DF5EF3}" ProjectGUID="{5F78E90B-BD22-47B1-9CA5-7A80F4DF5EF3}"
RootNamespace="CDVDiso_vs2008" RootNamespace="CDVDiso_vs2008"
Keyword="Win32Proj" Keyword="Win32Proj"
@ -65,7 +65,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
OutputFile="$(OutDir)\CDVDiso-debug.dll" OutputFile="$(OutDir)\$(ProjectName)-dbg.dll"
LinkIncremental="2" LinkIncremental="2"
ModuleDefinitionFile="$(ProjectDir)\CDVDiso.def" ModuleDefinitionFile="$(ProjectDir)\CDVDiso.def"
GenerateDebugInformation="true" GenerateDebugInformation="true"
@ -148,7 +148,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
OutputFile="$(OutDir)\CDVDiso-PP.dll" OutputFile="$(OutDir)\$(ProjectName).dll"
LinkIncremental="1" LinkIncremental="1"
GenerateManifest="false" GenerateManifest="false"
ModuleDefinitionFile="$(ProjectDir)\CDVDiso.def" ModuleDefinitionFile="$(ProjectDir)\CDVDiso.def"

View File

@ -2,7 +2,7 @@
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="9.00" Version="9.00"
Name="SPU2ghz" Name="SPU2ghz-Pg"
ProjectGUID="{5307BBB7-EBB9-4AA4-8CB6-A94EC473C8C4}" ProjectGUID="{5307BBB7-EBB9-4AA4-8CB6-A94EC473C8C4}"
RootNamespace="SPU2ghz_vs2005" RootNamespace="SPU2ghz_vs2005"
TargetFrameworkVersion="131072" TargetFrameworkVersion="131072"
@ -87,7 +87,7 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="winmm.lib dsound.lib" AdditionalDependencies="winmm.lib dsound.lib"
OutputFile="$(OutDir)\SPU2ghz-dev.dll" OutputFile="$(OutDir)\$(ProjectName)-dev.dll"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="true" SuppressStartupBanner="true"
GenerateManifest="true" GenerateManifest="true"
@ -185,7 +185,7 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="winmm.lib dsound.lib" AdditionalDependencies="winmm.lib dsound.lib"
OutputFile="$(OutDir)\SPU2ghz-dbg.dll" OutputFile="$(OutDir)\$(ProjectName)-dbg.dll"
LinkIncremental="2" LinkIncremental="2"
SuppressStartupBanner="true" SuppressStartupBanner="true"
ModuleDefinitionFile=".\SPU2ghz.def" ModuleDefinitionFile=".\SPU2ghz.def"
@ -292,7 +292,7 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="winmm.lib dsound.lib" AdditionalDependencies="winmm.lib dsound.lib"
OutputFile="$(OutDir)\SPU2ghz-PP.dll" OutputFile="$(OutDir)\$(ProjectName)-PG.dll"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="true" SuppressStartupBanner="true"
ModuleDefinitionFile=".\SPU2ghz.def" ModuleDefinitionFile=".\SPU2ghz.def"
@ -394,7 +394,7 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="winmm.lib dsound.lib" AdditionalDependencies="winmm.lib dsound.lib"
OutputFile="$(OutDir)\SPU2ghz-dbg.dll" OutputFile="$(OutDir)\$(ProjectName)-dbg.dll"
LinkIncremental="2" LinkIncremental="2"
SuppressStartupBanner="true" SuppressStartupBanner="true"
ModuleDefinitionFile=".\SPU2ghz.def" ModuleDefinitionFile=".\SPU2ghz.def"
@ -666,134 +666,6 @@
RelativePath="sndout.h" RelativePath="sndout.h"
> >
</File> </File>
<Filter
Name="asio"
>
<File
RelativePath=".\asio\asio.cpp"
>
<FileConfiguration
Name="Release (dev)|Win32"
>
<Tool
Name="VCCLCompilerTool"
CompileAs="0"
/>
</FileConfiguration>
<FileConfiguration
Name="Release (nondev) [public]|Win32"
>
<Tool
Name="VCCLCompilerTool"
CompileAs="0"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\asio\asio.h"
>
</File>
<File
RelativePath=".\asio\ASIOConvertSamples.cpp"
>
<FileConfiguration
Name="Release (dev)|Win32"
>
<Tool
Name="VCCLCompilerTool"
CompileAs="0"
/>
</FileConfiguration>
<FileConfiguration
Name="Release (nondev) [public]|Win32"
>
<Tool
Name="VCCLCompilerTool"
CompileAs="0"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\asio\ASIOConvertSamples.h"
>
</File>
<File
RelativePath=".\asio\asiodrivers.cpp"
>
<FileConfiguration
Name="Release (dev)|Win32"
>
<Tool
Name="VCCLCompilerTool"
CompileAs="0"
/>
</FileConfiguration>
<FileConfiguration
Name="Release (nondev) [public]|Win32"
>
<Tool
Name="VCCLCompilerTool"
CompileAs="0"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\asio\asiodrivers.h"
>
</File>
<File
RelativePath=".\asio\asiolist.cpp"
>
<FileConfiguration
Name="Release (dev)|Win32"
>
<Tool
Name="VCCLCompilerTool"
CompileAs="0"
/>
</FileConfiguration>
<FileConfiguration
Name="Release (nondev) [public]|Win32"
>
<Tool
Name="VCCLCompilerTool"
CompileAs="0"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\asio\asiolist.h"
>
</File>
<File
RelativePath=".\asioout.cpp"
>
<FileConfiguration
Name="Release (dev)|Win32"
>
<Tool
Name="VCCLCompilerTool"
CompileAs="0"
/>
</FileConfiguration>
<FileConfiguration
Name="Release (nondev) [public]|Win32"
>
<Tool
Name="VCCLCompilerTool"
CompileAs="0"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\asio\asiosys.h"
>
</File>
<File
RelativePath=".\asio\ginclude.h"
>
</File>
</Filter>
<Filter <Filter
Name="waveOut" Name="waveOut"
> >

View File

@ -1,878 +0,0 @@
#include "ginclude.h"
#include "ASIOConvertSamples.h"
#include <math.h>
#if MAC
#define TRUNCATE 0
#elif ASIO_CPU_X86 || ASIO_CPU_SPARC || ASIO_CPU_MIPS
#define TRUNCATE 1
#undef MAXFLOAT
#define MAXFLOAT 0x7fffff00L
#endif
ASIOConvertSamples::ASIOConvertSamples()
{
}
//-------------------------------------------------------------------------------------------
// mono
void ASIOConvertSamples::convertMono8Unsigned(long *source, char *dest, long frames)
{
unsigned char *c = (unsigned char *)source;
unsigned char a;
dest--;
while(--frames >= 0)
{
#if ASIO_LITTLE_ENDIAN
a = c[3];
#else
a = c[0];
#endif
c += 4;
a -= 0x80U;
*++dest = a;
}
}
void ASIOConvertSamples::convertMono8(long *source, char *dest, long frames)
{
char *c = (char *)source;
char a;
dest--;
while(--frames >= 0)
{
#if ASIO_LITTLE_ENDIAN
a = c[3];
#else
a = c[0];
#endif
c += 4;
*++dest = a;
}
}
void ASIOConvertSamples::convertMono16(long *source, short *dest, long frames)
{
#if ASIO_LITTLE_ENDIAN
char* s = (char*)source;
char* d = (char*)dest;
while(--frames >= 0)
{
*d++ = s[3]; // dest big endian, msb first
*d++ = s[2];
s += 4;
}
#else
long l;
source--;
dest--;
while(--frames >= 0)
{
l = *++source;
*++dest = (short)(l >> 16);
}
#endif
}
void ASIOConvertSamples::convertMono24(long *source, char *dest, long frames)
{
// work with chars in order to prevent misalignments
char *s = (char *)source;
char a, b, c;
dest--;
while(--frames >= 0)
{
#if ASIO_LITTLE_ENDIAN
a = s[3]; // msb
b = s[2];
c = s[1]; // lsb
#else
a = s[0];
b = s[1];
c = s[2];
#endif
s += 4;
*++dest = a; // big endian, msb first
*++dest = b;
*++dest = c;
}
}
// small endian
void ASIOConvertSamples::convertMono16SmallEndian(long *source, short *dest, long frames)
{
char *s = (char *)source;
char *d = (char *)dest;
char a, b;
d--;
while(--frames >= 0)
{
#if ASIO_LITTLE_ENDIAN
a = s[3];
b = s[2];
#else
a = s[0];
b = s[1];
#endif
s += 4;
*++d = b; // dest small endian, lsb first
*++d = a;
}
}
void ASIOConvertSamples::convertMono24SmallEndian(long *source, char *dest, long frames)
{
// work with chars in order to prevent misalignments
char *s = (char *)source;
char a, b, c;
dest--;
while(--frames >= 0)
{
#if ASIO_LITTLE_ENDIAN
a = s[3];
b = s[2];
c = s[1];
#else
a = s[0];
b = s[1];
c = s[2];
#endif
s += 4;
*++dest = c; // lsb first
*++dest = b;
*++dest = a;
}
}
//-------------------------------------------------------------------------------------------
// stereo interleaved
void ASIOConvertSamples::convertStereo8InterleavedUnsigned(long *left, long *right, char *dest, long frames)
{
unsigned char *cl = (unsigned char *)left;
unsigned char *cr = (unsigned char *)right;
unsigned char a, b;
dest--;
while(--frames >= 0)
{
#if ASIO_LITTLE_ENDIAN
a = cl[3];
b = cr[3];
#else
a = cl[0];
b = cr[0];
#endif
cl += 4;
cr += 4;
a -= 0x80U;
b -= 0x80U;
*++dest = a;
*++dest = b;
}
}
void ASIOConvertSamples::convertStereo8Interleaved(long *left, long *right, char *dest, long frames)
{
unsigned char *cl = (unsigned char *)left;
unsigned char *cr = (unsigned char *)right;
unsigned char a, b;
dest--;
while(--frames >= 0)
{
#if ASIO_LITTLE_ENDIAN
a = cl[3];
b = cr[3];
#else
a = cl[0];
b = cr[0];
#endif
cl += 4;
cr += 4;
*++dest = a;
*++dest = b;
}
}
void ASIOConvertSamples::convertStereo16Interleaved(long *left, long *right, short *dest, long frames)
{
#if ASIO_LITTLE_ENDIAN
char* sl = (char*)left;
char* sr = (char*)right;
char* d = (char*)dest;
while(--frames >= 0)
{
*d++ = sl[3]; // msb first
*d++ = sl[2];
*d++ = sr[3];
*d++ = sr[2];
sl += 4;
sr += 4;
}
#else
long l, r;
left--;
right--;
dest--;
while(--frames >= 0)
{
l = *++left;
r = *++right;
*++dest = (short)(l >> 16);
*++dest = (short)(r >> 16);
}
#endif
}
void ASIOConvertSamples::convertStereo24Interleaved(long *left, long *right, char *dest, long frames)
{
// work with chars in order to prevent misalignments
char *sl = (char *)left;
char *sr = (char *)right;
char al, bl, cl, ar, br, cr;
dest--;
while(--frames >= 0)
{
#if ASIO_LITTLE_ENDIAN
al = sl[3];
bl = sl[2];
cl = sl[1];
ar = sr[3];
br = sr[2];
cr = sr[1];
#else
al = sl[0];
bl = sl[1];
cl = sl[2];
ar = sr[0];
br = sr[1];
cr = sr[2];
#endif
sl += 4;
sr += 4;
*++dest = al;
*++dest = bl;
*++dest = cl;
*++dest = ar;
*++dest = br;
*++dest = cr;
}
}
void ASIOConvertSamples::convertStereo16InterleavedSmallEndian(long *left, long *right, short *dest, long frames)
{
char *sl = (char *)left;
char *sr = (char *)right;
char *d = (char *)dest;
char al, bl, ar, br;
d--;
while(--frames >= 0)
{
#if ASIO_LITTLE_ENDIAN
al = sl[3];
bl = sl[2];
ar = sr[3];
br = sr[2];
#else
al = sl[0];
bl = sl[1];
ar = sr[0];
br = sr[1];
#endif
sl += 4;
sr += 4;
*++d = bl; // lsb first
*++d = al;
*++d = br;
*++d = ar;
}
}
void ASIOConvertSamples::convertStereo24InterleavedSmallEndian(long *left, long *right, char *dest, long frames)
{
// work with chars in order to prevent misalignments
char *sl = (char *)left;
char *sr = (char *)right;
char al, bl, cl, ar, br, cr;
dest--;
while(--frames >= 0)
{
#if ASIO_LITTLE_ENDIAN
al = sl[3];
bl = sl[2];
cl = sl[1];
ar = sr[3];
br = sr[2];
cr = sr[1];
#else
al = sl[0];
bl = sl[1];
cl = sl[2];
ar = sr[0];
br = sr[1];
cr = sr[2];
#endif
sl += 4;
sr += 4;
*++dest = cl;
*++dest = bl;
*++dest = al;
*++dest = cr;
*++dest = br;
*++dest = ar;
}
}
//-------------------------------------------------------------------------------------------
// stereo split
void ASIOConvertSamples::convertStereo8Unsigned(long *left, long *right, char *dLeft, char *dRight, long frames)
{
unsigned char *cl = (unsigned char *)left;
unsigned char *cr = (unsigned char *)right;
unsigned char a, b;
dLeft--;
dRight--;
while(--frames >= 0)
{
#if ASIO_LITTLE_ENDIAN
a = cl[3];
b = cr[3];
#else
a = cl[0];
b = cr[0];
#endif
cl += 4;
cr += 4;
a -= 0x80U;
b -= 0x80U;
*++dLeft = a;
*++dRight = b;
}
}
void ASIOConvertSamples::convertStereo8(long *left, long *right, char *dLeft, char *dRight, long frames)
{
unsigned char *cl = (unsigned char *)left;
unsigned char *cr = (unsigned char *)right;
unsigned char a, b;
dLeft--;
dRight--;
while(--frames >= 0)
{
#if ASIO_LITTLE_ENDIAN
a = cl[3];
b = cr[3];
#else
a = cl[0];
b = cr[0];
#endif
cl += 4;
cr += 4;
*++dLeft = a;
*++dRight = b;
}
}
void ASIOConvertSamples::convertStereo16(long *left, long *right, short *dLeft, short *dRight, long frames)
{
#if ASIO_LITTLE_ENDIAN
char* sl = (char*)left;
char* sr = (char*)right;
char* dl = (char*)dLeft;
char* dr = (char*)dRight;
while(--frames >= 0)
{
*dl++ = sl[3]; // msb first
*dl++ = sl[2];
*dr++ = sr[3];
*dr++ = sr[2];
sl += 4;
sr += 4;
}
#else
long l, r;
left--;
right--;
dLeft--;
dRight--;
while(--frames >= 0)
{
l = *++left;
r = *++right;
*++dLeft = (short)(l >> 16);
*++dRight = (short)(r >> 16);
}
#endif
}
void ASIOConvertSamples::convertStereo24(long *left, long *right, char *dLeft, char *dRight, long frames)
{
// work with chars in order to prevent misalignments
char *sl = (char *)left;
char *sr = (char *)right;
char al, bl, cl, ar, br, cr;
dLeft--;
dRight--;
while(--frames >= 0)
{
#if ASIO_LITTLE_ENDIAN
al = sl[3];
bl = sl[2];
cl = sl[1];
ar = sr[3];
br = sr[2];
cr = sr[1];
#else
al = sl[0];
bl = sl[1];
cl = sl[2];
ar = sr[0];
br = sr[1];
cr = sr[2];
#endif
sl += 4;
sr += 4;
*++dLeft = al;
*++dLeft = bl;
*++dLeft = cl;
*++dRight = ar;
*++dRight = br;
*++dRight = cr;
}
}
// small endian
void ASIOConvertSamples::convertStereo16SmallEndian(long *left, long *right, short *dLeft, short *dRight, long frames)
{
char *sl = (char *)left;
char *sr = (char *)right;
char *dl = (char *)dLeft;
char *dr = (char *)dRight;
char al, bl, ar, br;
dl--;
dr--;
while(--frames >= 0)
{
#if ASIO_LITTLE_ENDIAN
al = sl[3];
bl = sl[2];
ar = sr[3];
br = sr[2];
#else
al = sl[0];
bl = sl[1];
ar = sr[0];
br = sr[1];
#endif
sl += 4;
sr += 4;
*++dl = bl;
*++dl = al;
*++dr = br;
*++dr = ar;
}
}
void ASIOConvertSamples::convertStereo24SmallEndian(long *left, long *right, char *dLeft, char *dRight, long frames)
{
// work with chars in order to prevent misalignments
char *sl = (char *)left;
char *sr = (char *)right;
char al, bl, cl, ar, br, cr;
dLeft--;
dRight--;
while(--frames >= 0)
{
#if ASIO_LITTLE_ENDIAN
al = sl[3];
bl = sl[2];
cl = sl[1];
ar = sr[3];
br = sr[2];
cr = sr[1];
#else
al = sl[0];
bl = sl[1];
cl = sl[2];
ar = sr[0];
br = sr[1];
cr = sr[2];
#endif
sl += 4;
sr += 4;
*++dLeft = cl;
*++dLeft = bl;
*++dLeft = al;
*++dRight = cr;
*++dRight = br;
*++dRight = ar;
}
}
//------------------------------------------------------------------------------------------
// in place integer conversions
void ASIOConvertSamples::int32msb16to16inPlace(long *in, long frames)
{
short *d1 = (short *)in;
short* out = d1;
#if ASIO_LITTLE_ENDIAN
d1++;
#endif
while(--frames >= 0)
{
*out++ = *d1;
d1 += 2;
}
}
void ASIOConvertSamples::int32lsb16to16inPlace(long *in, long frames)
{
short *d1 = (short *)in;
short* out = d1;
#if !ASIO_LITTLE_ENDIAN
d1++;
#endif
while(--frames >= 0)
{
*out++ = *d1;
d1 += 2;
}
}
void ASIOConvertSamples::int32msb16shiftedTo16inPlace(long *in, long frames, long shift)
{
short* out = (short*)in;
while(--frames >= 0)
*out++ = (short)(*in++ >> shift);
}
void ASIOConvertSamples::int24msbto16inPlace(unsigned char *in, long frames)
{
short a;
short* out = (short*)in;
while(--frames >= 0)
{
#if ASIO_LITTLE_ENDIAN
a = (short)in[2];
a <<= 8;
a |= (in[1] & 0xff);
#else
a = (short)in[0];
a <<= 8;
a |= (in[1] & 0xff);
#endif
*out++ = a;
in += 3;
}
}
//-----------------------------------------------------------------------------------------
void ASIOConvertSamples::shift32(void* buffer, long shiftAmount, long targetByteWidth,
bool revertEndian, long sampleFrames)
{
long a;
long frames = sampleFrames;
long* source = (long*)buffer;
if(revertEndian)
{
reverseEndian(buffer, 4, sampleFrames);
revertEndian = false;
}
if(targetByteWidth == 2)
{
short* dest = (short*)buffer;
short* al = (short*)&a;
#if ASIO_LITTLE_ENDIAN
al++;
#endif
while(--frames >= 0)
{
a = *source++;
a <<= shiftAmount;
*dest++ = *al;
}
}
else if(targetByteWidth == 3)
{
char* dest = (char*)buffer;
source = (long*)buffer;
char* aa = (char*)&a;
while(--frames >= 0)
{
a = *source++;
a <<= shiftAmount;
#if ASIO_LITTLE_ENDIAN
dest[0] = aa[1]; // lsb
dest[1] = aa[2];
dest[2] = aa[3]; // msb
#else
dest[0] = aa[0]; // msb
dest[1] = aa[1];
dest[2] = aa[2]; // lsb
#endif
dest += 3;
}
}
else if(targetByteWidth == 4)
{
long* dest = source;
while(--frames >= 0)
*dest++ = *source++ << shiftAmount;
}
}
void ASIOConvertSamples::reverseEndian(void* buffer, long byteWidth, long frames)
{
char* a = (char*)buffer;
char* b = a;
char c;
if(byteWidth == 2)
{
while(--frames >= 0)
{
c = a[0];
a[0] = a[1];
a[1] = c;
a += 2;
}
}
else if(byteWidth == 3)
{
while(--frames >= 0)
{
c = a[0];
a[0] = a[2];
a[2] = c;
a += 3;
}
}
else if(byteWidth == 4)
{
while(--frames >= 0)
{
c = a[0];
a[0] = a[3];
a[3] = c;
c = a[1];
a[1] = a[2];
a[2] = c;
a += 4;
}
}
else if(byteWidth == 8)
{
while(--frames >= 0)
{
c = a[0];
a[0] = a[7];
a[7] = c;
c = a[1];
a[1] = a[6];
a[6] = c;
c = a[2];
a[2] = a[5];
a[5] = c;
c = a[3];
a[3] = a[4];
a[4] = c;
a += 4;
}
}
}
//-------------------------------------------------------------------------------------------------
void ASIOConvertSamples::int32to16inPlace(void* buffer, long frames)
{
short* in = (short*)buffer;
short* out = in;
#if ASIO_LITTLE_ENDIAN
in++;
#endif
while(--frames >= 0)
{
*out++ = *in;
in += 2;
}
}
void ASIOConvertSamples::int24to16inPlace(void* buffer, long frames)
{
char* from = (char*)buffer;
char* to = from;
while(--frames >= 0)
{
#if ASIO_LITTLE_ENDIAN
to[0] = from[1];
to[1] = from[2];
#else
to[0] = from[0];
to[1] = from[1];
#endif
from += 3;
to += 2;
}
}
void ASIOConvertSamples::int32to24inPlace(void* buffer, long frames)
{
long* in = (long*)buffer;
char* out = (char*)buffer;
long a;
while(--frames >= 0)
{
a = *in++;
a >>= 8; // 32->24
#if ASIO_LITTLE_ENDIAN
out[0] = (char)a; // lsb
a >>= 8;
out[1] = (char)a;
a >>= 8;
out[2] = (char)a;
#else
out[2] = (char)a; // lsb
a >>= 8;
out[1] = (char)a;
a >>= 8;
out[0] = (char)a;
#endif
out += 3;
}
}
void ASIOConvertSamples::int16to24inPlace(void* buffer, long frames)
{
char* in = (char*)buffer;
char* out = (char*)buffer;
in += frames * 2;
out += frames * 3;
while(--frames >= 0)
{
out -= 3;
in -= 2;
#if ASIO_LITTLE_ENDIAN
out[2] = in[1]; // msb
out[1] = in[0]; // lsb
out[0] = 0;
#else
out[2] = 0;
out[1] = in[1]; // lsb
out[0] = in[0]; // msb
#endif
}
}
void ASIOConvertSamples::int24to32inPlace(void* buffer, long frames)
{
long a, b, c;
char* in = (char*)buffer;
long* out = (long*)buffer;
in += (frames * 3);
out += frames;
while(--frames >= 0)
{
#if ASIO_LITTLE_ENDIAN
a = (long)in[-1]; // msb
b = (long)in[-2];
c = (long)in[-3];
#else
a = (long)in[-3]; // msb
b = (long)in[-2];
c = (long)in[-1];
#endif
a <<= 24;
b <<= 16;
b &= 0x00ff0000;
a |= b;
c <<= 8;
c &= 0x0000ff00;
a |= c;
*--out = a;
in -= 3;
}
}
void ASIOConvertSamples::int16to32inPlace(void* buffer, long frames)
{
short* in = (short*)buffer;
long* out = (long*)buffer;
in += frames;
out += frames;
while(--frames >= 0)
*--out = ((long)(*--in)) << 16;
}
//------------------------------------------------------------------------------------------
// float to int
const double fScaler16 = (double)0x7fffL;
const double fScaler24 = (double)0x7fffffL;
const double fScaler32 = (double)0x7fffffffL;
void ASIOConvertSamples::float32toInt16inPlace(float* buffer, long frames)
{
double sc = fScaler16 + .49999;
short* b = (short*)buffer;
while(--frames >= 0)
*b++ = (short)((double)(*buffer++) * sc);
}
void ASIOConvertSamples::float32toInt24inPlace(float* buffer, long frames)
{
double sc = fScaler24 + .49999;
long a;
char* b = (char*)buffer;
char* aa = (char*)&a;
while(--frames >= 0)
{
a = (long)((double)(*buffer++) * sc);
#if ASIO_LITTLE_ENDIAN
*b++ = aa[3];
*b++ = aa[2];
*b++ = aa[1];
#else
*b++ = aa[1];
*b++ = aa[2];
*b++ = aa[3];
#endif
}
}
void ASIOConvertSamples::float32toInt32inPlace(float* buffer, long frames)
{
double sc = fScaler32 + .49999;
long* b = (long*)buffer;
while(--frames >= 0)
*b++ = (long)((double)(*buffer++) * sc);
}

View File

@ -1,62 +0,0 @@
#ifndef __ASIOConvertSamples__
#define __ASIOConvertSamples__
class ASIOConvertSamples
{
public:
ASIOConvertSamples();
~ASIOConvertSamples() {}
// format converters, input 32 bit integer
// mono
void convertMono8(long *source, char *dest, long frames);
void convertMono8Unsigned(long *source, char *dest, long frames);
void convertMono16(long *source, short *dest, long frames);
void convertMono16SmallEndian(long *source, short *dest, long frames);
void convertMono24(long *source, char *dest, long frames);
void convertMono24SmallEndian(long *source, char *dest, long frames);
// stereo interleaved
void convertStereo8Interleaved(long *left, long *right, char *dest, long frames);
void convertStereo8InterleavedUnsigned(long *left, long *right, char *dest, long frames);
void convertStereo16Interleaved(long *left, long *right, short *dest, long frames);
void convertStereo16InterleavedSmallEndian(long *left, long *right, short *dest, long frames);
void convertStereo24Interleaved(long *left, long *right, char *dest, long frames);
void convertStereo24InterleavedSmallEndian(long *left, long *right, char *dest, long frames);
// stereo split
void convertStereo8(long *left, long *right, char *dLeft, char *dRight, long frames);
void convertStereo8Unsigned(long *left, long *right, char *dLeft, char *dRight, long frames);
void convertStereo16(long *left, long *right, short *dLeft, short *dRight, long frames);
void convertStereo16SmallEndian(long *left, long *right, short *dLeft, short *dRight, long frames);
void convertStereo24(long *left, long *right, char *dLeft, char *dRight, long frames);
void convertStereo24SmallEndian(long *left, long *right, char *dLeft, char *dRight, long frames);
// integer in place conversions
void int32msb16to16inPlace(long *in, long frames);
void int32lsb16to16inPlace(long *in, long frames);
void int32msb16shiftedTo16inPlace(long *in1, long frames, long shift);
void int24msbto16inPlace(unsigned char *in, long frames);
// integer to integer
void shift32(void* buffer, long shiftAmount, long targetByteWidth,
bool reverseEndian, long frames);
void reverseEndian(void* buffer, long byteWidth, long frames);
void int32to16inPlace(void* buffer, long frames);
void int24to16inPlace(void* buffer, long frames);
void int32to24inPlace(void* buffer, long frames);
void int16to24inPlace(void* buffer, long frames);
void int24to32inPlace(void* buffer, long frames);
void int16to32inPlace(void* buffer, long frames);
// float to integer
void float32toInt16inPlace(float* buffer, long frames);
void float32toInt24inPlace(float* buffer, long frames);
void float32toInt32inPlace(float* buffer, long frames);
};
#endif

View File

@ -1,257 +0,0 @@
/*
Steinberg Audio Stream I/O API
(c) 1996, Steinberg Soft- und Hardware GmbH
asio.cpp
asio functions entries which translate the
asio interface to the asiodrvr class methods
*/
#include <string.h>
#include "asiosys.h" // platform definition
#include "asio.h"
#if MAC
#include "asiodrvr.h"
#pragma export on
AsioDriver *theAsioDriver = 0;
extern "C"
{
long main()
{
return 'ASIO';
}
#elif WINDOWS
#include "windows.h"
#include "iasiodrv.h"
#include "asiodrivers.h"
IASIO *theAsioDriver = 0;
//extern AsioDrivers *asioDrivers;
#elif SGI || SUN || BEOS || LINUX
#include "asiodrvr.h"
static AsioDriver *theAsioDriver = 0;
#endif
//-----------------------------------------------------------------------------------------------------
ASIOError ASIOInit(ASIODriverInfo *info)
{
#if MAC || SGI || SUN || BEOS || LINUX
if(theAsioDriver)
{
delete theAsioDriver;
theAsioDriver = 0;
}
info->driverVersion = 0;
strcpy(info->name, "No ASIO Driver");
theAsioDriver = getDriver();
if(!theAsioDriver)
{
strcpy(info->errorMessage, "Not enough memory for the ASIO driver!");
return ASE_NotPresent;
}
if(!theAsioDriver->init(info->sysRef))
{
theAsioDriver->getErrorMessage(info->errorMessage);
delete theAsioDriver;
theAsioDriver = 0;
return ASE_NotPresent;
}
strcpy(info->errorMessage, "No ASIO Driver Error");
theAsioDriver->getDriverName(info->name);
info->driverVersion = theAsioDriver->getDriverVersion();
return ASE_OK;
#else
info->driverVersion = 0;
strcpy(info->name, "No ASIO Driver");
if(theAsioDriver) // must be loaded!
{
if(!theAsioDriver->init(info->sysRef))
{
theAsioDriver->getErrorMessage(info->errorMessage);
theAsioDriver = 0;
return ASE_NotPresent;
}
strcpy(info->errorMessage, "No ASIO Driver Error");
theAsioDriver->getDriverName(info->name);
info->driverVersion = theAsioDriver->getDriverVersion();
return ASE_OK;
}
return ASE_NotPresent;
#endif // !MAC
}
ASIOError ASIOExit(void)
{
if(theAsioDriver)
{
#if WINDOWS
//asioDrivers->removeCurrentDriver();
#else
delete theAsioDriver;
#endif
}
theAsioDriver = 0;
return ASE_OK;
}
ASIOError ASIOStart(void)
{
if(!theAsioDriver)
return ASE_NotPresent;
return theAsioDriver->start();
}
ASIOError ASIOStop(void)
{
if(!theAsioDriver)
return ASE_NotPresent;
return theAsioDriver->stop();
}
ASIOError ASIOGetChannels(long *numInputChannels, long *numOutputChannels)
{
if(!theAsioDriver)
{
*numInputChannels = *numOutputChannels = 0;
return ASE_NotPresent;
}
return theAsioDriver->getChannels(numInputChannels, numOutputChannels);
}
ASIOError ASIOGetLatencies(long *inputLatency, long *outputLatency)
{
if(!theAsioDriver)
{
*inputLatency = *outputLatency = 0;
return ASE_NotPresent;
}
return theAsioDriver->getLatencies(inputLatency, outputLatency);
}
ASIOError ASIOGetBufferSize(long *minSize, long *maxSize, long *preferredSize, long *granularity)
{
if(!theAsioDriver)
{
*minSize = *maxSize = *preferredSize = *granularity = 0;
return ASE_NotPresent;
}
return theAsioDriver->getBufferSize(minSize, maxSize, preferredSize, granularity);
}
ASIOError ASIOCanSampleRate(ASIOSampleRate sampleRate)
{
if(!theAsioDriver)
return ASE_NotPresent;
return theAsioDriver->canSampleRate(sampleRate);
}
ASIOError ASIOGetSampleRate(ASIOSampleRate *currentRate)
{
if(!theAsioDriver)
return ASE_NotPresent;
return theAsioDriver->getSampleRate(currentRate);
}
ASIOError ASIOSetSampleRate(ASIOSampleRate sampleRate)
{
if(!theAsioDriver)
return ASE_NotPresent;
return theAsioDriver->setSampleRate(sampleRate);
}
ASIOError ASIOGetClockSources(ASIOClockSource *clocks, long *numSources)
{
if(!theAsioDriver)
{
*numSources = 0;
return ASE_NotPresent;
}
return theAsioDriver->getClockSources(clocks, numSources);
}
ASIOError ASIOSetClockSource(long reference)
{
if(!theAsioDriver)
return ASE_NotPresent;
return theAsioDriver->setClockSource(reference);
}
ASIOError ASIOGetSamplePosition(ASIOSamples *sPos, ASIOTimeStamp *tStamp)
{
if(!theAsioDriver)
return ASE_NotPresent;
return theAsioDriver->getSamplePosition(sPos, tStamp);
}
ASIOError ASIOGetChannelInfo(ASIOChannelInfo *info)
{
if(!theAsioDriver)
{
info->channelGroup = -1;
info->type = ASIOSTInt16MSB;
strcpy(info->name, "None");
return ASE_NotPresent;
}
return theAsioDriver->getChannelInfo(info);
}
ASIOError ASIOCreateBuffers(ASIOBufferInfo *bufferInfos, long numChannels,
long bufferSize, ASIOCallbacks *callbacks)
{
if(!theAsioDriver)
{
ASIOBufferInfo *info = bufferInfos;
for(long i = 0; i < numChannels; i++, info++)
info->buffers[0] = info->buffers[1] = 0;
return ASE_NotPresent;
}
return theAsioDriver->createBuffers(bufferInfos, numChannels, bufferSize, callbacks);
}
ASIOError ASIODisposeBuffers(void)
{
if(!theAsioDriver)
return ASE_NotPresent;
return theAsioDriver->disposeBuffers();
}
ASIOError ASIOControlPanel(void)
{
if(!theAsioDriver)
return ASE_NotPresent;
return theAsioDriver->controlPanel();
}
ASIOError ASIOFuture(long selector, void *opt)
{
if(!theAsioDriver)
return ASE_NotPresent;
return theAsioDriver->future(selector, opt);
}
ASIOError ASIOOutputReady(void)
{
if(!theAsioDriver)
return ASE_NotPresent;
return theAsioDriver->outputReady();
}
#if MAC
} // extern "C"
#pragma export off
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,173 +0,0 @@
#include <string.h>
#include "asiodrivers.h"
//------------------------------------------------------------------------------------
#if MAC
bool resolveASIO(unsigned long aconnID);
AsioDrivers::AsioDrivers() : CodeFragments("ASIO Drivers", 'AsDr', 'Asio')
{
connID = -1;
curIndex = -1;
}
AsioDrivers::~AsioDrivers()
{
removeCurrentDriver();
}
bool AsioDrivers::getCurrentDriverName(char *name)
{
if(curIndex >= 0)
return getName(curIndex, name);
return false;
}
long AsioDrivers::getDriverNames(char **names, long maxDrivers)
{
for(long i = 0; i < getNumFragments() && i < maxDrivers; i++)
getName(i, names[i]);
return getNumFragments() < maxDrivers ? getNumFragments() : maxDrivers;
}
bool AsioDrivers::loadDriver(char *name)
{
char dname[64];
unsigned long newID;
for(long i = 0; i < getNumFragments(); i++)
{
if(getName(i, dname) && !strcmp(name, dname))
{
if(newInstance(i, &newID))
{
if(resolveASIO(newID))
{
if(connID != -1)
removeInstance(curIndex, connID);
curIndex = i;
connID = newID;
return true;
}
}
break;
}
}
return false;
}
void AsioDrivers::removeCurrentDriver()
{
if(connID != -1)
removeInstance(curIndex, connID);
connID = -1;
curIndex = -1;
}
//------------------------------------------------------------------------------------
#elif WINDOWS
#include "iasiodrv.h"
extern IASIO* theAsioDriver;
AsioDrivers::AsioDrivers() : AsioDriverList()
{
curIndex = -1;
}
AsioDrivers::~AsioDrivers()
{
}
bool AsioDrivers::getCurrentDriverName(char *name)
{
if(curIndex >= 0)
return asioGetDriverName(curIndex, name, 32) == 0 ? true : false;
name[0] = 0;
return false;
}
long AsioDrivers::getDriverNames(char **names, long maxDrivers)
{
for(long i = 0; i < asioGetNumDev() && i < maxDrivers; i++)
asioGetDriverName(i, names[i], 32);
return asioGetNumDev() < maxDrivers ? asioGetNumDev() : maxDrivers;
}
bool AsioDrivers::loadDriver(char *name)
{
char dname[64];
char curName[64];
for(long i = 0; i < asioGetNumDev(); i++)
{
if(!asioGetDriverName(i, dname, 32) && !strcmp(name, dname))
{
curName[0] = 0;
getCurrentDriverName(curName); // in case we fail...
removeCurrentDriver();
if(!asioOpenDriver(i, (void **)&theAsioDriver))
{
curIndex = i;
return true;
}
else
{
theAsioDriver = 0;
if(curName[0] && strcmp(dname, curName))
loadDriver(curName); // try restore
}
break;
}
}
return false;
}
void AsioDrivers::removeCurrentDriver()
{
if(curIndex != -1)
asioCloseDriver(curIndex);
curIndex = -1;
}
#elif SGI || BEOS
#include "asiolist.h"
AsioDrivers::AsioDrivers()
: AsioDriverList()
{
curIndex = -1;
}
AsioDrivers::~AsioDrivers()
{
}
bool AsioDrivers::getCurrentDriverName(char *name)
{
return false;
}
long AsioDrivers::getDriverNames(char **names, long maxDrivers)
{
return 0;
}
bool AsioDrivers::loadDriver(char *name)
{
return false;
}
void AsioDrivers::removeCurrentDriver()
{
}
#else
#error implement me
#endif

View File

@ -1,41 +0,0 @@
#ifndef __AsioDrivers__
#define __AsioDrivers__
#include "ginclude.h"
#if MAC
#include "CodeFragments.hpp"
class AsioDrivers : public CodeFragments
#elif WINDOWS
#include <windows.h>
#include "asiolist.h"
class AsioDrivers : public AsioDriverList
#elif SGI || BEOS
#include "asiolist.h"
class AsioDrivers : public AsioDriverList
#else
#error implement me
#endif
{
public:
AsioDrivers();
~AsioDrivers();
bool getCurrentDriverName(char *name);
long getDriverNames(char **names, long maxDrivers);
bool loadDriver(char *name);
void removeCurrentDriver();
long getCurrentDriverIndex() {return curIndex;}
protected:
unsigned long connID;
long curIndex;
};
#endif

View File

@ -1,139 +0,0 @@
/*
Steinberg Audio Stream I/O API
(c) 1996, Steinberg Soft- und Hardware GmbH
charlie (May 1996)
asiodrvr.cpp
c++ superclass to implement asio functionality. from this,
you can derive whatever required
*/
#include <string.h>
#include "asiosys.h"
#include "asiodrvr.h"
#if WINDOWS
#error do not use this
AsioDriver::AsioDriver (LPUNKNOWN pUnk, HRESULT *phr) : CUnknown("My AsioDriver", pUnk, phr)
{
}
#else
AsioDriver::AsioDriver()
{
}
#endif
AsioDriver::~AsioDriver()
{
}
ASIOBool AsioDriver::init(void *sysRef)
{
return ASE_NotPresent;
}
void AsioDriver::getDriverName(char *name)
{
strcpy(name, "No Driver");
}
long AsioDriver::getDriverVersion()
{
return 0;
}
void AsioDriver::getErrorMessage(char *string)
{
strcpy(string, "ASIO Driver Implementation Error!");
}
ASIOError AsioDriver::start()
{
return ASE_NotPresent;
}
ASIOError AsioDriver::stop()
{
return ASE_NotPresent;
}
ASIOError AsioDriver::getChannels(long *numInputChannels, long *numOutputChannels)
{
return ASE_NotPresent;
}
ASIOError AsioDriver::getLatencies(long *inputLatency, long *outputLatency)
{
return ASE_NotPresent;
}
ASIOError AsioDriver::getBufferSize(long *minSize, long *maxSize,
long *preferredSize, long *granularity)
{
return ASE_NotPresent;
}
ASIOError AsioDriver::canSampleRate(ASIOSampleRate sampleRate)
{
return ASE_NotPresent;
}
ASIOError AsioDriver::getSampleRate(ASIOSampleRate *sampleRate)
{
return ASE_NotPresent;
}
ASIOError AsioDriver::setSampleRate(ASIOSampleRate sampleRate)
{
return ASE_NotPresent;
}
ASIOError AsioDriver::getClockSources(ASIOClockSource *clocks, long *numSources)
{
*numSources = 0;
return ASE_NotPresent;
}
ASIOError AsioDriver::setClockSource(long reference)
{
return ASE_NotPresent;
}
ASIOError AsioDriver::getSamplePosition(ASIOSamples *sPos, ASIOTimeStamp *tStamp)
{
return ASE_NotPresent;
}
ASIOError AsioDriver::getChannelInfo(ASIOChannelInfo *info)
{
return ASE_NotPresent;
}
ASIOError AsioDriver::createBuffers(ASIOBufferInfo *channelInfos, long numChannels,
long bufferSize, ASIOCallbacks *callbacks)
{
return ASE_NotPresent;
}
ASIOError AsioDriver::disposeBuffers()
{
return ASE_NotPresent;
}
ASIOError AsioDriver::controlPanel()
{
return ASE_NotPresent;
}
ASIOError AsioDriver::future(long selector, void *opt)
{
return ASE_NotPresent;
}
ASIOError AsioDriver::outputReady()
{
return ASE_NotPresent;
}

View File

@ -1,76 +0,0 @@
/*
Steinberg Audio Stream I/O API
(c) 1996, Steinberg Soft- und Hardware GmbH
charlie (May 1996)
asiodrvr.h
c++ superclass to implement asio functionality. from this,
you can derive whatever required
*/
#ifndef _asiodrvr_
#define _asiodrvr_
// cpu and os system we are running on
#include "asiosys.h"
// basic "C" interface
#include "asio.h"
class AsioDriver;
extern AsioDriver *getDriver(); // for generic constructor
#if WINDOWS
#include <windows.h>
#include "combase.h"
#include "iasiodrv.h"
class AsioDriver : public IASIO ,public CUnknown
{
public:
AsioDriver(LPUNKNOWN pUnk, HRESULT *phr);
DECLARE_IUNKNOWN
// Factory method
static CUnknown *CreateInstance(LPUNKNOWN pUnk, HRESULT *phr);
// IUnknown
virtual HRESULT STDMETHODCALLTYPE NonDelegatingQueryInterface(REFIID riid,void **ppvObject);
#else
class AsioDriver
{
public:
AsioDriver();
#endif
virtual ~AsioDriver();
virtual ASIOBool init(void* sysRef);
virtual void getDriverName(char *name); // max 32 bytes incl. terminating zero
virtual long getDriverVersion();
virtual void getErrorMessage(char *string); // max 124 bytes incl.
virtual ASIOError start();
virtual ASIOError stop();
virtual ASIOError getChannels(long *numInputChannels, long *numOutputChannels);
virtual ASIOError getLatencies(long *inputLatency, long *outputLatency);
virtual ASIOError getBufferSize(long *minSize, long *maxSize,
long *preferredSize, long *granularity);
virtual ASIOError canSampleRate(ASIOSampleRate sampleRate);
virtual ASIOError getSampleRate(ASIOSampleRate *sampleRate);
virtual ASIOError setSampleRate(ASIOSampleRate sampleRate);
virtual ASIOError getClockSources(ASIOClockSource *clocks, long *numSources);
virtual ASIOError setClockSource(long reference);
virtual ASIOError getSamplePosition(ASIOSamples *sPos, ASIOTimeStamp *tStamp);
virtual ASIOError getChannelInfo(ASIOChannelInfo *info);
virtual ASIOError createBuffers(ASIOBufferInfo *bufferInfos, long numChannels,
long bufferSize, ASIOCallbacks *callbacks);
virtual ASIOError disposeBuffers();
virtual ASIOError controlPanel();
virtual ASIOError future(long selector, void *opt);
virtual ASIOError outputReady();
};
#endif

View File

@ -1,268 +0,0 @@
#include <windows.h>
#include "iasiodrv.h"
#include "asiolist.h"
#define ASIODRV_DESC "description"
#define INPROC_SERVER "InprocServer32"
#define ASIO_PATH "software\\asio"
#define COM_CLSID "clsid"
// ******************************************************************
// Local Functions
// ******************************************************************
static LONG findDrvPath (char *clsidstr,char *dllpath,int dllpathsize)
{
HKEY hkEnum,hksub,hkpath;
char databuf[512];
LONG cr,rc = -1;
DWORD datatype,datasize;
DWORD index;
OFSTRUCT ofs;
HFILE hfile;
BOOL found = FALSE;
CharLowerBuff(clsidstr,strlen(clsidstr));
if ((cr = RegOpenKey(HKEY_CLASSES_ROOT,COM_CLSID,&hkEnum)) == ERROR_SUCCESS) {
index = 0;
while (cr == ERROR_SUCCESS && !found) {
cr = RegEnumKey(hkEnum,index++,(LPTSTR)databuf,512);
if (cr == ERROR_SUCCESS) {
CharLowerBuff(databuf,strlen(databuf));
if (!(strcmp(databuf,clsidstr))) {
if ((cr = RegOpenKeyEx(hkEnum,(LPCTSTR)databuf,0,KEY_READ,&hksub)) == ERROR_SUCCESS) {
if ((cr = RegOpenKeyEx(hksub,(LPCTSTR)INPROC_SERVER,0,KEY_READ,&hkpath)) == ERROR_SUCCESS) {
datatype = REG_SZ; datasize = (DWORD)dllpathsize;
cr = RegQueryValueEx(hkpath,0,0,&datatype,(LPBYTE)dllpath,&datasize);
if (cr == ERROR_SUCCESS) {
memset(&ofs,0,sizeof(OFSTRUCT));
ofs.cBytes = sizeof(OFSTRUCT);
hfile = OpenFile(dllpath,&ofs,OF_EXIST);
if (hfile) rc = 0;
}
RegCloseKey(hkpath);
}
RegCloseKey(hksub);
}
found = TRUE; // break out
}
}
}
RegCloseKey(hkEnum);
}
return rc;
}
static LPASIODRVSTRUCT newDrvStruct (HKEY hkey,char *keyname,int drvID,LPASIODRVSTRUCT lpdrv)
{
HKEY hksub;
char databuf[256];
char dllpath[MAXPATHLEN];
WORD wData[100];
CLSID clsid;
DWORD datatype,datasize;
LONG cr,rc;
if (!lpdrv) {
if ((cr = RegOpenKeyEx(hkey,(LPCTSTR)keyname,0,KEY_READ,&hksub)) == ERROR_SUCCESS) {
datatype = REG_SZ; datasize = 256;
cr = RegQueryValueEx(hksub,COM_CLSID,0,&datatype,(LPBYTE)databuf,&datasize);
if (cr == ERROR_SUCCESS) {
rc = findDrvPath (databuf,dllpath,MAXPATHLEN);
if (rc == 0) {
lpdrv = new ASIODRVSTRUCT[1];
if (lpdrv) {
memset(lpdrv,0,sizeof(ASIODRVSTRUCT));
lpdrv->drvID = drvID;
MultiByteToWideChar(CP_ACP,0,(LPCSTR)databuf,-1,(LPWSTR)wData,100);
if ((cr = CLSIDFromString((LPOLESTR)wData,(LPCLSID)&clsid)) == S_OK) {
memcpy(&lpdrv->clsid,&clsid,sizeof(CLSID));
}
datatype = REG_SZ; datasize = 256;
cr = RegQueryValueEx(hksub,ASIODRV_DESC,0,&datatype,(LPBYTE)databuf,&datasize);
if (cr == ERROR_SUCCESS) {
strncpy(lpdrv->drvname,databuf,127);
}
else strcpy(lpdrv->drvname,keyname);
}
}
}
RegCloseKey(hksub);
}
}
else lpdrv->next = newDrvStruct(hkey,keyname,drvID+1,lpdrv->next);
return lpdrv;
}
static void deleteDrvStruct (LPASIODRVSTRUCT lpdrv)
{
IASIO *iasio;
if (lpdrv != 0) {
deleteDrvStruct(lpdrv->next);
if (lpdrv->asiodrv) {
iasio = (IASIO *)lpdrv->asiodrv;
iasio->Release();
}
delete lpdrv;
}
}
static LPASIODRVSTRUCT getDrvStruct (int drvID,LPASIODRVSTRUCT lpdrv)
{
while (lpdrv) {
if (lpdrv->drvID == drvID) return lpdrv;
lpdrv = lpdrv->next;
}
return 0;
}
// ******************************************************************
// ******************************************************************
// AsioDriverList
// ******************************************************************
AsioDriverList::AsioDriverList ()
{
HKEY hkEnum = 0;
char keyname[MAXDRVNAMELEN];
LPASIODRVSTRUCT pdl;
LONG cr;
DWORD index = 0;
BOOL fin = FALSE;
numdrv = 0;
lpdrvlist = 0;
cr = RegOpenKey(HKEY_LOCAL_MACHINE,ASIO_PATH,&hkEnum);
while (cr == ERROR_SUCCESS) {
if ((cr = RegEnumKey(hkEnum,index++,(LPTSTR)keyname,MAXDRVNAMELEN))== ERROR_SUCCESS) {
lpdrvlist = newDrvStruct (hkEnum,keyname,0,lpdrvlist);
}
else fin = TRUE;
}
if (hkEnum) RegCloseKey(hkEnum);
pdl = lpdrvlist;
while (pdl) {
numdrv++;
pdl = pdl->next;
}
if (numdrv) CoInitialize(0); // initialize COM
}
AsioDriverList::~AsioDriverList ()
{
if (numdrv) {
deleteDrvStruct(lpdrvlist);
CoUninitialize();
}
}
LONG AsioDriverList::asioGetNumDev (VOID)
{
return (LONG)numdrv;
}
LONG AsioDriverList::asioOpenDriver (int drvID,LPVOID *asiodrv)
{
LPASIODRVSTRUCT lpdrv = 0;
long rc;
if (!asiodrv) return DRVERR_INVALID_PARAM;
if ((lpdrv = getDrvStruct(drvID,lpdrvlist)) != 0) {
if (!lpdrv->asiodrv) {
rc = CoCreateInstance(lpdrv->clsid,0,CLSCTX_INPROC_SERVER,lpdrv->clsid,asiodrv);
if (rc == S_OK) {
lpdrv->asiodrv = *asiodrv;
return 0;
}
// else if (rc == REGDB_E_CLASSNOTREG)
// strcpy (info->messageText, "Driver not registered in the Registration Database!");
}
else rc = DRVERR_DEVICE_ALREADY_OPEN;
}
else rc = DRVERR_DEVICE_NOT_FOUND;
return rc;
}
LONG AsioDriverList::asioCloseDriver (int drvID)
{
LPASIODRVSTRUCT lpdrv = 0;
IASIO *iasio;
if ((lpdrv = getDrvStruct(drvID,lpdrvlist)) != 0) {
if (lpdrv->asiodrv) {
iasio = (IASIO *)lpdrv->asiodrv;
iasio->Release();
lpdrv->asiodrv = 0;
}
}
return 0;
}
LONG AsioDriverList::asioGetDriverName (int drvID,char *drvname,int drvnamesize)
{
LPASIODRVSTRUCT lpdrv = 0;
if (!drvname) return DRVERR_INVALID_PARAM;
if ((lpdrv = getDrvStruct(drvID,lpdrvlist)) != 0) {
if (strlen(lpdrv->drvname) < (unsigned int)drvnamesize) {
strcpy(drvname,lpdrv->drvname);
}
else {
memcpy(drvname,lpdrv->drvname,drvnamesize-4);
drvname[drvnamesize-4] = '.';
drvname[drvnamesize-3] = '.';
drvname[drvnamesize-2] = '.';
drvname[drvnamesize-1] = 0;
}
return 0;
}
return DRVERR_DEVICE_NOT_FOUND;
}
LONG AsioDriverList::asioGetDriverPath (int drvID,char *dllpath,int dllpathsize)
{
LPASIODRVSTRUCT lpdrv = 0;
if (!dllpath) return DRVERR_INVALID_PARAM;
if ((lpdrv = getDrvStruct(drvID,lpdrvlist)) != 0) {
if (strlen(lpdrv->dllpath) < (unsigned int)dllpathsize) {
strcpy(dllpath,lpdrv->dllpath);
return 0;
}
dllpath[0] = 0;
return DRVERR_INVALID_PARAM;
}
return DRVERR_DEVICE_NOT_FOUND;
}
LONG AsioDriverList::asioGetDriverCLSID (int drvID,CLSID *clsid)
{
LPASIODRVSTRUCT lpdrv = 0;
if (!clsid) return DRVERR_INVALID_PARAM;
if ((lpdrv = getDrvStruct(drvID,lpdrvlist)) != 0) {
memcpy(clsid,&lpdrv->clsid,sizeof(CLSID));
return 0;
}
return DRVERR_DEVICE_NOT_FOUND;
}

View File

@ -1,46 +0,0 @@
#ifndef __asiolist__
#define __asiolist__
#define DRVERR -5000
#define DRVERR_INVALID_PARAM DRVERR-1
#define DRVERR_DEVICE_ALREADY_OPEN DRVERR-2
#define DRVERR_DEVICE_NOT_FOUND DRVERR-3
#define MAXPATHLEN 512
#define MAXDRVNAMELEN 128
struct asiodrvstruct
{
int drvID;
CLSID clsid;
char dllpath[MAXPATHLEN];
char drvname[MAXDRVNAMELEN];
LPVOID asiodrv;
struct asiodrvstruct *next;
};
typedef struct asiodrvstruct ASIODRVSTRUCT;
typedef ASIODRVSTRUCT *LPASIODRVSTRUCT;
class AsioDriverList {
public:
AsioDriverList();
~AsioDriverList();
LONG asioOpenDriver (int,VOID **);
LONG asioCloseDriver (int);
// nice to have
LONG asioGetNumDev (VOID);
LONG asioGetDriverName (int,char *,int);
LONG asioGetDriverPath (int,char *,int);
LONG asioGetDriverCLSID (int,CLSID *);
// or use directly access
LPASIODRVSTRUCT lpdrvlist;
int numdrv;
};
typedef class AsioDriverList *LPASIODRIVERLIST;
#endif

View File

@ -1,82 +0,0 @@
#ifndef __asiosys__
#define __asiosys__
#ifdef WIN32
#undef MAC
#define PPC 0
#define WINDOWS 1
#define SGI 0
#define SUN 0
#define LINUX 0
#define BEOS 0
#define NATIVE_INT64 0
#define IEEE754_64FLOAT 1
#elif BEOS
#define MAC 0
#define PPC 0
#define WINDOWS 0
#define PC 0
#define SGI 0
#define SUN 0
#define LINUX 0
#define NATIVE_INT64 0
#define IEEE754_64FLOAT 1
#ifndef DEBUG
#define DEBUG 0
#if DEBUG
void DEBUGGERMESSAGE(char *string);
#else
#define DEBUGGERMESSAGE(a)
#endif
#endif
#elif SGI
#define MAC 0
#define PPC 0
#define WINDOWS 0
#define PC 0
#define SUN 0
#define LINUX 0
#define BEOS 0
#define NATIVE_INT64 0
#define IEEE754_64FLOAT 1
#ifndef DEBUG
#define DEBUG 0
#if DEBUG
void DEBUGGERMESSAGE(char *string);
#else
#define DEBUGGERMESSAGE(a)
#endif
#endif
#else // MAC
#define MAC 1
#define PPC 1
#define WINDOWS 0
#define PC 0
#define SGI 0
#define SUN 0
#define LINUX 0
#define BEOS 0
#define NATIVE_INT64 0
#define IEEE754_64FLOAT 1
#ifndef DEBUG
#define DEBUG 0
#if DEBUG
void DEBUGGERMESSAGE(char *string);
#else
#define DEBUGGERMESSAGE(a)
#endif
#endif
#endif
#endif

View File

@ -1,202 +0,0 @@
//==========================================================================;
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
// PURPOSE.
//
// Copyright (c) 1992 - 1996 Microsoft Corporation. All Rights Reserved.
//
//--------------------------------------------------------------------------;
// Base class hierachy for creating COM objects, December 1994
#include <windows.h>
#include "wxdebug.h"
#include "combase.h"
#pragma warning( disable : 4514 ) // Disable warnings re unused inline functions
/* Define the static member variable */
LONG CBaseObject::m_cObjects = 0;
/* Constructor */
CBaseObject::CBaseObject(TCHAR *pName)
{
/* Increment the number of active objects */
InterlockedIncrement(&m_cObjects);
#ifdef DEBUG
m_dwCookie = DbgRegisterObjectCreation(pName);
#endif
}
/* Destructor */
CBaseObject::~CBaseObject()
{
/* Decrement the number of objects active */
InterlockedDecrement(&m_cObjects);
#ifdef DEBUG
DbgRegisterObjectDestruction(m_dwCookie);
#endif
}
/* Constructor */
// We know we use "this" in the initialization list, we also know we don't modify *phr.
#pragma warning( disable : 4355 4100 )
CUnknown::CUnknown(TCHAR *pName, LPUNKNOWN pUnk, HRESULT *phr)
: CBaseObject(pName)
/* Start the object with a reference count of zero - when the */
/* object is queried for it's first interface this may be */
/* incremented depending on whether or not this object is */
/* currently being aggregated upon */
, m_cRef(0)
/* Set our pointer to our IUnknown interface. */
/* If we have an outer, use its, otherwise use ours. */
/* This pointer effectivly points to the owner of */
/* this object and can be accessed by the GetOwner() method. */
, m_pUnknown( pUnk != 0 ? pUnk : reinterpret_cast<LPUNKNOWN>( static_cast<PNDUNKNOWN>(this) ) )
/* Why the double cast? Well, the inner cast is a type-safe cast */
/* to pointer to a type from which we inherit. The second is */
/* type-unsafe but works because INonDelegatingUnknown "behaves */
/* like" IUnknown. (Only the names on the methods change.) */
{
// Everything we need to do has been done in the initializer list
}
#pragma warning( default : 4355 4100 )
/* QueryInterface */
STDMETHODIMP CUnknown::NonDelegatingQueryInterface(REFIID riid, void ** ppv)
{
CheckPointer(ppv,E_POINTER);
ValidateReadWritePtr(ppv,sizeof(PVOID));
/* We know only about IUnknown */
if (riid == IID_IUnknown) {
GetInterface((LPUNKNOWN) (PNDUNKNOWN) this, ppv);
return NOERROR;
} else {
*ppv = NULL;
return E_NOINTERFACE;
}
}
/* We have to ensure that we DON'T use a max macro, since these will typically */
/* lead to one of the parameters being evaluated twice. Since we are worried */
/* about concurrency, we can't afford to access the m_cRef twice since we can't */
/* afford to run the risk that its value having changed between accesses. */
#ifdef max
#undef max
#endif
template<class T> inline static T max( const T & a, const T & b )
{
return a > b ? a : b;
}
/* AddRef */
STDMETHODIMP_(ULONG) CUnknown::NonDelegatingAddRef()
{
LONG lRef = InterlockedIncrement( &m_cRef );
ASSERT(lRef > 0);
DbgLog((LOG_MEMORY,3,TEXT(" Obj %d ref++ = %d"),
m_dwCookie, m_cRef));
return max(ULONG(m_cRef), 1ul);
}
/* Release */
STDMETHODIMP_(ULONG) CUnknown::NonDelegatingRelease()
{
/* If the reference count drops to zero delete ourselves */
LONG lRef = InterlockedDecrement( &m_cRef );
ASSERT(lRef >= 0);
DbgLog((LOG_MEMORY,3,TEXT(" Object %d ref-- = %d"),
m_dwCookie, m_cRef));
if (lRef == 0) {
// COM rules say we must protect against re-entrancy.
// If we are an aggregator and we hold our own interfaces
// on the aggregatee, the QI for these interfaces will
// addref ourselves. So after doing the QI we must release
// a ref count on ourselves. Then, before releasing the
// private interface, we must addref ourselves. When we do
// this from the destructor here it will result in the ref
// count going to 1 and then back to 0 causing us to
// re-enter the destructor. Hence we add an extra refcount here
// once we know we will delete the object.
// for an example aggregator see filgraph\distrib.cpp.
m_cRef++;
delete this;
return ULONG(0);
} else {
return max(ULONG(m_cRef), 1ul);
}
}
/* Return an interface pointer to a requesting client
performing a thread safe AddRef as necessary */
HRESULT CUnknown::GetInterface(LPUNKNOWN pUnk, void **ppv)
{
CheckPointer(ppv, E_POINTER);
*ppv = pUnk;
pUnk->AddRef();
return NOERROR;
}
/* Compares two interfaces and returns TRUE if they are on the same object */
BOOL IsEqualObject(IUnknown *pFirst, IUnknown *pSecond)
{
/* Different objects can't have the same interface pointer for
any interface
*/
if (pFirst == pSecond) {
return TRUE;
}
/* OK - do it the hard way - check if they have the same
IUnknown pointers - a single object can only have one of these
*/
LPUNKNOWN pUnknown1; // Retrieve the IUnknown interface
LPUNKNOWN pUnknown2; // Retrieve the other IUnknown interface
HRESULT hr; // General OLE return code
ASSERT(pFirst);
ASSERT(pSecond);
/* See if the IUnknown pointers match */
hr = pFirst->QueryInterface(IID_IUnknown,(void **) &pUnknown1);
ASSERT(SUCCEEDED(hr));
ASSERT(pUnknown1);
hr = pSecond->QueryInterface(IID_IUnknown,(void **) &pUnknown2);
ASSERT(SUCCEEDED(hr));
ASSERT(pUnknown2);
/* Release the extra interfaces we hold */
pUnknown1->Release();
pUnknown2->Release();
return (pUnknown1 == pUnknown2);
}

View File

@ -1,282 +0,0 @@
//==========================================================================;
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
// PURPOSE.
//
// Copyright (c) 1992 - 1996 Microsoft Corporation. All Rights Reserved.
//
//--------------------------------------------------------------------------;
// Base class hierachy for creating COM objects, December 1994
/*
a. Derive your COM object from CUnknown
b. Make a static CreateInstance function that takes an LPUNKNOWN, an HRESULT *
and a TCHAR *. The LPUNKNOWN defines the object to delegate IUnknown calls
to. The HRESULT * allows error codes to be passed around constructors and
the TCHAR * is a descriptive name that can be printed on the debugger.
It is important that constructors only change the HRESULT * if they have
to set an ERROR code, if it was successful then leave it alone or you may
overwrite an error code from an object previously created.
When you call a constructor the descriptive name should be in static store
as we do not copy the string. To stop large amounts of memory being used
in retail builds by all these static strings use the NAME macro,
CMyFilter = new CImplFilter(NAME("My filter"),pUnknown,phr);
if (FAILED(hr)) {
return hr;
}
In retail builds NAME(_x_) compiles to NULL, the base CBaseObject class
knows not to do anything with objects that don't have a name.
c. Have a constructor for your object that passes the LPUNKNOWN, HRESULT * and
TCHAR * to the CUnknown constructor. You can set the HRESULT if you have an
error, or just simply pass it through to the constructor.
The object creation will fail in the class factory if the HRESULT indicates
an error (ie FAILED(HRESULT) == TRUE)
d. Create a FactoryTemplate with your object's class id and CreateInstance
function.
Then (for each interface) either
Multiple inheritance
1. Also derive it from ISomeInterface
2. Include DECLARE_IUNKNOWN in your class definition to declare
implementations of QueryInterface, AddRef and Release that
call the outer unknown
3. Override NonDelegatingQueryInterface to expose ISomeInterface by
code something like
if (riid == IID_ISomeInterface) {
return GetInterface((ISomeInterface *) this, ppv);
} else {
return CUnknown::NonDelegatingQueryInterface(riid, ppv);
}
4. Declare and implement the member functions of ISomeInterface.
or: Nested interfaces
1. Declare a class derived from CUnknown
2. Include DECLARE_IUNKNOWN in your class definition
3. Override NonDelegatingQueryInterface to expose ISomeInterface by
code something like
if (riid == IID_ISomeInterface) {
return GetInterface((ISomeInterface *) this, ppv);
} else {
return CUnknown::NonDelegatingQueryInterface(riid, ppv);
}
4. Implement the member functions of ISomeInterface. Use GetOwner() to
access the COM object class.
And in your COM object class:
5. Make the nested class a friend of the COM object class, and declare
an instance of the nested class as a member of the COM object class.
NOTE that because you must always pass the outer unknown and an hResult
to the CUnknown constructor you cannot use a default constructor, in
other words you will have to make the member variable a pointer to the
class and make a NEW call in your constructor to actually create it.
6. override the NonDelegatingQueryInterface with code like this:
if (riid == IID_ISomeInterface) {
return m_pImplFilter->
NonDelegatingQueryInterface(IID_ISomeInterface, ppv);
} else {
return CUnknown::NonDelegatingQueryInterface(riid, ppv);
}
You can have mixed classes which support some interfaces via multiple
inheritance and some via nested classes
*/
#ifndef __COMBASE__
#define __COMBASE__
/* The DLLENTRY module initialises the module handle on loading */
extern HINSTANCE g_hInst;
/* On DLL load remember which platform we are running on */
extern DWORD g_amPlatform;
extern OSVERSIONINFO g_osInfo; // Filled in by GetVersionEx
/* Version of IUnknown that is renamed to allow a class to support both
non delegating and delegating IUnknowns in the same COM object */
DECLARE_INTERFACE(INonDelegatingUnknown)
{
STDMETHOD(NonDelegatingQueryInterface) (THIS_ REFIID, LPVOID *) PURE;
STDMETHOD_(ULONG, NonDelegatingAddRef)(THIS) PURE;
STDMETHOD_(ULONG, NonDelegatingRelease)(THIS) PURE;
};
typedef INonDelegatingUnknown *PNDUNKNOWN;
/* This is the base object class that supports active object counting. As
part of the debug facilities we trace every time a C++ object is created
or destroyed. The name of the object has to be passed up through the class
derivation list during construction as you cannot call virtual functions
in the constructor. The downside of all this is that every single object
constructor has to take an object name parameter that describes it */
class CBaseObject
{
private:
// Disable the copy constructor and assignment by default so you will get
// compiler errors instead of unexpected behaviour if you pass objects
// by value or assign objects.
CBaseObject(const CBaseObject& objectSrc); // no implementation
void operator=(const CBaseObject& objectSrc); // no implementation
private:
static LONG m_cObjects; /* Total number of objects active */
protected:
#ifdef DEBUG
DWORD m_dwCookie; /* Cookie identifying this object */
#endif
public:
/* These increment and decrement the number of active objects */
CBaseObject(TCHAR *pName);
~CBaseObject();
/* Call this to find if there are any CUnknown derived objects active */
static LONG ObjectsActive() {
return m_cObjects;
};
};
/* An object that supports one or more COM interfaces will be based on
this class. It supports counting of total objects for DLLCanUnloadNow
support, and an implementation of the core non delegating IUnknown */
class CUnknown : public INonDelegatingUnknown,
public CBaseObject
{
private:
const LPUNKNOWN m_pUnknown; /* Owner of this object */
protected: /* So we can override NonDelegatingRelease() */
volatile LONG m_cRef; /* Number of reference counts */
public:
CUnknown(TCHAR *pName, LPUNKNOWN pUnk, HRESULT *phr);
virtual ~CUnknown() {};
/* Return the owner of this object */
LPUNKNOWN GetOwner() const {
return m_pUnknown;
};
/* Called from the class factory to create a new instance, it is
pure virtual so it must be overriden in your derived class */
/* static CUnknown *CreateInstance(LPUNKNOWN, HRESULT *) */
/* Non delegating unknown implementation */
STDMETHODIMP NonDelegatingQueryInterface(REFIID, void **);
STDMETHODIMP_(ULONG) NonDelegatingAddRef();
STDMETHODIMP_(ULONG) NonDelegatingRelease();
/* Return an interface pointer to a requesting client
performing a thread safe AddRef as necessary */
HRESULT GetInterface(LPUNKNOWN pUnk, void **ppv);
};
#if defined(_MSC_VER) && (_MSC_VER<1300)
/* The standard InterlockedXXX functions won't take volatiles */
static inline LONG InterlockedIncrement( volatile LONG * plong )
{ return InterlockedIncrement( const_cast<LONG*>( plong ) ); }
static inline LONG InterlockedDecrement( volatile LONG * plong )
{ return InterlockedDecrement( const_cast<LONG*>( plong ) ); }
static inline LONG InterlockedExchange( volatile LONG * plong, LONG new_value )
{ return InterlockedExchange( const_cast<LONG*>( plong ), new_value ); }
#endif
/* A function that can create a new COM object */
typedef CUnknown *(*LPFNNewCOMObject)(LPUNKNOWN pUnkOuter, HRESULT *phr);
/* A function (can be NULL) which is called from the DLL entrypoint
routine for each factory template:
bLoading - TRUE on DLL load, FALSE on DLL unload
rclsid - the m_ClsID of the entry
*/
typedef void (*LPFNInitRoutine)(BOOL bLoading, const CLSID *rclsid);
/* Create one of these per object class in an array so that
the default class factory code can create new instances */
class CFactoryTemplate {
public:
const WCHAR *m_Name;
const CLSID *m_ClsID;
LPFNNewCOMObject m_lpfnNew;
LPFNInitRoutine m_lpfnInit;
BOOL IsClassID(REFCLSID rclsid) const {
return (IsEqualCLSID(*m_ClsID,rclsid));
};
CUnknown *CreateInstance(LPUNKNOWN pUnk, HRESULT *phr) const {
return m_lpfnNew(pUnk, phr);
};
};
/* You must override the (pure virtual) NonDelegatingQueryInterface to return
interface pointers (using GetInterface) to the interfaces your derived
class supports (the default implementation only supports IUnknown) */
#define 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(); \
};
#endif /* __COMBASE__ */

View File

@ -1,14 +0,0 @@
#include "asiosys.h"
#if DEBUG
#if MAC
#include <TextUtils.h>
void DEBUGGERMESSAGE(char *string)
{
c2pstr(string);
DebugStr((unsigned char *)string);
}
#else
#error debugmessage
#endif
#endif

View File

@ -1,323 +0,0 @@
//==========================================================================;
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
// PURPOSE.
//
// Copyright (c) 1992 - 1996 Microsoft Corporation. All Rights Reserved.
//
//--------------------------------------------------------------------------;
//
// classes used to support dll entrypoints for COM objects.
//
// #include "switches.h"
#include <windows.h>
#include "wxdebug.h"
#include "combase.h"
#ifdef DEBUG
#include <tchar.h>
#endif
#include <stdio.h>
extern CFactoryTemplate g_Templates[];
extern int g_cTemplates;
HINSTANCE hinstance = 0;
DWORD g_amPlatform; // VER_PLATFORM_WIN32_WINDOWS etc... (from GetVersionEx)
OSVERSIONINFO g_osInfo;
//
// an instance of this is created by the DLLGetClassObject entrypoint
// it uses the CFactoryTemplate object it is given to support the
// IClassFactory interface
class CClassFactory : public IClassFactory
{
private:
const CFactoryTemplate * m_pTemplate;
ULONG m_cRef;
static int m_cLocked;
public:
CClassFactory(const CFactoryTemplate *);
// IUnknown
STDMETHODIMP QueryInterface(REFIID riid, void ** ppv);
STDMETHODIMP_(ULONG)AddRef();
STDMETHODIMP_(ULONG)Release();
// IClassFactory
STDMETHODIMP CreateInstance(LPUNKNOWN pUnkOuter, REFIID riid, void **pv);
STDMETHODIMP LockServer(BOOL fLock);
// allow DLLGetClassObject to know about global server lock status
static BOOL IsLocked() {
return (m_cLocked > 0);
};
};
// process-wide dll locked state
int CClassFactory::m_cLocked = 0;
CClassFactory::CClassFactory(const CFactoryTemplate *pTemplate)
{
m_cRef = 0;
m_pTemplate = pTemplate;
}
STDMETHODIMP CClassFactory::QueryInterface(REFIID riid,void **ppv)
{
CheckPointer(ppv,E_POINTER)
ValidateReadWritePtr(ppv,sizeof(PVOID));
*ppv = NULL;
// any interface on this object is the object pointer.
if ((riid == IID_IUnknown) || (riid == IID_IClassFactory)) {
*ppv = (LPVOID) this;
// AddRef returned interface pointer
((LPUNKNOWN) *ppv)->AddRef();
return NOERROR;
}
return ResultFromScode(E_NOINTERFACE);
}
STDMETHODIMP_(ULONG) CClassFactory::AddRef()
{
return ++m_cRef;
}
STDMETHODIMP_(ULONG) CClassFactory::Release()
{
LONG rc;
if (--m_cRef == 0) {
delete this;
rc = 0;
} else rc = m_cRef;
return rc;
}
STDMETHODIMP CClassFactory::CreateInstance(LPUNKNOWN pUnkOuter,REFIID riid,void **pv)
{
CheckPointer(pv,E_POINTER)
ValidateReadWritePtr(pv,sizeof(void *));
/* Enforce the normal OLE rules regarding interfaces and delegation */
if (pUnkOuter != NULL) {
if (IsEqualIID(riid,IID_IUnknown) == FALSE) {
return ResultFromScode(E_NOINTERFACE);
}
}
/* Create the new object through the derived class's create function */
HRESULT hr = NOERROR;
CUnknown *pObj = m_pTemplate->CreateInstance(pUnkOuter, &hr);
if (pObj == NULL) {
return E_OUTOFMEMORY;
}
/* Delete the object if we got a construction error */
if (FAILED(hr)) {
delete pObj;
return hr;
}
/* Get a reference counted interface on the object */
/* We wrap the non-delegating QI with NDAddRef & NDRelease. */
/* This protects any outer object from being prematurely */
/* released by an inner object that may have to be created */
/* in order to supply the requested interface. */
pObj->NonDelegatingAddRef();
hr = pObj->NonDelegatingQueryInterface(riid, pv);
pObj->NonDelegatingRelease();
/* Note that if NonDelegatingQueryInterface fails, it will */
/* not increment the ref count, so the NonDelegatingRelease */
/* will drop the ref back to zero and the object will "self-*/
/* destruct". Hence we don't need additional tidy-up code */
/* to cope with NonDelegatingQueryInterface failing. */
if (SUCCEEDED(hr)) {
ASSERT(*pv);
}
return hr;
}
STDMETHODIMP CClassFactory::LockServer(BOOL fLock)
{
if (fLock) {
m_cLocked++;
} else {
m_cLocked--;
}
return NOERROR;
}
// --- COM entrypoints -----------------------------------------
// DllRegisterServer
//called by COM to get the class factory object for a given class
STDAPI DllGetClassObject(REFCLSID rClsID,REFIID riid,void **pv)
{
// DebugBreak();
if (!(riid == IID_IUnknown) && !(riid == IID_IClassFactory)) {
return E_NOINTERFACE;
}
// traverse the array of templates looking for one with this
// class id
for (int i = 0; i < g_cTemplates; i++) {
const CFactoryTemplate * pT = &g_Templates[i];
if (pT->IsClassID(rClsID)) {
// found a template - make a class factory based on this
// template
*pv = (LPVOID) (LPUNKNOWN) new CClassFactory(pT);
if (*pv == NULL) {
return E_OUTOFMEMORY;
}
((LPUNKNOWN)*pv)->AddRef();
return NOERROR;
}
}
return CLASS_E_CLASSNOTAVAILABLE;
}
//
// Call any initialization routines
//
void DllInitClasses(BOOL bLoading)
{
int i;
// DebugBreak();
// traverse the array of templates calling the init routine
// if they have one
for (i = 0; i < g_cTemplates; i++) {
const CFactoryTemplate * pT = &g_Templates[i];
if (pT->m_lpfnInit != NULL) {
(*pT->m_lpfnInit)(bLoading, pT->m_ClsID);
}
}
}
// called by COM to determine if this dll can be unloaded
// return ok unless there are outstanding objects or a lock requested
// by IClassFactory::LockServer
//
// CClassFactory has a static function that can tell us about the locks,
// and CCOMObject has a static function that can tell us about the active
// object count
STDAPI DllCanUnloadNow()
{
// DebugBreak();
DbgLog((LOG_MEMORY,2,TEXT("DLLCanUnloadNow called - IsLocked = %d, Active objects = %d"),
CClassFactory::IsLocked(),
CBaseObject::ObjectsActive()));
if (CClassFactory::IsLocked() || CBaseObject::ObjectsActive()) {
return S_FALSE;
}
else {
return S_OK;
}
}
// --- standard WIN32 entrypoints --------------------------------------
//extern "C" BOOL WINAPI DllEntryPoint(HINSTANCE, ULONG, LPVOID);
//BOOL WINAPI DllEntryPoint(HINSTANCE hInstance,ULONG ulReason,LPVOID pv)
//BOOL WINAPI DllMain (HINSTANCE hInstance,ULONG ulReason,LPVOID pv)
BOOL WINAPI DllEntryPoint (HINSTANCE hInstance,ULONG ulReason,LPVOID pv)
{
// DebugBreak();
switch (ulReason) {
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hInstance);
DbgInitialise(hInstance);
{
// The platform identifier is used to work out whether
// full unicode support is available or not. Hence the
// default will be the lowest common denominator - i.e. N/A
g_amPlatform = VER_PLATFORM_WIN32_WINDOWS; // win95 assumed in case GetVersionEx fails
g_osInfo.dwOSVersionInfoSize = sizeof(g_osInfo);
if (GetVersionEx(&g_osInfo)) {
g_amPlatform = g_osInfo.dwPlatformId;
}
else {
DbgLog((LOG_ERROR, 1, "Failed to get the OS platform, assuming Win95"));
}
}
hinstance = hInstance;
DllInitClasses(TRUE);
break;
case DLL_PROCESS_DETACH:
DllInitClasses(FALSE);
#ifdef DEBUG
if (CBaseObject::ObjectsActive()) {
DbgSetModuleLevel(LOG_MEMORY, 2);
TCHAR szInfo[512];
extern TCHAR m_ModuleName[]; // Cut down module name
TCHAR FullName[_MAX_PATH]; // Load the full path and module name
TCHAR *pName; // Searches from the end for a backslash
GetModuleFileName(NULL,FullName,_MAX_PATH);
pName = _tcsrchr(FullName,'\\');
if (pName == NULL) {
pName = FullName;
}
else {
pName++;
}
DWORD cch = wsprintf(szInfo, TEXT("Executable: %s Pid %x Tid %x. "),
pName, GetCurrentProcessId(), GetCurrentThreadId());
wsprintf(szInfo+cch, TEXT("Module %s, %d objects left active!"),
m_ModuleName, CBaseObject::ObjectsActive());
DbgAssert(szInfo, TEXT(__FILE__),__LINE__);
// If running remotely wait for the Assert to be acknowledged
// before dumping out the object register
DbgDumpObjectRegister();
}
DbgTerminate();
#endif
break;
}
return TRUE;
}

View File

@ -1,38 +0,0 @@
#ifndef __gInclude__
#define __gInclude__
#if SGI
#undef BEOS
#undef MAC
#undef WINDOWS
//
#define ASIO_BIG_ENDIAN 1
#define ASIO_CPU_MIPS 1
#elif defined WIN32
#undef BEOS
#undef MAC
#undef SGI
#define WINDOWS 1
#define ASIO_LITTLE_ENDIAN 1
#define ASIO_CPU_X86 1
#elif BEOS
#undef MAC
#undef SGI
#undef WINDOWS
#define ASIO_LITTLE_ENDIAN 1
#define ASIO_CPU_X86 1
//
#else
#define MAC 1
#undef BEOS
#undef WINDOWS
#undef SGI
#define ASIO_BIG_ENDIAN 1
#define ASIO_CPU_PPC 1
#endif
// always
#define NATIVE_INT64 0
#define IEEE754_64FLOAT 1
#endif // __gInclude__

View File

@ -1,37 +0,0 @@
#include "asiosys.h"
#include "asio.h"
/* Forward Declarations */
#ifndef __ASIODRIVER_FWD_DEFINED__
#define __ASIODRIVER_FWD_DEFINED__
typedef interface IASIO IASIO;
#endif /* __ASIODRIVER_FWD_DEFINED__ */
interface IASIO : public IUnknown
{
virtual ASIOBool init(void *sysHandle) = 0;
virtual void getDriverName(char *name) = 0;
virtual long getDriverVersion() = 0;
virtual void getErrorMessage(char *string) = 0;
virtual ASIOError start() = 0;
virtual ASIOError stop() = 0;
virtual ASIOError getChannels(long *numInputChannels, long *numOutputChannels) = 0;
virtual ASIOError getLatencies(long *inputLatency, long *outputLatency) = 0;
virtual ASIOError getBufferSize(long *minSize, long *maxSize,
long *preferredSize, long *granularity) = 0;
virtual ASIOError canSampleRate(ASIOSampleRate sampleRate) = 0;
virtual ASIOError getSampleRate(ASIOSampleRate *sampleRate) = 0;
virtual ASIOError setSampleRate(ASIOSampleRate sampleRate) = 0;
virtual ASIOError getClockSources(ASIOClockSource *clocks, long *numSources) = 0;
virtual ASIOError setClockSource(long reference) = 0;
virtual ASIOError getSamplePosition(ASIOSamples *sPos, ASIOTimeStamp *tStamp) = 0;
virtual ASIOError getChannelInfo(ASIOChannelInfo *info) = 0;
virtual ASIOError createBuffers(ASIOBufferInfo *bufferInfos, long numChannels,
long bufferSize, ASIOCallbacks *callbacks) = 0;
virtual ASIOError disposeBuffers() = 0;
virtual ASIOError controlPanel() = 0;
virtual ASIOError future(long selector,void *opt) = 0;
virtual ASIOError outputReady() = 0;
};

View File

@ -1,332 +0,0 @@
#include <windows.h>
#include <stdio.h>
typedef struct keylist
{
HKEY mainKey;
HKEY subKey;
char *keyname;
struct keylist *next;
} KEYLIST, *LPKEYLIST;
#define CLSID_STRING_LEN 100
#define MAX_PATH_LEN 360
#define DEV_ERR_SELFREG -100
#define ERRSREG_MODULE_NOT_FOUND DEV_ERR_SELFREG-1
#define ERRSREG_MODPATH_NOT_FOUND DEV_ERR_SELFREG-2
#define ERRSREG_STRING_FROM_CLSID DEV_ERR_SELFREG-3
#define ERRSREG_CHAR_TO_MULTIBYTE DEV_ERR_SELFREG-4
#define SZREGSTR_DESCRIPTION "Description"
#define SZREGSTR_CLSID "CLSID"
#define SZREGSTR_INPROCSERVER32 "InprocServer32"
#define SZREGSTR_THREADINGMODEL "ThreadingModel"
#define SZREGSTR_SOFTWARE "SOFTWARE"
#define SZREGSTR_ASIO "ASIO"
LONG RegisterAsioDriver (CLSID,char *,char *,char *,char *);
LONG UnregisterAsioDriver (CLSID,char *,char *);
static LONG findRegPath (HKEY,char *);
static LONG createRegPath (HKEY,char *,char *);
static LONG createRegStringValue (HKEY,char *,char *,char *);
static LONG getRegString (HKEY,char *,char *,LPVOID,DWORD);
static LPKEYLIST findAllSubKeys (HKEY,HKEY,DWORD,char *,LPKEYLIST);
static LONG deleteRegPath (HKEY,char *,char *);
static char subkeybuf[MAX_PATH_LEN];
// ------------------------------------------
// Global Functions
// ------------------------------------------
LONG RegisterAsioDriver (CLSID clsid,char *szdllname,char *szregname,char *szasiodesc,char *szthreadmodel)
{
HMODULE hMod;
char szDLLPath[MAX_PATH_LEN];
char szModuleName[MAX_PATH_LEN];
char szregpath[MAX_PATH_LEN];
char szclsid[CLSID_STRING_LEN];
LPOLESTR wszCLSID = NULL;
BOOL newregentry = FALSE;
LONG rc;
hMod = GetModuleHandle(szdllname);
if (!hMod) return ERRSREG_MODULE_NOT_FOUND;
szModuleName[0] = 0;
GetModuleFileName(hMod,szModuleName,MAX_PATH_LEN);
if (!szModuleName[0]) return ERRSREG_MODPATH_NOT_FOUND;
CharLower((LPTSTR)szModuleName);
rc = (LONG)StringFromCLSID(clsid,&wszCLSID);
if (rc != S_OK) return ERRSREG_STRING_FROM_CLSID;
rc = (LONG)WideCharToMultiByte(CP_ACP,0,(LPWSTR)wszCLSID,-1,szclsid,CLSID_STRING_LEN,0,0);
if (!rc) return ERRSREG_CHAR_TO_MULTIBYTE;
sprintf(szregpath,"%s\\%s",SZREGSTR_CLSID,szclsid);
rc = findRegPath(HKEY_CLASSES_ROOT,szregpath);
if (rc) {
sprintf(szregpath,"%s\\%s\\%s",SZREGSTR_CLSID,szclsid,SZREGSTR_INPROCSERVER32);
getRegString (HKEY_CLASSES_ROOT,szregpath,0,(LPVOID)szDLLPath,MAX_PATH_LEN);
CharLower((LPTSTR)szDLLPath);
rc = (LONG)strcmp(szDLLPath,szModuleName);
if (rc) {
// delete old regentry
sprintf(szregpath,"%s",SZREGSTR_CLSID);
deleteRegPath(HKEY_CLASSES_ROOT,szregpath,szclsid);
newregentry = TRUE;
}
}
else newregentry = TRUE;
if (newregentry) {
// HKEY_CLASSES_ROOT\CLSID\{...}
sprintf(szregpath,"%s",SZREGSTR_CLSID);
createRegPath (HKEY_CLASSES_ROOT,szregpath,szclsid);
// HKEY_CLASSES_ROOT\CLSID\{...} -> Description
sprintf(szregpath,"%s\\%s",SZREGSTR_CLSID,szclsid);
createRegStringValue(HKEY_CLASSES_ROOT,szregpath,0,szasiodesc);
// HKEY_CLASSES_ROOT\CLSID\InProcServer32
sprintf(szregpath,"%s\\%s",SZREGSTR_CLSID,szclsid);
createRegPath (HKEY_CLASSES_ROOT,szregpath,SZREGSTR_INPROCSERVER32);
// HKEY_CLASSES_ROOT\CLSID\InProcServer32 -> DLL path
sprintf(szregpath,"%s\\%s\\%s",SZREGSTR_CLSID,szclsid,SZREGSTR_INPROCSERVER32);
createRegStringValue(HKEY_CLASSES_ROOT,szregpath,0,szModuleName);
// HKEY_CLASSES_ROOT\CLSID\InProcServer32 -> ThreadingModel
createRegStringValue(HKEY_CLASSES_ROOT,szregpath,SZREGSTR_THREADINGMODEL,szthreadmodel);
}
// HKEY_LOCAL_MACHINE\SOFTWARE\ASIO
sprintf(szregpath,"%s\\%s",SZREGSTR_SOFTWARE,SZREGSTR_ASIO);
rc = findRegPath(HKEY_LOCAL_MACHINE,szregpath);
if (rc) {
sprintf(szregpath,"%s\\%s\\%s",SZREGSTR_SOFTWARE,SZREGSTR_ASIO,szregname);
rc = findRegPath(HKEY_LOCAL_MACHINE,szregpath);
if (rc) {
sprintf(szregpath,"%s\\%s",SZREGSTR_SOFTWARE,SZREGSTR_ASIO);
deleteRegPath(HKEY_LOCAL_MACHINE,szregpath,szregname);
}
}
else {
// HKEY_LOCAL_MACHINE\SOFTWARE\ASIO
sprintf(szregpath,"%s",SZREGSTR_SOFTWARE);
createRegPath (HKEY_LOCAL_MACHINE,szregpath,SZREGSTR_ASIO);
}
// HKEY_LOCAL_MACHINE\SOFTWARE\ASIO\<szregname>
sprintf(szregpath,"%s\\%s",SZREGSTR_SOFTWARE,SZREGSTR_ASIO);
createRegPath (HKEY_LOCAL_MACHINE,szregpath,szregname);
// HKEY_LOCAL_MACHINE\SOFTWARE\ASIO\<szregname> -> CLSID
// HKEY_LOCAL_MACHINE\SOFTWARE\ASIO\<szregname> -> Description
sprintf(szregpath,"%s\\%s\\%s",SZREGSTR_SOFTWARE,SZREGSTR_ASIO,szregname);
createRegStringValue(HKEY_LOCAL_MACHINE,szregpath,SZREGSTR_CLSID,szclsid);
createRegStringValue(HKEY_LOCAL_MACHINE,szregpath,SZREGSTR_DESCRIPTION,szasiodesc);
return 0;
}
LONG UnregisterAsioDriver (CLSID clsid,char *szdllname,char *szregname)
{
LONG rc;
HMODULE hMod;
char szregpath[MAX_PATH_LEN];
char szModuleName[MAX_PATH_LEN];
char szclsid[CLSID_STRING_LEN];
LPOLESTR wszCLSID = NULL;
hMod = GetModuleHandle(szdllname);
if (!hMod) return ERRSREG_MODULE_NOT_FOUND;
szModuleName[0] = 0;
GetModuleFileName(hMod,szModuleName,MAX_PATH_LEN);
if (!szModuleName[0]) return ERRSREG_MODPATH_NOT_FOUND;
CharLower((LPTSTR)szModuleName);
rc = (LONG)StringFromCLSID(clsid,&wszCLSID) ;
if (rc != S_OK) return ERRSREG_STRING_FROM_CLSID;
rc = (LONG)WideCharToMultiByte(CP_ACP,0,(LPWSTR)wszCLSID,-1,szclsid,CLSID_STRING_LEN,0,0);
if (!rc) return ERRSREG_CHAR_TO_MULTIBYTE;
sprintf(szregpath,"%s\\%s",SZREGSTR_CLSID,szclsid);
rc = findRegPath(HKEY_CLASSES_ROOT,szregpath);
if (rc) {
// delete old regentry
sprintf(szregpath,"%s",SZREGSTR_CLSID);
deleteRegPath(HKEY_CLASSES_ROOT,szregpath,szclsid);
}
// HKEY_LOCAL_MACHINE\SOFTWARE\ASIO
sprintf(szregpath,"%s\\%s",SZREGSTR_SOFTWARE,SZREGSTR_ASIO);
rc = findRegPath(HKEY_LOCAL_MACHINE,szregpath);
if (rc) {
sprintf(szregpath,"%s\\%s\\%s",SZREGSTR_SOFTWARE,SZREGSTR_ASIO,szregname);
rc = findRegPath(HKEY_LOCAL_MACHINE,szregpath);
if (rc) {
sprintf(szregpath,"%s\\%s",SZREGSTR_SOFTWARE,SZREGSTR_ASIO);
deleteRegPath(HKEY_LOCAL_MACHINE,szregpath,szregname);
}
}
return 0;
}
// ------------------------------------------
// Local Functions
// ------------------------------------------
static LONG findRegPath (HKEY mainkey,char *szregpath)
{
HKEY hkey;
LONG cr,rc = -1;
if (szregpath) {
if ((cr = RegOpenKey(mainkey,szregpath,&hkey)) == ERROR_SUCCESS) {
RegCloseKey(hkey);
rc = 1;
}
else rc = 0;
}
return rc;
}
static LONG createRegPath (HKEY mainkey,char *szregpath,char *sznewpath)
{
HKEY hkey,hksub;
LONG cr,rc = -1;
char newregpath[MAX_PATH_LEN];
sprintf(newregpath,"%s\\%s",szregpath,sznewpath);
if (!(cr = findRegPath(mainkey,newregpath))) {
if ((cr = RegOpenKey(mainkey,szregpath,&hkey)) == ERROR_SUCCESS) {
if ((cr = RegCreateKey(hkey,sznewpath,&hksub)) == ERROR_SUCCESS) {
RegCloseKey(hksub);
rc = 0;
}
RegCloseKey(hkey);
}
}
else if (cr > 0) rc = 0;
return rc;
}
static LONG createRegStringValue (HKEY mainkey,char *szregpath,char *valname,char *szvalstr)
{
LONG cr,rc = -1;
HKEY hkey;
if (szregpath) {
if ((cr = RegOpenKey(mainkey,szregpath,&hkey)) == ERROR_SUCCESS) {
cr = RegSetValueEx(hkey,(LPCTSTR)valname,0,REG_SZ,(const BYTE *)szvalstr,(DWORD)strlen(szvalstr));
RegCloseKey(hkey);
if (cr == ERROR_SUCCESS) rc = 0;
}
}
return rc;
}
static LONG getRegString (HKEY mainkey,char *szregpath,char *valname,LPVOID pval,DWORD vsize)
{
HKEY hkey;
LONG cr,rc = -1;
DWORD hsize,htype;
if (szregpath) {
if ((cr = RegOpenKey(mainkey,szregpath,&hkey)) == ERROR_SUCCESS) {
cr = RegQueryValueEx(hkey,valname,0,&htype,0,&hsize);
if (cr == ERROR_SUCCESS) {
if (hsize <= vsize) {
cr = RegQueryValueEx(hkey,valname,0,&htype,(LPBYTE)pval,&hsize);
rc = 0;
}
}
RegCloseKey(hkey);
}
}
return rc;
}
static LPKEYLIST findAllSubKeys (HKEY hkey,HKEY hksub,DWORD index,char *keyname,LPKEYLIST kl)
{
HKEY hknew = 0;
char *newkey;
LONG cr;
if (!hksub) {
cr = RegOpenKeyEx(hkey,(LPCTSTR)keyname,0,KEY_ALL_ACCESS,&hknew);
if (cr != ERROR_SUCCESS) return kl;
}
else hknew = hksub;
cr = RegEnumKey(hknew,index,(LPTSTR)subkeybuf,MAX_PATH_LEN);
if (cr == ERROR_SUCCESS) {
newkey = new char[strlen(subkeybuf)+1];
strcpy(newkey,subkeybuf);
kl = findAllSubKeys(hknew,0,0,newkey,kl);
kl = findAllSubKeys(hkey,hknew,index+1,keyname,kl);
return kl;
}
if (!kl->next) {
kl->next = new KEYLIST[1];
kl = kl->next;
kl->mainKey = hkey;
kl->subKey = hknew;
kl->keyname = keyname;
kl->next = 0;
}
return kl;
}
static LONG deleteRegPath (HKEY mainkey,char *szregpath,char *szdelpath)
{
HKEY hkey;
LONG cr,rc = -1;
KEYLIST klist;
LPKEYLIST pkl,k;
char *keyname = 0;
if ((cr = RegOpenKey(mainkey,szregpath,&hkey)) == ERROR_SUCCESS) {
keyname = new char[strlen(szdelpath)+1];
if (!keyname) {
RegCloseKey(hkey);
return rc;
}
strcpy(keyname,szdelpath);
klist.next = 0;
findAllSubKeys(hkey,0,0,keyname,&klist);
if (klist.next) {
pkl = klist.next;
while (pkl) {
RegCloseKey(pkl->subKey);
cr = RegDeleteKey(pkl->mainKey,pkl->keyname);
delete pkl->keyname;
k = pkl;
pkl = pkl->next;
delete k;
}
rc = 0;
}
RegCloseKey(hkey);
}
return rc;
}

View File

@ -1,326 +0,0 @@
//==========================================================================;
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
// PURPOSE.
//
// Copyright (c) 1992 - 1996 Microsoft Corporation. All Rights Reserved.
//
//--------------------------------------------------------------------------;
// Debugging facilities, January 1995
#ifndef __WXDEBUG__
#define __WXDEBUG__
// Avoid conflict with MFC
#undef ASSERT
// This library provides fairly straight forward debugging functionality, this
// is split into two main sections. The first is assertion handling, there are
// three types of assertions provided here. The most commonly used one is the
// ASSERT(condition) macro which will pop up a message box including the file
// and line number if the condition evaluates to FALSE. Then there is the
// EXECUTE_ASSERT macro which is the same as ASSERT except the condition will
// still be executed in NON debug builds. The final type of assertion is the
// KASSERT macro which is more suitable for pure (perhaps kernel) filters as
// the condition is printed onto the debugger rather than in a message box.
//
// The other part of the debug module facilties is general purpose logging.
// This is accessed by calling DbgLog(). The function takes a type and level
// field which define the type of informational string you are presenting and
// it's relative importance. The type field can be a combination (one or more)
// of LOG_TIMING, LOG_TRACE, LOG_MEMORY, LOG_LOCKING and LOG_ERROR. The level
// is a DWORD value where zero defines highest important. Use of zero as the
// debug logging level is to be encouraged ONLY for major errors or events as
// they will ALWAYS be displayed on the debugger. Other debug output has it's
// level matched against the current debug output level stored in the registry
// for this module and if less than the current setting it will be displayed.
//
// Each module or executable has it's own debug output level for each of the
// five types. These are read in when the DbgInitialise function is called
// for DLLs linking to STRMBASE.LIB this is done automatically when the DLL
// is loaded, executables must call it explicitely with the module instance
// handle given to them through the WINMAIN entry point. An executable must
// also call DbgTerminate when they have finished to clean up the resources
// the debug library uses, once again this is done automatically for DLLs
// These are the five different categories of logging information
enum { LOG_TIMING = 0x01, // Timing and performance measurements
LOG_TRACE = 0x02, // General step point call tracing
LOG_MEMORY = 0x04, // Memory and object allocation/destruction
LOG_LOCKING = 0x08, // Locking/unlocking of critical sections
LOG_ERROR = 0x10 }; // Debug error notification
enum { CDISP_HEX = 0x01,
CDISP_DEC = 0x02};
// For each object created derived from CBaseObject (in debug builds) we
// create a descriptor that holds it's name (statically allocated memory)
// and a cookie we assign it. We keep a list of all the active objects
// we have registered so that we can dump a list of remaining objects
typedef struct tag_ObjectDesc {
TCHAR *m_pName;
DWORD m_dwCookie;
tag_ObjectDesc *m_pNext;
} ObjectDesc;
#define DLLIMPORT __declspec(dllimport)
#define DLLEXPORT __declspec(dllexport)
#ifdef DEBUG
#define NAME(x) TEXT(x)
// These are used internally by the debug library (PRIVATE)
void DbgInitKeyLevels(HKEY hKey);
void DbgInitGlobalSettings();
void DbgInitModuleSettings();
void DbgInitModuleName();
DWORD DbgRegisterObjectCreation(TCHAR *pObjectName);
BOOL DbgRegisterObjectDestruction(DWORD dwCookie);
// These are the PUBLIC entry points
BOOL DbgCheckModuleLevel(DWORD Type,DWORD Level);
void DbgSetModuleLevel(DWORD Type,DWORD Level);
// Initialise the library with the module handle
void DbgInitialise(HINSTANCE hInst);
void DbgTerminate();
void DbgDumpObjectRegister();
// Display error and logging to the user
void DbgAssert(const TCHAR *pCondition,const TCHAR *pFileName,INT iLine);
void DbgBreakPoint(const TCHAR *pCondition,const TCHAR *pFileName,INT iLine);
void DbgKernelAssert(const TCHAR *pCondition,const TCHAR *pFileName,INT iLine);
void DbgLogInfo(DWORD Type,DWORD Level,const TCHAR *pFormat,...);
void DbgOutString(LPCTSTR psz);
// Debug infinite wait stuff
DWORD DbgWaitForSingleObject(HANDLE h);
DWORD DbgWaitForMultipleObjects(DWORD nCount,
CONST HANDLE *lpHandles,
BOOL bWaitAll);
void DbgSetWaitTimeout(DWORD dwTimeout);
#ifdef __strmif_h__
void DisplayType(LPSTR label, const AM_MEDIA_TYPE *pmtIn);
#endif
#define KASSERT(_x_) if (!(_x_)) \
DbgKernelAssert(TEXT(#_x_),TEXT(__FILE__),__LINE__)
// Break on the debugger without putting up a message box
// message goes to debugger instead
#define KDbgBreak(_x_) \
DbgKernelAssert(TEXT(#_x_),TEXT(__FILE__),__LINE__)
#define ASSERT(_x_) if (!(_x_)) \
DbgAssert(TEXT(#_x_),TEXT(__FILE__),__LINE__)
// Put up a message box informing the user of a halt
// condition in the program
#define DbgBreak(_x_) \
DbgBreakPoint(TEXT(#_x_),TEXT(__FILE__),__LINE__)
#define EXECUTE_ASSERT(_x_) ASSERT(_x_)
#define DbgLog(_x_) DbgLogInfo _x_
// MFC style trace macros
#define NOTE(_x_) DbgLog((LOG_TRACE,5,TEXT(_x_)));
#define NOTE1(_x_,a) DbgLog((LOG_TRACE,5,TEXT(_x_),a));
#define NOTE2(_x_,a,b) DbgLog((LOG_TRACE,5,TEXT(_x_),a,b));
#define NOTE3(_x_,a,b,c) DbgLog((LOG_TRACE,5,TEXT(_x_),a,b,c));
#define NOTE4(_x_,a,b,c,d) DbgLog((LOG_TRACE,5,TEXT(_x_),a,b,c,d));
#define NOTE5(_x_,a,b,c,d,e) DbgLog((LOG_TRACE,5,TEXT(_x_),a,b,c,d,e));
#else
// Retail builds make public debug functions inert - WARNING the source
// files do not define or build any of the entry points in debug builds
// (public entry points compile to nothing) so if you go trying to call
// any of the private entry points in your source they won't compile
#define NAME(_x_) NULL
#define DbgInitialise(hInst)
#define DbgTerminate()
#define DbgLog(_x_)
#define DbgOutString(psz)
#define DbgRegisterObjectCreation(pObjectName)
#define DbgRegisterObjectDestruction(dwCookie)
#define DbgDumpObjectRegister()
#define DbgCheckModuleLevel(Type,Level)
#define DbgSetModuleLevel(Type,Level)
#define DbgWaitForSingleObject(h) WaitForSingleObject(h, INFINITE)
#define DbgWaitForMultipleObjects(nCount, lpHandles, bWaitAll) \
WaitForMultipleObjects(nCount, lpHandles, bWaitAll, INFINITE)
#define DbgSetWaitTimeout(dwTimeout)
#define KDbgBreak(_x_)
#define DbgBreak(_x_)
#define KASSERT(_x_)
#define ASSERT(_x_)
#define EXECUTE_ASSERT(_x_) _x_
// MFC style trace macros
#define NOTE(_x_)
#define NOTE1(_x_,a)
#define NOTE2(_x_,a,b)
#define NOTE3(_x_,a,b,c)
#define NOTE4(_x_,a,b,c,d)
#define NOTE5(_x_,a,b,c,d,e)
#define DisplayType(label, pmtIn)
#endif
// Checks a pointer which should be non NULL - can be used as follows.
#define CheckPointer(p,ret) {if((p)==NULL) return (ret);}
// HRESULT Foo(VOID *pBar)
// {
// CheckPointer(pBar,E_INVALIDARG)
// }
//
// Or if the function returns a boolean
//
// BOOL Foo(VOID *pBar)
// {
// CheckPointer(pBar,FALSE)
// }
// These validate pointers when symbol VFWROBUST is defined
// This will normally be defined in debug not retail builds
#ifdef DEBUG
#define VFWROBUST
#endif
#ifdef VFWROBUST
#define ValidateReadPtr(p,cb) \
{if(IsBadReadPtr((PVOID)p,cb) == TRUE) \
DbgBreak("Invalid read pointer");}
#define ValidateWritePtr(p,cb) \
{if(IsBadWritePtr((PVOID)p,cb) == TRUE) \
DbgBreak("Invalid write pointer");}
#define ValidateReadWritePtr(p,cb) \
{ValidateReadPtr(p,cb) ValidateWritePtr(p,cb)}
#define ValidateStringPtr(p) \
{if(IsBadStringPtr((LPCTSTR)p,INFINITE) == TRUE) \
DbgBreak("Invalid string pointer");}
#define ValidateStringPtrA(p) \
{if(IsBadStringPtrA((LPCSTR)p,INFINITE) == TRUE) \
DbgBreak("Invalid ANSII string pointer");}
#define ValidateStringPtrW(p) \
{if(IsBadStringPtrW((LPCWSTR)p,INFINITE) == TRUE) \
DbgBreak("Invalid UNICODE string pointer");}
#else
#define ValidateReadPtr(p,cb)
#define ValidateWritePtr(p,cb)
#define ValidateReadWritePtr(p,cb)
#define ValidateStringPtr(p)
#define ValidateStringPtrA(p)
#define ValidateStringPtrW(p)
#endif
#ifdef _OBJBASE_H_
// Outputting GUID names. If you want to include the name
// associated with a GUID (eg CLSID_...) then
//
// GuidNames[yourGUID]
//
// Returns the name defined in uuids.h as a string
typedef struct {
TCHAR *szName;
GUID guid;
} GUID_STRING_ENTRY;
class CGuidNameList {
public:
TCHAR *operator [] (const GUID& guid);
};
extern CGuidNameList GuidNames;
#endif
// REMIND macro - generates warning as reminder to complete coding
// (eg) usage:
//
// #pragma message (REMIND("Add automation support"))
#define QUOTE(x) #x
#define QQUOTE(y) QUOTE(y)
#define REMIND(str) __FILE__ "(" QQUOTE(__LINE__) ") : " str
// Hack to display objects in a useful format
//
// eg If you want to display a LONGLONG ll in a debug string do (eg)
//
// DbgLog((LOG_TRACE, n, TEXT("Value is %s"), (LPCTSTR)CDisp(ll, CDISP_HEX)));
class CDispBasic
{
public:
CDispBasic() { m_pString = m_String; };
~CDispBasic();
protected:
PTCHAR m_pString; // normally points to m_String... unless too much data
TCHAR m_String[50];
};
class CDisp : public CDispBasic
{
public:
CDisp(LONGLONG ll, int Format = CDISP_HEX); // Display a LONGLONG in CDISP_HEX or CDISP_DEC form
CDisp(REFCLSID clsid); // Display a GUID
CDisp(double d); // Display a floating point number
#ifdef __strmif_h__
#ifdef __STREAMS__
CDisp(CRefTime t); // Display a Reference Time
#endif
CDisp(IPin *pPin); // Display a pin as {filter clsid}(pin name)
#endif // __strmif_h__
~CDisp();
// Implement cast to (LPCTSTR) as parameter to logger
operator LPCTSTR()
{
return (LPCTSTR)m_pString;
};
};
#endif // __WXDEBUG__

View File

@ -102,7 +102,6 @@ int LimitMode=0;
CONFIG_DSOUNDOUT Config_DSoundOut; CONFIG_DSOUNDOUT Config_DSoundOut;
CONFIG_DSOUND51 Config_DSound51; CONFIG_DSOUND51 Config_DSound51;
CONFIG_WAVEOUT Config_WaveOut; CONFIG_WAVEOUT Config_WaveOut;
CONFIG_ASIO Config_Asio;
// MISC // MISC
bool LimiterToggleEnabled=false; bool LimiterToggleEnabled=false;
@ -300,9 +299,6 @@ void ReadSettings()
Config_DSound51.AddCLR =CfgReadInt("DSOUND51","Channel_Center_In_LR", 56); Config_DSound51.AddCLR =CfgReadInt("DSOUND51","Channel_Center_In_LR", 56);
Config_DSound51.LowpassLFE = CfgReadInt("DSOUND51","LFE_Lowpass_Frequency", 80); Config_DSound51.LowpassLFE = CfgReadInt("DSOUND51","LFE_Lowpass_Frequency", 80);
// Read ASIOOUT config:
CfgReadStr("ASIO","Asio_Driver_Name",AsioDriver,128,"");
// Sanity Checks // Sanity Checks
// ------------- // -------------
@ -398,8 +394,6 @@ void WriteSettings()
CfgWriteInt("DSOUND51","Channel_Center_In_LR", Config_DSound51.AddCLR); CfgWriteInt("DSOUND51","Channel_Center_In_LR", Config_DSound51.AddCLR);
CfgWriteInt("DSOUND51","LFE_Lowpass_Frequency", Config_DSound51.LowpassLFE); CfgWriteInt("DSOUND51","LFE_Lowpass_Frequency", Config_DSound51.LowpassLFE);
CfgWriteStr("ASIO","Asio_Driver_Name",AsioDriver);
CfgWriteStr("DSP PLUGIN","Filename",dspPlugin); CfgWriteStr("DSP PLUGIN","Filename",dspPlugin);
CfgWriteInt("DSP PLUGIN","ModuleNum",dspPluginModule); CfgWriteInt("DSP PLUGIN","ModuleNum",dspPluginModule);
CfgWriteBool("DSP PLUGIN","Enabled",dspPluginEnabled); CfgWriteBool("DSP PLUGIN","Enabled",dspPluginEnabled);

View File

@ -154,22 +154,10 @@ struct CONFIG_DSOUND51
} }
}; };
struct CONFIG_ASIO
{
s8 NumBuffers;
CONFIG_ASIO() :
NumBuffers( 8 )
{
//memset( Device, 0, sizeof( Device ) );
}
};
extern CONFIG_DSOUNDOUT Config_DSoundOut; extern CONFIG_DSOUNDOUT Config_DSoundOut;
extern CONFIG_DSOUND51 Config_DSound51; extern CONFIG_DSOUND51 Config_DSound51;
extern CONFIG_WAVEOUT Config_WaveOut; extern CONFIG_WAVEOUT Config_WaveOut;
extern CONFIG_ASIO Config_Asio;
////// //////

View File

@ -154,7 +154,7 @@ static void InitLibraryName()
// Use TortoiseSVN's SubWCRev utility's output // Use TortoiseSVN's SubWCRev utility's output
// to label the specific revision: // to label the specific revision:
sprintf_s( libraryName, "SPU2ghz PPr %d%s" sprintf_s( libraryName, "SPU2ghz PG r%d%s"
# ifdef _DEBUG_FAST # ifdef _DEBUG_FAST
"-Debug" "-Debug"
# elif defined( _DEBUG ) # elif defined( _DEBUG )

View File

@ -66,7 +66,7 @@ private:
XAUDIO2_BUFFER buf = {0}; XAUDIO2_BUFFER buf = {0};
buf.AudioBytes = BufferSizeBytes; buf.AudioBytes = BufferSizeBytes;
buf.pAudioData=(const BYTE*)context; buf.pAudioData=(BYTE*)context;
buf.pContext=context; buf.pContext=context;
pSourceVoice->SubmitSourceBuffer( &buf ); pSourceVoice->SubmitSourceBuffer( &buf );

View File

@ -73,22 +73,18 @@ unsigned char revision = 0; // revision and build gives plugin version
unsigned char build = VER; unsigned char build = VER;
unsigned char minor = 1; unsigned char minor = 1;
// NOTE : ZeroGS is currently very evil and uses the libraryName as a versioning tool in
// its savestate information. So putting the revision info into the libraryName isn't
// going to be a good idea for now. :(
#ifdef _DEBUG #ifdef _DEBUG
char *libraryName = "ZeroGS (Debug) "; char *libraryName = "ZeroGS Playground (Debug) ";
#elif defined(RELEASE_TO_PUBLIC) #elif defined(RELEASE_TO_PUBLIC)
#ifdef ZEROGS_SSE2 #ifdef ZEROGS_SSE2
char *libraryName = "ZeroGS KOSMOS"; char *libraryName = "ZeroGS Playground";
#else #else
char *libraryName = "ZeroGS KOSMOS (no SSE2)"; char *libraryName = "ZeroGS Playground (no SSE2)";
#endif #endif
#else #else
char *libraryName = "ZeroGS (Dev) "; char *libraryName = "ZeroGS Playground (Dev) ";
#endif #endif
static const char* s_aa[5] = { "AA none |", "AA 2x |", "AA 4x |", "AA 8x", "AA 16x" }; static const char* s_aa[5] = { "AA none |", "AA 2x |", "AA 4x |", "AA 8x", "AA 16x" };

View File

@ -1,7 +1,6 @@
; Declares the module parameters for the DLL. ; Declares the module parameters for the DLL.
LIBRARY "ZeroGS" LIBRARY "ZeroGS"
DESCRIPTION 'ZeroGS dll'
EXPORTS EXPORTS
; Explicit exports can go here ; Explicit exports can go here

View File

@ -2,7 +2,7 @@
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="9.00" Version="9.00"
Name="zerogs" Name="ZeroGS-Pg"
ProjectGUID="{5C6B7D28-E73D-4F71-8FC0-17ADA640EBD8}" ProjectGUID="{5C6B7D28-E73D-4F71-8FC0-17ADA640EBD8}"
RootNamespace="ZeroGS" RootNamespace="ZeroGS"
TargetFrameworkVersion="131072" TargetFrameworkVersion="131072"

View File

@ -2,7 +2,7 @@
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="9.00" Version="9.00"
Name="ZeroSPU2" Name="ZeroSPU2-Pg"
ProjectGUID="{7F059854-568D-4E08-9D00-1E78E203E4DC}" ProjectGUID="{7F059854-568D-4E08-9D00-1E78E203E4DC}"
RootNamespace="ZeroSPU2" RootNamespace="ZeroSPU2"
Keyword="Win32Proj" Keyword="Win32Proj"

View File

@ -161,7 +161,7 @@ static void InitLibraryName()
// Use TortoiseSVN's SubWCRev utility's output // Use TortoiseSVN's SubWCRev utility's output
// to label the specific revision: // to label the specific revision:
sprintf_s( libraryName, "ZeroSPU2 PPr%d%s" sprintf_s( libraryName, "ZeroSPU2 PG r%d%s"
# ifdef _DEBUG # ifdef _DEBUG
"-Debug" "-Debug"
# else # else