mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 17:01:51 +00:00
fixes... mostly sound fuckery
git-svn-id: https://svn.eduke32.com/eduke32@1481 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
a188f1600e
commit
3964ca6766
20 changed files with 112 additions and 804 deletions
|
@ -1610,7 +1610,7 @@ static int32_t kpegrend(const char *kfilebuf, int32_t kfilength,
|
|||
//Get DC
|
||||
if (!Ss)
|
||||
{
|
||||
while (curbits < 24) //Getbits
|
||||
while (curbits < 16) //Getbits
|
||||
{
|
||||
ch = *kfileptr++; if (ch == 255) kfileptr++;
|
||||
num = (num<<8)+((int32_t)ch); curbits += 8;
|
||||
|
@ -1625,7 +1625,7 @@ static int32_t kpegrend(const char *kfilebuf, int32_t kfilength,
|
|||
|
||||
if (daval)
|
||||
{
|
||||
while (curbits < 24) //Getbits
|
||||
while (curbits < daval) //Getbits
|
||||
{
|
||||
ch = *kfileptr++; if (ch == 255) kfileptr++;
|
||||
num = (num<<8)+((int32_t)ch); curbits += 8;
|
||||
|
@ -1647,7 +1647,7 @@ static int32_t kpegrend(const char *kfilebuf, int32_t kfilength,
|
|||
{
|
||||
for (; z<=Se; z++)
|
||||
{
|
||||
while (curbits < 24) //Getbits
|
||||
while (curbits < 16) //Getbits
|
||||
{
|
||||
ch = *kfileptr++; if (ch == 255) kfileptr++;
|
||||
num = (num<<8)+((int32_t)ch); curbits += 8;
|
||||
|
@ -1662,7 +1662,11 @@ static int32_t kpegrend(const char *kfilebuf, int32_t kfilength,
|
|||
{
|
||||
if (Ah)
|
||||
{
|
||||
//NOTE: Getbits not needed here - buffer should have enough bits
|
||||
if (curbits < 8) //Getbits
|
||||
{
|
||||
ch = *kfileptr++; if (ch == 255) kfileptr++;
|
||||
num = (num<<8)+((long)ch); curbits += 8;
|
||||
}
|
||||
if (num&(pow2long[--curbits])) daval = Alut[0]; else daval = Alut[1];
|
||||
}
|
||||
}
|
||||
|
@ -1671,7 +1675,7 @@ static int32_t kpegrend(const char *kfilebuf, int32_t kfilength,
|
|||
eobrun = pow2long[zz];
|
||||
if (zz)
|
||||
{
|
||||
while (curbits < 24) //Getbits
|
||||
while (curbits < zz) //Getbits
|
||||
{
|
||||
ch = *kfileptr++; if (ch == 255) kfileptr++;
|
||||
num = (num<<8)+((int32_t)ch); curbits += 8;
|
||||
|
@ -1687,7 +1691,7 @@ static int32_t kpegrend(const char *kfilebuf, int32_t kfilength,
|
|||
{
|
||||
if (dcs[z])
|
||||
{
|
||||
while (curbits < 24) //Getbits
|
||||
if (curbits < 8) //Getbits
|
||||
{
|
||||
ch = *kfileptr++; if (ch == 255) kfileptr++;
|
||||
num = (num<<8)+((int32_t)ch); curbits += 8;
|
||||
|
@ -1704,7 +1708,7 @@ static int32_t kpegrend(const char *kfilebuf, int32_t kfilength,
|
|||
{
|
||||
z += zz; if (z > Se) break;
|
||||
|
||||
while (curbits < 24) //Getbits
|
||||
while (curbits < daval) //Getbits
|
||||
{
|
||||
ch = *kfileptr++; if (ch == 255) kfileptr++;
|
||||
num = (num<<8)+((int32_t)ch); curbits += 8;
|
||||
|
@ -1723,7 +1727,7 @@ static int32_t kpegrend(const char *kfilebuf, int32_t kfilength,
|
|||
for (; z<=Se; z++)
|
||||
{
|
||||
if (!dcs[z]) continue;
|
||||
while (curbits < 24) //Getbits
|
||||
if (curbits < 8) //Getbits
|
||||
{
|
||||
ch = *kfileptr++; if (ch == 255) kfileptr++;
|
||||
num = (num<<8)+((int32_t)ch); curbits += 8;
|
||||
|
@ -1996,7 +2000,7 @@ static int32_t ktgarend(const char *header, int32_t fleng,
|
|||
const uint8_t *fptr, *cptr, *nptr;
|
||||
|
||||
//Ugly and unreliable identification for .TGA!
|
||||
if ((fleng < 20) || (header[1]&0xfe)) return(-1);
|
||||
if ((fleng < 19) || (header[1]&0xfe)) return(-1);
|
||||
if ((header[2] >= 12) || (!((1<<header[2])&0xe0e))) return(-1);
|
||||
if ((header[16]&7) || (header[16] == 0) || (header[16] > 32)) return(-1);
|
||||
if (header[17]&0xc0) return(-1);
|
||||
|
@ -2476,7 +2480,7 @@ void kpgetdim(const char *buf, int32_t leng, int32_t *xsiz, int32_t *ysiz)
|
|||
}
|
||||
else
|
||||
{ //Unreliable .TGA identification - this MUST be final case!
|
||||
if ((leng >= 20) && (!(ubuf[1]&0xfe)))
|
||||
if ((leng >= 19) && (!(ubuf[1]&0xfe)))
|
||||
if ((ubuf[2] < 12) && ((1<<ubuf[2])&0xe0e))
|
||||
if ((!(ubuf[16]&7)) && (ubuf[16] != 0) && (ubuf[16] <= 32))
|
||||
if (!(buf[17]&0xc0))
|
||||
|
@ -2516,7 +2520,7 @@ int32_t kprender(const char *buf, int32_t leng, intptr_t frameptr, int32_t bpl,
|
|||
return(kddsrend(buf,leng,frameptr,bpl,xdim,ydim,xoff,yoff));
|
||||
|
||||
//Unreliable .TGA identification - this MUST be final case!
|
||||
if ((leng >= 20) && (!(ubuf[1]&0xfe)))
|
||||
if ((leng >= 19) && (!(ubuf[1]&0xfe)))
|
||||
if ((ubuf[2] < 12) && ((1<<ubuf[2])&0xe0e))
|
||||
if ((!(ubuf[16]&7)) && (ubuf[16] != 0) && (ubuf[16] <= 32))
|
||||
if (!(ubuf[17]&0xc0))
|
||||
|
|
|
@ -592,10 +592,6 @@
|
|||
RelativePath=".\source\jaudiolib\src\_multivc.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\jaudiolib\src\driver_coreaudio.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\jaudiolib\src\driver_directsound.h"
|
||||
>
|
||||
|
@ -644,10 +640,6 @@
|
|||
<Filter
|
||||
Name="Source Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\source\jaudiolib\src\driver_coreaudio.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\jaudiolib\src\driver_directsound.c"
|
||||
>
|
||||
|
|
|
@ -37,7 +37,6 @@ typedef enum
|
|||
{
|
||||
ASS_NoSound,
|
||||
ASS_SDL,
|
||||
ASS_CoreAudio,
|
||||
ASS_DirectSound,
|
||||
ASS_NumSoundCards,
|
||||
ASS_AutoDetect = -2
|
||||
|
|
|
@ -1,307 +0,0 @@
|
|||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 42;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
AB2E9E5F1011E65900DD2F1F /* _multivc.h in Headers */ = {isa = PBXBuildFile; fileRef = AB2E9E4D1011E65900DD2F1F /* _multivc.h */; };
|
||||
AB2E9E601011E65900DD2F1F /* driver_coreaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = AB2E9E4E1011E65900DD2F1F /* driver_coreaudio.c */; };
|
||||
AB2E9E611011E65900DD2F1F /* driver_coreaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = AB2E9E4F1011E65900DD2F1F /* driver_coreaudio.h */; };
|
||||
AB2E9E641011E65900DD2F1F /* driver_nosound.c in Sources */ = {isa = PBXBuildFile; fileRef = AB2E9E521011E65900DD2F1F /* driver_nosound.c */; };
|
||||
AB2E9E651011E65900DD2F1F /* driver_nosound.h in Headers */ = {isa = PBXBuildFile; fileRef = AB2E9E531011E65900DD2F1F /* driver_nosound.h */; };
|
||||
AB2E9E681011E65900DD2F1F /* drivers.c in Sources */ = {isa = PBXBuildFile; fileRef = AB2E9E561011E65900DD2F1F /* drivers.c */; };
|
||||
AB2E9E691011E65900DD2F1F /* drivers.h in Headers */ = {isa = PBXBuildFile; fileRef = AB2E9E571011E65900DD2F1F /* drivers.h */; };
|
||||
AB2E9E6A1011E65900DD2F1F /* fx_man.c in Sources */ = {isa = PBXBuildFile; fileRef = AB2E9E581011E65900DD2F1F /* fx_man.c */; };
|
||||
AB2E9E6B1011E65900DD2F1F /* linklist.h in Headers */ = {isa = PBXBuildFile; fileRef = AB2E9E591011E65900DD2F1F /* linklist.h */; };
|
||||
AB2E9E6C1011E65900DD2F1F /* ll_man.h in Headers */ = {isa = PBXBuildFile; fileRef = AB2E9E5A1011E65900DD2F1F /* ll_man.h */; };
|
||||
AB2E9E6D1011E65900DD2F1F /* multivoc.c in Sources */ = {isa = PBXBuildFile; fileRef = AB2E9E5B1011E65900DD2F1F /* multivoc.c */; };
|
||||
AB2E9E6E1011E65900DD2F1F /* multivoc.h in Headers */ = {isa = PBXBuildFile; fileRef = AB2E9E5C1011E65900DD2F1F /* multivoc.h */; };
|
||||
AB2E9E6F1011E65900DD2F1F /* pitch.c in Sources */ = {isa = PBXBuildFile; fileRef = AB2E9E5D1011E65900DD2F1F /* pitch.c */; };
|
||||
AB2E9E701011E65900DD2F1F /* pitch.h in Headers */ = {isa = PBXBuildFile; fileRef = AB2E9E5E1011E65900DD2F1F /* pitch.h */; };
|
||||
AB2E9E741011E66100DD2F1F /* fx_man.h in Headers */ = {isa = PBXBuildFile; fileRef = AB2E9E711011E66100DD2F1F /* fx_man.h */; };
|
||||
AB2E9E751011E66100DD2F1F /* music.h in Headers */ = {isa = PBXBuildFile; fileRef = AB2E9E721011E66100DD2F1F /* music.h */; };
|
||||
AB2E9E761011E66100DD2F1F /* sndcards.h in Headers */ = {isa = PBXBuildFile; fileRef = AB2E9E731011E66100DD2F1F /* sndcards.h */; };
|
||||
AB2EA0831012029200DD2F1F /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB2EA0821012029200DD2F1F /* AudioUnit.framework */; };
|
||||
AB2EA17710121AA900DD2F1F /* mix.c in Sources */ = {isa = PBXBuildFile; fileRef = AB2EA17610121AA900DD2F1F /* mix.c */; };
|
||||
AB8C5612101A077700B42306 /* mixst.c in Sources */ = {isa = PBXBuildFile; fileRef = AB8C5611101A077700B42306 /* mixst.c */; };
|
||||
AB8C5828101B6B7100B42306 /* ogg.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB8C5826101B6B7100B42306 /* ogg.framework */; };
|
||||
AB8C5829101B6B7100B42306 /* vorbis.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB8C5827101B6B7100B42306 /* vorbis.framework */; };
|
||||
AB8C5868101B6D7500B42306 /* vorbis.c in Sources */ = {isa = PBXBuildFile; fileRef = AB8C5867101B6D7500B42306 /* vorbis.c */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
AB2E9E421011E61700DD2F1F /* libjfaudiolib.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libjfaudiolib.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
AB2E9E4D1011E65900DD2F1F /* _multivc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _multivc.h; sourceTree = "<group>"; };
|
||||
AB2E9E4E1011E65900DD2F1F /* driver_coreaudio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = driver_coreaudio.c; sourceTree = "<group>"; };
|
||||
AB2E9E4F1011E65900DD2F1F /* driver_coreaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = driver_coreaudio.h; sourceTree = "<group>"; };
|
||||
AB2E9E521011E65900DD2F1F /* driver_nosound.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = driver_nosound.c; sourceTree = "<group>"; };
|
||||
AB2E9E531011E65900DD2F1F /* driver_nosound.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = driver_nosound.h; sourceTree = "<group>"; };
|
||||
AB2E9E561011E65900DD2F1F /* drivers.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = drivers.c; sourceTree = "<group>"; };
|
||||
AB2E9E571011E65900DD2F1F /* drivers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = drivers.h; sourceTree = "<group>"; };
|
||||
AB2E9E581011E65900DD2F1F /* fx_man.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fx_man.c; sourceTree = "<group>"; };
|
||||
AB2E9E591011E65900DD2F1F /* linklist.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = linklist.h; sourceTree = "<group>"; };
|
||||
AB2E9E5A1011E65900DD2F1F /* ll_man.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ll_man.h; sourceTree = "<group>"; };
|
||||
AB2E9E5B1011E65900DD2F1F /* multivoc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = multivoc.c; sourceTree = "<group>"; };
|
||||
AB2E9E5C1011E65900DD2F1F /* multivoc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = multivoc.h; sourceTree = "<group>"; };
|
||||
AB2E9E5D1011E65900DD2F1F /* pitch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pitch.c; sourceTree = "<group>"; };
|
||||
AB2E9E5E1011E65900DD2F1F /* pitch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pitch.h; sourceTree = "<group>"; };
|
||||
AB2E9E711011E66100DD2F1F /* fx_man.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fx_man.h; sourceTree = "<group>"; };
|
||||
AB2E9E721011E66100DD2F1F /* music.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = music.h; sourceTree = "<group>"; };
|
||||
AB2E9E731011E66100DD2F1F /* sndcards.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sndcards.h; sourceTree = "<group>"; };
|
||||
AB2EA0821012029200DD2F1F /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = /System/Library/Frameworks/AudioUnit.framework; sourceTree = "<absolute>"; };
|
||||
AB2EA17610121AA900DD2F1F /* mix.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mix.c; sourceTree = "<group>"; };
|
||||
AB8C5611101A077700B42306 /* mixst.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mixst.c; sourceTree = "<group>"; };
|
||||
AB8C5826101B6B7100B42306 /* ogg.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ogg.framework; path = "third-party/ogg.framework"; sourceTree = "<group>"; };
|
||||
AB8C5827101B6B7100B42306 /* vorbis.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = vorbis.framework; path = "third-party/vorbis.framework"; sourceTree = "<group>"; };
|
||||
AB8C5867101B6D7500B42306 /* vorbis.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = vorbis.c; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
AB2E9E401011E61600DD2F1F /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
AB2EA0831012029200DD2F1F /* AudioUnit.framework in Frameworks */,
|
||||
AB8C5828101B6B7100B42306 /* ogg.framework in Frameworks */,
|
||||
AB8C5829101B6B7100B42306 /* vorbis.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
AB2E9E301011E60300DD2F1F = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AB8C582E101B6B7900B42306 /* Linked frameworks */,
|
||||
AB2E9E481011E63F00DD2F1F /* include */,
|
||||
AB2E9E471011E63900DD2F1F /* src */,
|
||||
AB2E9E431011E61700DD2F1F /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
AB2E9E431011E61700DD2F1F /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AB2E9E421011E61700DD2F1F /* libjfaudiolib.a */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
AB2E9E471011E63900DD2F1F /* src */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AB2E9E4D1011E65900DD2F1F /* _multivc.h */,
|
||||
AB2E9E4E1011E65900DD2F1F /* driver_coreaudio.c */,
|
||||
AB2E9E4F1011E65900DD2F1F /* driver_coreaudio.h */,
|
||||
AB2E9E521011E65900DD2F1F /* driver_nosound.c */,
|
||||
AB2E9E531011E65900DD2F1F /* driver_nosound.h */,
|
||||
AB2E9E561011E65900DD2F1F /* drivers.c */,
|
||||
AB2E9E571011E65900DD2F1F /* drivers.h */,
|
||||
AB2E9E581011E65900DD2F1F /* fx_man.c */,
|
||||
AB2E9E591011E65900DD2F1F /* linklist.h */,
|
||||
AB2E9E5A1011E65900DD2F1F /* ll_man.h */,
|
||||
AB2E9E5B1011E65900DD2F1F /* multivoc.c */,
|
||||
AB2E9E5C1011E65900DD2F1F /* multivoc.h */,
|
||||
AB2E9E5D1011E65900DD2F1F /* pitch.c */,
|
||||
AB2E9E5E1011E65900DD2F1F /* pitch.h */,
|
||||
AB2EA17610121AA900DD2F1F /* mix.c */,
|
||||
AB8C5611101A077700B42306 /* mixst.c */,
|
||||
AB8C5867101B6D7500B42306 /* vorbis.c */,
|
||||
);
|
||||
path = src;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
AB2E9E481011E63F00DD2F1F /* include */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AB2E9E711011E66100DD2F1F /* fx_man.h */,
|
||||
AB2E9E721011E66100DD2F1F /* music.h */,
|
||||
AB2E9E731011E66100DD2F1F /* sndcards.h */,
|
||||
);
|
||||
path = include;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
AB8C582E101B6B7900B42306 /* Linked frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AB2EA0821012029200DD2F1F /* AudioUnit.framework */,
|
||||
AB8C5827101B6B7100B42306 /* vorbis.framework */,
|
||||
AB8C5826101B6B7100B42306 /* ogg.framework */,
|
||||
);
|
||||
name = "Linked frameworks";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
AB2E9E3E1011E61600DD2F1F /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
AB2E9E5F1011E65900DD2F1F /* _multivc.h in Headers */,
|
||||
AB2E9E611011E65900DD2F1F /* driver_coreaudio.h in Headers */,
|
||||
AB2E9E651011E65900DD2F1F /* driver_nosound.h in Headers */,
|
||||
AB2E9E691011E65900DD2F1F /* drivers.h in Headers */,
|
||||
AB2E9E6B1011E65900DD2F1F /* linklist.h in Headers */,
|
||||
AB2E9E6C1011E65900DD2F1F /* ll_man.h in Headers */,
|
||||
AB2E9E6E1011E65900DD2F1F /* multivoc.h in Headers */,
|
||||
AB2E9E701011E65900DD2F1F /* pitch.h in Headers */,
|
||||
AB2E9E741011E66100DD2F1F /* fx_man.h in Headers */,
|
||||
AB2E9E751011E66100DD2F1F /* music.h in Headers */,
|
||||
AB2E9E761011E66100DD2F1F /* sndcards.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
AB2E9E411011E61600DD2F1F /* jfaudiolib */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = AB2E9E441011E61900DD2F1F /* Build configuration list for PBXNativeTarget "jfaudiolib" */;
|
||||
buildPhases = (
|
||||
AB2E9E3E1011E61600DD2F1F /* Headers */,
|
||||
AB2E9E3F1011E61600DD2F1F /* Sources */,
|
||||
AB2E9E401011E61600DD2F1F /* Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = jfaudiolib;
|
||||
productName = jfaudiolib;
|
||||
productReference = AB2E9E421011E61700DD2F1F /* libjfaudiolib.a */;
|
||||
productType = "com.apple.product-type.library.static";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
AB2E9E321011E60300DD2F1F /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
buildConfigurationList = AB2E9E331011E60300DD2F1F /* Build configuration list for PBXProject "jfaudiolib" */;
|
||||
compatibilityVersion = "Xcode 2.4";
|
||||
hasScannedForEncodings = 0;
|
||||
mainGroup = AB2E9E301011E60300DD2F1F;
|
||||
productRefGroup = AB2E9E431011E61700DD2F1F /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
AB2E9E411011E61600DD2F1F /* jfaudiolib */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
AB2E9E3F1011E61600DD2F1F /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
AB2E9E601011E65900DD2F1F /* driver_coreaudio.c in Sources */,
|
||||
AB2E9E641011E65900DD2F1F /* driver_nosound.c in Sources */,
|
||||
AB2E9E681011E65900DD2F1F /* drivers.c in Sources */,
|
||||
AB2E9E6A1011E65900DD2F1F /* fx_man.c in Sources */,
|
||||
AB2E9E6D1011E65900DD2F1F /* multivoc.c in Sources */,
|
||||
AB2E9E6F1011E65900DD2F1F /* pitch.c in Sources */,
|
||||
AB2EA17710121AA900DD2F1F /* mix.c in Sources */,
|
||||
AB8C5612101A077700B42306 /* mixst.c in Sources */,
|
||||
AB8C5868101B6D7500B42306 /* vorbis.c in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
AB2E9E341011E60300DD2F1F /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = (
|
||||
ppc,
|
||||
i386,
|
||||
);
|
||||
COPY_PHASE_STRIP = NO;
|
||||
FRAMEWORK_SEARCH_PATHS = "third-party";
|
||||
GCC_PREPROCESSOR_DEFINITIONS = __MACOSX__;
|
||||
GCC_VERSION_i386 = 4.0;
|
||||
GCC_VERSION_ppc = 4.0;
|
||||
MACOSX_DEPLOYMENT_TARGET_i386 = 10.4;
|
||||
MACOSX_DEPLOYMENT_TARGET_ppc = 10.3;
|
||||
SDKROOT_i386 = /Developer/SDKs/MacOSX10.4u.sdk;
|
||||
SDKROOT_ppc = /Developer/SDKs/MacOSX10.3.9.sdk;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
AB2E9E351011E60300DD2F1F /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = (
|
||||
ppc,
|
||||
i386,
|
||||
);
|
||||
COPY_PHASE_STRIP = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = "third-party";
|
||||
GCC_PREPROCESSOR_DEFINITIONS = __MACOSX__;
|
||||
GCC_VERSION_i386 = 4.0;
|
||||
GCC_VERSION_ppc = 4.0;
|
||||
MACOSX_DEPLOYMENT_TARGET_i386 = 10.4;
|
||||
MACOSX_DEPLOYMENT_TARGET_ppc = 10.3;
|
||||
SDKROOT_i386 = /Developer/SDKs/MacOSX10.4u.sdk;
|
||||
SDKROOT_ppc = /Developer/SDKs/MacOSX10.3.9.sdk;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
AB2E9E451011E61900DD2F1F /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
COPY_PHASE_STRIP = NO;
|
||||
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_ENABLE_FIX_AND_CONTINUE = YES;
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
PREBINDING = NO;
|
||||
PRODUCT_NAME = jfaudiolib;
|
||||
ZERO_LINK = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
AB2E9E461011E61900DD2F1F /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
COPY_PHASE_STRIP = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
|
||||
GCC_ENABLE_FIX_AND_CONTINUE = NO;
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||
PREBINDING = NO;
|
||||
PRODUCT_NAME = jfaudiolib;
|
||||
ZERO_LINK = NO;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
AB2E9E331011E60300DD2F1F /* Build configuration list for PBXProject "jfaudiolib" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
AB2E9E341011E60300DD2F1F /* Debug */,
|
||||
AB2E9E351011E60300DD2F1F /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
AB2E9E441011E61900DD2F1F /* Build configuration list for PBXNativeTarget "jfaudiolib" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
AB2E9E451011E61900DD2F1F /* Debug */,
|
||||
AB2E9E461011E61900DD2F1F /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = AB2E9E321011E60300DD2F1F /* Project object */;
|
||||
}
|
|
@ -1,339 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2009 Jonathon Fowler <jf@jonof.id.au>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* CoreAudio output driver for MultiVoc
|
||||
*
|
||||
* Inspired by the example set by the Audiere sound library available at
|
||||
* https://audiere.svn.sourceforge.net/svnroot/audiere/trunk/audiere/
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AudioUnit/AudioUnit.h>
|
||||
#include <pthread.h>
|
||||
#include "driver_coreaudio.h"
|
||||
|
||||
enum {
|
||||
CAErr_Warning = -2,
|
||||
CAErr_Error = -1,
|
||||
CAErr_Ok = 0,
|
||||
CAErr_Uninitialised,
|
||||
CAErr_FindNextComponent,
|
||||
CAErr_OpenAComponent,
|
||||
CAErr_AudioUnitInitialize,
|
||||
CAErr_AudioUnitSetProperty,
|
||||
CAErr_Mutex
|
||||
};
|
||||
|
||||
static int32_t ErrorCode = CAErr_Ok;
|
||||
static int32_t Initialised = 0;
|
||||
static int32_t Playing = 0;
|
||||
static ComponentInstance output_audio_unit;
|
||||
static pthread_mutex_t mutex;
|
||||
|
||||
static char *MixBuffer = 0;
|
||||
static int32_t MixBufferSize = 0;
|
||||
static int32_t MixBufferCount = 0;
|
||||
static int32_t MixBufferCurrent = 0;
|
||||
static int32_t MixBufferUsed = 0;
|
||||
static void ( *MixCallBack )( void ) = 0;
|
||||
|
||||
static OSStatus fillInput(
|
||||
void *inRefCon,
|
||||
AudioUnitRenderActionFlags inActionFlags,
|
||||
const AudioTimeStamp *inTimeStamp,
|
||||
UInt32 inBusNumber,
|
||||
AudioBuffer *ioData)
|
||||
{
|
||||
UInt32 remaining, len;
|
||||
char *ptr, *sptr;
|
||||
|
||||
remaining = ioData->mDataByteSize;
|
||||
ptr = ioData->mData;
|
||||
|
||||
while (remaining > 0) {
|
||||
if (MixBufferUsed == MixBufferSize) {
|
||||
CoreAudioDrv_Lock();
|
||||
MixCallBack();
|
||||
CoreAudioDrv_Unlock();
|
||||
|
||||
MixBufferUsed = 0;
|
||||
MixBufferCurrent++;
|
||||
if (MixBufferCurrent >= MixBufferCount) {
|
||||
MixBufferCurrent -= MixBufferCount;
|
||||
}
|
||||
}
|
||||
|
||||
while (remaining > 0 && MixBufferUsed < MixBufferSize) {
|
||||
sptr = MixBuffer + (MixBufferCurrent * MixBufferSize) + MixBufferUsed;
|
||||
|
||||
len = MixBufferSize - MixBufferUsed;
|
||||
if (remaining < len) {
|
||||
len = remaining;
|
||||
}
|
||||
|
||||
memcpy(ptr, sptr, len);
|
||||
|
||||
ptr += len;
|
||||
MixBufferUsed += len;
|
||||
remaining -= len;
|
||||
}
|
||||
}
|
||||
|
||||
return noErr;
|
||||
}
|
||||
|
||||
int32_t CoreAudioDrv_GetError(void)
|
||||
{
|
||||
return ErrorCode;
|
||||
}
|
||||
|
||||
const char *CoreAudioDrv_ErrorString( int32_t ErrorNumber )
|
||||
{
|
||||
const char *ErrorString;
|
||||
|
||||
switch( ErrorNumber )
|
||||
{
|
||||
case CAErr_Warning :
|
||||
case CAErr_Error :
|
||||
ErrorString = CoreAudioDrv_ErrorString( ErrorCode );
|
||||
break;
|
||||
|
||||
case CAErr_Ok :
|
||||
ErrorString = "CoreAudio ok.";
|
||||
break;
|
||||
|
||||
case CAErr_Uninitialised:
|
||||
ErrorString = "CoreAudio uninitialised.";
|
||||
break;
|
||||
|
||||
case CAErr_FindNextComponent:
|
||||
ErrorString = "CoreAudio error: FindNextComponent returned NULL.";
|
||||
break;
|
||||
|
||||
case CAErr_OpenAComponent:
|
||||
ErrorString = "CoreAudio error: OpenAComponent failed.";
|
||||
break;
|
||||
|
||||
case CAErr_AudioUnitInitialize:
|
||||
ErrorString = "CoreAudio error: AudioUnitInitialize failed.";
|
||||
break;
|
||||
|
||||
case CAErr_AudioUnitSetProperty:
|
||||
ErrorString = "CoreAudio error: AudioUnitSetProperty failed.";
|
||||
break;
|
||||
|
||||
case CAErr_Mutex:
|
||||
ErrorString = "CoreAudio error: could not initialise mutex.";
|
||||
break;
|
||||
|
||||
default:
|
||||
ErrorString = "Unknown CoreAudio error code.";
|
||||
break;
|
||||
}
|
||||
|
||||
return ErrorString;
|
||||
}
|
||||
|
||||
/*
|
||||
int32_t CoreAudioDrv_InitMIDI()
|
||||
{
|
||||
AudioStreamBasicDescription requestedDesc;
|
||||
|
||||
requestedDesc.mFormatID = kAudioFormatMIDIStream;
|
||||
}
|
||||
*/
|
||||
|
||||
int32_t CoreAudioDrv_Init(int32_t mixrate, int32_t numchannels, int32_t samplebits, void * initdata)
|
||||
{
|
||||
OSStatus result = noErr;
|
||||
Component comp;
|
||||
ComponentDescription desc;
|
||||
AudioStreamBasicDescription requestedDesc;
|
||||
struct AudioUnitInputCallback callback;
|
||||
|
||||
if (Initialised) {
|
||||
CoreAudioDrv_Shutdown();
|
||||
}
|
||||
|
||||
if (pthread_mutex_init(&mutex, 0) < 0) {
|
||||
ErrorCode = CAErr_Mutex;
|
||||
return CAErr_Error;
|
||||
}
|
||||
|
||||
// Setup a AudioStreamBasicDescription with the requested format
|
||||
requestedDesc.mFormatID = kAudioFormatLinearPCM;
|
||||
requestedDesc.mFormatFlags = kLinearPCMFormatFlagIsPacked;
|
||||
requestedDesc.mChannelsPerFrame = numchannels;
|
||||
requestedDesc.mSampleRate = mixrate;
|
||||
|
||||
requestedDesc.mBitsPerChannel = samplebits;
|
||||
if (samplebits == 16) {
|
||||
requestedDesc.mFormatFlags |= kLinearPCMFormatFlagIsSignedInteger;
|
||||
#ifdef __POWERPC__
|
||||
requestedDesc.mFormatFlags |= kLinearPCMFormatFlagIsBigEndian;
|
||||
#endif
|
||||
}
|
||||
|
||||
requestedDesc.mFramesPerPacket = 1;
|
||||
requestedDesc.mBytesPerFrame = requestedDesc.mBitsPerChannel * \
|
||||
requestedDesc.mChannelsPerFrame / 8;
|
||||
requestedDesc.mBytesPerPacket = requestedDesc.mBytesPerFrame * \
|
||||
requestedDesc.mFramesPerPacket;
|
||||
|
||||
// Locate the default output audio unit
|
||||
desc.componentType = kAudioUnitComponentType;
|
||||
desc.componentSubType = kAudioUnitSubType_Output;
|
||||
desc.componentManufacturer = kAudioUnitID_DefaultOutput;
|
||||
desc.componentFlags = 0;
|
||||
desc.componentFlagsMask = 0;
|
||||
|
||||
comp = FindNextComponent(NULL, &desc);
|
||||
if (comp == NULL) {
|
||||
ErrorCode = CAErr_FindNextComponent;
|
||||
pthread_mutex_destroy(&mutex);
|
||||
return CAErr_Error;
|
||||
}
|
||||
|
||||
// Open & initialize the default output audio unit
|
||||
result = OpenAComponent(comp, &output_audio_unit);
|
||||
if (result != noErr) {
|
||||
ErrorCode = CAErr_OpenAComponent;
|
||||
CloseComponent(output_audio_unit);
|
||||
pthread_mutex_destroy(&mutex);
|
||||
return CAErr_Error;
|
||||
}
|
||||
|
||||
result = AudioUnitInitialize(output_audio_unit);
|
||||
if (result != noErr) {
|
||||
ErrorCode = CAErr_AudioUnitInitialize;
|
||||
CloseComponent(output_audio_unit);
|
||||
pthread_mutex_destroy(&mutex);
|
||||
return CAErr_Error;
|
||||
}
|
||||
|
||||
// Set the input format of the audio unit.
|
||||
result = AudioUnitSetProperty(output_audio_unit,
|
||||
kAudioUnitProperty_StreamFormat,
|
||||
kAudioUnitScope_Input,
|
||||
0,
|
||||
&requestedDesc,
|
||||
sizeof(requestedDesc));
|
||||
if (result != noErr) {
|
||||
ErrorCode = CAErr_AudioUnitSetProperty;
|
||||
CloseComponent(output_audio_unit);
|
||||
pthread_mutex_destroy(&mutex);
|
||||
return CAErr_Error;
|
||||
}
|
||||
|
||||
// Set the audio callback
|
||||
callback.inputProc = fillInput;
|
||||
callback.inputProcRefCon = 0;
|
||||
AudioUnitSetProperty(output_audio_unit,
|
||||
kAudioUnitProperty_SetInputCallback,
|
||||
kAudioUnitScope_Input,
|
||||
0,
|
||||
&callback,
|
||||
sizeof(callback));
|
||||
|
||||
Initialised = 1;
|
||||
|
||||
return CAErr_Ok;
|
||||
}
|
||||
|
||||
void CoreAudioDrv_Shutdown(void)
|
||||
{
|
||||
OSStatus result;
|
||||
struct AudioUnitInputCallback callback;
|
||||
|
||||
if (!Initialised) {
|
||||
return;
|
||||
}
|
||||
|
||||
// stop processing the audio unit
|
||||
CoreAudioDrv_StopPlayback();
|
||||
|
||||
// Remove the input callback
|
||||
callback.inputProc = 0;
|
||||
callback.inputProcRefCon = 0;
|
||||
result = AudioUnitSetProperty(output_audio_unit,
|
||||
kAudioUnitProperty_SetInputCallback,
|
||||
kAudioUnitScope_Input,
|
||||
0,
|
||||
&callback,
|
||||
sizeof(callback));
|
||||
result = CloseComponent(output_audio_unit);
|
||||
|
||||
pthread_mutex_destroy(&mutex);
|
||||
|
||||
Initialised = 0;
|
||||
}
|
||||
|
||||
int32_t CoreAudioDrv_BeginPlayback(char *BufferStart, int32_t BufferSize,
|
||||
int32_t NumDivisions, void ( *CallBackFunc )( void ) )
|
||||
{
|
||||
if (!Initialised) {
|
||||
ErrorCode = CAErr_Uninitialised;
|
||||
return CAErr_Error;
|
||||
}
|
||||
|
||||
if (Playing) {
|
||||
CoreAudioDrv_StopPlayback();
|
||||
}
|
||||
|
||||
MixBuffer = BufferStart;
|
||||
MixBufferSize = BufferSize;
|
||||
MixBufferCount = NumDivisions;
|
||||
MixBufferCurrent = 0;
|
||||
MixBufferUsed = 0;
|
||||
MixCallBack = CallBackFunc;
|
||||
|
||||
// prime the buffer
|
||||
MixCallBack();
|
||||
|
||||
AudioOutputUnitStart(output_audio_unit);
|
||||
|
||||
Playing = 1;
|
||||
|
||||
return CAErr_Ok;
|
||||
}
|
||||
|
||||
void CoreAudioDrv_StopPlayback(void)
|
||||
{
|
||||
if (!Initialised || !Playing) {
|
||||
return;
|
||||
}
|
||||
|
||||
CoreAudioDrv_Lock();
|
||||
AudioOutputUnitStop(output_audio_unit);
|
||||
CoreAudioDrv_Unlock();
|
||||
|
||||
Playing = 0;
|
||||
}
|
||||
|
||||
void CoreAudioDrv_Lock(void)
|
||||
{
|
||||
pthread_mutex_lock(&mutex);
|
||||
}
|
||||
|
||||
void CoreAudioDrv_Unlock(void)
|
||||
{
|
||||
pthread_mutex_unlock(&mutex);
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2009 Jonathon Fowler <jf@jonof.id.au>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
int32_t CoreAudioDrv_GetError(void);
|
||||
const char *CoreAudioDrv_ErrorString( int32_t ErrorNumber );
|
||||
int32_t CoreAudioDrv_Init(int32_t mixrate, int32_t numchannels, int32_t samplebits, void * initdata);
|
||||
void CoreAudioDrv_Shutdown(void);
|
||||
int32_t CoreAudioDrv_BeginPlayback(char *BufferStart, int32_t BufferSize,
|
||||
int32_t NumDivisions, void ( *CallBackFunc )( void ) );
|
||||
void CoreAudioDrv_StopPlayback(void);
|
||||
void CoreAudioDrv_Lock(void);
|
||||
void CoreAudioDrv_Unlock(void);
|
|
@ -293,14 +293,14 @@ static void TeardownDSound(HRESULT err)
|
|||
lpds = 0;
|
||||
}
|
||||
|
||||
int32_t DirectSoundDrv_Init(int32_t mixrate, int32_t numchannels, int32_t samplebits, void * initdata)
|
||||
int32_t DirectSoundDrv_PCM_Init(int32_t *mixrate, int32_t *numchannels, int32_t *samplebits, void * initdata)
|
||||
{
|
||||
HRESULT err;
|
||||
DSBUFFERDESC bufdesc;
|
||||
WAVEFORMATEX wfex;
|
||||
|
||||
if (Initialised) {
|
||||
DirectSoundDrv_Shutdown();
|
||||
DirectSoundDrv_PCM_Shutdown();
|
||||
}
|
||||
|
||||
err = DirectSoundCreate(0, &lpds, 0);
|
||||
|
@ -329,9 +329,9 @@ int32_t DirectSoundDrv_Init(int32_t mixrate, int32_t numchannels, int32_t sample
|
|||
|
||||
memset(&wfex, 0, sizeof(WAVEFORMATEX));
|
||||
wfex.wFormatTag = WAVE_FORMAT_PCM;
|
||||
wfex.nChannels = numchannels;
|
||||
wfex.nSamplesPerSec = mixrate;
|
||||
wfex.wBitsPerSample = samplebits;
|
||||
wfex.nChannels = *numchannels;
|
||||
wfex.nSamplesPerSec = *mixrate;
|
||||
wfex.wBitsPerSample = *samplebits;
|
||||
wfex.nBlockAlign = wfex.nChannels * wfex.wBitsPerSample / 8;
|
||||
wfex.nAvgBytesPerSec = wfex.nSamplesPerSec * wfex.nBlockAlign;
|
||||
|
||||
|
@ -405,20 +405,20 @@ int32_t DirectSoundDrv_Init(int32_t mixrate, int32_t numchannels, int32_t sample
|
|||
return DSErr_Ok;
|
||||
}
|
||||
|
||||
void DirectSoundDrv_Shutdown(void)
|
||||
void DirectSoundDrv_PCM_Shutdown(void)
|
||||
{
|
||||
if (!Initialised) {
|
||||
return;
|
||||
}
|
||||
|
||||
DirectSoundDrv_StopPlayback();
|
||||
DirectSoundDrv_PCM_StopPlayback();
|
||||
|
||||
TeardownDSound(DS_OK);
|
||||
|
||||
Initialised = 0;
|
||||
}
|
||||
|
||||
int32_t DirectSoundDrv_BeginPlayback(char *BufferStart, int32_t BufferSize,
|
||||
int32_t DirectSoundDrv_PCM_BeginPlayback(char *BufferStart, int32_t BufferSize,
|
||||
int32_t NumDivisions, void ( *CallBackFunc )( void ) )
|
||||
{
|
||||
HRESULT err;
|
||||
|
@ -428,7 +428,7 @@ int32_t DirectSoundDrv_BeginPlayback(char *BufferStart, int32_t BufferSize,
|
|||
return DSErr_Error;
|
||||
}
|
||||
|
||||
DirectSoundDrv_StopPlayback();
|
||||
DirectSoundDrv_PCM_StopPlayback();
|
||||
|
||||
MixBuffer = BufferStart;
|
||||
MixBufferSize = BufferSize;
|
||||
|
@ -459,7 +459,7 @@ int32_t DirectSoundDrv_BeginPlayback(char *BufferStart, int32_t BufferSize,
|
|||
return DSErr_Ok;
|
||||
}
|
||||
|
||||
void DirectSoundDrv_StopPlayback(void)
|
||||
void DirectSoundDrv_PCM_StopPlayback(void)
|
||||
{
|
||||
if (!Playing) {
|
||||
return;
|
||||
|
@ -471,7 +471,7 @@ void DirectSoundDrv_StopPlayback(void)
|
|||
Playing = 0;
|
||||
}
|
||||
|
||||
void DirectSoundDrv_Lock(void)
|
||||
void DirectSoundDrv_PCM_Lock(void)
|
||||
{
|
||||
DWORD err;
|
||||
|
||||
|
@ -481,7 +481,7 @@ void DirectSoundDrv_Lock(void)
|
|||
}
|
||||
}
|
||||
|
||||
void DirectSoundDrv_Unlock(void)
|
||||
void DirectSoundDrv_PCM_Unlock(void)
|
||||
{
|
||||
ReleaseMutex(mutex);
|
||||
}
|
||||
|
|
|
@ -22,10 +22,10 @@
|
|||
|
||||
int32_t DirectSoundDrv_GetError(void);
|
||||
const char *DirectSoundDrv_ErrorString( int32_t ErrorNumber );
|
||||
int32_t DirectSoundDrv_Init(int32_t mixrate, int32_t numchannels, int32_t samplebits, void * initdata);
|
||||
void DirectSoundDrv_Shutdown(void);
|
||||
int32_t DirectSoundDrv_BeginPlayback(char *BufferStart, int32_t BufferSize,
|
||||
int32_t DirectSoundDrv_PCM_Init(int32_t *mixrate, int32_t *numchannels, int32_t *samplebits, void * initdata);
|
||||
void DirectSoundDrv_PCM_Shutdown(void);
|
||||
int32_t DirectSoundDrv_PCM_BeginPlayback(char *BufferStart, int32_t BufferSize,
|
||||
int32_t NumDivisions, void ( *CallBackFunc )( void ) );
|
||||
void DirectSoundDrv_StopPlayback(void);
|
||||
void DirectSoundDrv_Lock(void);
|
||||
void DirectSoundDrv_Unlock(void);
|
||||
void DirectSoundDrv_PCM_StopPlayback(void);
|
||||
void DirectSoundDrv_PCM_Lock(void);
|
||||
void DirectSoundDrv_PCM_Unlock(void);
|
||||
|
|
|
@ -34,29 +34,29 @@ const char *NoSoundDrv_ErrorString( int32_t ErrorNumber )
|
|||
return "No sound, Ok.";
|
||||
}
|
||||
|
||||
int32_t NoSoundDrv_Init(int32_t mixrate, int32_t numchannels, int32_t samplebits, void * initdata)
|
||||
int32_t NoSoundDrv_PCM_Init(int32_t *mixrate, int32_t *numchannels, int32_t *samplebits, void * initdata)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void NoSoundDrv_Shutdown(void)
|
||||
void NoSoundDrv_PCM_Shutdown(void)
|
||||
{
|
||||
}
|
||||
|
||||
int32_t NoSoundDrv_BeginPlayback(char *BufferStart, int32_t BufferSize,
|
||||
int32_t NoSoundDrv_PCM_BeginPlayback(char *BufferStart, int32_t BufferSize,
|
||||
int32_t NumDivisions, void ( *CallBackFunc )( void ) )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void NoSoundDrv_StopPlayback(void)
|
||||
void NoSoundDrv_PCM_StopPlayback(void)
|
||||
{
|
||||
}
|
||||
|
||||
void NoSoundDrv_Lock(void)
|
||||
void NoSoundDrv_PCM_Lock(void)
|
||||
{
|
||||
}
|
||||
|
||||
void NoSoundDrv_Unlock(void)
|
||||
void NoSoundDrv_PCM_Unlock(void)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -21,10 +21,10 @@
|
|||
|
||||
int NoSoundDrv_GetError(void);
|
||||
const char *NoSoundDrv_ErrorString( int ErrorNumber );
|
||||
int NoSoundDrv_Init(int mixrate, int numchannels, int samplebits, void * initdata);
|
||||
void NoSoundDrv_Shutdown(void);
|
||||
int NoSoundDrv_BeginPlayback(char *BufferStart, int BufferSize,
|
||||
int NoSoundDrv_PCM_Init(int *mixrate, int *numchannels, int *samplebits, void * initdata);
|
||||
void NoSoundDrv_PCM_Shutdown(void);
|
||||
int NoSoundDrv_PCM_BeginPlayback(char *BufferStart, int BufferSize,
|
||||
int NumDivisions, void ( *CallBackFunc )( void ) );
|
||||
void NoSoundDrv_StopPlayback(void);
|
||||
void NoSoundDrv_Lock(void);
|
||||
void NoSoundDrv_Unlock(void);
|
||||
void NoSoundDrv_PCM_StopPlayback(void);
|
||||
void NoSoundDrv_PCM_Lock(void);
|
||||
void NoSoundDrv_PCM_Unlock(void);
|
||||
|
|
|
@ -43,7 +43,7 @@ enum {
|
|||
static int32_t ErrorCode = SDLErr_Ok;
|
||||
static int32_t Initialised = 0;
|
||||
static int32_t Playing = 0;
|
||||
static int32_t StartedSDL = -1;
|
||||
// static int32_t StartedSDL = -1;
|
||||
|
||||
static char *MixBuffer = 0;
|
||||
static int32_t MixBufferSize = 0;
|
||||
|
@ -132,19 +132,21 @@ const char *SDLDrv_ErrorString( int32_t ErrorNumber )
|
|||
return ErrorString;
|
||||
}
|
||||
|
||||
int32_t SDLDrv_Init(int32_t mixrate, int32_t numchannels, int32_t samplebits, void * initdata)
|
||||
int32_t SDLDrv_PCM_Init(int32_t *mixrate, int32_t *numchannels, int32_t *samplebits, void * initdata)
|
||||
{
|
||||
uint32_t inited;
|
||||
// uint32_t inited;
|
||||
int32_t err = 0;
|
||||
int32_t chunksize;
|
||||
uint16_t fmt;
|
||||
|
||||
UNREFERENCED_PARAMETER(numchannels);
|
||||
UNREFERENCED_PARAMETER(initdata);
|
||||
|
||||
if (Initialised) {
|
||||
SDLDrv_Shutdown();
|
||||
SDLDrv_PCM_Shutdown();
|
||||
}
|
||||
|
||||
/*
|
||||
inited = SDL_WasInit(SDL_INIT_EVERYTHING);
|
||||
|
||||
if (inited == 0) {
|
||||
|
@ -160,20 +162,26 @@ int32_t SDLDrv_Init(int32_t mixrate, int32_t numchannels, int32_t samplebits, vo
|
|||
ErrorCode = SDLErr_InitSubSystem;
|
||||
return SDLErr_Error;
|
||||
}
|
||||
*/
|
||||
|
||||
chunksize = 512;
|
||||
|
||||
if (mixrate >= 16000) chunksize *= 2;
|
||||
if (mixrate >= 32000) chunksize *= 2;
|
||||
if (*mixrate >= 16000) chunksize *= 2;
|
||||
if (*mixrate >= 32000) chunksize *= 2;
|
||||
|
||||
// allocate 4 channels: 2 for the game's SFX, 1 for music, and 1 for fillData()
|
||||
err = Mix_OpenAudio(mixrate, (samplebits == 8) ? AUDIO_U8 : AUDIO_S16SYS, 4, chunksize);
|
||||
err = Mix_OpenAudio(*mixrate, (*samplebits == 8) ? AUDIO_U8 : AUDIO_S16SYS, 4, chunksize);
|
||||
|
||||
if (err < 0) {
|
||||
ErrorCode = SDLErr_OpenAudio;
|
||||
return SDLErr_Error;
|
||||
}
|
||||
|
||||
Mix_QuerySpec(mixrate, &fmt, numchannels);
|
||||
|
||||
if (fmt == AUDIO_U8) *samplebits = 8;
|
||||
else *samplebits = 16;
|
||||
|
||||
//Mix_SetPostMix(fillData, NULL);
|
||||
|
||||
// channel 0 and 1 are actual sounds
|
||||
|
@ -192,39 +200,38 @@ int32_t SDLDrv_Init(int32_t mixrate, int32_t numchannels, int32_t samplebits, vo
|
|||
return SDLErr_Ok;
|
||||
}
|
||||
|
||||
void SDLDrv_Shutdown(void)
|
||||
void SDLDrv_PCM_Shutdown(void)
|
||||
{
|
||||
if (!Initialised) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (StartedSDL > 0) {
|
||||
// if (StartedSDL > 0) {
|
||||
if (Initialised)
|
||||
{
|
||||
Mix_HaltChannel(0);
|
||||
Mix_HaltChannel(-1);
|
||||
}
|
||||
|
||||
if (DummyChunk != NULL)
|
||||
{
|
||||
Mix_FreeChunk(DummyChunk);
|
||||
DummyChunk = NULL;
|
||||
}
|
||||
|
||||
DummyChunk = NULL;
|
||||
|
||||
if (DummyBuffer != NULL)
|
||||
{
|
||||
free(DummyBuffer);
|
||||
DummyBuffer = NULL;
|
||||
}
|
||||
|
||||
DummyBuffer = NULL;
|
||||
|
||||
if (Initialised)
|
||||
{
|
||||
Mix_CloseAudio();
|
||||
Initialised = 0;
|
||||
}
|
||||
|
||||
Initialised = 0;
|
||||
|
||||
/*
|
||||
SDL_QuitSubSystem(SDL_INIT_AUDIO);
|
||||
}
|
||||
else if (StartedSDL == 0) {
|
||||
|
@ -233,9 +240,10 @@ void SDLDrv_Shutdown(void)
|
|||
|
||||
|
||||
StartedSDL = -1;
|
||||
*/
|
||||
}
|
||||
|
||||
int32_t SDLDrv_BeginPlayback(char *BufferStart, int32_t BufferSize,
|
||||
int32_t SDLDrv_PCM_BeginPlayback(char *BufferStart, int32_t BufferSize,
|
||||
int32_t NumDivisions, void ( *CallBackFunc )( void ) )
|
||||
{
|
||||
if (!Initialised) {
|
||||
|
@ -244,7 +252,7 @@ int32_t SDLDrv_BeginPlayback(char *BufferStart, int32_t BufferSize,
|
|||
}
|
||||
|
||||
if (Playing) {
|
||||
SDLDrv_StopPlayback();
|
||||
SDLDrv_PCM_StopPlayback();
|
||||
}
|
||||
|
||||
MixBuffer = BufferStart;
|
||||
|
@ -264,7 +272,7 @@ int32_t SDLDrv_BeginPlayback(char *BufferStart, int32_t BufferSize,
|
|||
return SDLErr_Ok;
|
||||
}
|
||||
|
||||
void SDLDrv_StopPlayback(void)
|
||||
void SDLDrv_PCM_StopPlayback(void)
|
||||
{
|
||||
if (!Initialised || !Playing) {
|
||||
return;
|
||||
|
@ -275,7 +283,7 @@ void SDLDrv_StopPlayback(void)
|
|||
Playing = 0;
|
||||
}
|
||||
|
||||
void SDLDrv_Lock(void)
|
||||
void SDLDrv_PCM_Lock(void)
|
||||
{
|
||||
/*
|
||||
if (InterruptsDisabled++)
|
||||
|
@ -285,7 +293,7 @@ void SDLDrv_Lock(void)
|
|||
|
||||
}
|
||||
|
||||
void SDLDrv_Unlock(void)
|
||||
void SDLDrv_PCM_Unlock(void)
|
||||
{
|
||||
/*
|
||||
if (--InterruptsDisabled)
|
||||
|
|
|
@ -21,10 +21,10 @@
|
|||
|
||||
int32_t SDLDrv_GetError(void);
|
||||
const char *SDLDrv_ErrorString( int32_t ErrorNumber );
|
||||
int32_t SDLDrv_Init(int32_t mixrate, int32_t numchannels, int32_t samplebits, void * initdata);
|
||||
void SDLDrv_Shutdown(void);
|
||||
int32_t SDLDrv_BeginPlayback(char *BufferStart, int32_t BufferSize,
|
||||
int32_t SDLDrv_PCM_Init(int32_t *mixrate, int32_t *numchannels, int32_t *samplebits, void * initdata);
|
||||
void SDLDrv_PCM_Shutdown(void);
|
||||
int32_t SDLDrv_PCM_BeginPlayback(char *BufferStart, int32_t BufferSize,
|
||||
int32_t NumDivisions, void ( *CallBackFunc )( void ) );
|
||||
void SDLDrv_StopPlayback(void);
|
||||
void SDLDrv_Lock(void);
|
||||
void SDLDrv_Unlock(void);
|
||||
void SDLDrv_PCM_StopPlayback(void);
|
||||
void SDLDrv_PCM_Lock(void);
|
||||
void SDLDrv_PCM_Unlock(void);
|
||||
|
|
|
@ -31,10 +31,6 @@
|
|||
# include "driver_sdl.h"
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
# include "driver_coreaudio.h"
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
# include "driver_directsound.h"
|
||||
#endif
|
||||
|
@ -46,7 +42,7 @@ int32_t ASS_SoundDriver = -1;
|
|||
static struct {
|
||||
int32_t (* GetError)(void);
|
||||
const char * (* ErrorString)(int32_t);
|
||||
int32_t (* Init)(int32_t, int32_t, int32_t, void *);
|
||||
int32_t (* Init)(int32_t *, int32_t *, int32_t *, void *);
|
||||
void (* Shutdown)(void);
|
||||
int32_t (* BeginPlayback)(char *, int32_t, int32_t, void ( * )(void) );
|
||||
void (* StopPlayback)(void);
|
||||
|
@ -58,12 +54,12 @@ static struct {
|
|||
{
|
||||
NoSoundDrv_GetError,
|
||||
NoSoundDrv_ErrorString,
|
||||
NoSoundDrv_Init,
|
||||
NoSoundDrv_Shutdown,
|
||||
NoSoundDrv_BeginPlayback,
|
||||
NoSoundDrv_StopPlayback,
|
||||
NoSoundDrv_Lock,
|
||||
NoSoundDrv_Unlock,
|
||||
NoSoundDrv_PCM_Init,
|
||||
NoSoundDrv_PCM_Shutdown,
|
||||
NoSoundDrv_PCM_BeginPlayback,
|
||||
NoSoundDrv_PCM_StopPlayback,
|
||||
NoSoundDrv_PCM_Lock,
|
||||
NoSoundDrv_PCM_Unlock,
|
||||
},
|
||||
|
||||
// Simple DirectMedia Layer
|
||||
|
@ -71,28 +67,12 @@ static struct {
|
|||
{
|
||||
SDLDrv_GetError,
|
||||
SDLDrv_ErrorString,
|
||||
SDLDrv_Init,
|
||||
SDLDrv_Shutdown,
|
||||
SDLDrv_BeginPlayback,
|
||||
SDLDrv_StopPlayback,
|
||||
SDLDrv_Lock,
|
||||
SDLDrv_Unlock,
|
||||
},
|
||||
#else
|
||||
UNSUPPORTED
|
||||
#endif
|
||||
|
||||
// OS X CoreAudio
|
||||
#ifdef __APPLE__
|
||||
{
|
||||
CoreAudioDrv_GetError,
|
||||
CoreAudioDrv_ErrorString,
|
||||
CoreAudioDrv_Init,
|
||||
CoreAudioDrv_Shutdown,
|
||||
CoreAudioDrv_BeginPlayback,
|
||||
CoreAudioDrv_StopPlayback,
|
||||
CoreAudioDrv_Lock,
|
||||
CoreAudioDrv_Unlock,
|
||||
SDLDrv_PCM_Init,
|
||||
SDLDrv_PCM_Shutdown,
|
||||
SDLDrv_PCM_BeginPlayback,
|
||||
SDLDrv_PCM_StopPlayback,
|
||||
SDLDrv_PCM_Lock,
|
||||
SDLDrv_PCM_Unlock,
|
||||
},
|
||||
#else
|
||||
UNSUPPORTED
|
||||
|
@ -103,12 +83,12 @@ static struct {
|
|||
{
|
||||
DirectSoundDrv_GetError,
|
||||
DirectSoundDrv_ErrorString,
|
||||
DirectSoundDrv_Init,
|
||||
DirectSoundDrv_Shutdown,
|
||||
DirectSoundDrv_BeginPlayback,
|
||||
DirectSoundDrv_StopPlayback,
|
||||
DirectSoundDrv_Lock,
|
||||
DirectSoundDrv_Unlock,
|
||||
DirectSoundDrv_PCM_Init,
|
||||
DirectSoundDrv_PCM_Shutdown,
|
||||
DirectSoundDrv_PCM_BeginPlayback,
|
||||
DirectSoundDrv_PCM_StopPlayback,
|
||||
DirectSoundDrv_PCM_Lock,
|
||||
DirectSoundDrv_PCM_Unlock,
|
||||
},
|
||||
#else
|
||||
UNSUPPORTED
|
||||
|
@ -141,7 +121,7 @@ const char * SoundDriver_ErrorString( int32_t ErrorNumber )
|
|||
return SoundDrivers[ASS_SoundDriver].ErrorString(ErrorNumber);
|
||||
}
|
||||
|
||||
int32_t SoundDriver_Init(int32_t mixrate, int32_t numchannels, int32_t samplebits, void * initdata)
|
||||
int32_t SoundDriver_Init(int32_t *mixrate, int32_t *numchannels, int32_t *samplebits, void * initdata)
|
||||
{
|
||||
return SoundDrivers[ASS_SoundDriver].Init(mixrate, numchannels, samplebits, initdata);
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ int32_t SoundDriver_IsSupported(int32_t driver);
|
|||
|
||||
int32_t SoundDriver_GetError(void);
|
||||
const char * SoundDriver_ErrorString( int32_t ErrorNumber );
|
||||
int32_t SoundDriver_Init(int32_t mixrate, int32_t numchannels, int32_t samplebits, void * initdata);
|
||||
int32_t SoundDriver_Init(int32_t *mixrate, int32_t *numchannels, int32_t *samplebits, void * initdata);
|
||||
void SoundDriver_Shutdown(void);
|
||||
int32_t SoundDriver_BeginPlayback( char *BufferStart,
|
||||
int32_t BufferSize, int32_t NumDivisions,
|
||||
|
|
|
@ -126,9 +126,7 @@ int32_t FX_Init
|
|||
|
||||
if (SoundCard == ASS_AutoDetect)
|
||||
{
|
||||
#if defined __APPLE__
|
||||
SoundCard = ASS_CoreAudio;
|
||||
#elif defined WIN32
|
||||
#if defined WIN32
|
||||
SoundCard = ASS_DirectSound;
|
||||
#elif defined HAVE_SDL
|
||||
SoundCard = ASS_SDL;
|
||||
|
|
|
@ -2829,7 +2829,7 @@ int32_t MV_Init
|
|||
ASS_SoundDriver = soundcard;
|
||||
|
||||
// Initialize the sound card
|
||||
status = SoundDriver_Init(MixRate, numchannels, samplebits, initdata);
|
||||
status = SoundDriver_Init(&MixRate, &numchannels, &samplebits, initdata);
|
||||
if (status != MV_Ok)
|
||||
{
|
||||
MV_SetErrorCode(MV_DriverError);
|
||||
|
|
|
@ -4610,10 +4610,10 @@ cheat_for_port_credits:
|
|||
if (x==io)
|
||||
{
|
||||
ud.config.NumVoices++;
|
||||
if (ud.config.NumVoices > 32)
|
||||
if (ud.config.NumVoices > 96)
|
||||
ud.config.NumVoices = 4;
|
||||
}
|
||||
modval(4,32,(int32_t *)&ud.config.NumVoices,1,probey==io);
|
||||
modval(4,96,(int32_t *)&ud.config.NumVoices,1,probey==io);
|
||||
if (ud.config.NumVoices != i)
|
||||
changesmade |= 8;
|
||||
Bsprintf(tempbuf,"%d",ud.config.NumVoices);
|
||||
|
|
|
@ -255,9 +255,8 @@ int32_t MUSIC_PlaySong(char *song, int32_t loopflag)
|
|||
music_musicchunk = Mix_LoadMUS_RW(SDL_RWFromMem((char *) song, g_musicSize));
|
||||
|
||||
if (music_musicchunk != NULL)
|
||||
{
|
||||
Mix_PlayMusic(music_musicchunk, (loopflag == MUSIC_LoopSong)?-1:0);
|
||||
}
|
||||
|
||||
return MUSIC_Ok;
|
||||
}
|
||||
|
||||
|
|
|
@ -3275,7 +3275,7 @@ void P_CheckSectors(int32_t snum)
|
|||
if (PN == CAMERA1 && SP == 0 && sprite[neartagsprite].hitag == SLT)
|
||||
{
|
||||
SP = 1; //Using this camera
|
||||
A_PlaySound(MONITOR_ACTIVE,neartagsprite);
|
||||
A_PlaySound(MONITOR_ACTIVE,p->i);
|
||||
|
||||
sprite[neartagsprite].owner = i;
|
||||
sprite[neartagsprite].yvel = 1;
|
||||
|
|
|
@ -204,10 +204,13 @@ void S_PauseMusic(int32_t onf)
|
|||
|
||||
if (MusicIsWaveform)
|
||||
FX_PauseVoice(MusicVoice, onf);
|
||||
else if (onf)
|
||||
MUSIC_Pause();
|
||||
else
|
||||
MUSIC_Continue();
|
||||
{
|
||||
if (onf)
|
||||
MUSIC_Pause();
|
||||
else
|
||||
MUSIC_Continue();
|
||||
}
|
||||
|
||||
MusicPaused = onf;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue