From 3964ca6766910f9a2ea2550a940803d0fe4ca14e Mon Sep 17 00:00:00 2001 From: terminx Date: Fri, 31 Jul 2009 11:45:29 +0000 Subject: [PATCH] fixes... mostly sound fuckery git-svn-id: https://svn.eduke32.com/eduke32@1481 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/src/kplib.c | 26 +- polymer/eduke32/eduke32.vcproj | 8 - .../source/jaudiolib/include/sndcards.h | 1 - .../jfaudiolib.xcodeproj/project.pbxproj | 307 ---------------- .../source/jaudiolib/src/driver_coreaudio.c | 339 ------------------ .../source/jaudiolib/src/driver_coreaudio.h | 29 -- .../source/jaudiolib/src/driver_directsound.c | 24 +- .../source/jaudiolib/src/driver_directsound.h | 12 +- .../source/jaudiolib/src/driver_nosound.c | 12 +- .../source/jaudiolib/src/driver_nosound.h | 12 +- .../eduke32/source/jaudiolib/src/driver_sdl.c | 48 +-- .../eduke32/source/jaudiolib/src/driver_sdl.h | 12 +- .../eduke32/source/jaudiolib/src/drivers.c | 60 ++-- .../eduke32/source/jaudiolib/src/drivers.h | 2 +- polymer/eduke32/source/jaudiolib/src/fx_man.c | 4 +- .../eduke32/source/jaudiolib/src/multivoc.c | 2 +- polymer/eduke32/source/menus.c | 4 +- polymer/eduke32/source/sdlmusic.c | 3 +- polymer/eduke32/source/sector.c | 2 +- polymer/eduke32/source/sounds.c | 9 +- 20 files changed, 112 insertions(+), 804 deletions(-) delete mode 100644 polymer/eduke32/source/jaudiolib/jfaudiolib.xcodeproj/project.pbxproj delete mode 100644 polymer/eduke32/source/jaudiolib/src/driver_coreaudio.c delete mode 100644 polymer/eduke32/source/jaudiolib/src/driver_coreaudio.h diff --git a/polymer/eduke32/build/src/kplib.c b/polymer/eduke32/build/src/kplib.c index f65b6bef6..17e6c4428 100644 --- a/polymer/eduke32/build/src/kplib.c +++ b/polymer/eduke32/build/src/kplib.c @@ -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< 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<= 20) && (!(ubuf[1]&0xfe))) + if ((leng >= 19) && (!(ubuf[1]&0xfe))) if ((ubuf[2] < 12) && ((1< - - @@ -644,10 +640,6 @@ - - diff --git a/polymer/eduke32/source/jaudiolib/include/sndcards.h b/polymer/eduke32/source/jaudiolib/include/sndcards.h index 31cd6a858..100f2b416 100644 --- a/polymer/eduke32/source/jaudiolib/include/sndcards.h +++ b/polymer/eduke32/source/jaudiolib/include/sndcards.h @@ -37,7 +37,6 @@ typedef enum { ASS_NoSound, ASS_SDL, - ASS_CoreAudio, ASS_DirectSound, ASS_NumSoundCards, ASS_AutoDetect = -2 diff --git a/polymer/eduke32/source/jaudiolib/jfaudiolib.xcodeproj/project.pbxproj b/polymer/eduke32/source/jaudiolib/jfaudiolib.xcodeproj/project.pbxproj deleted file mode 100644 index 88ded1e65..000000000 --- a/polymer/eduke32/source/jaudiolib/jfaudiolib.xcodeproj/project.pbxproj +++ /dev/null @@ -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 = ""; }; - AB2E9E4E1011E65900DD2F1F /* driver_coreaudio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = driver_coreaudio.c; sourceTree = ""; }; - AB2E9E4F1011E65900DD2F1F /* driver_coreaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = driver_coreaudio.h; sourceTree = ""; }; - AB2E9E521011E65900DD2F1F /* driver_nosound.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = driver_nosound.c; sourceTree = ""; }; - AB2E9E531011E65900DD2F1F /* driver_nosound.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = driver_nosound.h; sourceTree = ""; }; - AB2E9E561011E65900DD2F1F /* drivers.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = drivers.c; sourceTree = ""; }; - AB2E9E571011E65900DD2F1F /* drivers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = drivers.h; sourceTree = ""; }; - AB2E9E581011E65900DD2F1F /* fx_man.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fx_man.c; sourceTree = ""; }; - AB2E9E591011E65900DD2F1F /* linklist.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = linklist.h; sourceTree = ""; }; - AB2E9E5A1011E65900DD2F1F /* ll_man.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ll_man.h; sourceTree = ""; }; - AB2E9E5B1011E65900DD2F1F /* multivoc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = multivoc.c; sourceTree = ""; }; - AB2E9E5C1011E65900DD2F1F /* multivoc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = multivoc.h; sourceTree = ""; }; - AB2E9E5D1011E65900DD2F1F /* pitch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pitch.c; sourceTree = ""; }; - AB2E9E5E1011E65900DD2F1F /* pitch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pitch.h; sourceTree = ""; }; - AB2E9E711011E66100DD2F1F /* fx_man.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fx_man.h; sourceTree = ""; }; - AB2E9E721011E66100DD2F1F /* music.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = music.h; sourceTree = ""; }; - AB2E9E731011E66100DD2F1F /* sndcards.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sndcards.h; sourceTree = ""; }; - AB2EA0821012029200DD2F1F /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = /System/Library/Frameworks/AudioUnit.framework; sourceTree = ""; }; - AB2EA17610121AA900DD2F1F /* mix.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mix.c; sourceTree = ""; }; - AB8C5611101A077700B42306 /* mixst.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mixst.c; sourceTree = ""; }; - AB8C5826101B6B7100B42306 /* ogg.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ogg.framework; path = "third-party/ogg.framework"; sourceTree = ""; }; - AB8C5827101B6B7100B42306 /* vorbis.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = vorbis.framework; path = "third-party/vorbis.framework"; sourceTree = ""; }; - AB8C5867101B6D7500B42306 /* vorbis.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = vorbis.c; sourceTree = ""; }; -/* 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 = ""; - }; - AB2E9E431011E61700DD2F1F /* Products */ = { - isa = PBXGroup; - children = ( - AB2E9E421011E61700DD2F1F /* libjfaudiolib.a */, - ); - name = Products; - sourceTree = ""; - }; - 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 = ""; - }; - AB2E9E481011E63F00DD2F1F /* include */ = { - isa = PBXGroup; - children = ( - AB2E9E711011E66100DD2F1F /* fx_man.h */, - AB2E9E721011E66100DD2F1F /* music.h */, - AB2E9E731011E66100DD2F1F /* sndcards.h */, - ); - path = include; - sourceTree = ""; - }; - AB8C582E101B6B7900B42306 /* Linked frameworks */ = { - isa = PBXGroup; - children = ( - AB2EA0821012029200DD2F1F /* AudioUnit.framework */, - AB8C5827101B6B7100B42306 /* vorbis.framework */, - AB8C5826101B6B7100B42306 /* ogg.framework */, - ); - name = "Linked frameworks"; - sourceTree = ""; - }; -/* 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 */; -} diff --git a/polymer/eduke32/source/jaudiolib/src/driver_coreaudio.c b/polymer/eduke32/source/jaudiolib/src/driver_coreaudio.c deleted file mode 100644 index 6aee6ba24..000000000 --- a/polymer/eduke32/source/jaudiolib/src/driver_coreaudio.c +++ /dev/null @@ -1,339 +0,0 @@ -/* - Copyright (C) 2009 Jonathon Fowler - - 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 -#include -#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); -} diff --git a/polymer/eduke32/source/jaudiolib/src/driver_coreaudio.h b/polymer/eduke32/source/jaudiolib/src/driver_coreaudio.h deleted file mode 100644 index 48df3e352..000000000 --- a/polymer/eduke32/source/jaudiolib/src/driver_coreaudio.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - Copyright (C) 2009 Jonathon Fowler - - 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); \ No newline at end of file diff --git a/polymer/eduke32/source/jaudiolib/src/driver_directsound.c b/polymer/eduke32/source/jaudiolib/src/driver_directsound.c index 9a413564f..ae02367f5 100644 --- a/polymer/eduke32/source/jaudiolib/src/driver_directsound.c +++ b/polymer/eduke32/source/jaudiolib/src/driver_directsound.c @@ -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); } diff --git a/polymer/eduke32/source/jaudiolib/src/driver_directsound.h b/polymer/eduke32/source/jaudiolib/src/driver_directsound.h index 33dfe7d7c..9d7d50737 100644 --- a/polymer/eduke32/source/jaudiolib/src/driver_directsound.h +++ b/polymer/eduke32/source/jaudiolib/src/driver_directsound.h @@ -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); diff --git a/polymer/eduke32/source/jaudiolib/src/driver_nosound.c b/polymer/eduke32/source/jaudiolib/src/driver_nosound.c index 55818c8b2..da66c5943 100644 --- a/polymer/eduke32/source/jaudiolib/src/driver_nosound.c +++ b/polymer/eduke32/source/jaudiolib/src/driver_nosound.c @@ -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) { } diff --git a/polymer/eduke32/source/jaudiolib/src/driver_nosound.h b/polymer/eduke32/source/jaudiolib/src/driver_nosound.h index fcba11bbe..5555cbfc7 100644 --- a/polymer/eduke32/source/jaudiolib/src/driver_nosound.h +++ b/polymer/eduke32/source/jaudiolib/src/driver_nosound.h @@ -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); diff --git a/polymer/eduke32/source/jaudiolib/src/driver_sdl.c b/polymer/eduke32/source/jaudiolib/src/driver_sdl.c index d34c27b47..ef523098c 100644 --- a/polymer/eduke32/source/jaudiolib/src/driver_sdl.c +++ b/polymer/eduke32/source/jaudiolib/src/driver_sdl.c @@ -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) diff --git a/polymer/eduke32/source/jaudiolib/src/driver_sdl.h b/polymer/eduke32/source/jaudiolib/src/driver_sdl.h index 36c04ec2c..9ea19e97d 100644 --- a/polymer/eduke32/source/jaudiolib/src/driver_sdl.h +++ b/polymer/eduke32/source/jaudiolib/src/driver_sdl.h @@ -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); diff --git a/polymer/eduke32/source/jaudiolib/src/drivers.c b/polymer/eduke32/source/jaudiolib/src/drivers.c index a8f394cdb..7b1e645b4 100644 --- a/polymer/eduke32/source/jaudiolib/src/drivers.c +++ b/polymer/eduke32/source/jaudiolib/src/drivers.c @@ -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); } diff --git a/polymer/eduke32/source/jaudiolib/src/drivers.h b/polymer/eduke32/source/jaudiolib/src/drivers.h index 4a25f68cf..bc0bd3b39 100644 --- a/polymer/eduke32/source/jaudiolib/src/drivers.h +++ b/polymer/eduke32/source/jaudiolib/src/drivers.h @@ -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, diff --git a/polymer/eduke32/source/jaudiolib/src/fx_man.c b/polymer/eduke32/source/jaudiolib/src/fx_man.c index c228d72c0..fc16af6e9 100644 --- a/polymer/eduke32/source/jaudiolib/src/fx_man.c +++ b/polymer/eduke32/source/jaudiolib/src/fx_man.c @@ -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; diff --git a/polymer/eduke32/source/jaudiolib/src/multivoc.c b/polymer/eduke32/source/jaudiolib/src/multivoc.c index 9b0a7540d..113f538bf 100644 --- a/polymer/eduke32/source/jaudiolib/src/multivoc.c +++ b/polymer/eduke32/source/jaudiolib/src/multivoc.c @@ -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); diff --git a/polymer/eduke32/source/menus.c b/polymer/eduke32/source/menus.c index 8240e11fb..3c6ccdabb 100644 --- a/polymer/eduke32/source/menus.c +++ b/polymer/eduke32/source/menus.c @@ -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); diff --git a/polymer/eduke32/source/sdlmusic.c b/polymer/eduke32/source/sdlmusic.c index 0786099a8..d08150347 100644 --- a/polymer/eduke32/source/sdlmusic.c +++ b/polymer/eduke32/source/sdlmusic.c @@ -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; } diff --git a/polymer/eduke32/source/sector.c b/polymer/eduke32/source/sector.c index 8d4f445b2..ae3406099 100644 --- a/polymer/eduke32/source/sector.c +++ b/polymer/eduke32/source/sector.c @@ -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; diff --git a/polymer/eduke32/source/sounds.c b/polymer/eduke32/source/sounds.c index b30057c05..d6f929fc5 100644 --- a/polymer/eduke32/source/sounds.c +++ b/polymer/eduke32/source/sounds.c @@ -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; }