From cd8b728ca66fd37484faf68999d7de6ff5aa3ce5 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Wed, 29 Dec 2021 15:24:23 -0800 Subject: [PATCH] Removed plugin --- Cog.xcodeproj/project.pbxproj | 43 - Frameworks/Syntrax-c/Syntrax-c/Info.plist | 28 - Frameworks/Syntrax-c/Syntrax-c/ioutil.h | 6 - Frameworks/Syntrax-c/Syntrax-c/jaytrax.c | 1779 ----------------- Frameworks/Syntrax-c/Syntrax-c/jaytrax.h | 264 --- Frameworks/Syntrax-c/Syntrax-c/jxs.c | 359 ---- Frameworks/Syntrax-c/Syntrax-c/jxs.h | 168 -- Frameworks/Syntrax-c/Syntrax-c/mixcore.c | 213 -- Frameworks/Syntrax-c/Syntrax-c/mixcore.h | 15 - .../Syntrax_c.xcodeproj/project.pbxproj | 334 ---- .../xcshareddata/xcschemes/Syntrax_c.xcscheme | 76 - .../Syntrax/Syntrax.xcodeproj/project.pbxproj | 384 ---- .../xcshareddata/xcschemes/Syntrax.xcscheme | 76 - Plugins/Syntrax/Syntrax/Info.plist | 28 - Plugins/Syntrax/Syntrax/jxsContainer.h | 17 - Plugins/Syntrax/Syntrax/jxsContainer.m | 85 - Plugins/Syntrax/Syntrax/jxsDecoder.h | 25 - Plugins/Syntrax/Syntrax/jxsDecoder.m | 231 --- Plugins/Syntrax/Syntrax/jxsMetadataReader.h | 17 - Plugins/Syntrax/Syntrax/jxsMetadataReader.m | 99 - 20 files changed, 4247 deletions(-) delete mode 100644 Frameworks/Syntrax-c/Syntrax-c/Info.plist delete mode 100644 Frameworks/Syntrax-c/Syntrax-c/ioutil.h delete mode 100644 Frameworks/Syntrax-c/Syntrax-c/jaytrax.c delete mode 100644 Frameworks/Syntrax-c/Syntrax-c/jaytrax.h delete mode 100644 Frameworks/Syntrax-c/Syntrax-c/jxs.c delete mode 100644 Frameworks/Syntrax-c/Syntrax-c/jxs.h delete mode 100644 Frameworks/Syntrax-c/Syntrax-c/mixcore.c delete mode 100644 Frameworks/Syntrax-c/Syntrax-c/mixcore.h delete mode 100644 Frameworks/Syntrax-c/Syntrax_c.xcodeproj/project.pbxproj delete mode 100644 Frameworks/Syntrax-c/Syntrax_c.xcodeproj/xcshareddata/xcschemes/Syntrax_c.xcscheme delete mode 100644 Plugins/Syntrax/Syntrax.xcodeproj/project.pbxproj delete mode 100644 Plugins/Syntrax/Syntrax.xcodeproj/xcshareddata/xcschemes/Syntrax.xcscheme delete mode 100644 Plugins/Syntrax/Syntrax/Info.plist delete mode 100755 Plugins/Syntrax/Syntrax/jxsContainer.h delete mode 100755 Plugins/Syntrax/Syntrax/jxsContainer.m delete mode 100755 Plugins/Syntrax/Syntrax/jxsDecoder.h delete mode 100755 Plugins/Syntrax/Syntrax/jxsDecoder.m delete mode 100644 Plugins/Syntrax/Syntrax/jxsMetadataReader.h delete mode 100644 Plugins/Syntrax/Syntrax/jxsMetadataReader.m diff --git a/Cog.xcodeproj/project.pbxproj b/Cog.xcodeproj/project.pbxproj index 252323ffd..30b29bebb 100644 --- a/Cog.xcodeproj/project.pbxproj +++ b/Cog.xcodeproj/project.pbxproj @@ -159,7 +159,6 @@ 83D0380F24A40DFB004CF90F /* CogAssets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 83D0380E24A40DF2004CF90F /* CogAssets.xcassets */; }; 83E5E54C18087CA5001F3284 /* miniModeOffTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 83E5E54A18087CA5001F3284 /* miniModeOffTemplate.pdf */; }; 83E5E54D18087CA5001F3284 /* miniModeOnTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 83E5E54B18087CA5001F3284 /* miniModeOnTemplate.pdf */; }; - 83EEAB241C965C56002761C5 /* Syntrax.bundle in CopyFiles */ = {isa = PBXBuildFile; fileRef = 83EEAAFA1C9651D8002761C5 /* Syntrax.bundle */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 83F9D8071A884C54007ABEC2 /* SilenceDecoder.bundle in CopyFiles */ = {isa = PBXBuildFile; fileRef = 83F9D7F61A884B46007ABEC2 /* SilenceDecoder.bundle */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; @@ -528,20 +527,6 @@ remoteGlobalIDString = 8D5B49B6048680CD000E48DA; remoteInfo = "Shorten Plugin"; }; - 83EEAAF91C9651D8002761C5 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83EEAAF51C9651D8002761C5 /* Syntrax.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 832FF2F81C96508E0076D662; - remoteInfo = Syntrax; - }; - 83EEAB251C965C61002761C5 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83EEAAF51C9651D8002761C5 /* Syntrax.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 832FF2F71C96508E0076D662; - remoteInfo = Syntrax; - }; 83F9D7F51A884B46007ABEC2 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 83F9D7F11A884B44007ABEC2 /* SilenceDecoder.xcodeproj */; @@ -649,7 +634,6 @@ 834F7F4520E4E51F00228DAB /* WavPack.bundle in CopyFiles */, 834F7F4420E4E4FA00228DAB /* OpenMPT.bundle in CopyFiles */, 834F7F4320E4E4ED00228DAB /* AdPlug.bundle in CopyFiles */, - 83EEAB241C965C56002761C5 /* Syntrax.bundle in CopyFiles */, 83F9D8071A884C54007ABEC2 /* SilenceDecoder.bundle in CopyFiles */, 836F5BF91A357A01002730CC /* sidplay.bundle in CopyFiles */, 836FB5A718206F2500B3AD2D /* Hively.bundle in CopyFiles */, @@ -927,7 +911,6 @@ 83E5E54A18087CA5001F3284 /* miniModeOffTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; name = miniModeOffTemplate.pdf; path = Images/miniModeOffTemplate.pdf; sourceTree = ""; }; 83E5E54B18087CA5001F3284 /* miniModeOnTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; name = miniModeOnTemplate.pdf; path = Images/miniModeOnTemplate.pdf; sourceTree = ""; }; 83E5EFAC1FFEF78100659F0F /* OpenMPT.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = OpenMPT.xcodeproj; path = Plugins/OpenMPT/OpenMPT.xcodeproj; sourceTree = ""; }; - 83EEAAF51C9651D8002761C5 /* Syntrax.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Syntrax.xcodeproj; path = Plugins/Syntrax/Syntrax.xcodeproj; sourceTree = ""; }; 83F9D7F11A884B44007ABEC2 /* SilenceDecoder.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SilenceDecoder.xcodeproj; path = Plugins/SilenceDecoder/SilenceDecoder.xcodeproj; sourceTree = ""; }; 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; 8E07AB760AAC930B00A4B32F /* PreferencesController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = PreferencesController.h; path = Preferences/PreferencesController.h; sourceTree = ""; }; @@ -1178,7 +1161,6 @@ 17C808A70C3BD1BA005707C4 /* Shorten.xcodeproj */, 8314D63B1A354DFE00EEE8E6 /* sidplay.xcodeproj */, 83F9D7F11A884B44007ABEC2 /* SilenceDecoder.xcodeproj */, - 83EEAAF51C9651D8002761C5 /* Syntrax.xcodeproj */, 17C808B00C3BD1C5005707C4 /* TagLib.xcodeproj */, 836F6B2518BDB80D0095E648 /* vgmstream.xcodeproj */, 17C808B70C3BD1D2005707C4 /* VorbisPlugin.xcodeproj */, @@ -1582,14 +1564,6 @@ name = Products; sourceTree = ""; }; - 83EEAAF61C9651D8002761C5 /* Products */ = { - isa = PBXGroup; - children = ( - 83EEAAFA1C9651D8002761C5 /* Syntrax.bundle */, - ); - name = Products; - sourceTree = ""; - }; 83F9D7F21A884B44007ABEC2 /* Products */ = { isa = PBXGroup; children = ( @@ -1738,7 +1712,6 @@ 834F7F3620E4E4B400228DAB /* PBXTargetDependency */, 834F7F3420E4E4B000228DAB /* PBXTargetDependency */, 834F7F1F20E4E4AA00228DAB /* PBXTargetDependency */, - 83EEAB261C965C61002761C5 /* PBXTargetDependency */, 83F9D8061A884C33007ABEC2 /* PBXTargetDependency */, 836F5BEE1A3579F5002730CC /* PBXTargetDependency */, 836FB5A618206F1500B3AD2D /* PBXTargetDependency */, @@ -1898,10 +1871,6 @@ ProductGroup = 83F9D7F21A884B44007ABEC2 /* Products */; ProjectRef = 83F9D7F11A884B44007ABEC2 /* SilenceDecoder.xcodeproj */; }, - { - ProductGroup = 83EEAAF61C9651D8002761C5 /* Products */; - ProjectRef = 83EEAAF51C9651D8002761C5 /* Syntrax.xcodeproj */; - }, { ProductGroup = 8303A30520E4E3D000951EF8 /* Products */; ProjectRef = 17C808B00C3BD1C5005707C4 /* TagLib.xcodeproj */; @@ -2095,13 +2064,6 @@ remoteRef = 83CA5B0220E4E395003E463A /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 83EEAAFA1C9651D8002761C5 /* Syntrax.bundle */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = Syntrax.bundle; - remoteRef = 83EEAAF91C9651D8002761C5 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; 83F9D7F61A884B46007ABEC2 /* SilenceDecoder.bundle */ = { isa = PBXReferenceProxy; fileType = wrapper.cfbundle; @@ -2448,11 +2410,6 @@ name = "FFMPEG Plugin"; targetProxy = 83BCB8DC17FC96FC00760340 /* PBXContainerItemProxy */; }; - 83EEAB261C965C61002761C5 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = Syntrax; - targetProxy = 83EEAB251C965C61002761C5 /* PBXContainerItemProxy */; - }; 83F9D8061A884C33007ABEC2 /* PBXTargetDependency */ = { isa = PBXTargetDependency; name = SilenceDecoder; diff --git a/Frameworks/Syntrax-c/Syntrax-c/Info.plist b/Frameworks/Syntrax-c/Syntrax-c/Info.plist deleted file mode 100644 index efe595462..000000000 --- a/Frameworks/Syntrax-c/Syntrax-c/Info.plist +++ /dev/null @@ -1,28 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - NSHumanReadableCopyright - Copyright © 2021 Christopher Snowhill. All rights reserved. - NSPrincipalClass - - - diff --git a/Frameworks/Syntrax-c/Syntrax-c/ioutil.h b/Frameworks/Syntrax-c/Syntrax-c/ioutil.h deleted file mode 100644 index 85812d4a6..000000000 --- a/Frameworks/Syntrax-c/Syntrax-c/ioutil.h +++ /dev/null @@ -1,6 +0,0 @@ -enum loadErr { - ERR_OK, - ERR_MALLOC, - ERR_BADSONG, - ERR_FILEIO -}; \ No newline at end of file diff --git a/Frameworks/Syntrax-c/Syntrax-c/jaytrax.c b/Frameworks/Syntrax-c/Syntrax-c/jaytrax.c deleted file mode 100644 index 300327c24..000000000 --- a/Frameworks/Syntrax-c/Syntrax-c/jaytrax.c +++ /dev/null @@ -1,1779 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "jaytrax.h" -#include "mixcore.h" - -#ifndef M_PI -#define M_PI (3.14159265359) -#endif - -int32_t frequencyTable[SE_NROFFINETUNESTEPS][128]; -int16_t sineTab[256]; -uint8_t isStaticInit = 0; - -//void SoundEngine::DeAllocate() - -static void handleEffects(JT1Player* SELF, int32_t channr) { - int32_t f; - for (f=0; fvoices[channr]; - ins = SELF->song->instruments[vc->instrument]; - fx = &ins->fx[f]; - vfx = &vc->fx[f]; - - // increase oscilator - s = (int16_t) fx->oscspd; - vfx->osccnt += s; - vfx->osccnt &= 255; - - switch (fx->effecttype) { - case 0: //none - break; - case 1: { //negate - int32_t dest; - int16_t *dw; - int16_t i,s,c; - dest = fx->dsteffect; - s = (int16_t)fx->effectspd; - c = (int16_t)vfx->fxcnt1; - dw = &vc->waves[256*dest]; - for (i=0; ifxcnt1 = (int32_t)c; - } - break; - case 2: { // warp - int32_t dest; - int16_t *dw; - int16_t i,s,c; - dest = fx->dsteffect; - s = (int16_t) fx->effectspd; - dw = &vc->waves[256*dest]; - c = 0; - for (i=0; i<256; i++) { - dw[i] += c; - c+=s; - } - } - break; - case 3: { // Filter - int32_t dest, src; - int16_t *dw, *sw; - int16_t i, s, t; - dest = fx->dsteffect; - src = fx->srceffect1; - dw = &vc->waves[256*dest]; - sw = &vc->waves[256*src]; - s = (int16_t) fx->effectspd; - if(s>12) s=12; //not more than 12 times...it slowes down too much - for (t=0; t>1; - for (i=1; i<255; i++) { - dw[i] = (sw[i-1] +sw[i+1])>>1; - } - dw[255] = (sw[254] +sw[0])>>1; - } - } - break; - case 4: { // Wavemix - int32_t dest, src1, src2; - int16_t *dw, *sw1, *sw2; - int16_t i, s, c; - dest = fx->dsteffect; - src1 = fx->srceffect1; - src2 = fx->srceffect2; - dw = &vc->waves[256*dest]; - sw1 = &vc->waves[256*src1]; - sw2 = &vc->waves[256*src2]; - s = (int16_t) fx->effectspd; - vfx->fxcnt1 += s; - vfx->fxcnt1 &= 255; - c = (int16_t)vfx->fxcnt1; - for (i=0; i<256; i++) { - dw[i] = (sw1[i] +sw2[c])>>1; - c++; - c&=255; - } - } - break; - case 5: { // Resonance - int32_t dest, src1, src2; - int16_t *dw, *sw1, *sw2; - int16_t i, c; - dest = fx->dsteffect; - src1 = fx->srceffect1; - src2 = fx->osceffect-1; - dw = &vc->waves[256*dest]; - sw1 = &vc->waves[256*src1]; - sw2 = &vc->waves[256*src2]; - - c = (int16_t)vfx->osccnt; - - // init - double centerFreq, bandwidth; - if(fx->osceffect==0) { - centerFreq = (double)(fx->effectvar1*20); - bandwidth = (double)(fx->effectvar2*16); - } else { - if(fx->oscflg) { - centerFreq = (double)(fx->effectvar1*20); - bandwidth = (double)(sw2[c]+32768)/16; - } else { - centerFreq = (double)(sw2[c]+32768)/13; - bandwidth = (double)(fx->effectvar2*16); - } - } - - vfx->b2 = exp(-(2 * M_PI) * (bandwidth / 22000)); - vfx->b1 = (-4.0 * vfx->b2) / (1.0 + vfx->b2) * cos(2 * M_PI * (centerFreq / 22000)); - vfx->a0 = (1.0 - vfx->b2) * sqrt(1.0 - (vfx->b1 * vfx->b1) / (4.0 * vfx->b2)); - - for (i=0; i<256; i++) { - double o; - o = vfx->a0 * ((double)(sw1[i])/32768) - vfx->b1 * vfx->y1 - vfx->b2 * vfx->y2; - - vfx->y2 = vfx->y1; - vfx->y1 = o; - if(o>.9999)o=.9999; - if(o<-.9999)o=-.9999; - dw[i] = (int16_t)(o*32768); - } - } - break; - case 6: { // Reso Whistle - int32_t dest,src1,src2; - int16_t *dw,*sw1,*sw2; - int16_t i,c; - dest = fx->dsteffect; - src1 = fx->srceffect1; - src2 = fx->osceffect-1; - dw = &vc->waves[256*dest]; - sw1 = &vc->waves[256*src1]; - sw2 = &vc->waves[256*src2]; - - c = (int16_t)vfx->osccnt; - - // init - double centerFreq, bandwidth; - - if(fx->osceffect==0) { - centerFreq = (double)(fx->effectvar1*20); - bandwidth = (double)(fx->effectvar2*16); - } else { - if(fx->oscflg) { - centerFreq = (double)(fx->effectvar1*20); - bandwidth = (double)(sw2[c]+32768)/16; - } else { - centerFreq = (double)(sw2[c]+32768)/13; - bandwidth = (double)(fx->effectvar2*16); - } - } - - vfx->b2 = exp(-(2 * M_PI) * (bandwidth / 22000)); - vfx->b1 = (-4.0 * vfx->b2) / (1.0 + vfx->b2) * cos(2 * M_PI * (centerFreq / 22000)); - vfx->a0 = (1.0 - vfx->b2) * sqrt(1.0 - (vfx->b1 * vfx->b1) / (4.0 * vfx->b2)); - - vfx->b2*=1.2; // do the reso whistle - for (i=0; i<256; i++) { - double o; - o = vfx->a0 * ((double)(sw1[i])/32768) - vfx->b1 * vfx->y1 - vfx->b2 * vfx->y2; - - vfx->y2 = vfx->y1; - vfx->y1 = o; - if(o>.9999)o=.9999; - if(o<-.9999)o=-.9999; - dw[i] = (int16_t)(o*32768); - } - } - break; - case 7: { // Morphing - int32_t dest,src1,src2,osc; - int16_t *dw,*sw1,*sw2,*ow; - int16_t i,c; - dest = fx->dsteffect; - src1 = fx->srceffect1; - src2 = fx->srceffect2; - osc = fx->osceffect-1; - dw = &vc->waves[256*dest]; - sw1 = &vc->waves[256*src1]; - sw2 = &vc->waves[256*src2]; - ow = &vc->waves[256*osc]; - - c = (int16_t)vfx->osccnt; - - // init - int16_t m1,m2; - if(fx->osceffect==0) { - m1 = fx->effectvar1; - } else { - if(fx->oscflg) { - m1 = fx->effectvar1; - } else { - m1 = (ow[c]+32768)/256; - } - } - - m2 = 255-m1; - for (i=0; i<256; i++) { - int32_t a; - a=(((int32_t)sw1[i]*m1)/256)+(((int32_t)sw2[i]*m2)/256); - dw[i] = (int16_t)(a); - } - } - break; - case 8: { // Dyna-Morphing - int32_t dest,src1,src2,osc; - int16_t *dw,*sw1,*sw2,*ow,*si; - int16_t i,c; - si = &sineTab[0]; - dest = fx->dsteffect; - src1 = fx->srceffect1; - src2 = fx->srceffect2; - osc = fx->osceffect-1; - dw = &vc->waves[256*dest]; - sw1 = &vc->waves[256*src1]; - sw2 = &vc->waves[256*src2]; - ow = &vc->waves[256*osc]; - - c = (int16_t)vfx->osccnt; - - // init - int16_t m1,m2,sc; //sc is sincnt - if(fx->osceffect==0) { - sc = fx->effectvar1; - } else { - if(fx->oscflg) - { - sc = fx->effectvar1; - } - else - { - sc = (ow[c]+32768)/256; - } - } - - for (i=0; i<256; i++) { - int32_t a; - m1=(si[sc]>>8)+128; - m2 = 255-m1; - a=(((int32_t)sw1[i]*m1)/256)+(((int32_t)sw2[i]*m2)/256); - dw[i] = (int16_t)(a); - sc++; - sc&=255; - } - } - break; - case 9: { // Distortion - int32_t dest,src1,osc; - int16_t *dw,*sw1,*ow; - int16_t i,c; - dest = fx->dsteffect; - src1 = fx->srceffect1; - osc = fx->osceffect-1; - dw = &vc->waves[256*dest]; - sw1 = &vc->waves[256*src1]; - ow = &vc->waves[256*osc]; - - c = (int16_t)vfx->osccnt; - - // init - int16_t m1; - if(fx->osceffect==0) { - m1 = fx->effectvar1; - } else { - if(fx->oscflg) { - m1 = fx->effectvar1; - } else { - m1 = (ow[c]+32768)/256; - } - } - - for (i=0; i<256; i++) { - int32_t a; - a=((int32_t)sw1[i]*m1)/16; - a+=32768; - if(a<0)a=-a; - a%=131072; - if(a>65535) a = 131071-a; - a-=32768; - dw[i] = (int16_t)(a); - } - } - break; - case 10: { // Scroll left - - int32_t dest; - int16_t *dw; - int16_t i,t; - dest = fx->dsteffect; - dw = &vc->waves[256*dest]; - - t=dw[0]; - for (i=0; i<255; i++) { - dw[i] = dw[i+1]; - } - dw[255]=t; - } - break; - case 11: { // Upsample - - int32_t dest; - int16_t *dw; - int16_t i,c; - c = (int16_t)vfx->fxcnt1; - if(c != 0) { // timeout ended? - vfx->fxcnt1--; - break; - } - vfx->fxcnt1 = fx->effectvar1; - dest = fx->dsteffect; - dw = &vc->waves[256*dest]; - - for (i=0; i<128; i++) { - dw[i]=dw[i*2]; - } - memcpy(&dw[128], &dw[0], 256); - } - break; - case 12: { // Clipper - int32_t dest,src1,osc; - int16_t *dw,*sw1,*ow; - int16_t i,c; - dest = fx->dsteffect; - src1 = fx->srceffect1; - osc = fx->osceffect-1; - dw = &vc->waves[256*dest]; - sw1 = &vc->waves[256*src1]; - ow = &vc->waves[256*osc]; - - c = (int16_t)vfx->osccnt; - - // init - int16_t m1; - if(fx->osceffect==0) { - m1 = fx->effectvar1; - } else { - if(fx->oscflg) { - m1 = fx->effectvar1; - } else { - m1 = (ow[c]+32768)/256; - } - } - - for (i=0; i<256; i++) { - int32_t a; - a=((int32_t)sw1[i]*m1)/16; - if(a<-32767)a=-32767; - if(a>32767)a=32767; - dw[i] = (int16_t)(a); - } - } - break; - case 13: { // bandpass - int32_t dest,src1,src2; - int16_t *dw,*sw1,*sw2; - int16_t i,c; - int32_t _2_pi_w0; - int32_t _1000_Q; - - dest = fx->dsteffect; - src1 = fx->srceffect1; - src2 = fx->osceffect-1; - dw = &vc->waves[256*dest]; - sw1 = &vc->waves[256*src1]; - sw2 = &vc->waves[256*src2]; - - c = (int16_t)vfx->osccnt; - - // init - int32_t freq,reso; - if(fx->osceffect==0) { - freq = fx->effectvar1; - reso = fx->effectvar2; - freq*=16; //(freq 0 - 16000hz) - } else { - if(fx->oscflg) { - freq = fx->effectvar1; - reso = (sw2[c]+32768)>>8; - freq*=16; //(freq 0 - 16000hz) - } else { - freq = (sw2[c]+32768)/16; - reso = fx->effectvar2; - } - } - //calc freq; - //double x = freq - 920.0; - //double w0 = 228 + 3900/2*(1 + tanh(_copysign(pow(fabs(x), 0.85)/95, x))); - double w0 = 228+freq; - _2_pi_w0 = (int32_t)(2*M_PI*w0); - - //calc Q - _1000_Q = 707 + 1000*reso/128; - - int32_t _2_pi_w0_delta_t; - int32_t Vhp_next; - int32_t Vbp_next; - int32_t Vlp_next; - int32_t Vbp; - int32_t Vlp; - int32_t Vhp; - int32_t Vi; - int32_t s; - int32_t delta_t; - - Vbp = vfx->Vbp; - Vlp = vfx->Vlp; - Vhp = vfx->Vhp; - delta_t=8; - - // now let's throw our waveform through the resonator! - for (i=0; i<256; i++) { - // delta_t is converted to seconds given a 1MHz clock by dividing - // with 1 000 000. This is done in three operations to avoid integer - // multiplication overflow. - _2_pi_w0_delta_t = _2_pi_w0*delta_t/100; - - // Calculate filter outputs. - Vi=sw1[i]; - Vhp_next = Vbp*1000/_1000_Q - Vlp + Vi; - Vbp_next = Vbp - _2_pi_w0_delta_t*(Vhp/100)/100; - Vlp_next = Vlp - _2_pi_w0_delta_t*(Vbp/100)/100; - Vhp = Vhp_next; - Vbp = Vbp_next; - Vlp = Vlp_next; - - s = Vlp; - if(s>32767)s=32767; - if(s<-32767)s=-32767; - - dw[i] = (int16_t)(s); - } - vfx->Vbp = Vbp; - vfx->Vlp = Vlp; - vfx->Vhp = Vhp; - } - break; - case 14: { // highpass - int32_t dest,src1,src2; - int16_t *dw,*sw1,*sw2; - int16_t i,c; - int32_t _2_pi_w0; - int32_t _1000_Q; - - dest = fx->dsteffect; - src1 = fx->srceffect1; - src2 = fx->osceffect-1; - dw = &vc->waves[256*dest]; - sw1 = &vc->waves[256*src1]; - sw2 = &vc->waves[256*src2]; - - c = (int16_t)vfx->osccnt; - - // init - int32_t freq, reso; - if(fx->osceffect==0) { - freq = fx->effectvar1; - reso = fx->effectvar2; - freq*=32; //(freq 0 - 16000hz) - } else { - if(fx->oscflg) { - freq = fx->effectvar1; - reso = (sw2[c]+32768)>>8; - freq*=32; //(freq 0 - 16000hz) - } else { - freq = (sw2[c]+32768)/8; - reso = fx->effectvar2; - } - } - //calc freq; - //double x = freq - 920.0; - //double w0 = 228 + 3900/2*(1 + tanh(_copysign(pow(fabs(x), 0.85)/95, x))); - double w0 = 228+freq; - _2_pi_w0 = (int32_t)(2*M_PI*w0); - - //calc Q - _1000_Q = 707 + 1000*reso/128; - - int32_t _2_pi_w0_delta_t; - int32_t Vhp_next; - int32_t Vbp_next; - int32_t Vlp_next; - int32_t Vbp; - int32_t Vlp; - int32_t Vhp; - int32_t Vi; - int32_t s; - int32_t delta_t; - - Vbp = vfx->Vbp; - Vlp = vfx->Vlp; - Vhp = vfx->Vhp; - delta_t=8; - - // now let's throw our waveform through the resonator! - for (i=0; i<256; i++) { - // delta_t is converted to seconds given a 1MHz clock by dividing - // with 1 000 000. This is done in three operations to avoid integer - // multiplication overflow. - _2_pi_w0_delta_t = _2_pi_w0*delta_t/100; - - // Calculate filter outputs. - Vi=sw1[i]; - Vhp_next = Vbp*1000/_1000_Q - Vlp + Vi; - Vbp_next = Vbp - _2_pi_w0_delta_t*(Vhp/100)/100; - Vlp_next = Vlp - _2_pi_w0_delta_t*(Vbp/100)/100; - Vhp = Vhp_next; - Vbp = Vbp_next; - Vlp = Vlp_next; - - s = Vhp; - if(s>32767)s=32767; - if(s<-32767)s=-32767; - - dw[i] = (int16_t)(s); - } - vfx->Vbp = Vbp; - vfx->Vlp = Vlp; - vfx->Vhp = Vhp; - } - break; - case 15: { // bandpass - int32_t dest,src1,src2; - int16_t *dw,*sw1,*sw2; - int16_t i,c; - int32_t _2_pi_w0; - int32_t _1000_Q; - - dest = fx->dsteffect; - src1 = fx->srceffect1; - src2 = fx->osceffect-1; - dw = &vc->waves[256*dest]; - sw1 = &vc->waves[256*src1]; - sw2 = &vc->waves[256*src2]; - - c = (int16_t)vfx->osccnt; - - // init - - int32_t freq,reso; - if(fx->osceffect==0) { - freq = fx->effectvar1; - reso = fx->effectvar2; - freq*=16; //(freq 0 - 16000hz) - } else { - if(fx->oscflg) { - freq = fx->effectvar1; - reso = (sw2[c]+32768)>>8; - freq*=16; //(freq 0 - 16000hz) - } else { - freq = (sw2[c]+32768)/16; - reso = fx->effectvar2; - } - } - //calc freq; - //double x = freq - 920.0; - //double w0 = 228 + 3900/2*(1 + tanh(_copysign(pow(fabs(x), 0.85)/95, x))); - double w0 = 228+freq; - _2_pi_w0 = (int32_t)(2*M_PI*w0); - - //calc Q - _1000_Q = 707 + 1000*reso/128; - - int32_t _2_pi_w0_delta_t; - int32_t Vhp_next; - int32_t Vbp_next; - int32_t Vlp_next; - int32_t Vbp; - int32_t Vlp; - int32_t Vhp; - int32_t Vi; - int32_t s; - int32_t delta_t; - - Vbp = vfx->Vbp; - Vlp = vfx->Vlp; - Vhp = vfx->Vhp; - delta_t=8; - - // now let's throw our waveform through the resonator! - for (i=0; i<256; i++) { - // delta_t is converted to seconds given a 1MHz clock by dividing - // with 1 000 000. This is done in three operations to avoid integer - // multiplication overflow. - _2_pi_w0_delta_t = _2_pi_w0*delta_t/100; - - // Calculate filter outputs. - Vi=sw1[i]; - Vhp_next = Vbp*1000/_1000_Q - Vlp + Vi; - Vbp_next = Vbp - _2_pi_w0_delta_t*(Vhp/100)/100; - Vlp_next = Vlp - _2_pi_w0_delta_t*(Vbp/100)/100; - Vhp = Vhp_next; - Vbp = Vbp_next; - Vlp = Vlp_next; - - s = Vbp; - if(s>32767)s=32767; - if(s<-32767)s=-32767; - - dw[i] = (int16_t)(s); - } - vfx->Vbp = Vbp; - vfx->Vlp = Vlp; - vfx->Vhp = Vhp; - } - break; - case 16: { // Noise - - int32_t dest; - int16_t *dw; - int16_t i; - dest = fx->dsteffect; - dw = &vc->waves[256*dest]; - - for (i=0; i<256; i++) { - //TODO: LCG or twin LSFR noise - dw[i]=(rand()*2)-32768; - } - } - break; - case 17: { // Squash - int32_t dest,src1,osc; - int16_t *dw,*sw1,*ow; - int16_t i,c; - dest = fx->dsteffect; - src1 = fx->srceffect1; - osc = fx->osceffect-1; - dw = &vc->waves[256*dest]; - sw1 = &vc->waves[256*src1]; - ow = &vc->waves[256*osc]; - - c = (int16_t)vfx->osccnt; - - // init - uint16_t m1a, m1b, m2; - if(fx->osceffect==0) { - m1a = fx->effectvar1; - m1b = fx->effectvar2; - } else { - if(fx->oscflg) { - m1a = fx->effectvar1; - m1b = (ow[c]+32768)/256; - } else { - m1a = (ow[c]+32768)/256; - m1b = fx->effectvar2; - } - } - - m1b<<=8; - m1a+=m1b; //m1 is now the counter for the squash - m2=0; //m2 is the actual counter which is 256 times too large (fixed point) - for (i=0; i<256; i++) { - int32_t a,b; - b=sw1[m2>>8]; - a=sw1[(m2>>8)+1]; - a*=(m2&255); - b*=(255-(m2&255)); - a=(a>>8)+(b>>8); - dw[i] = a; - m2+=m1a; - } - } - break; - } - } -} - -static void handleInstrument(JT1Player* SELF, int32_t channr) { - JT1Voice* vc; JT1Inst* ins; - int32_t vol, freq, pan; - - vc = &SELF->voices[channr]; - ins = SELF->song->instruments[vc->instrument]; - - //vol - if (ins->amwave == 0) { //volume wave? - vol = 0; - } else { - vc->volcnt += ins->amspd; - if (vc->volcnt >= 256) { - vc->volcnt -= 256; - vc->volcnt += ins->amlooppoint; - if(vc->volcnt >= 256) { - vc->volcnt = ins->amlooppoint; - } - } - - vol = vc->waves[(256*(ins->amwave-1))+vc->volcnt]; - vol = vol+32768; - vol /= 6; - vol = -vol; //10930; - if (vol <-10000) vol = -10000; - } - - //last but not least, the master volume - vol += 10000; - vol *= ins->mastervol; - vol >>=8; - vol *= SELF->masterVolume; //and the replayers master master volume - vol >>=8; - vol -= 10000; - vc->curvol = vol; - //if(vc->buf) vc->buf->SetVolume(vol); - - //update panning - if(ins->panwave == 0) { //panning wave? - pan = 0; - } else { - vc->pancnt += ins->panspd; - if (vc->pancnt >= 256) { - vc->pancnt -= 256; - vc->pancnt += ins->panlooppoint; - if(vc->pancnt >= 256) { - vc->pancnt = ins->panlooppoint; - } - } - - pan = vc->waves[(256*(ins->panwave-1))+vc->pancnt]; - pan >>=7; - } - //if(vc->buf) vc->buf->SetPan(pan); - vc->curpan = pan; - - //update freq - int32_t k; - k = 0; - k = SELF->song->arpTable[(ins->arpeggio*16)+vc->arpcnt]; - vc->arpcnt++; - vc->arpcnt&=15; - - freq = frequencyTable[ins->finetune][k+vc->curnote]; - - if(vc->freqdel) { - vc->freqdel--; - } else { - if(ins->fmwave != 0) { //frequency wave? - vc->freqcnt += ins->fmspd; - if (vc->freqcnt >= 256) { - vc->freqcnt -= 256; - vc->freqcnt += ins->fmlooppoint; - if(vc->freqcnt >= 256) { - vc->freqcnt = ins->fmlooppoint; - } - } - freq -= vc->waves[(256*(ins->fmwave-1))+vc->freqcnt]; - } - } - freq += vc->bendadd; - vc->curfreq = freq; - - //update pitchbend - - if(vc->bendspd != 0) { - if(vc->bendspd >0) { - if(vc->bendadd < vc->destfreq) { - vc->bendadd += vc->bendspd; - if(vc->bendadd > vc->destfreq) { - vc->bendadd = vc->destfreq; - } - } - } else { - if(vc->bendadd > vc->destfreq) { - vc->bendadd += vc->bendspd; - if(vc->bendadd < vc->destfreq) { - vc->bendadd = vc->destfreq; - } - } - } - } -} - -static void playInstrument(JT1Player* SELF, int32_t channr, int32_t instNum, int32_t note) { - JT1Voice* vc; JT1Inst* ins; - int32_t f; - - // instruments init - if(instNum > SELF->song->nrofinst) return; // not allowed! - vc = &SELF->voices[channr]; - if(vc->instrument == -1 && instNum == 0) return; //geen instrument 0 op een gemute channel...er was namelijk geen previous instrument - ins = SELF->song->instruments[instNum-1]; - - vc->arpcnt = 0; - vc->volcnt = 0; - vc->pancnt = 0; - vc->freqcnt = 0; - vc->curnote = note; - vc->curfreq = 0; - vc->bendtonote = note; - vc->bendadd = 0; - vc->destfreq = 0; - vc->bendspd = 0; - - if(instNum) { // do not copy if 0 - int32_t i; - - //TODO: check sample usage - if(!ins->sharing) { // no sample sharing - vc->sampledata = SELF->song->samples[instNum-1]; - } else { - vc->sampledata = SELF->song->samples[ins->sharing-1]; - } - vc->samplepos = ins->startpoint<<8; - vc->looppoint = ins->looppoint<<8; - vc->endpoint = ins->endpoint<<8; - vc->loopflg = ins->loopflg; - vc->bidirecflg = ins->bidirecflg; - - vc->freqdel = ins->fmdelay; - for (i=0; iresetwave[i]) memcpy(&vc->waves[i*256], &ins->waves[i*256], 256 * sizeof(int16_t)); - } - vc->instrument = instNum-1; - } - - // effects init - for (f=0; fsong->instruments[vc->instrument]->fx[f]; - vfx = &vc->fx[f]; - if (fx->effecttype && fx->reseteffect) { - vfx->osccnt = 0; - vfx->fxcnt1 = 0; - vfx->fxcnt2 = 0; - vfx->y2 = 0; - vfx->y1 = 0; - vfx->Vhp = 0; - vfx->Vbp = 0; - vfx->Vlp = 0; - } - } -} - -static void handleSong(JT1Player* SELF) { - int16_t i; - int32_t step; - - if (!SELF->playFlg) return; - if (SELF->pauseFlg) return; - - SELF->patternDelay--; - if (SELF->patternDelay==0) { - step = SELF->playMode == SE_PM_SONG ? SELF->playStep : SELF->patternOffset; - - if ((step&1) == 0) { // change the groove - SELF->playSpeed = 8 - SELF->subsong->groove; - } else { - SELF->playSpeed = 8 + SELF->subsong->groove; - } - SELF->patternDelay = SELF->playSpeed; - - if (SELF->playMode == SE_PM_PATTERN) { - SELF->patternOffset++; - SELF->patternOffset %= SELF->patternLength; - } else { - for (i=0; i < SELF->subsong->nrofchans; i++) { - JT1Voice* vc = &SELF->voices[i]; - - vc->patpos++; - //the ==-1 part is that the song counter always is 1 before the start...so if the song starts at the beginning, the pos is -1 - if (vc->patpos == SELF->subsong->orders[i][vc->songpos].patlen || vc->songpos == -1) { - vc->patpos = 0; - vc->songpos++; - } - } - - SELF->playStep++; - if (SELF->playStep==64) { - SELF->playStep=0; - SELF->playPosition++; - } - - //has endpos been reached? - if (SELF->playPosition == SELF->subsong->endpos && SELF->playStep == SELF->subsong->endstep) { - if (SELF->subsong->songloop) { //does song loop? - int32_t maat, pos, t; - uint8_t isSkipLoop = 0; - - // now me must reset all the playpointers to the loop positions - for (t=0; tsubsong->orders[t]; - JT1Voice* vc = &SELF->voices[t]; - int32_t endpos; - int32_t lastmaat; - - maat = 0; - pos = 0; - lastmaat=0; - - endpos = (SELF->subsong->looppos * 64) + SELF->subsong->loopstep; - while (pos<256) { - if (maat > endpos) { - if (pos != endpos) pos--; - break; - } - lastmaat=maat; - maat+=orders[pos].patlen; - pos++; - } - //oops! starting position too far! - if (pos == 256) { //!WARN: >= 256? - SELF->playFlg = 0; - isSkipLoop = 1; - break; - } - - endpos -= lastmaat; - endpos &= 63; - - vc->songpos = pos; - vc->patpos = endpos; - } - - if (!isSkipLoop) { - SELF->playPosition = SELF->subsong->looppos; - SELF->playStep = SELF->subsong->loopstep; - } - - SELF->loopCnt ++; - } else { // stop song - SELF->playFlg = 0; - SELF->pauseFlg = 0; - SELF->playMode = SE_PM_SONG; - SELF->playPosition = SELF->subsong->songpos; - SELF->playStep = SELF->subsong->songstep; - } - } - } - } -} - -static void handleScript(JT1Player* SELF, int32_t f,int32_t s, int32_t d, int32_t p, int32_t channr) { //note, script,dstnote,param,channr - JT1Voice* vc; JT1Inst* ins; - int32_t a; - - vc = &SELF->voices[channr]; - if(vc->instrument==-1) return; //no change - ins = SELF->song->instruments[vc->instrument]; - - switch(s) { - default: - case 0: - return; - case 1: //pitch bend - if (vc->bendtonote) { //hebben we al eens gebend? - a = frequencyTable[ins->finetune][vc->bendtonote]; // begin frequentie - vc->curnote = vc->bendtonote; - } else { - a = frequencyTable[ins->finetune][f]; // begin freqeuntie - } - vc->bendadd = 0; - vc->destfreq = frequencyTable[ins->finetune][d] - a; - vc->bendspd = p*20; - vc->bendtonote = d; - break; - case 2: //waveform - if (d>15) d = 15; - ins->waveform = d; - break; - case 3: //wavelength - d = (d>192 ? 256 : (d>96 ? 128 : (d>48 ? 64 : 32))); - ins->wavelength = d; - break; - case 4: //mastervol - ins->mastervol = d; - break; - case 5: //amwaveform - if (d>15) d = 15; - ins->amwave = d; - break; - case 6: //amspd - ins->amspd = d; - break; - case 7: //amlooppoint - ins->amlooppoint = d; - break; - case 8: //finetune - if (d>15) d = 15; - ins->finetune = d; - break; - case 9: //fmwaveform - if (d>15) d = 15; - ins->fmwave = d; - break; - case 10: //fmspd - ins->fmspd = d; - break; - case 11: //fmlooppoint - ins->fmlooppoint = d; - break; - case 12: //fmdelay - ins->fmdelay = d; - break; - case 13: //arpeggio - if (d>15) d = 15; - ins->arpeggio = d; - break; - - case 14: //fx 0 fxdstwave - if (d>15) d = 15; - ins->fx[0].dsteffect = d; - break; - case 15: //fx 0 fxsrcwave1 - if (d>15) d = 15; - ins->fx[0].srceffect1 = d; - break; - case 16: //fx 0 fxsrcwave2 - if (d>15) d = 15; - ins->fx[0].srceffect2 = d; - break; - case 17: //fx 0 fxoscwave - if (d>15) d = 15; - ins->fx[0].osceffect = d; - break; - case 18: //fx 0 effectvar1 - ins->fx[0].effectvar1 = d; - break; - case 19: //fx 0 effectvar2 - ins->fx[0].effectvar2 = d; - break; - case 20: //fx 0 effectspd - ins->fx[0].effectspd = d; - break; - case 21: //fx 0 oscspd - ins->fx[0].oscspd = d; - break; - case 22: //fx 0 oscflg - if (d>1) d=1; - ins->fx[0].oscflg = d; - break; - case 23: //fx 0 effecttype - if (d>=SE_NROFEFFECTS) d=SE_NROFEFFECTS-1; - ins->fx[0].effecttype = d; - break; - case 24: //fx 0 reseteffect - if (d>1) d=1; - ins->fx[0].reseteffect = d; - break; - - case 25: //fx 1 fxdstwave - if (d>15) d = 15; - ins->fx[1].dsteffect = d; - break; - case 26: //fx 1 fxsrcwave1 - if (d>15) d = 15; - ins->fx[1].srceffect1 = d; - break; - case 27: //fx 1 fxsrcwave2 - if (d>15) d = 15; - ins->fx[1].srceffect2 = d; - break; - case 28: //fx 1 fxoscwave - if (d>15) d = 15; - ins->fx[1].osceffect = d; - break; - case 29: //fx 1 effectvar1 - ins->fx[1].effectvar1 = d; - break; - case 30: //fx 1 effectvar2 - ins->fx[1].effectvar2 = d; - break; - case 31: //fx 1 effectspd - ins->fx[1].effectspd = d; - break; - case 32: //fx 1 oscspd - ins->fx[1].oscspd = d; - break; - case 33: //fx 1 oscflg - if (d>1) d=1; - ins->fx[1].oscflg = d; - break; - case 34: //fx 1 effecttype - if (d>=SE_NROFEFFECTS) d=SE_NROFEFFECTS-1; - ins->fx[1].effecttype = d; - break; - case 35: //fx 1 reseteffect - if (d>1) d=1; - ins->fx[1].reseteffect = d; - break; - - case 36: //fx 2 fxdstwave - if (d>15) d = 15; - ins->fx[2].dsteffect = d; - break; - case 37: //fx 2 fxsrcwave1 - if (d>15) d = 15; - ins->fx[2].srceffect1 = d; - break; - case 38: //fx 2 fxsrcwave2 - if (d>15) d = 15; - ins->fx[2].srceffect2 = d; - break; - case 39: //fx 2 fxoscwave - if (d>15) d = 15; - ins->fx[2].osceffect = d; - break; - case 40: //fx 2 effectvar1 - ins->fx[2].effectvar1 = d; - break; - case 41: //fx 2 effectvar2 - ins->fx[2].effectvar2 = d; - break; - case 42: //fx 2 effectspd - ins->fx[2].effectspd = d; - break; - case 43: //fx 2 oscspd - ins->fx[2].oscspd = d; - break; - case 44: //fx 2 oscflg - if (d>1) d=1; - ins->fx[2].oscflg = d; - break; - case 45: //fx 2 effecttype - if (d>=SE_NROFEFFECTS) d=SE_NROFEFFECTS-1; - ins->fx[2].effecttype = d; - break; - case 46: //fx 2 reseteffect - if (d>1) d=1; - ins->fx[2].reseteffect = d; - break; - - case 47: //fx 3 fxdstwave - if (d>15) d = 15; - ins->fx[3].dsteffect = d; - break; - case 48: //fx 3 fxsrcwave1 - if (d>15) d = 15; - ins->fx[3].srceffect1 = d; - break; - case 49: //fx 3 fxsrcwave2 - if (d>15) d = 15; - ins->fx[3].srceffect2 = d; - break; - case 50: //fx 3 fxoscwave - if (d>15) d = 15; - ins->fx[3].osceffect = d; - break; - case 51: //fx 3 effectvar1 - ins->fx[3].effectvar1 = d; - break; - case 52: //fx 3 effectvar2 - ins->fx[3].effectvar2 = d; - break; - case 53: //fx 3 effectspd - ins->fx[3].effectspd = d; - break; - case 54: //fx 3 oscspd - ins->fx[3].oscspd = d; - break; - case 55: //fx 3 oscflg - if (d>1) d=1; - ins->fx[3].oscflg = d; - break; - case 56: //fx 3 effecttype - if (d>=SE_NROFEFFECTS) d=SE_NROFEFFECTS-1; - ins->fx[3].effecttype = d; - break; - case 57: //fx 3 reseteffect - if (d>1) d=1; - ins->fx[3].reseteffect = d; - break; - - case 58: //resetwave 00 - if (d>1) d=1; - ins->resetwave[0] = d; - break; - case 59: //resetwave 01 - if (d>1) d=1; - ins->resetwave[1] = d; - break; - case 60: //resetwave 02 - if (d>1) d=1; - ins->resetwave[2] = d; - break; - case 61: //resetwave 03 - if (d>1) d=1; - ins->resetwave[3] = d; - break; - case 62: //resetwave 04 - if (d>1) d=1; - ins->resetwave[4] = d; - break; - case 63: //resetwave 05 - if (d>1) d=1; - ins->resetwave[5] = d; - break; - case 64: //resetwave 06 - if (d>1) d=1; - ins->resetwave[6] = d; - break; - case 65: //resetwave 07 - if (d>1) d=1; - ins->resetwave[7] = d; - break; - case 66: //resetwave 08 - if (d>1) d=1; - ins->resetwave[8] = d; - break; - case 67: //resetwave 09 - if (d>1) d=1; - ins->resetwave[9] = d; - break; - case 68: //resetwave 10 - if (d>1) d=1; - ins->resetwave[10] = d; - break; - case 69: //resetwave 11 - if (d>1) d=1; - ins->resetwave[11] = d; - break; - case 70: //resetwave 12 - if (d>1) d=1; - ins->resetwave[12] = d; - break; - case 71: //resetwave 13 - if (d>1) d=1; - ins->resetwave[13] = d; - break; - case 72: //resetwave 14 - if (d>1) d=1; - ins->resetwave[14] = d; - break; - case 73: //resetwave 15 - if (d>1) d=1; - ins->resetwave[15] = d; - break; - - case 74: //Change bpm - if (d<=10) d=10; - if (d>220) d=220; - SELF->subsong->songspd = d; - - float t; - t = (float)SELF->subsong->songspd; //bpm - t /=60.0; //bps - t *=32.0; - SELF->timeSpd = (int32_t)(44100.0/t); - break; - case 75: //Change Groove - if (d>3) d=3; - SELF->subsong->groove = d; - break; - case 76: //Fire External Event - //TODO: add this effect - break; - } -} - -static void handlePattern(JT1Player* SELF, int32_t channr) { - JT1Voice* vc; JT1Row* row; - int32_t pat,off; - int32_t f,d,s,p; - - if (SELF->pauseFlg) return; - if (!SELF->playFlg) return; - if (SELF->patternDelay != SELF->playSpeed) return; - - vc = &SELF->voices[channr]; - - if (SELF->playMode == SE_PM_PATTERN) { - if (channr > 0) return; // just play channel 0 - pat = SELF->currentPattern; - off = SELF->patternOffset; - } else { - if (SELF->subsong->mute[channr]) return; - off = vc->patpos; - pat = SELF->subsong->orders[channr][vc->songpos].patnr; - } - - row = &SELF->song->patterns[(pat*64)+off]; - //init instrument - f = row->srcnote; - if (f) playInstrument(SELF, channr, row->inst, f); - - //handle special effects - s = row->script; - d = row->dstnote; - p = row->param; - handleScript(SELF, f, s, d, p, channr); -} - -static void advanceSong(JT1Player* SELF) { - handleSong(SELF); - for (int i=0; i < SELF->subsong->nrofchans; i++) { - handlePattern(SELF, i); - if(SELF->voices[i].instrument != -1) {// mute? - handleInstrument(SELF, i); //do volume and pitch things - handleEffects(SELF, i); //do instrument effects - } - } -} - -static void PlayPattern(JT1Player* SELF, int PatternNr) { - SELF->playFlg = 1; - SELF->currentPattern = PatternNr; - SELF->patternOffset = 63; - SELF->patternDelay = 1; - SELF->playMode = SE_PM_PATTERN; - SELF->playSpeed = SELF->song->subsongs[0]->songspd - SELF->song->subsongs[0]->groove; -} - -static void clearSoundBuffers(JT1Player* SELF) { - int32_t i,j; - - // clear delaybuffers - memset(SELF->overlapBuffer, 0, WANTEDOVERLAP*2*sizeof(int16_t)); - memset(SELF->leftDelayBuffer, 0, 65536*sizeof(int16_t)); - memset(SELF->rightDelayBuffer, 0, 65536*sizeof(int16_t)); - - //initialize channel data - for (i=0;ivoices[i]; - - vc->songpos = 0; - vc->patpos = 0; - vc->instrument = -1; - vc->volcnt = 0; - vc->arpcnt = 0; - vc->pancnt = 0; - vc->curnote = 0; - vc->curfreq = 0; - vc->bendadd = 0; - vc->destfreq = 0; - vc->bendspd = 0; - vc->freqcnt = 0; - vc->freqdel = 0; - vc->sampledata = NULL; - vc->endpoint = 0; - vc->synthPos = 0; - vc->samplepos = 0; - vc->curvol = 0; - vc->curpan = 0; - vc->bendtonote = 0; - vc->looppoint = 0; - vc->loopflg = 0; - vc->bidirecflg = 0; - - vc->wavePtr = NULL; - vc->waveLength = 0; - vc->freqOffset = 0; - vc->gainMainL = 0; - vc->gainMainR = 0; - vc->gainEchoL = 0; - vc->gainEchoR = 0; - - for(j=0;j<4;j++) { - JT1VoiceEffect* vfx = &vc->fx[j]; - - vfx->fxcnt1 = 0; - vfx->fxcnt2 = 0; - vfx->osccnt = 0; - vfx->a0 = 0; - vfx->b1 = 0; - vfx->b2 = 0; - vfx->y1 = 0; - vfx->y2 = 0; - vfx->Vhp = 0; - vfx->Vbp = 0; - vfx->Vlp = 0; - } - memset(vc->waves, 0, 4096*sizeof(int16_t)); - } -} - -//---------------------API - -int jaytrax_loadSong(JT1Player* SELF, JT1Song* sng) { - SELF->song = sng; - jaytrax_changeSubsong(SELF, 0); - return 1; -} - -// This function ensures that the play routine is called properly and everything is initialized in a good way -void jaytrax_changeSubsong(JT1Player* SELF, int subsongnr) { - int maat, pos, t; - JT1Order* order; - - if (subsongnr > SELF->song->nrofsongs) return; - SELF->subsongNr = subsongnr; - SELF->subsong = SELF->song->subsongs[subsongnr]; - clearSoundBuffers(SELF); - - for(t=0; t < SE_NROFCHANS; t++) { - JT1Voice* vc; - int endpos, lastmaat; - - vc = &SELF->voices[t]; - - maat = pos = lastmaat = 0; - order = SELF->subsong->orders[t]; - endpos = (SELF->subsong->songpos * 64) + SELF->subsong->songstep - 1; //minus 1 because we immediately start with the new note - while (pos<256) { - if (maat >= endpos) { - if(pos != endpos) pos--; - break; - } - lastmaat=maat; - maat+=order[pos].patlen; - pos++; - } - //oops! starting position too far! - if (pos == 256) return; //!WARN: >= 256? - - endpos-=lastmaat; - //endpos-=maat; - endpos &=63; - - vc->songpos = pos; - vc->patpos = endpos; - } - - SELF->patternDelay = 1; - SELF->playFlg = 1; - SELF->pauseFlg = 0; - SELF->loopCnt = 0; - SELF->playSpeed = 8 + SELF->subsong->groove; - //SELF->playSpeed = 8; - - if (SELF->subsong->songspd != 0) { - float t; - t = (float)SELF->subsong->songspd; //bpm - t /= 60.0; //bps - t *= 32.0; - SELF->timeCnt = SELF->timeSpd = (int)(44100.0/t); - } - - if(SELF->subsong->songstep == 0) { - SELF->playPosition = SELF->subsong->songpos - 1; - } else { - SELF->playPosition = SELF->subsong->songpos; - } - SELF->playStep = SELF->subsong->songstep - 1; - SELF->playStep &= 63; -} - -void jaytrax_stopSong(JT1Player* SELF) { - SELF->playFlg = 0; - SELF->pauseFlg = 0; - SELF->playMode = SE_PM_SONG; - if(SELF->song) { - SELF->playPosition = SELF->subsong->songpos; - SELF->playStep = SELF->subsong->songstep; - } -} - -void jaytrax_pauseSong(JT1Player* SELF) { - SELF->pauseFlg = 1; -} - -void jaytrax_continueSong(JT1Player* SELF) { - SELF->pauseFlg = 0; -} - -JT1Player* jaytrax_init(void) { - JT1Player* SELF = calloc(1, sizeof(JT1Player)); - //lazy static init - if (!isStaticInit) { - int32_t i, j; - double f,y; - //freq and finetune table - y=2; - for (j=0;joverlapCnt = 0; - - SELF->playPosition = 0; // waar is de song nu? - SELF->playStep = 0; - SELF->subsongNr = 0; - SELF->playFlg = 0; - SELF->pauseFlg = 0; - SELF->loopCnt = 0; - - SELF->patternDelay = 0; - SELF->playSpeed = 0; - SELF->masterVolume = 256; - SELF->playMode = SE_PM_SONG; - jaymix_setInterp(&SELF->itp, ITP_CUBIC); - SELF->song = NULL; - SELF->subsong = NULL; - - //initialize rendering counters and speed - SELF->timeCnt = 2200; - SELF->timeSpd = 2200; - - clearSoundBuffers(SELF); - SELF->delayCnt=0; - return SELF; -} - -void jaytrax_free(JT1Player* SELF) { - free(SELF); -} - -void jaytrax_setInterpolation(JT1Player* SELF, uint8_t id) { - jaymix_setInterp(&SELF->itp, id); -} - -void jaytrax_renderChunk(JT1Player* SELF, int16_t* outbuf, int32_t nrofsamples, int32_t frequency) { - int16_t ic, is; - int32_t r; - int16_t amplification; // amount to amplify afterwards - uint16_t echodelaytime; //delaytime for echo (differs for MIDI or songplayback) - int16_t chanNr; - // we calc nrofsamples samples in blocks of 'timeCnt' big (de songspd) - - r = 0; - echodelaytime = amplification = 0; - while (nrofsamples > 0) { - int32_t availOvlap, frameLen; - int16_t nos; - - frameLen = (SELF->timeSpd * frequency) / 44100; - availOvlap = MIN(WANTEDOVERLAP, frameLen); - if (SELF->timeCnttimeCnt; //Complete block - SELF->timeCnt = frameLen; - } else { - nos = nrofsamples; //Last piece - SELF->timeCnt = SELF->timeCnt - nos; - } - nrofsamples-=nos; - - if (!outbuf) { - //times two for stereo - r += (nos*2); - } else { - if (!SELF->song || !SELF->subsong || SELF->subsong->nrofchans == 0) { - for(is=0; is < nos; is++) { //clean renderbuffer - outbuf[r++] = 0; - outbuf[r++] = 0; - } - } else { - chanNr = SELF->subsong->nrofchans; - - //preparation of wave pointers and freq offset - for(ic=0; ic < chanNr; ic++) { - JT1Voice* vc; - int16_t instnr; - int16_t volMain, volEcho; - - vc = &SELF->voices[ic]; - instnr = vc->instrument; - if (instnr == -1) { // mute? - vc->wavePtr = NULL; - } else { - if(vc->sampledata) { - vc->wavePtr = (int16_t*)vc->sampledata; - } else { - JT1Inst* inst = SELF->song->instruments[instnr]; - vc->wavePtr = &vc->waves[256*inst->waveform]; - vc->waveLength = ((inst->wavelength-1)<<8)+255; //fixed point 8 bit (last 8 bits should be set) - } - } - - //calculate frequency - if (vc->curfreq < 10) vc->curfreq = 10; - vc->freqOffset = (256*vc->curfreq)/frequency * (vc->freqOffset<0 ? -1 : 1); - - if (vc->curpan == 0) { //panning? - vc->gainMainL = 256; //center - vc->gainMainR = 256; - } else { - if (vc->curpan > 0) { - vc->gainMainL = 256-(vc->curpan); - vc->gainMainR = 256; - } else { - vc->gainMainL = 256; - vc->gainMainR = 256+(vc->curpan); - } - } - - //gains - volMain = (vc->curvol+10000)/39; - if (volMain > 256) volMain = 256; - volEcho = SELF->subsong->delayamount[ic]; - - //premultiply volumes - vc->gainMainL = (vc->gainMainL * volMain)>>8; - vc->gainMainR = (vc->gainMainR * volMain)>>8; - vc->gainEchoL = (vc->gainMainL * volEcho)>>8; - vc->gainEchoR = (vc->gainMainR * volEcho)>>8; - } - amplification = SELF->subsong->amplification; - echodelaytime = SELF->subsong->delaytime; - - //main render - while (nos > 0) { - int16_t morenos = MIN(nos, MIXBUF_LEN); - int16_t* overBuf = &SELF->overlapBuffer[0]; - int16_t* delLBuf = &SELF->leftDelayBuffer[0]; - int16_t* delRBuf = &SELF->rightDelayBuffer[0]; - int32_t* tempBuf = &SELF->tempBuf[0]; - - - jaymix_mixCore(SELF, morenos); - - for(is=0; is < morenos; is++) { - int32_t lsample, rsample, echosamplel, echosampler; - int32_t off = MIXBUF_NR * is; - int32_t ocnt = SELF->overlapCnt; - int32_t delcnt = SELF->delayCnt; - - lsample = tempBuf[off + BUF_MAINL]; - rsample = tempBuf[off + BUF_MAINR]; - echosamplel = tempBuf[off + BUF_ECHOL]; - echosampler = tempBuf[off + BUF_ECHOR]; - - lsample = ((lsample / chanNr) + delLBuf[delcnt]) / 2; - lsample *= amplification; - lsample /= 100; - CLAMP(lsample, -32760, 32760); - - rsample = ((rsample / chanNr) + delRBuf[delcnt]) / 2; - rsample *= amplification; - rsample /= 100; - CLAMP(rsample, -32760, 32760); - - //interpolate from overlap buffer - if(ocnt < availOvlap) { - int32_t lovlapsamp, rovlapsamp; - lovlapsamp = overBuf[ocnt*2+0]; - rovlapsamp = overBuf[ocnt*2+1]; - lsample = ((lsample * (ocnt)) / availOvlap) + ((lovlapsamp * (availOvlap - ocnt)) / availOvlap); - rsample = ((rsample * (ocnt)) / availOvlap) + ((rovlapsamp * (availOvlap - ocnt)) / availOvlap); - SELF->overlapCnt++; - } - - outbuf[r++] = lsample; - outbuf[r++] = rsample; - - delLBuf[delcnt] = ((echosamplel / chanNr) + delLBuf[delcnt]) / 2; - delRBuf[delcnt] = ((echosampler / chanNr) + delRBuf[delcnt]) / 2; - SELF->delayCnt++; - SELF->delayCnt %= echodelaytime / (44100 / frequency); - } - - nos -= morenos; - } - } - } - - if(SELF->timeCnt == frameLen) { - int32_t tempdelaycnt; - struct { - int32_t synthPos; - int32_t sampPos; - int32_t freqOffset; - } temp[SE_NROFCHANS]; - - tempdelaycnt = SELF->delayCnt; - for(ic=0; ic < SE_NROFCHANS; ic++) { - JT1Voice* vc = &SELF->voices[ic]; - - temp[ic].synthPos = vc->synthPos; - temp[ic].sampPos = vc->samplepos; - temp[ic].freqOffset = vc->freqOffset; - } - - if (outbuf && SELF->song && SELF->subsong && SELF->subsong->nrofchans != 0) { - int16_t nos2 = availOvlap; - chanNr = SELF->subsong->nrofchans; - - //render to overlap buffer - assert(availOvlap - SELF->overlapCnt == 0); - while (nos2 > 0) { - int16_t morenos = MIN(nos2, MIXBUF_LEN); - int16_t* overBuf = &SELF->overlapBuffer[0]; - int16_t* delLBuf = &SELF->leftDelayBuffer[0]; - int16_t* delRBuf = &SELF->rightDelayBuffer[0]; - int32_t* tempBuf = &SELF->tempBuf[0]; - - - jaymix_mixCore(SELF, morenos); - - for(is=0; is < morenos; is++) { - int32_t lsample, rsample; - int32_t off = MIXBUF_NR * is; - int32_t ocnt = SELF->overlapCnt; - int32_t delcnt = SELF->delayCnt; - - lsample = tempBuf[off + BUF_MAINL]; - rsample = tempBuf[off + BUF_MAINR]; - - lsample = ((lsample / chanNr) + delLBuf[delcnt]) / 2; - lsample *= amplification; - lsample /= 100; - CLAMP(lsample, -32760, 32760); - - rsample = ((rsample / chanNr) + delRBuf[delcnt]) / 2; - rsample *= amplification; - rsample /= 100; - CLAMP(rsample, -32760, 32760); - - overBuf[(availOvlap - ocnt)*2+0] = lsample; - overBuf[(availOvlap - ocnt)*2+1] = rsample; - - SELF->delayCnt++; - SELF->delayCnt %= echodelaytime / (44100 / frequency); - SELF->overlapCnt--; - } - nos2 -= morenos; - } - assert(SELF->overlapCnt == 0); - } - - SELF->delayCnt = tempdelaycnt; - - for(ic=0; ic < SE_NROFCHANS; ic++) { - JT1Voice* vc = &SELF->voices[ic]; - - vc->synthPos = temp[ic].synthPos; - vc->samplepos = temp[ic].sampPos; - vc->freqOffset = temp[ic].freqOffset; - } - - //Update song pointers - advanceSong(SELF); - } - } -} - -int32_t jaytrax_getLength(JT1Player* SELF, int subsongnr, int loopCnt, int frequency) { - int32_t length = 0; - int32_t lengthMax = frequency * 60 * 30; - int32_t frameLen; - jaytrax_changeSubsong(SELF, subsongnr); - while (SELF->playFlg && SELF->loopCnt < loopCnt && length < lengthMax) { - frameLen = (SELF->timeSpd * frequency) / 44100; - advanceSong(SELF); - length += frameLen; - } - return length < lengthMax ? length : -1; -} diff --git a/Frameworks/Syntrax-c/Syntrax-c/jaytrax.h b/Frameworks/Syntrax-c/Syntrax-c/jaytrax.h deleted file mode 100644 index 9418d751b..000000000 --- a/Frameworks/Syntrax-c/Syntrax-c/jaytrax.h +++ /dev/null @@ -1,264 +0,0 @@ -#ifndef JAYTRAX_H -#define JAYTRAX_H - -#define WANTEDOVERLAP (15) //wanted declick overlap length(in samples). Will be smaller than a song tick. -#define MIXBUF_LEN (512) //temporary mixing buffer length -#define SAMPSPOOLSIZE (0xFFF) //buffer for unrolling samples - -enum INTERP_LIST { - ITP_NONE, - ITP_NEAREST, - ITP_LINEAR, - ITP_QUADRATIC, - ITP_CUBIC, - //ITP_BLEP, - INTERP_COUNT -}; - -enum SE_BUFTYPE { - BUF_MAINL, - BUF_MAINR, - BUF_ECHOL, - BUF_ECHOR, - MIXBUF_NR -}; - -enum SE_PLAYMODE { - SE_PM_SONG = 0, - SE_PM_PATTERN -}; - -//in case of changing any of the below -//please change jxs loader to account for changes -#define SE_ORDERS_SUBSONG (256) -#define SE_ROWS_PAT (64) -#define SE_EFF_INST (4) -#define SE_WAVES_INST (16) -#define SE_SAMPS_WAVE (256) -#define SE_ARPS_SONG (16) -#define SE_STEPS_ARP (16) -#define SE_NAMELEN (32) - -#define SE_NROFCHANS (16) // number of chans replayer can take -#define SE_NROFFINETUNESTEPS (16) // number of finetune scales -#define SE_NROFEFFECTS (18) // number of available wave effects - -typedef struct JT1Order JT1Order; -struct JT1Order { - int16_t patnr; // welk pattern spelen... - int16_t patlen; // 0/16/32/48 -}; - -typedef struct JT1Row JT1Row; -struct JT1Row { - uint8_t srcnote; - uint8_t dstnote; - uint8_t inst; - int8_t param; - uint8_t script; -}; - -typedef struct JT1Subsong JT1Subsong; -struct JT1Subsong { - uint8_t mute[SE_NROFCHANS]; // which channels are muted? (1=muted) - int32_t songspd; // delay tussen de pattern-stepjes - int32_t groove; // groove value... 0=nothing, 1 = swing, 2=shuffle - int32_t songpos; // waar start song? (welke maat?) - int32_t songstep; // welke patternpos offset? (1/64 van maat) - int32_t endpos; // waar stopt song? (welke maat?) - int32_t endstep; // welke patternpos offset? (1/64 van maat) - int32_t looppos; // waar looped song? (welke maat?) - int32_t loopstep; // welke patternpos offset? (1/64 van maat) - int16_t songloop; // if true, the song loops inbetween looppos and endpos - char name[SE_NAMELEN]; // name of subsong - int16_t nrofchans; //nr of channels used - uint16_t delaytime; // the delaytime (for the echo effect) - uint8_t delayamount[SE_NROFCHANS]; // amount per channel for the echo-effect - int16_t amplification; //extra amplification factor (20 to 1000) - JT1Order orders[SE_NROFCHANS][SE_ORDERS_SUBSONG]; -}; - -typedef struct JT1Effect JT1Effect; -struct JT1Effect { - int32_t dsteffect; - int32_t srceffect1; - int32_t srceffect2; - int32_t osceffect; - int32_t effectvar1; - int32_t effectvar2; - int32_t effectspd; - int32_t oscspd; - int32_t effecttype; - int8_t oscflg; - int8_t reseteffect; -}; - -// inst is the structure which has the entire instrument definition. -typedef struct JT1Inst JT1Inst; -struct JT1Inst { - int16_t mugiversion; - char instname[SE_NAMELEN]; - int16_t waveform; - int16_t wavelength; - int16_t mastervol; - int16_t amwave; - int16_t amspd; - int16_t amlooppoint; - int16_t finetune; - int16_t fmwave; - int16_t fmspd; - int16_t fmlooppoint; - int16_t fmdelay; - int16_t arpeggio; - int8_t resetwave[SE_WAVES_INST]; - int16_t panwave; - int16_t panspd; - int16_t panlooppoint; - JT1Effect fx[SE_EFF_INST]; - char samplename[SE_NAMELEN]; - //ugly. Move samples into their own spot - int16_t sharing; // sample sharing! sharing contains instr nr of shared sanpledata (0=no sharing) - int16_t loopflg; //does the sample loop or play one/shot? (0=1shot) - int16_t bidirecflg; // does the sample loop birdirectional? (0=no) - int32_t startpoint; - int32_t looppoint; - int32_t endpoint; - uint8_t hasSampData; // pointer naar de sample (mag 0 zijn) - int32_t samplelength; // length of sample - int16_t waves[SE_WAVES_INST * SE_SAMPS_WAVE]; -}; - -typedef struct JT1Song JT1Song; -struct JT1Song { - int16_t mugiversion;//version of mugician this song was saved with - int32_t nrofpats; //aantal patterns beschikbaar - int32_t nrofsongs; //aantal beschikbare subsongs - int32_t nrofinst; //aantal gebruikte instruments - - JT1Subsong** subsongs; - JT1Row* patterns; - char** patNames; - JT1Inst** instruments; - uint8_t** samples; - int8_t arpTable[SE_ARPS_SONG * SE_STEPS_ARP]; - -}; - -//---------------------internal structs - -// Chanfx is an internal structure which keeps track of the current effect parameters per active channel -typedef struct JT1VoiceEffect JT1VoiceEffect; -struct JT1VoiceEffect { - int fxcnt1; - int fxcnt2; - int osccnt; - double a0; - double b1; - double b2; - double y1; - double y2; - int Vhp; - int Vbp; - int Vlp; -}; - -// chandat is an internal structure which keeps track of the current instruemnts current variables per active channel -typedef struct JT1Voice JT1Voice; -struct JT1Voice { - int32_t songpos; - int32_t patpos; - int32_t instrument; - int32_t volcnt; - int32_t pancnt; - int32_t arpcnt; - int32_t curnote; - int32_t curfreq; - int32_t curvol; - int32_t curpan; - int32_t bendadd; // for the pitchbend - int32_t destfreq; // ... - int32_t bendspd; // ... - int32_t bendtonote; - int32_t freqcnt; - int32_t freqdel; - uint8_t* sampledata; - int32_t looppoint; - int32_t endpoint; - uint8_t loopflg; - uint8_t bidirecflg; - int32_t synthPos; - int32_t samplepos; - - //immediate render vars - int16_t* wavePtr; - int32_t waveLength; - int32_t freqOffset; - int16_t gainMainL; - int16_t gainMainR; - int16_t gainEchoL; - int16_t gainEchoR; - - JT1VoiceEffect fx[SE_WAVES_INST]; - int16_t waves[SE_WAVES_INST * SE_SAMPS_WAVE]; -}; - -typedef struct Interpolator Interpolator; -struct Interpolator { - uint8_t id; - int16_t numTaps; - int32_t (*fItp) (int16_t* buf, int32_t pos, int32_t sizeMask); - char name[32]; -}; - -typedef struct JT1Player JT1Player; -struct JT1Player { - JT1Song* song; - JT1Subsong* subsong; - JT1Voice voices[SE_NROFCHANS]; - int32_t subsongNr; - int16_t timeCnt; // Samplecounter which stores the njumber of samples before the next songparams are calculated (is reinited with timeSpd) - int16_t timeSpd; // Sample accurate counter which indicates every how many samples the song should progress 1 tick. Is dependant on rendering frequency and BPM - uint8_t playFlg; // 0 if playback is stopped, 1 if song is being played - uint8_t pauseFlg; // 0 if playback is not paused, 1 if playback is paused - int32_t playSpeed; // Actual delay in between notes - int32_t patternDelay; // Current delay in between notes (resets with playSpeed) - int32_t playPosition; // Current position in song (coarse) - int32_t playStep; // Current position in song (fine) - int32_t masterVolume; // Mastervolume of the replayer (256=max - 0=min) - int16_t leftDelayBuffer[65536]; // buffer to simulate an echo on the left stereo channel - int16_t rightDelayBuffer[65536]; // buffer to simulate an echo on the right stereo channel - int16_t overlapBuffer[WANTEDOVERLAP*2]; // Buffer which stores overlap between waveforms to avoid clicks - int16_t overlapCnt; // Used to store how much overlap we have already rendered - uint16_t delayCnt; // Internal counter used for delay - int32_t tempBuf[MIXBUF_LEN * MIXBUF_NR]; - Interpolator* itp; - - int32_t playMode; // in which mode is the replayer? Song or patternmode? - int32_t currentPattern; // Which pattern are we currently playing (In pattern play mode) - int32_t patternLength; // Current length of a pattern (in pattern play mode) - int32_t patternOffset; // Current play offset in the pattern (used for display) - - int32_t loopCnt; // If song is meant to loop, the number of times the song has looped -}; - -//---------------------API - -#ifdef __cplusplus -extern "C" { -#endif - -int jaytrax_loadSong(JT1Player* SELF, JT1Song* sng); -void jaytrax_changeSubsong(JT1Player* SELF, int subsongnr); -void jaytrax_stopSong(JT1Player* SELF); -void jaytrax_pauseSong(JT1Player* SELF); -void jaytrax_continueSong(JT1Player* SELF); -void jaytrax_setInterpolation(JT1Player* SELF, uint8_t id); -JT1Player* jaytrax_init(void); -void jaytrax_free(JT1Player* SELF); -void jaytrax_renderChunk(JT1Player* SELF, int16_t* renderbuf, int32_t nrofsamples, int32_t frequency); -int32_t jaytrax_getLength(JT1Player* SELF, int subsongnr, int loopCnt, int frequency); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/Frameworks/Syntrax-c/Syntrax-c/jxs.c b/Frameworks/Syntrax-c/Syntrax-c/jxs.c deleted file mode 100644 index c69c83736..000000000 --- a/Frameworks/Syntrax-c/Syntrax-c/jxs.c +++ /dev/null @@ -1,359 +0,0 @@ -#include -#include -#include -#include -#include "jaytrax.h" -#include "jxs.h" -#include "ioutil.h" - -struct memdata -{ - const uint8_t* data; - size_t remain; - int error; -}; - -void memread(void* buf, size_t size, size_t count, void* _data) -{ - struct memdata* data = (struct memdata*)_data; - size_t unread = 0; - size *= count; - if (size > data->remain) - { - unread = size - data->remain; - size = data->remain; - data->error = 1; - } - memcpy(buf, data->data, size); - data->data += size; - data->remain -= size; - if (unread) - memset(((uint8_t*)buf) + size, 0, unread); -} - -int memerror(void* _data) -{ - struct memdata* data = (struct memdata*)_data; - return data->error; -} - -void fileread(void* buf, size_t size, size_t count, void* _file) -{ - FILE* file = (FILE*)_file; - fread(buf, size, count, file); -} - -int fileerror(void* _file) -{ - FILE* file = (FILE*)_file; - return ferror(file); -} - -typedef void (*thereader)(void*, size_t, size_t, void*); -typedef int (*theerror)(void*); - -//---------------------JXS3457 - -static int struct_readHeader(JT1Song* dest, thereader reader, theerror iferror, void* fin) { - - f_JT1Header t; - - reader(&t, sizeof(f_JT1Header), 1, fin); - dest->mugiversion = t.mugiversion; - dest->nrofpats = t.nrofpats; - dest->nrofsongs = t.nrofsongs; - dest->nrofinst = t.nrofinst; - return iferror(fin); -} - -static int struct_readSubsong(JT1Subsong* dest, size_t len, thereader reader, theerror iferror, void* fin) { - uint32_t i, j, k; - f_JT1Subsong t; - - for (i=0; i < len; i++) { - reader(&t, sizeof(f_JT1Subsong), 1, fin); - for (j=0; j < J3457_CHANS_SUBSONG; j++) dest[i].mute[j] = t.mute[j]; - dest[i].songspd = t.songspd; - dest[i].groove = t.groove; - dest[i].songpos = t.songpos; - dest[i].songstep = t.songstep; - dest[i].endpos = t.endpos; - dest[i].endstep = t.endstep; - dest[i].looppos = t.looppos; - dest[i].loopstep = t.loopstep; - dest[i].songloop = t.songloop; - memcpy(&dest[i].name, &t.name, 32); - dest[i].nrofchans = t.nrofchans; - dest[i].delaytime = t.delaytime; - for (j=0; j < J3457_CHANS_SUBSONG; j++) { - dest[i].delayamount[j] = t.delayamount[j]; - } - dest[i].amplification = t.amplification; - for (j=0; j < J3457_CHANS_SUBSONG; j++) { - for (k=0; k < J3457_ORDERS_SUBSONG; k++) { - dest[i].orders[j][k].patnr = t.orders[j][k].patnr; - dest[i].orders[j][k].patlen = t.orders[j][k].patlen; - } - } - } - return iferror(fin); -} - -static int struct_readPat(JT1Row* dest, size_t len, thereader reader, theerror iferror, void* fin) { - uint32_t i, j; - f_JT1Row t[J3457_ROWS_PAT]; - - for (i=0; i < len; i++) { - reader(&t, sizeof(f_JT1Row)*J3457_ROWS_PAT, 1, fin); - for (j=0; j < J3457_ROWS_PAT; j++) { - uint32_t off = i*J3457_ROWS_PAT + j; - dest[off].srcnote = t[j].srcnote; - dest[off].dstnote = t[j].dstnote; - dest[off].inst = t[j].inst; - dest[off].param = t[j].param; - dest[off].script = t[j].script; - } - } - return iferror(fin); -} - -static int struct_readInst(JT1Inst* dest, size_t len, thereader reader, theerror iferror, void* fin) { - uint32_t i, j; - f_JT1Inst t; - for (i=0; i < len; i++) { - reader(&t, sizeof(f_JT1Inst), 1, fin); - dest[i].mugiversion = t.mugiversion; - memcpy(&dest[i].instname, &t.instname, 32); - dest[i].waveform = t.waveform; - dest[i].wavelength = t.wavelength; - dest[i].mastervol = t.mastervol; - dest[i].amwave = t.amwave; - dest[i].amspd = t.amspd; - dest[i].amlooppoint = t.amlooppoint; - dest[i].finetune = t.finetune; - dest[i].fmwave = t.fmwave; - dest[i].fmspd = t.fmspd; - dest[i].fmlooppoint = t.fmlooppoint; - dest[i].fmdelay = t.fmdelay; - dest[i].arpeggio = t.arpeggio; - for (j=0; j < J3457_WAVES_INST; j++) { - dest[i].resetwave[j] = t.resetwave[j]; - } - dest[i].panwave = t.panwave; - dest[i].panspd = t.panspd; - dest[i].panlooppoint = t.panlooppoint; - for (j=0; j < J3457_EFF_INST; j++) { - dest[i].fx[j].dsteffect = t.fx[j].dsteffect; - dest[i].fx[j].srceffect1 = t.fx[j].srceffect1; - dest[i].fx[j].srceffect2 = t.fx[j].srceffect2; - dest[i].fx[j].osceffect = t.fx[j].osceffect; - dest[i].fx[j].effectvar1 = t.fx[j].effectvar1; - dest[i].fx[j].effectvar2 = t.fx[j].effectvar2; - dest[i].fx[j].effectspd = t.fx[j].effectspd; - dest[i].fx[j].oscspd = t.fx[j].oscspd; - dest[i].fx[j].effecttype = t.fx[j].effecttype; - dest[i].fx[j].oscflg = t.fx[j].oscflg; - dest[i].fx[j].reseteffect = t.fx[j].reseteffect; - } - memcpy(&dest[i].samplename, &t.samplename, 192); - //exFnameFromPath(&dest[i].samplename, &t.samplename, SE_NAMELEN); - dest[i].sharing = t.sharing; - dest[i].loopflg = t.loopflg; - dest[i].bidirecflg = t.bidirecflg; - dest[i].startpoint = t.startpoint; - dest[i].looppoint = t.looppoint; - dest[i].endpoint = t.endpoint; - dest[i].hasSampData = t.hasSampData ? 1 : 0; //this was a sampdata pointer in original jaytrax - dest[i].samplelength = t.samplelength; - //memcpy(&dest[i].waves, &t.waves, J3457_WAVES_INST * J3457_SAMPS_WAVE * sizeof(int16_t)); - reader(&dest->waves, 2, J3457_WAVES_INST * J3457_SAMPS_WAVE, fin); - } - return iferror(fin); -} - -//---------------------JXS3458 - -/* Soon! */ - -//--------------------- - -static int jxsfile_readSongCb(thereader reader, theerror iferror, void* fin, JT1Song** sngOut) { -#define FAIL(x) {error=(x); goto _ERR;} - JT1Song* song; - int i; - int error; - - //song - if((song = (JT1Song*)calloc(1, sizeof(JT1Song)))) { - int version; - - if (struct_readHeader(song, reader, iferror, fin)) FAIL(ERR_BADSONG); - //version magic - version = song->mugiversion; - if (version >= 3456 && version <= 3457) { - int nrSubsongs = song->nrofsongs; - int nrPats = song->nrofpats; - int nrRows = J3457_ROWS_PAT * nrPats; - int nrInst = song->nrofinst; - - //subsongs - if ((song->subsongs = (JT1Subsong**)calloc(nrSubsongs, sizeof(JT1Subsong*)))) { - for (i=0; i < nrSubsongs; i++) { - if ((song->subsongs[i] = (JT1Subsong*)calloc(1, sizeof(JT1Subsong)))) { - if (struct_readSubsong(song->subsongs[i], 1, reader, iferror, fin)) FAIL(ERR_BADSONG); - } else FAIL(ERR_MALLOC); - } - } else FAIL(ERR_MALLOC); - - //patterns - if ((song->patterns = (JT1Row*)calloc(nrRows, sizeof(JT1Row)))) { - if (struct_readPat(song->patterns, nrPats, reader, iferror, fin)) FAIL(ERR_BADSONG); - } else FAIL(ERR_MALLOC); - - //pattern names. Length includes \0 - if ((song->patNames = (char**)calloc(nrPats, sizeof(char*)))) { - for (i=0; i < nrPats; i++) { - int32_t nameLen = 0; - - reader(&nameLen, 4, 1, fin); - if ((song->patNames[i] = (char*)calloc(nameLen, sizeof(char)))) { - reader(song->patNames[i], nameLen, 1, fin); - } else FAIL(ERR_MALLOC); - } - - if (iferror(fin)) FAIL(ERR_BADSONG); - } else FAIL(ERR_MALLOC); - - //instruments - if ((song->instruments = (JT1Inst**)calloc(nrInst, sizeof(JT1Inst*)))) { - if (!(song->samples = (uint8_t**)calloc(nrInst, sizeof(uint8_t*)))) FAIL(ERR_MALLOC); - for (i=0; i < nrInst; i++) { - if ((song->instruments[i] = (JT1Inst*)calloc(1, sizeof(JT1Inst)))) { - JT1Inst* inst = song->instruments[i]; - if (struct_readInst(inst, 1, reader, iferror, fin)) FAIL(ERR_BADSONG); - - //patch old instrument to new - if (version == 3456) { - inst->sharing = 0; - inst->loopflg = 0; - inst->bidirecflg = 0; - inst->startpoint = 0; - inst->looppoint = 0; - inst->endpoint = 0; - //silly place to put a pointer - if (inst->hasSampData) { - inst->startpoint=0; - inst->endpoint=(inst->samplelength/2); - inst->looppoint=0; - } - } - - //sample data - if (inst->hasSampData) { - //inst->samplelength is in bytes, not samples - if(!(song->samples[i] = (uint8_t*)calloc(inst->samplelength, sizeof(uint8_t)))) FAIL(ERR_MALLOC); - reader(song->samples[i], 1, inst->samplelength, fin); - if (iferror(fin)) FAIL(ERR_BADSONG); - } else { - song->samples[i] = NULL; - } - } else FAIL(ERR_MALLOC); - } - } else FAIL(ERR_MALLOC); - - //arpeggio table - reader(&song->arpTable, J3457_STEPS_ARP, J3457_ARPS_SONG, fin); - - if (iferror(fin)) FAIL(ERR_BADSONG); - } else if (version == 3458) { - //Soon enough! - FAIL(ERR_BADSONG); - } else FAIL(ERR_BADSONG); - } else FAIL(ERR_MALLOC); - - *sngOut = song; - return ERR_OK; - #undef FAIL - _ERR: - jxsfile_freeSong(song); - *sngOut = NULL; - return error; -} - -int jxsfile_readSong(const char* path, JT1Song** sngOut) { - char buf[BUFSIZ]; - FILE *fin; - int error; - - if (!(fin = fopen(path, "rb"))) return ERR_FILEIO; - setbuf(fin, buf); - - error = jxsfile_readSongCb(fileread, fileerror, fin, sngOut); - - fclose(fin); - return error; - - _ERR: - if (fin) fclose(fin); - return error; -} - -int jxsfile_readSongMem(const uint8_t* data, size_t size, JT1Song** sngOut) { - struct memdata fin; - fin.data = data; - fin.remain = size; - fin.error = 0; - - return jxsfile_readSongCb(memread, memerror, &fin, sngOut); -} - -void jxsfile_freeSong(JT1Song* song) { - if (song) { - int i; - int nrSubsongs = song->nrofsongs; - int nrPats = song->nrofpats; - int nrInst = song->nrofinst; - - if (song->subsongs) { - - for (i=0; i < nrSubsongs; i++) { - if (song->subsongs[i]) - free(song->subsongs[i]); - } - - free(song->subsongs); - } - - if (song->patterns) { - free(song->patterns); - } - - if (song->patNames) { - for (i=0; i < nrPats; i++) { - if (song->patNames[i]) - free(song->patNames[i]); - } - - free(song->patNames); - } - - if (song->instruments && song->samples) { - for (i=0; i < nrInst; i++) { - if (song->instruments[i]) - free(song->instruments[i]); - if (song->samples[i]) - free(song->samples[i]); - } - } - - if (song->samples) { - free(song->samples); - } - - if (song->instruments) { - free(song->instruments); - } - - free(song); - } -} diff --git a/Frameworks/Syntrax-c/Syntrax-c/jxs.h b/Frameworks/Syntrax-c/Syntrax-c/jxs.h deleted file mode 100644 index e16cb62ea..000000000 --- a/Frameworks/Syntrax-c/Syntrax-c/jxs.h +++ /dev/null @@ -1,168 +0,0 @@ -#ifndef JXS_H -#define JXS_H -#include -#include "jaytrax.h" - -#define J3457_CHANS_SUBSONG (16) -#define J3457_ORDERS_SUBSONG (256) -#define J3457_ROWS_PAT (64) -#define J3457_EFF_INST (4) -#define J3457_WAVES_INST (16) -#define J3457_SAMPS_WAVE (256) -#define J3457_ARPS_SONG (16) -#define J3457_STEPS_ARP (16) - -typedef struct f_JT1Order f_JT1Order; -struct f_JT1Order { - int16_t patnr; // welk pattern spelen... - int16_t patlen; // 0/16/32/48 -} __attribute__((__packed__)); - -typedef struct f_JT1Row f_JT1Row; -struct f_JT1Row { - uint8_t srcnote; - uint8_t dstnote; - uint8_t inst; - int8_t param; - uint8_t script; -} __attribute__((__packed__)); - -typedef struct f_JT1Header f_JT1Header; -struct f_JT1Header { - int16_t mugiversion;//version of mugician this song was saved with - int16_t PAD00; - int32_t nrofpats; //aantal patterns beschikbaar - int32_t nrofsongs; //aantal beschikbare subsongs - int32_t nrofinst; //aantal gebruikte instruments - int32_t PAD01; - int16_t PAD02; - int16_t PAD03; - int16_t PAD04; - int16_t PAD05; - int16_t PAD06; - int16_t PAD07; - int16_t PAD08; - int16_t PAD09; - int16_t PAD0A; - int16_t PAD0B; - int16_t PAD0C; - int16_t PAD0D; - int16_t PAD0E; - int16_t PAD0F; - int16_t PAD10; - int16_t PAD11; -} __attribute__((__packed__)); - -typedef struct f_JT1Subsong f_JT1Subsong; -struct f_JT1Subsong { - int32_t PAD00[J3457_CHANS_SUBSONG]; - uint8_t mute[J3457_CHANS_SUBSONG]; // which channels are muted? (1=muted) - int32_t songspd; // delay tussen de pattern-stepjes - int32_t groove; // groove value... 0=nothing, 1 = swing, 2=shuffle - int32_t songpos; // waar start song? (welke maat?) - int32_t songstep; // welke patternpos offset? (1/64 van maat) - int32_t endpos; // waar stopt song? (welke maat?) - int32_t endstep; // welke patternpos offset? (1/64 van maat) - int32_t looppos; // waar looped song? (welke maat?) - int32_t loopstep; // welke patternpos offset? (1/64 van maat) - int16_t songloop; // if true, the song loops inbetween looppos and endpos - char name[32]; // name of subsong - int16_t nrofchans; //nr of channels used - uint16_t delaytime; // the delaytime (for the echo effect) - uint8_t delayamount[J3457_CHANS_SUBSONG]; // amount per channel for the echo-effect - int16_t amplification; //extra amplification factor (20 to 1000) - int16_t PAD01; - int16_t PAD02; - int16_t PAD03; - int16_t PAD04; - int16_t PAD05; - int16_t PAD06; - f_JT1Order orders[J3457_CHANS_SUBSONG][J3457_ORDERS_SUBSONG]; -} __attribute__((__packed__)); - -typedef struct f_JT1Effect f_JT1Effect; -struct f_JT1Effect { - int32_t dsteffect; - int32_t srceffect1; - int32_t srceffect2; - int32_t osceffect; - int32_t effectvar1; - int32_t effectvar2; - int32_t effectspd; - int32_t oscspd; - int32_t effecttype; - int8_t oscflg; - int8_t reseteffect; - int16_t PAD00; -} __attribute__((__packed__)); - -// inst is the structure which has the entire instrument definition. -typedef struct f_JT1Inst f_JT1Inst; -struct f_JT1Inst { - int16_t mugiversion; - char instname[32]; - int16_t waveform; - int16_t wavelength; - int16_t mastervol; - int16_t amwave; - int16_t amspd; - int16_t amlooppoint; - int16_t finetune; - int16_t fmwave; - int16_t fmspd; - int16_t fmlooppoint; - int16_t fmdelay; - int16_t arpeggio; - int8_t resetwave[J3457_WAVES_INST]; - int16_t panwave; - int16_t panspd; - int16_t panlooppoint; - int16_t PAD00; - int16_t PAD01; - int16_t PAD02; - int16_t PAD03; - int16_t PAD04; - int16_t PAD05; - f_JT1Effect fx[J3457_EFF_INST]; - char samplename[192]; // path naar de gebruikte sample (was _MAX_PATH lang... is nu getruncate naar 192)(in de toekomst nog kleiner?) - int32_t PAD06; - int32_t PAD07; - int32_t PAD08; - int32_t PAD09; - int32_t PAD0A; - int32_t PAD0B; - int32_t PAD0C; - int32_t PAD0D; - int32_t PAD0E; - int32_t PAD0F; - int32_t PAD10; - int32_t PAD11; - int16_t PAD12; - int16_t sharing; // sample sharing! sharing contains instr nr of shared sanpledata (0=no sharing) - int16_t loopflg; //does the sample loop or play one/shot? (0=1shot) - int16_t bidirecflg; // does the sample loop birdirectional? (0=no) - int32_t startpoint; - int32_t looppoint; - int32_t endpoint; - int32_t hasSampData; // pointer naar de sample (mag 0 zijn) - int32_t samplelength; // length of sample - //int16_t waves[J3457_WAVES_INST * J3457_SAMPS_WAVE]; -} __attribute__((__packed__)); - -//---------------------JXS3458 - - -//--------------------- - -#ifdef __cplusplus -extern "C" { -#endif - -int jxsfile_readSong(const char* path, JT1Song** sngOut); -int jxsfile_readSongMem(const uint8_t* data, size_t size, JT1Song** sngOut); -void jxsfile_freeSong(JT1Song* song); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/Frameworks/Syntrax-c/Syntrax-c/mixcore.c b/Frameworks/Syntrax-c/Syntrax-c/mixcore.c deleted file mode 100644 index 331cf6788..000000000 --- a/Frameworks/Syntrax-c/Syntrax-c/mixcore.c +++ /dev/null @@ -1,213 +0,0 @@ -#include -#include -#include -#include "mixcore.h" -#include "jaytrax.h" - -// ITP_[number of taps]_[input sample width]_[fractional precision]_[readable name] -#define ITP_T02_S16_I08_LINEAR(P, F) (P[0]+(((P[1]-P[0])*F) >> 8)) -#define ITP_T03_S16_I15_QUADRA(P, F) (((((((((P[0] + P[2]) >> 1) - P[1]) * F) >> 16) + P[1]) - ((P[2] + P[0] + (P[0] << 1)) >> 2)) * F) >> 14) + P[0] -#define ITP_T04_S16_I08_CUBIC(P, F) (P[1] + ((F*(P[2] - P[0] + ((F*(2 * P[0] - 5 * P[1] + 4 * P[2] - P[3] + ((F*(3 * (P[1] - P[2]) + P[3] - P[0]) + 0x80) >> 8)) + 0x80) >> 8)) + 0x100) >> 9)) -#define ITP_T04_SXX_F01_CUBIC(P, F) (P[1] + 0.5 * F*(P[2] - P[0] + F*(2.0 * P[0] - 5.0 * P[1] + 4.0 * P[2] - P[3] + F * (3.0 * (P[1] - P[2]) + P[3] - P[0])))) - - -//---------------------interpolators -#define GET_PT(x) buf[((pos + ((x)<<8)) & sizeMask)>>8] - -static int32_t itpNone(int16_t* buf, int32_t pos, int32_t sizeMask) { - return 0;(void)buf;(void)pos;(void)sizeMask; -} - -static int32_t itpNearest(int16_t* buf, int32_t pos, int32_t sizeMask) { - return GET_PT(0); -} - -static int32_t itpLinear(int16_t* buf, int32_t pos, int32_t sizeMask) { - int32_t p[2]; - int32_t frac = pos & 0xFF; - - p[0] = GET_PT(0); - p[1] = GET_PT(1); - - return ITP_T02_S16_I08_LINEAR(p, frac); -} - -static int32_t itpQuad(int16_t* buf, int32_t pos, int32_t sizeMask) { - int32_t p[3]; - int32_t frac = (pos & 0xFF)<<7; - - p[0] = GET_PT(0); - p[1] = GET_PT(1); - p[2] = GET_PT(2); - - return ITP_T03_S16_I15_QUADRA(p, frac); -} - -static int32_t itpCubic(int16_t* buf, int32_t pos, int32_t sizeMask) { - int32_t p[4]; - int32_t frac = pos & 0xFF; - - p[0] = GET_PT(0); - p[1] = GET_PT(1); - p[2] = GET_PT(2); - p[3] = GET_PT(3); - - return ITP_T04_S16_I08_CUBIC(p, frac); -} - -Interpolator interps[INTERP_COUNT] = { - {ITP_NONE, 0, &itpNone, "None"}, - {ITP_NEAREST, 1, &itpNearest, "Nearest"}, - {ITP_LINEAR, 2, &itpLinear, "Linear"}, - {ITP_QUADRATIC, 3, &itpQuad, "Quadratic"}, - {ITP_CUBIC, 4, &itpCubic, "Cubic"}, - //{ITP_BLEP, -1, &mixSynthNearest, &mixSampNearest, "BLEP"} //BLEP needs variable amount of taps -}; - -static void smpCpyFrw(int16_t* destination, const int16_t* source, int32_t num) { - memcpy(destination, source, num * sizeof(int16_t)); -} - -static void smpCpyRev(int16_t* destination, const int16_t* source, int32_t num) { - for (int i=0; i < num; i++) { - destination[i] = source[num-1 - i]; - } -} - -//---------------------API - -uint8_t jaymix_setInterp(Interpolator** out, uint8_t id) { - for (int8_t i=0; itempBuf[0]; - int32_t chanNr = SELF->subsong->nrofchans; - - - assert(numSamples <= MIXBUF_LEN); - memset(&outBuf[0], 0, numSamples * MIXBUF_NR * sizeof(int32_t)); - - - for (ic=0; ic < chanNr; ic++) { - JT1Voice* vc = &SELF->voices[ic]; - int32_t (*fItp) (int16_t* buf, int pos, int sizeMask); - int32_t loopLen = vc->endpoint - vc->looppoint; - - doneSmp = 0; - if (vc->sampledata) { - - if (!vc->wavePtr) continue; - if (vc->samplepos < 0) continue; - fItp = SELF->itp->fItp; - - while (doneSmp < numSamples) { - int16_t tapArr[32] = {0}; - int32_t tapPos = vc->samplepos>>8; - uint8_t tapDir = 0; - - //slow, but better than nothing - //also, not centered - for (int i=0; i < SELF->itp->numTaps; i++) { - tapArr[i] = vc->wavePtr[tapPos]; - - if (tapDir) { //backwards - tapPos--; - - if (tapPos < (vc->looppoint>>8)) { - tapPos += 2; - tapDir = 0; - } - } else { //forwards - tapPos++; - - if (tapPos >= (vc->endpoint>>8)) { - if (vc->loopflg) { //has loop - if(vc->bidirecflg) { //bidi - tapPos -= 2; - tapDir = 1; - } else { //straight - tapPos -= (loopLen>>8); - } - } else { //oneshot - break; - } - } - } - } - - tempBuf[doneSmp++] = fItp(tapArr, vc->samplepos&0xFF, 0xFFFFFFFF); //vc->wavePtr[vc->samplepos>>8]; - vc->samplepos += vc->freqOffset; - - - - if (vc->freqOffset < 0) { //backwards - if (vc->samplepos < vc->looppoint) { - vc->freqOffset *= -1; - vc->samplepos += vc->freqOffset; - } - } else { //forwards - if (vc->samplepos >= vc->endpoint) { - if (vc->loopflg) { //has loop - if(vc->bidirecflg) { //bidi - vc->freqOffset *= -1; - vc->samplepos += vc->freqOffset; - } else { //straight - vc->samplepos -= loopLen; - } - } else { //oneshot - vc->samplepos = -1; - break; - } - } - } - } - } else { //synth render - int32_t nos; - - if (!vc->wavePtr) { - //original replayer plays through an empty wave - vc->synthPos += vc->freqOffset * numSamples; - vc->synthPos &= vc->waveLength; - continue; - } - fItp = SELF->itp->fItp; - - //loop unroll optimization - nos = numSamples; - if (nos&1) { - tempBuf[doneSmp++] = fItp(vc->wavePtr, vc->synthPos, vc->waveLength); - vc->synthPos += vc->freqOffset; - vc->synthPos &= vc->waveLength; - nos--; - } - for(is=0; is < nos; is+=2) { - tempBuf[doneSmp++] = fItp(vc->wavePtr, vc->synthPos, vc->waveLength); - vc->synthPos += vc->freqOffset; - vc->synthPos &= vc->waveLength; - tempBuf[doneSmp++] = fItp(vc->wavePtr, vc->synthPos, vc->waveLength); - vc->synthPos += vc->freqOffset; - vc->synthPos &= vc->waveLength; - } - } - - for(is=0; is < doneSmp; is++) { - int32_t samp, off; - - samp = tempBuf[is]; - off = is * MIXBUF_NR; - outBuf[off + BUF_MAINL] += (samp * vc->gainMainL)>>8; - outBuf[off + BUF_MAINR] += (samp * vc->gainMainR)>>8; - outBuf[off + BUF_ECHOL] += (samp * vc->gainEchoL)>>8; - outBuf[off + BUF_ECHOR] += (samp * vc->gainEchoR)>>8; - } - } -} diff --git a/Frameworks/Syntrax-c/Syntrax-c/mixcore.h b/Frameworks/Syntrax-c/Syntrax-c/mixcore.h deleted file mode 100644 index 912927f66..000000000 --- a/Frameworks/Syntrax-c/Syntrax-c/mixcore.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef MIXCORE_H -#define MIXCORE_H -#include -#include "jaytrax.h" - -#define CLAMP(x, low, high) (x = ((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x))) -//#define CLAMP16(x) if ((int16_t)(x) != x) x = 0x7FFF ^ (x >> 31) //fast 32 -> 16 bit clamp -#define CLAMP16(x) (int16_t)(x) != x ? 0x7FFF ^ (x >> 31) : x //fast 32 -> 16 bit clamp -#define MIN(x, y) (((x) < (y)) ? (x) : (y)) -#define CHKPOS(VC) ((VC->samplepos >= 0) && ((VC->curdirecflg && ((VC->samplepos & 0xFFFFFF00) >= VC->looppoint)) || ((VC->samplepos & 0xFFFFFF00) < VC->endpoint))) - -void jaymix_mixCore(JT1Player* SELF, int32_t numSamples); -uint8_t jaymix_setInterp(Interpolator** out, uint8_t id); - -#endif \ No newline at end of file diff --git a/Frameworks/Syntrax-c/Syntrax_c.xcodeproj/project.pbxproj b/Frameworks/Syntrax-c/Syntrax_c.xcodeproj/project.pbxproj deleted file mode 100644 index e65153acf..000000000 --- a/Frameworks/Syntrax-c/Syntrax_c.xcodeproj/project.pbxproj +++ /dev/null @@ -1,334 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 8398BF3D2769D28A0048F38A /* jaytrax.c in Sources */ = {isa = PBXBuildFile; fileRef = 8398BF3C2769D26D0048F38A /* jaytrax.c */; }; - 8398BF3E2769D28D0048F38A /* jxs.c in Sources */ = {isa = PBXBuildFile; fileRef = 8398BF372769D26D0048F38A /* jxs.c */; }; - 8398BF3F2769D2950048F38A /* mixcore.c in Sources */ = {isa = PBXBuildFile; fileRef = 8398BF392769D26D0048F38A /* mixcore.c */; }; - 8398BF402769D2EE0048F38A /* mixcore.h in Headers */ = {isa = PBXBuildFile; fileRef = 8398BF362769D26D0048F38A /* mixcore.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 8398BF412769D2F50048F38A /* ioutil.h in Headers */ = {isa = PBXBuildFile; fileRef = 8398BF3A2769D26D0048F38A /* ioutil.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 8398BF422769D2F80048F38A /* jaytrax.h in Headers */ = {isa = PBXBuildFile; fileRef = 8398BF382769D26D0048F38A /* jaytrax.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 8398BF432769D2FD0048F38A /* jxs.h in Headers */ = {isa = PBXBuildFile; fileRef = 8398BF3B2769D26D0048F38A /* jxs.h */; settings = {ATTRIBUTES = (Public, ); }; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 832FF31B1C96511E0076D662 /* Syntrax_c.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Syntrax_c.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 832FF3201C96511E0076D662 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 8398BF362769D26D0048F38A /* mixcore.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = mixcore.h; sourceTree = ""; }; - 8398BF372769D26D0048F38A /* jxs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = jxs.c; sourceTree = ""; }; - 8398BF382769D26D0048F38A /* jaytrax.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = jaytrax.h; sourceTree = ""; }; - 8398BF392769D26D0048F38A /* mixcore.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = mixcore.c; sourceTree = ""; }; - 8398BF3A2769D26D0048F38A /* ioutil.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ioutil.h; sourceTree = ""; }; - 8398BF3B2769D26D0048F38A /* jxs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = jxs.h; sourceTree = ""; }; - 8398BF3C2769D26D0048F38A /* jaytrax.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = jaytrax.c; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 832FF3171C96511E0076D662 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 832FF3111C96511E0076D662 = { - isa = PBXGroup; - children = ( - 832FF31D1C96511E0076D662 /* Syntrax-c */, - 832FF31C1C96511E0076D662 /* Products */, - ); - sourceTree = ""; - }; - 832FF31C1C96511E0076D662 /* Products */ = { - isa = PBXGroup; - children = ( - 832FF31B1C96511E0076D662 /* Syntrax_c.framework */, - ); - name = Products; - sourceTree = ""; - }; - 832FF31D1C96511E0076D662 /* Syntrax-c */ = { - isa = PBXGroup; - children = ( - 8398BF3A2769D26D0048F38A /* ioutil.h */, - 8398BF3C2769D26D0048F38A /* jaytrax.c */, - 8398BF382769D26D0048F38A /* jaytrax.h */, - 8398BF372769D26D0048F38A /* jxs.c */, - 8398BF3B2769D26D0048F38A /* jxs.h */, - 8398BF392769D26D0048F38A /* mixcore.c */, - 8398BF362769D26D0048F38A /* mixcore.h */, - 832FF3201C96511E0076D662 /* Info.plist */, - ); - path = "Syntrax-c"; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 832FF3181C96511E0076D662 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 8398BF412769D2F50048F38A /* ioutil.h in Headers */, - 8398BF422769D2F80048F38A /* jaytrax.h in Headers */, - 8398BF432769D2FD0048F38A /* jxs.h in Headers */, - 8398BF402769D2EE0048F38A /* mixcore.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 832FF31A1C96511E0076D662 /* Syntrax_c */ = { - isa = PBXNativeTarget; - buildConfigurationList = 832FF3231C96511E0076D662 /* Build configuration list for PBXNativeTarget "Syntrax_c" */; - buildPhases = ( - 832FF3161C96511E0076D662 /* Sources */, - 832FF3171C96511E0076D662 /* Frameworks */, - 832FF3181C96511E0076D662 /* Headers */, - 832FF3191C96511E0076D662 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = Syntrax_c; - productName = "Syntrax-c"; - productReference = 832FF31B1C96511E0076D662 /* Syntrax_c.framework */; - productType = "com.apple.product-type.framework"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 832FF3121C96511E0076D662 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 1250; - ORGANIZATIONNAME = "Christopher Snowhill"; - TargetAttributes = { - 832FF31A1C96511E0076D662 = { - DevelopmentTeam = ""; - ProvisioningStyle = Automatic; - }; - }; - }; - buildConfigurationList = 832FF3151C96511E0076D662 /* Build configuration list for PBXProject "Syntrax_c" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 832FF3111C96511E0076D662; - productRefGroup = 832FF31C1C96511E0076D662 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 832FF31A1C96511E0076D662 /* Syntrax_c */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 832FF3191C96511E0076D662 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 832FF3161C96511E0076D662 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 8398BF3D2769D28A0048F38A /* jaytrax.c in Sources */, - 8398BF3E2769D28D0048F38A /* jxs.c in Sources */, - 8398BF3F2769D2950048F38A /* mixcore.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 832FF3211C96511E0076D662 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.12; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - 832FF3221C96511E0076D662 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.12; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = macosx; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - 832FF3241C96511E0076D662 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_IDENTITY = ""; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = ""; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - FRAMEWORK_VERSION = A; - INFOPLIST_FILE = "Syntrax-c/Info.plist"; - INSTALL_PATH = "@loader_path/../Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "org.cogx.Syntrax-c"; - PRODUCT_NAME = Syntrax_c; - PROVISIONING_PROFILE_SPECIFIER = ""; - SKIP_INSTALL = YES; - }; - name = Debug; - }; - 832FF3251C96511E0076D662 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_IDENTITY = ""; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = ""; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - FRAMEWORK_VERSION = A; - INFOPLIST_FILE = "Syntrax-c/Info.plist"; - INSTALL_PATH = "@loader_path/../Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "org.cogx.Syntrax-c"; - PRODUCT_NAME = Syntrax_c; - PROVISIONING_PROFILE_SPECIFIER = ""; - SKIP_INSTALL = YES; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 832FF3151C96511E0076D662 /* Build configuration list for PBXProject "Syntrax_c" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 832FF3211C96511E0076D662 /* Debug */, - 832FF3221C96511E0076D662 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 832FF3231C96511E0076D662 /* Build configuration list for PBXNativeTarget "Syntrax_c" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 832FF3241C96511E0076D662 /* Debug */, - 832FF3251C96511E0076D662 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 832FF3121C96511E0076D662 /* Project object */; -} diff --git a/Frameworks/Syntrax-c/Syntrax_c.xcodeproj/xcshareddata/xcschemes/Syntrax_c.xcscheme b/Frameworks/Syntrax-c/Syntrax_c.xcodeproj/xcshareddata/xcschemes/Syntrax_c.xcscheme deleted file mode 100644 index 83de7fcf8..000000000 --- a/Frameworks/Syntrax-c/Syntrax_c.xcodeproj/xcshareddata/xcschemes/Syntrax_c.xcscheme +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Plugins/Syntrax/Syntrax.xcodeproj/project.pbxproj b/Plugins/Syntrax/Syntrax.xcodeproj/project.pbxproj deleted file mode 100644 index befade3ec..000000000 --- a/Plugins/Syntrax/Syntrax.xcodeproj/project.pbxproj +++ /dev/null @@ -1,384 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 8333B6751DCC49FF004C140D /* Syntrax_c.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83EEAB171C96537A002761C5 /* Syntrax_c.framework */; }; - 83EEAB0F1C965324002761C5 /* jxsDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 83EEAB0E1C965324002761C5 /* jxsDecoder.m */; }; - 83EEAB1E1C965835002761C5 /* jxsContainer.m in Sources */ = {isa = PBXBuildFile; fileRef = 83EEAB1D1C965835002761C5 /* jxsContainer.m */; }; - 83EEAB211C965A4F002761C5 /* jxsMetadataReader.m in Sources */ = {isa = PBXBuildFile; fileRef = 83EEAB201C965A4F002761C5 /* jxsMetadataReader.m */; }; - 83EEAB231C965C32002761C5 /* Syntrax_c.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 83EEAB171C96537A002761C5 /* Syntrax_c.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 83EEAB161C96537A002761C5 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83EEAB121C965379002761C5 /* Syntrax_c.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 832FF31B1C96511E0076D662; - remoteInfo = Syntrax_c; - }; - 83EEAB181C965384002761C5 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83EEAB121C965379002761C5 /* Syntrax_c.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 832FF31A1C96511E0076D662; - remoteInfo = Syntrax_c; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 83EEAB221C965C27002761C5 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 10; - files = ( - 83EEAB231C965C32002761C5 /* Syntrax_c.framework in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 832FF2F81C96508E0076D662 /* Syntrax.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Syntrax.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; - 832FF2FB1C96508E0076D662 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 83EEAB0D1C965324002761C5 /* jxsDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jxsDecoder.h; sourceTree = ""; }; - 83EEAB0E1C965324002761C5 /* jxsDecoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = jxsDecoder.m; sourceTree = ""; }; - 83EEAB121C965379002761C5 /* Syntrax_c.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Syntrax_c.xcodeproj; path = "../../Frameworks/Syntrax-c/Syntrax_c.xcodeproj"; sourceTree = ""; }; - 83EEAB1A1C9653AA002761C5 /* Plugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Plugin.h; path = ../../../Audio/Plugin.h; sourceTree = ""; }; - 83EEAB1B1C9653C3002761C5 /* PlaylistController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PlaylistController.h; path = ../../../Playlist/PlaylistController.h; sourceTree = ""; }; - 83EEAB1C1C965835002761C5 /* jxsContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jxsContainer.h; sourceTree = ""; }; - 83EEAB1D1C965835002761C5 /* jxsContainer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = jxsContainer.m; sourceTree = ""; }; - 83EEAB1F1C965A4F002761C5 /* jxsMetadataReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jxsMetadataReader.h; sourceTree = ""; }; - 83EEAB201C965A4F002761C5 /* jxsMetadataReader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = jxsMetadataReader.m; sourceTree = ""; }; - 83EEAB271C965D2E002761C5 /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Logging.h; path = ../../../Utils/Logging.h; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 832FF2F51C96508E0076D662 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 8333B6751DCC49FF004C140D /* Syntrax_c.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 832FF2EF1C96508E0076D662 = { - isa = PBXGroup; - children = ( - 832FF2FA1C96508E0076D662 /* Syntrax */, - 832FF3101C9650E50076D662 /* Frameworks */, - 832FF2F91C96508E0076D662 /* Products */, - ); - sourceTree = ""; - }; - 832FF2F91C96508E0076D662 /* Products */ = { - isa = PBXGroup; - children = ( - 832FF2F81C96508E0076D662 /* Syntrax.bundle */, - ); - name = Products; - sourceTree = ""; - }; - 832FF2FA1C96508E0076D662 /* Syntrax */ = { - isa = PBXGroup; - children = ( - 83EEAB271C965D2E002761C5 /* Logging.h */, - 83EEAB1B1C9653C3002761C5 /* PlaylistController.h */, - 83EEAB1A1C9653AA002761C5 /* Plugin.h */, - 83EEAB1C1C965835002761C5 /* jxsContainer.h */, - 83EEAB1D1C965835002761C5 /* jxsContainer.m */, - 83EEAB0D1C965324002761C5 /* jxsDecoder.h */, - 83EEAB0E1C965324002761C5 /* jxsDecoder.m */, - 83EEAB1F1C965A4F002761C5 /* jxsMetadataReader.h */, - 83EEAB201C965A4F002761C5 /* jxsMetadataReader.m */, - 832FF2FB1C96508E0076D662 /* Info.plist */, - ); - path = Syntrax; - sourceTree = ""; - }; - 832FF3101C9650E50076D662 /* Frameworks */ = { - isa = PBXGroup; - children = ( - 83EEAB121C965379002761C5 /* Syntrax_c.xcodeproj */, - ); - name = Frameworks; - sourceTree = ""; - }; - 83EEAB131C965379002761C5 /* Products */ = { - isa = PBXGroup; - children = ( - 83EEAB171C96537A002761C5 /* Syntrax_c.framework */, - ); - name = Products; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 832FF2F71C96508E0076D662 /* Syntrax */ = { - isa = PBXNativeTarget; - buildConfigurationList = 832FF2FE1C96508E0076D662 /* Build configuration list for PBXNativeTarget "Syntrax" */; - buildPhases = ( - 832FF2F41C96508E0076D662 /* Sources */, - 832FF2F51C96508E0076D662 /* Frameworks */, - 832FF2F61C96508E0076D662 /* Resources */, - 83EEAB221C965C27002761C5 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - 83EEAB191C965384002761C5 /* PBXTargetDependency */, - ); - name = Syntrax; - productName = Syntrax; - productReference = 832FF2F81C96508E0076D662 /* Syntrax.bundle */; - productType = "com.apple.product-type.bundle"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 832FF2F01C96508E0076D662 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 1250; - ORGANIZATIONNAME = "Christopher Snowhill"; - TargetAttributes = { - 832FF2F71C96508E0076D662 = { - DevelopmentTeam = ""; - ProvisioningStyle = Automatic; - }; - }; - }; - buildConfigurationList = 832FF2F31C96508E0076D662 /* Build configuration list for PBXProject "Syntrax" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 832FF2EF1C96508E0076D662; - productRefGroup = 832FF2F91C96508E0076D662 /* Products */; - projectDirPath = ""; - projectReferences = ( - { - ProductGroup = 83EEAB131C965379002761C5 /* Products */; - ProjectRef = 83EEAB121C965379002761C5 /* Syntrax_c.xcodeproj */; - }, - ); - projectRoot = ""; - targets = ( - 832FF2F71C96508E0076D662 /* Syntrax */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXReferenceProxy section */ - 83EEAB171C96537A002761C5 /* Syntrax_c.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = Syntrax_c.framework; - remoteRef = 83EEAB161C96537A002761C5 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; -/* End PBXReferenceProxy section */ - -/* Begin PBXResourcesBuildPhase section */ - 832FF2F61C96508E0076D662 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 832FF2F41C96508E0076D662 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 83EEAB0F1C965324002761C5 /* jxsDecoder.m in Sources */, - 83EEAB211C965A4F002761C5 /* jxsMetadataReader.m in Sources */, - 83EEAB1E1C965835002761C5 /* jxsContainer.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 83EEAB191C965384002761C5 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = Syntrax_c; - targetProxy = 83EEAB181C965384002761C5 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin XCBuildConfiguration section */ - 832FF2FC1C96508E0076D662 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.12; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - }; - name = Debug; - }; - 832FF2FD1C96508E0076D662 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.12; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = macosx; - }; - name = Release; - }; - 832FF2FF1C96508E0076D662 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_IDENTITY = ""; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = ""; - INFOPLIST_FILE = Syntrax/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles"; - PRODUCT_BUNDLE_IDENTIFIER = org.cogx.Syntrax; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = ""; - SKIP_INSTALL = YES; - WRAPPER_EXTENSION = bundle; - }; - name = Debug; - }; - 832FF3001C96508E0076D662 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_IDENTITY = ""; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = ""; - INFOPLIST_FILE = Syntrax/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles"; - PRODUCT_BUNDLE_IDENTIFIER = org.cogx.Syntrax; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = ""; - SKIP_INSTALL = YES; - WRAPPER_EXTENSION = bundle; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 832FF2F31C96508E0076D662 /* Build configuration list for PBXProject "Syntrax" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 832FF2FC1C96508E0076D662 /* Debug */, - 832FF2FD1C96508E0076D662 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 832FF2FE1C96508E0076D662 /* Build configuration list for PBXNativeTarget "Syntrax" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 832FF2FF1C96508E0076D662 /* Debug */, - 832FF3001C96508E0076D662 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 832FF2F01C96508E0076D662 /* Project object */; -} diff --git a/Plugins/Syntrax/Syntrax.xcodeproj/xcshareddata/xcschemes/Syntrax.xcscheme b/Plugins/Syntrax/Syntrax.xcodeproj/xcshareddata/xcschemes/Syntrax.xcscheme deleted file mode 100644 index 8b313d135..000000000 --- a/Plugins/Syntrax/Syntrax.xcodeproj/xcshareddata/xcschemes/Syntrax.xcscheme +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Plugins/Syntrax/Syntrax/Info.plist b/Plugins/Syntrax/Syntrax/Info.plist deleted file mode 100644 index 65a6dd424..000000000 --- a/Plugins/Syntrax/Syntrax/Info.plist +++ /dev/null @@ -1,28 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - NSHumanReadableCopyright - Copyright © 2021 Christopher Snowhill. All rights reserved. - NSPrincipalClass - - - diff --git a/Plugins/Syntrax/Syntrax/jxsContainer.h b/Plugins/Syntrax/Syntrax/jxsContainer.h deleted file mode 100755 index 4f2984bdd..000000000 --- a/Plugins/Syntrax/Syntrax/jxsContainer.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// jxsContainer.h -// Syntrax-c -// -// Created by Christopher Snowhill on 03/14/16. -// Copyright 2016 __NoWork, Inc__. All rights reserved. -// - -#import - -#import "Plugin.h" - -@interface jxsContainer : NSObject { - -} - -@end diff --git a/Plugins/Syntrax/Syntrax/jxsContainer.m b/Plugins/Syntrax/Syntrax/jxsContainer.m deleted file mode 100755 index 5092c59de..000000000 --- a/Plugins/Syntrax/Syntrax/jxsContainer.m +++ /dev/null @@ -1,85 +0,0 @@ -// -// jxsContainer.m -// Syntrax-c -// -// Created by Christopher Snowhill on 03/14/16. -// Copyright 2016 __NoWork, Inc__. All rights reserved. -// - -#import -#import - -#import "jxsContainer.h" -#import "jxsDecoder.h" - -#import "Logging.h" - -@implementation jxsContainer - -+ (NSArray *)fileTypes -{ - return [jxsDecoder fileTypes]; -} - -+ (NSArray *)mimeTypes -{ - return nil; -} - -+ (float)priority -{ - return 1.0f; -} - -+ (NSArray *)urlsForContainerURL:(NSURL *)url -{ - if ([url fragment]) { - // input url already has fragment defined - no need to expand further - return [NSMutableArray arrayWithObject:url]; - } - - id audioSourceClass = NSClassFromString(@"AudioSource"); - id source = [audioSourceClass audioSourceForURL:url]; - - if (![source open:url]) - return 0; - - if (![source seekable]) - return 0; - - [source seek:0 whence:SEEK_END]; - long size = [source tell]; - [source seek:0 whence:SEEK_SET]; - - void * data = malloc(size); - [source read:data amount:size]; - - JT1Song * synSong; - if (jxsfile_readSongMem(data, size, &synSong)) - { - ALog(@"Open failed for file: %@", [url absoluteString]); - free(data); - return nil; - } - - free(data); - - int i; - int subsongs = synSong->nrofsongs; - - jxsfile_freeSong(synSong); - - NSMutableArray *tracks = [NSMutableArray array]; - - if ( subsongs ) { - for (i = 0; i < subsongs; i++) - { - [tracks addObject:[NSURL URLWithString:[[url absoluteString] stringByAppendingFormat:@"#%i", i]]]; - } - } - - return tracks; -} - - -@end diff --git a/Plugins/Syntrax/Syntrax/jxsDecoder.h b/Plugins/Syntrax/Syntrax/jxsDecoder.h deleted file mode 100755 index 6141555a1..000000000 --- a/Plugins/Syntrax/Syntrax/jxsDecoder.h +++ /dev/null @@ -1,25 +0,0 @@ -// -// jxsDecoder.h -// Syntrax-c -// -// Created by Christopher Snowhill on 03/14/16. -// Copyright 2016 __NoWork, Inc__. All rights reserved. -// - -#import - -#import -#import - -#import "Plugin.h" - -@interface jxsDecoder : NSObject { - JT1Song *synSong; - JT1Player *synPlayer; - int track_num; - - long framesLength; - long totalFrames; - long framesRead; -} -@end diff --git a/Plugins/Syntrax/Syntrax/jxsDecoder.m b/Plugins/Syntrax/Syntrax/jxsDecoder.m deleted file mode 100755 index 9b517f2cf..000000000 --- a/Plugins/Syntrax/Syntrax/jxsDecoder.m +++ /dev/null @@ -1,231 +0,0 @@ -// -// jxsDecoder.m -// Syntrax-c -// -// Created by Christopher Snowhill on 03/14/16. -// Copyright 2016 __NoWork, Inc__. All rights reserved. -// - -#import "jxsDecoder.h" - -#import "Logging.h" - -#import "PlaylistController.h" - -@implementation jxsDecoder - -- (id)init -{ - self = [super init]; - if (self) { - synSong = NULL; - synPlayer = NULL; - } - return self; -} - -- (BOOL)open:(id)s -{ - [s seek:0 whence:SEEK_END]; - size_t size = [s tell]; - [s seek:0 whence:SEEK_SET]; - - void * data = malloc(size); - [s read:data amount:size]; - - if ([[[s url] fragment] length] == 0) - track_num = 0; - else - track_num = [[[s url] fragment] intValue]; - - if (jxsfile_readSongMem(data, size, &synSong)) - return NO; - - free(data); - - synPlayer = jaytrax_init(); - if (!synPlayer) - return NO; - - if (!jaytrax_loadSong(synPlayer, synSong)) - return NO; - - framesLength = jaytrax_getLength(synPlayer, track_num, 2, 44100); - totalFrames = framesLength + ((synPlayer->playFlg) ? 44100 * 8 : 0); - - framesRead = 0; - - [self willChangeValueForKey:@"properties"]; - [self didChangeValueForKey:@"properties"]; - - return YES; -} - -- (BOOL)decoderInitialize -{ - jaytrax_changeSubsong(synPlayer, track_num); - - uint8_t interp = ITP_CUBIC; - NSString * resampling = [[NSUserDefaults standardUserDefaults] stringForKey:@"resampling"]; - if ([resampling isEqualToString:@"zoh"]) - interp = ITP_NEAREST; - else if ([resampling isEqualToString:@"blep"]) - interp = ITP_NEAREST; - else if ([resampling isEqualToString:@"linear"]) - interp = ITP_LINEAR; - else if ([resampling isEqualToString:@"blam"]) - interp = ITP_LINEAR; - else if ([resampling isEqualToString:@"cubic"]) - interp = ITP_CUBIC; - else if ([resampling isEqualToString:@"sinc"]) - interp = ITP_CUBIC; - - jaytrax_setInterpolation(synPlayer, interp); - - framesRead = 0; - - return YES; -} - -- (void)decoderShutdown -{ - if (synPlayer) - { - jaytrax_stopSong(synPlayer); - } - - framesRead = 0; -} - -- (NSDictionary *)properties -{ - return [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithInt:0], @"bitrate", - [NSNumber numberWithFloat:44100], @"sampleRate", - [NSNumber numberWithDouble:totalFrames], @"totalFrames", - [NSNumber numberWithInt:16], @"bitsPerSample", - [NSNumber numberWithBool:NO], @"floatingPoint", - [NSNumber numberWithInt:2], @"channels", - [NSNumber numberWithBool:YES], @"seekable", - @"Syntrax", @"codec", - @"host", @"endian", - nil]; -} - -- (int)readAudio:(void *)buf frames:(UInt32)frames -{ - BOOL repeat_one = IsRepeatOneSet(); - - if ( !repeat_one && framesRead >= totalFrames ) - return 0; - - if ( !framesRead ) - { - if ( ![self decoderInitialize] ) - return 0; - } - - if ( synPlayer && !synPlayer->playFlg ) - return 0; - - int total = 0; - while ( total < frames ) { - int framesToRender = 512; - if ( !repeat_one && framesToRender > totalFrames - framesRead ) - framesToRender = (int)(totalFrames - framesRead); - if ( framesToRender > frames - total ) - framesToRender = frames - total; - - int16_t * sampleBuf = ( int16_t * ) buf + total * 2; - - jaytrax_renderChunk(synPlayer, sampleBuf, framesToRender, 44100); - - if ( !repeat_one && framesRead + framesToRender > framesLength ) { - long fadeStart = ( framesLength > framesRead ) ? framesLength : framesRead; - long fadeEnd = ( framesRead + framesToRender < totalFrames ) ? framesRead + framesToRender : totalFrames; - const long fadeTotal = totalFrames - framesLength; - for ( long fadePos = fadeStart; fadePos < fadeEnd; ++fadePos ) { - const long scale = ( fadeTotal - ( fadePos - framesLength ) ); - const long offset = fadePos - framesRead; - int16_t * samples = sampleBuf + offset * 2; - samples[ 0 ] = (int16_t)(samples[ 0 ] * scale / fadeTotal); - samples[ 1 ] = (int16_t)(samples[ 1 ] * scale / fadeTotal); - } - - framesToRender = (int)(fadeEnd - framesRead); - } - - if ( !framesToRender ) - break; - - total += framesToRender; - framesRead += framesToRender; - - if ( !synPlayer->playFlg ) - break; - } - - return total; -} - -- (long)seek:(long)frame -{ - if ( frame < framesRead || !synPlayer ) - { - [self decoderShutdown]; - if ( ![self decoderInitialize] ) - return 0; - } - - while ( framesRead < frame ) - { - int frames_todo = INT_MAX; - if ( frames_todo > frame - framesRead ) - frames_todo = (int)( frame - framesRead ); - jaytrax_renderChunk(synPlayer, NULL, frames_todo, 44100); - framesRead += frames_todo; - } - - framesRead = frame; - - return frame; -} - -- (void)close -{ - [self decoderShutdown]; - - if (synPlayer) - { - jaytrax_free(synPlayer); - synPlayer = NULL; - } - - if (synSong) - { - jxsfile_freeSong(synSong); - synSong = NULL; - } -} - -- (void)dealloc -{ - [self close]; -} - -+ (NSArray *)fileTypes -{ - return [NSArray arrayWithObjects:@"jxs", nil]; -} - -+ (NSArray *)mimeTypes -{ - return [NSArray arrayWithObjects:@"audio/x-jxs", nil]; -} - -+ (float)priority -{ - return 1.0; -} - -@end diff --git a/Plugins/Syntrax/Syntrax/jxsMetadataReader.h b/Plugins/Syntrax/Syntrax/jxsMetadataReader.h deleted file mode 100644 index 5ec11f2c9..000000000 --- a/Plugins/Syntrax/Syntrax/jxsMetadataReader.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// jxsMetadataReader.h -// Syntrax-c -// -// Created by Christopher Snowhill on 03/14/16. -// Copyright 2016 __NoWork, Inc__. All rights reserved. -// - -#import - -#import "Plugin.h" - -@interface jxsMetadataReader : NSObject { - -} - -@end diff --git a/Plugins/Syntrax/Syntrax/jxsMetadataReader.m b/Plugins/Syntrax/Syntrax/jxsMetadataReader.m deleted file mode 100644 index e5ece459a..000000000 --- a/Plugins/Syntrax/Syntrax/jxsMetadataReader.m +++ /dev/null @@ -1,99 +0,0 @@ -// -// jxsMetadataReader.m -// Syntrax-c -// -// Created by Christopher Snowhill on 03/14/16. -// Copyright 2016 __NoWork, Inc__. All rights reserved. -// - -#import "jxsMetadataReader.h" -#import "jxsDecoder.h" - -#import -#import - -#import "Logging.h" - -@implementation jxsMetadataReader - -+ (NSArray *)fileTypes -{ - return [jxsDecoder fileTypes]; -} - -+ (NSArray *)mimeTypes -{ - return [jxsDecoder mimeTypes]; -} - -+ (float)priority -{ - return 1.0f; -} - -+ (NSDictionary *)metadataForURL:(NSURL *)url -{ - id audioSourceClass = NSClassFromString(@"AudioSource"); - id source = [audioSourceClass audioSourceForURL:url]; - - if (![source open:url]) - return 0; - - if (![source seekable]) - return 0; - - [source seek:0 whence:SEEK_END]; - long size = [source tell]; - [source seek:0 whence:SEEK_SET]; - - void * data = malloc(size); - [source read:data amount:size]; - - JT1Song* synSong; - if (jxsfile_readSongMem(data, size, &synSong)) - { - ALog(@"Open failed for file: %@", [url absoluteString]); - free(data); - return nil; - } - - free(data); - - JT1Player * synPlayer = jaytrax_init(); - if (!synPlayer) - { - ALog(@"Failed to create player for file: %@", [url absoluteString]); - jxsfile_freeSong(synSong); - return nil; - } - - if (!jaytrax_loadSong(synPlayer, synSong)) - { - ALog(@"Load failed for file: %@", [url absoluteString]); - jaytrax_free(synPlayer); - jxsfile_freeSong(synSong); - return nil; - } - - int track_num; - if ([[url fragment] length] == 0) - track_num = 0; - else - track_num = [[url fragment] intValue]; - - jaytrax_changeSubsong(synPlayer, track_num); - - //Some titles are all spaces?! - NSString *title = [[NSString stringWithUTF8String: synPlayer->subsong->name] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; - - jaytrax_free(synPlayer); - jxsfile_freeSong(synSong); - - if (title == nil) { - title = @""; - } - - return [NSDictionary dictionaryWithObject:title forKey:@"title"]; -} - -@end