├── .gitignore ├── 64klang2.png ├── FileProperties_Security_Unblock.png ├── LICENSE ├── Player ├── Player.sln └── Player │ ├── 64k2Patch.h │ ├── 64k2Song.h │ ├── Player.vcxproj │ ├── Player.vcxproj.filters │ ├── Synth.cpp │ ├── Synth.h │ ├── SynthAllocator.cpp │ ├── SynthAllocator.h │ ├── SynthNode.cpp │ ├── SynthNode.h │ ├── main.cpp │ ├── sample_t.cpp │ └── sample_t.h ├── README.md ├── VSTiPlugin └── 64klang2.zip └── VSTiPluginSourceCode ├── 64klang2.sln ├── 64klang2Core ├── 64klang2Core.vcxproj ├── 64klang2Core.vcxproj.filters ├── Synth.cpp ├── Synth.h ├── SynthAllocator.cpp ├── SynthAllocator.h ├── SynthController.cpp ├── SynthController.h ├── SynthNode.cpp ├── SynthNode.h ├── sample_t.cpp ├── sample_t.h ├── tinystr.cpp ├── tinystr.h ├── tinyxml.cpp ├── tinyxml.h ├── tinyxmlerror.cpp └── tinyxmlparser.cpp ├── 64klang2GUI ├── 64klang2Config.xml ├── 64klang2GUI.csproj ├── ArpeggiatorEdit.xaml ├── ArpeggiatorEdit.xaml.cs ├── BitPattern.xaml ├── BitPattern.xaml.cs ├── GUISynthNode.xaml ├── GUISynthNode.xaml.cs ├── GUISynthNodeEdit.xaml ├── GUISynthNodeEdit.xaml.cs ├── Knob.xaml ├── Knob.xaml.cs ├── ModeButton.xaml ├── ModeButton.xaml.cs ├── MultiParse │ ├── DefaultCasts │ │ ├── MPBooleanCast.cs │ │ ├── MPByteCast.cs │ │ ├── MPCharCast.cs │ │ ├── MPDecimalCast.cs │ │ ├── MPDoubleCast.cs │ │ ├── MPInt16Cast.cs │ │ ├── MPInt32Cast.cs │ │ ├── MPInt64Cast.cs │ │ ├── MPSByteCast.cs │ │ ├── MPSingleCast.cs │ │ ├── MPStringCast.cs │ │ ├── MPUInt16Cast.cs │ │ ├── MPUInt32Cast.cs │ │ └── MPUInt64Cast.cs │ ├── DefaultDataTypes │ │ ├── MPBoolean.cs │ │ ├── MPByte.cs │ │ ├── MPChar.cs │ │ ├── MPDecimal.cs │ │ ├── MPDouble.cs │ │ ├── MPInt16.cs │ │ ├── MPInt32.cs │ │ ├── MPInt64.cs │ │ ├── MPSByte.cs │ │ ├── MPSingle.cs │ │ ├── MPString.cs │ │ ├── MPUInt16.cs │ │ ├── MPUInt32.cs │ │ ├── MPUInt64.cs │ │ └── MPVariable.cs │ ├── DefaultFunctions │ │ ├── MPAbs.cs │ │ ├── MPAcos.cs │ │ ├── MPAsin.cs │ │ ├── MPAtan.cs │ │ ├── MPAtan2.cs │ │ ├── MPCeiling.cs │ │ ├── MPCos.cs │ │ ├── MPCosh.cs │ │ ├── MPExp.cs │ │ ├── MPExp2.cs │ │ ├── MPFloor.cs │ │ ├── MPIfThen.cs │ │ ├── MPIn0.cs │ │ ├── MPIn1.cs │ │ ├── MPLerp.cs │ │ ├── MPLog.cs │ │ ├── MPLog10.cs │ │ ├── MPLog2.cs │ │ ├── MPMax.cs │ │ ├── MPMaxTime.cs │ │ ├── MPMin.cs │ │ ├── MPPi.cs │ │ ├── MPPow.cs │ │ ├── MPPulse.cs │ │ ├── MPRand.cs │ │ ├── MPRound.cs │ │ ├── MPSign.cs │ │ ├── MPSin.cs │ │ ├── MPSqr.cs │ │ ├── MPSqrt.cs │ │ ├── MPTan.cs │ │ ├── MPTanh.cs │ │ ├── MPTau.cs │ │ ├── MPTautime.cs │ │ ├── MPTriSaw.cs │ │ ├── MPTruncate.cs │ │ ├── MPVAftertouch.cs │ │ ├── MPVFrequency.cs │ │ ├── MPVGate.cs │ │ ├── MPVNote.cs │ │ ├── MPVTrigger.cs │ │ └── MPVVelocity.cs │ ├── DefaultOperators │ │ ├── MPAddition.cs │ │ ├── MPAssignment.cs │ │ ├── MPComplement.cs │ │ ├── MPConditionalAnd.cs │ │ ├── MPConditionalOr.cs │ │ ├── MPDivision.cs │ │ ├── MPEquality.cs │ │ ├── MPInequality.cs │ │ ├── MPLeftShift.cs │ │ ├── MPLogicalAnd.cs │ │ ├── MPLogicalOr.cs │ │ ├── MPLogicalXOr.cs │ │ ├── MPModulo.cs │ │ ├── MPMultiplication.cs │ │ ├── MPNegative.cs │ │ ├── MPNot.cs │ │ ├── MPPositive.cs │ │ ├── MPRelationalLarger.cs │ │ ├── MPRelationalLargerEqual.cs │ │ ├── MPRelationalSmaller.cs │ │ ├── MPRelationalSmallerEqual.cs │ │ ├── MPRightShift.cs │ │ └── MPSubtraction.cs │ ├── Expression.cs │ ├── MPDataType.cs │ ├── MPDefault.cs │ ├── MPFunction.cs │ ├── MPOperator.cs │ ├── MPSpecialCharacters.cs │ └── ParseException.cs ├── Properties │ └── AssemblyInfo.cs ├── SynthCanvas.xaml ├── SynthCanvas.xaml.cs ├── SynthWindow.xaml ├── SynthWindow.xaml.cs ├── TouchScrolling.cs ├── VUMeter.xaml ├── VUMeter.xaml.cs ├── WaveFileConfig.xaml ├── WaveFileConfig.xaml.cs ├── WaveFileDialog.xaml ├── WaveFileDialog.xaml.cs └── WaveformTimeline.cs ├── 64klang2VSTi ├── 64klang2VSTi.vcxproj ├── vstplugmain.cpp ├── vstxsynth.cpp ├── vstxsynth.h └── vstxsynthproc.cpp ├── 64klang2Wrapper ├── 64klang2Wrapper.cpp ├── 64klang2Wrapper.h ├── 64klang2Wrapper.vcxproj ├── 64klang2Wrapper.vcxproj.filters ├── ReadMe.txt ├── dllmain.cpp ├── stdafx.cpp ├── stdafx.h └── targetver.h ├── DebugExe ├── DebugExe.vcxproj ├── Exe.cpp ├── Exe.h ├── Exe.ico ├── Exe.rc ├── Exe.vcxproj.filters ├── ReadMe.txt ├── Resource.h ├── small.ico ├── stdafx.cpp ├── stdafx.h └── targetver.h ├── Setup ├── 64klang2_Setup.exe ├── Setup.isl └── Setup.isproj ├── readme.txt ├── stk ├── include │ ├── ADSR.h │ ├── Asymp.h │ ├── BandedWG.h │ ├── BeeThree.h │ ├── BiQuad.h │ ├── Blit.h │ ├── BlitSaw.h │ ├── BlitSquare.h │ ├── BlowBotl.h │ ├── BlowHole.h │ ├── BowTable.h │ ├── Bowed.h │ ├── Brass.h │ ├── Chorus.h │ ├── Clarinet.h │ ├── Cubic.h │ ├── Delay.h │ ├── DelayA.h │ ├── DelayL.h │ ├── Drummer.h │ ├── Echo.h │ ├── Effect.h │ ├── Envelope.h │ ├── FM.h │ ├── FMVoices.h │ ├── FileLoop.h │ ├── FileRead.h │ ├── FileWrite.h │ ├── FileWvIn.h │ ├── FileWvOut.h │ ├── Filter.h │ ├── Fir.h │ ├── Flute.h │ ├── FormSwep.h │ ├── FreeVerb.h │ ├── Function.h │ ├── Generator.h │ ├── Granulate.h │ ├── Guitar.h │ ├── HevyMetl.h │ ├── Iir.h │ ├── InetWvIn.h │ ├── InetWvOut.h │ ├── Instrmnt.h │ ├── JCRev.h │ ├── JetTable.h │ ├── LentPitShift.h │ ├── Mandolin.h │ ├── Mesh2D.h │ ├── Messager.h │ ├── MidiFileIn.h │ ├── Modal.h │ ├── ModalBar.h │ ├── Modulate.h │ ├── Moog.h │ ├── Mutex.h │ ├── NRev.h │ ├── Noise.h │ ├── OnePole.h │ ├── OneZero.h │ ├── PRCRev.h │ ├── PercFlut.h │ ├── Phonemes.h │ ├── PitShift.h │ ├── PluckTwo.h │ ├── Plucked.h │ ├── PoleZero.h │ ├── ReedTable.h │ ├── Resonate.h │ ├── Rhodey.h │ ├── RtAudio.h │ ├── RtError.h │ ├── RtMidi.h │ ├── RtWvIn.h │ ├── RtWvOut.h │ ├── SKINI.msg │ ├── SKINI.tbl │ ├── Sampler.h │ ├── Saxofony.h │ ├── Shakers.h │ ├── Simple.h │ ├── SineWave.h │ ├── SingWave.h │ ├── Sitar.h │ ├── Skini.h │ ├── Socket.h │ ├── Sphere.h │ ├── StifKarp.h │ ├── Stk.h │ ├── TapDelay.h │ ├── TcpClient.h │ ├── TcpServer.h │ ├── Thread.h │ ├── TubeBell.h │ ├── Twang.h │ ├── TwoPole.h │ ├── TwoZero.h │ ├── UdpSocket.h │ ├── Vector3D.h │ ├── VoicForm.h │ ├── Voicer.h │ ├── Whistle.h │ ├── Wurley.h │ ├── WvIn.h │ └── WvOut.h └── src │ ├── ADSR.cpp │ ├── Asymp.cpp │ ├── BandedWG.cpp │ ├── BeeThree.cpp │ ├── BiQuad.cpp │ ├── Blit.cpp │ ├── BlitSaw.cpp │ ├── BlitSquare.cpp │ ├── BlowBotl.cpp │ ├── BlowHole.cpp │ ├── Bowed.cpp │ ├── Brass.cpp │ ├── Chorus.cpp │ ├── Clarinet.cpp │ ├── Delay.cpp │ ├── DelayA.cpp │ ├── DelayL.cpp │ ├── Drummer.cpp │ ├── Echo.cpp │ ├── Envelope.cpp │ ├── FM.cpp │ ├── FMVoices.cpp │ ├── FileLoop.cpp │ ├── FileRead.cpp │ ├── FileWrite.cpp │ ├── FileWvIn.cpp │ ├── FileWvOut.cpp │ ├── Fir.cpp │ ├── Flute.cpp │ ├── FormSwep.cpp │ ├── FreeVerb.cpp │ ├── Granulate.cpp │ ├── Guitar.cpp │ ├── HevyMetl.cpp │ ├── Iir.cpp │ ├── InetWvIn.cpp │ ├── InetWvOut.cpp │ ├── JCRev.cpp │ ├── LentPitShift.cpp │ ├── Mandolin.cpp │ ├── Mesh2D.cpp │ ├── Messager.cpp │ ├── MidiFileIn.cpp │ ├── Modal.cpp │ ├── ModalBar.cpp │ ├── Modulate.cpp │ ├── Moog.cpp │ ├── Mutex.cpp │ ├── NRev.cpp │ ├── Noise.cpp │ ├── OnePole.cpp │ ├── OneZero.cpp │ ├── PRCRev.cpp │ ├── PercFlut.cpp │ ├── Phonemes.cpp │ ├── PitShift.cpp │ ├── PluckTwo.cpp │ ├── Plucked.cpp │ ├── PoleZero.cpp │ ├── Resonate.cpp │ ├── Rhodey.cpp │ ├── RtAudio.cpp │ ├── RtMidi.cpp │ ├── RtWvIn.cpp │ ├── RtWvOut.cpp │ ├── Sampler.cpp │ ├── Saxofony.cpp │ ├── Shakers.cpp │ ├── Simple.cpp │ ├── SineWave.cpp │ ├── SingWave.cpp │ ├── Sitar.cpp │ ├── Skini.cpp │ ├── Socket.cpp │ ├── Sphere.cpp │ ├── StifKarp.cpp │ ├── Stk.cpp │ ├── TapDelay.cpp │ ├── TcpClient.cpp │ ├── TcpServer.cpp │ ├── Thread.cpp │ ├── TubeBell.cpp │ ├── Twang.cpp │ ├── TwoPole.cpp │ ├── TwoZero.cpp │ ├── UdpSocket.cpp │ ├── VoicForm.cpp │ ├── Voicer.cpp │ ├── Whistle.cpp │ ├── Wurley.cpp │ └── include │ ├── FunctionDiscoveryKeys_devpkey.h │ ├── asio.cpp │ ├── asio.h │ ├── asiodrivers.cpp │ ├── asiodrivers.h │ ├── asiodrvr.h │ ├── asiolist.cpp │ ├── asiolist.h │ ├── asiosys.h │ ├── dsound.h │ ├── ginclude.h │ ├── iasiodrv.h │ ├── iasiothiscallresolver.cpp │ ├── iasiothiscallresolver.h │ └── soundcard.h └── vstsdk ├── interfaces ├── aeffect.h ├── aeffectx.h └── vstfxstore.h ├── source ├── aeffeditor.h ├── audioeffect.cpp ├── audioeffect.h ├── audioeffectx.cpp └── audioeffectx.h └── vstplug.def /.gitignore: -------------------------------------------------------------------------------- 1 | # Visual Studio 2015/2017 cache/options directory 2 | .vs/ 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | 8 | # Build results 9 | [Dd]ebug/ 10 | [Rr]elease/ 11 | [Bb]in/ 12 | [Oo]bj/ 13 | 14 | 15 | -------------------------------------------------------------------------------- /64klang2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gopher-atz/64klang/fc95541ceff3e6022b1a18deca5df0ecde1bdc16/64klang2.png -------------------------------------------------------------------------------- /FileProperties_Security_Unblock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gopher-atz/64klang/fc95541ceff3e6022b1a18deca5df0ecde1bdc16/FileProperties_Security_Unblock.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Dominik Ries 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Player/Player.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.27130.2036 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Player", "Player\Player.vcxproj", "{D5AA23B1-586D-4D6A-863A-DF1E75328AE9}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {D5AA23B1-586D-4D6A-863A-DF1E75328AE9}.Debug|x64.ActiveCfg = Debug|x64 17 | {D5AA23B1-586D-4D6A-863A-DF1E75328AE9}.Debug|x64.Build.0 = Debug|x64 18 | {D5AA23B1-586D-4D6A-863A-DF1E75328AE9}.Debug|x86.ActiveCfg = Debug|Win32 19 | {D5AA23B1-586D-4D6A-863A-DF1E75328AE9}.Debug|x86.Build.0 = Debug|Win32 20 | {D5AA23B1-586D-4D6A-863A-DF1E75328AE9}.Release|x64.ActiveCfg = Release|x64 21 | {D5AA23B1-586D-4D6A-863A-DF1E75328AE9}.Release|x64.Build.0 = Release|x64 22 | {D5AA23B1-586D-4D6A-863A-DF1E75328AE9}.Release|x86.ActiveCfg = Release|Win32 23 | {D5AA23B1-586D-4D6A-863A-DF1E75328AE9}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {BD815C56-E2D1-4830-A56A-1E6B3D1D434F} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /Player/Player/Player.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | 35 | 36 | Header Files 37 | 38 | 39 | Header Files 40 | 41 | 42 | Header Files 43 | 44 | 45 | Header Files 46 | 47 | 48 | Header Files 49 | 50 | 51 | Header Files 52 | 53 | 54 | -------------------------------------------------------------------------------- /Player/Player/Synth.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // 64klang core interface functions for playback, plugin and authoring 3 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 4 | 5 | #ifndef __SYNTH_H__ 6 | #define __SYNTH_H__ 7 | 8 | #include 9 | 10 | void _64klang_Init (BYTE* songStream, void* patchData, DWORD const1Offset, DWORD const2Offset, DWORD maxoffset); 11 | int _64klang_ACMConvert (void* srcFormat, void* dstFormat, LPBYTE srcBuffer, DWORD srcBufferSize, LPBYTE& dstBuffer, DWORD& dstBufferSize); 12 | #ifdef COMPILE_VSTI 13 | void _64klang_NoteOn (DWORD channel, DWORD note, DWORD velocity); 14 | void _64klang_NoteOff (DWORD channel, DWORD note, DWORD velocity); 15 | void _64klang_NoteAftertouch(DWORD channel, DWORD note, DWORD value); 16 | void _64klang_MidiSignal (DWORD channel, int value, DWORD cc); 17 | void _64klang_SetBPM (float bpm); 18 | void _64klang_Tick (float* left, float* right, DWORD samples); 19 | #else 20 | void _64klang_Render(float* dstbuffer); 21 | bool _64klang_RenderDone(); 22 | #ifdef AUTHORING 23 | int _64klang_CurrentBufferSample(); 24 | #endif 25 | #endif 26 | 27 | #endif -------------------------------------------------------------------------------- /Player/Player/SynthAllocator.cpp: -------------------------------------------------------------------------------- 1 | #include "SynthAllocator.h" 2 | #ifdef COMPILE_VSTI 3 | #include "SynthController.h" 4 | #endif 5 | 6 | #ifndef COMPILE_VSTI 7 | void* SynthFreeList[65536]; 8 | int SynthFreeCounter = 0; 9 | #endif 10 | 11 | void* __fastcall SynthMalloc(int size) 12 | { 13 | // always allocate 16 bytes more than requested 14 | int* ptr = (int*)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT, size + 16); 15 | // step forward 16 bytes 16 | ptr += 4; 17 | // not 16byte aligned? 18 | if ((uintptr_t)ptr & 0x08) 19 | { 20 | // go back 8 bytes for the pointer to be 16 byte aligned 21 | ptr -= 2; 22 | // to know we had originally unaligned mem, store the pointer as marker in the 8 bytes before (start of original memory block) 23 | *((uintptr_t*)(ptr-2)) = (uintptr_t)ptr; 24 | } 25 | return ptr; 26 | } 27 | 28 | void __fastcall SynthFree(void* ptr) 29 | { 30 | int* fptr = (int*)ptr; 31 | // check if initial malloc returned an 8 byte aligned address by checking for pointer to self at the beginning of the (see above) 32 | if (*((uintptr_t*)(fptr-2)) == (uintptr_t)fptr) 33 | { 34 | fptr -= 2; 35 | } 36 | // initial malloc was 16 bytes aligned 37 | else 38 | { 39 | // step back 16 bytes 40 | fptr -= 4; 41 | } 42 | 43 | #ifndef COMPILE_VSTI 44 | SynthFreeList[SynthFreeCounter++] = fptr; 45 | #else 46 | SynthController::instance()->AddDeferredFreeNode(fptr); 47 | #endif 48 | } 49 | 50 | void __fastcall SynthDeferredFree() 51 | { 52 | #ifndef COMPILE_VSTI 53 | while (SynthFreeCounter) 54 | GlobalFree(SynthFreeList[--SynthFreeCounter]); 55 | #endif 56 | } 57 | 58 | void __fastcall SynthMemSet(void* mptr, int s, int v) 59 | { 60 | char* pdst = (char*)mptr; 61 | while(s--) 62 | pdst[s] = v; 63 | } 64 | 65 | void __fastcall SynthMemCopy(void* dst, void* src, int s) 66 | { 67 | char* psrc = (char*)src, * pdst = (char*)dst; 68 | while (s--) 69 | pdst[s] = psrc[s]; 70 | } -------------------------------------------------------------------------------- /Player/Player/SynthAllocator.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // custom memory allocation for 64klang's SSE based data. takes care of memory alignment 3 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 4 | 5 | #ifndef _SYNTH_ALLOCATOR_H_ 6 | #define _SYNTH_ALLOCATOR_H_ 7 | 8 | #include "windows.h" 9 | 10 | void* __fastcall SynthMalloc(int size); 11 | void __fastcall SynthFree(void* ptr); 12 | void __fastcall SynthDeferredFree(); 13 | void __fastcall SynthMemSet(void* ptr, int size, int value); 14 | void __fastcall SynthMemCopy(void* dst, void* src, int s); 15 | 16 | #endif -------------------------------------------------------------------------------- /Player/Player/main.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gopher-atz/64klang/fc95541ceff3e6022b1a18deca5df0ecde1bdc16/Player/Player/main.cpp -------------------------------------------------------------------------------- /VSTiPlugin/64klang2.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gopher-atz/64klang/fc95541ceff3e6022b1a18deca5df0ecde1bdc16/VSTiPlugin/64klang2.zip -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2Core/Synth.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // 64klang core interface functions for playback, plugin and authoring 3 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 4 | 5 | #ifndef __SYNTH_H__ 6 | #define __SYNTH_H__ 7 | 8 | #include 9 | 10 | #ifdef USE_BLOBS 11 | void _64klang_Init (BYTE* songStream, void* patchData); 12 | #else 13 | void _64klang_Init (BYTE* songStream, void* patchData, DWORD const1Offset, DWORD const2Offset, DWORD maxoffset); 14 | #endif 15 | int _64klang_ACMConvert (void* srcFormat, void* dstFormat, LPBYTE srcBuffer, DWORD srcBufferSize, LPBYTE& dstBuffer, DWORD& dstBufferSize); 16 | #ifdef COMPILE_VSTI 17 | void _64klang_NoteOn (DWORD channel, DWORD note, DWORD velocity); 18 | void _64klang_NoteOff (DWORD channel, DWORD note, DWORD velocity); 19 | void _64klang_NoteAftertouch(DWORD channel, DWORD note, DWORD value); 20 | void _64klang_MidiSignal (DWORD channel, int value, DWORD cc); 21 | void _64klang_SetBPM (float bpm); 22 | void _64klang_Tick (float* left, float* right, DWORD samples); 23 | #else 24 | void _64klang_Render(float* dstbuffer); 25 | bool _64klang_RenderDone(); 26 | #ifdef AUTHORING 27 | int _64klang_CurrentBufferSample(); 28 | #endif 29 | #endif 30 | 31 | #endif -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2Core/SynthAllocator.cpp: -------------------------------------------------------------------------------- 1 | #include "SynthAllocator.h" 2 | #ifdef COMPILE_VSTI 3 | #include "SynthController.h" 4 | #endif 5 | 6 | #ifndef COMPILE_VSTI 7 | void* SynthFreeList[65536]; 8 | int SynthFreeCounter = 0; 9 | #endif 10 | 11 | void* __fastcall SynthMalloc(int size) 12 | { 13 | // always allocate 16 bytes more than requested 14 | int* ptr = (int*)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT, size + 16); 15 | // step forward 16 bytes 16 | ptr += 4; 17 | // not 16byte aligned? 18 | if ((uintptr_t)ptr & 0x08) 19 | { 20 | // go back 8 bytes for the pointer to be 16 byte aligned 21 | ptr -= 2; 22 | // to know we had originally unaligned mem, store the pointer as marker in the 8 bytes before (start of original memory block) 23 | *((uintptr_t*)(ptr-2)) = (uintptr_t)ptr; 24 | } 25 | return ptr; 26 | } 27 | 28 | void __fastcall SynthFree(void* ptr) 29 | { 30 | int* fptr = (int*)ptr; 31 | // check if initial malloc returned an 8 byte aligned address by checking for pointer to self at the beginning of the (see above) 32 | if (*((uintptr_t*)(fptr-2)) == (uintptr_t)fptr) 33 | { 34 | fptr -= 2; 35 | } 36 | // initial malloc was 16 bytes aligned 37 | else 38 | { 39 | // step back 16 bytes 40 | fptr -= 4; 41 | } 42 | 43 | #ifndef COMPILE_VSTI 44 | SynthFreeList[SynthFreeCounter++] = fptr; 45 | #else 46 | SynthController::instance()->AddDeferredFreeNode(fptr); 47 | #endif 48 | } 49 | 50 | void __fastcall SynthDeferredFree() 51 | { 52 | #ifndef COMPILE_VSTI 53 | while (SynthFreeCounter) 54 | GlobalFree(SynthFreeList[--SynthFreeCounter]); 55 | #endif 56 | } 57 | 58 | void __fastcall SynthMemSet(void* mptr, int s, int v) 59 | { 60 | char* pdst = (char*)mptr; 61 | while(s--) 62 | pdst[s] = v; 63 | } 64 | 65 | void __fastcall SynthMemCopy(void* dst, void* src, int s) 66 | { 67 | char* psrc = (char*)src, * pdst = (char*)dst; 68 | while (s--) 69 | pdst[s] = psrc[s]; 70 | } -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2Core/SynthAllocator.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // custom memory allocation for 64klang's SSE based data. takes care of memory alignment 3 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 4 | 5 | #ifndef _SYNTH_ALLOCATOR_H_ 6 | #define _SYNTH_ALLOCATOR_H_ 7 | 8 | #include "windows.h" 9 | 10 | void* __fastcall SynthMalloc(int size); 11 | void __fastcall SynthFree(void* ptr); 12 | void __fastcall SynthDeferredFree(); 13 | void __fastcall SynthMemSet(void* ptr, int size, int value); 14 | void __fastcall SynthMemCopy(void* dst, void* src, int s); 15 | 16 | #endif -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2Core/tinyxmlerror.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | www.sourceforge.net/projects/tinyxml 3 | Original code (2.0 and earlier )copyright (c) 2000-2006 Lee Thomason (www.grinninglizard.com) 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any 7 | damages arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any 10 | purpose, including commercial applications, and to alter it and 11 | redistribute it freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must 14 | not claim that you wrote the original software. If you use this 15 | software in a product, an acknowledgment in the product documentation 16 | would be appreciated but is not required. 17 | 18 | 2. Altered source versions must be plainly marked as such, and 19 | must not be misrepresented as being the original software. 20 | 21 | 3. This notice may not be removed or altered from any source 22 | distribution. 23 | */ 24 | 25 | #include "tinyxml.h" 26 | 27 | // The goal of the seperate error file is to make the first 28 | // step towards localization. tinyxml (currently) only supports 29 | // english error messages, but the could now be translated. 30 | // 31 | // It also cleans up the code a bit. 32 | // 33 | 34 | const char* TiXmlBase::errorString[ TiXmlBase::TIXML_ERROR_STRING_COUNT ] = 35 | { 36 | "No error", 37 | "Error", 38 | "Failed to open file", 39 | "Error parsing Element.", 40 | "Failed to read Element name", 41 | "Error reading Element value.", 42 | "Error reading Attributes.", 43 | "Error: empty tag.", 44 | "Error reading end tag.", 45 | "Error parsing Unknown.", 46 | "Error parsing Comment.", 47 | "Error parsing Declaration.", 48 | "Error document empty.", 49 | "Error null (0) or unexpected EOF found in input stream.", 50 | "Error parsing CDATA.", 51 | "Error when TiXmlDocument added to document, because TiXmlDocument can only be at the root.", 52 | }; 53 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/ModeButton.xaml: -------------------------------------------------------------------------------- 1 |  8 | 9 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/ModeButton.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | using System.Windows.Data; 8 | using System.Windows.Documents; 9 | using System.Windows.Input; 10 | using System.Windows.Media; 11 | using System.Windows.Media.Imaging; 12 | using System.Windows.Navigation; 13 | using System.Windows.Shapes; 14 | 15 | namespace _64klang2GUI 16 | { 17 | /// 18 | /// Interaction logic for ModeButton.xaml 19 | /// 20 | public partial class ModeButton : RadioButton 21 | { 22 | public ModeButton() 23 | { 24 | InitializeComponent(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultCasts/MPBooleanCast.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text.RegularExpressions; 4 | 5 | namespace MultiParse.Default 6 | { 7 | public class MPBooleanCast : MPOperator 8 | { 9 | /// 10 | /// Constructor 11 | /// 12 | public MPBooleanCast() 13 | : base("(bool)", PrecedenceUnary, false) 14 | { 15 | } 16 | 17 | /// 18 | /// Find byte cast 19 | /// 20 | /// 21 | /// 22 | /// 23 | public override int Match(string expression, object previousToken) 24 | { 25 | if (!IsUnary(previousToken)) 26 | return -1; 27 | Match m = Regex.Match(expression, @"^\((bool|Boolean)\)"); 28 | if (m.Success) 29 | return m.Length; 30 | return -1; 31 | } 32 | 33 | /// 34 | /// Execute byte cast 35 | /// 36 | /// 37 | public override void Execute(Stack output) 38 | { 39 | // Pop object from the stack 40 | object top = PopOrGet(output); 41 | TypeCode tc = Type.GetTypeCode(top.GetType()); 42 | if (top is bool) 43 | { 44 | output.Push((bool)(bool)top); 45 | return; 46 | } 47 | 48 | // Invalid operation 49 | throw new InvalidOperatorTypesException("(Boolean)", top); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultCasts/MPByteCast.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text.RegularExpressions; 4 | 5 | namespace MultiParse.Default 6 | { 7 | public class MPByteCast : MPOperator 8 | { 9 | /// 10 | /// Constructor 11 | /// 12 | public MPByteCast() 13 | : base("(byte)", PrecedenceUnary, false) 14 | { 15 | } 16 | 17 | /// 18 | /// Find byte cast 19 | /// 20 | /// 21 | /// 22 | /// 23 | public override int Match(string expression, object previousToken) 24 | { 25 | if (!IsUnary(previousToken)) 26 | return -1; 27 | Match m = Regex.Match(expression, @"^\([bB]yte\)"); 28 | if (m.Success) 29 | return m.Length; 30 | return -1; 31 | } 32 | 33 | /// 34 | /// Execute byte cast 35 | /// 36 | /// 37 | public override void Execute(Stack output) 38 | { 39 | // Pop object from the stack 40 | object top = PopOrGet(output); 41 | TypeCode tc = Type.GetTypeCode(top.GetType()); 42 | 43 | switch (tc) 44 | { 45 | case TypeCode.Byte: output.Push((byte)(Byte)top); return; 46 | case TypeCode.Char: output.Push((byte)(Char)top); return; 47 | case TypeCode.Decimal: output.Push((byte)(Decimal)top); return; 48 | case TypeCode.Double: output.Push((byte)(Double)top); return; 49 | case TypeCode.Int16: output.Push((byte)(Int16)top); return; 50 | case TypeCode.Int32: output.Push((byte)(Int32)top); return; 51 | case TypeCode.Int64: output.Push((byte)(Int64)top); return; 52 | case TypeCode.SByte: output.Push((byte)(SByte)top); return; 53 | case TypeCode.Single: output.Push((byte)(Single)top); return; 54 | case TypeCode.UInt16: output.Push((byte)(UInt16)top); return; 55 | case TypeCode.UInt32: output.Push((byte)(UInt32)top); return; 56 | case TypeCode.UInt64: output.Push((byte)(UInt64)top); return; 57 | } 58 | 59 | // Invalid operation 60 | throw new InvalidOperatorTypesException("(Byte)", top); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultCasts/MPCharCast.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text.RegularExpressions; 4 | 5 | namespace MultiParse.Default 6 | { 7 | public class MPCharCast : MPOperator 8 | { 9 | /// 10 | /// Constructor 11 | /// 12 | public MPCharCast() 13 | : base("(char)", PrecedenceUnary, false) 14 | { 15 | } 16 | 17 | /// 18 | /// Find byte cast 19 | /// 20 | /// 21 | /// 22 | /// 23 | public override int Match(string expression, object previousToken) 24 | { 25 | if (!IsUnary(previousToken)) 26 | return -1; 27 | Match m = Regex.Match(expression, @"^\([cC]har\)"); 28 | if (m.Success) 29 | return m.Length; 30 | return -1; 31 | } 32 | 33 | /// 34 | /// Execute byte cast 35 | /// 36 | /// 37 | public override void Execute(Stack output) 38 | { 39 | // Pop object from the stack 40 | object top = PopOrGet(output); 41 | TypeCode tc = Type.GetTypeCode(top.GetType()); 42 | 43 | switch (tc) 44 | { 45 | case TypeCode.Byte: output.Push((char)(Byte)top); return; 46 | case TypeCode.Char: output.Push((char)(Char)top); return; 47 | case TypeCode.Decimal: output.Push((char)(Decimal)top); return; 48 | case TypeCode.Double: output.Push((char)(Double)top); return; 49 | case TypeCode.Int16: output.Push((char)(Int16)top); return; 50 | case TypeCode.Int32: output.Push((char)(Int32)top); return; 51 | case TypeCode.Int64: output.Push((char)(Int64)top); return; 52 | case TypeCode.SByte: output.Push((char)(SByte)top); return; 53 | case TypeCode.Single: output.Push((char)(Single)top); return; 54 | case TypeCode.UInt16: output.Push((char)(UInt16)top); return; 55 | case TypeCode.UInt32: output.Push((char)(UInt32)top); return; 56 | case TypeCode.UInt64: output.Push((char)(UInt64)top); return; 57 | } 58 | 59 | // Invalid operation 60 | throw new InvalidOperatorTypesException("(Char)", top); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultCasts/MPInt32Cast.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text.RegularExpressions; 4 | 5 | namespace MultiParse.Default 6 | { 7 | public class MPInt32Cast : MPOperator 8 | { 9 | /// 10 | /// Constructor 11 | /// 12 | public MPInt32Cast() 13 | : base("(int)", PrecedenceUnary, false) 14 | { 15 | } 16 | 17 | /// 18 | /// Find byte cast 19 | /// 20 | /// 21 | /// 22 | /// 23 | public override int Match(string expression, object previousToken) 24 | { 25 | if (!IsUnary(previousToken)) 26 | return -1; 27 | Match m = Regex.Match(expression, @"^\((int|Int32)\)"); 28 | if (m.Success) 29 | return m.Length; 30 | return -1; 31 | } 32 | 33 | /// 34 | /// Execute byte cast 35 | /// 36 | /// 37 | public override void Execute(Stack output) 38 | { 39 | // Pop object from the stack 40 | object top = PopOrGet(output); 41 | TypeCode tc = Type.GetTypeCode(top.GetType()); 42 | 43 | switch (tc) 44 | { 45 | case TypeCode.Byte: output.Push((int)(Byte)top); return; 46 | case TypeCode.Char: output.Push((int)(Char)top); return; 47 | case TypeCode.Decimal: output.Push((int)(Decimal)top); return; 48 | case TypeCode.Double: output.Push((int)(Double)top); return; 49 | case TypeCode.Int16: output.Push((int)(Int16)top); return; 50 | case TypeCode.Int32: output.Push((int)(Int32)top); return; 51 | case TypeCode.Int64: output.Push((int)(Int64)top); return; 52 | case TypeCode.SByte: output.Push((int)(SByte)top); return; 53 | case TypeCode.Single: output.Push((int)(Single)top); return; 54 | case TypeCode.UInt16: output.Push((int)(UInt16)top); return; 55 | case TypeCode.UInt32: output.Push((int)(UInt32)top); return; 56 | case TypeCode.UInt64: output.Push((int)(UInt64)top); return; 57 | } 58 | 59 | // Invalid operation 60 | throw new InvalidOperatorTypesException("(Int32)", top); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultCasts/MPInt64Cast.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text.RegularExpressions; 4 | 5 | namespace MultiParse.Default 6 | { 7 | public class MPInt64Cast : MPOperator 8 | { 9 | /// 10 | /// Constructor 11 | /// 12 | public MPInt64Cast() 13 | : base("(long)", PrecedenceUnary, false) 14 | { 15 | } 16 | 17 | /// 18 | /// Find byte cast 19 | /// 20 | /// 21 | /// 22 | /// 23 | public override int Match(string expression, object previousToken) 24 | { 25 | if (!IsUnary(previousToken)) 26 | return -1; 27 | Match m = Regex.Match(expression, @"^\((long|Int64)\)"); 28 | if (m.Success) 29 | return m.Length; 30 | return -1; 31 | } 32 | 33 | /// 34 | /// Execute byte cast 35 | /// 36 | /// 37 | public override void Execute(Stack output) 38 | { 39 | // Pop object from the stack 40 | object top = PopOrGet(output); 41 | TypeCode tc = Type.GetTypeCode(top.GetType()); 42 | 43 | switch (tc) 44 | { 45 | case TypeCode.Byte: output.Push((long)(Byte)top); return; 46 | case TypeCode.Char: output.Push((long)(Char)top); return; 47 | case TypeCode.Decimal: output.Push((long)(Decimal)top); return; 48 | case TypeCode.Double: output.Push((long)(Double)top); return; 49 | case TypeCode.Int16: output.Push((long)(Int16)top); return; 50 | case TypeCode.Int32: output.Push((long)(Int32)top); return; 51 | case TypeCode.Int64: output.Push((long)(Int64)top); return; 52 | case TypeCode.SByte: output.Push((long)(SByte)top); return; 53 | case TypeCode.Single: output.Push((long)(Single)top); return; 54 | case TypeCode.UInt16: output.Push((long)(UInt16)top); return; 55 | case TypeCode.UInt32: output.Push((long)(UInt32)top); return; 56 | case TypeCode.UInt64: output.Push((long)(UInt64)top); return; 57 | } 58 | 59 | // Invalid operation 60 | throw new InvalidOperatorTypesException("(Int64)", top); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultCasts/MPStringCast.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text.RegularExpressions; 4 | 5 | namespace MultiParse.Default 6 | { 7 | public class MPStringCast : MPOperator 8 | { 9 | /// 10 | /// Constructor 11 | /// 12 | public MPStringCast() 13 | : base("(string)", PrecedenceUnary, false) 14 | { 15 | } 16 | 17 | /// 18 | /// Find byte cast 19 | /// 20 | /// 21 | /// 22 | /// 23 | public override int Match(string expression, object previousToken) 24 | { 25 | if (!IsUnary(previousToken)) 26 | return -1; 27 | Match m = Regex.Match(expression, @"^\([sS]tring\)"); 28 | if (m.Success) 29 | return m.Length; 30 | return -1; 31 | } 32 | 33 | /// 34 | /// Execute byte cast 35 | /// 36 | /// 37 | public override void Execute(Stack output) 38 | { 39 | // Pop object from the stack 40 | object top = PopOrGet(output); 41 | if (top is string) 42 | { 43 | output.Push((string)(String)top); 44 | return; 45 | } 46 | 47 | // Invalid operation 48 | throw new InvalidOperatorTypesException("(String)", top); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultCasts/MPUInt32Cast.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text.RegularExpressions; 4 | 5 | namespace MultiParse.Default 6 | { 7 | public class MPUInt32Cast : MPOperator 8 | { 9 | /// 10 | /// Constructor 11 | /// 12 | public MPUInt32Cast() 13 | : base("(uint)", PrecedenceUnary, false) 14 | { 15 | } 16 | 17 | /// 18 | /// Find byte cast 19 | /// 20 | /// 21 | /// 22 | /// 23 | public override int Match(string expression, object previousToken) 24 | { 25 | if (!IsUnary(previousToken)) 26 | return -1; 27 | Match m = Regex.Match(expression, @"^\((uint|UInt32)\)"); 28 | if (m.Success) 29 | return m.Length; 30 | return -1; 31 | } 32 | 33 | /// 34 | /// Execute byte cast 35 | /// 36 | /// 37 | public override void Execute(Stack output) 38 | { 39 | // Pop object from the stack 40 | object top = PopOrGet(output); 41 | TypeCode tc = Type.GetTypeCode(top.GetType()); 42 | 43 | switch (tc) 44 | { 45 | case TypeCode.Byte: output.Push((uint)(Byte)top); return; 46 | case TypeCode.Char: output.Push((uint)(Char)top); return; 47 | case TypeCode.Decimal: output.Push((uint)(Decimal)top); return; 48 | case TypeCode.Double: output.Push((uint)(Double)top); return; 49 | case TypeCode.Int16: output.Push((uint)(Int16)top); return; 50 | case TypeCode.Int32: output.Push((uint)(Int32)top); return; 51 | case TypeCode.Int64: output.Push((uint)(Int64)top); return; 52 | case TypeCode.SByte: output.Push((uint)(SByte)top); return; 53 | case TypeCode.Single: output.Push((uint)(Single)top); return; 54 | case TypeCode.UInt16: output.Push((uint)(UInt16)top); return; 55 | case TypeCode.UInt32: output.Push((uint)(UInt32)top); return; 56 | case TypeCode.UInt64: output.Push((uint)(UInt64)top); return; 57 | } 58 | 59 | // Invalid operation 60 | throw new InvalidOperatorTypesException("(UInt32)", top); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultDataTypes/MPBoolean.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text.RegularExpressions; 4 | 5 | namespace MultiParse.Default 6 | { 7 | public class MPBoolean : MPDataType 8 | { 9 | /// 10 | /// Constructor 11 | /// 12 | public MPBoolean() 13 | : base() 14 | { 15 | } 16 | 17 | /// 18 | /// Find a boolean 19 | /// 20 | /// 21 | /// 22 | /// 23 | /// 24 | public override int Match(string expression, object previousToken, out object convertedToken) 25 | { 26 | // Match true 27 | if (Regex.IsMatch(expression, @"^[tT]rue(?!\w)")) 28 | { 29 | convertedToken = true; 30 | return 4; 31 | } 32 | 33 | // Match false 34 | if (Regex.IsMatch(expression, @"^[fF]alse(?!\w)")) 35 | { 36 | convertedToken = false; 37 | return 5; 38 | } 39 | 40 | // No match 41 | convertedToken = null; 42 | return -1; 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultDataTypes/MPByte.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text.RegularExpressions; 4 | 5 | namespace MultiParse.Default 6 | { 7 | /// 8 | /// A class able to parse (positive) integers 9 | /// 10 | public class MPByte : MPDataType 11 | { 12 | /// 13 | /// Matches an integer at the start of an expression and removes it afterwards 14 | /// 15 | /// 16 | /// 17 | /// 18 | /// 19 | public override int Match(string expression, object previousToken, out object converted) 20 | { 21 | string sign = @"^"; 22 | if (IsUnary(previousToken)) 23 | sign = @"^\+?"; 24 | 25 | // Match an integer 26 | Match m = Regex.Match(expression, sign + @"\d+(?![\w\.])"); 27 | if (m.Success) 28 | { 29 | try 30 | { 31 | converted = Byte.Parse(m.Value); 32 | } 33 | catch (Exception) 34 | { 35 | converted = null; 36 | return -1; 37 | } 38 | return m.Length; 39 | } 40 | 41 | // Default 42 | converted = null; 43 | return -1; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultDataTypes/MPDecimal.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text.RegularExpressions; 4 | 5 | namespace MultiParse.Default 6 | { 7 | public class MPDecimal : MPDataType 8 | { 9 | 10 | /// 11 | /// Constructor 12 | /// 13 | public MPDecimal() 14 | { 15 | } 16 | 17 | /// 18 | /// Read a decimal 19 | /// 20 | /// 21 | /// 22 | /// 23 | /// 24 | public override int Match(string expression, object previousToken, out object converted) 25 | { 26 | string sign = @"^"; 27 | if (IsUnary(previousToken)) 28 | sign = @"^[\+\-]?"; 29 | 30 | // Match an integer 31 | Match m = Regex.Match(expression, sign + @"\d+[mM]?(?![\w\.])"); 32 | if (m.Success) 33 | { 34 | try 35 | { 36 | converted = Decimal.Parse(m.Value, System.Globalization.CultureInfo.InvariantCulture); 37 | } 38 | catch (Exception) 39 | { 40 | converted = null; 41 | return -1; 42 | } 43 | return m.Length; 44 | } 45 | 46 | // Default 47 | converted = null; 48 | return -1; 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultDataTypes/MPDouble.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text.RegularExpressions; 4 | 5 | namespace MultiParse.Default 6 | { 7 | public class MPDouble : MPDataType 8 | { 9 | 10 | /// 11 | /// Constructor 12 | /// 13 | public MPDouble() 14 | : base() 15 | { 16 | } 17 | 18 | /// 19 | /// Find a double 20 | /// 21 | /// 22 | /// 23 | /// 24 | /// 25 | public override int Match(string expression, object previousToken, out object convertedToken) 26 | { 27 | string sign = @""; 28 | if (IsUnary(previousToken)) 29 | sign = @"[\+\-]?"; 30 | 31 | Match m = Regex.Match(expression, @"^(?" + sign + @"\d+(\.\d+)?)([eE](?[\-\+]?\d+))?(?![\w\.])"); 32 | if (m.Success) 33 | { 34 | try 35 | { 36 | if (m.Groups["exponent"].Success) 37 | { 38 | // Scientific notation 39 | convertedToken = Double.Parse(m.Groups["mantissa"] + "E" + m.Groups["exponent"], System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture); 40 | return m.Length; 41 | } 42 | else 43 | { 44 | // No scientific notation 45 | convertedToken = Double.Parse(m.Groups["mantissa"].Value, System.Globalization.CultureInfo.InvariantCulture); 46 | return m.Length; 47 | } 48 | } 49 | catch (Exception) 50 | { 51 | convertedToken = null; 52 | return -1; 53 | } 54 | } 55 | 56 | // Default 57 | convertedToken = null; 58 | return -1; 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultDataTypes/MPInt16.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text.RegularExpressions; 4 | 5 | namespace MultiParse.Default 6 | { 7 | /// 8 | /// A class able to parse (positive) integers 9 | /// 10 | public class MPInt16 : MPDataType 11 | { 12 | /// 13 | /// Matches an integer at the start of an expression and removes it afterwards 14 | /// 15 | /// 16 | /// 17 | /// 18 | /// 19 | public override int Match(string expression, object previousToken, out object converted) 20 | { 21 | string sign = @"^"; 22 | if (IsUnary(previousToken)) 23 | sign = @"^[\+\-]?"; 24 | 25 | // Match an integer 26 | Match m = Regex.Match(expression, sign + @"\d+(?![\w\.])"); 27 | if (m.Success) 28 | { 29 | try 30 | { 31 | converted = Int16.Parse(m.Value); 32 | } 33 | catch (Exception) 34 | { 35 | converted = null; 36 | return -1; 37 | } 38 | return m.Length; 39 | } 40 | 41 | // Default 42 | converted = null; 43 | return -1; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultDataTypes/MPInt32.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text.RegularExpressions; 3 | 4 | namespace MultiParse.Default 5 | { 6 | /// 7 | /// A class able to parse integers 8 | /// 9 | public class MPInt32 : MPDataType 10 | { 11 | /// 12 | /// Matches an integer at the start of an expression and removes it afterwards 13 | /// 14 | /// The expression that possibly starts with a token representing an integer 15 | /// The last parsed token 16 | /// Contains the converted token 17 | /// 18 | public override int Match(string expression, object previousToken, out object converted) 19 | { 20 | string sign = @"^"; 21 | if (IsUnary(previousToken)) 22 | sign = @"^[\+\-]?"; 23 | 24 | // Match an integer 25 | Match m = Regex.Match(expression, sign + @"\d+(?![\w\.])"); 26 | if (m.Success) 27 | { 28 | try 29 | { 30 | converted = Int32.Parse(m.Value); 31 | } 32 | catch (Exception) 33 | { 34 | converted = null; 35 | return -1; 36 | } 37 | return m.Length; 38 | } 39 | 40 | // Default 41 | converted = null; 42 | return -1; 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultDataTypes/MPInt64.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text.RegularExpressions; 4 | 5 | namespace MultiParse.Default 6 | { 7 | /// 8 | /// A class able to parse (positive) integers 9 | /// 10 | public class MPInt64 : MPDataType 11 | { 12 | /// 13 | /// Matches an integer at the start of an expression and removes it afterwards 14 | /// 15 | /// 16 | /// 17 | /// 18 | /// 19 | public override int Match(string expression, object previousToken, out object converted) 20 | { 21 | string sign = @""; 22 | if (IsUnary(previousToken)) 23 | sign = @"[\+\-]?"; 24 | 25 | // Match an integer 26 | Match m = Regex.Match(expression, @"^(?" + sign + @"\d+)[lL]?(?![\w\.])"); 27 | if (m.Success) 28 | { 29 | try 30 | { 31 | converted = Int64.Parse(m.Groups["value"].Value); 32 | } 33 | catch (Exception) 34 | { 35 | converted = null; 36 | return -1; 37 | } 38 | return m.Length; 39 | } 40 | 41 | // Default 42 | converted = null; 43 | return -1; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultDataTypes/MPSByte.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text.RegularExpressions; 4 | 5 | namespace MultiParse.Default 6 | { 7 | /// 8 | /// A class able to parse (positive) integers 9 | /// 10 | public class MPSByte : MPDataType 11 | { 12 | /// 13 | /// Matches an integer at the start of an expression and removes it afterwards 14 | /// 15 | /// 16 | /// 17 | /// 18 | /// 19 | public override int Match(string expression, object previousToken, out object converted) 20 | { 21 | string sign = @"^"; 22 | if (IsUnary(previousToken)) 23 | sign = @"^[\+\-]?"; 24 | 25 | // Match an integer 26 | Match m = Regex.Match(expression, sign + @"\d+(?![\w\.])"); 27 | if (m.Success) 28 | { 29 | try 30 | { 31 | converted = SByte.Parse(m.Value); 32 | } 33 | catch (Exception) 34 | { 35 | converted = null; 36 | return -1; 37 | } 38 | return m.Length; 39 | } 40 | 41 | // Default 42 | converted = null; 43 | return -1; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultDataTypes/MPSingle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text.RegularExpressions; 4 | 5 | namespace MultiParse.Default 6 | { 7 | public class MPSingle : MPDataType 8 | { 9 | 10 | /// 11 | /// Constructor 12 | /// 13 | public MPSingle() 14 | : base() 15 | { 16 | } 17 | 18 | /// 19 | /// Find a double 20 | /// 21 | /// 22 | /// 23 | /// 24 | /// 25 | public override int Match(string expression, object previousToken, out object convertedToken) 26 | { 27 | string sign = @""; 28 | if (IsUnary(previousToken)) 29 | sign = @"[\+\-]?"; 30 | 31 | Match m = Regex.Match(expression, @"^(?" + sign + @"\d+(\.\d+)?)([eE](?[\-\+]?\d+))?[fF]?(?![\w\.])"); 32 | if (m.Success) 33 | { 34 | try 35 | { 36 | if (m.Groups["exponent"].Success) 37 | { 38 | // Scientific notation 39 | convertedToken = Single.Parse(m.Groups["mantissa"] + "E" + m.Groups["exponent"], System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture); 40 | return m.Length; 41 | } 42 | else 43 | { 44 | // No scientific notation 45 | convertedToken = Single.Parse(m.Groups["mantissa"].Value, System.Globalization.CultureInfo.InvariantCulture); 46 | return m.Length; 47 | } 48 | } 49 | catch (Exception) 50 | { 51 | 52 | convertedToken = null; 53 | return -1; 54 | } 55 | } 56 | 57 | // Default 58 | convertedToken = null; 59 | return -1; 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultDataTypes/MPUInt16.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text.RegularExpressions; 4 | 5 | namespace MultiParse.Default 6 | { 7 | /// 8 | /// A class able to parse (positive) integers 9 | /// 10 | public class MPUInt16 : MPDataType 11 | { 12 | /// 13 | /// Matches an integer at the start of an expression and removes it afterwards 14 | /// 15 | /// 16 | /// 17 | /// 18 | /// 19 | public override int Match(string expression, object previousToken, out object converted) 20 | { 21 | string sign = @"^"; 22 | if (IsUnary(previousToken)) 23 | sign = @"^\+?"; 24 | 25 | // Match an integer 26 | Match m = Regex.Match(expression, sign + @"\d+(?![\w\.])"); 27 | if (m.Success) 28 | { 29 | try 30 | { 31 | converted = UInt16.Parse(m.Value); 32 | } 33 | catch (Exception) 34 | { 35 | converted = null; 36 | return -1; 37 | } 38 | return m.Length; 39 | } 40 | 41 | // Default 42 | converted = null; 43 | return -1; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultDataTypes/MPUInt32.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text.RegularExpressions; 4 | 5 | namespace MultiParse.Default 6 | { 7 | /// 8 | /// A class able to parse (positive) integers 9 | /// 10 | public class MPUInt32 : MPDataType 11 | { 12 | /// 13 | /// Matches an integer at the start of an expression and removes it afterwards 14 | /// 15 | /// 16 | /// 17 | /// 18 | /// 19 | public override int Match(string expression, object previousToken, out object converted) 20 | { 21 | string sign = @""; 22 | if (IsUnary(previousToken)) 23 | sign = @"\+?"; 24 | 25 | // Match an integer 26 | Match m = Regex.Match(expression, @"^(?" + sign + @"\d+)[uU]?(?![\w\.])"); 27 | if (m.Success) 28 | { 29 | try 30 | { 31 | converted = UInt32.Parse(m.Groups["value"].Value); 32 | } 33 | catch (Exception) 34 | { 35 | converted = null; 36 | return -1; 37 | } 38 | return m.Length; 39 | } 40 | 41 | // Default 42 | converted = null; 43 | return -1; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultDataTypes/MPUInt64.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text.RegularExpressions; 4 | 5 | namespace MultiParse.Default 6 | { 7 | /// 8 | /// A class able to parse (positive) integers 9 | /// 10 | public class MPUInt64 : MPDataType 11 | { 12 | /// 13 | /// Matches an integer at the start of an expression and removes it afterwards 14 | /// 15 | /// 16 | /// 17 | /// 18 | /// 19 | public override int Match(string expression, object previousToken, out object converted) 20 | { 21 | string sign = @"^"; 22 | if (IsUnary(previousToken)) 23 | sign = @"^\+?"; 24 | 25 | // Match an integer 26 | Match m = Regex.Match(expression, @"^(?" + sign + @"\d+)([uU][lL]|[lL][uU])?(?![\w\.])"); 27 | if (m.Success) 28 | { 29 | try 30 | { 31 | converted = UInt64.Parse(m.Groups["value"].Value); 32 | } 33 | catch (Exception) 34 | { 35 | converted = null; 36 | return -1; 37 | } 38 | return m.Length; 39 | } 40 | 41 | // Default 42 | converted = null; 43 | return -1; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultFunctions/MPAbs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MultiParse.Default 5 | { 6 | public class MPAbs : MPFunction 7 | { 8 | 9 | /// 10 | /// Constructor 11 | /// 12 | public MPAbs() 13 | : base("[aA]bs", false) 14 | { 15 | } 16 | 17 | /// 18 | /// Execute absolute value 19 | /// 20 | /// 21 | /// 22 | public override void Execute(Stack output, int arguments) 23 | { 24 | if (arguments != 1) 25 | throw new InvalidArgumentCountException(1, "Abs()"); 26 | 27 | // Pop object from the stack 28 | object top = PopOrGet(output); 29 | Abs(output, top); 30 | } 31 | 32 | /// 33 | /// Absolute value 34 | /// 35 | /// 36 | /// 37 | public void Abs(Stack output, object arg) 38 | { 39 | TypeCode tc = Type.GetTypeCode(arg.GetType()); 40 | switch (tc) 41 | { 42 | case TypeCode.Byte: output.Push(Math.Abs((Byte)arg)); return; 43 | case TypeCode.Char: output.Push(Math.Abs((Char)arg)); return; 44 | case TypeCode.Decimal: output.Push(Math.Abs((Decimal)arg)); return; 45 | case TypeCode.Double: output.Push(Math.Abs((Double)arg)); return; 46 | case TypeCode.Int16: output.Push(Math.Abs((Int16)arg)); return; 47 | case TypeCode.Int32: output.Push(Math.Abs((Int32)arg)); return; 48 | case TypeCode.Int64: output.Push(Math.Abs((Int64)arg)); return; 49 | case TypeCode.SByte: output.Push(Math.Abs((SByte)arg)); return; 50 | case TypeCode.Single: output.Push(Math.Abs((Single)arg)); return; 51 | case TypeCode.UInt16: output.Push(Math.Abs((UInt16)arg)); return; 52 | case TypeCode.UInt32: output.Push(Math.Abs((UInt32)arg)); return; 53 | } 54 | 55 | // Invalid operation 56 | throw new InvalidArgumentTypeException("Abs()", arg); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultFunctions/MPAcos.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MultiParse.Default 5 | { 6 | public class MPAcos : MPFunction 7 | { 8 | 9 | /// 10 | /// Constructor 11 | /// 12 | public MPAcos() 13 | : base("[aA]cos", false) 14 | { 15 | } 16 | 17 | /// 18 | /// Execute Acos 19 | /// 20 | /// 21 | /// 22 | public override void Execute(Stack output, int arguments) 23 | { 24 | // check number of arguments 25 | if (arguments != 1) 26 | throw new InvalidArgumentCountException(1, "Acos()"); 27 | object top = PopOrGet(output); 28 | Acos(output, top); 29 | } 30 | 31 | /// 32 | /// Arc cosine 33 | /// 34 | /// 35 | /// 36 | public void Acos(Stack output, object arg) 37 | { 38 | // Calculate 39 | double v; 40 | if (CastImplicit(arg, out v)) 41 | output.Push(Math.Acos(v)); 42 | else 43 | throw new InvalidArgumentTypeException("Acos()", arg); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultFunctions/MPAsin.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MultiParse.Default 5 | { 6 | public class MPAsin : MPFunction 7 | { 8 | 9 | /// 10 | /// Constructor 11 | /// 12 | public MPAsin() 13 | : base("[aA]sin", false) 14 | { 15 | } 16 | 17 | /// 18 | /// Execute Asin 19 | /// 20 | /// 21 | /// 22 | public override void Execute(Stack output, int arguments) 23 | { 24 | // check number of arguments 25 | if (arguments != 1) 26 | throw new InvalidArgumentCountException(1, "Asin()"); 27 | object top = PopOrGet(output); 28 | Asin(output, top); 29 | } 30 | 31 | /// 32 | /// Arc sine 33 | /// 34 | /// 35 | /// 36 | public void Asin(Stack output, object arg) 37 | { 38 | // Calculate 39 | double v; 40 | if (CastImplicit(arg, out v)) 41 | output.Push(Math.Asin(v)); 42 | else 43 | throw new InvalidArgumentTypeException("Asin()", arg); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultFunctions/MPAtan.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MultiParse.Default 5 | { 6 | public class MPAtan : MPFunction 7 | { 8 | 9 | /// 10 | /// Constructor 11 | /// 12 | public MPAtan() 13 | : base("[aA]tan", false) 14 | { 15 | } 16 | 17 | /// 18 | /// Execute Atan 19 | /// 20 | /// 21 | /// 22 | public override void Execute(Stack output, int arguments) 23 | { 24 | // check number of arguments 25 | if (arguments != 1) 26 | throw new InvalidArgumentCountException(1, "Atan()"); 27 | object top = PopOrGet(output); 28 | Atan(output, top); 29 | } 30 | 31 | /// 32 | /// Arc tangent 33 | /// 34 | /// 35 | /// 36 | public void Atan(Stack output, object arg) 37 | { 38 | // Calculate 39 | double v; 40 | if (CastImplicit(arg, out v)) 41 | output.Push(Math.Atan(v)); 42 | else 43 | throw new InvalidArgumentTypeException("Atan()", arg); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultFunctions/MPAtan2.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MultiParse.Default 5 | { 6 | public class MPAtan2 : MPFunction 7 | { 8 | /// 9 | /// Constructor 10 | /// 11 | public MPAtan2() 12 | : base("[aA]tan2", false) 13 | { 14 | } 15 | 16 | /// 17 | /// Execute the atan2 function 18 | /// 19 | /// 20 | public override void Execute(Stack output, int arguments) 21 | { 22 | if (arguments != 2) 23 | throw new ParseException("Invalid number of arguments for Atan2(). 2 arguments expected."); 24 | 25 | // Pop two objects from the stack 26 | object right = PopOrGet(output); 27 | object left = PopOrGet(output); 28 | Atan2(output, left, right); 29 | } 30 | 31 | /// 32 | /// Arc tangent 2 33 | /// 34 | /// 35 | /// 36 | /// 37 | public void Atan2(Stack output, object left, object right) 38 | { 39 | // Only doubles are possible 40 | double a, b; 41 | if (CastImplicit(left, out a) && CastImplicit(right, out b)) 42 | output.Push(Math.Atan2(a, b)); 43 | else 44 | throw new InvalidArgumentTypeException("Atan2()", left, right); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultFunctions/MPCeiling.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MultiParse.Default 5 | { 6 | public class MPCeiling : MPFunction 7 | { 8 | 9 | /// 10 | /// Constructor 11 | /// 12 | public MPCeiling() 13 | : base("[cC]eil", false) 14 | { 15 | } 16 | 17 | /// 18 | /// Execute rounding 19 | /// 20 | /// 21 | /// 22 | public override void Execute(Stack output, int arguments) 23 | { 24 | // Ceiling accepts one or 2 parameters 25 | if (arguments != 1 && arguments != 2) 26 | throw new InvalidArgumentCountException(1, 2, "Ceil()"); 27 | object top = PopOrGet(output); 28 | Ceiling(output, top); 29 | } 30 | 31 | /// 32 | /// Ceiling 33 | /// 34 | /// 35 | /// 36 | public void Ceiling(Stack output, object arg) 37 | { 38 | // The first argument is either a double or decimal 39 | double dbl; 40 | decimal dec; 41 | bool dblok = CastImplicit(arg, out dbl); 42 | bool decok = CastImplicit(arg, out dec); 43 | 44 | // Check 45 | if (dblok && decok) 46 | throw new ParseException("The call to Ceil() is ambiguous for the type '" + arg.GetType() + "'"); 47 | 48 | if (dblok) 49 | output.Push(Math.Ceiling(dbl)); 50 | else if (decok) 51 | output.Push(Math.Ceiling(dec)); 52 | else 53 | throw new InvalidArgumentTypeException("Ceil()", arg); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultFunctions/MPCos.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MultiParse.Default 5 | { 6 | public class MPCos : MPFunction 7 | { 8 | 9 | /// 10 | /// Constructor 11 | /// 12 | public MPCos() 13 | : base("[cC]os", false) 14 | { 15 | } 16 | 17 | /// 18 | /// Execute Asin 19 | /// 20 | /// 21 | /// 22 | public override void Execute(Stack output, int arguments) 23 | { 24 | // check number of arguments 25 | if (arguments != 1) 26 | throw new InvalidArgumentCountException(1, "Cos()"); 27 | object top = PopOrGet(output); 28 | Cos(output, top); 29 | } 30 | 31 | /// 32 | /// Cosine 33 | /// 34 | /// 35 | /// 36 | public void Cos(Stack output, object arg) 37 | { 38 | // Calculate 39 | double v; 40 | if (CastImplicit(arg, out v)) 41 | output.Push(Math.Cos(v)); 42 | else 43 | throw new InvalidArgumentTypeException("Cos()", arg); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultFunctions/MPCosh.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MultiParse.Default 5 | { 6 | public class MPCosh : MPFunction 7 | { 8 | 9 | /// 10 | /// Constructor 11 | /// 12 | public MPCosh() 13 | : base("[cC]osh", false) 14 | { 15 | } 16 | 17 | /// 18 | /// Execute Cosh 19 | /// 20 | /// 21 | /// 22 | public override void Execute(Stack output, int arguments) 23 | { 24 | // check number of arguments 25 | if (arguments != 1) 26 | throw new InvalidArgumentCountException(1, "Cosh()"); 27 | object top = PopOrGet(output); 28 | Cosh(output, top); 29 | } 30 | 31 | /// 32 | /// Cosine hyperbolic 33 | /// 34 | /// 35 | /// 36 | public void Cosh(Stack output, object arg) 37 | { 38 | // Calculate 39 | double v; 40 | if (CastImplicit(arg, out v)) 41 | output.Push(Math.Cosh(v)); 42 | else 43 | throw new InvalidArgumentTypeException("Cosh()", arg); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultFunctions/MPExp.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MultiParse.Default 5 | { 6 | public class MPExp : MPFunction 7 | { 8 | 9 | /// 10 | /// Constructor 11 | /// 12 | public MPExp() 13 | : base("[eE]xp", false) 14 | { 15 | } 16 | 17 | /// 18 | /// Execute Exp 19 | /// 20 | /// 21 | /// 22 | public override void Execute(Stack output, int arguments) 23 | { 24 | // check number of arguments 25 | if (arguments != 1) 26 | throw new InvalidArgumentCountException(1, "Exp()"); 27 | object top = PopOrGet(output); 28 | Exp(output, top); 29 | } 30 | 31 | /// 32 | /// Exponent 33 | /// 34 | /// 35 | /// 36 | public void Exp(Stack output, object arg) 37 | { 38 | // Calculate 39 | double v; 40 | if (CastImplicit(arg, out v)) 41 | output.Push(Math.Exp(v)); 42 | else 43 | throw new InvalidArgumentTypeException("Exp()", arg); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultFunctions/MPExp2.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MultiParse.Default 5 | { 6 | public class MPExp2 : MPFunction 7 | { 8 | 9 | /// 10 | /// Constructor 11 | /// 12 | public MPExp2() 13 | : base("[eE]xp2", false) 14 | { 15 | } 16 | 17 | /// 18 | /// Execute Exp2 19 | /// 20 | /// 21 | /// 22 | public override void Execute(Stack output, int arguments) 23 | { 24 | // check number of arguments 25 | if (arguments != 1) 26 | throw new InvalidArgumentCountException(1, "Exp2()"); 27 | object top = PopOrGet(output); 28 | Exp2(output, top); 29 | } 30 | 31 | /// 32 | /// Exponent Base 2 33 | /// 34 | /// 35 | /// 36 | public void Exp2(Stack output, object arg) 37 | { 38 | // Calculate 39 | double v; 40 | if (CastImplicit(arg, out v)) 41 | output.Push(Math.Pow(2.0, v)); 42 | else 43 | throw new InvalidArgumentTypeException("Exp2()", arg); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultFunctions/MPFloor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MultiParse.Default 5 | { 6 | public class MPFloor : MPFunction 7 | { 8 | 9 | /// 10 | /// Constructor 11 | /// 12 | public MPFloor() 13 | : base("[fF]loor", false) 14 | { 15 | } 16 | 17 | /// 18 | /// Execute rounding 19 | /// 20 | /// 21 | /// 22 | public override void Execute(Stack output, int arguments) 23 | { 24 | // Floor accepts one or 2 parameters 25 | if (arguments != 1) 26 | throw new InvalidArgumentCountException(1, 2, "Floor()"); 27 | object top = PopOrGet(output); 28 | Floor(output, top); 29 | } 30 | 31 | /// 32 | /// Floor 33 | /// 34 | /// 35 | /// 36 | public void Floor(Stack output, object arg) 37 | { 38 | // The first argument is either a double or decimal 39 | double dbl; 40 | decimal dec; 41 | bool dblok = CastImplicit(arg, out dbl); 42 | bool decok = CastImplicit(arg, out dec); 43 | 44 | // Check 45 | if (dblok && decok) 46 | throw new ParseException("The call to Floor() is ambiguous for the type '" + arg.GetType() + "'"); 47 | 48 | if (dblok) 49 | output.Push(Math.Floor(dbl)); 50 | else if (decok) 51 | output.Push(Math.Floor(dec)); 52 | else 53 | throw new InvalidArgumentTypeException("Floor()", arg); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultFunctions/MPIn0.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MultiParse.Default 5 | { 6 | public class MPIn0 : MPFunction 7 | { 8 | 9 | /// 10 | /// Constructor 11 | /// 12 | public MPIn0() 13 | : base("[iI]n0", false) 14 | { 15 | } 16 | 17 | /// 18 | /// 19 | /// 20 | /// 21 | public override void Execute(Stack output, int arguments) 22 | { 23 | if (arguments != 0) 24 | throw new InvalidArgumentCountException(0, "In0()"); 25 | 26 | output.Push((double)Expression.In0); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultFunctions/MPIn1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MultiParse.Default 5 | { 6 | public class MPIn1 : MPFunction 7 | { 8 | 9 | /// 10 | /// Constructor 11 | /// 12 | public MPIn1() 13 | : base("[iI]n1", false) 14 | { 15 | } 16 | 17 | /// 18 | /// 19 | /// 20 | /// 21 | public override void Execute(Stack output, int arguments) 22 | { 23 | if (arguments != 0) 24 | throw new InvalidArgumentCountException(0, "In1()"); 25 | 26 | output.Push((double)Expression.In1); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultFunctions/MPLerp.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MultiParse.Default 5 | { 6 | public class MPLerp : MPFunction 7 | { 8 | /// 9 | /// Constructor 10 | /// 11 | public MPLerp() 12 | : base("[lL]erp", false) 13 | { 14 | } 15 | 16 | /// 17 | /// Execute the max function 18 | /// 19 | /// 20 | public override void Execute(Stack output, int arguments) 21 | { 22 | if (arguments != 3) 23 | throw new InvalidArgumentCountException(3, "Lerp()"); 24 | 25 | // Pop two objects from the stack 26 | object t = PopOrGet(output); 27 | object y = PopOrGet(output); 28 | object x = PopOrGet(output); 29 | Lerp(output, x, y, t); 30 | } 31 | 32 | /// 33 | /// Maximum value 34 | /// 35 | /// 36 | /// 37 | /// 38 | public void Lerp(Stack output, object x, object y, object t) 39 | { 40 | // Default implementation depends on the typecodes 41 | TypeCode tx = Type.GetTypeCode(x.GetType()); 42 | TypeCode ty = Type.GetTypeCode(y.GetType()); 43 | TypeCode tt = Type.GetTypeCode(t.GetType()); 44 | 45 | if (tx != TypeCode.Double || ty != TypeCode.Double || tt != TypeCode.Double) 46 | throw new InvalidArgumentTypeException("Lerp()", x, y, t); 47 | 48 | output.Push((double)x + ((double)y-(double)x)*(double)t); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultFunctions/MPLog.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MultiParse.Default 5 | { 6 | public class MPLog : MPFunction 7 | { 8 | /// 9 | /// Constructor 10 | /// 11 | public MPLog() 12 | : base("[lL]og", false) 13 | { 14 | } 15 | 16 | /// 17 | /// Execute logarithm 18 | /// 19 | /// 20 | /// 21 | public override void Execute(Stack output, int arguments) 22 | { 23 | // This function needs two arguments 24 | object val, b; 25 | switch (arguments) 26 | { 27 | case 1: 28 | val = PopOrGet(output); 29 | Log(output, val); 30 | break; 31 | case 2: 32 | b = PopOrGet(output); 33 | val = PopOrGet(output); 34 | Log(output, val, b); 35 | break; 36 | default: 37 | throw new InvalidArgumentCountException(1, 2, "Log()"); 38 | } 39 | } 40 | 41 | /// 42 | /// Logarithm 43 | /// 44 | /// 45 | /// 46 | public void Log(Stack output, object arg) 47 | { 48 | double d; 49 | if (CastImplicit(arg, out d)) 50 | output.Push(Math.Log(d)); 51 | else 52 | throw new InvalidArgumentTypeException("Log()", arg); 53 | } 54 | 55 | /// 56 | /// Logarithm 57 | /// 58 | /// 59 | /// 60 | /// 61 | public void Log(Stack output, object left, object right) 62 | { 63 | double d, b; 64 | if (CastImplicit(left, out d) && CastImplicit(right, out b)) 65 | output.Push(Math.Log(d, b)); 66 | else 67 | throw new InvalidArgumentTypeException("Log()", left, right); 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultFunctions/MPLog10.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MultiParse.Default 5 | { 6 | public class MPLog10 : MPFunction 7 | { 8 | 9 | /// 10 | /// Constructor 11 | /// 12 | public MPLog10() 13 | : base("[lL]og10", false) 14 | { 15 | } 16 | 17 | /// 18 | /// Execute Log10 19 | /// 20 | /// 21 | /// 22 | public override void Execute(Stack output, int arguments) 23 | { 24 | // check number of arguments 25 | if (arguments != 1) 26 | throw new InvalidArgumentCountException(1, "Log10()"); 27 | object top = PopOrGet(output); 28 | Log10(output, top); 29 | } 30 | 31 | /// 32 | /// Logarithm base 10 33 | /// 34 | /// 35 | /// 36 | public void Log10(Stack output, object arg) 37 | { 38 | // Calculate 39 | double v; 40 | if (CastImplicit(arg, out v)) 41 | output.Push(Math.Log10(v)); 42 | else 43 | throw new InvalidArgumentTypeException("Log10()", arg); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultFunctions/MPLog2.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MultiParse.Default 5 | { 6 | public class MPLog2 : MPFunction 7 | { 8 | 9 | /// 10 | /// Constructor 11 | /// 12 | public MPLog2() 13 | : base("[lL]og2", false) 14 | { 15 | } 16 | 17 | /// 18 | /// Execute Log2 19 | /// 20 | /// 21 | /// 22 | public override void Execute(Stack output, int arguments) 23 | { 24 | // check number of arguments 25 | if (arguments != 1) 26 | throw new InvalidArgumentCountException(1, "Log2()"); 27 | object top = PopOrGet(output); 28 | Log2(output, top); 29 | } 30 | 31 | /// 32 | /// Logarithm base 10 33 | /// 34 | /// 35 | /// 36 | public void Log2(Stack output, object arg) 37 | { 38 | // Calculate 39 | double v; 40 | if (CastImplicit(arg, out v)) 41 | output.Push(Math.Log(v, 2.0)); 42 | else 43 | throw new InvalidArgumentTypeException("Log2()", arg); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultFunctions/MPMaxTime.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MultiParse.Default 5 | { 6 | public class MPMaxTime : MPFunction 7 | { 8 | 9 | /// 10 | /// Constructor 11 | /// 12 | public MPMaxTime() 13 | : base("[mM]axtime", false) 14 | { 15 | } 16 | 17 | /// 18 | /// 19 | /// 20 | /// 21 | public override void Execute(Stack output, int arguments) 22 | { 23 | if (arguments != 2) 24 | throw new InvalidArgumentCountException(2, "MaxTime()"); 25 | 26 | // Pop two objects from the stack 27 | object func = PopOrGet(output); 28 | object time = PopOrGet(output); 29 | // if the time is still in limits, push the function again 30 | if ((double)Expression.Time < (double)time) 31 | output.Push(func); 32 | else 33 | output.Push((double)0.0); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultFunctions/MPPi.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MultiParse.Default 5 | { 6 | public class MPPi : MPFunction 7 | { 8 | 9 | /// 10 | /// Constructor 11 | /// 12 | public MPPi() 13 | : base("[pP]i", false) 14 | { 15 | } 16 | 17 | // need custom match for 0 argument functions 18 | public override int Match(string expression, object previousToken) 19 | { 20 | int len = base.Match(expression, previousToken); 21 | //if (len != -1) 22 | // len += 2; 23 | return len; 24 | } 25 | 26 | /// 27 | /// 28 | /// 29 | /// 30 | public override void Execute(Stack output, int arguments) 31 | { 32 | if (arguments != 0) 33 | throw new InvalidArgumentCountException(0, "Pi()"); 34 | 35 | output.Push((double)(Math.PI)); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultFunctions/MPPow.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MultiParse.Default 5 | { 6 | public class MPPow : MPFunction 7 | { 8 | /// 9 | /// Constructor 10 | /// 11 | public MPPow() 12 | : base("[pP]ow", false) 13 | { 14 | } 15 | 16 | /// 17 | /// Execute the atan2 function 18 | /// 19 | /// 20 | public override void Execute(Stack output, int arguments) 21 | { 22 | if (arguments != 2) 23 | throw new ParseException("Invalid number of arguments for Pow(). 2 arguments expected."); 24 | 25 | // Pop two objects from the stack 26 | object right = PopOrGet(output); 27 | object left = PopOrGet(output); 28 | Pow(output, left, right); 29 | } 30 | 31 | /// 32 | /// Power 33 | /// 34 | /// 35 | /// 36 | /// 37 | public void Pow(Stack output, object left, object right) 38 | { 39 | // Only doubles are possible 40 | double a, b; 41 | if (CastImplicit(left, out a) && CastImplicit(right, out b)) 42 | output.Push(Math.Pow(a, b)); 43 | else 44 | throw new InvalidArgumentTypeException("Pow()", left, right); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultFunctions/MPPulse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MultiParse.Default 5 | { 6 | public class MPPulse : MPFunction 7 | { 8 | /// 9 | /// Constructor 10 | /// 11 | public MPPulse() 12 | : base("[pP]ulse", false) 13 | { 14 | } 15 | 16 | /// 17 | /// Execute the max function 18 | /// 19 | /// 20 | public override void Execute(Stack output, int arguments) 21 | { 22 | if (arguments != 2) 23 | throw new InvalidArgumentCountException(2, "MPPulse()"); 24 | 25 | // Pop two objects from the stack 26 | object color = PopOrGet(output); 27 | object phase = PopOrGet(output); 28 | Pulse(output, phase, color); 29 | } 30 | 31 | /// 32 | /// Maximum value 33 | /// 34 | /// 35 | /// 36 | /// 37 | public void Pulse(Stack output, object phase, object color) 38 | { 39 | double p, c; 40 | if (CastImplicit(phase, out p) && CastImplicit(color, out c)) 41 | { 42 | if (p > c) 43 | output.Push((double)-1.0); 44 | else 45 | output.Push((double)1.0); 46 | } 47 | else 48 | throw new InvalidArgumentTypeException("MPPulse()", phase, color); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultFunctions/MPRand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MultiParse.Default 5 | { 6 | public class MPRand : MPFunction 7 | { 8 | 9 | static Random rand = new Random(); 10 | 11 | /// 12 | /// Constructor 13 | /// 14 | public MPRand() 15 | : base("[rR]and", false) 16 | { 17 | } 18 | 19 | /// 20 | /// 21 | /// 22 | /// 23 | public override void Execute(Stack output, int arguments) 24 | { 25 | if (arguments != 0) 26 | throw new InvalidArgumentCountException(0, "Rand()"); 27 | output.Push((double)(rand.NextDouble() * 2.0 - 1.0)); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultFunctions/MPSign.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MultiParse.Default 5 | { 6 | public class MPSign : MPFunction 7 | { 8 | 9 | /// 10 | /// Constructor 11 | /// 12 | public MPSign() 13 | : base("[sS]ign", false) 14 | { 15 | } 16 | 17 | /// 18 | /// Execute sign operator 19 | /// 20 | /// 21 | /// 22 | public override void Execute(Stack output, int arguments) 23 | { 24 | // Expects 1 parameter 25 | if (arguments != 1) 26 | throw new InvalidArgumentCountException(1, "Sign()"); 27 | 28 | // Pop object from the stack 29 | object top = PopOrGet(output); 30 | Sign(output, top); 31 | } 32 | 33 | /// 34 | /// Sign 35 | /// 36 | /// 37 | /// 38 | public void Sign(Stack output, object arg) 39 | { 40 | TypeCode tc = Type.GetTypeCode(arg.GetType()); 41 | switch (tc) 42 | { 43 | case TypeCode.Byte: output.Push(Math.Sign((Byte)arg)); return; 44 | case TypeCode.Char: output.Push(Math.Sign((Char)arg)); return; 45 | case TypeCode.Decimal: output.Push(Math.Sign((Decimal)arg)); return; 46 | case TypeCode.Double: output.Push(Math.Sign((Double)arg)); return; 47 | case TypeCode.Int16: output.Push(Math.Sign((Int16)arg)); return; 48 | case TypeCode.Int32: output.Push(Math.Sign((Int32)arg)); return; 49 | case TypeCode.Int64: output.Push(Math.Sign((Int64)arg)); return; 50 | case TypeCode.SByte: output.Push(Math.Sign((SByte)arg)); return; 51 | case TypeCode.Single: output.Push(Math.Sign((Single)arg)); return; 52 | case TypeCode.UInt16: output.Push(Math.Sign((UInt16)arg)); return; 53 | case TypeCode.UInt32: output.Push(Math.Sign((UInt32)arg)); return; 54 | } 55 | 56 | // Invalid operation 57 | throw new InvalidArgumentTypeException("Sign()", arg); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultFunctions/MPSin.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MultiParse.Default 5 | { 6 | public class MPSin : MPFunction 7 | { 8 | 9 | /// 10 | /// Constructor 11 | /// 12 | public MPSin() 13 | : base("[sS]in", false) 14 | { 15 | } 16 | 17 | /// 18 | /// Execute Asin 19 | /// 20 | /// 21 | /// 22 | public override void Execute(Stack output, int arguments) 23 | { 24 | // check number of arguments 25 | if (arguments != 1) 26 | throw new InvalidArgumentCountException(1, "Sin()"); 27 | object top = PopOrGet(output); 28 | Sin(output, top); 29 | } 30 | 31 | /// 32 | /// Arc sine 33 | /// 34 | /// 35 | /// 36 | public void Sin(Stack output, object arg) 37 | { 38 | // Calculate 39 | double v; 40 | if (CastImplicit(arg, out v)) 41 | output.Push(Math.Sin(v)); 42 | else 43 | throw new InvalidArgumentTypeException("Sin()", arg); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultFunctions/MPSqr.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MultiParse.Default 5 | { 6 | public class MPSqr : MPFunction 7 | { 8 | 9 | /// 10 | /// Constructor 11 | /// 12 | public MPSqr() 13 | : base("[sS]qr", false) 14 | { 15 | } 16 | 17 | /// 18 | /// Execute Sqr 19 | /// 20 | /// 21 | /// 22 | public override void Execute(Stack output, int arguments) 23 | { 24 | // check number of arguments 25 | if (arguments != 1) 26 | throw new InvalidArgumentCountException(1, "Sqr()"); 27 | object top = PopOrGet(output); 28 | Sqr(output, top); 29 | } 30 | 31 | /// 32 | /// Square root 33 | /// 34 | /// 35 | /// 36 | public void Sqr(Stack output, object arg) 37 | { 38 | // Calculate 39 | double v; 40 | if (CastImplicit(arg, out v)) 41 | output.Push(v*v); 42 | else 43 | throw new InvalidArgumentTypeException("Sqr()", arg); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultFunctions/MPSqrt.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MultiParse.Default 5 | { 6 | public class MPSqrt : MPFunction 7 | { 8 | 9 | /// 10 | /// Constructor 11 | /// 12 | public MPSqrt() 13 | : base("[sS]qrt", false) 14 | { 15 | } 16 | 17 | /// 18 | /// Execute Sqrt 19 | /// 20 | /// 21 | /// 22 | public override void Execute(Stack output, int arguments) 23 | { 24 | // check number of arguments 25 | if (arguments != 1) 26 | throw new InvalidArgumentCountException(1, "Sqrt()"); 27 | object top = PopOrGet(output); 28 | Sqrt(output, top); 29 | } 30 | 31 | /// 32 | /// Square root 33 | /// 34 | /// 35 | /// 36 | public void Sqrt(Stack output, object arg) 37 | { 38 | // Calculate 39 | double v; 40 | if (CastImplicit(arg, out v)) 41 | output.Push(Math.Sqrt(v)); 42 | else 43 | throw new InvalidArgumentTypeException("Sqrt()", arg); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultFunctions/MPTan.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MultiParse.Default 5 | { 6 | public class MPTan : MPFunction 7 | { 8 | 9 | /// 10 | /// Constructor 11 | /// 12 | public MPTan() 13 | : base("[tT]an", false) 14 | { 15 | } 16 | 17 | /// 18 | /// Execute Asin 19 | /// 20 | /// 21 | /// 22 | public override void Execute(Stack output, int arguments) 23 | { 24 | // check number of arguments 25 | if (arguments != 1) 26 | throw new InvalidArgumentCountException(1, "Tan()"); 27 | object top = PopOrGet(output); 28 | Tan(output, top); 29 | } 30 | 31 | /// 32 | /// Tangent 33 | /// 34 | /// 35 | /// 36 | public void Tan(Stack output, object arg) 37 | { 38 | // Calculate 39 | double v; 40 | if (CastImplicit(arg, out v)) 41 | output.Push(Math.Tan(v)); 42 | else 43 | throw new InvalidArgumentTypeException("Tan()", arg); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultFunctions/MPTanh.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MultiParse.Default 5 | { 6 | public class MPTanh : MPFunction 7 | { 8 | 9 | /// 10 | /// Constructor 11 | /// 12 | public MPTanh() 13 | : base("[tT]anh", false) 14 | { 15 | } 16 | 17 | /// 18 | /// Execute Asin 19 | /// 20 | /// 21 | /// 22 | public override void Execute(Stack output, int arguments) 23 | { 24 | // check number of arguments 25 | if (arguments != 1) 26 | throw new InvalidArgumentCountException(1, "Tanh()"); 27 | object top = PopOrGet(output); 28 | Tanh(output, top); 29 | } 30 | 31 | /// 32 | /// Tangent hyperbolic 33 | /// 34 | /// 35 | /// 36 | public void Tanh(Stack output, object arg) 37 | { 38 | // Calculate 39 | double v; 40 | if (CastImplicit(arg, out v)) 41 | output.Push(Math.Tanh(v)); 42 | else 43 | throw new InvalidArgumentTypeException("Tanh()", arg); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultFunctions/MPTau.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MultiParse.Default 5 | { 6 | public class MPTau : MPFunction 7 | { 8 | 9 | /// 10 | /// Constructor 11 | /// 12 | public MPTau() 13 | : base("[tT]au", false) 14 | { 15 | } 16 | 17 | /// 18 | /// 19 | /// 20 | /// 21 | public override void Execute(Stack output, int arguments) 22 | { 23 | if (arguments != 0) 24 | throw new InvalidArgumentCountException(0, "Tau()"); 25 | 26 | output.Push((double)(Math.PI*2.0)); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultFunctions/MPTautime.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MultiParse.Default 5 | { 6 | public class MPTautime : MPFunction 7 | { 8 | 9 | /// 10 | /// Constructor 11 | /// 12 | public MPTautime() 13 | : base("[tT]autime", false) 14 | { 15 | } 16 | 17 | /// 18 | /// 19 | /// 20 | /// 21 | public override void Execute(Stack output, int arguments) 22 | { 23 | if (arguments != 0) 24 | throw new InvalidArgumentCountException(0, "Tautime()"); 25 | 26 | output.Push((double)(Expression.Time * Math.PI * 2.0)); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultFunctions/MPTriSaw.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MultiParse.Default 5 | { 6 | public class MPTriSaw : MPFunction 7 | { 8 | /// 9 | /// Constructor 10 | /// 11 | public MPTriSaw() 12 | : base("[tT]risaw", false) 13 | { 14 | } 15 | 16 | /// 17 | /// Execute the max function 18 | /// 19 | /// 20 | public override void Execute(Stack output, int arguments) 21 | { 22 | if (arguments != 2) 23 | throw new InvalidArgumentCountException(2, "MPTriSaw()"); 24 | 25 | // Pop two objects from the stack 26 | object color = PopOrGet(output); 27 | object phase = PopOrGet(output); 28 | TriSaw(output, phase, color); 29 | } 30 | 31 | /// 32 | /// Maximum value 33 | /// 34 | /// 35 | /// 36 | /// 37 | public void TriSaw(Stack output, object phase, object color) 38 | { 39 | double p, c; 40 | if (CastImplicit(phase, out p) && CastImplicit(color, out c)) 41 | { 42 | c = c % 1.0; 43 | if (c < 0.00001) c = 0.00001; 44 | if (c > 0.99999) c = 0.99999; 45 | if (p > c) 46 | output.Push((double)(2.0 * (1.0 - p) / (1.0 - c) - 1.0)); 47 | else 48 | output.Push((double)(2.0 * p / c - 1.0)); 49 | } 50 | else 51 | throw new InvalidArgumentTypeException("TriSaw()", phase, color); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultFunctions/MPTruncate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MultiParse.Default 5 | { 6 | public class MPTruncate : MPFunction 7 | { 8 | /// 9 | /// Constructor 10 | /// 11 | public MPTruncate() 12 | : base("[tT]runcate", false) 13 | { 14 | } 15 | 16 | /// 17 | /// Execute truncate 18 | /// 19 | /// 20 | /// 21 | public override void Execute(Stack output, int arguments) 22 | { 23 | // Expects one argument 24 | if (arguments != 1) 25 | throw new InvalidArgumentCountException(1, "Truncate()"); 26 | object top = PopOrGet(output); 27 | Truncate(output, top); 28 | } 29 | 30 | /// 31 | /// Truncate 32 | /// 33 | /// 34 | /// 35 | public void Truncate(Stack output, object arg) 36 | { 37 | // Try to convert to either decimal or double 38 | double dbl; 39 | decimal dec; 40 | bool dblok = CastImplicit(arg, out dbl); 41 | bool decok = CastImplicit(arg, out dec); 42 | 43 | // Ambiguous call 44 | if (dblok && decok) 45 | throw new ParseException("Ambiguous call to Truncate() for type '" + arg.GetType() + "'"); 46 | if (dblok) 47 | output.Push(Math.Truncate(dbl)); 48 | else if (decok) 49 | output.Push(Math.Truncate(dec)); 50 | else 51 | throw new InvalidArgumentTypeException("Truncate()", arg); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultFunctions/MPVAftertouch.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MultiParse.Default 5 | { 6 | public class MPVAftertouch : MPFunction 7 | { 8 | 9 | /// 10 | /// Constructor 11 | /// 12 | public MPVAftertouch() 13 | : base("[vV]aftertouch", false) 14 | { 15 | } 16 | 17 | /// 18 | /// 19 | /// 20 | /// 21 | public override void Execute(Stack output, int arguments) 22 | { 23 | if (arguments != 0) 24 | throw new InvalidArgumentCountException(0, "VAftertouch()"); 25 | 26 | output.Push((double)(0.5)); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultFunctions/MPVFrequency.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MultiParse.Default 5 | { 6 | public class MPVFrequency : MPFunction 7 | { 8 | 9 | /// 10 | /// Constructor 11 | /// 12 | public MPVFrequency() 13 | : base("[vV]frequency", false) 14 | { 15 | } 16 | 17 | /// 18 | /// 19 | /// 20 | /// 21 | public override void Execute(Stack output, int arguments) 22 | { 23 | if (arguments != 0) 24 | throw new InvalidArgumentCountException(0, "VFrequency()"); 25 | 26 | output.Push((double)(44.1)); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultFunctions/MPVGate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MultiParse.Default 5 | { 6 | public class MPVGate : MPFunction 7 | { 8 | 9 | /// 10 | /// Constructor 11 | /// 12 | public MPVGate() 13 | : base("[vV]gate", false) 14 | { 15 | } 16 | 17 | /// 18 | /// 19 | /// 20 | /// 21 | public override void Execute(Stack output, int arguments) 22 | { 23 | if (arguments != 0) 24 | throw new InvalidArgumentCountException(0, "VGate()"); 25 | 26 | output.Push((double)(1.0)); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultFunctions/MPVNote.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MultiParse.Default 5 | { 6 | public class MPVNote : MPFunction 7 | { 8 | 9 | /// 10 | /// Constructor 11 | /// 12 | public MPVNote() 13 | : base("[vV]note", false) 14 | { 15 | } 16 | 17 | /// 18 | /// 19 | /// 20 | /// 21 | public override void Execute(Stack output, int arguments) 22 | { 23 | if (arguments != 0) 24 | throw new InvalidArgumentCountException(0, "VNote()"); 25 | 26 | output.Push((double)(0.5)); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultFunctions/MPVTrigger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MultiParse.Default 5 | { 6 | public class MPVTrigger : MPFunction 7 | { 8 | 9 | /// 10 | /// Constructor 11 | /// 12 | public MPVTrigger() 13 | : base("[vV]trigger", false) 14 | { 15 | } 16 | 17 | /// 18 | /// 19 | /// 20 | /// 21 | public override void Execute(Stack output, int arguments) 22 | { 23 | if (arguments != 0) 24 | throw new InvalidArgumentCountException(0, "VTrigger()"); 25 | 26 | output.Push((double)(0.0)); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultFunctions/MPVVelocity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MultiParse.Default 5 | { 6 | public class MPVVelocity : MPFunction 7 | { 8 | 9 | /// 10 | /// Constructor 11 | /// 12 | public MPVVelocity() 13 | : base("[vV]velocity", false) 14 | { 15 | } 16 | 17 | /// 18 | /// 19 | /// 20 | /// 21 | public override void Execute(Stack output, int arguments) 22 | { 23 | if (arguments != 0) 24 | throw new InvalidArgumentCountException(0, "VVelocity()"); 25 | 26 | output.Push((double)(1.0)); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultOperators/MPAssignment.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text.RegularExpressions; 4 | 5 | namespace MultiParse.Default 6 | { 7 | public class MPAssignment : MPOperator 8 | { 9 | 10 | /// 11 | /// Constructor 12 | /// 13 | public MPAssignment() 14 | : base("=", PrecedenceAssignment, false) 15 | { 16 | } 17 | 18 | /// 19 | /// Match an expression for an assignment 20 | /// 21 | /// 22 | /// 23 | /// 24 | public override int Match(string expression, object previousToken) 25 | { 26 | if (Regex.IsMatch(expression, @"^\=(?!\=)")) 27 | return 1; 28 | return -1; 29 | } 30 | 31 | /// 32 | /// Execute the assignment 33 | /// 34 | /// 35 | public override void Execute(Stack output) 36 | { 37 | // Pop the right operand off the stack 38 | object right = PopOrGet(output); 39 | 40 | // Pop the left off the stack 41 | object left = output.Pop(); 42 | if (left is IMPAssignable) 43 | { 44 | ((IMPAssignable)left).Assign(right); 45 | 46 | // Push the left operand back on the stack for possible subsequent assignments 47 | output.Push(right); 48 | } 49 | else 50 | throw new ParseException("Cannot assign to a non-assignable"); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultOperators/MPConditionalAnd.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MultiParse.Default 5 | { 6 | public class MPConditionalAnd : MPOperator 7 | { 8 | /// 9 | /// Constructor 10 | /// 11 | public MPConditionalAnd() 12 | : base("&&", PrecedenceConditionalAnd, true) 13 | { 14 | } 15 | 16 | /// 17 | /// Find conditional And 18 | /// 19 | /// 20 | /// 21 | /// 22 | public override int Match(string expression, object previousToken) 23 | { 24 | if (IsUnary(previousToken)) 25 | return -1; 26 | if (expression.StartsWith("&&")) 27 | return 2; 28 | return -1; 29 | } 30 | 31 | /// 32 | /// Execute conditional And 33 | /// 34 | /// 35 | public override void Execute(Stack output) 36 | { 37 | // Pop two objects from the stack 38 | object right = PopOrGet(output); 39 | object left = PopOrGet(output); 40 | ConditionalAnd(output, left, right); 41 | } 42 | 43 | /// 44 | /// Conditional And 45 | /// 46 | /// 47 | /// 48 | /// 49 | public void ConditionalAnd(Stack output, object left, object right) 50 | { 51 | if ((left is Boolean) && (right is Boolean)) 52 | { 53 | output.Push((Boolean)left && (Boolean)right); 54 | return; 55 | } 56 | 57 | // Invalid operation 58 | throw new InvalidOperatorTypesException("&&", left, right); 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultOperators/MPConditionalOr.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MultiParse.Default 5 | { 6 | public class MPConditionalOr : MPOperator 7 | { 8 | 9 | /// 10 | /// Constructor 11 | /// 12 | public MPConditionalOr() 13 | : base("||", PrecedenceConditionalOr, true) 14 | { 15 | } 16 | 17 | /// 18 | /// Find conditional Or 19 | /// 20 | /// 21 | /// 22 | /// 23 | public override int Match(string expression, object previousToken) 24 | { 25 | if (IsUnary(previousToken)) 26 | return -1; 27 | if (expression.StartsWith("||")) 28 | return 2; 29 | return -1; 30 | } 31 | 32 | /// 33 | /// Execute conditional Or 34 | /// 35 | /// 36 | public override void Execute(Stack output) 37 | { 38 | // Pop two objects from the stack 39 | object right = PopOrGet(output); 40 | object left = PopOrGet(output); 41 | ConditionalOr(output, left, right); 42 | } 43 | 44 | /// 45 | /// Conditional Or 46 | /// 47 | /// 48 | /// 49 | /// 50 | public void ConditionalOr(Stack output, object left, object right) 51 | { 52 | if ((left is Boolean) && (right is Boolean)) 53 | { 54 | output.Push((Boolean)left || (Boolean)right); 55 | return; 56 | } 57 | 58 | // Invalid operation 59 | throw new InvalidOperatorTypesException("||", left, right); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/DefaultOperators/MPNot.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text.RegularExpressions; 3 | using System.Collections.Generic; 4 | 5 | namespace MultiParse.Default 6 | { 7 | public class MPNot : MPOperator 8 | { 9 | 10 | /// 11 | /// Constructor 12 | /// 13 | public MPNot() 14 | : base("!", PrecedenceUnary, true) 15 | { 16 | } 17 | 18 | /// 19 | /// Find unary NOT 20 | /// 21 | /// 22 | /// 23 | /// 24 | public override int Match(string expression, object previousToken) 25 | { 26 | if (!IsUnary(previousToken)) 27 | return -1; 28 | if (Regex.IsMatch(expression, @"^\!(?![\!\=])")) 29 | return 1; 30 | return -1; 31 | } 32 | 33 | /// 34 | /// Execute unary NOT 35 | /// 36 | /// 37 | public override void Execute(Stack output) 38 | { 39 | // Pop object from the stack 40 | object top = PopOrGet(output); 41 | Not(output, top); 42 | } 43 | 44 | /// 45 | /// Not 46 | /// 47 | /// 48 | /// 49 | public void Not(Stack output, object operand) 50 | { 51 | if (operand is Boolean) 52 | { 53 | output.Push(!(Boolean)operand); 54 | return; 55 | } 56 | 57 | // Invalid operation 58 | throw new InvalidOperatorTypesException("!", operand); 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/MPDataType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace MultiParse 7 | { 8 | /// 9 | /// An interface describing an assignable object 10 | /// 11 | public interface IMPAssignable 12 | { 13 | void Assign(object value); 14 | } 15 | 16 | /// 17 | /// An interface describing a gettable object 18 | /// 19 | public interface IMPGettable 20 | { 21 | object Get(); 22 | } 23 | 24 | /// 25 | /// A class describing a data type 26 | /// 27 | public abstract class MPDataType 28 | { 29 | 30 | /// 31 | /// Returns -1 if the operator doesn't match. Else it returns the length of the matched string. 32 | /// 33 | /// The expression 34 | /// The previous expression 35 | /// 36 | public abstract int Match(string expression, object previousToken, out object convertedToken); 37 | 38 | /// 39 | /// Check whether or not it is possible to have a binary operator 40 | /// 41 | /// 42 | /// 43 | protected bool IsUnary(object previousToken) 44 | { 45 | if (previousToken == null) 46 | return true; 47 | if (previousToken is MPOperator) 48 | return true; 49 | if (previousToken is BracketOpen) 50 | return true; 51 | if (previousToken is FunctionSeparator) 52 | return true; 53 | return false; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/MPFunction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Text.RegularExpressions; 6 | 7 | namespace MultiParse 8 | { 9 | public abstract class MPFunction : MPOperator 10 | { 11 | /// 12 | /// Constructor 13 | /// 14 | public MPFunction(string name, bool postfix) 15 | : base(name, int.MaxValue, postfix) 16 | { 17 | } 18 | 19 | /// 20 | /// Find the function 21 | /// 22 | /// 23 | /// 24 | /// 25 | public override int Match(string expression, object previousToken) 26 | { 27 | // Basic implementation for matching a function with a certain name 28 | Match m = Regex.Match(expression, @"^" + key + @"\("); 29 | if (m.Success) 30 | return m.Length - 1; 31 | return -1; 32 | } 33 | 34 | /// 35 | /// Invalid execution 36 | /// 37 | /// 38 | sealed public override void Execute(Stack output) 39 | { 40 | throw new ParseException("Invalid execution call. Programming error."); 41 | } 42 | 43 | /// 44 | /// Executes the function. The function should pop the arguments from the output stack, 45 | /// and push the result of the operation back. 46 | /// 47 | /// The output stack 48 | /// The number of arguments passed with the function 49 | public abstract void Execute(Stack output, int arguments); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/MultiParse/MPSpecialCharacters.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace MultiParse 7 | { 8 | /// 9 | /// A special class signifiying an opening round bracket 10 | /// 11 | public class BracketOpen 12 | { 13 | public int Match(string expression, object previousToken) 14 | { 15 | if (expression[0] == '(') 16 | return 1; 17 | return -1; 18 | } 19 | } 20 | 21 | /// 22 | /// A special class signifying a closing round bracket 23 | /// 24 | public class BracketClose 25 | { 26 | public int Match(string expression, object previousToken) 27 | { 28 | if (expression[0] == ')') 29 | return 1; 30 | return -1; 31 | } 32 | } 33 | 34 | /// 35 | /// A special class signifying a argument seperator symbol 36 | /// 37 | public class FunctionSeparator 38 | { 39 | public int Match(string expression, object previousToken) 40 | { 41 | if (expression[0] == ',') 42 | return 1; 43 | return -1; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("64klang2GUI")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Alcatraz")] 12 | [assembly: AssemblyProduct("64klang2GUI")] 13 | [assembly: AssemblyCopyright("Copyright © Alcatraz 2018")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("89516bc3-86f5-4299-bf82-dc5ca4690230")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("2.0.0.*")] 36 | [assembly: AssemblyFileVersion("2.0.0.*")] 37 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/SynthCanvas.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/VUMeter.xaml: -------------------------------------------------------------------------------- 1 |  8 | 9 | -------------------------------------------------------------------------------- /VSTiPluginSourceCode/64klang2GUI/WaveFileConfig.xaml: -------------------------------------------------------------------------------- 1 |  8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |