diff --git a/FX/BryanChi_FX Devices.lua b/FX/BryanChi_FX Devices.lua deleted file mode 100644 index 71bb54454..000000000 --- a/FX/BryanChi_FX Devices.lua +++ /dev/null @@ -1,16101 +0,0 @@ --- @description FX Devices --- @author Bryan Chi --- @version 1.0beta10.3.3 --- @changelog --- - Allow users to write their own ‘plugin scripts’ for specific FXs. --- - Add a new ‘record last touch’ script, which allows you to add the last touched parameter by a hotkey even when you’re focusing on the plugin’s UI. --- - Add ‘Add all parameters’ button in the add parameters menu. --- - Added gain scale drag for Pro-Q 3. --- - Adjust default parameter sizes behaviors so that it’ll show unlimited amount of parameters correctly. --- - Allow deleting parameters by alt + double clicking. --- - fix Pro-C and Pro-Q not showing up. --- @provides --- [effect] BryanChi_FX Devices/FXD Macros.jsfx --- [effect] BryanChi_FX Devices/FXD ReSpectrum.jsfx --- [effect] BryanChi_FX Devices/FXD Gain Reduction Scope.jsfx --- [effect] BryanChi_FX Devices/FXD Split to 32 Channels.jsfx --- [effect] BryanChi_FX Devices/FXD Split To 4 Channels.jsfx --- [effect] BryanChi_FX Devices/cookdsp.jsfx-inc --- [effect] BryanChi_FX Devices/cookdsp/analysis.jsfx-inc --- [effect] BryanChi_FX Devices/cookdsp/buffer.jsfx-inc --- [effect] BryanChi_FX Devices/cookdsp/delay.jsfx-inc --- [effect] BryanChi_FX Devices/cookdsp/dynamics.jsfx-inc --- [effect] BryanChi_FX Devices/cookdsp/effects.jsfx-inc --- [effect] BryanChi_FX Devices/cookdsp/fft-mono-template --- [effect] BryanChi_FX Devices/cookdsp/fft-stereo-template --- [effect] BryanChi_FX Devices/cookdsp/fftobjects.jsfx-inc --- [effect] BryanChi_FX Devices/cookdsp/filters.jsfx-inc --- [effect] BryanChi_FX Devices/cookdsp/granulator.jsfx-inc --- [effect] BryanChi_FX Devices/cookdsp/list.jsfx-inc --- [effect] BryanChi_FX Devices/cookdsp/memalloc.jsfx-inc --- [effect] BryanChi_FX Devices/cookdsp/midi.jsfx-inc --- [effect] BryanChi_FX Devices/cookdsp/mmath.jsfx-inc --- [effect] BryanChi_FX Devices/cookdsp/oscil.jsfx-inc --- [effect] BryanChi_FX Devices/cookdsp/pobjects.jsfx-inc --- [effect] BryanChi_FX Devices/cookdsp/pv-mono-template --- [effect] BryanChi_FX Devices/cookdsp/pv-stereo-template --- [effect] BryanChi_FX Devices/cookdsp/pvocobjects.jsfx-inc --- [effect] BryanChi_FX Devices/cookdsp/pvtrans-example --- [effect] BryanChi_FX Devices/cookdsp/random.jsfx-inc --- [effect] BryanChi_FX Devices/cookdsp/scaling.jsfx-inc --- [effect] BryanChi_FX Devices/firhalfband.jsfx-inc --- [effect] BryanChi_FX Devices/spectrum.jsfx-inc --- [effect] BryanChi_FX Devices/svf_filter.jsfx-inc --- BryanChi_FX Devices/IconFont1.ttf --- [effect] BryanChi_FX Devices/FXD (Mix)RackMixer.jsfx --- BryanChi_FX Devices/FX Layouts/ValhallaFreqEcho (Valhalla DSP, LLC).ini --- BryanChi_FX Devices/FX Layouts/ValhallaShimmer (Valhalla DSP, LLC).ini --- BryanChi_FX Devices/FX Layouts/ValhallaVintageVerb (Valhalla DSP, LLC).ini --- BryanChi_FX Devices/FX Layouts/ValhallaSupermassive (Valhalla DSP, LLC).ini --- BryanChi_FX Devices/FX Layouts/ValhallaDelay (Valhalla DSP, LLC).ini --- [effect] BryanChi_FX Devices/FXD Saike BandSplitter.jsfx --- [effect] BryanChi_FX Devices/FXD Band Joiner.jsfx --- BryanChi_FX Devices/Images/trash.png --- BryanChi_FX Devices/Images/Attached Drawings/LED light.png --- BryanChi_FX Devices/Images/Knobs/Bitwig.png --- BryanChi_FX Devices/FX Layout Plugin Scripts/Pro C 2.lua --- BryanChi_FX Devices/FX Layout Plugin Scripts/Pro Q 3.lua --- BryanChi_FX Devices/FXD - Record Last Touch.lua --- @about --- Please check the forum post for info: --- https://forum.cockos.com/showthread.php?t=263622 - - - ---------------------------== declare Initial Variables & Functions ------------------------ -VersionNumber = 'V1.0beta10.3.2 ' -FX_Add_Del_WaitTime = 2 -r = reaper - - - - - - -function msg(m) - return reaper.ShowConsoleMsg(tostring(m) .. "\n") -end - - - - - - - -PluginScript = {} -CAT = {} -local LAST_USED_FX -VP = {} -demo = {} -app = {} -enum_cache = {} -cache = {} -Draw = { - Rect = {}, - DrawMode = {}, - ItemInst = {}, - L = {}, - R = {}, - Y = {}, - T = {}, - B = {}, - FxGUID = {}, - Time = 0, - Df_EdgeRound = {} -} -AddFX = { Pos = {}, Name = {}, GUID = {} } -DelFX = { Pos = {}, Name = {} } -MovFX = { ToPos = {}, FromPos = {}, Lbl = {}, Copy = {} } -ClrPallet = {} -Glob = {}; -Sel_Cross = {} -ToDef = {} -DraggingFXs = {}; DraggingFXs_Idx = {} -DefaultWidth = 200 -GapBtwnPrmColumns = 10 ---Sequencer ----- -StepSEQ_W = 20 -StepSEQ_H = 100 -SEQ_Default_Num_of_Steps = 8 -SEQ_Default_Denom = 1 - - - - ------------ Custom Colors------------------- -CustomColors = { 'Window_BG', 'FX_Devices_Bg', 'FX_Layer_Container_BG', 'Space_Between_FXs', 'Morph_A', 'Morph_B', - 'Layer_Solo', 'Layer_Mute', 'FX_Adder_VST', 'FX_Adder_VST3', 'FX_Adder_JS', 'FX_Adder_AU' } -CustomColorsDefault = { - Window_BG = 0x000000ff, - FX_Devices_Bg = 0x151515ff, - FX_Layer_Container_BG = 0x262626ff, - Space_Between_FXs = 0x131313ff, - Morph_A = 0x22222266, - Morph_B = 0x78787877, - Layer_Solo = 0xDADF3775, - Layer_Mute = 0xBE01015C, - FX_Adder_VST = 0x6FB74BFF, - FX_Adder_VST3 = 0xC3DC5CFF, - FX_Adder_JS = 0x9348A9FF, - FX_Adder_AU = 0x526D97FF, - FX_Adder_CLAP = 0xB62424FF - -} - - - -----------Parameters -------------------- -Prm = { - McroModAmt = {}, - McroModAmt_Norm = {}, - Pos_L = {}, - Pos_T = {}, - Pos_R = {}, - Pos_B = {}, - ModAngle = {}, - SldrGrabXPos = {}, - Val = {}, - NameS = {}, - FXGUID = {}, - InstAdded = {}, - Init_Val = {}, - Num = {}, - TrkID = {}, - Deletable = {}, - Name = {} -} - ------------------------------------------ ------Param Modulations ------------------------------------------ -PM = { Ins = {}, FXGUID = {}, Corres_Glob_ID = {}, HasMod = {}, Final_V = {}, DIY_TrkID = {} } -waitForGmem = 0 - - ------------------------------------------ ------FX layering ------------------------------------------ -Lyr = { - Selected = {}, - title = {}, - ProgBarClick = {}, - Title = {}, - ProgBarVal = {}, - SpltrID = {}, - Count = {}, - Solo = {}, - Mute = {}, - Rename = {}, - FX_Ins = {}, - ProgBarDrag = {}, - EditingTitle = {}, - LastFXPos = {}, - FrstFXPos = {}, - SplitrAttachTo = {}, - PrevFX = {}, - TitleToShow = {}, -} - -Spltr = {} - - -LE = { GridSize = 10, Sel_Items = {}, ChangeR_Bound = {} } -----Preset Morph-------------- -PresetMorph = { timer = 0 } - ---- FX Chain ----------------------------- -FXchain = { FxGUID = {}, wait = 0, } - - -----track-------------------------------- -Trk = { - GUID = {}, - Prm = { FXGUID = {}, Inst = {}, AssignWhich = {}, V = {}, O_V = {}, Num = {}, WhichMcros = {} }, - FxGUID = {}, - PreFX = {} -} - -------------------Divider--------------- -Dvdr = { Width = {}, Clr = {}, Spc_Hover = {}, RestoreNormWidthWait = 0, RestoreNormWidthWait = {}, JustDrop = {}, } - ------------------FX State----------------- -FX = { - Enable = {}, - InLyr = {}, - Width = {}, - Collapse = {}, - LyrNum = {}, - Win = {}, - Win_Name = {}, - Def_Type = {}, - Win_Name_S = {}, - TitleWidth = {}, - Sldr_W = {}, - WidthCollapse = {}, - Round = {}, - GrbRound = {}, - BgClr = {}, - Def_Sldr_W = {}, - Prm = { - V_Round = {}, - V_FontSize = {}, - ShowCondition = {}, - ConditionPrm = {}, - ConditionPrm_V = {}, - Switch_W = {}, - Combo_W = {}, - Options = {}, - BgClrHvr = {}, - BgClrAct = {}, - Lbl_Clr = {}, - V_Clr = {}, - DragDir = {}, - Lbl_Pos = {}, - V_Pos = {}, - Style = {}, - GrbClr = {}, - BgClr = {}, - Count = {}, - Name = {}, - Num = {}, - V = {}, - InitV = {}, - AssignWhichParam = {}, - ToTrkPrm = {}, - Lbl = {}, - PosX = {}, - PosY = {}, - VertSldr = {}, - Type = {}, - CustomLbl = {}, - FontSize = {}, - Sldr_H = {} - } -} - - -Knob_DefaultFontSize = 10 -LBL_DefaultFontSize = 10 -Df = { V_Sldr_W = 15, KnobRadius = 18, KnobSize = 15 * 3, Sldr_W = 160, Dvdr_Width = 15, Dvdr_Hvr_W = 0 } - - ------------ShortCut----------- -AllAvailableKeys = { - ['0'] = r.ImGui_Key_0(), - ['1'] = r.ImGui_Key_1(), - ['2'] = r.ImGui_Key_2(), - ['3'] = r.ImGui_Key_3(), - ['4'] = r.ImGui_Key_4(), - ['5'] = r.ImGui_Key_5(), - ['6'] = r.ImGui_Key_6(), - ['7'] = r.ImGui_Key_7(), - ['8'] = r.ImGui_Key_8(), - ['9'] = r.ImGui_Key_9(), - A = r.ImGui_Key_A(), - B = r.ImGui_Key_B(), - C = r.ImGui_Key_C(), - D = r.ImGui_Key_D(), - E = r.ImGui_Key_E(), - F = r.ImGui_Key_F(), - G = r.ImGui_Key_G(), - H = r.ImGui_Key_H(), - I = r.ImGui_Key_I(), - J = r.ImGui_Key_J(), - K = r.ImGui_Key_K(), - L = r.ImGui_Key_L(), - M = r.ImGui_Key_M(), - N = r.ImGui_Key_N(), - O = r.ImGui_Key_O(), - P = r.ImGui_Key_P(), - Q = r.ImGui_Key_Q(), - R = r.ImGui_Key_R(), - S = r.ImGui_Key_S(), - T = r.ImGui_Key_T(), - U = r.ImGui_Key_U(), - V = r.ImGui_Key_V(), - W = r.ImGui_Key_W(), - X = r.ImGui_Key_X(), - Y = r.ImGui_Key_Y(), - Z = r.ImGui_Key_Z(), - Esc = r.ImGui_Key_Escape(), - F1 = r.ImGui_Key_F1(), - F2 = r.ImGui_Key_F2(), - F3 = r.ImGui_Key_F3(), - F4 = r.ImGui_Key_F4(), - F5 = r.ImGui_Key_F5(), - F6 = r.ImGui_Key_F6(), - F7 = r.ImGui_Key_F7(), - F8 = r.ImGui_Key_F8(), - F9 = r.ImGui_Key_F9(), - F10 = r.ImGui_Key_F10(), - F11 = r.ImGui_Key_F11(), - F12 = r.ImGui_Key_F12(), - Apostrophe = r.ImGui_Key_Apostrophe(), - Backslash = r.ImGui_Key_Backslash(), - Backspace = r.ImGui_Key_Backspace(), - Comma = r.ImGui_Key_Comma(), - Delete = r.ImGui_Key_Delete(), - DownArrow = r.ImGui_Key_DownArrow(), - Enter = r.ImGui_Key_Enter(), - End = r.ImGui_Key_End(), - Equal = r.ImGui_Key_Equal(), - GraveAccent = r.ImGui_Key_GraveAccent(), - Home = r.ImGui_Key_Home(), - ScrollLock = r.ImGui_Key_ScrollLock(), - Insert = r.ImGui_Key_Insert(), - Minus = r.ImGui_Key_Minus(), - LeftArrow = r.ImGui_Key_LeftArrow(), - LeftBracket = r.ImGui_Key_LeftBracket(), - Period = r.ImGui_Key_Period(), - PageDown = r.ImGui_Key_PageDown(), - PageUp = r.ImGui_Key_PageUp(), - Pause = r.ImGui_Key_Pause(), - RightBracket = r.ImGui_Key_RightBracket(), - RightArrow = r.ImGui_Key_RightArrow(), - SemiColon = r.ImGui_Key_Semicolon(), - Slash = r.ImGui_Key_Slash(), - Space = r.ImGui_Key_Space(), - Tab = r.ImGui_Key_Tab(), - UpArrow = r.ImGui_Key_UpArrow(), - Pad0 = r.ImGui_Key_Keypad0(), - Pad1 = r.ImGui_Key_Keypad1(), - Pad2 = r.ImGui_Key_Keypad2(), - Pad3 = r.ImGui_Key_Keypad3(), - Pad4 = r.ImGui_Key_Keypad4(), - Pad5 = r.ImGui_Key_Keypad5(), - Pad6 = r.ImGui_Key_Keypad6(), - Pad7 = r.ImGui_Key_Keypad7(), - Pad8 = r.ImGui_Key_Keypad8(), - Pad9 = r.ImGui_Key_Keypad9(), - PadAdd = r.ImGui_Key_KeypadAdd(), - PadDecimal = r.ImGui_Key_KeypadDecimal(), - PadDivide = r.ImGui_Key_KeypadDivide(), - PadEnter = r.ImGui_Key_KeypadEnter(), - PadEqual = r.ImGui_Key_KeypadEqual(), - PadMultiply = r.ImGui_Key_KeypadMultiply(), - PadSubtract = r.ImGui_Key_KeypadSubtract(), -} - -KB_Shortcut = {} -Command_ID = {} - - ---------Pro C ------------------------ -ProC = { Width = 280, Pt = { R = { m = {}, M = {} }, L = { m = {}, M = {} } } } - - - - - - - - - --------------------Macros -------------------------- -Mc = { Val_Trk = {}, V_Out = { 0, 0, 0, 0, 0, 0, 0, 0, 0 }, Name = {} } -Wet = { DragLbl = {}, Val = {}, P_Num = {} } -MacroNums = { 1, 2, 3, 4, 5, 6, 7, 8 } - -r.gmem_attach('gmemForSpectrum') - --- FXs listed here will not have a fx window in the script UI -BlackListFXs = { 'Macros', 'JS: Macros .+', 'Frequency Spectrum Analyzer Meter', 'JS: FXD Split to 32 Channels', - 'JS: FXD (Mix)RackMixer .+', 'FXD (Mix)RackMixer', 'JS: FXD Macros', 'FXD Macros', - 'JS: FXD ReSpectrum', 'AU: AULowpass (Apple)', 'AU: AULowpass', 'VST: FabFilter Pro C 2 ', 'Pro-C 2', 'Pro C 2', - 'JS: FXD Split to 4 channels', 'JS: FXD Gain Reduction Scope', - 'JS: FXD Saike BandSplitter', 'JS: FXD Band Joiner', 'FXD Saike BandSplitter', 'FXD Band Joiner', - 'FXD Split to 32 Channels' -} -UtilityFXs = { 'Macros', 'JS: Macros /[.+', 'Frequency Spectrum Analyzer Meter', 'JS: FXD Split to 32 Channels', - 'JS: FXD (Mix)RackMixer .+', 'FXD (Mix)RackMixer', 'JS: FXD Macros', 'FXD Macros', - 'JS: FXD ReSpectrum', 'JS: FXD Split to 4 channels', 'JS: FXD Gain Reduction Scope', 'JS: FXD Band Joiner', - 'FXD Split to 32 Channels' -} - -SpecialLayoutFXs = { 'VST: FabFilter Pro C 2 ', 'Pro Q 3', 'VST: FabFilter Pro Q 3 ', 'VST3: Pro Q 3 FabFilter', - 'VST3: Pro C 2 FabFilter', 'AU: Pro C 2 FabFilter' } - - - - - - - -Sel_Track = r.GetSelectedTrack(0, 0) -if Sel_Track ~= nil then Sel_Track_FX_Count = reaper.TrackFX_GetCount(Sel_Track) end - - -FX_DeviceWindow_NoScroll = 0 -FXGUID = {} -FirstLoop = true - - - -------- == Colors ---------- - -Clr = { - SliderGrab = 0x309D89ff, - Dvdr = { - Active = 0x777777aa, - In_Layer = 0x131313ff, - outline = 0x444444ff - } - -} - -CLR_BtwnFXs_Btn_Hover = 0x77777744 -CLR_BtwnFXs_Btn_Active = 0x777777aa -FX_Window_Clr_When_Dragging = 0x44444433 -FX_Window_Clr_Default = 0x262626ff -Btns_Hover_DefaultColor = 0x2d3b3aff - -Btns_DefaultColor = 0x333333ff -Btns_ClickedColor = 0x358f8fff -BGColor_FXLayeringWindow = 0x262626ff - -Macro1Color = 0xff2121ff -Macro2Color = 0xff5521ff -Macro3Color = 0xff8921ff -Macro4Color = 0xffd321ff -Macro5Color = 0xf4ff21ff -Macro6Color = 0xb9ff21ff -Macro7Color = 0x6fff21ff -Macro8Color = 0x21ff6bff - -EightColors = { - LowMidSat = {}, - LowSat = {}, - MidSat = {}, - Bright = {}, - Bright_HighSat = {}, - HighSat_MidBright = {}, - bgWhenAsgnMod = {}, - bgWhenAsgnModAct = {}, - bgWhenAsgnModHvr = {} -} - -function HSV(h, s, v, a) - local r, g, b = reaper.ImGui_ColorConvertHSVtoRGB(h, s, v) - return reaper.ImGui_ColorConvertDouble4ToU32(r, g, b, a or 1.0) -end - -for a = 1, 8, 1 do - table.insert(EightColors.LowSat, HSV(0.08 * (a - 1), 0.25, 0.33, 0.25)) - table.insert(EightColors.LowMidSat, HSV(0.08 * (a - 1), 0.25, 0.33, 0.5)) - table.insert(EightColors.MidSat, HSV(0.08 * (a - 1), 0.5, 0.5, 0.5)) - table.insert(EightColors.Bright, HSV(0.08 * (a - 1), 1, 0.5, 0.2)) - table.insert(EightColors.Bright_HighSat, HSV(0.08 * (a - 1), 1, 1, 0.9)) - table.insert(EightColors.HighSat_MidBright, HSV(0.08 * (a - 1), 1, 0.5, 0.5)) - table.insert(EightColors.bgWhenAsgnMod, HSV(0.08 * (a - 0.7), 0.7, 0.6, 0.15)) - table.insert(EightColors.bgWhenAsgnModAct, HSV(0.08 * (a - 0.7), 0.8, 0.7, 0.9)) - table.insert(EightColors.bgWhenAsgnModHvr, HSV(0.08 * (a - 0.7), 1, 0.2, 0.5)) -end - - - -function HSV_Change(InClr, H,S,V,A) - local R,g,b, a = r.ImGui_ColorConvertU32ToDouble4(InClr) - - local h,s,v = r.ImGui_ColorConvertRGBtoHSV( R, g, b) - local h,s,v, a = (H or 0)+h, s+(S or 0),v+(V or 0), a+(A or 0) - local R, g, b = r.ImGui_ColorConvertHSVtoRGB( h, s, v) - return r.ImGui_ColorConvertDouble4ToU32( R, g, b, a) - -end - -function BlendColors(Clr1,Clr2, pos) - local R1, G1, B1, A1 = r.ImGui_ColorConvertU32ToDouble4(Clr1) - - local R2, G2, B2, A2 = r.ImGui_ColorConvertU32ToDouble4(Clr2) - - local R3 =SetMinMax((R2-R1) * pos + R1,0, 1) - local G3 =SetMinMax((G2-G1) * pos + G1,0, 1) - local B3 =SetMinMax((B2-B1) * pos + B1,0, 1) - local A3 =SetMinMax((A2-A1) * pos + A1,0, 1) - - return r.ImGui_ColorConvertDouble4ToU32(R3,G3,B3, A3) - -end - - - ------end of colors-------- - -Array_Macro_Colors = { - frameBgColor = {}, - frameBgHoveredColor = {}, - frameBgActiveColor = {}, - sliderGrabColor = {}, - sliderGrabActiveColor = {} -} - - -x = 0.5 - -Cont_Param_Add_Mode = false -OffsetForMultipleMOD = 2 - -Array = {} - - - - - - - ------------------Script Testing Area--------------------------- ---------------------------------Layout Editor Functions ----------------------------- - - - - - - - - - - - - - ------------------------------------------------------------------------------------------------------------- -dofile(r.GetResourcePath() .. "/UserPlugins/ultraschall_api.lua") - -function GeneralFunctions() - - function GetFileExtension(str) - return str:match("^.+(%..+)$") - end - function ChangeFX_Name(FX_Name) - if FX_Name then - local FX_Name = FX_Name:gsub("%w+%:%s+", - { - ['AU: '] = "", - ['JS: '] = "", - ['VST: '] = "", - ['VSTi: '] = "", - ['VST3: '] = '', - ['VST3i: '] = "", - ['CLAP: '] = "", - ['CLAPi: '] = "" - }) - local FX_Name = FX_Name:gsub('[%:%[%]%/]', "_") - return FX_Name - end - end - - - - function AddMacroJSFX() - local MacroGetLT_Track = reaper.GetLastTouchedTrack() - MacrosJSFXExist = reaper.TrackFX_AddByName(MacroGetLT_Track, 'FXD Macros', 0, 0) - if MacrosJSFXExist == -1 then - reaper.TrackFX_AddByName(MacroGetLT_Track, 'FXD Macros', 0, -1000) - reaper.TrackFX_Show(MacroGetLT_Track, 0, 2) - return false - else - return true - end - end - - function GetLTParam() - LT_Track = reaper.GetLastTouchedTrack() - retval, LT_Prm_TrackNum, LT_FXNum, LT_ParamNum = reaper.GetLastTouchedFX() - --GetTrack_LT_Track = reaper.GetTrack(0,LT_TrackNum) - if LT_Track ~= nil then - retval, LT_FXName = reaper.TrackFX_GetFXName(LT_Track, LT_FXNum) - retval, LT_ParamName = reaper.TrackFX_GetParamName(LT_Track, LT_FXNum, LT_ParamNum) - end - end - - function GetLT_FX_Num() - retval, LT_Prm_TrackNum, LT_FX_Number, LT_ParamNum = reaper.GetLastTouchedFX() - LT_Track = r.GetLastTouchedTrack() - end - - function MouseCursorBusy(enable, title) - mx, my = reaper.GetMousePosition() - - local hwnd = reaper.JS_Window_FindTop(title, true) - local hwnd = reaper.JS_Window_FromPoint(mx, my) - - if enable then -- set cursor to hourglass - reaper.JS_Mouse_SetCursor(Invisi_Cursor) - -- block app from changing mouse cursor - reaper.JS_WindowMessage_Intercept(hwnd, "WM_SETCURSOR", false) - else -- set cursor to arrow - reaper.JS_Mouse_SetCursor(reaper.JS_Mouse_LoadCursor(32512)) - -- allow app to change mouse cursor - end - end - - function ConcatPath(...) - -- Get system dependent path separator - local sep = package.config:sub(1, 1) - return table.concat({ ... }, sep) - end - - function SetMinMax(Input, Min, Max) - if Input >= Max then - Input = Max - elseif Input <= Min then - Input = Min - else - Input = Input - end - return Input - end - - function ToNum(str) - str = tonumber(str) - end - - function toggle(v) - if v then v = false else v = true end - return v - end - - function get_aftr_Equal(str) - if str then - local o = str:sub((str:find('=') or -2) + 2) - if o == '' or o == ' ' then o = nil end - return o - end - end - - function RecallInfo(Str, Id, Fx_P, Type, untilwhere) - if Str then - local Out, LineChange - local ID = Fx_P .. '. ' .. Id .. ' = ' - local Start, End = Str:find(ID) - if untilwhere then - LineChange = Str:find(untilwhere, Start) - else - LineChange = Str:find('\n', Start) - end - if End and Str and LineChange then - if Type == 'Num' then - Out = tonumber(string.sub(Str, End + 1, LineChange - 1)) - elseif Type == 'Bool' then - if string.sub(Str, End + 1, LineChange - 1) == 'true' then Out = true else Out = false end - else - Out = string.sub(Str, End + 1, LineChange - 1) - end - end - if Out == '' then Out = nil end - return Out - end - end - - function RecallGlobInfo(Str, ID, Type, untilwhere) - if Str then - local Out, LineChange - local Start, End = Str:find(ID) - - if untilwhere then - LineChange = Str:find(untilwhere, Start) - else - LineChange = Str:find('\n', Start) - end - if End and Str and LineChange then - if Type == 'Num' then - Out = tonumber(string.sub(Str, End + 1, LineChange - 1)) - elseif Type == 'Bool' then - if string.sub(Str, End + 1, LineChange - 1) == 'true' then Out = true else Out = false end - else - Out = string.sub(Str, End + 1, LineChange - 1) - end - end - if Out == '' then Out = nil end - return Out - end - end - - function RecallIntoTable(Str, Id, Fx_P, Type) - if Str then - local _, End = Str:find(Id) - local T = {} - while End do - local NextLine = Str:find('\n', End) - local EndPos - local NextSep = Str:find('|', End) - if NextSep and NextLine then - if NextSep > NextLine then - End = nil - else - if Type == 'Num' then - table.insert(T, tonumber(Str:sub(End + 1, NextSep - 1))) - else - table.insert(T, Str:sub(End + 1, NextSep - 1)) - end - - _, NewEnd = Str:find('|%d+=', End + 1) - if NewEnd then - if NewEnd > NextLine then End = nil else End = NewEnd end - else - End = nil - end - end - else - End = nil - end - end - if T[1] then return T end - end - end - - function get_aftr_Equal_bool(str) - if str then - local o = str:sub(str:find('=') + 2) - if o == '' or o == ' ' or 0 == 'nil' then - o = nil - elseif o == 'true' then - o = true - elseif o == 'false' then - o = false - else - o = nil - end - return o - end - end - - function get_aftr_Equal_Num(str) - if str then - if str:find('=') then - return tonumber(str:sub(str:find('=') + 2)) - end - else - return nil - end - end - - function OnlyNum(str) - return tonumber(str:gsub('[%D%.]', '')) - end - - function get_lines(filename) - local lines = {} - -- io.lines returns an iterator, so we need to manually unpack it into an array - for line in io.lines(filename) do - lines[#lines + 1] = line - end - return lines - end - - function TableSwap(Table, Pos1, Pos2) - Table[Pos1], Table[Pos2] = Table[Pos2], Table[Pos1] - return Table - end - - function tablefind(tab, el) - if tab then - for index, value in pairs(tab) do - if value == el then - return index - end - end - end - end - - function GetProjExt_FxNameNum(FxGUID) - local PrmCount - rv, PrmCount = r.GetProjExtState(0, 'FX Devices', 'Prm Count' .. FxGUID) - if PrmCount ~= '' then FX.Prm.Count[FxGUID] = tonumber(PrmCount) end - FX[FxGUID] = FX[FxGUID] or {} - if rv ~= 0 then - for P = 1, FX.Prm.Count[FxGUID], 1 do - FX[FxGUID][P] = FX[FxGUID][P] or {} - local FP = FX[FxGUID][P] - if FP then - _, FP.Name = r.GetProjExtState(0, 'FX Devices', 'FX' .. P .. 'Name' .. FxGUID) - _, FP.Num = r.GetProjExtState(0, 'FX Devices', 'FX' .. P .. 'Num' .. FxGUID); FP.Num = tonumber(FP - .Num) - end - end - end - end - - function SyncAnalyzerPinWithFX(FX_Idx, Target_FX_Idx, FX_Name) - -- input -- - local Target_L, _ = r.TrackFX_GetPinMappings(LT_Track, Target_FX_Idx, 0, 0) -- L chan - local Target_R, _ = r.TrackFX_GetPinMappings(LT_Track, Target_FX_Idx, 0, 1) -- R chan - local L, _ = r.TrackFX_GetPinMappings(LT_Track, FX_Idx, 0, 0) -- L chan - local R, _ = r.TrackFX_GetPinMappings(LT_Track, FX_Idx, 0, 1) -- R chan - - - if L ~= Target_L then - if not FX_Name then _, FX_Name = r.TrackFX_GetFXName(LT_Track, FX_Idx) end - - r.TrackFX_SetPinMappings(LT_Track, FX_Idx, 0, 0, Target_L, 0) - - - if FX_Name:find('JS: FXD ReSpectrum') then - for i = 2, 16, 1 do - r.TrackFX_SetPinMappings(LT_Track, FX_Idx, 0, i, 0, 0) - r.TrackFX_SetPinMappings(LT_Track, FX_Idx, 1, i, 0, 0) - end - end - - - if FX_Name == 'JS: FXD Split to 4 channels' then - r.TrackFX_SetPinMappings(LT_Track, FX_Idx, 1, 2, Target_R * 2, 0) - elseif FX_Name == 'JS: FXD Gain Reduction Scope' then - r.TrackFX_SetPinMappings(LT_Track, FX_Idx, 0, 2, Target_R * 2, 0) - end - end - if R ~= Target_R then - r.TrackFX_SetPinMappings(LT_Track, FX_Idx, 0, 1, Target_R, 0) - if FX_Name == 'JS: FXD Split to 4 channels' then - r.TrackFX_SetPinMappings(LT_Track, FX_Idx, 1, 3, Target_R * 4, 0) - elseif FX_Name:find('FXD Gain Reduction Scope') then - r.TrackFX_SetPinMappings(LT_Track, FX_Idx, 0, 3, Target_R * 4, 0) - end - end - - - - -- output -- - local Target_L, _ = r.TrackFX_GetPinMappings(LT_Track, Target_FX_Idx, 1, 0) -- L chan - local Target_R, _ = r.TrackFX_GetPinMappings(LT_Track, Target_FX_Idx, 1, 1) -- R chan - local L, _ = r.TrackFX_GetPinMappings(LT_Track, FX_Idx, 1, 0) -- L chan - local R, _ = r.TrackFX_GetPinMappings(LT_Track, FX_Idx, 1, 1) -- R chan - if L ~= Target_L then - r.TrackFX_SetPinMappings(LT_Track, FX_Idx, 1, 0, Target_L, 0) - end - if R ~= Target_R then - r.TrackFX_SetPinMappings(LT_Track, FX_Idx, 1, 1, Target_R, 0) - end - end - - function AddFX_HideWindow(track, fx_name, Position) - local val = r.SNM_GetIntConfigVar("fxfloat_focus", 0) - if val & 4 == 0 then - r.TrackFX_AddByName(track, fx_name, 0, Position) -- add fx - else - r.SNM_SetIntConfigVar("fxfloat_focus", val & (~4)) -- temporarily disable Auto-float newly created FX windows - r.TrackFX_AddByName(track, fx_name, 0, Position) -- add fx - r.SNM_SetIntConfigVar("fxfloat_focus", val|4) -- re-enable Auto-float - end - end - - function ToggleCollapseAll() - -- check if all are collapsed - local All_Collapsed - for i = 0, Sel_Track_FX_Count - 1, 1 do - if not FX[FXGUID[i]].Collapse then All_Collapsed = false end - end - if All_Collapsed == false then - for i = 0, Sel_Track_FX_Count - 1, 1 do - FX[FXGUID[i]].Collapse = true - end - else -- if all is collapsed - for i = 0, Sel_Track_FX_Count - 1, 1 do - FX[FXGUID[i]].Collapse = false - FX.WidthCollapse[FXGUID[i]] = nil - end - BlinkFX = FX_Idx - end - return BlinkFX - end - - function RoundPrmV(str, DecimalPlaces) - local A = tostring('%.' .. DecimalPlaces .. 'f') - --local num = tonumber(str:gsub('[^%d%.]', '')..str:gsub('[%d%.]','')) - local otherthanNum = str:gsub('[%d%.]', '') - local num = str:gsub('[^%d%.]', '') - return string.format(A, tonumber(num) or 0) .. otherthanNum - end - - function StrToNum(str) - return str:gsub('[^%p%d]', '') - end - - function TableMaxVal() - end - - function tablelength(T) - local count = 0 - for _ in pairs(T) do count = count + 1 end - return count - end - - function roundUp(num, multipleOf) - return math.floor((num + multipleOf / 2) / multipleOf) * multipleOf; - end - - function F_Tp(FX_P, FxGUID) - return FX.Prm.ToTrkPrm[FxGUID .. FX_P] - end - - function FindStringInTable(Table, V) - local found = nil - local Tab = {} - if V then - for i, val in pairs(Table) do - if string.find(val, V) ~= nil then - found = true - table.insert(Tab, i) - end - end - if found == true then return true, Tab else return false end - else - return nil - end - end - - function FindExactStringInTable(Table, V) - local found = nil - local Tab = {} - if V then - for i, val in pairs(Table) do - if val == V then - found = true - table.insert(Tab, i) - end - end - if found == true then return true, Tab else return false end - else - return nil - end - end - - - - - function round(num, numDecimalPlaces) - num = tonumber(num) - if num then - local mult = 10 ^ (numDecimalPlaces or 0) - return math.floor(num * mult + 0.5) / mult - end - end - - StringToBool = { ['true'] = true, ['false'] = false } - - function has_value(tab, val) - local found = false - for index, value in pairs(tab) do - if value == val then - found = true - end - end - if found == true then - return true - else - return false - end - end - - function findDuplicates(t) - seen = {} --keep record of elements we've seen - duplicated = {} --keep a record of duplicated elements - if t then - for i, v in ipairs(t) do - element = t[i] - if seen[element] then --check if we've seen the element before - duplicated[element] = true --if we have then it must be a duplicate! add to a table to keep track of this - else - seen[element] = true -- set the element to seen - end - end - if #duplicated > 1 then - return duplicated - else - return nil - end - end - end - - --------------ImGUI Related --------------------- - function HighlightSelectedItem(FillClr, OutlineClr, Padding, L, T, R, B, h, w, H_OutlineSc, V_OutlineSc, GetItemRect, - Foreground, rounding) - if GetItemRect == 'GetItemRect' then - L, T = r.ImGui_GetItemRectMin(ctx); R, B = r.ImGui_GetItemRectMax(ctx); w, h = r.ImGui_GetItemRectSize(ctx) - --Get item rect - end - local P = Padding; local HSC = H_OutlineSc or 4; local VSC = V_OutlineSc or 4 - if Foreground == 'Foreground' then WinDrawList = Glob.FDL else WinDrawList = Foreground end - if not WinDrawList then WinDrawList = r.ImGui_GetWindowDrawList(ctx) end - if FillClr then r.ImGui_DrawList_AddRectFilled(WinDrawList, L, T, R, B, FillClr) end - - if OutlineClr and not rounding then - r.ImGui_DrawList_AddLine(WinDrawList, L - P, T - P, L - P, T + h / VSC - P, OutlineClr); r - .ImGui_DrawList_AddLine(WinDrawList, R + P, T - P, R + P, T + h / VSC - P, OutlineClr) - r.ImGui_DrawList_AddLine(WinDrawList, L - P, B + P, L - P, B + P - h / VSC, OutlineClr); r - .ImGui_DrawList_AddLine(WinDrawList, R + P, B + P, R + P, B - h / VSC + P, OutlineClr) - r.ImGui_DrawList_AddLine(WinDrawList, L - P, T - P, L - P + w / HSC, T - P, OutlineClr); r - .ImGui_DrawList_AddLine(WinDrawList, R + P, T - P, R + P - w / HSC, T - P, OutlineClr) - r.ImGui_DrawList_AddLine(WinDrawList, L - P, B + P, L - P + w / HSC, B + P, OutlineClr); r - .ImGui_DrawList_AddLine(WinDrawList, R + P, B + P, R + P - w / HSC, B + P, OutlineClr) - else - if FillClr then r.ImGui_DrawList_AddRectFilled(WinDrawList, L, T, R, B, FillClr, rounding) end - if OutlineClr then r.ImGui_DrawList_AddRect(WinDrawList, L, T, R, B, OutlineClr, rounding) end - end - if GetItemRect == 'GetItemRect' then return L, T, R, B, w, h end - end - - - - - - function PC(ctx, itm, clr) - r.ImGui_PushStyleColor(ctx, itm, clr) - end - - function PopClr(ctx, time) - r.ImGui_PopStyleColor(ctx, time) - end - - function SaveDrawings(FX_Idx, FxGUID) - local dir_path = ConcatPath(r.GetResourcePath(), 'Scripts', 'ReaTeam Scripts', 'FX', 'BryanChi_FX Devices', - 'FX Layouts') - local FX_Name = ChangeFX_Name(FX_Name) - - local file_path = ConcatPath(dir_path, FX_Name .. '.ini') - -- Create directory for file if it doesn't exist - r.RecursiveCreateDirectory(dir_path, 0) - local file = io.open(file_path, 'r+') - - local D = Draw[FX_Name] - - if file and D then - local content = file:read("*a") - - if string.find(content, '========== Drawings ==========') then - file:seek('set', string.find(content, '========== Drawings ==========')) - else - file:seek('end') - end - local function write(Name, Value, ID) - if ID then - file:write('D' .. ID .. '. ' .. Name, ' = ', Value or '', '\n') - else - file:write(Name, ' = ', Value or '', '\n') - end - end - if D.Type then - file:write('\n========== Drawings ==========\n') - write('Default Drawing Edge Rounding', Draw.Df_EdgeRound[FxGUID]) - file:write('\n') - end - write('Total Number of Drawings', #D.Type) - - for i, Type in ipairs(D.Type) do - D[i] = D[i] or {} - write('Type', D.Type[i], i) - write('Left', D.L[i], i) - write('Right', D.R[i], i) - write('Top', D.T[i], i) - write('Bottom', D.B[i], i) - write('Color', D.clr[i], i) - write('Text', D.Txt[i], i) - write('ImagePath', D[i].FilePath, i) - write('KeepImgRatio', tostring(D[i].KeepImgRatio), i) - file:write('\n') - end - end - end - - function ttp(A) - reaper.ImGui_BeginTooltip(ctx) - reaper.ImGui_SetTooltip(ctx, A) - reaper.ImGui_EndTooltip(ctx) - end - - function HideCursor(time) - UserOS = r.GetOS() - if UserOS == "OSX32" or UserOS == "OSX64" or UserOS == "macOS-arm64" then - Invisi_Cursor = reaper.JS_Mouse_LoadCursorFromFile(r.GetResourcePath() .. '/Cursors/Empty Cursor.cur') - end - mx, my = reaper.GetMousePosition() - window = reaper.JS_Window_FromPoint(mx, my) - release_time = reaper.time_precise() + (time or 1) -- hide/freeze mouse for 3 secs. - - local function Hide() - if reaper.time_precise() < release_time then - reaper.JS_Mouse_SetPosition(mx, my) - reaper.JS_Mouse_SetCursor(Invisi_Cursor) - - reaper.defer(Hide) - else - reaper.JS_WindowMessage_Release(window, "WM_SETCURSOR") - end - end - --[[ reaper.JS_WindowMessage_Intercept(window, "WM_SETCURSOR", false) - release_time = reaper.time_precise() + 3 ]] - - Hide() - end - - function HideCursorTillMouseUp(MouseBtn) - UserOS = r.GetOS() - if UserOS == "OSX32" or UserOS == "OSX64" or UserOS == "macOS-arm64" then - Invisi_Cursor = reaper.JS_Mouse_LoadCursorFromFile(r.GetResourcePath() .. '/Cursors/Empty Cursor.cur') - end - - if r.ImGui_IsMouseClicked(ctx, MouseBtn) then - MousePosX_WhenClick, MousePosY_WhenClick = r.GetMousePosition() - end - - if MousePosX_WhenClick then - window = r.JS_Window_FromPoint(MousePosX_WhenClick, MousePosY_WhenClick) - - local function Hide() - if r.ImGui_IsMouseDown(ctx, MouseBtn) then - r.JS_Mouse_SetCursor(Invisi_Cursor) - r.defer(Hide) - else - reaper.JS_WindowMessage_Release(window, "WM_SETCURSOR") - if r.ImGui_IsMouseReleased(ctx, MouseBtn) then - r.JS_Mouse_SetPosition(MousePosX_WhenClick, MousePosY_WhenClick) - end - end - end - Hide() - end - end - - function CreateWindowBtn_Vertical(Name, FX_Idx) - local rv = r.ImGui_Button(ctx, Name, 25, 220) -- create window name button - if rv and Mods == 0 then - openFXwindow(LT_Track, FX_Idx) - elseif rv and Mods == Shift then - ToggleBypassFX(LT_Track, FX_Idx) - elseif rv and Mods == Alt then - DeleteFX(FX_Idx) - end - if r.ImGui_IsItemClicked(ctx, 1) and Mods == 0 then - FX.Collapse[FXGUID[FX_Idx]] = false - end - end - - function HighlightHvredItem() - local DL = r.ImGui_GetForegroundDrawList(ctx) - L, T = r.ImGui_GetItemRectMin(ctx); R, B = r.ImGui_GetItemRectMax(ctx) - if r.ImGui_IsMouseHoveringRect(ctx, L, T, R, B) then - r.ImGui_DrawList_AddRect(DL, L, T, R, B, 0x99999999) - r.ImGui_DrawList_AddRectFilled(DL, L, T, R, B, 0x99999933) - if IsLBtnClicked then - r.ImGui_DrawList_AddRect(DL, L, T, R, B, 0x999999dd) - r.ImGui_DrawList_AddRectFilled(DL, L, T, R, B, 0xffffff66) - return true - end - end - end - - function BlinkItem(dur, rpt, var, highlightEdge, EdgeNoBlink, L, T, R, B, h, w) - TimeBegin = TimeBegin or r.time_precise() - local Now = r.time_precise() - local EdgeClr = 0x00000000 - if highlightEdge then EdgeClr = highlightEdge end - local GetItemRect = 'GetItemRect' - if L then GetItemRect = nil end - - if rpt then - for i = 0, rpt - 1, 1 do - if Now > TimeBegin + dur * i and Now < TimeBegin + dur * (i + 0.5) then -- second blink - HighlightSelectedItem(0xffffff77, EdgeClr, 0, L, T, R, B, h, w, H_OutlineSc, V_OutlineSc, GetItemRect, - Foreground) - end - end - else - if Now > TimeBegin and Now < TimeBegin + dur / 2 then - HighlightSelectedItem(0xffffff77, EdgeClr, 0, L, T, R, B, h, w, H_OutlineSc, V_OutlineSc, GetItemRect, - Foreground) - elseif Now > TimeBegin + dur / 2 + dur then - TimeBegin = r.time_precise() - end - end - - if EdgeNoBlink == 'EdgeNoBlink' then - if Now < TimeBegin + dur * (rpt - 0.95) then - HighlightSelectedItem(0xffffff00, EdgeClr, 0, L, T, R, B, h, w, H_OutlineSc, V_OutlineSc, GetItemRect, - Foreground) - end - end - - if rpt then - if Now > TimeBegin + dur * (rpt - 0.95) then - TimeBegin = nil - return nil, 'Stop' - else - return var - end - end - end - - function MyText(text, font, color, WrapPosX) - if WrapPosX then r.ImGui_PushTextWrapPos(ctx, WrapPosX) end - - if font then r.ImGui_PushFont(ctx, font) end - if color then - reaper.ImGui_TextColored(ctx, color, text) - else - reaper.ImGui_Text(ctx, text) - end - - if font then r.ImGui_PopFont(ctx) end - if WrapPosX then r.ImGui_PopTextWrapPos(ctx) end - end - - function Add_WetDryKnob(ctx, label, labeltoShow, p_value, v_min, v_max, FX_Idx, P_Num) - r.ImGui_SetNextItemWidth(ctx, 40) - local radius_outer = 10 - local pos = { reaper.ImGui_GetCursorScreenPos(ctx) } - local center = { pos[1] + radius_outer, pos[2] + radius_outer } - local CircleClr - local line_height = reaper.ImGui_GetTextLineHeight(ctx) - local draw_list = reaper.ImGui_GetWindowDrawList(ctx) - local item_inner_spacing = { reaper.ImGui_GetStyleVar(ctx, reaper.ImGui_StyleVar_ItemInnerSpacing()) } - local mouse_delta = { reaper.ImGui_GetMouseDelta(ctx) } - - local ANGLE_MIN = 3.141592 * 0.75 - local ANGLE_MAX = 3.141592 * 2.25 - local FxGUID = FXGUID[FX_Idx] - - reaper.ImGui_InvisibleButton(ctx, label, radius_outer * 2, radius_outer * 2 + line_height - 10 + - item_inner_spacing[2]) - - local value_changed = false - local is_active = reaper.ImGui_IsItemActive(ctx) - local is_hovered = reaper.ImGui_IsItemHovered(ctx) - - if is_active and mouse_delta[2] ~= 0.0 and FX[FxGUID].DeltaP_V ~= 1 then - local step = (v_max - v_min) / 200.0 - if Mods == Shift then step = 0.001 end - p_value = p_value + ((-mouse_delta[2]) * step) - if p_value < v_min then p_value = v_min end - if p_value > v_max then p_value = v_max end - end - - FX[FxGUID].DeltaP_V = FX[FxGUID].DeltaP_V or 0 - FX[FxGUID].DeltaP = FX[FxGUID].DeltaP or (r.TrackFX_GetNumParams(LT_Track, LT_FXNum) - 1) - - - if is_active then - lineClr = r.ImGui_GetColor(ctx, r.ImGui_Col_SliderGrabActive()) - CircleClr = Change_Clr_A(getClr(r.ImGui_Col_SliderGrabActive()), -0.3) - value_changed = true - ActiveAny = true - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, P_Num or Wet.P_Num[FX_Idx], p_value) - elseif is_hovered or p_value ~= 1 then - lineClr = Change_Clr_A(getClr(r.ImGui_Col_SliderGrabActive()), -0.3) - else - lineClr = r.ImGui_GetColor(ctx, r.ImGui_Col_FrameBgHovered()) - end - - if ActiveAny == true then - if IsLBtnHeld == false then ActiveAny = false end - end - - local t = (p_value - v_min) / (v_max - v_min) - local angle = ANGLE_MIN + (ANGLE_MAX - ANGLE_MIN) * t - local angle_cos, angle_sin = math.cos(angle), math.sin(angle) - local radius_inner = radius_outer * 0.40 - if r.ImGui_IsItemClicked(ctx, 1) and Mods == Alt then - local Total_P = r.TrackFX_GetNumParams(LT_Track, FX_Idx) - local P = Total_P - 1 - local DeltaV = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, P) - if DeltaV == 1 then - reaper.TrackFX_SetParamNormalized(LT_Track, FX_Idx, P, 0) - FX[FxGUID].DeltaP_V = 0 - else - reaper.TrackFX_SetParamNormalized(LT_Track, FX_Idx, P, 1) - FX[FxGUID].DeltaP_V = 1 - end - FX[FxGUID].DeltaP = P - end - - if FX[FxGUID].DeltaP_V ~= 1 then - r.ImGui_DrawList_AddCircle(draw_list, center[1], center[2], radius_outer, CircleClr or lineClr, 16) - r.ImGui_DrawList_AddLine(draw_list, center[1], center[2], center[1] + angle_cos * (radius_outer - 2), - center[2] + angle_sin * (radius_outer - 2), lineClr, 2.0) - r.ImGui_DrawList_AddText(draw_list, pos[1], pos[2] + radius_outer * 2 + item_inner_spacing[2], - reaper.ImGui_GetColor(ctx, reaper.ImGui_Col_Text()), labeltoShow) - else - local radius_outer = radius_outer - r.ImGui_DrawList_AddTriangleFilled(draw_list, center[1] - radius_outer, center[2] + radius_outer, center[1], - center[2] - radius_outer, center[1] + radius_outer, center[2] + radius_outer, 0x999900ff) - r.ImGui_DrawList_AddText(draw_list, center[1] - radius_outer / 2 + 1, center[2] - radius_outer / 2, - 0xffffffff, - 'S') - end - - if is_active or is_hovered and FX[FxGUID].DeltaP_V ~= 1 then - local window_padding = { reaper.ImGui_GetStyleVar(ctx, reaper.ImGui_StyleVar_WindowPadding()) } - reaper.ImGui_SetNextWindowPos(ctx, pos[1] - window_padding[1], - pos[2] - line_height - item_inner_spacing[2] - window_padding[2] - 8) - reaper.ImGui_BeginTooltip(ctx) - if Mods == Shift then - r.ImGui_Text(ctx, ('%.1f'):format(p_value * 100) .. '%') - else - r.ImGui_Text(ctx, ('%.0f'):format(p_value * 100) .. '%' --[[ ('%.3f'):format(p_value) ]]) - end - reaper.ImGui_EndTooltip(ctx) - end - if is_hovered then HintMessage = 'Alt+Right-Click = Delta-Solo' end - - return ActiveAny, value_changed, p_value - end - - function DrawTriangle(DL, CenterX, CenterY, size, clr) - local Cx = CenterX - local Cy = CenterY - local S = size - r.ImGui_DrawList_AddTriangleFilled(DL, Cx, Cy - S, Cx - S, Cy, Cx + S, Cy, clr or 0x77777777ff) - end - - function DrawDownwardTriangle(DL, CenterX, CenterY, size, clr) - local Cx = CenterX - local Cy = CenterY - local S = size - r.ImGui_DrawList_AddTriangleFilled(DL, Cx - S, Cy, Cx, Cy + S, Cx + S, Cy, clr or 0x77777777ff) - end - - function SL(xpos, pad) - r.ImGui_SameLine(ctx, xpos, pad) - end - - function IconBtn(w, h, icon, BGClr, center, Identifier) -- Y = wrench - r.ImGui_PushFont(ctx, FontAwesome) - if r.ImGui_InvisibleButton(ctx, icon .. (Identifier or ''), w, h) then - end - local FillClr - if r.ImGui_IsItemActive(ctx) then - FillClr = getClr(r.ImGui_Col_ButtonActive()) - IcnClr = getClr(r.ImGui_Col_TextDisabled()) - elseif r.ImGui_IsItemHovered(ctx) then - FillClr = getClr(r.ImGui_Col_ButtonHovered()) - IcnClr = getClr(r.ImGui_Col_Text()) - else - FillClr = getClr(r.ImGui_Col_Button()) - IcnClr = getClr(r.ImGui_Col_Text()) - end - if BGClr then FillClr = BGClr end - - L, T, R, B, W, H = HighlightSelectedItem(FillClr, 0x00000000, 0, L, T, R, B, h, w, H_OutlineSc, V_OutlineSc, - 'GetItemRect', Foreground) - TxtSzW, TxtSzH = r.ImGui_CalcTextSize(ctx, icon) - if center == 'center' then - r.ImGui_DrawList_AddText(WDL, L + W / 2 - TxtSzW / 2, T - H / 2 - 1, IcnClr, icon) - else - r.ImGui_DrawList_AddText(WDL, L + 3, T - H / 2, IcnClr, icon) - end - r.ImGui_PopFont(ctx) - if r.ImGui_IsItemActivated(ctx) then return true end - end - - function getClr(f) - return r.ImGui_GetStyleColor(ctx, f) - end - - function Change_Clr_A(CLR, HowMuch) - local R, G, B, A = r.ImGui_ColorConvertU32ToDouble4(CLR) - local A = SetMinMax(A + HowMuch, 0, 1) - return r.ImGui_ColorConvertDouble4ToU32(R, G, B, A) - end - - function Generate_Active_And_Hvr_CLRs(Clr) - local ActV, HvrV - local R, G, B, A = r.ImGui_ColorConvertU32ToDouble4(Clr) - local H, S, V = r.ImGui_ColorConvertRGBtoHSV(R, G, B) - if V > 0.9 then - ActV = V - 0.2 - HvrV = V - 0.1 - end - local R, G, B = r.ImGui_ColorConvertHSVtoRGB(H, S, SetMinMax(ActV or V + 0.2, 0, 1)) - local ActClr = r.ImGui_ColorConvertDouble4ToU32(R, G, B, A) - local R, G, B = r.ImGui_ColorConvertHSVtoRGB(H, S, HvrV or V + 0.1) - local HvrClr = r.ImGui_ColorConvertDouble4ToU32(R, G, B, A) - return ActClr, HvrClr - end - - function IfTryingToAddExistingPrm(Fx_P, FxGUID, Shape, L, T, R, B, Rad) - if Fx_P .. FxGUID == TryingToAddExistingPrm then - if r.time_precise() > TimeNow and r.time_precise() < TimeNow + 0.1 or r.time_precise() > TimeNow + 0.2 and r.time_precise() < TimeNow + 0.3 then - if Shape == 'Circle' then - r.ImGui_DrawList_AddCircleFilled(FX.DL, L, T, Rad, 0x99999950) - elseif Shape == 'Rect' then - local L, T = reaper.ImGui_GetItemRectMin(ctx) - r.ImGui_DrawList_AddRectFilled(FX.DL, L, T, R, B, 0x99999977, Rounding) - end - end - end - if Fx_P .. FxGUID == TryingToAddExistingPrm_Cont then - local L, T = reaper.ImGui_GetItemRectMin(ctx) - if Shape == 'Circle' then - r.ImGui_DrawList_AddCircleFilled(FX.DL, L, T, Rad, 0x99999950) - elseif Shape == 'Rect' then - r.ImGui_DrawList_AddRectFilled(FX.DL, L, T, R, B, 0x99999977, Rounding) - end - end - end - - function RestoreBlacklistSettings(FxGUID, FX_Idx, LT_Track, PrmCount) - local _, FXsBL = r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: Morph_BL' .. FxGUID, '', false) - rv, FX_Name = r.TrackFX_GetFXName(LT_Track, FX_Idx) - local Nm = ChangeFX_Name(FX_Name) - FX[FxGUID] = FX[FxGUID] or {} - FX[FxGUID].PrmList = FX[FxGUID].PrmList or {} - if FXsBL == 'Has Blacklist saved to FX' then -- if there's FX-specific BL settings - --restore FX specific Blacklist settings - for i = 0, PrmCount - 4, 1 do - FX[FxGUID].PrmList[i] = FX[FxGUID].PrmList[i] or {} - _, FX[FxGUID].PrmList[i].BL = r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: Morph_BL' .. FxGUID .. i, - '', - false) - if FX[FxGUID].PrmList[i].BL == 'Blacklisted' then FX[FxGUID].PrmList[i].BL = true else FX[FxGUID].PrmList[i].BL = nil end - end - else --if there's no FX-specific BL settings saved - local _, whether = r.GetProjExtState(0, 'FX Devices - Preset Morph', 'Whether FX has Blacklist' .. (Nm or '')) - if whether == 'Yes' then -- if there's Project-specific BL settings - for i = 0, PrmCount - 4, 1 do - FX[FxGUID].PrmList[i] = FX[FxGUID].PrmList[i] or {} - local rv, BLprm = r.GetProjExtState(0, 'FX Devices - Preset Morph', Nm .. ' Blacklist ' .. i) - if BLprm ~= '' then - BLprm = tonumber(BLprm) - FX[FxGUID].PrmList[BLprm] = FX[FxGUID].PrmList[BLprm] or {} - FX[FxGUID].PrmList[BLprm].BL = true - else - end - end - else -- Check if need to restore Global Blacklist settings - file, file_path = CallFile('r', Nm .. '.ini', 'Preset Morphing') - if file then - local L = get_lines(file_path) - for i, V in ipairs(L) do - local Num = get_aftr_Equal_Num(V) - - FX[FxGUID].PrmList[Num] = {} - FX[FxGUID].PrmList[Num].BL = true - end - file:close() - end - end - end - end - - function tooltip(A) - reaper.ImGui_BeginTooltip(ctx) - reaper.ImGui_SetTooltip(ctx, A) - reaper.ImGui_EndTooltip(ctx) - end - - function HintToolTip(A) - reaper.ImGui_BeginTooltip(ctx) - reaper.ImGui_SetTooltip(ctx, A) - reaper.ImGui_EndTooltip(ctx) - end - - function openFXwindow(LT_Track, FX_Idx) - FX.Win.FocusState = r.TrackFX_GetOpen(LT_Track, FX_Idx) - if FX.Win.FocusState == false then - reaper.TrackFX_Show(LT_Track, FX_Idx, 3) - elseif FX.Win.FocusState == true then - reaper.TrackFX_Show(LT_Track, FX_Idx, 2) - end - end - - function ToggleBypassFX(LT_Track, FX_Idx) - FX.Enable = FX.Enable or {} - FX.Enable[FX_Idx] = reaper.TrackFX_GetEnabled(LT_Track, FX_Idx) - if FX.Enable[FX_Idx] == true then - reaper.TrackFX_SetEnabled(LT_Track, FX_Idx, false) - elseif FX.Enable[FX_Idx] == false then - reaper.TrackFX_SetEnabled(LT_Track, FX_Idx, true) - end - end - - function DeleteFX(FX_Idx) - local DelFX_Name - r.Undo_BeginBlock() - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: PreFX ' .. (tablefind(Trk[TrkID].PreFX, FXGUID[FX_Idx]) or ''), - '', - true) - --r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: PostFX '..(tablefind (Trk[TrkID].PostFX, FXGUID[FX_Idx]) or ''), '', true) - - if tablefind(Trk[TrkID].PreFX, FXGUID[FX_Idx]) then - DelFX_Name = 'FX in Pre-FX Chain' - table.remove(Trk[TrkID].PreFX, tablefind(Trk[TrkID].PreFX, FXGUID[FX_Idx])) - end - - if tablefind(Trk[TrkID].PostFX, FXGUID[FX_Idx]) then - table.remove(Trk[TrkID].PostFX, tablefind(Trk[TrkID].PostFX, FXGUID[FX_Idx])) - for i = 1, #Trk[TrkID].PostFX + 1, 1 do - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: PostFX ' .. i, Trk[TrkID].PostFX[i] or '', true) - end - end - - if FX[FXGUID[FX_Idx]].InWhichBand then -- if FX is in band split - for i = 0, Sel_Track_FX_Count - 1, 1 do - if FX[FXGUID[i]].FXsInBS then - if tablefind(FX[FXGUID[i]].FXsInBS, FXGUID[FX_Idx]) then - table.remove(FX[FXGUID[i]].FXsInBS, tablefind(FX[FXGUID[i]].FXsInBS, FXGUID[FX_Idx])) - end - end - end - end - - DeleteAllParamOfFX(FXGUID[FX_Idx], TrkID) - - - - if FX_Name:find('Pro Q 3') ~= nil and not FXinPost and not FXinPre then - r.TrackFX_Delete(LT_Track, FX_Idx) - r.TrackFX_Delete(LT_Track, FX_Idx - 1) - DelFX_Name = 'Pro Q 3' - elseif FX_Name:find('Pro C 2') ~= nil and not FXinPost and not FXinPre then - DelFX_Name = 'Pro C 2' - r.TrackFX_Delete(LT_Track, FX_Idx + 1) - r.TrackFX_Delete(LT_Track, FX_Idx) - r.TrackFX_Delete(LT_Track, FX_Idx - 1) - else - r.TrackFX_Delete(LT_Track, FX_Idx) - end - - - - r.Undo_EndBlock('Delete ' .. (DelFX_Name or 'FX'), 0) - end - - function DeletePrm(FxGUID, Fx_P, FX_Idx) - --LE.Sel_Items[1] = nil - local FP = FX[FxGUID][Fx_P] - for i, v in ipairs (FX[FxGUID]) do - if v.ConditionPrm then - v.ConditionPrm = nil - end - end - - - if FP.WhichMODs then - Trk[TrkID].ModPrmInst = Trk[TrkID].ModPrmInst - 1 - FX[FxGUID][Fx_P].WhichCC = nil - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: FX' .. FxGUID .. 'WhichCC' .. FP.Num, '', true) - - FX[FxGUID][Fx_P].WhichMODs = nil - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: FX' .. FxGUID .. 'Prm' .. Fx_P .. 'Linked to which Mods', '', - true) - end - - for Mc = 1, 8, 1 do - if FP.ModAMT then - if FP.ModAMT[Mc] then - Unlink_Parm(LT_TrackNum, FX_Idx, FP.Num) - FP.ModAMT[Mc] = nil - end - end - end - - table.remove(FX[FxGUID], Fx_P) - if Trk.Prm.Inst[TrkID] then - Trk.Prm.Inst[TrkID] = Trk.Prm.Inst[TrkID] - 1 - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: Trk Prm Count', Trk.Prm.Inst[TrkID], true) - end - - - for i, v in ipairs(FX[FxGUID]) do - r.SetProjExtState(0, 'FX Devices', 'FX' .. i .. 'Name' .. FxGUID, FX[FxGUID][i].Name) - r.SetProjExtState(0, 'FX Devices', 'FX' .. i .. 'Num' .. FxGUID, FX[FxGUID][i].Num) - end - r.SetProjExtState(0, 'FX Devices', 'Prm Count' .. FxGUID, #FX[FxGUID]) - -- Delete Proj Ext state data!!!!!!!!!! - end - - function SyncTrkPrmVtoActualValue() - for FX_Idx = 0, Sel_Track_FX_Count, 1 do - local FxGUID = r.TrackFX_GetFXGUID(LT_Track, FX_Idx) - if FxGUID then - FX[FxGUID] = FX[FxGUID] or {} - for Fx_P = 1, #FX[FxGUID] or 0, 1 do - if TrkID then - if not FX[FxGUID][Fx_P].WhichMODs then - FX[FxGUID][Fx_P].V = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, FX[FxGUID][Fx_P].Num or 0) - end - end - end - end - end - end - - -------------General Functions ------------------------------ - - - - function scandir(directory) - - local Files = {} - for i=0, 999, 1 do - local F = r.EnumerateFiles(directory,i) - if F then table.insert(Files, F ) end - - if not F then return Files end - end - - return F - end - - - function IsPrmAlreadyAdded(ShowAlreadyAddedPrm) - GetLTParam() - local FX_Count = reaper.TrackFX_GetCount(LT_Track); local RptPrmFound - local F = FX[LT_FXGUID] or {} - - if F then - for i, v in ipairs(F) do - if FX[LT_FXGUID][i].Num == LT_ParamNum then - RptPrmFound = true - - if ShowAlreadyAddedPrm then - - TryingToAddExistingPrm = i .. LT_FXGUID - TimeNow = r.time_precise() - end - end - end - --[[ if not RptPrmFound and LT_FXGUID then - StoreNewParam(LT_FXGUID, LT_ParamName, LT_ParamNum, LT_FXNum, true ) - end ]] - end - return RptPrmFound - - end - - function RemoveEmptyStr(str) - if str == '' then return nil else return str end - end - - function tablelength(T) - local count = 0 - for _ in pairs(T) do count = count + 1 end - return count - end - - function AddSpacing(Rpt) - for i = 1, Rpt, 1 do - r.ImGui_Spacing(ctx) - end - end -end - - -function CopyFile(old_path, new_path) - local old_file = io.open(old_path, "rb") - local new_file = io.open(new_path, "wb") - local old_file_sz, new_file_sz = 0, 0 - if not old_file or not new_file then - return false - end - while true do - local block = old_file:read(2 ^ 13) - if not block then - old_file_sz = old_file:seek("end") - break - end - new_file:write(block) - end - old_file:close() - new_file_sz = new_file:seek("end") - new_file:close() - return new_file_sz == old_file_sz -end - - -function CopyImageFile(filename, subfolder) - if filename then - local UserOS = r.GetOS() - local slash = '%\\' - if UserOS == "OSX32" or UserOS == "OSX64" or UserOS == "macOS-arm64" then - slash = '/' - end - local index = filename:match ('^.*()'..slash) - local SUBFOLDER = subfolder or '' - local NewFileName = r.GetResourcePath() .. '/Scripts/ReaTeam Scripts/FX/BryanChi_FX Devices/Images/' .. SUBFOLDER .. filename:sub(index) - local relativePath = '/Scripts/ReaTeam Scripts/FX/BryanChi_FX Devices/Images/' .. SUBFOLDER .. filename:sub(index) - local Files = scandir('/Scripts/ReaTeam Scripts/FX/BryanChi_FX Devices/Images/' .. SUBFOLDER ) - if FindExactStringInTable(Files, NewFileName) then - return NewFileName, relativePath - else - CopyFile(filename, NewFileName) - return NewFileName, relativePath - end - end - end - -function LayoutEditorFunctions() - function AddKnob(ctx, label, labeltoShow, p_value, v_min, v_max, Fx_P, FX_Idx, P_Num, Style, Radius, - item_inner_spacing,Disabled, LblTextSize, Lbl_Pos, V_Pos,ImgPath) - if Style == 'Pro C' then r.gmem_attach('ParamValues') end - - local FxGUID = FXGUID[FX_Idx] - - FX[FxGUID] = FX[FxGUID] or {} - FX[FxGUID][Fx_P] = FX[FxGUID][Fx_P] or {} - - if FX[FxGUID].Morph_Value_Edit or Mods == Alt + Ctrl then r.ImGui_BeginDisabled(ctx) end - - local radius_outer = Radius or Df.KnobRadius; - local FP = FX[FxGUID][Fx_P] - local V_Font, Font = Arial_12, Font_Andale_Mono_12 - if LblTextSize ~= 'No Font' then - Font = 'Font_Andale_Mono_' .. roundUp(FP.FontSize or LblTextSize or Knob_DefaultFontSize, 1) - V_Font = 'Arial_' .. roundUp(FP.V_FontSize or LblTextSize or Knob_DefaultFontSize, 1) - r.ImGui_PushFont(ctx, _G[Font]) - end - local Radius = Radius or 0 - - local pos = { r.ImGui_GetCursorScreenPos(ctx) } - local center = { pos[1] + radius_outer, pos[2] + radius_outer } - local Clr_SldrGrab = Change_Clr_A(getClr(r.ImGui_Col_SliderGrabActive()), -0.2) - - - local TextW = r.ImGui_CalcTextSize(ctx, labeltoShow or FX[FxGUID][Fx_P].Name, nil, nil, true) - - local CenteredLblPos, CenteredVPos - - if TextW < (Radius or 0) * 2 then - CenteredLblPos = pos[1] + Radius - TextW / 2 - else - CenteredLblPos = pos[1] - end - - - - if DraggingMorph == FxGUID then p_value = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, P_Num) end - - local line_height = reaper.ImGui_GetTextLineHeight(ctx) - local draw_list = reaper.ImGui_GetWindowDrawList(ctx) - local item_inner_spacing = { item_inner_spacing, item_inner_spacing } or - { { reaper.ImGui_GetStyleVar(ctx, reaper.ImGui_StyleVar_ItemInnerSpacing()) } } - local mouse_delta = { reaper.ImGui_GetMouseDelta(ctx) } - local F_Tp = FX.Prm.ToTrkPrm[FxGUID .. Fx_P] or 0 - - local ANGLE_MIN = 3.141592 * 0.75 - local ANGLE_MAX = 3.141592 * 2.25 - local BtnOffset - if Lbl_Pos == 'Top' then BtnOffset = -line_height end - - r.ImGui_InvisibleButton(ctx, label, radius_outer * 2, - radius_outer * 2 + line_height + item_inner_spacing[2] + (BtnOffset or 0)) - if V_Pos == 'Free' then - local Ox, Oy = r.ImGui_GetCursorScreenPos(ctx) - r.ImGui_DrawList_AddTextEx(draw_list, _G[V_Font], FX[FxGUID][Fx_P].V_FontSize or Knob_DefaultFontSize, - pos[1] + (FP.V_Pos_X or 0), pos[2] + (FP.V_Pos_Y or 0), FX[FxGUID][Fx_P].V_Clr or 0xffffffff, FormatPV, - (Radius or 20) * 2) - end - - if FP.Lbl_Pos == 'Free' then - local Cx, Cy = r.ImGui_GetCursorScreenPos(ctx) - r.ImGui_DrawList_AddTextEx(draw_list, _G[Font], FP.FontSize or LblTextSize or Knob_DefaultFontSize, - pos[1] + (FP.Lbl_Pos_X or 0), pos[2] + (FP.Lbl_Pos_Y or 0), FP.Lbl_Clr or getClr(r.ImGui_Col_Text()), - FP.CustomLbl or FP.Name) - end - - - local BtnL, BtnT = r.ImGui_GetItemRectMin(ctx) - local BtnR, BtnB = r.ImGui_GetItemRectMax(ctx) - if Lbl_Pos == 'Top' then - r.ImGui_DrawList_AddTextEx(draw_list, _G[Font], FX[FxGUID][Fx_P].FontSize or Knob_DefaultFontSize, - CenteredLblPos or pos[1], BtnT - line_height + item_inner_spacing[2], FP.Lbl_Clr or 0xffffffff, - labeltoShow or FP.Name, nil, pos[1], BtnT - line_height, pos[1] + Radius * 2, BtnT + line_height) - end - - - - local value_changed = false - local is_active = reaper.ImGui_IsItemActive(ctx) - local is_hovered = reaper.ImGui_IsItemHovered(ctx) - if (is_hovered or Tweaking == P_Num .. FxGUID) and (V_Pos == 'None' or not V_Pos) then - local get, PV = r.TrackFX_GetFormattedParamValue(LT_Track, FX_Idx, P_Num) - if get then - local Y_Pos - if Lbl_Pos == 'Top' then _, Y_Pos = r.ImGui_GetCursorScreenPos(ctx) end - local window_padding = { r.ImGui_GetStyleVar(ctx, r.ImGui_StyleVar_WindowPadding()) } - r.ImGui_SetNextWindowPos(ctx, pos[1] + radius_outer / 2, - Y_Pos or pos[2] - line_height - window_padding[2] - 8) - r.ImGui_BeginTooltip(ctx) - r.ImGui_Text(ctx, PV) - r.ImGui_EndTooltip(ctx) - end - Clr_SldrGrab = getClr(r.ImGui_Col_SliderGrabActive()) - end - - if is_active == true then - Knob_Active = true - Clr_SldrGrab = getClr(r.ImGui_Col_Text()) - - - HideCursorTillMouseUp(0) - r.ImGui_SetMouseCursor(ctx, r.ImGui_MouseCursor_None()) - end - if Knob_Active == true then - if IsLBtnHeld == false then Knob_Active = false end - end - - if is_active and -mouse_delta[2] ~= 0.0 then - local stepscale = 1 - if Mods == Shift then stepscale = 3 end - local step = (v_max - v_min) / (200.0 * stepscale) - p_value = p_value + (-mouse_delta[2] * step) - if p_value < v_min then p_value = v_min end - if p_value > v_max then p_value = v_max end - value_changed = true - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, P_Num, p_value) - MvingP_Idx = F_Tp - Tweaking = P_Num .. FxGUID - end - local t = (p_value - v_min) / (v_max - v_min) - - local angle = ANGLE_MIN + (ANGLE_MAX - ANGLE_MIN) * t - - local angle_cos, angle_sin = math.cos(angle), math.sin(angle) - local radius_inner = radius_outer * 0.40 - - - local ClrBg = reaper.ImGui_GetColor(ctx, reaper.ImGui_Col_FrameBg()) - if Style == 'Pro C' then - local offset; local TxtClr = 0xD9D9D9ff - if labeltoShow == 'Release' then offset = 5 else offset = nil end - - reaper.ImGui_DrawList_AddCircleFilled(draw_list, center[1], center[2], radius_outer, - FX[FxGUID][Fx_P].BgClr or 0xC7A47399) - reaper.ImGui_DrawList_AddLine(draw_list, center[1] + angle_cos * radius_inner, center[2] + angle_sin * - radius_inner, center[1] + angle_cos * (radius_outer - 2), center[2] + angle_sin * (radius_outer - 2), - FX[FxGUID][Fx_P].GrbClr or 0xDBDBDBff, FX[FxGUID][Fx_P].Value_Thick or 2.0) - local TextW, h = reaper.ImGui_CalcTextSize(ctx, labeltoShow, nil, nil, true) - if Disabled == 'Pro C Ratio Disabled' then - local CompStyle = 'CompStyle##Value' - if _G[CompStyle] == 'Vocal' then - r.ImGui_DrawList_AddCircleFilled(draw_list, center[1], center[2], radius_outer, 0x000000aa) - TxtClr = 0x55555577 - end - end - --if string.find(FX_Name, 'Pro%-C 2') then - -- r.ImGui_DrawList_AddText(draw_list, center[1]-TextW/2+ (offset or 0) , pos[2] + radius_outer * 2 + item_inner_spacing[2], TxtClr, labeltoShow) - --end - - - - - - local txtX = center[1] - TextW / 2; local txtY = pos[2] + radius_outer * 2 + item_inner_spacing[2] - - local function AutoBtn(Label, offset, Rect_offset) - if labeltoShow == Label then - MouseX, MouseY = reaper.ImGui_GetMousePos(ctx) - r.ImGui_DrawList_AddText(draw_list, center[1] - TextW / 2 + (offset or 0), - pos[2] + radius_outer * 2 + item_inner_spacing[2], 0xFFD57144, 'A') - - if MouseX > txtX and MouseX < txtX + TextW and MouseY > txtY - 4 and MouseY < txtY + 10 then - r.ImGui_DrawList_AddRectFilled(draw_list, txtX + (Rect_offset or 0), txtY, - txtX + TextW + (Rect_offset or 0), txtY + 10, 0x99999955, 3) - r.ImGui_DrawList_AddText(draw_list, center[1] - TextW / 2 + (offset or 0), - pos[2] + radius_outer * 2 + item_inner_spacing[2], 0xFFD57166, 'A') - if IsLBtnClicked and Label == 'Release' then - AutoRelease = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, 7) - if AutoRelease == 1 then - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, 7, 0) - AutoRelease = 0 - else - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, 7, 1) - AutoRelease = 1 - end - elseif IsLBtnClicked and Label == 'Gain' then - AutoGain = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, 14) - if AutoGain == 1 then - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, 14, 0) - AutoGain = 0 - else - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, 14, 1) - AutoGain = 1 - end - end - end - - if Label == 'Release' then - if not AutoRelease then AutoRelease = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, 7) end - if AutoRelease == 1 then - r.ImGui_DrawList_AddText(draw_list, center[1] - TextW / 2 + (offset or 0), - pos[2] + radius_outer * 2 + item_inner_spacing[2], 0xFFD571ff, 'A') - end - end - if Label == 'Gain' then - if not AutoGain then AutoGain = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, 14) end - if AutoGain == 1 then - r.ImGui_DrawList_AddText(draw_list, center[1] - TextW / 2 + (offset or 0), - pos[2] + radius_outer * 2 + item_inner_spacing[2], 0xFFD571ff, 'A') - end - end - end - end - - AutoBtn('Release', -8, 3) - AutoBtn('Gain', -8) - - if is_active or is_hovered then - if labeltoShow == 'Release' or labeltoShow == 'Gain' and MouseX > txtX and MouseX < txtX + TextW and MouseY > txtY - 4 and MouseY < txtY + 10 then - else - if is_active then - r.ImGui_DrawList_AddCircleFilled(draw_list, center[1], center[2], radius_outer, - FX[FxGUID][Fx_P].BgClrAct or 0xE4B96B99) - r.ImGui_DrawList_AddLine(draw_list, center[1] + angle_cos * radius_inner, - center[2] + angle_sin * radius_inner, center[1] + angle_cos * (radius_outer - 2), - center[2] + angle_sin * (radius_outer - 2), FP.V_Clr or 0xDBDBDBff, 2.0) - elseif is_hovered then - r.ImGui_DrawList_AddCircle(draw_list, center[1], center[2], radius_outer, 0xE4B96B99) - --r.ImGui_DrawList_AddLine(draw_list, center[1] + angle_cos*radius_inner, center[2] + angle_sin*radius_inner, center[1] + angle_cos*(radius_outer-2), center[2] + angle_sin*(radius_outer-2), FP.V_Clr or 0xDBDBDBff, 2.0) - end - end - end - elseif Style == 'FX Layering' then - r.ImGui_DrawList_AddCircleFilled(draw_list, center[1], center[2], radius_outer, - FX[FxGUID][Fx_P].BgClr or r.ImGui_GetColor(ctx, r.ImGui_Col_Button()), 16) - r.ImGui_DrawList_AddLine(draw_list, center[1] + angle_cos * radius_inner, - center[2] + angle_sin * radius_inner, - center[1] + angle_cos * (radius_outer - 2), center[2] + angle_sin * (radius_outer - 2), - FX[FxGUID][Fx_P].GrbClr or Clr_SldrGrab, 2.0) - r.ImGui_DrawList_PathArcTo(draw_list, center[1], center[2], radius_outer / 2, ANGLE_MAX - ANGLE_MIN, angle) - r.ImGui_DrawList_PathStroke(draw_list, 0x99999922, nil, radius_outer * 0.6) - r.ImGui_DrawList_PathClear(draw_list) - - r.ImGui_DrawList_PathArcTo(draw_list, center[1], center[2], radius_outer / 2, ANGLE_MAX + 1.35, - ANGLE_MAX + 0.15) - r.ImGui_DrawList_PathStroke(draw_list, r.ImGui_GetColor(ctx, r.ImGui_Col_FrameBg()), nil, radius_outer) - - r.ImGui_DrawList_AddCircleFilled(draw_list, center[1], center[2], radius_inner, - r.ImGui_GetColor(ctx, - is_active and reaper.ImGui_Col_FrameBgActive() or is_hovered and reaper.ImGui_Col_FrameBgHovered() or - reaper.ImGui_Col_FrameBg()), 16) - - elseif Style == 'Custom Image' then - local Image = ImgPath or FP.Image - if Image then - local w, h = r.ImGui_Image_GetSize(Image) - - if h > w * 5 then -- It's probably a strip knob file - local scale = 2 - local sz = radius_outer * scale - - - uvmin, uvmax = Calc_strip_uv(Image, FP.V) - - - r.ImGui_DrawList_AddImage(WDL, Image, center[1] - sz / 2, center[2] - sz / 2, center[1] + sz / 2, - center[2] + sz / 2, 0, uvmin, 1, uvmax, FP.BgClr or 0xffffffff) - else - local scale = 2 - local sz = radius_outer * scale - ImageAngle(ctx, Image, 4 + FP.V * 4.5, sz, sz, center[1] - sz / 2, center[2] - sz / 2) - end - end - elseif Style == 'Invisible' then - else -- for all generic FXs - r.ImGui_DrawList_AddCircleFilled(draw_list, center[1], center[2], radius_outer, - FX[FxGUID][Fx_P].BgClr or r.ImGui_GetColor(ctx, r.ImGui_Col_Button())) - r.ImGui_DrawList_AddLine(draw_list, center[1] + angle_cos * radius_inner, - center[2] + angle_sin * radius_inner, - center[1] + angle_cos * (radius_outer - 2), center[2] + angle_sin * (radius_outer - 2), - FX[FxGUID][Fx_P].GrbClr or Clr_SldrGrab, FX[FxGUID][Fx_P].Value_Thick or 2) - r.ImGui_DrawList_PathArcTo(draw_list, center[1], center[2], radius_outer / 2, ANGLE_MIN, angle) - r.ImGui_DrawList_PathStroke(draw_list, 0x99999922, nil, radius_outer * 0.6) - r.ImGui_DrawList_PathClear(draw_list) - r.ImGui_DrawList_AddCircleFilled(draw_list, center[1], center[2], radius_inner, - reaper.ImGui_GetColor(ctx, - is_active and reaper.ImGui_Col_FrameBgActive() or is_hovered and reaper.ImGui_Col_FrameBgHovered() or - reaper.ImGui_Col_FrameBg())) - end - - - - - - if FX[FxGUID].Morph_Value_Edit or Mods == Alt + Ctrl and FX[FxGUID].MorphA and FX[FxGUID].MorphB then - r.ImGui_EndDisabled(ctx) - - if FX[FxGUID].MorphA[P_Num] and FX[FxGUID].MorphB[P_Num] then - r.ImGui_SetCursorScreenPos(ctx, pos[1], pos[2]) - local sizeX, sizeY = r.ImGui_GetItemRectSize(ctx) - r.ImGui_InvisibleButton(ctx, label, sizeX, sizeY) - - - - --local A = SetMinMax(PosL+ sizeX*FX[FxGUID].MorphA[P_Num],PosL, PosR) - --local B = SetMinMax(PosL+ sizeX*FX[FxGUID].MorphB[P_Num],PosL,PosR) - local A = ANGLE_MIN + (ANGLE_MAX - ANGLE_MIN) * FX[FxGUID].MorphA[P_Num] - local B = ANGLE_MIN + (ANGLE_MAX - ANGLE_MIN) * FX[FxGUID].MorphB[P_Num] - - local ClrA, ClrB = DefClr_A_Hvr, DefClr_B_Hvr - local MsX, MsY = r.ImGui_GetMousePos(ctx) - - if FX[FxGUID].MorphA[P_Num] ~= FX[FxGUID].MorphB[P_Num] then - --r.ImGui_DrawList_PathArcTo( draw_list, center[1] , center[2],(radius_inner+ radius_outer)/2, A , B) - FX[FxGUID].Angle1 = angle - FX[FxGUID].Angle2 = angle + (ANGLE_MAX - ANGLE_MIN) * 0.5 - local angle_cos, angle_sin = math.cos(A), math.sin(A) - r.ImGui_DrawList_AddLine(draw_list, center[1], center[2], center[1] + angle_cos * (radius_outer - 2), - center[2] + angle_sin * (radius_outer - 2), ClrA, 2.0) - local angle_cos, angle_sin = math.cos(B), math.sin(B) - r.ImGui_DrawList_AddLine(draw_list, center[1], center[2], center[1] + angle_cos * (radius_outer - 2), - center[2] + angle_sin * (radius_outer - 2), ClrB, 2.0) - - - r.ImGui_DrawList_PathStroke(draw_list, ClrA, nil, radius_outer * 0.2) - r.ImGui_DrawList_PathClear(draw_list) - --r.ImGui_DrawList_AddRectFilledMultiColor(WDL,A,PosT,B,PosB,ClrA, ClrB, ClrB,ClrA) - end - - local txtClr = r.ImGui_GetStyleColor(ctx, r.ImGui_Col_Text()) - - if r.ImGui_IsItemClicked(ctx) or r.ImGui_IsItemClicked(ctx, 1) then - if IsLBtnClicked or IsRBtnClicked then - FP.TweakingAB_Val = P_Num - Orig_Baseline = GetParmModTable(LT_TrackNum, FX_Idx, P_Num, 'PARAMOD_BASELINE') - end - if not FP.TweakingAB_Val then - local offsetA, offsetB - --if AB-14 then offsetA=-10 offsetB = 10 end - --r.ImGui_DrawList_AddTextEx(WDL,Font_Andale_Mono_20_B, 16, A, PosT+(offsetA or 0), txtClr,'A') - --r.ImGui_DrawList_AddTextEx(WDL,Font_Andale_Mono_20_B, 16, B, PosT+(offsetB or 0), txtClr, 'B') - end - end - - if FP.TweakingAB_Val == P_Num and not MorphingMenuOpen then - local X_A, X_B - local offsetA, offsetB - if IsLBtnHeld then - local drag = FX[FxGUID].MorphA[P_Num] + select(2, r.ImGui_GetMouseDelta(ctx)) * -0.01 - FX[FxGUID].MorphA[P_Num] = SetMinMax(drag, 0, 1) - if FX[FxGUID].Morph_ID then -- if Morph Sldr is linked to a CC - local A = (MsY - BtnT) / sizeY - local Scale = FX[FxGUID].MorphB[P_Num] - A - Link_Param_to_CC(LT_TrackNum, FX_Idx, P_Num, true, true, 160, FX[FxGUID].Morph_ID, A, Scale) - end - elseif IsRBtnHeld then - local drag = FX[FxGUID].MorphB[P_Num] + select(2, r.ImGui_GetMouseDelta(ctx, 1)) * -0.01 - FX[FxGUID].MorphB[P_Num] = SetMinMax(drag, 0, 1) - if FX[FxGUID].Morph_ID then -- if Morph Sldr is linked to a CC - Link_Param_to_CC(LT_TrackNum, FX_Idx, P_Num, true, true, 160, FX[FxGUID].Morph_ID, - Orig_Baseline, - FX[FxGUID].MorphB[P_Num] - FX[FxGUID].MorphA[P_Num]) - end - end - if IsLBtnHeld then - X_A = MsX - Y_A = MsY - 15 - offsetA = -10 - if MsX < B + 5 and MsX > B - 14 then offsetB = 10 end - elseif IsRBtnHeld then - X_B = MsX - offsetB = -10 - if MsX < A + 5 and MsX > A - 14 then offsetA = 10 end - end - - r.ImGui_DrawList_AddTextEx(WDL, Font_Andale_Mono_20_B, 16, A, BtnT + (offsetA or 0), txtClr, 'A') - r.ImGui_DrawList_AddTextEx(WDL, Font_Andale_Mono_20_B, 16, B, BtnT + (offsetB or 0), txtClr, 'B') - if LBtnRel or RBtnRel then - StoreAllPrmVal('A', 'Dont') - StoreAllPrmVal('B', 'Dont') - FP.TweakingAB_Val = nil - end - end - end - r.ImGui_BeginDisabled(ctx) - end - - - if Lbl_Pos == 'Bottom' then --Write Bottom Label - local T = pos[2] + radius_outer * 2 + item_inner_spacing[2]; local R = pos[1] + radius_outer * 2; local L = - pos - [1] - local X, Y = CenteredLblPos or pos[1], pos[2] + radius_outer * 2 + item_inner_spacing[2] - local Clr = FX[FxGUID][Fx_P].Lbl_Clr or 0xffffffff - local FontSize = FX[FxGUID][Fx_P].FontSize or Knob_DefaultFontSize - - r.ImGui_DrawList_AddTextEx(draw_list, _G[Font], FX[FxGUID][Fx_P].FontSize or Knob_DefaultFontSize, X, Y, Clr, - labeltoShow or FX[FxGUID][Fx_P].Name, (Radius or 20) * 2, X, Y, X + (Radius or 20) * 2, Y + FontSize * 2) - end - RemoveModulationIfDoubleRClick(FxGUID, Fx_P, P_Num, FX_Idx) - - if V_Pos ~= 'None' and V_Pos then - r.ImGui_PushFont(ctx, _G[V_Font]) - _, FormatPV = r.TrackFX_GetFormattedParamValue(LT_Track, FX_Idx, P_Num) - if FX[FxGUID][Fx_P].ValToNoteL then - FormatPV = StrToNum(FormatPV) - tempo = r.Master_GetTempo() - local num = FormatPV:gsub('[^%p%d]', '') - noteL = num * tempo / 60000 - - - if noteL > 0.99 and noteL < 1.99 then - FormatPV = roundUp(noteL, 1) .. '/4' - elseif noteL > 1.99 then - FormatPV = roundUp(noteL, 2) .. '/4' - elseif noteL > 0.49 and noteL < 0.99 then - FormatPV = '1/8' - elseif noteL > 0.24 and noteL < 0.49 then - FormatPV = '1/16' - elseif noteL > 0.124 and noteL < 0.24 then - FormatPV = '1/32' - elseif noteL < 0.124 then - FormatPV = '1/64' - end - end - - if FX[FxGUID][Fx_P].V_Round then FormatPV = RoundPrmV(FormatPV, FX[FxGUID][Fx_P].V_Round) end - - - local ValueTxtW = r.ImGui_CalcTextSize(ctx, FormatPV, nil, nil, true) - if ValueTxtW < Radius * 2 then - CenteredVPos = pos[1] + Radius - ValueTxtW / 2 - else - CenteredVPos = pos[1] - end - local Y_Offset, drawlist - - if V_Pos == 'Within' then Y_Offset = radius_outer * 1.2 end - if is_active or is_hovered then drawlist = Glob.FDL else drawlist = draw_list end - if V_Pos ~= 'Free' then - - r.ImGui_DrawList_AddTextEx(draw_list, _G[V_Font], FX[FxGUID][Fx_P].V_FontSize or Knob_DefaultFontSize, - CenteredVPos, pos[2] + radius_outer * 2 + item_inner_spacing[2] - (Y_Offset or 0), FX[FxGUID][Fx_P].V_Clr or 0xffffffff, FormatPV, (Radius or 20) * 2) - end - r.ImGui_PopFont(ctx) - end - - if Lbl_Pos == 'Within' and Style == 'FX Layering' then - local ValueTxtW = r.ImGui_CalcTextSize(ctx, labeltoShow, nil, nil, true) - CenteredVPos = pos[1] + Radius - ValueTxtW / 2 + 0.5 - Y_Offset = radius_outer * 1.3 - 1 - - r.ImGui_DrawList_AddTextEx(draw_list, _G[V_Font], 10, CenteredVPos, - pos[2] + radius_outer * 2 + item_inner_spacing[2] - (Y_Offset or 0), FX[FxGUID][Fx_P].V_Clr or 0xffffff88, - labeltoShow, (Radius or 20) * 2) - end - - - - - --if user turn knob on ImGui - if Tweaking == P_Num .. FxGUID then - FX[FxGUID][Fx_P].V = p_value - if not FP.WhichCC then - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, P_Num, p_value) - else - Unlink_Parm(LT_TrackNum, LT_FXNum, P_Num) - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, P_Num, FX[FxGUID][Fx_P].V) - end - end - - - - - if AssigningMacro ~= nil then - reaper.ImGui_DrawList_AddCircleFilled(draw_list, center[1], center[2], radius_outer, - EightColors.bgWhenAsgnMod[AssigningMacro], 16) - end - - - local AlreadyAddPrm = false - - if LT_ParamNum == P_Num and focusedFXState == 1 and LT_FXGUID == FxGUID and not FP.WhichCC then - local LT_ParamValue = r.TrackFX_GetParamNormalized(LT_Track, LT_FX_Number, LT_ParamNum) - - p_value = LT_ParamValue - FX[FxGUID][Fx_P].V = p_value - - local L, T = r.ImGui_GetItemRectMin(ctx); - - r.ImGui_DrawList_AddCircle(draw_list, center[1], center[2], radius_outer, 0xffffffff, 16) - for m = 1, 8, 1 do - if AssigningMacro == m then - reaper.ImGui_PopStyleColor(ctx, 2) - end - end - end - - - if PM.TimeNow ~= nil then - if r.time_precise() > PM.TimeNow + 1 then - r.gmem_write(7, 0) --tells jsfx to stop retrieving P value - r.gmem_write(8, 0) - PM.TimeNow = nil - end - end - - IfTryingToAddExistingPrm(Fx_P, FxGUID, 'Circle', center[1], center[2], nil, nil, radius_outer) - - - - MakeModulationPossible(FxGUID, Fx_P, FX_Idx, P_Num, p_value, Sldr_Width, 'knob') - - - if FP.ModAMT then -- Draw modlines circular - local offset = 0 - for Macro, v in ipairs(MacroNums) do - if FP.ModAMT[Macro] then - --if Modulation has been assigned to params - local P_V_Norm = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, P_Num) - - --- indicator of where the param is currently - local PosAftrMod = ANGLE_MIN + (ANGLE_MAX - ANGLE_MIN) * P_V_Norm - - - r.ImGui_DrawList_PathArcTo(draw_list, center[1], center[2], radius_outer * 0.75, angle, - ANGLE_MIN + (ANGLE_MAX - ANGLE_MIN) * P_V_Norm) - r.ImGui_DrawList_PathStroke(draw_list, EightColors.Bright[Macro], nil, radius_outer / 2) - r.ImGui_DrawList_PathClear(draw_list) - - --- shows modulation range - r.ImGui_DrawList_PathArcTo(draw_list, center[1], center[2], radius_outer - 1 + offset, angle, - SetMinMax(angle + (ANGLE_MAX - ANGLE_MIN) * FP.ModAMT[Macro], ANGLE_MIN, ANGLE_MAX)) - - reaper.ImGui_DrawList_PathStroke(draw_list, EightColors.HighSat_MidBright[Macro], nil, - radius_outer * 0.1) - r.ImGui_DrawList_PathClear(draw_list) - - ParamHasMod_Any = true - - offset = offset + OffsetForMultipleMOD - end - end - end -- of reapeat for every macro - - if Trk.Prm.Assign and F_Tp == Trk.Prm.Assign and AssigningMacro then - local M = AssigningMacro - - RightBtnDragX, RightBtnDragY = r.ImGui_GetMouseDragDelta(ctx, x, y, 1) - - FP.ModAMT[M] = ((-RightBtnDragY / 100) or 0) + (FP.ModAMT[M] or 0) - - if FP.ModAMT[M] + p_value > 1 then FP.ModAMT[M] = 1 - p_value end - if FP.ModAMT[M] + p_value < 0 then FP.ModAMT[M] = -p_value end - - r.ImGui_DrawList_PathArcTo(draw_list, center[1], center[2], radius_outer - 1, angle, - angle + (ANGLE_MAX - ANGLE_MIN) * FP.ModAMT[M]) - reaper.ImGui_DrawList_PathStroke(draw_list, EightColors.bgWhenAsgnModAct[AssigningMacro], nil, - radius_outer * 0.1) - r.ImGui_DrawList_PathClear(draw_list) - r.gmem_write(4, 1) --tells jsfx that user is changing Mod Amount - r.gmem_write(1000 * AssigningMacro + Trk.Prm.Assign, FP.ModAMT[M]) - r.ImGui_ResetMouseDragDelta(ctx, 1) - - r.SetProjExtState(0, 'FX Devices', 'Param -' .. Trk.Prm.Assign .. 'Macro - ' .. AssigningMacro .. FxGUID, - FP.ModAMT[M]) - end - - --repeat for every param stored on track... - - - if FX[FxGUID].Morph_Value_Edit or Mods == Alt + Ctrl then r.ImGui_EndDisabled(ctx) end - - - if LblTextSize ~= 'No Font' then r.ImGui_PopFont(ctx) end - - return value_changed, p_value - end - - function AddSlider(ctx, label, labeltoShow, p_value, v_min, v_max, Fx_P, FX_Idx, P_Num, SliderStyle, Sldr_Width, - item_inner_spacing, Disable, Vertical, GrabSize, BtmLbl, SpacingBelow, Height) - local PosL, PosR, PosT, PosB - local ClrPop = 0 - local pos = { r.ImGui_GetCursorScreenPos(ctx) } - - - local line_height = reaper.ImGui_GetTextLineHeight(ctx) - local draw_list = reaper.ImGui_GetWindowDrawList(ctx) - - - - local mouse_delta = { reaper.ImGui_GetMouseDelta(ctx) } - local FxGUID = FXGUID[FX_Idx] - local F_Tp = FX.Prm.ToTrkPrm[FxGUID .. Fx_P] or 0 - - FX[FxGUID][Fx_P] = FX[FxGUID][Fx_P] or {} - local FP = FX[FxGUID][Fx_P] - local Font = 'Font_Andale_Mono_' .. roundUp(FP.FontSize or LblTextSize or Knob_DefaultFontSize, 1) - - local V_Font = 'Arial_' .. roundUp(FP.V_FontSize or LblTextSize or Knob_DefaultFontSize, 1) - - - - if FP.Lbl_Pos == 'Left' then - r.ImGui_PushFont(ctx, _G[Font]) - r.ImGui_AlignTextToFramePadding(ctx) - r.ImGui_TextColored(ctx, FP.Lbl_Clr or r.ImGui_GetColor(ctx, r.ImGui_Col_Text()), labeltoShow or FP.Name) - SL() - r.ImGui_PopFont(ctx) - end - - if LBtnDC then r.ImGui_PushStyleVar(ctx, r.ImGui_StyleVar_DisabledAlpha(), 1) end - if FX[FxGUID][Fx_P].Name then - local CC = FP.WhichCC or -1 - - - if FX[FxGUID].Morph_Value_Edit or Mods == Alt + Ctrl or LBtnDC then r.ImGui_BeginDisabled(ctx) end - - if item_inner_spacing then - r.ImGui_PushStyleVar(ctx, r.ImGui_StyleVar_ItemSpacing(), item_inner_spacing, item_inner_spacing) - end - - if not Sldr_Width or Sldr_Width == '' then Sldr_Width = FX.Def_Sldr_W[FxGUID] or Def_Sldr_W or 160 end - r.ImGui_SetNextItemWidth(ctx, Sldr_Width) - r.ImGui_BeginGroup(ctx) - - if SliderStyle == 'Pro C Thresh' then - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_FrameBg(), 0x99999900); r.ImGui_PushStyleColor(ctx, - r.ImGui_Col_FrameBgActive(), 0x99999922) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_FrameBgHovered(), 0x99999922) - ClrPop = 3; - elseif FX[FxGUID][Fx_P].BgClr and SliderStyle == nil then - r.ImGui_PushStyleColor(ctx, reaper.ImGui_Col_FrameBg(), FX[FxGUID][Fx_P].BgClr) - r.ImGui_PushStyleColor(ctx, reaper.ImGui_Col_FrameBgHovered(), FX[FxGUID][Fx_P].BgClrHvr) - r.ImGui_PushStyleColor(ctx, reaper.ImGui_Col_FrameBgActive(), FX[FxGUID][Fx_P].BgClrAct) - ClrPop = 3 - else - ClrPop = 0 --r.ImGui_PushStyleColor(ctx, reaper.ImGui_Col_FrameBg(), 0x474747ff) ClrPop =1 - end - if GrabSize then r.ImGui_PushStyleVar(ctx, r.ImGui_StyleVar_GrabMinSize(), GrabSize) end - - if FP.GrbClr then - local ActV - local R, G, B, A = r.ImGui_ColorConvertU32ToDouble4(FP.GrbClr) - local H, S, V = r.ImGui_ColorConvertRGBtoHSV(R, G, B) - if V > 0.9 then ActV = V - 0.2 end - local R, G, B = r.ImGui_ColorConvertHSVtoRGB(H, S, ActV or V + 0.2) - local ActClr = r.ImGui_ColorConvertDouble4ToU32(R, G, B, A) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_SliderGrab(), FP.GrbClr) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_SliderGrabActive(), ActClr) - ClrPop = ClrPop + 2 - end - - - if Vertical == 'Vert' then - if FP.Lbl_Pos == 'Top' then - local CurX = r.ImGui_GetCursorPosX(ctx) - local w = r.ImGui_CalcTextSize(ctx, labeltoShow or FP.Name) - r.ImGui_SetCursorPosX(ctx, CurX - w / 2 + Sldr_Width / 2) - --r.ImGui_TextColored(ctx, FP.Lbl_Clr or r.ImGui_GetColor(ctx, r.ImGui_Col_Text()) ,labeltoShow or FP.Name ) - MyText(labeltoShow or FP.Name, _G[Font], FP.Lbl_Clr or r.ImGui_GetColor(ctx, r.ImGui_Col_Text())) - end - if FP.V_Pos == 'Top' then - local CurX = r.ImGui_GetCursorPosX(ctx) - local Get, Param_Value = r.TrackFX_GetFormattedParamValue(LT_Track, FX_Idx, P_Num) - local w = r.ImGui_CalcTextSize(ctx, Param_Value) - r.ImGui_SetCursorPosX(ctx, CurX - w / 2 + Sldr_Width / 2) - if Get then MyText(Param_Value, _G[V_Font], FP.V_Clr or r.ImGui_GetColor(ctx, r.ImGui_Col_Text())) end - end - end - - - if DraggingMorph == FxGUID then p_value = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, P_Num) end - - - if Vertical == 'Vert' then - _, p_value = r.ImGui_VSliderDouble(ctx, label, Sldr_Width, Height, p_value, v_min, v_max, ' ') - else - _, p_value = r.ImGui_SliderDouble(ctx, label, p_value, v_min, v_max, ' ', r.ImGui_SliderFlags_NoInput()) - end - if GrabSize then r.ImGui_PopStyleVar(ctx) end - r.ImGui_PopStyleColor(ctx, ClrPop) - - RemoveModulationIfDoubleRClick(FxGUID, Fx_P, P_Num, FX_Idx) - - local SldrR, SldrB = r.ImGui_GetItemRectMax(ctx) - local SldrL, SldrT = r.ImGui_GetItemRectMin(ctx) - - - PosL, PosT = r.ImGui_GetItemRectMin(ctx) - PosR, PosB = r.ImGui_GetItemRectMax(ctx) - - - local value_changed = false - local is_active = reaper.ImGui_IsItemActive(ctx) - local is_hovered = reaper.ImGui_IsItemHovered(ctx) - if is_active == true then Knob_Active = true end - if Knob_Active == true then - if IsLBtnHeld == false then Knob_Active = false end - end - - - - - if SliderStyle == 'Pro C' then - SldrLength = PosR - PosL - SldrGrbPos = SldrLength * p_value - if is_active then - r.ImGui_DrawList_AddRectFilled(draw_list, PosL, PosT, PosL + SldrGrbPos, PosB, 0xFFD571bb, Rounding) - elseif is_hovered then - r.ImGui_DrawList_AddRectFilled(draw_list, PosL, PosT, PosL + SldrGrbPos, PosB, 0xDFB973bb, Rounding) - else - r.ImGui_DrawList_AddRectFilled(draw_list, PosL, PosT, PosL + SldrGrbPos, PosB, 0x888888bb, Rounding) - end - end - - if Disable == 'Disabled' then - r.ImGui_DrawList_AddRectFilled(draw_list, PosL, PosT, PosL + SldrGrbPos, PosB, 0x000000cc, Rounding) - end - - if is_active then - p_value = SetMinMax(p_value, v_min, v_max) - value_changed = true - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, P_Num, p_value) - MvingP_Idx = CC - - Tweaking = P_Num .. FxGUID - end - if is_active or is_hovered then - if FP.V_Pos == 'None' then - local SzX, SzY = r.ImGui_GetItemRectSize(ctx) - local MsX, MsY = r.ImGui_GetMousePos(ctx) - - r.ImGui_SetNextWindowPos(ctx, SetMinMax(MsX, pos[1], pos[1] + SzX), pos[2] - SzY - line_height) - r.ImGui_BeginTooltip(ctx) - local Get, Pv = r.TrackFX_GetFormattedParamValue(LT_Track, FX_Idx, P_Num) - - r.ImGui_Text(ctx, Pv) - r.ImGui_EndTooltip(ctx) - end - end - local t = (p_value - v_min) / (v_max - v_min) - - local Clr_SldrGrab = r.ImGui_GetColor(ctx, reaper.ImGui_Col_SliderGrabActive()) - local ClrBg = reaper.ImGui_GetColor(ctx, reaper.ImGui_Col_FrameBg()) - - - - - --[[ if is_active or is_hovered then - local window_padding = {reaper.ImGui_GetStyleVar(ctx, reaper.ImGui_StyleVar_WindowPadding())} - reaper.ImGui_SetNextWindowPos(ctx, pos[1] - window_padding[1], pos[2] - line_height - item_inner_spacing[2] - window_padding[2]) - reaper.ImGui_BeginTooltip(ctx) - reaper.ImGui_Text(ctx, ('%.3f'):format(p_value)) - reaper.ImGui_EndTooltip(ctx) - end ]] - - - --if user turn knob on ImGui - if not P_Num then P_Num = 0 end - if Tweaking == P_Num .. FxGUID then - FX[FxGUID][Fx_P].V = p_value - local getSlider, P_Value = r.TrackFX_GetFormattedParamValue(LT_Track, FX_Idx, P_Num) - ---!!! ONLY ACTIVATE TOOLTIP IF VALUE IS HIDDEN - --[[ if getSlider then - local window_padding = {reaper.ImGui_GetStyleVar(ctx, reaper.ImGui_StyleVar_WindowPadding())} - r.ImGui_SetNextWindowPos(ctx, pos[1] - window_padding[1], pos[2] - line_height - window_padding[2] -8) - r.ImGui_BeginTooltip(ctx) - r.ImGui_Text(ctx, P_Value) - r.ImGui_EndTooltip(ctx) - end ]] - if Trk.Prm.WhichMcros[CC .. TrkID] == nil then - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, P_Num, p_value) - elseif Trk.Prm.WhichMcros[CC .. TrkID] ~= nil then - Unlink_Parm(LT_TrackNum, LT_FXNum, P_Num) - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, P_Num, FX[FxGUID][Fx_P].V) - end - end - - - if AssigningMacro ~= nil then - reaper.ImGui_DrawList_AddRectFilled(draw_list, PosL, PosT, PosR, PosB, - EightColors.bgWhenAsgnMod[AssigningMacro]) - end - - local AlreadyAddPrm = false - - if LT_ParamNum == P_Num and focusedFXState == 1 and LT_FXGUID == FxGUID and not FP.WhichCC then - local LT_ParamValue = r.TrackFX_GetParamNormalized(LT_Track, LT_FX_Number, LT_ParamNum) - - FX[FxGUID][Fx_P].V = LT_ParamValue - - r.ImGui_DrawList_AddRectFilled(draw_list, PosL, PosT, PosR, PosB, 0x99999922, Rounding) - r.ImGui_DrawList_AddRect(draw_list, PosL, PosT, PosR, PosB, 0x99999966, Rounding) - - for m = 1, 8, 1 do - if AssigningMacro == m then - reaper.ImGui_PopStyleColor(ctx, 2) - end - end - end - - - - -- if IsLBtnHeld ==false then Tweaking= nil end - - if PM.TimeNow ~= nil then - if r.time_precise() > PM.TimeNow + 1 then - r.gmem_write(7, 0) --tells jsfx to stop retrieving P value - r.gmem_write(8, 0) - PM.TimeNow = nil - end - end - - if FX[FxGUID].Morph_Value_Edit or Mods == Alt + Ctrl and FX[FxGUID].MorphA and FX[FxGUID].MorphB then - --r.ImGui_EndDisabled(ctx) - if FX[FxGUID].MorphA[P_Num] and FX[FxGUID].MorphB[P_Num] then - - - HintMessage = 'LMB : adjust A RMB : adjust B Alt + Ctrl : Quick Access to morph value edit mode' - local sizeX, sizeY = r.ImGui_GetItemRectSize(ctx) - local A = SetMinMax(PosL + sizeX * FX[FxGUID].MorphA[P_Num], PosL, PosR) - local B = SetMinMax(PosL + sizeX * FX[FxGUID].MorphB[P_Num], PosL, PosR) - local ClrA, ClrB = DefClr_A_Hvr, DefClr_B_Hvr - local MsX, MsY = r.ImGui_GetMousePos(ctx) - - - if FX[FxGUID].MorphA[P_Num] ~= FX[FxGUID].MorphB[P_Num] then - r.ImGui_DrawList_AddRectFilledMultiColor(WDL, A, PosT, B, PosB, ClrA, ClrB, ClrB, ClrA) - end - - local txtClr = r.ImGui_GetStyleColor(ctx, r.ImGui_Col_Text()) - - if r.ImGui_IsMouseHoveringRect(ctx, PosL, PosT, PosR, PosB) and not MorphingMenuOpen then - if IsLBtnClicked or IsRBtnClicked then - FP.TweakingAB_Val = P_Num - Orig_Baseline = GetParmModTable(LT_TrackNum, FX_Idx, P_Num, 'PARAMOD_BASELINE') - end - if not FP.TweakingAB_Val then - local offsetA, offsetB - if A < B + 5 and A > B - 14 then - offsetA = -10 - offsetB = 10 - end - r.ImGui_DrawList_AddTextEx(WDL, Font_Andale_Mono_20_B, 16, A, PosT + (offsetA or 0), txtClr, - 'A') - r.ImGui_DrawList_AddTextEx(WDL, Font_Andale_Mono_20_B, 16, B, PosT + (offsetB or 0), txtClr, - 'B') - end - end - - if FP.TweakingAB_Val == P_Num and not MorphingMenuOpen then - local X_A, X_B - local offsetA, offsetB - if IsLBtnHeld then - FX[FxGUID].MorphA[P_Num] = SetMinMax((MsX - PosL) / sizeX, 0, 1) - if FX[FxGUID].Morph_ID then -- if Morph Sldr is linked to a CC - local A = (MsX - PosL) / sizeX - local Scale = FX[FxGUID].MorphB[P_Num] - A - Link_Param_to_CC(LT_TrackNum, FX_Idx, P_Num, true, true, 160, FX[FxGUID].Morph_ID, A, - Scale) - end - elseif IsRBtnHeld then - FX[FxGUID].MorphB[P_Num] = SetMinMax((MsX - PosL) / sizeX, 0, 1) - if FX[FxGUID].Morph_ID then -- if Morph Sldr is linked to a CC - Link_Param_to_CC(LT_TrackNum, FX_Idx, P_Num, true, true, 160, FX[FxGUID].Morph_ID, - Orig_Baseline, FX[FxGUID].MorphB[P_Num] - FX[FxGUID].MorphA[P_Num]) - end - end - if IsLBtnHeld then - X_A = MsX - Y_A = MsY - 15 - offsetA = -10 - if MsX < B + 5 and MsX > B - 14 then offsetB = 10 end - elseif IsRBtnHeld then - X_B = MsX - offsetB = -10 - if MsX < A + 5 and MsX > A - 14 then offsetA = 10 end - end - - r.ImGui_DrawList_AddTextEx(WDL, Font_Andale_Mono_20_B, 16, A, PosT + (offsetA or 0), txtClr, 'A') - r.ImGui_DrawList_AddTextEx(WDL, Font_Andale_Mono_20_B, 16, B, PosT + (offsetB or 0), txtClr, 'B') - end - end - if LBtnRel or RBtnRel then - StoreAllPrmVal('A', 'Dont') - StoreAllPrmVal('B', 'Dont') - FP.TweakingAB_Val = nil - end - --r.ImGui_BeginDisabled(ctx) - end - - IfTryingToAddExistingPrm(Fx_P, FxGUID, 'Rect', PosL, PosT, PosR, PosB) - - if Vertical == 'Vert' then ModLineDir = Height else ModLineDir = Sldr_Width end - - Tweaking = MakeModulationPossible(FxGUID, Fx_P, FX_Idx, P_Num, p_value, Sldr_Width, Vertical) - - - - - - local TextW, h = r.ImGui_CalcTextSize(ctx, labeltoShow, nil, nil, true) - local V_Clr, LblClr - if Disable == 'Disabled' then - LblClr = 0x111111ff; V_Clr = 0x111111ff - else LblClr = FP.Lbl_Clr or 0xD6D6D6ff ; V_Clr = FP.V_Clr or 0xD6D6D6ff - end - - local _, Format_P_V = r.TrackFX_GetFormattedParamValue(LT_Track, FX_Idx, P_Num) - r.ImGui_PushFont(ctx, Arial_11) - TextW, Texth = r.ImGui_CalcTextSize(ctx, Format_P_V, nil, nil, true, -100) - - r.ImGui_PopFont(ctx) - - if FX[FxGUID][Fx_P].V_Round then Format_P_V = RoundPrmV(StrToNum(Format_P_V), FX[FxGUID][Fx_P].V_Round) end - - - if BtmLbl ~= 'No BtmLbl' then - local Cx, Cy = r.ImGui_GetCursorScreenPos(ctx) - if Vertical ~= 'Vert' then - if not FP.Lbl_Pos or FP.Lbl_Pos == 'Bottom' then - r.ImGui_DrawList_AddTextEx(draw_list, _G[Font], - FP.FontSize or LblTextSize or Knob_DefaultFontSize, - Cx, Cy, LblClr, labeltoShow or FX[FxGUID][Fx_P].Name, nil, PosL, PosT, SldrR - TextW - 3,PosB +20) - end - else -- if vertical - if FP.Lbl_Pos == 'Bottom' or not FP.Lbl_Pos then - local CurX = r.ImGui_GetCursorPosX(ctx) - local w = r.ImGui_CalcTextSize(ctx, labeltoShow or FP.Name) - r.ImGui_SetCursorPosX(ctx, CurX - w / 2 + Sldr_Width / 2) - MyText(labeltoShow or FP.Name, _G[Font], LblClr) - end - if FP.V_Pos == 'Bottom' then - local Cx = r.ImGui_GetCursorPosX(ctx) - local txtW = r.ImGui_CalcTextSize(ctx, Format_P_V, nil, nil, true) - r.ImGui_SetCursorPosX(ctx, Cx + Sldr_Width / 2 - txtW / 2) - MyText(Format_P_V, _G[V_Font], FP.V_Clr or LblClr) - end - end - if FP.Lbl_Pos == 'Free' then - r.ImGui_DrawList_AddTextEx(draw_list, _G[Font], FP.FontSize or LblTextSize or Knob_DefaultFontSize, - Cx + (FP.Lbl_Pos_X or 0), Cy + (FP.Lbl_Pos_Y or 0), FP.Lbl_Clr or LblClr, labeltoShow or FX[FxGUID][Fx_P].Name) - end - end - - if FP.V_Pos == 'Free' then - local Ox, Oy = r.ImGui_GetCursorScreenPos(ctx) - r.ImGui_DrawList_AddTextEx(draw_list, _G[V_Font], FP.V_FontSize or Knob_DefaultFontSize, - Ox + Sldr_Width - TextW + (FP.V_Pos_X or 0), Oy + (FP.V_Pos_Y or 0), V_Clr , - Format_P_V) - end - - if Vertical ~= 'Vert' and (not FP.V_Pos or FP.V_Pos == 'Right') then - r.ImGui_PushFont(ctx, Arial_11); local X, Y = r.ImGui_GetCursorScreenPos(ctx) - r.ImGui_SetCursorScreenPos(ctx, SldrR - TextW, Y) - - - MyText(Format_P_V, _G[V_Font], V_Clr ) - - r.ImGui_PopFont(ctx) - end - - - - - if FX[FxGUID].Morph_Value_Edit or Mods == Alt + Ctrl or LBtnDC then r.ImGui_EndDisabled(ctx) end - - - r.ImGui_EndGroup(ctx) - if item_inner_spacing then r.ImGui_PopStyleVar(ctx) end - - - if SpacingBelow then - for i = 1, SpacingBelow, 1 do r.ImGui_Spacing(ctx) end - else - r.ImGui_Spacing(ctx); r.ImGui_Spacing(ctx); r.ImGui_Spacing(ctx); r.ImGui_Spacing(ctx); r.ImGui_Spacing( - ctx) - end - end - - if LBtnDC then r.ImGui_PopStyleVar(ctx) end - return value_changed, p_value - end - - function AddCombo(ctx, LT_Track, FX_Idx, Label, WhichPrm, Options, Width, Style, FxGUID, Fx_P, OptionValues, - LabelOveride, CustomLbl, Lbl_Pos) - LabelValue = Label .. 'Value' - local FP - FX[FxGUID or ''][Fx_P or ''] = FX[FxGUID or ''][Fx_P or ''] or {} - r.ImGui_BeginGroup(ctx) - if Fx_P then FP = FX[FxGUID][Fx_P] end - local V_Font = 'Font_Andale_Mono_' .. roundUp(FP.V_FontSize or LblTextSize or Knob_DefaultFontSize, 1) - local Font = 'Font_Andale_Mono_' .. roundUp(FP.FontSize or LblTextSize or Knob_DefaultFontSize, 1) - - if Fx_P and FP then - if (FP.Lbl_Pos == 'Left' and Lbl_Pos ~= 'No Lbl') or FP.Lbl_Pos == 'Top' then - local name - if not LabelOveride and not FP.CustomLbl and not CustomLbl then - _, name = r.TrackFX_GetParamName( - LT_Track, FX_Idx, WhichPrm) - end - r.ImGui_AlignTextToFramePadding(ctx) - MyText(LabelOveride or FP.CustomLbl or CustomLbl or FP.Name, _G[Font], - FP.Lbl_Clr or r.ImGui_GetColor(ctx, r.ImGui_Col_Text())) - if FP.Lbl_Pos == 'Left' and Lbl_Pos ~= 'No Lbl' then - SL() - end - end - end - - if LabelOveride then _G[LabelValue] = LabelOveride end - - local PopClr - local MaxTextLength - if Style == 'Pro C 2' then - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_FrameBg(), 0x444444ff) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_Text(), 0xffffffff) - PopClr = 2 - if _G[LabelValue] == 'Mastering' then _G[LabelValue] = 'Master' end - else - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_FrameBg(), FX[FxGUID][Fx_P].BgClr or 0x444444ff) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_Text(), FX[FxGUID][Fx_P].V_Clr or 0xffffffff) - PopClr = 2 - end - local OP = FX.Prm.Options; local OPs, V - - if Options == 'Get Options' then - if not OP[FxGUID] then OP[FxGUID] = {} end - if not OP[FxGUID][Fx_P] then - OP[FxGUID][Fx_P] = {}; - - OP[FxGUID][Fx_P] = { V = {} } - end - OPs = OP[FxGUID][Fx_P] - V = OP[FxGUID][Fx_P].V - - - if #OPs == 0 then - local OrigPrmV = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, WhichPrm) - for i = 0, 1.01, 0.01 do - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, WhichPrm, i) - local _, buf = r.TrackFX_GetFormattedParamValue(LT_Track, FX_Idx, WhichPrm) - - if not Value then - Value = buf; OPs[1] = buf - V[1] = i - end - if Value ~= buf then - table.insert(OPs, buf) - table.insert(V, i) - local L1 = r.ImGui_CalcTextSize(ctx, buf); local L2 = r.ImGui_CalcTextSize(ctx, Value) - FX[FxGUID][Fx_P].Combo_W = math.max(L1, L2) - Value = buf - end - end - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, WhichPrm, OrigPrmV) - end - end - - - - - local ExtraW - if Style == 'up-down arrow' then ExtraW = 20 end - - - if FX[FxGUID][Fx_P].ManualValues then - local Vn = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, WhichPrm) - - for i, V in ipairs(FP.ManualValues) do - if Vn == V then _G[LabelValue] = FP.ManualValuesFormat[i] end - end - else - _, _G[LabelValue] = r.TrackFX_GetFormattedParamValue(LT_Track, FX_Idx, WhichPrm) - end - --_,_G[LabelValue] = r.TrackFX_GetFormattedParamValue(LT_Track,FX_Idx, WhichPrm) - local Cx, Cy - if FP.V_Pos == 'Free' then - Cx, Cy = r.ImGui_GetCursorPos(ctx) - r.ImGui_SetCursorPos(ctx, Cx + (FP.V_Pos_X or 0), Cy + (FP.V_Pos_Y or 0)) - end - - local function begincombo(ctx) - if FP.V_FontSize then r.ImGui_PushFont(ctx, _G[V_Font]) end - if Width or FX[FxGUID][Fx_P].Combo_W then - r.ImGui_SetNextItemWidth(ctx, Width or (FX[FxGUID][Fx_P].Combo_W + (ExtraW or 0))) - end - if r.ImGui_BeginCombo(ctx, '## ' .. tostring(Label), LabelOveride or _G[LabelValue], r.ImGui_ComboFlags_NoArrowButton()) then - -----Style-------- - - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_Header(), 0x44444433) - local AccentClr = reaper.ImGui_GetColor(ctx, reaper.ImGui_Col_SliderGrabActive()) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_HeaderHovered(), AccentClr) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_Text(), 0xbbbbbbff) - if Style == 'Pro C 2' then - ProC.ChoosingStyle = true - end - local Options = Options - if FX[FxGUID][Fx_P].ManualValues then Options = FP.ManualValuesFormat end - - - - if Options ~= 'Get Options' then - local rv - - for i = 1, #Options, 1 do - if r.ImGui_Selectable(ctx, Options[i], i) and WhichPrm ~= nil then - if OptionValues then - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, WhichPrm, OptionValues[i]) - else - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, WhichPrm, - (i - 1) / #Options + ((i - 1) / #Options) * 0.1) -- + options* 0.05 so the value will be slightly higher than threshold, - end - if FX[FxGUID][Fx_P].ManualValues then - if FX[FxGUID][Fx_P].ManualValues[i] then - _G[LabelValue] = FP.ManualValuesFormat[i] - end - else - _, _G[LabelValue] = r.TrackFX_GetFormattedParamValue(LT_Track, FX_Idx, WhichPrm) - end - r.ImGui_PopStyleColor(ctx, 3) - r.ImGui_EndCombo(ctx) - return true, _G[LabelValue] - end - end - r.ImGui_PopStyleColor(ctx, 3) - r.ImGui_EndCombo(ctx) - else - for i = 1, #OPs, 1 do - if r.ImGui_Selectable(ctx, OPs[i], i) and WhichPrm ~= nil then - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, WhichPrm, V[i]) - _, _G[LabelValue] = r.TrackFX_GetFormattedParamValue(LT_Track, FX_Idx, WhichPrm) - r.ImGui_PopStyleColor(ctx, 3) - r.ImGui_EndCombo(ctx) - return true, _G[LabelValue] - end - end - r.ImGui_PopStyleColor(ctx, 3) - r.ImGui_EndCombo(ctx) - end - - local L, T = r.ImGui_GetItemRectMin(ctx); local R, B = r.ImGui_GetItemRectMax(ctx) - local lineheight = reaper.ImGui_GetTextLineHeight(ctx) - local drawlist = r.ImGui_GetForegroundDrawList(ctx) - - r.ImGui_DrawList_AddRectFilled(drawlist, L, T + lineheight / 8, R, B - lineheight / 8, 0x88888844, - Rounding) - r.ImGui_DrawList_AddRect(drawlist, L, T + lineheight / 8, R, B - lineheight / 8, 0x88888877, Rounding) - else - if Style == 'Pro C 2' and LBtnRel then - ProC.ChoosingStyle = false - end - end - if FP.V_FontSize then r.ImGui_PopFont(ctx) end - end - - local rv, v_format = begincombo(ctx) - - if Style == 'up-down arrow' then - local R, B = r.ImGui_GetItemRectMax(ctx) - local lineheight = reaper.ImGui_GetTextLineHeight(ctx) - local drawlist = r.ImGui_GetWindowDrawList(ctx) - local m = B - lineheight / 2 - 3 - g = 2 - local X = R - ExtraW / 2 - DrawTriangle(drawlist, X, m - g, 3, clr) - DrawDownwardTriangle(drawlist, X, m + g, 3, clr) - end - - - - if FP.Lbl_Pos == 'Right' then - SL() - r.ImGui_AlignTextToFramePadding(ctx) --[[ r.ImGui_Text(ctx,FP.CustomLbl or FP.Name) ]] - MyText(LabelOveride or FP.CustomLbl or CustomLbl or FP.Name, _G[Font], - FP.Lbl_Clr or r.ImGui_GetColor(ctx, r.ImGui_Col_Text())) - elseif FP.Lbl_Pos == 'Bottom' then - MyText(LabelOveride or FP.CustomLbl or CustomLbl or FP.Name, _G[Font], - FP.Lbl_Clr or r.ImGui_GetColor(ctx, r.ImGui_Col_Text())) - end - - r.ImGui_EndGroup(ctx) - r.ImGui_PopStyleColor(ctx, PopClr or 0) - if rv then return rv, v_format end - end - - - function AddSwitch(LT_Track, FX_Idx, Value, P_Num, BgClr, Lbl_Type, Fx_P, F_Tp, FontSize, FxGUID) - local clr, TextW, Font - FX[FxGUID][Fx_P] = FX[FxGUID][Fx_P] or {} - local FP = FX[FxGUID][Fx_P] - local V_Font = 'Font_Andale_Mono_' .. roundUp(FP.V_FontSize or LblTextSize or Knob_DefaultFontSize, 1) - - if FontSize then - Font = 'Font_Andale_Mono_' .. roundUp(FontSize, 1); r.ImGui_PushFont(ctx, _G[Font]) - end - if FX[FxGUID][Fx_P].Lbl_Clr then r.ImGui_PushStyleColor(ctx, r.ImGui_Col_Text(), FX[FxGUID][Fx_P].Lbl_Clr) end - local popClr - - r.ImGui_BeginGroup(ctx) - if FP.Lbl_Pos == 'Left' then - r.ImGui_AlignTextToFramePadding(ctx) - r.ImGui_Text(ctx, FP.CustomLbl or FP.Name) - SL() - elseif FP.Lbl_Pos == 'Top' then - r.ImGui_Text(ctx, FP.CustomLbl or FP.Name) - end - - if FP.V_Pos == 'None' or FP.V_Pos == 'Free' then - lbl = ' ' - elseif FP.V_Pos == 'Within' then - r.ImGui_PushFont(ctx, _G[V_Font]) - _, lbl = r.TrackFX_GetFormattedParamValue(LT_Track, FX_Idx, P_Num) - TextW = r.ImGui_CalcTextSize(ctx, lbl) - elseif Lbl_Type == 'Use Prm Name as Lbl' then - lbl = FX[FxGUID][Fx_P].Name - TextW = r.ImGui_CalcTextSize(ctx, lbl) - elseif Lbl_Type and Lbl_Type ~= 'Use Prm Name as Lbl' then - lbl = Lbl_Type - TextW = r.ImGui_CalcTextSize(ctx, Lbl_Type) - FX[FxGUID][Fx_P].Switch_W = TextW - else --Use Value As Label - _, lbl = r.TrackFX_GetFormattedParamValue(LT_Track, FX_Idx, P_Num) - end - - if FP.Lbl_Pos == 'Within' then lbl = FP.CustomLbl or FP.Name end - - - - - if FX[FxGUID][Fx_P].V == nil then FX[FxGUID][Fx_P].V = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, P_Num) end - - - if FX[FxGUID][Fx_P].Switch_On_Clr then - if FX[FxGUID][Fx_P].V == 1 then - popClr = 2 - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_Button(), FX[FxGUID][Fx_P].Switch_On_Clr) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_ButtonHovered(), - Change_Clr_A(FX[FxGUID][Fx_P].Switch_On_Clr, -0.2)) - else - popClr = 2 - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_Button(), BgClr or 0x00000000) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_ButtonHovered(), Change_Clr_A((BgClr or 0xffffff00), -0.2)) - end - else - if BgClr then - popClr = 2 - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_Button(), BgClr or 0xffffff00) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_ButtonHovered(), Change_Clr_A((BgClr or 0xffffff00), -0.2)) - end - end - - - if FP.V_Clr then r.ImGui_PushStyleColor(ctx, r.ImGui_Col_Text(), FP.V_Clr) end - - - - - if not FP.Image then - r.ImGui_Button(ctx, lbl .. '##' .. FxGUID .. Fx_P, FX[FxGUID][Fx_P].Sldr_W or TextW) - else -- if there's an image - uvmin, uvmax, w, h = Calc_strip_uv(FP.Image, FP.V) - - - - r.ImGui_ImageButton(ctx, lbl .. '##' .. FxGUID .. Fx_P, FP.Image, FP.Sldr_W or 30, FP.Sldr_W or 30, 0, - uvmin, 1, uvmax, FP.BgClr or 0xffffff00) - end - - - if r.ImGui_IsItemClicked(ctx, 0) then - if FP.SwitchType == 'Momentary' then - FX[FxGUID][Fx_P].V = FX[FxGUID][Fx_P].SwitchTargV - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, P_Num, FX[FxGUID][Fx_P].SwitchTargV or 0) - if r.ImGui_IsItemDeactivated(ctx) then - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, P_Num, FX[FxGUID][Fx_P].SwitchBaseV or 1) - end - else -- if it's a toggle - local Value = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, P_Num) - if Value == 0 then - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, P_Num, 1) - FX[FxGUID][Fx_P].V = 1 - elseif Value == 1 then - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, P_Num, 0) - FX[FxGUID][Fx_P].V = 0 - end - end - end - - - - - - - if FP.V_Clr then r.ImGui_PopStyleColor(ctx) end - --Sync Value if user tweak plugin's actual GUI. - - if focusedFXState == 1 and LT_FXGUID == FxGUID and LT_ParamNum == P_Num and not FX[FxGUID][Fx_P].WhichCC then - FX[FxGUID][Fx_P].V = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, P_Num) - end - - if FX[FxGUID][Fx_P].SwitchType == 'Momentary' then - clr = 0x00000000 - else - if FX[FxGUID][Fx_P].V == 0 then clr = 0x00000022 else clr = 0xffffff22 end - end - local X, Y = r.ImGui_GetItemRectMin(ctx); local W, H = r.ImGui_GetItemRectSize(ctx) - local DL = r.ImGui_GetWindowDrawList(ctx) - - if FP.Lbl_Pos == 'Right' then - SL() - r.ImGui_AlignTextToFramePadding(ctx) - r.ImGui_Text(ctx, FP.CustomLbl or FP.Name) - elseif FP.Lbl_Pos == 'Bottom' then - r.ImGui_Text(ctx, FP.CustomLbl or FP.Name) - elseif FP.Lbl_Pos == 'Free' then - local Cx, Cy = r.ImGui_GetCursorScreenPos(ctx) - r.ImGui_DrawList_AddTextEx(DL, _G[Font], FontSize or 11, Cx + (FP.Lbl_Pos_X or 0), Cy + (FP.Lbl_Pos_Y or 0), - FP.Lbl_Clr or getClr(r.ImGui_Col_Text()), FP.CustomLbl or FP.Name) - end - - if FP.V_Pos == 'Free' then - local Cx, Cy = r.ImGui_GetCursorScreenPos(ctx) - local _, lbl = r.TrackFX_GetFormattedParamValue(LT_Track, FX_Idx, P_Num) - r.ImGui_DrawList_AddTextEx(DL, _G[Font], FontSize or 11, Cx + (FP.V_Pos_X or 0), Cy + (FP.V_Pos_Y or 0), - FP.Lbl_Clr or getClr(r.ImGui_Col_Text()), lbl) - end - if FP.V_Pos == 'Within' then r.ImGui_PopFont(ctx) end - - - r.ImGui_EndGroup(ctx) - - r.ImGui_DrawList_AddRectFilled(DL, X, Y, X + W, Y + H, clr, FX.Round[FxGUID] or 0) - - if FontSize then r.ImGui_PopFont(ctx) end - if popClr then r.ImGui_PopStyleColor(ctx, popClr) end - if FX[FxGUID][Fx_P].Lbl_Clr then r.ImGui_PopStyleColor(ctx) end - if Value == 0 then return 0 else return 1 end - end - - function AddDrag(ctx, label, labeltoShow, p_value, v_min, v_max, Fx_P, FX_Idx, P_Num, Style, Sldr_Width, - item_inner_spacing, Disable, Lbl_Clickable, Lbl_Pos, V_Pos, DragDir, AllowInput) - - FxGUID = FxGUID or r.TrackFX_GetFXGUID(LT_Track, FX_Idx) - - FX[FxGUID][Fx_P] = FX[FxGUID][Fx_P] or {} - - local FxGUID = FXGUID[FX_Idx] - local FP = FX[FxGUID][Fx_P] - - - if FX[FxGUID].Morph_Value_Edit or (Mods == Alt + Ctrl and is_hovered) then r.ImGui_BeginDisabled(ctx) end - local radius_outer = 20.0 - - local pos = { r.ImGui_GetCursorScreenPos(ctx) } - - local line_height = r.ImGui_GetTextLineHeight(ctx); local draw_list = r.ImGui_GetWindowDrawList(ctx) - - local mouse_delta = { reaper.ImGui_GetMouseDelta(ctx) } - local F_Tp = FX.Prm.ToTrkPrm[FxGUID .. Fx_P] - - - local Font = 'Font_Andale_Mono_' .. roundUp(FP.FontSize or LblTextSize or Knob_DefaultFontSize, 1) - - - local V_Font = 'Arial_' .. roundUp(FP.V_FontSize or LblTextSize or Knob_DefaultFontSize, 1) - - if type(FP) ~= 'table' then - FX[FxGUID][Fx_P] = {} - FP = FX[FxGUID][Fx_P] - end - - if item_inner_spacing then - r.ImGui_PushStyleVar(ctx, r.ImGui_StyleVar_ItemSpacing(), item_inner_spacing, item_inner_spacing) - end - - r.ImGui_BeginGroup(ctx) - local BgClr - if SliderStyle == 'Pro C' or SliderStyle == 'Pro C Lookahead' then BgClr = 0x55555544 end - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_FrameBg(), - BgClr or FP.BgClr or r.ImGui_GetColor(ctx, r.ImGui_Col_FrameBg())) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_FrameBgActive(), - FP.BgClrAct or r.ImGui_GetColor(ctx, r.ImGui_Col_FrameBgActive())) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_FrameBgHovered(), - FP.BgClrHvr or r.ImGui_GetColor(ctx, r.ImGui_Col_FrameBgHovered())) - - if Lbl_Pos == 'Left' then - r.ImGui_AlignTextToFramePadding(ctx) - MyText(labeltoShow, _G[Font], FP.Lbl_Clr or 0xaaaaaaff) - r.ImGui_SameLine(ctx, nil, 8) - r.ImGui_AlignTextToFramePadding(ctx) - elseif Lbl_Pos == 'Free' then - r.ImGui_DrawList_AddTextEx(WDL, _G[Font] , FP.FontSize or Knob_DefaultFontSize, pos[1] + (FP.Lbl_Pos_X or 0), - pos[2] + (FP.Lbl_Pos_Y or 0), FP.Lbl_Clr or 0xffffffff, labeltoShow) - end - r.ImGui_SetNextItemWidth(ctx, Sldr_Width) - - local DragSpeed = 0.01 - if Mods == Shift then DragSpeed = 0.0003 end - if DraggingMorph == FxGUID then p_value = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, P_Num) end - - - local flag - if AllowInput == 'NoInput' then flag = r.ImGui_SliderFlags_NoInput() end - if Style == 'FX Layering' then r.ImGui_PushStyleVar(ctx, r.ImGui_StyleVar_FrameRounding(), 0) end - - _, p_value = r.ImGui_DragDouble(ctx, label, p_value, DragSpeed, v_min, v_max, ' ', r.ImGui_SliderFlags_NoInput()) - if Style == 'FX Layering' then r.ImGui_PopStyleVar(ctx) end - - r.ImGui_PopStyleColor(ctx, 3) - local PosL, PosT = r.ImGui_GetItemRectMin(ctx); local PosR, PosB = r.ImGui_GetItemRectMax(ctx) - - local value_changed = false - local is_active = r.ImGui_IsItemActive(ctx) - local is_hovered = r.ImGui_IsItemHovered(ctx) - if is_active == true then Knob_Active = true end - if Knob_Active == true then - if IsLBtnHeld == false then Knob_Active = false end - end - SldrLength = PosR - PosL - - SldrGrbPos = SldrLength * (p_value or 1) - - RemoveModulationIfDoubleRClick(FxGUID, Fx_P, P_Num, FX_Idx) - ---Edit preset morph values - - if FX[FxGUID].Morph_Value_Edit or (Mods == Alt + Ctrl and is_hovered) then - if FX[FxGUID].MorphA[P_Num] and FX[FxGUID].MorphB[P_Num] then - local sizeX, sizeY = r.ImGui_GetItemRectSize(ctx) - local A = SetMinMax(PosL + sizeX * FX[FxGUID].MorphA[P_Num], PosL, PosR) - local B = SetMinMax(PosL + sizeX * FX[FxGUID].MorphB[P_Num], PosL, PosR) - local ClrA, ClrB = DefClr_A_Hvr, DefClr_B_Hvr - local MsX, MsY = r.ImGui_GetMousePos(ctx) - - if FX[FxGUID].MorphA[P_Num] ~= FX[FxGUID].MorphB[P_Num] then - r.ImGui_DrawList_AddRectFilledMultiColor(WDL, A, PosT, B, PosB, ClrA, ClrB, ClrB, ClrA) - end - - local txtClr = r.ImGui_GetStyleColor(ctx, r.ImGui_Col_Text()) - - if r.ImGui_IsMouseHoveringRect(ctx, PosL, PosT, PosR, PosB) and not MorphingMenuOpen then - if IsLBtnClicked or IsRBtnClicked then - FP.TweakingAB_Val = P_Num - Orig_Baseline = GetParmModTable(LT_TrackNum, FX_Idx, P_Num, 'PARAMOD_BASELINE') - end - if not FP.TweakingAB_Val then - local offsetA, offsetB - if A < B + 5 and A > B - 14 then - offsetA = -10 - offsetB = 10 - end - r.ImGui_DrawList_AddTextEx(WDL, Font_Andale_Mono_20_B, 16, A, PosT + (offsetA or 0), txtClr, 'A') - r.ImGui_DrawList_AddTextEx(WDL, Font_Andale_Mono_20_B, 16, B, PosT + (offsetB or 0), txtClr, 'B') - end - end - - if FP.TweakingAB_Val == P_Num and not MorphingMenuOpen then - local X_A, X_B - local offsetA, offsetB - if IsLBtnHeld then - FX[FxGUID].MorphA[P_Num] = SetMinMax((MsX - PosL) / sizeX, 0, 1) - if FX[FxGUID].Morph_ID then -- if Morph Sldr is linked to a CC - local A = (MsX - PosL) / sizeX - local Scale = FX[FxGUID].MorphB[P_Num] - A - Link_Param_to_CC(LT_TrackNum, FX_Idx, P_Num, true, true, 160, FX[FxGUID].Morph_ID, A, Scale) - end - elseif IsRBtnHeld then - FX[FxGUID].MorphB[P_Num] = SetMinMax((MsX - PosL) / sizeX, 0, 1) - if FX[FxGUID].Morph_ID then -- if Morph Sldr is linked to a CC - Link_Param_to_CC(LT_TrackNum, FX_Idx, P_Num, true, true, 160, FX[FxGUID].Morph_ID, - Orig_Baseline, - FX[FxGUID].MorphB[P_Num] - FX[FxGUID].MorphA[P_Num]) - end - end - if IsLBtnHeld then - X_A = MsX - Y_A = MsY - 15 - offsetA = -10 - if MsX < B + 5 and MsX > B - 14 then offsetB = 10 end - elseif IsRBtnHeld then - X_B = MsX - offsetB = -10 - if MsX < A + 5 and MsX > A - 14 then offsetA = 10 end - end - - r.ImGui_DrawList_AddTextEx(WDL, Font_Andale_Mono_20_B, 16, A, PosT + (offsetA or 0), txtClr, 'A') - r.ImGui_DrawList_AddTextEx(WDL, Font_Andale_Mono_20_B, 16, B, PosT + (offsetB or 0), txtClr, 'B') - end - end - if LBtnRel or RBtnRel then - StoreAllPrmVal('A', 'Dont') - StoreAllPrmVal('B', 'Dont') - FP.TweakingAB_Val = nil - end - end - - if FP.GrbClr and FX.LayEdit == FxGUID then - local ActV - local R, G, B, A = r.ImGui_ColorConvertU32ToDouble4(FP.GrbClr) - local HSV, _, H, S, V = r.ImGui_ColorConvertRGBtoHSV(R, G, B) - if V > 0.9 then ActV = V - 0.2 end - local RGB, _, R, G, B = r.ImGui_ColorConvertHSVtoRGB(H, S, ActV or V + 0.2) - local ActClr = r.ImGui_ColorConvertDouble4ToU32(R, G, B, A) - local RGB, _, R, G, B = r.ImGui_ColorConvertHSVtoRGB(H, S, HvrV or V + 0.1) - local HvrClr = r.ImGui_ColorConvertDouble4ToU32(R, G, B, A) - FP.GrbAct = ActClr - FP.GrbHvr = HvrClr - end - - if Style == 'FX Layering' then - r.ImGui_DrawList_AddRectFilled(draw_list, PosL, PosT, PosR, PosB, 0x99999910) - end - - if not SliderStyle then - if DragDir == 'Right' or DragDir == nil then - if is_active then - r.ImGui_DrawList_AddRectFilled(draw_list, PosL, PosT, PosL + SldrGrbPos, PosB, FP.GrbAct or 0xffffff77, Rounding) - elseif is_hovered then - r.ImGui_DrawList_AddRectFilled(draw_list, PosL, PosT, PosL + SldrGrbPos, PosB, FP.GrbHvr or 0xffffff55, Rounding) - else - r.ImGui_DrawList_AddRectFilled(draw_list, PosL, PosT, PosL + SldrGrbPos, PosB, FP.GrbClr or 0xffffff44, Rounding) - end - elseif DragDir == 'Left-Right' then - local L = math.min(PosL + (PosR - PosL) / 2, PosL + SldrGrbPos); local R = math.max( - PosL + (PosR - PosL) / 2, - PosL + SldrGrbPos) - if is_active then - r.ImGui_DrawList_AddRectFilled(draw_list, L, PosT, R, PosB, FP.GrbAct or 0xffffff77, Rounding) - elseif is_hovered then - r.ImGui_DrawList_AddRectFilled(draw_list, L, PosT, R, PosB, FP.GrbHvr or 0xffffff55, Rounding) - else - r.ImGui_DrawList_AddRectFilled(draw_list, L, PosT, R, PosB, FP.GrbClr or 0xffffff44, Rounding) - end - elseif DragDir == 'Left' then - if is_active then - r.ImGui_DrawList_AddRectFilled(draw_list, PosR, PosT, PosL + SldrGrbPos, PosB, - FP.GrbAct or 0xffffff77, - Rounding) - elseif is_hovered then - r.ImGui_DrawList_AddRectFilled(draw_list, PosR, PosT, PosL + SldrGrbPos, PosB, - FP.GrbHvr or 0xffffff55, - Rounding) - else - r.ImGui_DrawList_AddRectFilled(draw_list, PosR, PosT, PosL + SldrGrbPos, PosB, - FP.GrbClr or 0xffffff44, - Rounding) - end - end - elseif SliderStyle == 'Pro C' or SliderStyle == 'Pro C Lookahead' then - if is_active then - r.ImGui_DrawList_AddRectFilled(draw_list, PosL, PosT, PosL + SldrGrbPos, PosB, 0xFFD571bb, Rounding) - elseif is_hovered then - r.ImGui_DrawList_AddRectFilled(draw_list, PosL, PosT, PosL + SldrGrbPos, PosB, 0xDFB973bb, Rounding) - else - r.ImGui_DrawList_AddRectFilled(draw_list, PosL, PosT, math.max(PosL + SldrGrbPos, PosL), PosB, 0x888888bb, - Rounding) - end - end - - - if Disable == 'Disabled' then - r.ImGui_DrawList_AddRectFilled(draw_list, PosL, PosT, PosL + SldrGrbPos, PosB, 0x222222bb, Rounding) - end - - - - - if is_active then - if p_value < v_min then p_value = v_min end - if p_value > v_max then p_value = v_max end - value_changed = true - - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, P_Num, p_value) - MvingP_Idx = F_Tp - - Tweaking = P_Num .. FxGUID - end - - - - local t = (p_value - v_min) / (v_max - v_min) - - local radius_inner = radius_outer * 0.40 - local Clr_SldrGrab = r.ImGui_GetColor(ctx, reaper.ImGui_Col_SliderGrabActive()) - local ClrBg = reaper.ImGui_GetColor(ctx, reaper.ImGui_Col_FrameBg()) - - - if (is_active or is_hovered) and (FX[FxGUID][Fx_P].V_Pos == 'None' or Style == 'Pro C' or Style == 'Pro C Lookahead') then - local getSldr, Param_Value = r.TrackFX_GetFormattedParamValue(LT_Track, FX_Idx, P_Num) - - local window_padding = { reaper.ImGui_GetStyleVar(ctx, reaper.ImGui_StyleVar_WindowPadding()) } - r.ImGui_SetNextWindowPos(ctx, pos[1] - window_padding[1], pos[2] - line_height - window_padding[2] - 8) - - r.ImGui_BeginTooltip(ctx) - r.ImGui_Text(ctx, Param_Value) - r.ImGui_EndTooltip(ctx) - end - - - - --if user tweak drag on ImGui - if Tweaking == P_Num .. FxGUID then - FX[FxGUID][Fx_P].V = p_value - if not FP.WhichCC then - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, P_Num, p_value) - else - Unlink_Parm(LT_TrackNum, LT_FXNum, P_Num) - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, P_Num, FX[FxGUID][Fx_P].V) - end - end - - - if AssigningMacro ~= nil then - reaper.ImGui_DrawList_AddRectFilled(draw_list, PosL, PosT, PosR, PosB, - EightColors.bgWhenAsgnMod[AssigningMacro]) - end - - - local AlreadyAddPrm = false - - if LT_ParamNum == P_Num and focusedFXState == 1 and LT_FXGUID == FxGUID and FX[FxGUID][Fx_P].Name and not FP.WhichCC then - local LT_ParamValue = r.TrackFX_GetParamNormalized(LT_Track, LT_FX_Number, LT_ParamNum) - - FX[FxGUID][Fx_P].V = LT_ParamValue - reaper.ImGui_DrawList_AddRectFilled(draw_list, PosL, PosT, PosR, PosB, 0x99999922, Rounding) - reaper.ImGui_DrawList_AddRect(draw_list, PosL, PosT, PosR, PosB, 0x99999966, Rounding) - - for m = 1, 8, 1 do - if AssigningMacro == m then - reaper.ImGui_PopStyleColor(ctx, 2) - end - end - end - - --[[ if Tweaking == P_Num..FxGUID and IsLBtnHeld == false then - if FP.WhichMODs then - r.GetSetMediaTrackInfo_String(LT_Track,'P_EXT: FX'..FxGUID..'Prm'..Fx_P.. 'Value before modulation' , FX[FxGUID][Fx_P].V, true ) - r.gmem_write(7, CC) --tells jsfx to retrieve P value - PM.TimeNow= r.time_precise() - r.gmem_write(11000+CC , p_value) - Link_Param_to_CC(LT_TrackNum, LT_FX_Number, P_Num, true, true, 176,MvingP_Idx) - - end - - Tweaking= nil - end ]] - - if PM.TimeNow ~= nil then - if r.time_precise() > PM.TimeNow + 1 then - r.gmem_write(7, 0) --tells jsfx to stop retrieving P value - r.gmem_write(8, 0) - PM.TimeNow = nil - end - end - - IfTryingToAddExistingPrm(Fx_P, FxGUID, 'Rect', PosL, PosT, PosR, PosB) - - Tweaking = MakeModulationPossible(FxGUID, Fx_P, FX_Idx, P_Num, p_value, Sldr_Width) - - - local TextW, h = reaper.ImGui_CalcTextSize(ctx, labeltoShow, nil, nil, true) - local SldrR, SldrB = r.ImGui_GetItemRectMax(ctx) - local SldrL, SldrT = r.ImGui_GetItemRectMin(ctx) - local W, H = SldrR - SldrL, SldrB - SldrT - local _, Format_P_V = r.TrackFX_GetFormattedParamValue(LT_Track, FX_Idx, P_Num) - r.ImGui_PushFont(ctx, Arial_11) - if FX[FxGUID][Fx_P].V_Round then Format_P_V = RoundPrmV(Format_P_V, FX[FxGUID][Fx_P].V_Round) end - TextW, Texth = reaper.ImGui_CalcTextSize(ctx, Format_P_V, nil, nil, true, -100) - if is_active then txtclr = 0xEEEEEEff else txtclr = 0xD6D6D6ff end - - if (V_Pos == 'Within' or Lbl_Pos == 'Left') and V_Pos ~= 'None' and V_Pos ~= 'Free' and V_Pos then - r.ImGui_DrawList_AddTextEx(draw_list, _G[V_Font], FP.V_FontSize or Knob_DefaultFontSize, SldrL + W / 2 - TextW / 2, - SldrT + H / 2 - 5, FP.V_Clr or txtclr, Format_P_V) - elseif FP.V_Pos == 'Free' then - local X = SldrL + W / 2 - TextW / 2 - local Y = SldrT + H / 2 - 5 - local Ox, Oy = Get - r.ImGui_DrawList_AddTextEx(draw_list, _G[V_Font], FP.V_FontSize or Knob_DefaultFontSize, X + (FP.V_Pos_X or 0), - Y + (FP.V_Pos_Y or 0), FP.V_Clr or 0xffffffff, Format_P_V) - end - - if Lbl_Pos == 'Within-Left' then - r.ImGui_DrawList_AddText(draw_list, SldrL, SldrT + H / 2 - 5, FX[FxGUID][Fx_P].Lbl_Clr or txtclr, labeltoShow) - end - if V_Pos == 'Within-Right' then - r.ImGui_DrawList_AddText(draw_list, SldrR - TextW, SldrT + H / 2 - 5, FX[FxGUID][Fx_P].V_Clr or txtclr, - Format_P_V) - end - - r.ImGui_PopFont(ctx) - - if not Lbl_Pos or Lbl_Pos == 'Bottom' then - local X, Y = r.ImGui_GetCursorScreenPos(ctx) - local TxtClr = FP.Lbl_Clr or getClr(r.ImGui_Col_Text()) - if Disable == 'Disabled' then TxtClr = getClr(r.ImGui_Col_TextDisabled()) end - - if item_inner_spacing then - if item_inner_spacing < 0 then r.ImGui_SetCursorPosY(ctx, r.ImGui_GetCursorPosY(ctx) + item_inner_spacing) end - end - - MyText(labeltoShow, _G[Font] or Font_Andale_Mono_12 , TxtClr) - - if not string.find(FX.Win_Name_S[FX_Idx] or '', 'Pro%-C 2') then r.ImGui_SameLine(ctx) end - - r.ImGui_SetCursorScreenPos(ctx, SldrR - TextW, Y) - - if Style ~= 'Pro C Lookahead' and Style ~= 'Pro C' and (not FX[FxGUID][Fx_P].V_Pos or FX[FxGUID][Fx_P].V_Pos == 'Right') then - MyText(Format_P_V, _G[V_Font], FP.V_Clr or getClr(r.ImGui_Col_Text())) - end - end - - - - - if Lbl_Clickable == 'Lbl_Clickable' then - local TextL; local TextY; local TxtSize; - local HvrText = r.ImGui_IsItemHovered(ctx) - local ClickText = r.ImGui_IsItemClicked(ctx) - - if HvrText then - TextL, TextY = r.ImGui_GetItemRectMin(ctx); TxtSize = r.ImGui_CalcTextSize(ctx, labeltoShow) - r.ImGui_DrawList_AddRectFilled(draw_list, TextL - 2, TextY, TextL + TxtSize, TextY + 10, 0x99999933) - r.ImGui_DrawList_AddRect(draw_list, TextL - 2, TextY, TextL + TxtSize, TextY + 10, 0x99999955) - end - - if ClickText then - if Style == 'Pro C Lookahead' then - local OnOff; - if OnOff == nil then OnOff = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, 41) end - if OnOff == 1 then - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, 41, 0) - Lookahead = 1 - else - Lookahead = 0 - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, 41, 1) - end - end - end - end - - r.ImGui_EndGroup(ctx) - if item_inner_spacing then r.ImGui_PopStyleVar(ctx) end - if FX[FxGUID].Morph_Value_Edit or is_hovered and Mods == Alt + Ctrl then r.ImGui_EndDisabled(ctx) end - - - return value_changed, p_value - end - - function CheckIfLayoutEditHasBeenMade(FxGUID, FX_Name) - if FX[FxGUID].File then - local ChangeBeenMade - local PrmCount = r.GetExtState('FX Devices - ' .. FX_Name, 'Param Instance') - local Ln = FX[FxGUID].FileLine - - if FX.GrbRound[FxGUID] ~= (get_aftr_Equal_Num(Ln[4]) or 0) then end - if FX.Round[FxGUID] ~= (get_aftr_Equal_Num(Ln[3]) or 0) then end - if FX.BgClr[FxGUID] ~= get_aftr_Equal_Num(Ln[5]) then end - if FX.TitleWidth[FxGUID] ~= (get_aftr_Equal_Num(Ln[7]) or 0) then end - if FX.Width[FxGUID] ~= (get_aftr_Equal_Num(Ln[6]) or 0) then end - - ChangeBeenMade = true - --end - - for Fx_P = 1, #FX[FxGUID] or 0, 1 do - local ID = FxGUID .. Fx_P - local FP = FX[FxGUID][Fx_P] - local function L(n) - return Ln[n + (40 - 14) * (Fx_P - 1)] - end - if FP.Name ~= get_aftr_Equal_Num(L(14)) or - FP.Num ~= get_aftr_Equal_Num(L(15)) or - FP.Sldr_W ~= get_aftr_Equal_Num(L(16)) or - FP.Type ~= get_aftr_Equal_(L(17)) or - FP.PosX ~= get_aftr_Equal_Num(L(18)) or - FP.PosY ~= get_aftr_Equal_Num(L(19)) or - FP.Style ~= get_aftr_Equal(L(20)) or - FP.V_FontSize ~= get_aftr_Equal_Num(L(21)) or - FP.CustomLbl ~= get_aftr_Equal_Num(L(22)) or - FP.FontSize ~= get_aftr_Equal_Num(L(23)) or - FP.Sldr_H ~= '1' or - FP.BgClr ~= '2' or - FP.GrbClr ~= '3' or - FP.Lbl_Pos ~= '4' or - FP.V_Pos ~= '' or - FP.Lbl_Clr ~= '4' or - FP.V_Clr ~= '4' or - FP.DragDir ~= '4' or - FP.ConditionPrm ~= '4' - - then - ChangeBeenMade = true - end - end - - - if FX[FxGUID].AllPrmHasBeenDeleted then ChangeBeenMade = true end - return ChangeBeenMade - end - end - - function CheckIfDrawingHasBeenMade(FX_Idx) - local D = Draw[FX.Win_Name_S[FX_Idx]], ChangeBeenMade - for i, Type in pairs(D.Type) do - if D.L[i] ~= tonumber(r.GetExtState('FX Devices Drawings', 'prm ' .. i .. 's L pos')) or - D.R[i] ~= tonumber(r.GetExtState('FX Devices Drawings', 'prm ' .. i .. 's R Pos')) or - D.T[i] ~= tonumber(r.GetExtState('FX Devices Drawings', 'prm ' .. i .. 's T Pos')) or - D.B[i] ~= tonumber(r.GetExtState('FX Devices Drawings', 'prm ' .. i .. 's B Pos')) or - D.Txt[i] ~= tonumber(r.GetExtState('FX Devices Drawings', 'prm ' .. i .. 's Txt')) or - D.clr[i] ~= tonumber(r.GetExtState('FX Devices Drawings', 'prm ' .. i .. 's Clr')) then - ChangeBeenMade = true - end - end - return ChangeBeenMade - end - - function RetrieveFXsSavedLayout(Sel_Track_FX_Count) - - if LT_Track then - for FX_Idx = 0, Sel_Track_FX_Count - 1, 1 do - local PrmInst, Line, FX_Name_Short - local _, FX_Name = r.TrackFX_GetFXName(LT_Track, FX_Idx) - local FX_Name = ChangeFX_Name(FX_Name) - --FX_Name = string.gsub(FX_Name , '[MVST:AU:]',"") - - - - - local FxGUID = r.TrackFX_GetFXGUID(LT_Track, FX_Idx) - --local file = CallFile('r', FX_Name..'.ini', 'FX Layouts') - - - - - local dir_path = ConcatPath(reaper.GetResourcePath(), 'Scripts', 'ReaTeam Scripts', 'FX','BryanChi_FX Devices', 'FX Layouts') - local file_path = ConcatPath(dir_path, FX_Name .. '.ini') - - -- Create directory for file if it doesn't exist - r.RecursiveCreateDirectory(dir_path, 0) - - - - local file = io.open(file_path, 'r') - if FxGUID then - FX[FxGUID] = FX[FxGUID] or {} - FX[FxGUID].File = file - local FX_Name_Short = ChangeFX_Name(FX_Name) - if file then - Line = get_lines(file_path) - FX[FxGUID].FileLine = Line - Content = file:read('*a') - local Ct = Content - - FX[FxGUID].MorphHide = r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: FX Morph Hide' ..FxGUID, 'true', true) - - FX.Round[FxGUID] = RecallGlobInfo(Ct, 'Edge Rounding = ', 'Num') - FX.GrbRound[FxGUID] = RecallGlobInfo(Ct, 'Grb Rounding = ', 'Num') - FX.BgClr[FxGUID] = RecallGlobInfo(Ct, 'BgClr = ', 'Num') - FX.Width[FxGUID] = RecallGlobInfo(Ct, 'Window Width = ', 'Num') - FX.TitleWidth[FxGUID] = RecallGlobInfo(Ct, 'Title Width = ', 'Num') - FX[FxGUID].TitleClr = RecallGlobInfo(Ct, 'Title Clr = ', 'Num') - FX[FxGUID].CustomTitle = RecallGlobInfo(Ct, 'Custom Title = ') - PrmInst = RecallGlobInfo(Ct, 'Param Instance = ', 'Num') - else Draw[FX_Name_Short] =nil - end - - - - - -------------------------------------Parameters ------------------------------------------------- - function attachFont (ctx, var, ft, sz, FP) - if sz > 20 then - --ChangeFont = FP - - CF = CF or {} - - - ChangeFont_Size = roundUp( sz,1 ) - _G[var..'_'..roundUp( sz,1 )] = r.ImGui_CreateFont( ft, roundUp( sz,1 )) - - r.ImGui_Attach(ctx, _G[var..'_'..roundUp( sz,1 )] ) - ChangeFont_Font = var - - end - end - - - if --[[ r.GetExtState('FX Devices - '..FX_Name, 'Param Instance') ~= '' ]] PrmInst then - local Ct = Content - PrmCount = RecallGlobInfo(Ct, 'Param Instance = ', 'Num') - - if PrmCount then - for Fx_P = 1, PrmCount or 0, 1 do - local function L(n) - return Line[n + (40 - 14) * (Fx_P - 1)] - end - FX[FxGUID] = FX[FxGUID] or {} - - FX[FxGUID][Fx_P] = FX[FxGUID][Fx_P] or {} - local FP = FX[FxGUID][Fx_P] - local ID = FxGUID .. Fx_P - - FP.Name = RecallInfo(Ct, 'Name', Fx_P) - FP.Num = RecallInfo(Ct, 'Num', Fx_P, 'Num') - FP.Sldr_W = RecallInfo(Ct, 'Width', Fx_P, 'Num') - FP.Type = RecallInfo(Ct, 'Type', Fx_P) - FP.PosX = RecallInfo(Ct, 'Pos X', Fx_P, 'Num') - FP.PosY = RecallInfo(Ct, 'Pos Y', Fx_P, 'Num') - FP.Style = RecallInfo(Ct, 'Style', Fx_P) - FP.V_FontSize = RecallInfo(Ct, 'Value Font Size', Fx_P, 'Num') - FP.CustomLbl = RecallInfo(Ct, 'Custom Label', Fx_P) - if FP.CustomLbl == '' then FP.CustomLbl = nil end - FP.FontSize = RecallInfo(Ct, 'Font Size', Fx_P, 'Num') - FP.Sldr_H = RecallInfo(Ct, 'Slider Height', Fx_P, 'Num') - FP.BgClr = RecallInfo(Ct, 'BgClr', Fx_P, 'Num') - FP.GrbClr = RecallInfo(Ct, 'GrbClr', Fx_P, 'Num') - FP.Lbl_Pos = RecallInfo(Ct, 'Label Pos', Fx_P) - FP.V_Pos = RecallInfo(Ct, 'Value Pos', Fx_P) - FP.Lbl_Clr = RecallInfo(Ct, 'Lbl Clr', Fx_P, 'Num') - FP.V_Clr = RecallInfo(Ct, 'V Clr', Fx_P, 'Num') - FP.DragDir = RecallInfo(Ct, 'Drag Direction', Fx_P, 'Num') - FP.Value_Thick = RecallInfo(Ct, 'Value Thickness', Fx_P, 'Num') - FP.V_Pos_X = RecallInfo(Ct, 'Value Free Pos X', Fx_P, 'Num') - FP.V_Pos_Y = RecallInfo(Ct, 'Value Free Pos Y', Fx_P, 'Num') - local path = RecallInfo(Ct, 'Custom Image', Fx_P) - if path then - FP.ImagePath = path - - FP.Style = 'Custom Image' - - FP.Image = r.ImGui_CreateImage(r.GetResourcePath() .. path) - r.ImGui_Attach(ctx, FP.Image) - end - - - FP.ConditionPrm = RecallInfo(Ct, 'Condition Param', Fx_P, 'Num', '|') - for i = 2, 5, 1 do - FP['ConditionPrm' .. i] = RecallInfo(Ct, 'Condition Param' .. i, Fx_P, 'Num', '|') - end - FP.V_Round = RecallInfo(Ct, 'Decimal Rounding', Fx_P, 'Num') - FP.ValToNoteL = RecallInfo(Ct, 'Value to Note Length', Fx_P, 'Num') - FP.SwitchType = RecallInfo(Ct, 'Switch type', Fx_P, 'Num') - FP.SwitchBaseV = RecallInfo(Ct, 'Switch Base Value', Fx_P, 'Num') - FP.SwitchTargV = RecallInfo(Ct, 'Switch Target Value', Fx_P, 'Num') - - - - if FP.ConditionPrm then - FP.ConditionPrm_V = RecallIntoTable(Ct, Fx_P .. '. Condition Param = %d+|1=', Fx_P, - nil) - FP.ConditionPrm_V_Norm = RecallIntoTable(Ct, Fx_P .. '. Condition Param Norm = |1=', - Fx_P, - 'Num') - end - for i = 2, 5, 1 do - FP['ConditionPrm_V' .. i] = RecallIntoTable(Ct, Fx_P .. - '. Condition Param' .. i .. ' = %d+|1=', Fx_P, nil) - FP['ConditionPrm_V_Norm' .. i] = RecallIntoTable(Ct, - Fx_P .. '. Condition Param Norm' .. i .. ' = |1=', Fx_P, 'Num') - end - - if Prm.InstAdded[FxGUID] ~= true then - StoreNewParam(FxGUID, FP.Name, FP.Num, FX_Idx, 'Not Deletable', 'AddingFromExtState', - Fx_P, FX_Idx, TrkID) - r.SetProjExtState(0, 'FX Devices', 'FX' .. FxGUID .. 'Params Added', 'true') - end - - FP.ManualValues = RecallIntoTable(Ct, Fx_P .. '. Manual V:1=', Fx_P, 'Num') - FP.ManualValuesFormat = RecallIntoTable(Ct, Fx_P .. '. Manual Val format:1=', Fx_P) - - - - local DrawNum = RecallInfo(Ct, 'Number of attached drawings', Fx_P, 'Num') - if DrawNum then - FP.Draw = FP.Draw or {} - for D = 1, DrawNum, 1 do - FP.Draw[D] = FP.Draw[D] or {} - local d = FP.Draw[D] - - local function RC(name, type) - return RecallInfo(Ct, 'Draw Item ' .. D .. ': ' .. name, Fx_P, type) - end - - d.Type = RC('Type') - d.X_Offset = RC('X Offset', 'Num') - d.X_Offset_VA = RC('X Offset Value Affect', 'Num') - d.Y_Offset = RC('Y offset', 'Num') - d.Y_Offset_VA = RC('Y Offset Value Affect', 'Num') - d.Width = RC('Width', 'Num') - d.Width_VA = RC('Width Value Affect', 'Num') - d.Clr = RC('Color', 'Num') - d.FillClr = RC('Fill Color', 'Num') - d.Angle_Min = RC('Angle Min', 'Num') - d.Angle_Max = RC('Angle Max', 'Num') - d.Rad_In = RC('Radius Inner', 'Num') - d.Rad_Out = RC('Radius Outer' , 'Num') - d.Height = RC('Height' , 'Num') - d.Height_VA = RC('Height_VA' , 'Num') - d.Round = RC('Round', 'Num') - d.Thick = RC('Thick', 'Num') - d.Repeat = RC('Repeat', 'Num') - d.Repeat_VA = RC('Repeat_VA', 'Num') - d.Y_Repeat = RC('Y_Repeat', 'Num') - d.Y_Repeat_VA = RC('Y_Repeat_VA', 'Num') - d.Gap = RC('Gap', 'Num') - d.Gap_VA = RC('Gap_VA', 'Num') - d.X_Gap = RC('X_Gap', 'Num') - d.X_Gap_VA = RC('X_Gap_VA', 'Num') - d.Y_Gap = RC('Y_Gap', 'Num') - d.Y_Gap_VA = RC('Y_Gap_VA', 'Num') - d.RPT_Clr = RC('RPT_Clr', 'Num') - - - local path = RC('Image_Path') - if path then - d.FilePath = path - - d.Image = r.ImGui_CreateImage(r.GetResourcePath() ..d.FilePath) - r.ImGui_Attach(ctx, d.Image) - end - - end - end - end - GetProjExt_FxNameNum(FxGUID) - Prm.InstAdded[FxGUID] = true - end - else ---- if no editings has been saved to extstate - if FX[FxGUID] then - for Fx_P = 1, #FX[FxGUID] or 0, 1 do - local ID = FxGUID .. Fx_P - local FP = FX[FxGUID][Fx_P] - if FX[FxGUID][Fx_P] then - FP.Name = nil - FP.Num = nil - FP.Sldr_W = nil - FP.Type = nil - FP.PosX = nil - FP.PosY = nil - FP.Style = nil - FP.V_FontSize = nil - FP.CustomLbl = nil - FP.FontSize = nil - FP.Sldr_H = nil - FP.BgClr = nil - FP.GrbClr = nil - FP.Lbl_Pos = nil - FP.V_Pos = nil - FP.Lbl_Clr = nil - FP.V_Clr = nil - FP.DragDir = nil - FP.ConditionPrm = nil - FP.V_Round = nil - FP.ValToNoteL = nil - FP.SwitchType = nil - FP.SwitchBaseV = nil - FP.SwitchTargV = nil - end - end - GetProjExt_FxNameNum(FxGUID) - end - end - - ------------------------------------- Drawings ------------------------------------------------- - if file then - local All = file:read('*a') - - local Top = tablefind(Line, '========== Drawings ==========') or nil - - - if Top then - local Ct = Content - - Draw.Df_EdgeRound[FxGUID] = get_aftr_Equal_Num(Line[Top + 1]) - local DrawInst = RecallGlobInfo(Ct, 'Total Number of Drawings = ', 'Num') - - - if DrawInst then - if DrawInst > 0 then - Draw[FX_Name_Short] = { - Rect = {}, - clr = {}, - ItemInst = {}, - L = {}, - R = {}, - Y = {}, - T = {}, - B = {}, - Type = {}, - FxGUID = {}, - Txt = {} - } - end - end - local D = Draw[FX_Name_Short] - - for i = 1, DrawInst or 0, 1 do - D[i] = D[i] or {} - local function LN(num) - return Line[Top + 5 + ((i - 1) * 9) + num] - end - local ID = FX_Name .. i - - Draw[FX_Name_Short].Type[i] = RecallInfo(Ct, 'Type', 'D' .. i, Type, untilwhere) - D.L[i] = RecallInfo(Ct, 'Left', 'D' .. i, 'Num') - - D.R[i] = RecallInfo(Ct, 'Right', 'D' .. i, 'Num') - D.T[i] = RecallInfo(Ct, 'Top', 'D' .. i, 'Num') - D.B[i] = RecallInfo(Ct, 'Bottom', 'D' .. i, 'Num') - D.clr[i] = RecallInfo(Ct, 'Color', 'D' .. i, 'Num') - D.Txt[i] = RecallInfo(Ct, 'Text', 'D' .. i) - D.Txt[i] = RecallInfo(Ct, 'Text', 'D' .. i) - D[i].FilePath = RecallInfo(Ct, 'ImagePath', 'D' .. i) - - D[i].KeepImgRatio = RecallInfo(Ct, 'KeepImgRatio', 'D' .. i, 'Bool') - - if D[i].FilePath then - D[i].Image = r.ImGui_CreateImage(D[i].FilePath) - r.ImGui_Attach(ctx, D[i].Image) - end - - - - --[[ Draw[FX_Name_Short].Type[i] = get_aftr_Equal(LN(1)) - D.L[i] = get_aftr_Equal_Num(LN(2)) - D.R[i] = get_aftr_Equal_Num(LN(3)) - D.T[i] = get_aftr_Equal_Num(LN(4)) - D.B[i] = get_aftr_Equal_Num(LN(5)) - D.clr[i] = get_aftr_Equal_Num(LN(6)) - D.Txt[i] = get_aftr_Equal(LN(7)) ]] - end - else - Draw[FX_Name_Short] =nil - - end - - end - end - end - end - end - - function StoreNewParam(FxGUID, P_Name, P_Num, FX_Num, IsDeletable, AddingFromExtState, Fx_P, FX_Idx, TrkID) - TrkID = TrkID or r.GetTrackGUID(r.GetLastTouchedTrack()) - - --Trk.Prm.Inst[TrkID] = (Trk.Prm.Inst[TrkID] or 0 )+1 - --r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: Trk Prm Count',Trk.Prm.Inst[TrkID], true ) - - local P - - - - if AddingFromExtState == 'AddingFromExtState' then - P = Fx_P - else - FX[FxGUID] = FX[FxGUID] or {} - -- local Index = #FX[FxGUID] or 0 - table.insert(FX[FxGUID], Fx_P) - FX.Prm.Count[FxGUID] = (FX.Prm.Count[FxGUID] or 0) + 1 - P = #FX[FxGUID] + 1 - end - - - r.SetProjExtState(0, 'FX Devices', 'Prm Count' .. FxGUID, P) - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: FXs Prm Count' .. FxGUID, P, true) - - - FX[FxGUID][P] = FX[FxGUID][P] or {} - FX[FxGUID][P].Num = P_Num - FX[FxGUID][P].Name = P_Name - - - r.SetProjExtState(0, 'FX Devices', 'FX' .. P .. 'Name' .. FxGUID, P_Name) - r.SetProjExtState(0, 'FX Devices', 'FX' .. P .. 'Num' .. FxGUID, P_Num) - table.insert(Prm.Num, P_Num) - - - table.insert(Prm.Deletable, IsDeletable) - - - if AddingFromExtState == 'AddingFromExtState' then - FX[FxGUID][P].V = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, P_Num) - else - local rv, step, smallstep, largestep, istoggle = r.TrackFX_GetParameterStepSizes(LT_Track, LT_FX_Number, - LT_ParamNum) - if rv then --[[ if the param is a switch ]] end - FX[FxGUID][P].V = r.TrackFX_GetParamNormalized(LT_Track, LT_FX_Number, LT_ParamNum) - end - return P - end - - function GetParamOptions(get, FxGUID, FX_Idx, Fx_P, WhichPrm) - local OP = FX.Prm.Options; local OPs, V - - if get == 'get' then OP[FxGUID] = nil end - - if not OP[FxGUID] then OP[FxGUID] = {} end - if not OP[FxGUID][Fx_P] then - OP[FxGUID][Fx_P] = {}; - - OP[FxGUID][Fx_P] = { V = {} } - end - OPs = OP[FxGUID][Fx_P] - V = OP[FxGUID][Fx_P].V - - - local OrigV = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, WhichPrm) - - - - if #OPs == 0 then - for i = 0, 1, 0.01 do - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, WhichPrm, i) - local _, buf = r.TrackFX_GetFormattedParamValue(LT_Track, FX_Idx, WhichPrm) - if not Value then - Value = buf; OPs[1] = buf - V[1] = i - end - if Value ~= buf then - OPs[#OPs + 1] = buf; V[#V + 1] = i; - local L1 = r.ImGui_CalcTextSize(ctx, buf); local L2 = r.ImGui_CalcTextSize(ctx, Value) - FX[FxGUID][Fx_P].Combo_W = math.max(L1, L2) - Value = buf - end - end - end - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, WhichPrm, OrigV) - end - - function DrawModLines(Macro, AddIndicator, McroV, FxGUID, F_Tp, Sldr_Width, P_V, Vertical, FP, offset) - local drawlist = r.ImGui_GetWindowDrawList(ctx) --[[add+ here]] - local SldrGrabPos - local L, T = r.ImGui_GetItemRectMin(ctx); local R, B = r.ImGui_GetItemRectMax(ctx) - local SizeX, SizeY = r.ImGui_GetItemRectSize(ctx) - MacroModLineOffset = 0 - - if Vertical ~= 'Vert' then - PosX_End_Of_Slider = (Sldr_Width) + L - SldrGrabPos = SizeX * P_V - SliderCurPos = L + SldrGrabPos - SliderModPos = SliderCurPos + ((FP.ModAMT[Macro] * Sldr_Width) or 0) - SliderModPos = SetMinMax(SliderModPos, L, PosX_End_Of_Slider) - elseif Vertical == 'Vert' then - PosX_End_Of_Slider = T - SldrGrabPos = (SizeY) * (P_V) - SliderCurPos = B - SldrGrabPos - SliderModPos = SliderCurPos - ((FP.ModAMT[Macro] * Sldr_Width) or 0) - SliderModPos = SetMinMax(SliderModPos, T, B) - end - - - drawlist = r.ImGui_GetWindowDrawList(ctx) - -- r.ImGui_DrawList_AddLine(drawlist,SliderCurPos,T,SliderModPos or 1,T, EightColors.HighSat_MidBright[Macro],3) - - - local Midsat, MidBright = EightColors.MidSat[Macro], EightColors.HighSat_MidBright[Macro] - if FP.ModBypass == Macro then Midsat, MidBright = 0x88888866, 0xaaaaaa66 end - - if AddIndicator and FP.ModAMT[Macro] ~= 0 then - local ModPosWithAmt - local M = Trk[TrkID].Mod[Macro] - local MOD = McroV - if M.Type == 'env' or M.Type == 'Step' or M.Type == 'Follower' then - r.gmem_attach('ParamValues') - MOD = math.abs(SetMinMax(r.gmem_read(100 + Macro) / 127, -1, 1)) - end - - - - if Vertical ~= 'Vert' then - ModPosWithAmt = math.min(SliderCurPos + (MOD * Sldr_Width * FP.ModAMT[Macro]) or 0, - PosX_End_Of_Slider) - else - ModPosWithAmt = math.max(SliderCurPos - (MOD * Sldr_Width * FP.ModAMT[Macro]) or 0, PosX_End_Of_Slider) - end - - - - - -- Current Value indicator - if Vertical ~= 'Vert' then - r.ImGui_DrawList_AddRectFilled(drawlist, SliderCurPos, T, (ModPosWithAmt or SliderCurPos or 0), B, - Midsat, Rounding) - else - r.ImGui_DrawList_AddRectFilled(drawlist, L, SliderCurPos, R, ModPosWithAmt or SliderCurPos, Midsat, - Rounding) - end - end - - --- mod range indicator line - if Vertical ~= 'Vert' then - r.ImGui_DrawList_AddLine(drawlist, SliderCurPos, T - offset, SliderModPos or 1, T - offset, - MidBright, 2) - else - r.ImGui_DrawList_AddRectFilled(drawlist, L - offset, SliderCurPos, L - offset, SliderModPos, MidBright, - Rounding) - end - end - - --r.ImGui_SetNextWindowDockID(ctx, -1) ---Dock the script - function ImageAngle(ctx, img, angle, w, h, x, y) - if not x and not y then x, y = reaper.ImGui_GetCursorScreenPos(ctx) end - local cx, cy = x + (w / 2), y + (h / 2) - local rotate = function(x, y) - x, y = x - cx, y - cy - return (x * math.cos(angle) - y * math.sin(angle)) + cx, - (x * math.sin(angle) + y * math.cos(angle)) + cy - end - local dl = reaper.ImGui_GetWindowDrawList(ctx) - local p1_x, p1_y = rotate(x, y) - local p2_x, p2_y = rotate(x + w, y) - local p3_x, p3_y = rotate(x + w, y + h) - local p4_x, p4_y = rotate(x, y + h) - reaper.ImGui_DrawList_AddImageQuad(dl, img, - p1_x, p1_y, p2_x, p2_y, p3_x, p3_y, p4_x, p4_y) - --r.ImGui_Dummy(ctx, w, h) - end - - function SaveLayoutEditings(FX_Name, ID, FxGUID) - local dir_path = ConcatPath(reaper.GetResourcePath(), 'Scripts', 'ReaTeam Scripts', 'FX', 'BryanChi_FX Devices', - 'FX Layouts') - local FX_Name = ChangeFX_Name(FX_Name) - local file_path = ConcatPath(dir_path, FX_Name .. '.ini') - reaper.RecursiveCreateDirectory(dir_path, 0) - - local file = io.open(file_path, 'w') - if file then - local function write(Name, Value) - file:write(Name, ' = ', Value or '', '\n') - end - - - file:write('FX global settings', '\n\n') - write('Edge Rounding', FX.Round[FxGUID]) -- 2 - write('Grb Rounding', FX.GrbRound[FxGUID]) -- 3 - write('BgClr', FX.BgClr[FxGUID]) -- 4 - write('Window Width', FX.Width[FxGUID]) -- 5 - write('Title Width', FX.TitleWidth[FxGUID]) - write('Title Clr', FX[FxGUID].TitleClr) - write('Custom Title', FX[FxGUID].CustomTitle) - - write('Param Instance', #FX[FxGUID]) -- 6 - - file:write('\nParameter Specific Settings \n\n') - - for i, v in ipairs(FX[FxGUID]) do - local Fx_P = i - local FP = FX[FxGUID][i] - if type(i) ~= 'number' and i then - i = 1; FP = {} - end - local function write(Name, Value) - if Value then - file:write(i .. '. ' .. Name, ' = ', Value or '', '\n') - end - end - - - file:write('\n-----------------Prm ', i, '-----------------\n') - write('Name', FP.Name) - write('Num', FP.Num) - write('Width', FP.Sldr_W) - write('Type', FP.Type) - write('Pos X', FP.PosX) - write('Pos Y', FP.PosY) - write('Style', FP.Style) - write('Value Font Size', FP.V_FontSize) - write('Custom Label', FP.CustomLbl) - write('Font Size', FP.FontSize) - write('Slider Height', FP.Sldr_H) - write('BgClr', FP.BgClr) - write('GrbClr', FP.GrbClr) - write('Label Pos', FP.Lbl_Pos) - write('Value Pos', FP.V_Pos) - write('Lbl Clr', FP.Lbl_Clr) - write('V Clr', FP.V_Clr) - write('Drag Direction', FP.DragDir) - write('Value Thickness', FP.Value_Thick) - write('Value Free Pos X', FP.V_Pos_X) - write('Value Free Pos Y', FP.V_Pos_Y) - write('Custom Image', FP.ImagePath) - - - - if FP.ConditionPrm_V then - file:write(i .. '. Condition Param = ', FP.ConditionPrm or '') - - for i, v in pairs(FP.ConditionPrm_V) do - file:write('|', i, '=', v or '') - --write('Condition Params Value'..i, v) - end - file:write('|\n') - else - file:write('\n') - end - - if FP.ConditionPrm_V_Norm then - file:write(i .. '. Condition Param Norm = ') - for i, v in ipairs(FP.ConditionPrm_V_Norm) do - file:write('|', i, '=', v or '') - end - file:write('|\n') - else - file:write('\n') - end - - for I = 2, 5, 1 do - if FP['ConditionPrm_V' .. I] then - file:write(i .. '. Condition Param' .. I .. ' = ', FP['ConditionPrm' .. I] or '') - - if FP['ConditionPrm_V' .. I] then - for i, v in pairs(FP['ConditionPrm_V' .. I]) do - file:write('|', i, '=', v or '') - --write('Condition Params Value'..i, v) - end - file:write('|\n') - else - file:write('\n') - end - - if FP['ConditionPrm_V_Norm' .. I] then - file:write(i .. '. Condition Param Norm' .. I .. ' = ') - for i, v in ipairs(FP['ConditionPrm_V_Norm' .. I]) do - file:write('|', i, '=', v or '') - end - file:write('|\n') - else - file:write('\n') - end - end - end - - write('Decimal Rounding', FP.V_Round) - write('Value to Note Length', FP.ValToNoteL) - write('Switch type', FP.SwitchType) - write('Switch Base Value', FP.SwitchBaseV) - write('Switch Target Value', FP.SwitchTargV) - - - if FP.ManualValues then - if FP.ManualValues[1] then - file:write(i .. '. Manual V:') - for i, V in ipairs(FP.ManualValues) do - file:write(i, '=', V, '|') - end - file:write('\n') - file:write(i .. '. Manual Val format:') - for i, V in ipairs(FP.ManualValuesFormat) do - file:write(i, '=', V, '|') - end - file:write('\n') - end - end - if FP.Draw then - write('Number of attached drawings', #FP.Draw) - for D, v in ipairs(FP.Draw) do - local function WRITE(name, val) - write('Draw Item ' .. D .. ': ' .. name, val) - end - WRITE('Type', v.Type) - WRITE('X Offset', v.X_Offset) - WRITE('X Offset Value Affect', v.X_Offset_VA) - WRITE('Y offset', v.Y_Offset) - WRITE('Y Offset Value Affect', v.Y_Offset_VA) - WRITE('Width', v.Width) - WRITE('Width Value Affect', v.Width_VA) - WRITE('Y offset', v.Y_Offset) - WRITE('Color', v.Clr) - WRITE('Fill Color', v.FillClr) - WRITE('Angle Min',v.Angle_Min) - WRITE('Angle Max',v.Angle_Max) - WRITE('Radius Inner', v.Rad_In) - WRITE('Radius Outer', v.Rad_Out) - WRITE('Thick', v.Thick) - WRITE('Height', v.Height) - WRITE('Height_VA', v.Height_VA) - WRITE('Round', v.Round) - WRITE('Repeat', v.Repeat) - WRITE('Repeat_VA', v.Repeat_VA) - WRITE('Y_Repeat', v.Y_Repeat) - WRITE('Y_Repeat_VA', v.Y_Repeat_VA) - WRITE('Gap',v.Gap) - WRITE('Gap_VA',v.Gap_VA) - WRITE('X_Gap', v.X_Gap) - WRITE('X_Gap_VA', v.X_Gap_VA) - WRITE('Y_Gap', v.Y_Gap) - WRITE('Y_Gap_VA', v.Y_Gap_VA) - WRITE('RPT_Clr', v.RPT_Clr) - WRITE('Image_Path' , v.FilePath) - - end - end - end - file:close() - end - - r.SetProjExtState(0, 'FX Devices', 'Prm Count' .. FxGUID, #FX[FxGUID]) - --[[ for i, v in pairs (FX[FxGUID]) do - local Fx_P=i - local FP = FX[FxGUID][i] - - if type(i)~= 'number' and i then i = 1 ; FP={} end - - r.SetExtState('FX Devices - '..FX_Name, 'Prm'..Fx_P ..'s Param Name', FP.Name or '', true ) - r.SetExtState('FX Devices - '..FX_Name, 'Prm'..Fx_P ..'s Param Num', FP.Num or '', true ) - - r.SetExtState('FX Devices - '..FX_Name, 'Prm'..Fx_P ..'s Width', FP.Sldr_W or '' , true) - r.SetExtState('FX Devices - '..FX_Name, 'Prm'..Fx_P..'s Type', FP.Type or '', true) - - - if FP.PosX then r. SetExtState('FX Devices - '..FX_Name, 'Prm'..Fx_P..'s Pos X' , FP.PosX, true) else r.DeleteExtState('FX Devices - '..FX_Name, 'Prm'..Fx_P..'s Pos X',true) end - if FP.PosY then r. SetExtState('FX Devices - '..FX_Name, 'Prm'..Fx_P..'s Pos Y' , FP.PosY, true)else r.DeleteExtState('FX Devices - '..FX_Name, 'Prm'..Fx_P..'s Pos Y',true ) end - if FP.Style then r.SetExtState('FX Devices - '..FX_Name, 'Prm'..Fx_P..'s Style' ,FP.Style, true)else r.DeleteExtState('FX Devices - '..FX_Name, 'Prm'..Fx_P..'s Style', true ) end - if FP.V_FontSize then r.SetExtState('FX Devices - '..FX_Name, 'Prm'..Fx_P..'s V_FontSize' ,FP.V_FontSize, true)else r.DeleteExtState('FX Devices - '..FX_Name, 'Prm'..Fx_P..'s V_FontSize', true ) end - if FP.CustomLbl then r. SetExtState('FX Devices - '..FX_Name, 'Prm'..Fx_P..'s Custom Label' , FP.CustomLbl, true) else r.DeleteExtState('FX Devices - '..FX_Name, 'Prm'..Fx_P..'s Custom Label', true ) end - if FP.FontSize then r. SetExtState('FX Devices - '..FX_Name, 'Prm'..Fx_P..'s Font Size' , FP.FontSize, true) else r.DeleteExtState('FX Devices - '..FX_Name, 'Prm'..Fx_P..'s Font Size', true ) end - if FP.Sldr_H then r. SetExtState('FX Devices - '..FX_Name, 'Prm'..Fx_P..'s Slider Height' , FP.Sldr_H, true)else r.DeleteExtState('FX Devices - '..FX_Name, 'Prm'..Fx_P..'s Slider Height', true ) end - if FP.BgClr then r. SetExtState('FX Devices - '..FX_Name, 'Prm'..Fx_P..'s BgClr' , FP.BgClr, true) else r.DeleteExtState('FX Devices - '..FX_Name, 'Prm'..Fx_P..'s BgClr', true ) end - if FP.GrbClr then r. SetExtState('FX Devices - '..FX_Name, 'Prm'..Fx_P..'s GrbClr' , FP.GrbClr, true) else r.DeleteExtState('FX Devices - '..FX_Name, 'Prm'..Fx_P..'s GrbClr', true ) end - - if FP.Lbl_Pos then r. SetExtState('FX Devices - '..FX_Name, 'Prm'..Fx_P..'s Label Pos' , FP.Lbl_Pos, true)else r.DeleteExtState('FX Devices - '..FX_Name, 'Prm'..Fx_P..'s Label Pos', true ) end - if FP.V_Pos then r. SetExtState('FX Devices - '..FX_Name, 'Prm'..Fx_P..'s Value Pos' , FP.V_Pos, true) else r.DeleteExtState('FX Devices - '..FX_Name, 'Prm'..Fx_P..'s Value Pos', true ) end - if FP.Lbl_Clr then r. SetExtState('FX Devices - '..FX_Name, 'Prm'..Fx_P..'s Lbl Clr' , FP.Lbl_Clr, true)else r.DeleteExtState('FX Devices - '..FX_Name, 'Prm'..Fx_P..'s Lbl Clr', true ) end - if FP.V_Clr then r. SetExtState('FX Devices - '..FX_Name, 'Prm'..Fx_P..'s V Clr' , FP.V_Clr, true) else r.DeleteExtState('FX Devices - '..FX_Name, 'Prm'..Fx_P..'s V Clr', true ) end - if FP.DragDir then r. SetExtState('FX Devices - '..FX_Name, 'Prm'..Fx_P..'s Drag Direction' , FP.DragDir, true)else r.DeleteExtState('FX Devices - '..FX_Name, 'Prm'..Fx_P..'s Drag Direction', true ) end - if FP.ConditionPrm then r.SetExtState('FX Devices - '..FX_Name, 'Prm'..Fx_P..'s Condition Param' , FP.ConditionPrm, true) else r.DeleteExtState('FX Devices - '..FX_Name, 'Prm'..Fx_P..'s Condition Param', true ) end - if FP.ConditionPrm_V then - for i, v in pairs(FP.ConditionPrm_V) do - r.SetExtState('FX Devices - '..FX_Name, 'Prm'..Fx_P..'s Condition Params Value'..i , v, true) - end - r.SetExtState('FX Devices - '..FX_Name, 'Prm'..Fx_P..'s Condition Params Value How Many' , #FP.ConditionPrm_V, true) - - end - if FP.V_Round then r. SetExtState('FX Devices - '..FX_Name, 'Prm'..Fx_P..'s Decimal Rounding' , FP.V_Round, true) end - if FP.ValToNoteL~=nil then r.SetExtState('FX Devices - '..FX_Name, 'Prm'..Fx_P..'s Value to Note Length' , tostring(FP.ValToNoteL), true) end - if FP.SwitchType then r.SetExtState('FX Devices - '..FX_Name, 'Prm'..Fx_P..'s Switch type' , FP.SwitchType, true) end - if FP.SwitchBaseV then r.SetExtState('FX Devices - '..FX_Name, 'Prm'..Fx_P..'s Switch Base Value' , FP.SwitchBaseV, true) end - if FP.SwitchTargV then r.SetExtState('FX Devices - '..FX_Name, 'Prm'..Fx_P..'s Switch Target Value' , FP.SwitchTargV, true) end - - - end ]] - - - SaveDrawings(FX_Idx, FxGUID) - end - - function MakeItemEditable(FxGUID, Fx_P, ItemWidth, ItemType, PosX, PosY) - if FX.LayEdit == FxGUID and Draw.DrawMode[FxGUID] ~= true and Mods~= Apl then - local DeltaX, DeltaY = r.ImGui_GetMouseDelta(ctx); local MouseX, MouseY = r.ImGui_GetMousePos(ctx) - - WinDrawList = r.ImGui_GetWindowDrawList(ctx) - local L, T = r.ImGui_GetItemRectMin(ctx); local w, h = r.ImGui_GetItemRectSize(ctx); local R = L + w; local B = - T + - h; - r.ImGui_DrawList_AddRect(WinDrawList, L, T, R, B, 0x999999ff) - - - - for i, v in pairs(LE.Sel_Items) do - if Fx_P == v then - HighlightSelectedItem(0x66666644, 0xffffffff, 0, L, T, R, B, h, w, 5, 4) - LE.SelectedItemType = ItemType - end - end - - - - - - --- if mouse is on an item - if r.ImGui_IsWindowHovered(ctx, r.ImGui_HoveredFlags_RootAndChildWindows()) then - if MouseX > L and MouseX < R - 5 and MouseY > T and MouseY < B then - if LBtnRel and Max_L_MouseDownDuration < 0.1 and Mods == 0 then - LE.Sel_Items = {} - table.insert(LE.Sel_Items, Fx_P) - end - - if IsLBtnClicked and Mods == 0 then - LE.SelectedItem = Fx_P - elseif IsLBtnClicked and Mods == Shift then - local ClickOnSelItem, ClickedItmNum - for i, v in pairs(LE.Sel_Items) do - if v == Fx_P then - ClickedItmNum = i - else - end - end - if ClickedItmNum then table.remove(LE.Sel_Items, ClickedItmNum) else table.insert(LE.Sel_Items, Fx_P) end - end - - if IsLBtnClicked then - ClickOnAnyItem = true - FX[FxGUID][Fx_P].PosX = PosX - FX[FxGUID][Fx_P].PosY = PosY - if #LE.Sel_Items > 1 then - LE.ChangePos = LE.Sel_Items - else - LE.ChangePos = Fx_P - end - end - end - end - - - if LE.Sel_Items and not r.ImGui_IsAnyItemActive(ctx) then - if r.ImGui_IsKeyPressed(ctx, r.ImGui_Key_DownArrow()) and Mods == 0 then - for i, v in ipairs(LE.Sel_Items) do - if v == Fx_P then FX[FxGUID][v].PosY = FX[FxGUID][v].PosY + LE.GridSize end - end - elseif r.ImGui_IsKeyPressed(ctx, r.ImGui_Key_UpArrow()) and Mods == 0 then - for i, v in ipairs(LE.Sel_Items) do - if v == Fx_P then FX[FxGUID][v].PosY = FX[FxGUID][v].PosY - LE.GridSize end - end - elseif r.ImGui_IsKeyPressed(ctx, r.ImGui_Key_LeftArrow()) and Mods == 0 then - for i, v in ipairs(LE.Sel_Items) do - if v == Fx_P then FX[FxGUID][v].PosX = FX[FxGUID][v].PosX - LE.GridSize end - end - elseif r.ImGui_IsKeyPressed(ctx, r.ImGui_Key_RightArrow()) and Mods == 0 then - for i, v in ipairs(LE.Sel_Items) do - if v == Fx_P then FX[FxGUID][v].PosX = FX[FxGUID][v].PosX + LE.GridSize end - end - elseif r.ImGui_IsKeyPressed(ctx, r.ImGui_Key_DownArrow()) and Mods == Shift then - for i, v in ipairs(LE.Sel_Items) do - if v == Fx_P then FX[FxGUID][v].PosY = FX[FxGUID][v].PosY + 1 end - end - elseif r.ImGui_IsKeyPressed(ctx, r.ImGui_Key_UpArrow()) and Mods == Shift then - for i, v in ipairs(LE.Sel_Items) do - if v == Fx_P then FX[FxGUID][v].PosY = FX[FxGUID][v].PosY - 1 end - end - elseif r.ImGui_IsKeyPressed(ctx, r.ImGui_Key_LeftArrow()) and Mods == Shift then - for i, v in ipairs(LE.Sel_Items) do - if v == Fx_P then FX[FxGUID][v].PosX = FX[FxGUID][v].PosX - 1 end - end - elseif r.ImGui_IsKeyPressed(ctx, r.ImGui_Key_RightArrow()) and Mods == Shift then - for i, v in ipairs(LE.Sel_Items) do - if v == Fx_P then FX[FxGUID][v].PosX = FX[FxGUID][v].PosX + 1 end - end - end - end - - -- Right Bound - if ItemType == 'V-Slider' or ItemType == 'Sldr' or ItemType == 'Drag' or ItemType == 'Selection' then - r.ImGui_DrawList_AddCircleFilled(WinDrawList, R, T + h / 2, 3, 0x999999dd) - if MouseX > R - 5 and MouseX < R + 5 and MouseY > T and MouseY < B then - r.ImGui_DrawList_AddCircleFilled(WinDrawList, R, T + h / 2, 4, 0xbbbbbbff) - r.ImGui_SetMouseCursor(ctx, r.ImGui_MouseCursor_ResizeEW()) - if IsLBtnClicked then - local ChangeSelectedItmBounds - for i, v in pairs(LE.Sel_Items) do - if v == Fx_P then - ChangeSelectedItmBounds = true - end - end - if ChangeSelectedItmBounds then - ChangePrmW = 'group' - else - ChangePrmW = Fx_P - end - end - end - elseif ItemType == 'Knob' or (not ItemType and FX.Def_Type[FxGUID] == 'Knob') then - r.ImGui_DrawList_AddCircleFilled(WinDrawList, R, B, 3, 0x999999dd) - if MouseX > R - 5 and MouseX < R + 5 and MouseY > B - 5 and MouseY < B + 3 then - r.ImGui_SetMouseCursor(ctx, r.ImGui_MouseCursor_ResizeNWSE()) - r.ImGui_DrawList_AddCircleFilled(WinDrawList, R, B, 4, 0xbbbbbbff) - if IsLBtnClicked then - local ChangeSelItmRadius - for i, v in pairs(LE.Sel_Items) do - if v == Fx_P then ChangeSelItmRadius = true end - end - if ChangeSelItmRadius then LE.ChangeRadius = 'Group' else LE.ChangeRadius = Fx_P end - end - end - end - - - - - function ChangeParamWidth(Fx_P) - r.ImGui_SetMouseCursor(ctx, r.ImGui_MouseCursor_ResizeEW()) - r.ImGui_DrawList_AddCircleFilled(WinDrawList, R, T + h / 2, 3, 0x444444ff) - local MsDragDeltaX, MsDragDeltaY = r.ImGui_GetMouseDragDelta(ctx); local Dx, Dy = r.ImGui_GetMouseDelta( - ctx) - - if ItemWidth == nil then - if ItemType == 'Sldr' or ItemType == 'Drag' then - ItemWidth = 160 - elseif ItemType == 'Selection' then - ItemWidth = FX[FxGUID][Fx_P].Combo_W - elseif ItemType == 'Switch' then - ItemWidth = FX[FxGUID][Fx_P].Switch_W - elseif ItemType == 'Knob' then - ItemWidth = Df.KnobRadius - elseif ItemType == 'V-Slider' then - ItemWidth = 15 - end - elseif ItemWidth < LE.GridSize and ItemType ~= 'V-Slider' then - ItemWidth = LE.GridSize - elseif ItemWidth < 5 and ItemType == 'V-Slider' then - ItemWidth = 4 - end - - if Mods == 0 then ItemWidth = ItemWidth + Dx end - - if ItemType == 'Sldr' or ItemType == 'V-Slider' or ItemType == 'Drag' or ItemType == 'Selection' or ItemType == 'Switch' then - FX[FxGUID][Fx_P].Sldr_W = ItemWidth - end - if LBtnRel and ChangePrmW == Fx_P then - FX[FxGUID][Fx_P].Sldr_W = roundUp(FX[FxGUID][Fx_P].Sldr_W, LE - .GridSize) - end - if LBtnRel then ChangePrmW = nil end - AdjustPrmWidth = true - end - - function ChangeKnobRadius(Fx_P) - r.ImGui_SetMouseCursor(ctx, r.ImGui_MouseCursor_ResizeNWSE()) - r.ImGui_DrawList_AddCircleFilled(WinDrawList, R, B, 3, 0x444444ff) - local Dx, Dy = r.ImGui_GetMouseDelta(ctx) - if not FX[FxGUID][Fx_P].Sldr_W then FX[FxGUID][Fx_P].Sldr_W = Df.KnobRadius end - local DiagDrag = (Dx + Dy) / 2 - if Mods == 0 then - FX[FxGUID][Fx_P].Sldr_W = FX[FxGUID][Fx_P].Sldr_W + DiagDrag; - end - if LBtnRel and LE.ChangeRaius == Fx_P then - FX[FxGUID][Fx_P].Sldr_W = roundUp(FX[FxGUID][Fx_P].Sldr_W, - LE.GridSize / 2) - end - if LBtnRel then LE.ChangeRadius = nil end - ClickOnAnyItem = true - FX[FxGUID][Fx_P].Sldr_W = math.max(FX[FxGUID][Fx_P].Sldr_W, 10) - end - - if LE.ChangeRadius == Fx_P then - ChangeKnobRadius(Fx_P) - elseif LE.ChangeRadius == 'Group' then - for i, v in pairs(LE.Sel_Items) do - if v == Fx_P then - ChangeKnobRadius(v) - end - end - end - - - if ChangePrmW == 'group' then - for i, v in pairs(LE.Sel_Items) do - if v == Fx_P then - ChangeParamWidth(v) - end - end - elseif ChangePrmW == Fx_P then - ChangeParamWidth(Fx_P) - end - - - - function ChangeItmPos() - if LBtnDrag then - HintMessage = 'Ctrl = Lock Y Axis | Alt = Lock X Axis | Shift = Disable grid snapping ' - local Dx, Dy = r.ImGui_GetMouseDelta(ctx) - if Mods == Ctrl or Mods == Ctrl + Shift then - Dx = 0 - elseif Mods == Alt or Mods == Alt + Shift then - Dy = 0 - end - r.ImGui_SetMouseCursor(ctx, r.ImGui_MouseCursor_ResizeAll()) - FX[FxGUID][Fx_P].PosX = FX[FxGUID][Fx_P].PosX or PosX - FX[FxGUID][Fx_P].PosY = FX[FxGUID][Fx_P].PosY or PosY - FX[FxGUID][Fx_P].PosX = FX[FxGUID][Fx_P].PosX + Dx; FX[FxGUID][Fx_P].PosY = FX[FxGUID][Fx_P].PosY + - Dy - AddGuideLines(0xffffff44, L, T, R, B) - end - end - - if LE.ChangePos == Fx_P then - ChangeItmPos() - elseif LBtnDrag and type(LE.ChangePos) == 'table' then - for i, v in pairs(LE.ChangePos) do - if v == Fx_P then - ChangeItmPos() - end - end - end - - if LBtnRel and LE.ChangePos == Fx_P and Max_L_MouseDownDuration > 0.1 then - if (Mods ~= Shift and Mods ~= Shift + Ctrl and Mods ~= Shift + Alt) and FX[FxGUID][Fx_P].PosX and FX[FxGUID][Fx_P].PosY then - FX[FxGUID][Fx_P].PosX = SetMinMax(roundUp(FX[FxGUID][Fx_P].PosX, LE.GridSize), 0, - Win_W - (FX[FxGUID][Fx_P].Sldr_W or 15)) - FX[FxGUID][Fx_P].PosY = SetMinMax(roundUp(FX[FxGUID][Fx_P].PosY, LE.GridSize), 0, 220 - 10) - end - end - if LBtnRel then - LE.ChangePos = nil - end - end - end - - function AddGuideLines(Clr, L, T, R, B) - r.ImGui_DrawList_AddLine(Glob.FDL, L, T, L - 9999, T, Clr) - r.ImGui_DrawList_AddLine(Glob.FDL, R, T, R + 9999, T, Clr) - r.ImGui_DrawList_AddLine(Glob.FDL, L, B, L - 9999, B, Clr) - r.ImGui_DrawList_AddLine(Glob.FDL, R, B, R + 9999, B, Clr) - r.ImGui_DrawList_AddLine(Glob.FDL, L, T, L, T - 9999, Clr) - r.ImGui_DrawList_AddLine(Glob.FDL, L, B, L, B + 9999, Clr) - r.ImGui_DrawList_AddLine(Glob.FDL, R, B, R, B + 9999, Clr) - r.ImGui_DrawList_AddLine(Glob.FDL, R, B, R, B + 9999, Clr) - r.ImGui_DrawList_AddLine(Glob.FDL, R, T, R, T - 9999, Clr) - end - - function Calc_strip_uv(img, V) - local w, h = r.ImGui_Image_GetSize(img) - local FrameNum = h / w - - local StepizedV = (SetMinMax(math.floor(V * FrameNum), 0, FrameNum - 1) / FrameNum) - - local uvmin = (1 / FrameNum) * StepizedV * FrameNum - - local uvmax = 1 / FrameNum + (1 / FrameNum) * StepizedV * FrameNum - - - return uvmin, uvmax, w, h - - --[[ if h > w * 5 then -- It's probably a strip knob file - local FrameNum = h / w -- 31 - local scale = 2 - local sz = radius_outer * scale - - local StepizedV = (SetMinMax(math.floor(FP.V * FrameNum), 0, FrameNum - 1) / FrameNum) - - local uvmin = (1 / FrameNum) * StepizedV * FrameNum - - local uvmax = 1 / FrameNum + (1 / FrameNum) * StepizedV * FrameNum - r.ImGui_DrawList_AddImage(WDL, FP.Image, center[1] - sz / 2, center[2] - sz / 2, center[1] + sz / 2, - center[2] + sz / 2, 0, uvmin, 1, uvmax, FP.BgClr or 0xffffffff) - end ]] - end -end - -function FXLayeringFunctions() - function DropFXtoLayerNoMove(FXGUID_RackMixer, LayerNum, DragFX_ID) - DragFX_ID = math.max(DragFX_ID, 0) - local function SetPinMappings(i) - r.TrackFX_SetPinMappings(LT_Track, i, 0, 0, 2 ^ (LayerNum * 2 - 2), 0) --sets input channel - r.TrackFX_SetPinMappings(LT_Track, i, 0, 1, 2 ^ (LayerNum * 2 - 1), 0) - --sets Output - r.TrackFX_SetPinMappings(LT_Track, i, 1, 0, 2 ^ (LayerNum * 2 - 2), 0) - r.TrackFX_SetPinMappings(LT_Track, i, 1, 1, 2 ^ (LayerNum * 2 - 1), 0) - end - if Lyr.FX_Ins[FXGUID_RackMixer] == nil then Lyr.FX_Ins[FXGUID_RackMixer] = 0 end - local guid = reaper.TrackFX_GetFXGUID(LT_Track, DragFX_ID) - - if FX.InLyr[guid] ~= FXGUID_RackMixer then - Lyr.FX_Ins[FXGUID_RackMixer] = Lyr.FX_Ins[FXGUID_RackMixer] + 1 - elseif FX.InLyr[guid] == FXGUID_RackMixer then - end - - FX.InLyr[guid] = FXGUID_RackMixer - r.SetProjExtState(0, 'FX Devices', 'FXLayer - ' .. 'is FX' .. guid .. 'in layer', FXGUID_RackMixer) - FX.LyrNum[guid] = LayerNum - r.SetProjExtState(0, 'FX Devices', 'FXLayer ' .. guid .. 'LayerNum', LayerNum) - - FX[guid] = FX[guid] or {} - FX[guid].inWhichLyr = FX[FXGUID_RackMixer].LyrID[LayerNum] - r.SetProjExtState(0, 'FX Devices', 'FXLayer - ' .. guid .. 'is in Layer ID', FX[FXGUID_RackMixer].LyrID - [LayerNum]) - - - - --@todo if this is the 2nd + FX in Layer, receive from layer channels (layer 2 = 3-4, layer 3 = 5-6 etc) - - - r.SetProjExtState(0, 'FX Devices', 'FX Inst in Layer' .. FXGUID_RackMixer, Lyr.FX_Ins[FXGUID_RackMixer]) - for i = 1, RepeatTimeForWindows, 1 do - local FXGUID = reaper.TrackFX_GetFXGUID(LT_Track, i) - if FX.LyrNum[FXGUID] == LayerNum and FX.InLyr[FXGUID] == FXGUID_RackMixer then - _, FXName = reaper.TrackFX_GetFXName(LT_Track, i) - SetPinMappings(i) - - local rv, inputPins, outputPins = reaper.TrackFX_GetIOSize(LT_Track, i) - if outputPins > 2 then - for P = 2, outputPins, 1 do - r.TrackFX_SetPinMappings(LT_Track, i, 1 --[[IsOutput]], P, 0, 0) - end - end - if inputPins > 2 then - for P = 2, inputPins, 1 do - r.TrackFX_SetPinMappings(LT_Track, i, 0 --[[IsOutput]], P, 0, 0) - end - end - end - end - end - - function DropFXtoLayer(FX_Idx, LayerNum, AltDragSrc) --fxIdx == the position in chain it's dropped to - DragFX_ID = DragFX_ID or AltDragSrc or FX_Idx - local function SetPinMappings(i) - r.TrackFX_SetPinMappings(LT_Track, i, 0, 0, 2 ^ (LayerNum * 2 - 2), 0) --sets input channel - r.TrackFX_SetPinMappings(LT_Track, i, 0, 1, 2 ^ (LayerNum * 2 - 1), 0) - --sets Output - r.TrackFX_SetPinMappings(LT_Track, i, 1, 0, 2 ^ (LayerNum * 2 - 2), 0) - r.TrackFX_SetPinMappings(LT_Track, i, 1, 1, 2 ^ (LayerNum * 2 - 1), 0) - end - - if Lyr.FX_Ins[FXGUID_RackMixer] == nil then Lyr.FX_Ins[FXGUID_RackMixer] = 0 end - local guid - if Payload_Type == 'AddFX_Sexan' then - guid = r.TrackFX_GetFXGUID(LT_Track, FX_Idx) - FX[guid] = FX[guid] or {} - else - guid = r.TrackFX_GetFXGUID(LT_Track, DragFX_ID) - end - - if FX[FXGUID[DragFX_ID]].InWhichBand then - MoveFX_Out_Of_BS() - end - - - if FX.InLyr[guid] ~= FXGUID_RackMixer then - Lyr.FX_Ins[FXGUID_RackMixer] = Lyr.FX_Ins[FXGUID_RackMixer] + 1 - elseif FX.InLyr[guid] == FXGUID_RackMixer then - end - - FX.InLyr[guid] = FXGUID_RackMixer - r.SetProjExtState(0, 'FX Devices', 'FXLayer - ' .. 'is FX' .. guid .. 'in layer', FXGUID_RackMixer) - FX.LyrNum[guid] = LayerNum - r.SetProjExtState(0, 'FX Devices', 'FXLayer ' .. guid .. 'LayerNum', LayerNum) - - - FX[guid].inWhichLyr = FX[FXGUID_RackMixer].LyrID[LayerNum] - r.SetProjExtState(0, 'FX Devices', 'FXLayer - ' .. guid .. 'is in Layer ID', FX[FXGUID_RackMixer].LyrID - [LayerNum]) - - - - --@todo if this is the 2nd + FX in Layer, receive from layer channels (layer 2 = 3-4, layer 3 = 5-6 etc) - - - r.SetProjExtState(0, 'FX Devices', 'FX Inst in Layer' .. FXGUID_RackMixer, Lyr.FX_Ins[FXGUID_RackMixer]) - - - MoveFX(DragFX_ID, FX_Idx, true) - - - - - --[[ for i=1, RepeatTimeForWindows,1 do - local FXGUID = reaper.TrackFX_GetFXGUID( LT_Track, i ) - ]] - if FX.LyrNum[guid] == LayerNum and FX.InLyr[guid] == FXGUID_RackMixer then - local FX_Idx - --_, FXName = r.TrackFX_GetFXName( LT_Track, i ) - for i = 1, RepeatTimeForWindows, 1 do - local FXGUID = reaper.TrackFX_GetFXGUID(LT_Track, i) - if FXGUID == guid then FX_Idx = i end - end - - SetPinMappings(DragFX_ID) - - local rv, inputPins, outputPins = reaper.TrackFX_GetIOSize(LT_Track, DragFX_ID) - if outputPins > 2 then - for P = 2, outputPins, 1 do - r.TrackFX_SetPinMappings(LT_Track, DragFX_ID, 1 --[[IsOutput]], P, 0, 0) - end - end - if inputPins > 2 then - for P = 2, inputPins, 1 do - r.TrackFX_SetPinMappings(LT_Track, DragFX_ID, 0 --[[IsOutput]], P, 0, 0) - end - end - end - --[[ end ]] - end - - function RepositionFXsInContainer(FX_Idx) - r.Undo_BeginBlock() - local FX_Idx = FX_Idx - local FX_Count = r.TrackFX_GetCount(LT_Track) - if AddLastSpace == 'LastSpc' and Trk[TrkID].PostFX[1] then - FX_Idx = FX_Idx - #Trk[TrkID].PostFX - end - - - -- Move the Head of Container - if FX_Idx > Payload or (FX_Idx == RepeatTimeForWindows and AddLastSpace == 'LastSpc') then - --table.insert(MovFX.FromPos,DragFX_ID) table.insert(MovFX.ToPos, FX_Idx-1) - reaper.TrackFX_CopyToTrack(LT_Track, Payload, LT_Track, FX_Idx - 1, true) - elseif Payload > FX_Idx and FX_Idx ~= RepeatTimeForWindows then - reaper.TrackFX_CopyToTrack(LT_Track, Payload, LT_Track, FX_Idx, true) - --table.insert(MovFX.FromPos,DragFX_ID) table.insert(MovFX.ToPos, FX_Idx) - end - - - - -- Move all FXs inside - if Payload_Type == 'FX Layer Repositioning' then - local DropDest = nil - for i = 0, FX_Count, 1 do - if DragFX_ID < FX_Idx then - if DropDest == nil then DropDest = 0 end - local ID = reaper.TrackFX_GetFXGUID(LT_Track, DropDest) - - if FX.InLyr[ID] == FXGUID_RackMixer or tablefind(FX[FXGUID[Payload]].FXsInBS, ID) then - if FX_Idx > DropDest and FX_Idx ~= RepeatTimeForWindows or (FX_Idx == RepeatTimeForWindows and AddLastSpace == 'LastSpc') then - reaper.TrackFX_CopyToTrack(LT_Track, DropDest, LT_Track, FX_Idx - 2, true) - --table.insert(MovFX.FromPos,DropDest) table.insert(MovFX.ToPos, FX_Idx-2) - elseif DropDest > FX_Idx and FX_Idx ~= RepeatTimeForWindows then - reaper.TrackFX_CopyToTrack(LT_Track, DropDest, LT_Track, FX_Idx, true) - --table.insert(MovFX.FromPos,DropDest) table.insert(MovFX.ToPos, FX_Idx) - end - else - DropDest = DropDest + 1 - end - elseif DragFX_ID > FX_Idx then - if DropDest == nil then DropDest = 1 end - local ID = reaper.TrackFX_GetFXGUID(LT_Track, DropDest) - if FX.InLyr[ID] == FXGUID_RackMixer or tablefind(FX[FXGUID[Payload]].FXsInBS, ID) then - reaper.TrackFX_CopyToTrack(LT_Track, DropDest, LT_Track, FX_Idx, true) - --table.insert(MovFX.FromPos,DropDest) table.insert(MovFX.ToPos, FX_Idx) - - DropDest = DropDest + 1 - else - DropDest = DropDest + 1 - end - end - end - elseif Payload_Type == 'BS_Drag' then - for i, v in ipairs(FX[FXGUID[Payload]].FXsInBS) do - if FX_Idx > Payload or (FX_Idx == RepeatTimeForWindows and AddLastSpace == 'LastSpc') then - reaper.TrackFX_CopyToTrack(LT_Track, Payload, LT_Track, FX_Idx - 1, true) - elseif Payload > FX_Idx and FX_Idx ~= RepeatTimeForWindows then - reaper.TrackFX_CopyToTrack(LT_Track, Payload + i, LT_Track, FX_Idx + i, true) - end - end - - --Move Joiner - if FX_Idx > Payload or (FX_Idx == RepeatTimeForWindows and AddLastSpace == 'LastSpc') then - reaper.TrackFX_CopyToTrack(LT_Track, Payload, LT_Track, FX_Idx - 1, true) - elseif Payload > FX_Idx and FX_Idx ~= RepeatTimeForWindows then - reaper.TrackFX_CopyToTrack(LT_Track, Payload + #FX[FXGUID[Payload]].FXsInBS + 1, LT_Track, - FX_Idx + #FX[FXGUID[Payload]].FXsInBS + 1, true) - end - end - if Payload_Type == 'FX Layer Repositioning' then - for i = 0, FX_Count, 1 do -- Move Splitter - local FXGUID = reaper.TrackFX_GetFXGUID(LT_Track, i) - - if Lyr.SplitrAttachTo[FXGUID] == FXGUID_RackMixer then - SplitrGUID = FXGUID - if FX_Idx == 0 then - r.TrackFX_CopyToTrack(LT_Track, i, LT_Track, 0, true) - elseif i > FX_Idx then -- FX_Idx = drop to fx position - if Lyr.FrstFXPos[FXGUID_RackMixer] ~= nil then - r.TrackFX_CopyToTrack(LT_Track, i, LT_Track, FX_Idx, true) - -- table.insert(MovFX.FromPos,i) table.insert(MovFX.ToPos, FX_Idx) - end - elseif i < FX_Idx then - --table.insert(MovFX.FromPos,i) table.insert(MovFX.ToPos, FX_Idx) - - r.TrackFX_CopyToTrack(LT_Track, i, LT_Track, DropDest or FX_Idx, true) - end - end - end - end - - local UndoName - if Payload_Type == 'BS_Drag' then - UndoName = 'Move Band Split and all contained FXs' - elseif Payload_Type == 'FX Layer Repositioning' then - UndoName = 'Move FX Layer and all contained FXs' - end - - r.Undo_EndBlock(UndoName or 'Undo', 0) - end -end - -function ModulationFunctions() - function Link_Param_to_CC(TrackNumToBeMod, FX_Slt_Indx_ToBeMod, PARAM_Num, parmlink, MIDIPLINK, Category, - CC_or_Note_Num, - Baseline_V, Scale) - --NOTE : ALL Numbers here are NOT zero-based, things start from 1 , hence the +1 in function - --('TrackNumToBeMod'..TrackNumToBeMod.. '\n FX_Slt_Indx_ToBeMod'..FX_Slt_Indx_ToBeMod..'\n PARAM_Num'..PARAM_Num..'\n'..'CC_or_Note_Num'..CC_or_Note_Num..'\n') - ParmModTable = ultraschall.CreateDefaultParmModTable() - - ParmModTable["PARMLINK"] = parmlink - - ParmModTable["MIDIPLINK"] = MIDIPLINK - ParmModTable["PARAM_TYPE"] = "" - - ParmModTable["WINDOW_ALTERED"] = false - ParmModTable["PARMLINK_LINKEDPLUGIN"] = -100 - ParmModTable["MIDIPLINK_BUS"] = 16 - ParmModTable["MIDIPLINK_CHANNEL"] = 16 - ParmModTable["MIDIPLINK_MIDICATEGORY"] = Category -- 176 is CC - ParmModTable["MIDIPLINK_MIDINOTE"] = CC_or_Note_Num - ParmModTable["PARAM_NR"] = PARAM_Num + 1 --Param Number to be modulated - ParmModTable["PARAMOD_ENABLE_PARAMETER_MODULATION"] = true - if Baseline_V then ParmModTable["PARAMOD_BASELINE"] = Baseline_V end - if Scale then ParmModTable["PARMLINK_SCALE"] = Scale end - - - whetherValid = ultraschall.IsValidParmModTable(ParmModTable) - - - retval, TrackStateChunk = ultraschall.GetTrackStateChunk_Tracknumber(TrackNumToBeMod) - FXStateChunk = ultraschall.GetFXStateChunk(TrackStateChunk) - alteredFXStateChunk = ultraschall.AddParmMod_ParmModTable(FXStateChunk, FX_Slt_Indx_ToBeMod + 1, ParmModTable) - retval, TrackStateChunk = ultraschall.SetFXStateChunk(TrackStateChunk, alteredFXStateChunk) - retval = ultraschall.SetTrackStateChunk_Tracknumber(TrackNumToBeMod, TrackStateChunk) - - tab = ultraschall.GetParmModTable_FXStateChunk(FXStateChunk, FX_Slt_Indx_ToBeMod + 1, PARAM_Num + 1) - end - - function SetPrmAlias(TrkNum, fxid, parmidx, AliasName) - local u = ultraschall - - retval, TrackStateChunk = u.GetTrackStateChunk_Tracknumber(TrkNum) - FXStateChunk = u.GetFXStateChunk(TrackStateChunk) - retval, alteredFXStateChunk = ultraschall.AddParmAlias_FXStateChunk(FXStateChunk, fxid, parmidx, AliasName) --rv, alteredFXStateChunk = u.AddParmAlias_FXStateChunk( FXStateChunk, fxid, parmalias) - - _, TrackStateChunk = u.SetFXStateChunk(TrackStateChunk, alteredFXStateChunk) - _ = u.SetTrackStateChunk_Tracknumber(TrkNum, TrackStateChunk) - end - - function GetParmModTable(TrkNum, FX_Idx, P_Num, TableIndex_Str) - local TblIDReturn - retval, TrackStateChunk = ultraschall.GetTrackStateChunk_Tracknumber(TrkNum) - FXStateChunk = ultraschall.GetFXStateChunk(TrackStateChunk) - if FXStateChunk then - tab = ultraschall.GetParmModTable_FXStateChunk(FXStateChunk, FX_Idx + 1, P_Num + 1) - end - if tab then TblIDReturn = tab[TableIndex_Str or 'PARAM_TYPE'] end - return TblIDReturn, TrackStateChunk, FXStateChunk, tab - end - - function Unlink_Parm(TrackNumToBeMod, FX_Slt_Indx_ToBeMod, PARAM_Num) - --NOTE : ALL Numbers here are NOT zero-based, things start from 1 , hence the +1 in function - - --ParmModTable = ultraschall.CreateDefaultParmModTable() - --[[ParmModTable["PARAM_NR"] =PARAM_Num - ParmModTable["PARAM_TYPE"] = "" - ParmModTable["WINDOW_ALTERED"] =true - - ParmModTable["PARAMOD_ENABLE_PARAMETER_MODULATION"] = false - ParmModTable["MIDIPLINK"] = false - ParmModTable["PARMLINK"] =false - ParmModTable["MIDIPLINK_BUS"] =nil - ParmModTable["MIDIPLINK_CHANNEL"] =nil - ParmModTable["MIDIPLINK_MIDICATEGORY"] =nil - ParmModTable["MIDIPLINK_MIDINOTE"] =nil ]] - whetherValidUnlink = ultraschall.IsValidParmModTable(ParmModTable) - retval, TrackStateChunk = ultraschall.GetTrackStateChunk_Tracknumber(TrackNumToBeMod) - FXStateChunk = ultraschall.GetFXStateChunk(TrackStateChunk) - --ParmModTable["WINDOW_ALTERED"] =true - --alteredFXStateChunk = ultraschall.AddParmMod_ParmModTable(FXStateChunk, FX_Slt_Indx_ToBeMod+1, ParmModTable) - - alteredFXStateChunk = ultraschall.DeleteParmModFromFXStateChunk(FXStateChunk, FX_Slt_Indx_ToBeMod + 1, - PARAM_Num + 1) - - retval, TrackStateChunk = ultraschall.SetFXStateChunk(TrackStateChunk, alteredFXStateChunk) - retval = ultraschall.SetTrackStateChunk_Tracknumber(TrackNumToBeMod, TrackStateChunk) - end - - function Link_Macros_to_ImGui_Sliders(trackNumber) - ParmModTable = ultraschall.CreateDefaultParmModTable() - retval, TrackStateChunk = ultraschall.GetTrackStateChunk_Tracknumber(TrackNumber) - FXStateChunk = ultraschall.GetFXStateChunk(TrackStateChunk) - alteredFXStateChunk = ultraschall.AddParmMod_ParmModTable(FXStateChunk, 1, ParmModTable) --Always Link 1st FX, which is macros - end - - function PrepareFXforModulation(FX_Idx, P_Num, FxGUID) - local ParamValue_Modding = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, P_Num) - AssignMODtoFX = FX_Idx - r.gmem_attach('ParamValues') - if r.TrackFX_AddByName(LT_Track, 'FXD Macros', 0, 0) == -1 and r.TrackFX_AddByName(LT_Track, 'Macros', 0, 0) == -1 then - r.gmem_write(1, PM.DIY_TrkID[TrkID]) --gives jsfx a guid when it's being created, this will not change becuase it's in the @init. - AddMacroJSFX() - AssignMODtoFX = AssignMODtoFX + 1 - end - - - r.gmem_write(2, PM.DIY_TrkID[TrkID]) --Sends Trk GUID for jsfx to determine track - r.gmem_write(11000 + Trk.Prm.Assign, ParamValue_Modding) - end - - function RemoveModulationIfDoubleRClick(FxGUID, Fx_P, P_Num, FX_Idx) - if r.ImGui_IsMouseDoubleClicked(ctx, 1) and r.ImGui_IsItemClicked(ctx, 1) then - if FX[FxGUID][Fx_P].ModAMT then - for Mc = 1, 8, 1 do - if FX[FxGUID][Fx_P].ModAMT[Mc] then - Unlink_Parm(LT_TrackNum, FX_Idx, P_Num) - FX[FxGUID][Fx_P].ModAMT[Mc] = 0 - end - end - end - end - end - - MacroNums = { 1, 2, 3, 4, 5, 6, 7, 8, } - - - function MakeModulationPossible(FxGUID, Fx_P, FX_Idx, P_Num, p_value, Sldr_Width, Type) - local FP = FX[FxGUID][Fx_P] - local CC = FP.WhichCC - - if --[[Link CC back when mouse is up]] Tweaking == P_Num .. FxGUID and IsLBtnHeld == false then - if FX[FxGUID][Fx_P].WhichCC then - local CC = FX[FxGUID][Fx_P].WhichCC - - r.GetSetMediaTrackInfo_String(LT_Track, - 'P_EXT: FX' .. FxGUID .. 'Prm' .. Fx_P .. 'Value before modulation', - FX[FxGUID][Fx_P].V, true) - - r.gmem_write(7, CC) --tells jsfx to retrieve P value - PM.TimeNow = r.time_precise() - r.gmem_write(11000 + CC, p_value) - Link_Param_to_CC(LT_TrackNum, LT_FX_Number, P_Num, true, true, 176, CC) - end - - Tweaking = nil - end - - - if r.ImGui_IsItemClicked(ctx, 1) and FP.ModAMT and AssigningMacro == nil and Mods == 0 then - for M, v in ipairs(MacroNums) do - if FP.ModAMT[M] then - Trk.Prm.Assign = FP.WhichCC - AssigningMacro = M - - - r.gmem_write(5, AssigningMacro) --tells jsfx which macro is user tweaking - r.gmem_write(6, FP.WhichCC) - end - PM.DragOnModdedPrm = true - end - elseif r.ImGui_IsItemClicked(ctx, 1) and FP.ModAMT and Mods == Shift then - for M, v in ipairs(MacroNums) do - if FP.ModAMT[M] then - Trk.Prm.Assign = FP.WhichCC - BypassingMacro = M - r.gmem_write(5, BypassingMacro) --tells jsfx which macro is user tweaking - r.gmem_write(6, FP.WhichCC) - end - end - DecideShortOrLongClick = FP - Dur = r.ImGui_GetMouseDownDuration(ctx, 1) - end - - if DecideShortOrLongClick == FP and Dur then - if r.ImGui_IsMouseReleased(ctx, 1) then - if Dur < 0.14 then - ---- if short right click - if FP.ModBypass then - r.gmem_write(5, BypassingMacro) --tells jsfx which macro is user tweaking - r.gmem_write(6, FP.WhichCC) - r.gmem_write(1000 * BypassingMacro + Trk.Prm.Assign, FP.ModAMT[BypassingMacro]) - r.gmem_write(3, Trk[TrkID].ModPrmInst) - FP.ModBypass = nil - else - FP.ModBypass = BypassingMacro - r.gmem_write(5, BypassingMacro) --tells jsfx which macro is user tweaking - r.gmem_write(6, FP.WhichCC) - r.gmem_write(1000 * BypassingMacro + Trk.Prm.Assign, 0) -- set mod amount to 0 - r.gmem_write(3, Trk[TrkID].ModPrmInst) - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: FX' .. FxGUID .. 'Prm' .. Fx_P .. 'Mod bypass', - BypassingMacro, true) - end - else - - end - - - DecideShortOrLongClick = nil - end - Dur = r.ImGui_GetMouseDownDuration(ctx, 1) - end - - - if --[[Assign Mod]] AssigningMacro and r.ImGui_IsItemClicked(ctx, 1) then - local _, ValBeforeMod - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: FX' .. FxGUID .. 'Prm' .. Fx_P .. 'Value before modulation', - '', - false) - if not ValBeforeMod then - r.GetSetMediaTrackInfo_String(LT_Track, - 'P_EXT: FX' .. FxGUID .. 'Prm' .. Fx_P .. 'Value before modulation', FX[FxGUID][Fx_P].V, true) - end - - - Trk.Prm.Assign = FP.WhichCC - - - --store which param has which Macros assigned - if FP.WhichMODs == nil then -- if This prm don't have a modulation assigned yet.. - FP.WhichMODs = tostring(AssigningMacro) - - FX[FxGUID][Fx_P].ModAMT = FX[FxGUID][Fx_P].ModAMT or {} - Trk[TrkID].ModPrmInst = (Trk[TrkID].ModPrmInst or 0) + 1 - FX[FxGUID][Fx_P].WhichCC = Trk[TrkID].ModPrmInst - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: FX' .. FxGUID .. 'WhichCC' .. P_Num, FP.WhichCC, true) - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: ModPrmInst', Trk[TrkID].ModPrmInst, true) - - Trk.Prm.Assign = Trk[TrkID].ModPrmInst - elseif FP.WhichMODs and string.find(FP.WhichMODs, tostring(AssigningMacro)) == nil then --if there's more than 1 macro assigned, and the assigning macro is new to this param. - FP.WhichMODs = FP.WhichMODs .. tostring(AssigningMacro) - end - local CC = FP.WhichCC - - - if not Trk.Prm.WhichMcros[CC .. TrkID] then - Trk.Prm.WhichMcros[CC .. TrkID] = tostring(AssigningMacro) - elseif Trk.Prm.WhichMcros[CC .. TrkID] and not string.find(Trk.Prm.WhichMcros[CC .. TrkID], tostring(AssigningMacro)) then --if there's more than 1 macro assigned, and the assigning macro is new to this param. - Trk.Prm.WhichMcros[CC .. TrkID] = Trk.Prm.WhichMcros[CC .. TrkID] .. tostring(AssigningMacro) - end - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: FX' .. FxGUID .. 'Prm' .. Fx_P .. 'Linked to which Mods', - FP.WhichMODs, true) - - --r.SetProjExtState(0, 'FX Devices', 'Prm'..F_Tp..'Has Which Macro Assigned, TrkID ='..TrkID, Trk.Prm.WhichMcros[F_Tp..TrkID]) - r.gmem_write(7, CC) --tells jsfx to retrieve P value - r.gmem_write(11000 + CC, p_value) - - r.gmem_write(6, CC) - - - AssignToPrmNum = P_Num - - r.gmem_write(5, AssigningMacro) --tells jsfx which macro is user tweaking - PrepareFXforModulation(FX_Idx, P_Num, FxGUID) - Link_Param_to_CC(LT_TrackNum, AssignMODtoFX, AssignToPrmNum, true, true, 176, CC) - r.gmem_write(3, Trk[TrkID].ModPrmInst) - - r.gmem_write(7, CC) --tells jsfx to rfetrieve P value - r.gmem_write(11000 + CC, p_value) - end - - - - - if PM.DragOnModdedPrm == true and r.ImGui_IsMouseDown(ctx, 1) ~= true then - AssigningMacro = nil - PM.DragOnModdedPrm = nil - end - if TrkID ~= TrkID_End then - r.gmem_write(3, Trk[TrkID].ModPrmInst or 0) - if FP.ModAMT and FP.WhichCC then - for M = 1, 8, 1 do - r.gmem_write(1000 * M + FP.WhichCC, FP.ModAMT[M] or 0) - end - end - end - - local Vertical - if Type == 'Vert' then Vertical = 'Vert' end - - - if --[[Right Dragging to adjust Mod Amt]] Trk.Prm.Assign and FP.WhichCC == Trk.Prm.Assign and AssigningMacro then - local Id = FxGUID .. Trk.Prm.Assign - local M = AssigningMacro - local IdM = 'Param:' .. tostring(Trk.Prm.Assign) .. 'Macro:' .. AssigningMacro - - - local sizeX, sizeY = r.ImGui_GetItemRectSize(ctx) - - --[[ - PosX_End_Of_Slider= Prm.Pos_L[Id]+sizeX - Prm.SldrGrabXPos[Id]=(PosX_End_Of_Slider-Prm.Pos_L[Id])*p_value - SliderCurPos=Prm.Pos_L[Id]+Prm.SldrGrabXPos[Id] ]] - - local RightBtnDragX, RightBtnDragY = reaper.ImGui_GetMouseDragDelta(ctx, x, y, 1); local MouseDrag - if Vertical == 'Vert' or Type == 'knob' then MouseDrag = -RightBtnDragY else MouseDrag = RightBtnDragX end - - - FX[FxGUID][Fx_P].ModAMT[M] = ((MouseDrag / 100) or 0) + (FX[FxGUID][Fx_P].ModAMT[M] or 0) - - if FP.ModAMT[M] + p_value > 1 then FP.ModAMT[M] = 1 - p_value end - if FP.ModAMT[M] + p_value < 0 then FP.ModAMT[M] = -p_value end - - if not IsLBtnHeld then r.gmem_write(4, 1) end --tells jsfx that user is changing Macro Mod Amount - r.gmem_write(1000 * AssigningMacro + Trk.Prm.Assign, FP.ModAMT[M]) - r.ImGui_ResetMouseDragDelta(ctx, 1) - - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: FX' .. FxGUID .. 'Prm' .. Fx_P .. 'Macro' .. M .. 'Mod Amt', - FP.ModAMT[M], true) - end - - - - if Type ~= 'knob' and FP.ModAMT then - local offset = 0 - for M, v in ipairs(MacroNums) do - if FP.ModAMT[M] and FP.ModAMT[M] ~= 0 then - --if Modulation has been assigned to params - local sizeX, sizeY = r.ImGui_GetItemRectSize(ctx) - local P_V_Norm = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, P_Num) - - --- indicator of where the param is currently - if not FX[FxGUID][Fx_P].V then - FX[FxGUID][Fx_P].V = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, - P_Num) - end - - - - DrawModLines(M, true, Trk[TrkID].Mod[M].Val, FxGUID, FP.WhichCC, ModLineDir or Sldr_Width, - FX[FxGUID][Fx_P].V, Vertical, FP, offset) - Mc.V_Out[M] = (FP.ModAMT[M] * p_value) - ParamHasMod_Any = true - offset = offset + OffsetForMultipleMOD - end - end -- of reapeat for every macro - end - - return Tweaking - end -end - -function ThemeEditorFunctions() - function demo.HelpMarker(desc) - r.ImGui_TextDisabled(ctx, '(?)') - if r.ImGui_IsItemHovered(ctx) then - r.ImGui_BeginTooltip(ctx) - r.ImGui_PushTextWrapPos(ctx, r.ImGui_GetFontSize(ctx) * 35.0) - r.ImGui_Text(ctx, desc) - r.ImGui_PopTextWrapPos(ctx) - r.ImGui_EndTooltip(ctx) - end - end - - function demo.PopStyle() - if app.style_editor and app.style_editor.push_count > 0 then - app.style_editor.push_count = app.style_editor.push_count - 1 - r.ImGui_PopStyleColor(ctx, #cache['Col']) - --r.ImGui_PopStyleVar(ctx, #cache['StyleVar']) - elseif NeedtoPopStyle then - for i in demo.EachEnum('Col') do - r.ImGui_PopStyleColor(ctx) - end - elseif DefaultThemeActive then - r.ImGui_PopStyleColor(ctx, DefaultStylePop) - end - end - - function demo.PushStyle() - if app.style_editor then - app.style_editor.push_count = app.style_editor.push_count + 1 - --[[ for i, value in pairs(app.style_editor.style.vars) do - if type(value) == 'table' then - r.ImGui_PushStyleVar(ctx, i, table.unpack(value)) - else - r.ImGui_PushStyleVar(ctx, i, value) - end - end ]] - for i, value in pairs(app.style_editor.style.colors) do - r.ImGui_PushStyleColor(ctx, i, value) - end - else - local file_path = ConcatPath(reaper.GetResourcePath(), 'Scripts', 'ReaTeam Scripts', 'FX', - 'BryanChi_FX Devices', 'ThemeColors.ini') - local file = io.open(file_path, 'r') - - - - if file then - local content = file:read("a+") - - - - - for i, v in pairs(CustomColors) do - _G[v] = RecallGlobInfo(content, v .. ' = ', 'Num') - end - end - DefaultThemeActive = true - ------------------- Default Color Theme -------------------- - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_FrameBg(), 0x48484837) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_FrameBgHovered(), 0x49494966) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_FrameBgActive(), 0x3F3F3FAB) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_Button(), 0x57575786) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_ButtonHovered(), 0x6F6F6F86) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_ButtonActive(), 0x90909086) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_ButtonActive(), 0x57575786) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_SliderGrab(), 0x616161FF) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_SliderGrabActive(), 0xD1D1D1AC) - DefaultStylePop = 9 - end - end - - function demo.EachEnum(enum) - local enum_cache = cache[enum] - if not enum_cache then - enum_cache = {} - cache[enum] = enum_cache - - for func_name, func in pairs(reaper) do - local enum_name = func_name:match(('^ImGui_%s_(.+)$'):format(enum)) - if enum_name then - table.insert(enum_cache, { func(), enum_name }) - end - end - table.sort(enum_cache, function(a, b) return a[1] < b[1] end) - end - - local i = 0 - return function() - i = i + 1 - if not enum_cache[i] then return end - return table.unpack(enum_cache[i]) - end - end - - function CallFile(mode, filename, folder) - local dir_path - if folder then - dir_path = ConcatPath(r.GetResourcePath(), 'Scripts', 'ReaTeam Scripts', 'FX', 'BryanChi_FX Devices', folder) - else - dir_path = ConcatPath(r.GetResourcePath(), 'Scripts', 'ReaTeam Scripts', 'FX', 'BryanChi_FX Devices') - end - local file_path = ConcatPath(dir_path, filename) - - -- Create directory for file if it doesn't exist - r.RecursiveCreateDirectory(dir_path, 0) - local file = io.open(file_path, mode) - return file, file_path - end - - function PushStyle_AtScriptStart() - local file, file_path = CallFile('r', 'ThemeColors.ini') - if file then - local Lines = get_lines(file_path) - for i in demo.EachEnum('Col') do - r.ImGui_PushStyleColor(ctx, 1, 0x372837ff) - end - else - ----- Default Color theme --------------- - end - end - - --PushStyle_AtScriptStart() - - - - function demo.GetStyleData() - local data = { vars = {}, colors = {} } - local vec2 = { - 'ButtonTextAlign', 'SelectableTextAlign', 'CellPadding', 'ItemSpacing', - 'ItemInnerSpacing', 'FramePadding', 'WindowPadding', 'WindowMinSize', - 'WindowTitleAlign', 'SeparatorTextAlign', 'SeparatorTextPadding' - } - - for i, name in demo.EachEnum('StyleVar') do - local rv = { r.ImGui_GetStyleVar(ctx, i) } - local is_vec2 = false - for _, vec2_name in ipairs(vec2) do - if vec2_name == name then - is_vec2 = true - break - end - end - data.vars[i] = is_vec2 and rv or rv[1] - end - for i in demo.EachEnum('Col') do - data.colors[i] = r.ImGui_GetStyleColor(ctx, i) - end - return data - end - - function demo.CopyStyleData(source, target) - for i, value in pairs(source.vars) do - if type(value) == 'table' then - target.vars[i] = { table.unpack(value) } - else - target.vars[i] = value - end - end - for i, value in pairs(source.colors) do - target.colors[i] = value - end - end - - function ShowStyleEditor() - local rv - - - if not ctx then ctx = r.ImGui_CreateContext('Style Editor 2') end - if not styleEditorIsOpen then r.ImGui_SetNextWindowSize(ctx, 500, 800) end - open, OpenStyleEditor = r.ImGui_Begin(ctx, 'FX Devices Style Editor', OpenStyleEditor, - r.ImGui_WindowFlags_TopMost() + r.ImGui_WindowFlags_NoCollapse() + - r.ImGui_WindowFlags_NoDocking() --[[ +r.ImGui_WindowFlags_AlwaysAutoResize() ]]) - - - if open then - styleEditorIsOpen = true - if not app.style_editor then - app.style_editor = { - style = demo.GetStyleData(), - ref = demo.GetStyleData(), - output_dest = 0, - output_only_modified = false, - push_count = 0, - } - end - - r.ImGui_PushItemWidth(ctx, r.ImGui_GetWindowWidth(ctx) * 0.50) - - local FrameRounding, GrabRounding = r.ImGui_StyleVar_FrameRounding(), - r.ImGui_StyleVar_GrabRounding() - --[[ rv,app.style_editor.style.vars[FrameRounding] = r.ImGui_SliderDouble(ctx, 'FrameRounding', app.style_editor.style.vars[FrameRounding], 0.0, 12.0, '%.0f') - if rv then - app.style_editor.style.vars[GrabRounding] = app.style_editor.style.vars[FrameRounding] -- Make GrabRounding always the same value as FrameRounding - end ]] - - r.ImGui_PushItemWidth(ctx, r.ImGui_GetFontSize(ctx) * 8) - - local Alpha, DisabledAlpha = r.ImGui_StyleVar_Alpha(), r.ImGui_StyleVar_DisabledAlpha() - rv, app.style_editor.style.vars[Alpha] = r.ImGui_DragDouble(ctx, 'Global Alpha', - app.style_editor.style.vars[Alpha], 0.005, 0.20, 1.0, '%.2f') -- Not exposing zero here so user doesn't "lose" the UI (zero alpha clips all widgets). But application code could have a toggle to switch between zero and non-zero. - r.ImGui_SameLine(ctx) - rv, app.style_editor.style.vars[DisabledAlpha] = r.ImGui_DragDouble(ctx, 'Disabled Alpha', - app.style_editor.style.vars[DisabledAlpha], 0.005, 0.0, 1.0, '%.2f'); r.ImGui_SameLine(ctx); demo - .HelpMarker('Additional alpha multiplier for disabled items (multiply over current value of Alpha).') - r.ImGui_PopItemWidth(ctx) - - - - - - - - local borders = { 'WindowBorder', 'FrameBorder', 'PopupBorder' } - for i, name in ipairs(borders) do - local var = r[('ImGui_StyleVar_%sSize'):format(name)]() - local enable = app.style_editor.style.vars[var] > 0 - if i > 1 then r.ImGui_SameLine(ctx) end - rv, enable = r.ImGui_Checkbox(ctx, name, enable) - if rv then app.style_editor.style.vars[var] = enable and 1 or 0 end - end - - -- Save/Revert button - --[[ if r.ImGui_Button(ctx, 'Save Ref') then - demo.CopyStyleData(app.style_editor.style, app.style_editor.ref) - end - r.ImGui_SameLine(ctx) - if r.ImGui_Button(ctx, 'Revert Ref') then - demo.CopyStyleData(app.style_editor.ref, app.style_editor.style) - end - r.ImGui_SameLine(ctx) ]] - - --[[ r.ImGui_SameLine(ctx) - demo.HelpMarker( - 'Save/Revert in local non-persistent storage. Default Colors definition are not affected. \z - Use "Export" below to save them somewhere.') - r.ImGui_SameLine(ctx) - ]] - - --[[ if r.ImGui_Button(ctx, 'Factory Reset Color Theme') then - DltClrTheme = true - end - if DltClrTheme then - - local file, file_path = CallFile('a', 'ThemeColors.ini') - if r.ImGui_BeginPopup( ctx, 'You Sure you want to delete color theme?',r.ImGui_WindowFlags_NoTitleBar()|r.ImGui_WindowFlags_NoResize() ) then - - if r.ImGui_Button(ctx, 'No') then DltClrTheme = false r.ImGui_CloseCurrentPopup(ctx) end - if r.ImGui_Button(ctx, 'Yes') then file:close() file:remove(file_path) DltClrTheme=false end - r.ImGui_EndPopup(ctx) - end - end ]] - - local export = function(enumName, funcSuffix, curTable, refTable, isEqual, formatValue) - local lines, name_maxlen = {}, 0 - for i, name in demo.EachEnum(enumName) do - if not app.style_editor.output_only_modified or not isEqual(curTable[i], refTable[i]) then - table.insert(lines, { name, curTable[i] }) - name_maxlen = math.max(name_maxlen, name:len()) - end - end - - if app.style_editor.output_dest == 0 then - r.ImGui_LogToClipboard(ctx) - else - r.ImGui_LogToTTY(ctx) - end - for _, line in ipairs(lines) do - local pad = string.rep('\x20', name_maxlen - line[1]:len()) - r.ImGui_LogText(ctx, ('reaper.ImGui_Push%s(ctx, reaper.ImGui_%s_%s(),%s %s)\n') - :format(funcSuffix, enumName, line[1], pad, formatValue(line[2]))) - end - if #lines == 1 then - r.ImGui_LogText(ctx, ('\nreaper.ImGui_Pop%s(ctx)\n'):format(funcSuffix)) - elseif #lines > 1 then - r.ImGui_LogText(ctx, ('\nreaper.ImGui_Pop%s(ctx, %d)\n'):format(funcSuffix, #lines)) - end - r.ImGui_LogFinish(ctx) - end - - --[[ if r.ImGui_Button(ctx, 'Export Vars') then - --- for enum - export('StyleVar', 'StyleVar', app.style_editor.style.vars, app.style_editor.ref.vars, - function(a, b) if type(a) == 'table' then return a[1] == b[1] and a[2] == b[2] else return a == b end end, - function(val) if type(val) == 'table' then return ('%g, %g'):format(table.unpack(val)) else return ('%g'):format(val) end end) - end - r.ImGui_SameLine(ctx) ]] - if r.ImGui_Button(ctx, 'Export Colors') then - -- for each enum - local file = CallFile('w', 'ThemeColors.ini') - - if file then - --[[ for i, name in demo.EachEnum('Col') do - if r.ImGui_TextFilter_PassFilter(app.style_editor.colors.filter.inst, name) then - file:write(name, ' - ', r.ImGui_GetStyleColor(ctx, )'\n') - end - end ]] - - for i, value in pairs(app.style_editor.style.colors) do - --[[ if i == 0 then - file:write(55, ' = ', r.ImGui_GetStyleColor(ctx,r.ImGui_Col_ModalWindowDimBg() ),'\n') - elseif i > 0 then - file:write(i, ' = ', app.style_editor.style.colors[i-1],'\n') - end ]] - end - --[[ for i, name in demo.EachEnum('Col') do - file:write(name..' = '.. r.ImGui_GetStyleColor(ctx,r.ImGui_Col_ModalWindowDimBg() )) - end ]] - - - - - - for i, v in pairs(CustomColors) do - file:write(v, ' = ', _G[v], '\n') - end - end - --[[ export('Col', 'StyleColor', app.style_editor.style.colors, app.style_editor.ref.colors, ]] - --[[ function(a, b) return a == b end, function(val) return ('0x%08X'):format(val & 0xffffffff) end) ]] - end - - - - - - - - - r.ImGui_Separator(ctx) - - --if r.ImGui_BeginTabBar(ctx, '##tabs', r.ImGui_TabBarFlags_None()) then - --[[ if r.ImGui_BeginTabItem(ctx, 'Sizes') then - local slider = function(varname, min, max, format) - local func = r['ImGui_StyleVar_' .. varname] - assert(func, ('%s is not exposed as a StyleVar'):format(varname)) - local var = func() - if type(app.style_editor.style.vars[var]) == 'table' then - local rv,val1,val2 = r.ImGui_SliderDouble2(ctx, varname, app.style_editor.style.vars[var][1], app.style_editor.style.vars[var][2], min, max, format) - if rv then app.style_editor.style.vars[var] = { val1, val2 } end - else - local rv,val = r.ImGui_SliderDouble(ctx, varname, app.style_editor.style.vars[var], min, max, format) - if rv then app.style_editor.style.vars[var] = val end - end - end - - r.ImGui_Text(ctx, 'Main') - slider('WindowPadding', 0.0, 20.0, '%.0f') - slider('FramePadding', 0.0, 20.0, '%.0f') - slider('CellPadding', 0.0, 20.0, '%.0f') - slider('ItemSpacing', 0.0, 20.0, '%.0f') - slider('ItemInnerSpacing', 0.0, 20.0, '%.0f') - -- slider('TouchExtraPadding', 0.0, 10.0, '%.0f') - slider('IndentSpacing', 0.0, 30.0, '%.0f') - slider('ScrollbarSize', 1.0, 20.0, '%.0f') - slider('GrabMinSize', 1.0, 20.0, '%.0f') - r.ImGui_Text(ctx, 'Borders') - slider('WindowBorderSize', 0.0, 1.0, '%.0f') - slider('ChildBorderSize', 0.0, 1.0, '%.0f') - slider('PopupBorderSize', 0.0, 1.0, '%.0f') - slider('FrameBorderSize', 0.0, 1.0, '%.0f') - -- slider('TabBorderSize', 0.0, 1.0, '%.0f') - r.ImGui_Text(ctx, 'Rounding') - slider('WindowRounding', 0.0, 12.0, '%.0f') - slider('ChildRounding', 0.0, 12.0, '%.0f') - slider('FrameRounding', 0.0, 12.0, '%.0f') - slider('PopupRounding', 0.0, 12.0, '%.0f') - slider('ScrollbarRounding', 0.0, 12.0, '%.0f') - slider('GrabRounding', 0.0, 12.0, '%.0f') - -- slider('LogSliderDeadzone', 0.0, 12.0, '%.0f') - slider('TabRounding', 0.0, 12.0, '%.0f') - r.ImGui_Text(ctx, 'Alignment') - slider('WindowTitleAlign', 0.0, 1.0, '%.2f') - -- int window_menu_button_position = app.style_editor.style.WindowMenuButtonPosition + 1 - -- if (ctx, r.ImGui_Combo(ctx, 'WindowMenuButtonPosition', (ctx, int*)&window_menu_button_position, "None\0Left\0Right\0")) - -- app.style_editor.style.WindowMenuButtonPosition = window_menu_button_position - 1 - -- r.ImGui_Combo(ctx, 'ColorButtonPosition', (ctx, int*)&app.style_editor.style.ColorButtonPosition, "Left\0Right\0") - slider('ButtonTextAlign', 0.0, 1.0, '%.2f') - r.ImGui_SameLine(ctx); demo.HelpMarker('Alignment applies when a button is larger than its text content.') - slider('SelectableTextAlign', 0.0, 1.0, '%.2f') - r.ImGui_SameLine(ctx); demo.HelpMarker('Alignment applies when a selectable is larger than its text content.') - -- r.ImGui_Text(ctx, 'Safe Area Padding') - -- r.ImGui_SameLine(ctx); demo.HelpMarker('Adjust if you cannot see the edges of your screen (ctx, e.g. on a TV where scaling has not been configured).') - -- slider('DisplaySafeAreaPadding', 0.0, 30.0, '%.0f') - r.ImGui_EndTabItem(ctx) - end ]] - - --[[ if r.ImGui_BeginTabItem(ctx, 'Colors') then ]] - if not app.style_editor.colors then - app.style_editor.colors = { - filter = { inst = nil, text = '' }, - alpha_flags = r.ImGui_ColorEditFlags_AlphaPreviewHalf(), - } - end - - - - - - -- the filter object is destroyed once unused for one or more frames - if not r.ImGui_ValidatePtr(app.style_editor.colors.filter.inst, 'ImGui_TextFilter*') then - app.style_editor.colors.filter.inst = r.ImGui_CreateTextFilter(app.style_editor.colors.filter.text) - end - - if r.ImGui_TextFilter_Draw(app.style_editor.colors.filter.inst, ctx, 'Filter colors', r.ImGui_GetFontSize(ctx) * 16) then - app.style_editor.colors.filter.text = r.ImGui_TextFilter_Get(app.style_editor.colors.filter.inst) - end - - if r.ImGui_RadioButton(ctx, 'Opaque', app.style_editor.colors.alpha_flags == r.ImGui_ColorEditFlags_None()) then - app.style_editor.colors.alpha_flags = r.ImGui_ColorEditFlags_None() - end - r.ImGui_SameLine(ctx) - if r.ImGui_RadioButton(ctx, 'Alpha', app.style_editor.colors.alpha_flags == r.ImGui_ColorEditFlags_AlphaPreview()) then - app.style_editor.colors.alpha_flags = r.ImGui_ColorEditFlags_AlphaPreview() - end - r.ImGui_SameLine(ctx) - if r.ImGui_RadioButton(ctx, 'Both', app.style_editor.colors.alpha_flags == r.ImGui_ColorEditFlags_AlphaPreviewHalf()) then - app.style_editor.colors.alpha_flags = r.ImGui_ColorEditFlags_AlphaPreviewHalf() - end - r.ImGui_SameLine(ctx) - demo.HelpMarker( - 'In the color list:\n\z - Left-click on color square to open color picker,\n\z - Right-click to open edit options menu.') - - if r.ImGui_BeginChild(ctx, '##colors', 0, 0, true, - r.ImGui_WindowFlags_AlwaysVerticalScrollbar() | - - -- r.ImGui_WindowFlags_NavFlattened()) TODO: BETA/INTERNAL, not exposed yet - 0) then - r.ImGui_PushItemWidth(ctx, -160) - local inner_spacing = r.ImGui_GetStyleVar(ctx, r.ImGui_StyleVar_ItemInnerSpacing()) - - -- @todo add custom colors here - function addClr(str) - rv, _G[str] = r.ImGui_ColorEdit4(ctx, '##' .. str, _G[str], - r.ImGui_ColorEditFlags_AlphaBar() | app.style_editor.colors.alpha_flags) - r.ImGui_SameLine(ctx, 0.0, inner_spacing) - r.ImGui_Text(ctx, str) - end - - r.ImGui_Text(ctx, 'Specific Colors') - AddSpacing(2) - - for i, v in pairs(CustomColors) do - if r.ImGui_TextFilter_PassFilter(app.style_editor.colors.filter.inst, v) then - rv, _G[v] = r.ImGui_ColorEdit4(ctx, '##' .. v, _G[v] or CustomColorsDefault[v], - r.ImGui_ColorEditFlags_AlphaBar() | app.style_editor.colors.alpha_flags) - r.ImGui_SameLine(ctx, 0.0, inner_spacing) - local name = string.gsub(v, '_', ' ') - r.ImGui_Text(ctx, name) - end - end - - - - - --[[ for i, name in demo.EachEnum('Col') do - if r.ImGui_TextFilter_PassFilter(app.style_editor.colors.filter.inst, name) then - r.ImGui_PushID(ctx, i) - rv, app.style_editor.style.colors[i] = r.ImGui_ColorEdit4(ctx, '##color', app.style_editor.style.colors[i], r.ImGui_ColorEditFlags_AlphaBar() | app.style_editor.colors.alpha_flags) - if app.style_editor.style.colors[i] ~= app.style_editor.ref.colors[i] then - -- Tips: in a real user application, you may want to merge and use an icon font into the main font, - -- so instead of "Save"/"Revert" you'd use icons! - -- Read the FAQ and docs/FONTS.md about using icon fonts. It's really easy and super convenient! - r.ImGui_SameLine(ctx, 0.0, inner_spacing) - if r.ImGui_Button(ctx, 'Save') then - app.style_editor.ref.colors[i] = app.style_editor.style.colors[i] - end - r.ImGui_SameLine(ctx, 0.0, inner_spacing) - if r.ImGui_Button(ctx, 'Revert') then - app.style_editor.style.colors[i] = app.style_editor.ref.colors[i] - end - end - r.ImGui_SameLine(ctx, 0.0, inner_spacing) - r.ImGui_Text(ctx, name) - r.ImGui_PopID(ctx) - end - end ]] - - - - - - r.ImGui_PopItemWidth(ctx) - r.ImGui_EndChild(ctx) - end - - --r.ImGui_EndTabItem(ctx) - --[[ end ]] - - - - --r.ImGui_EndTabBar(ctx) - --end - - r.ImGui_PopItemWidth(ctx) - r.ImGui_End(ctx) - else - styleEditorIsOpen = false - end - end - - function Show_KBShortcutEditor() - local rv - - if not ctx then ctx = r.ImGui_CreateContext('Shortcut Editor') end - if not KBEditorIsOpen then r.ImGui_SetNextWindowSize(ctx, 500, 800) end - open, OpenKBEditor = r.ImGui_Begin(ctx, 'FX Devices Shortcut Editor', OpenKBEditor, - r.ImGui_WindowFlags_NoCollapse() + - r.ImGui_WindowFlags_NoDocking() --[[ +r.ImGui_WindowFlags_AlwaysAutoResize() ]]) - - - if open then - KBEditorIsOpen = true - --[[ rv = r.ImGui_BeginTable(ctx, 'Keyboard Shortcut Table', 1 ,nil , outer_size_w , outer_size_h, inner_width ) - r.ImGui_Text(ctx, 'adfafd') - r.ImGui_EndTable(ctx) ]] - - local HoverKeyTime = HoverKeyTime or 0 - - if r.ImGui_Button(ctx, '+') then - local x, y = r.ImGui_GetWindowPos(ctx) - local w, h = r.ImGui_GetWindowSize(ctx) - - r.ImGui_SetNextWindowPos(ctx, x + w / 3.5, y + h / 2) - r.ImGui_OpenPopup(ctx, '##Type Key Popup') - end - SL() - - if r.ImGui_Button(ctx, 'Save') then - local file = CallFile('w', 'Keyboard Shortcuts.ini') - for i, v in pairs(KB_Shortcut) do - file:write(v, ' = ', Command_ID[i], '\n') - end - end - - - SL() - MyText('(?)', nil, 0xffffff66) - if r.ImGui_IsItemHovered(ctx) then - HintToolTip( - 'Start by click on the + and entering a key or key combination \nLeft click on a shortcut key to swap assigned actions \nAlt+Left click to remove shortcut') - end - - - if r.ImGui_BeginPopupModal(ctx, '##Type Key Popup', nil, r.ImGui_WindowFlags_NoTitleBar()|r.ImGui_WindowFlags_AlwaysAutoResize()) then - r.ImGui_Text(ctx, 'Type Key or mouse-click to cancel') - - for i, v in pairs(AllAvailableKeys) do - if r.ImGui_IsKeyPressed(ctx, v) then - local function GetFinalTxt(i) - local txt - if Mods == 0 then - txt = i - elseif Mods == Alt then - txt = 'Alt + ' .. i - elseif Mods == Ctrl then - txt = 'Ctrl + ' .. i - elseif Mods == Shift then - txt = 'Shift + ' .. i - elseif Mods == Apl then - txt = 'Cmd + ' .. i - elseif Mods == Alt + Ctrl then - txt = 'Alt + Ctrl + ' .. i - elseif Mods == Ctrl + Shift then - txt = 'Ctrl + Shift + ' .. i - elseif Mods == Alt + Shift then - txt = 'Alt + Shift + ' .. i - elseif Mods == Alt + Apl then - txt = 'Alt + Cmd + ' .. i - elseif Mods == Shift + Apl then - txt = 'Shift + Cmd + ' .. i - elseif Mods == Ctrl + Apl then - txt = 'Ctrl + Cmd' .. i - end - return txt - end - - if ShortCutKeyToSwitch then - if not tablefind(KB_Shortcut, GetFinalTxt(i)) then - KB_Shortcut[ShortCutKeyIndex] = GetFinalTxt(i) - end - - AlreadyAddedKey = GetFinalTxt(i) - - ShortCutKeyToSwitch = nil - ShortCutKeyIndex = nil - elseif not tablefind(KB_Shortcut, GetFinalTxt(i)) then - table.insert(KB_Shortcut, GetFinalTxt(i)) - end - - - - r.ImGui_CloseCurrentPopup(ctx) - end - end - - if r.ImGui_IsMouseClicked(ctx, 0) then - r.ImGui_CloseCurrentPopup(ctx) - end - - r.ImGui_EndPopup(ctx) - end - - - for i, v in ipairs(KB_Shortcut) do - if r.ImGui_Button(ctx, v) then - ShortCutKeyToSwitch = v - ShortCutKeyIndex = i - r.ImGui_OpenPopup(ctx, '##Type Key Popup') - end - - if r.ImGui_IsItemClicked(ctx) and Mods == Alt then - table.remove(KB_Shortcut, i) - end - - - if AlreadyAddedKey == v then - r.ImGui_SetScrollHereY(ctx) - _, stop = BlinkItem(0.3, 3.5) - if stop == 'Stop' then AlreadyAddedKey = nil end - end - - SL() - r.ImGui_Text(ctx, ' : ') - SL() - local CmdTxt, commandID - - - if Command_ID[i] then - commandID = r.NamedCommandLookup(Command_ID[i]) - CmdTxt = r.CF_GetCommandText(0, commandID) - end - if CmtTxt == '' then CmdTxt = nil end - - if r.ImGui_Button(ctx, (CmdTxt or ' Click to Paste Command ID') .. '##' .. i) then - Command_ID[i] = r.ImGui_GetClipboardText(ctx) - end - - if AlreadyAddedKey == v then - _, stop = BlinkItem(0.3, 3.5) - end - - - - --rv, Command_ID[i] = r.ImGui_InputText(ctx, '##'..i , Command_ID[i] or 'Paste Command ID Here...', r.ImGui_InputTextFlags_AutoSelectAll()) - - r.ImGui_Separator(ctx) - end - - - - - - - - r.ImGui_End(ctx) - else - KBEditorIsOpen = false - end - end -end - - -local os = r.GetOS() - -function GetFileContext(fp) - local str = "\n" - -- RETURN ANY STRING JUST FOR SCRIPT NOT TO CRASH IF PATH DOES NOT EXIST - if not fp then return str end - local f = io.open(fp, 'r') - if f then - str = f:read('a') - f:close() - end - return str -end - -local CAT = {} -local LAST_USED_FX - -function FindFXIDName(tbl, id, js) - for i = 1, #tbl do - if js then - -- JS PLUGINS CAN HAVE ONLY PART OF IDENTIFIER IN THE STRING - if tbl[i].id:find(id) then return tbl[i].name end - else - if tbl[i].id == id then return tbl[i].name end - end - end -end - -function InTbl(tbl, val) - for i = 1, #tbl do - if tbl[i].name == val then return tbl[i].fx end - end -end - -local os_separator = package.config:sub(1, 1) -local function GetDirFilesRecursive(dir, tbl) - for index = 0, math.huge do - local path = r.EnumerateSubdirectories(dir, index) - if not path then break end - tbl[#tbl + 1] = { dir = path, {} } - GetDirFilesRecursive(dir .. os_separator .. path, tbl[#tbl]) - end - - for index = 0, math.huge do - local file = r.EnumerateFiles(dir, index) - if not file then break end - tbl[#tbl + 1] = file - end -end - -local function ParseVST(plugin_list, INSTRUMENTS) - local VST_INFO = {} - local VST = {} - local VSTi = {} - local VST3 = {} - local VST3i = {} - local rename_tbl = {} - - local vst_path - local vst_str - - if os == "Win32" or os == "OSX32" then - vst_path = r.GetResourcePath() .. "/reaper-vstplugins.ini" - elseif os == "Win64" or os == "OSX64" or os == "Other" then - vst_path = r.GetResourcePath() .. "/reaper-vstplugins64.ini" - elseif os == "macOS-arm64" then - vst_path = r.GetResourcePath() .. "/reaper-vstplugins_arm64.ini" - end - - local vst_rename_path - - if os == "Win32" or os == "OSX32" then - vst_rename_path = r.GetResourcePath() .. "/reaper-vstrenames.ini" - elseif os == "Win64" or os == "OSX64" or os == "Other" then - vst_rename_path = r.GetResourcePath() .. "reaper-vstrenames64.ini" - elseif os == "macOS-arm64" then - vst_rename_path = r.GetResourcePath() .. "/reaper-vstpluginsrenames_arm64.ini" - end - - if vst_rename_path then - local vst_rename_str = GetFileContext(vst_rename_path) - for line in vst_rename_str:gmatch('[^\r\n]+') do - rename_tbl[#rename_tbl + 1] = line - end - end - - vst_str = GetFileContext(vst_path) - - for line in vst_str:gmatch('[^\r\n]+') do - -- reacast.dll=00EE7DC39FE1D901,1919246691,ReaCast (Cockos) - -- MATCH EVERY FIELD SEPARATED BY '=' AND ',' - local dll, id1, id2, name = line:match('(.-)=(.-),(.-),(.+)') - if name and name ~= "" then - local instrument = name:match("!!!VSTi") - name = name:gsub("!!!VSTi", "") - for i = 1, #rename_tbl do - local new_id, new_name = rename_tbl[i]:match("(.+)=(.+)") - if new_id == dll then - name = new_name - end - end - -- VST3 - if dll:match("vst3") then - local vst3_name = "VST3:" .. name - VST_INFO[#VST_INFO + 1] = { id = dll, name = vst3_name } - plugin_list[#plugin_list + 1] = vst3_name - VST3[#VST3 + 1] = vst3_name - -- VST3i - if instrument then - VST3i[#VST3i + 1] = vst3_name - INSTRUMENTS[#INSTRUMENTS + 1] = vst3_name - end - else - local vst_name = "VST:" .. name - -- VST - VST_INFO[#VST_INFO + 1] = { id = dll, name = vst_name } - plugin_list[#plugin_list + 1] = vst_name - VST[#VST + 1] = vst_name - -- VSTi - if instrument then - VSTi[#VSTi + 1] = vst_name - INSTRUMENTS[#INSTRUMENTS + 1] = vst_name - end - end - end - end - return VST_INFO, VST, VSTi, VST3, VST3i -end - -local function ParseJSFX(plugin_list) - local JS_INFO = {} - local JS = {} - - local jsfx_path = r.GetResourcePath() .. "/reaper-jsfx.ini" - local jsfx_str = GetFileContext(jsfx_path) - - for line in jsfx_str:gmatch('[^\r\n]+') do - local js_name - if line:match("NAME") then - -- NAME utility/volume "JS: Volume Adjustment" - -- NAME "ReaTeam Scripts/FX/BryanChi_FX Devices/cookdsp/fft-mono-template" "JS: FFT Mono Template" - local id, name = line:match('%w+ ["]?(.+)["]? "JS: (.+)"') - if name then - js_name = "JS:" .. name - JS_INFO[#JS_INFO + 1] = { id = id:gsub('"', ''), name = js_name } - end - end - if js_name then - plugin_list[#plugin_list + 1] = js_name - JS[#JS + 1] = js_name - end - end - return JS_INFO, JS -end - -local function ParseAU(plugin_list, INSTRUMENTS) - local AU_INFO = {} - local AU = {} - local AUi = {} - - local au_path - local au_str - - if os == "OSX32" then - au_path = r.GetResourcePath() .. "/reaper-auplugins.ini" - elseif os == "OSX64" then - au_path = r.GetResourcePath() .. "/reaper-auplugins64.ini" - elseif os == "macOS-arm64" then - au_path = r.GetResourcePath() .. "/reaper-auplugins_arm64.ini" - end - - au_str = GetFileContext(au_path) - - for line in au_str:gmatch('[^\r\n]+') do - local identifier = line:match("(.+)=<") - if identifier then - local renamed = line:match("=<.+>(.+)") - local is_instrument = line:match("") - local au_name = "AU:" .. (renamed and renamed or identifier) - AU[#AU + 1] = au_name - AU_INFO[#AU_INFO + 1] = { id = identifier, name = au_name } - if is_instrument then - AUi[#AUi + 1] = au_name - INSTRUMENTS[#INSTRUMENTS + 1] = au_name - end - plugin_list[#plugin_list + 1] = au_name - end - end - - return AU_INFO, AU, AUi -end - -local function ParseCLAP(plugin_list, INSTRUMENTS) - local CLAP_INFO = {} - local CLAP = {} - local CLAPi = {} - - local rename_tbl = {} - - local clap_path - local clap_str - - if os == "Win64" then - clap_path = r.GetResourcePath() .. "/reaper-clap-win64.ini" - elseif os == 'OSX64' then - clap_path = r.GetResourcePath() .. "/reaper-clap-macos-x86_64.ini" - elseif os == "macOS-arm64" then - clap_path = r.GetResourcePath() .. "/reaper-clap-macos-arm64.ini" - end - - clap_str = GetFileContext(clap_path) - - local clap_rename_path - if os == "Win64" then - clap_rename_path = r.GetResourcePath() .. "/reaper-clap-rename-win64.ini" - elseif os == 'OSX64' then - clap_rename_path = r.GetResourcePath() .. "/reaper-clap-rename-macos-x86_64.ini" - elseif os == "macOS-arm64" then - clap_rename_path = r.GetResourcePath() .. "/reaper-clap-rename-macos-arm64.ini" - end - - if clap_rename_path then - local clap_rename_str = GetFileContext(clap_rename_path) - for line in clap_rename_str:gmatch('[^\r\n]+') do - rename_tbl[#rename_tbl + 1] = line - end - end - - for line in clap_str:gmatch('[^\r\n]+') do - --org.surge-synth-team.surge-xt-fx=0|Surge XT Effects (Surge Synth Team) - -- SKIP SOME ID/GUID LINE "_=00E3FA30507FD901FD9E7AF993E4D901" - if not line:match("_=") then - -- GET STRINGS BETWEEN "=0|" - local id, name = line:match("(.+)=%d+|(.+)") - if name then - -- MATCH "fx=0|" - local is_instrument = line:match("=1|") - local clap_name = "CLAP:" .. name - -- CHECK IF PLUGIN IS RENAMED - for i = 1, #rename_tbl do - local new_id, new_name = rename_tbl[i]:match("(.+)=%d+|(.+)") - if new_id == id then - clap_name = "CLAP:" .. new_name - end - end - CLAP_INFO[#CLAP_INFO + 1] = { id = id, name = clap_name } - CLAP[#CLAP + 1] = clap_name - if is_instrument then - CLAPi[#CLAPi + 1] = clap_name - INSTRUMENTS[#INSTRUMENTS + 1] = clap_name - end - plugin_list[#plugin_list + 1] = clap_name - end - end - end - return CLAP_INFO, CLAP, CLAPi -end - -local function ParseLV2(plugin_list) - local LV2_INFO = {} - local LV2 = {} - local LV2i = {} - local LV2_files = {} - - local lv2_path - if os == "Win32" or os == "Win64" then - lv2_path = "C:/Program Files/Common Files/LV2/" - elseif os == "OSX32" or os == "OSX64" or os == "macOS-arm64" then - lv2_path = "/Library/Audio/Plug-Ins/LV2/" - elseif os == "Other" then - lv2_path = "/usr/local/lib/lv2/" - end - - GetDirFilesRecursive(lv2_path, LV2_files, "LV2") - - for i = 1, #LV2_files do - local plugin_path = lv2_path .. LV2_files[i] .. os_separator - local dll_info = GetFileContext(plugin_path .. LV2_files[i]:gsub(".lv2", ".ttl")) - local is_instrument - local identifier - --local mono_stereo - local file_name = LV2_files[i]:gsub(".lv2", "") - for line in dll_info:gmatch('[^\r\n]+') do - --@prefix fil4: - if not identifier then identifier = line:match('@prefix .+<(.+' .. file_name .. '#)>') end - if not is_instrument then is_instrument = line:match("InstrumentPlugin") end - --if not mono_stereo then - -- mono_stereo = line:match(file_name .. ':(mono)') - -- mono_stereo = mono_stereo and mono_stereo or line:match(file_name .. ':(stereo)') - -- end - - local lv2_name = line:match('doap:name "(.+)"') - if lv2_name then - --local lv2_id = mono_stereo and identifier .. mono_stereo or identifier:gsub("#", '') - local lv2_id = identifier:gsub("#", '') - - LV2_INFO[#LV2_INFO + 1] = { id = lv2_id, name = lv2_name } - LV2[#LV2 + 1] = lv2_name - plugin_list[#plugin_list + 1] = lv2_name - if is_instrument then LV2i[#LV2i + 1] = lv2_name end - --if mono_stereo then mono_stereo = nil end - end - end - end - return LV2_INFO, LV2, LV2i -end - -local function ParseFXTags(VST_INFO, JS_INFO, AU_INFO, CLAP_INFO) - -- PARSE CATEGORIES - local tags_path = r.GetResourcePath() .. "/reaper-fxtags.ini" - local tags_str = GetFileContext(tags_path) - - for line in tags_str:gmatch('[^\r\n]+') do - local category = line:match("%[(.+)%]") - -- CATEGORY FOUND - if category then - CAT[#CAT + 1] = { name = category:upper(), list = {} } - end - -- PLUGIN FOUND - local FX, dev_category = line:match("(.+)=(.+)") - if dev_category then - local fx_name = FindFXIDName(VST_INFO, FX) - fx_name = fx_name and fx_name or FindFXIDName(AU_INFO, FX) - fx_name = fx_name and fx_name or FindFXIDName(CLAP_INFO, FX) - fx_name = fx_name and fx_name or FindFXIDName(JS_INFO, FX, "JS") - --fx_name = fx_name and fx_name or FindFXIDName(LV2_INFO, FX, "JS") - -- IF MULTIPLE CATEGORIES SPLIT AT | - if dev_category:match("|") then - for category_type in dev_category:gmatch('[^%|]+') do - -- TRIM LEADING AND TRAILING WHITESPACES - local dev_tbl = InTbl(CAT[#CAT].list, category_type) - if fx_name then - -- ADD CATEGORY ONLY IF PLUGIN EXISTS - if not dev_tbl then - table.insert(CAT[#CAT].list, { name = category_type, fx = { fx_name } }) - else - table.insert(dev_tbl, fx_name) - end - end - end - else - -- ADD SINGLE CATEGORY - local dev_tbl = InTbl(CAT[#CAT].list, dev_category) - if fx_name then - -- ADD CATEGORY ONLY IF PLUGIN EXISTS - if not dev_tbl then - table.insert(CAT[#CAT].list, { name = dev_category, fx = { fx_name } }) - else - table.insert(dev_tbl, fx_name) - end - end - end - end - end -end - -local function FindCategory(cat) - for i = 1, #CAT do - if CAT[i].name == cat then return CAT[i].list end - end -end - -local function ParseCustomCategories(VST_INFO, JS_INFO, AU_INFO, CLAP_INFO) - local fav_path = r.GetResourcePath() .. "/reaper-fxfolders.ini" - local fav_str = GetFileContext(fav_path) - local cur_cat_tbl - - for line in fav_str:gmatch('[^\r\n]+') do - local category = line:match("%[(.+)%]") - if category then - if category == "category" then - cur_cat_tbl = FindCategory(category:upper()) - elseif category == "developer" then - cur_cat_tbl = FindCategory(category:upper()) - else - cur_cat_tbl = nil - end - end - - if cur_cat_tbl then - local FX, categories = line:match("(.+)=(.+)") - if categories then - local fx_name = FindFXIDName(VST_INFO, FX) - fx_name = fx_name and fx_name or FindFXIDName(AU_INFO, FX) - fx_name = fx_name and fx_name or FindFXIDName(CLAP_INFO, FX) - fx_name = fx_name and fx_name or FindFXIDName(JS_INFO, FX, "JS") - --fx_name = fx_name and fx_name or FindFXIDName(LV2_INFO, FX, "JS") - if categories:match("|") then - for category_type in categories:gmatch('[^%|]+') do - local dev_tbl = InTbl(cur_cat_tbl, category_type) - if fx_name then - -- ADD CATEGORY ONLY IF PLUGIN EXISTS - if not dev_tbl then - table.insert(cur_cat_tbl, { name = category_type, fx = { fx_name } }) - else - table.insert(dev_tbl, fx_name) - end - end - end - else - local dev_tbl = InTbl(cur_cat_tbl, categories) - if fx_name then - -- ADD CATEGORY ONLY IF PLUGIN EXISTS - if not dev_tbl then - table.insert(cur_cat_tbl, { name = categories, fx = { fx_name } }) - else - table.insert(dev_tbl, fx_name) - end - end - end - end - end - end -end - -local function ParseFavorites(VST_INFO, JS_INFO, AU_INFO, CLAP_INFO) - -- PARSE FAVORITES FOLDER - local fav_path = r.GetResourcePath() .. "/reaper-fxfolders.ini" - local fav_str = GetFileContext(fav_path) - - CAT[#CAT + 1] = { name = "FOLDERS", list = {} } - local current_folder - local folder_lvl - for line in fav_str:gmatch('[^\r\n]+') do - local folder = line:match("%[(Folder%d+)%]") - - -- GET INITIAL FOLDER NAME "[Folder0]" AND SAVE IF - if folder then - --folder_lvl = line:match("%d+") + 1 - current_folder = folder - end - - -- GET FOLDER ITEMS "Item0=..." - if line:match("Item%d+") then - local item = line:match("Item%d+=(.+)") - local dev_tbl = InTbl(CAT[#CAT].list, current_folder) - if not dev_tbl then - table.insert(CAT[#CAT].list, { name = current_folder, fx = { item } }) - else - table.insert(dev_tbl, item) - end - end - - -- RENAME ITEMS BY TYPE TO REAL NAMES "Type0=2" - -- 3 = VST, 2 = JS, 7 = CLAP, 1 = LV2 - if line:match("Type%d+") then - local line_id, fx_type = line:match("(%d+)=(%d+)") - if fx_type == "3" then -- VST - local item = CAT[#CAT].list[#CAT[#CAT].list].fx[line_id + 1] - if item then - local id = os:match("Win") and item:reverse():match("(.-)\\") or item:reverse():match("(.-)/") - if id then - -- NEED TO REPLACE WHITESPACES AND DASH WITH LOWER DASH ALSO (HOW ITS IN VST INI FILE) - id = id:reverse():gsub(" ", "_"):gsub("-", "_") - CAT[#CAT].list[#CAT[#CAT].list].fx[line_id + 1] = FindFXIDName(VST_INFO, id) - end - end - elseif fx_type == "2" then --JSFX - local item = CAT[#CAT].list[#CAT[#CAT].list].fx[line_id + 1] - CAT[#CAT].list[#CAT[#CAT].list].fx[line_id + 1] = FindFXIDName(JS_INFO, item) - elseif fx_type == "7" then -- CLAP - local item = CAT[#CAT].list[#CAT[#CAT].list].fx[line_id + 1] - CAT[#CAT].list[#CAT[#CAT].list].fx[line_id + 1] = FindFXIDName(CLAP_INFO, item) - elseif fx_type == "1" then -- LV2 - --local item = CAT[#CAT].list[#CAT[#CAT].list].fx[line_id + 1] - --CAT[#CAT].list[#CAT[#CAT].list].fx[line_id + 1] = FindFXIDName(LV2_INFO, item) - elseif fx_type == "5" then -- AU - local item = CAT[#CAT].list[#CAT[#CAT].list].fx[line_id + 1] - CAT[#CAT].list[#CAT[#CAT].list].fx[line_id + 1] = FindFXIDName(AU_INFO, item) - elseif fx_type == "1048576" then -- SMART FOLDER - CAT[#CAT].list[#CAT[#CAT].list].smart = true - end - end - -- RENAME ORIGINAL FOLDER NAME "[Folder0]" TO PROPER ID NAME (Name0=Favorites) - if line:match("Name%d+=(.+)") then - -- EXTRACT NAME - local folder_name = line:match("Name%d+=(.+)") - local folder_ID = line:match("(%d+)=") - - for i = 1, #CAT[#CAT].list do - if CAT[#CAT].list[i].name == "Folder" .. folder_ID then - CAT[#CAT].list[i].name = folder_name - end - end - -- EXTRACT TBL ID - -- RENAME TARGET TBL NAME FROM "Folder0" -> "Favorites" ONLY IF HAS ITEMS - -- if CAT[#CAT].list[folder_ID] then - -- CAT[#CAT].list[folder_ID].name = folder_name - --end - end - end - -- REMOVE SMART FOLDERS FOR NOW - for i = 1, #CAT do - for j = #CAT[i].list, 1, -1 do - if CAT[i].list[j].smart then table.remove(CAT[i].list, j) end - end - end -end - -local function ParseFXChains() - local fxChainsFolder = r.GetResourcePath() .. "/FXChains" - local FX_CHAINS = {} - GetDirFilesRecursive(fxChainsFolder, FX_CHAINS) - if #FX_CHAINS ~= 0 then - --table.sort(FX_CHAINS, function(a, b) if a and b then return a:lower() < b:lower() end end) - CAT[#CAT + 1] = { name = "FX CHAINS", list = FX_CHAINS } - end -end - -local function AllPluginsCategory(JS, AU, AUi, CLAP, CLAPi, VST, VSTi, VST3, VST3i, INSTRUMENTS) - CAT[#CAT + 1] = { name = "ALL PLUGINS", list = {} } - if #JS ~= 0 then table.insert(CAT[#CAT].list, { name = "JS", fx = JS }) end - if #AU ~= 0 then table.insert(CAT[#CAT].list, { name = "AU", fx = AU }) end - if #AUi ~= 0 then table.insert(CAT[#CAT].list, { name = "AUi", fx = AUi }) end - if #CLAP ~= 0 then table.insert(CAT[#CAT].list, { name = "CLAP", fx = CLAP }) end - if #CLAPi ~= 0 then table.insert(CAT[#CAT].list, { name = "CLAPi", fx = CLAPi }) end - if #VST ~= 0 then table.insert(CAT[#CAT].list, { name = "VST", fx = VST }) end - if #VSTi ~= 0 then table.insert(CAT[#CAT].list, { name = "VSTi", fx = VSTi }) end - if #VST3 ~= 0 then table.insert(CAT[#CAT].list, { name = "VST3", fx = VST3 }) end - if #VST3i ~= 0 then table.insert(CAT[#CAT].list, { name = "VST3i", fx = VST3i }) end - if #INSTRUMENTS ~= 0 then table.insert(CAT[#CAT].list, { name = "INSTRUMENTS", fx = INSTRUMENTS }) end - --if #LV2 ~= 0 then table.insert(CAT[#CAT].list, { name = "LV2", fx = LV2 }) end - --if #LV2i ~= 0 then table.insert(CAT[#CAT].list, { name = "LV2i", fx = LV2i }) end - - - -- SORT EVERYTHING ALPHABETICALLY - for i = 1, #CAT do - table.sort(CAT[i].list, function(a, b) if a.name and b.name then return a.name:lower() < b.name:lower() end end) - for j = 1, #CAT[i].list do - if CAT[i].list[j].fx then - table.sort(CAT[i].list[j].fx, function(a, b) if a and b then return a:lower() < b:lower() end end) - end - end - end - - table.sort(CAT, function(a, b) if a.name and b.name then return a.name:lower() < b.name:lower() end end) -end - -local function Fill_fx_list() - local plugin_list = {} - local INSTRUMENTS = {} - - plugin_list[#plugin_list + 1] = "Container" - plugin_list[#plugin_list + 1] = "Video processor" - - local VST_INFO, VST, VSTi, VST3, VST3i = ParseVST(plugin_list, INSTRUMENTS) - local JS_INFO, JS = ParseJSFX(plugin_list) - local AU_INFO, AU, AUi = ParseAU(plugin_list, INSTRUMENTS) - local CLAP_INFO, CLAP, CLAPi = ParseCLAP(plugin_list, INSTRUMENTS) - --local LV2_INFO, LV2, LV2i = ParseLV2(plugin_list) - ParseFXTags(VST_INFO, JS_INFO, AU_INFO, CLAP_INFO) -- CATEGORIES - ParseCustomCategories(VST_INFO, JS_INFO, AU_INFO, CLAP_INFO) - ParseFavorites(VST_INFO, JS_INFO, AU_INFO, CLAP_INFO) - ParseFXChains() - AllPluginsCategory(JS, AU, AUi, CLAP, CLAPi, VST, VSTi, VST3, VST3i, INSTRUMENTS) - - return plugin_list -end - -FX_LIST = Fill_fx_list() - --- EXAMPLE DRAW (NOTHING TO DO WITH PARSING ALL BELOOW) -local function Lead_Trim_ws(s) return s:match '^%s*(.*)' end - -local function Filter_actions(filter_text) - filter_text = Lead_Trim_ws(filter_text) - local t = {} - if filter_text == "" or not filter_text then return t end - for i = 1, #FX_LIST do - local action = FX_LIST[i] - local name = action:lower() - local found = true - for word in filter_text:gmatch("%S+") do - if not name:find(word:lower(), 1, true) then - found = false - break - end - end - - if found then t[#t + 1] = action end - end - return t -end - -local function SetMinMax(Input, Min, Max) - if Input >= Max then - Input = Max - elseif Input <= Min then - Input = Min - else - Input = Input - end - return Input -end - - -function FilterBox(FX_Idx, LyrID, SpaceIsBeforeRackMixer, FxGUID_Container, SpcIsInPre, SpcInPost, SpcIDinPost) - local FX_Idx_For_AddFX, close - if AddLastSPCinRack then FX_Idx_For_AddFX = FX_Idx - 1 end - local MAX_FX_SIZE = 250 - local FxGUID = FXGUID[FX_Idx_For_AddFX or FX_Idx] - r.ImGui_SetNextItemWidth(ctx, 180) - _, ADDFX_FILTER = r.ImGui_InputTextWithHint(ctx, '##input', "SEARCH FX", ADDFX_FILTER, r.ImGui_InputTextFlags_AutoSelectAll()) - - if r.ImGui_IsWindowAppearing(ctx) then - local tb = FX_LIST - r.ImGui_SetKeyboardFocusHere(ctx, -1) - end - - local filtered_fx = Filter_actions(ADDFX_FILTER) - --r.ImGui_SetNextWindowPos(ctx, r.ImGui_GetItemRectMin(ctx), ({ r.ImGui_GetItemRectMax(ctx) })[2]) - local filter_h = #filtered_fx == 0 and 2 or (#filtered_fx > 40 and 20 * 17 or (17 * #filtered_fx)) - local function InsertFX(Name) - local FX_Idx = FX_Idx - --- CLICK INSERT - if SpaceIsBeforeRackMixer == 'End of PreFX' then FX_Idx = FX_Idx + 1 end - - r.TrackFX_AddByName(LT_Track, Name, false, -1000 - FX_Idx) - - -- if Inserted into Layer - local FxID = r.TrackFX_GetFXGUID(LT_Track, FX_Idx) - - if FX.InLyr[FxGUID] == FXGUID_RackMixer and FX.InLyr[FxGUID] then - DropFXtoLayerNoMove(FXGUID_RackMixer, LyrID, FX_Idx) - end - if SpaceIsBeforeRackMixer == 'SpcInBS' then - DropFXintoBS(FxID, FxGUID_Container, FX[FxGUID_Container].Sel_Band, FX_Idx + 1, FX_Idx) - end - if SpcIsInPre then - local inspos = FX_Idx + 1 - if SpaceIsBeforeRackMixer == 'End of PreFX' then - table.insert(Trk[TrkID].PreFX, FxID) - else - table.insert(Trk[TrkID].PreFX, FX_Idx + 1, FxID) - end - for i, v in pairs(Trk[TrkID].PreFX) do - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: PreFX ' .. i, v, - true) - end - elseif SpcInPost then - if r.TrackFX_AddByName(LT_Track, 'FXD Macros', 0, 0) == -1 then offset = -1 else offset = 0 end - table.insert(Trk[TrkID].PostFX, SpcIDinPost + offset + 1, FxID) - -- InsertToPost_Src = FX_Idx + offset+2 - for i = 1, #Trk[TrkID].PostFX + 1, 1 do - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: PostFX ' .. i, Trk[TrkID].PostFX[i] or '', true) - end - end - - ADDFX_FILTER = nil - end - if ADDFX_FILTER ~= '' and ADDFX_FILTER then - SL() - r.ImGui_SetNextWindowSize(ctx, MAX_FX_SIZE, filter_h + 20) - local x, y = r.ImGui_GetCursorScreenPos(ctx) - - ParentWinPos_x, ParentWinPos_y = r.ImGui_GetWindowPos(ctx) - local VP_R = VP.X + VP.w - if x + MAX_FX_SIZE > VP_R then x = ParentWinPos_x - MAX_FX_SIZE end - - r.ImGui_SetNextWindowPos(ctx, x, y - filter_h / 2) - if r.ImGui_BeginPopup(ctx, "##popupp", r.ImGui_WindowFlags_NoFocusOnAppearing() --[[ MAX_FX_SIZE, filter_h ]]) then - ADDFX_Sel_Entry = SetMinMax(ADDFX_Sel_Entry or 1, 1, #filtered_fx) - for i = 1, #filtered_fx do - local ShownName - if filtered_fx[i]:find('VST:') then - local fx = filtered_fx[i] - ShownName = fx:sub(5, (fx:find('.vst') or 999) - 1) - local clr = FX_Adder_VST or CustomColorsDefault.FX_Adder_VST - MyText('VST', nil, clr) - SL() - HighlightSelectedItem(nil, clr, 0, L, T, R, B, h, w, 1, 1, 'GetItemRect') - elseif filtered_fx[i]:find('VST3:') then - local fx = filtered_fx[i] - ShownName = fx:sub(6) .. '##vst3' - local clr = FX_Adder_VST3 or CustomColorsDefault.FX_Adder_VST3 - MyText('VST3', nil, clr) - SL() - HighlightSelectedItem(nil, clr, 0, L, T, R, B, h, w, 1, 1, 'GetItemRect') - elseif filtered_fx[i]:find('JS:') then - local fx = filtered_fx[i] - ShownName = fx:sub(4) - local clr = FX_Adder_JS or CustomColorsDefault.FX_Adder_JS - MyText('JS', nil, clr) - SL() - HighlightSelectedItem(nil, clr, 0, L, T, R, B, h, w, 1, 1, 'GetItemRect') - elseif filtered_fx[i]:find('AU:') then - local fx = filtered_fx[i] - ShownName = fx:sub(4) - local clr = FX_Adder_AU or CustomColorsDefault.FX_Adder_AU - MyText('AU', nil, clr) - SL() - HighlightSelectedItem(nil, clr, 0, L, T, R, B, h, w, 1, 1, 'GetItemRect') - elseif filtered_fx[i]:find('CLAP:') then - local fx = filtered_fx[i] - ShownName = fx:sub(6) - local clr = FX_Adder_CLAP or CustomColorsDefault.FX_Adder_CLAP - MyText('CLAP', nil, clr) - SL() - HighlightSelectedItem(nil, clr, 0, L, T, R, B, h, w, 1, 1, 'GetItemRect') - end - - if r.ImGui_Selectable(ctx, (ShownName or filtered_fx[i]) .. '##emptyName', DRAG_FX == i) then - if filtered_fx[i] then - InsertFX(filtered_fx[i]) - r.ImGui_CloseCurrentPopup(ctx) - close = true - end - end - if i == ADDFX_Sel_Entry then - HighlightSelectedItem(0xffffff11, nil, 0, L, T, R, B, h, w, 1, 1, 'GetItemRect') - end - -- DRAG AND DROP - if r.ImGui_IsItemActive(ctx) and r.ImGui_IsMouseDragging(ctx, 0) then - -- HIGHLIGHT DRAGGED FX - DRAG_FX = i - AddFX_Drag(filtered_fx[i]) - end - end - - if r.ImGui_IsKeyPressed(ctx, r.ImGui_Key_Enter()) then - r.TrackFX_AddByName(LT_Track, filtered_fx[ADDFX_Sel_Entry], false, -1000 - FX_Idx) - LAST_USED_FX = filtered_fx[filtered_fx[ADDFX_Sel_Entry]] - ADDFX_Sel_Entry = nil - r.ImGui_CloseCurrentPopup(ctx) - close = true - - --FILTER = '' - --r.ImGui_CloseCurrentPopup(ctx) - elseif r.ImGui_IsKeyPressed(ctx, r.ImGui_Key_UpArrow()) then - ADDFX_Sel_Entry = ADDFX_Sel_Entry - 1 - elseif r.ImGui_IsKeyPressed(ctx, r.ImGui_Key_DownArrow()) then - ADDFX_Sel_Entry = ADDFX_Sel_Entry + 1 - end - --r.ImGui_EndChild(ctx) - r.ImGui_EndPopup(ctx) - end - - - r.ImGui_OpenPopup(ctx, "##popupp") - r.ImGui_NewLine(ctx) - end - - - if r.ImGui_IsKeyPressed(ctx, r.ImGui_Key_Escape()) then - r.ImGui_CloseCurrentPopup(ctx) - ADDFX_FILTER = nil - end - return close -end - -local function DrawChildMenu(tbl, path) - path = path or "" - for i = 1, #tbl do - if tbl[i].dir then - if r.ImGui_BeginMenu(ctx, tbl[i].dir) then - DrawChildMenu(tbl[i], table.concat({ path, os_separator, tbl[i].dir })) - r.ImGui_EndMenu(ctx) - end - end - if type(tbl[i]) ~= "table" then - if r.ImGui_Selectable(ctx, tbl[i]) then - if TRACK then - - -- r.ShowConsoleMsg(path .. os_separator .. tbl[i] .. "\n") - r.TrackFX_AddByName(TRACK, table.concat({ path, os_separator, tbl[i] }), false, - -1000 - FX_Idx) - end - end - end - end -end - -function AddFX_Drag(name) - if r.ImGui_BeginDragDropSource(ctx, r.ImGui_DragDropFlags_AcceptNoDrawDefaultRect()) then - r.ImGui_SetDragDropPayload(ctx, 'AddFX_Sexan', tostring(name)) - r.ImGui_Text(ctx, name) - r.ImGui_EndDragDropSource(ctx) - end -end - -function AddFX_drop(FX_Idx) - if r.ImGui_BeginDragDropTarget(ctx) then - local ret, payload = r.ImGui_AcceptDragDropPayload(ctx, 'AddFX_Sexan', nil) - r.ImGui_EndDragDropTarget(ctx) - if ret then - local fx_name = payload - r.TrackFX_AddByName(LT_Track, fx_name, false, -1000 - FX_Idx) - DRAG_FX = nil - end - end -end - -local function frame() - OPEN_FILTER = r.ImGui_IsKeyPressed(ctx, r.ImGui_Key_A()) - - if OPEN_FILTER and not r.ImGui_IsAnyItemActive(ctx) then - OPEN_FILTER = nil - if not r.ImGui_IsPopupOpen(ctx, "FILTER LIST") then - ADDFX_FILTER = '' - r.ImGui_OpenPopup(ctx, "FILTER LIST") - end - end - -- OPEN FX LIST - if r.ImGui_BeginPopup(ctx, "FILTER LIST") then - if FilterBox(FX_Idx) then r.ImGui_CloseCurrentPopup(ctx) end - r.ImGui_EndPopup(ctx) - end - - -- DRAG AND DROP HERE - for i = 1, 5 do - reaper.ImGui_Selectable(ctx, "TRACK " .. i, false, nil, 50, size_hIn) - AddFX_drop(i) - end -end - - - - - - - - --- @noindex -function EQFunctions() - ProQ3 = { LT_EQBand = {}, GainDrag = {}, Band_UseState = {}, DspRange = {}, SpectrumExist = {}, } - ProQ3.Width = 340 - ProQ3.SpecWait = 0 - FreqValueDrag = {} - fftsize = 4096 - xscale = 300 / (fftsize - 4) - wsc = ProQ3.Width / math.log(900) --- 340 = width of pro q window - SpectrumX = 0 - SpectrumY = 0 - OUTPUT = 0 - - NodeDrag = {} - XposNode = {} - ONE_OVER_SAMPLE_RATE = 1 / (30000 * 2) - Euler = 2.71828182845904523 - Hz = 6 - A = 2 - Q = 0.5 - - MAX_FREQ = 30000 - max_freq = 30000 - min_freq = 10; - MIN_FREQ = 10; - FREQ_LOG_MAX = math.log(MAX_FREQ / MIN_FREQ); - - MAX_Q = 40; - MIN_Q = 0.15; - freq_log_max = math.log(max_freq / min_freq); - NodeFreq = {} - - - - - function determineBandColor(Band) -- for pro q 3 - if Band == 1 or Band == 9 or Band == 17 then - Clr_HalfAlpha = 0x69B45D55 - elseif Band == 2 or Band == 10 or Band == 18 then - Clr_HalfAlpha = 0x2D91E355 - elseif Band == 3 or Band == 11 or Band == 19 then - Clr_HalfAlpha = 0xC530E555 - elseif Band == 4 or Band == 12 or Band == 20 then - Clr_HalfAlpha = 0xF51B1D55 - elseif Band == 5 or Band == 13 or Band == 21 then - Clr_HalfAlpha = 0x571EF555 - elseif Band == 6 or Band == 14 or Band == 22 then - Clr_HalfAlpha = 0xC1FF1A55 - elseif Band == 7 or Band == 15 or Band == 23 then - Clr_HalfAlpha = 0x30C2FF55 - elseif Band == 8 or Band == 16 or Band == 24 then - Clr_HalfAlpha = 0x00e49655 - end - if Band == 1 or Band == 9 or Band == 17 then - Clr_FullAlpha = 0x69B45Dff - elseif Band == 2 or Band == 10 or Band == 18 then - Clr_FullAlpha = 0x2D91E3ff - elseif Band == 3 or Band == 11 or Band == 19 then - Clr_FullAlpha = 0xC530E5ff - elseif Band == 4 or Band == 12 or Band == 20 then - Clr_FullAlpha = 0xF51B1Dff - elseif Band == 5 or Band == 13 or Band == 21 then - Clr_FullAlpha = 0x571EF5ff - elseif Band == 6 or Band == 14 or Band == 22 then - Clr_FullAlpha = 0xC1FF1Aff - elseif Band == 7 or Band == 15 or Band == 23 then - Clr_FullAlpha = 0x30C2FFff - elseif Band == 8 or Band == 16 or Band == 24 then - Clr_FullAlpha = 0x00e496ff - end - if Band == 1 or Band == 9 or Band == 17 then - Clr_Brighter = 0x96CA8Dff - elseif Band == 2 or Band == 10 or Band == 18 then - Clr_Brighter = 0x6CB2EBff - elseif Band == 3 or Band == 11 or Band == 19 then - Clr_Brighter = 0xC530E5ff - elseif Band == 4 or Band == 12 or Band == 20 then - Clr_Brighter = 0xF51B1Dff - elseif Band == 5 or Band == 13 or Band == 21 then - Clr_Brighter = 0x865affff - elseif Band == 6 or Band == 14 or Band == 22 then - Clr_Brighter = 0xccef6eff - elseif Band == 7 or Band == 15 or Band == 23 then - Clr_Brighter = 0x30C2FFff - elseif Band == 8 or Band == 16 or Band == 24 then - Clr_Brighter = 0x00e496ff - end - - - - return Clr_HalfAlpha, Clr_FullAlpha, Clr_Brighter - end - - function explode_rgba(rgba) - return - ((rgba >> 24) & 0xFF) / 255, - ((rgba >> 16) & 0xFF) / 255, - ((rgba >> 8) & 0xFF) / 255, - (rgba & 0xFF) / 255 - end - - function _svf_bp(freq, q) - g = math.tan(math.pi * freq / SAMPLE_RATE); - k = 1.0 / q; - a1 = 1.0 / (1.0 + g * (g + k)); - a2 = g * a1; - a3 = g * a2; - m0 = 0; - m1 = 1 / q; - m2 = 0; - svf_set_coeffs(g, k, a1, a2, a3, m0, m1, m2); - end - - function _svf_bs(freq, q) - g = math.tan(math.pi * freq / SAMPLE_RATE); - k = 1.0 / q; - a1 = 1.0 / (1.0 + g * (g + k)); - a2 = g * a1; - a3 = g * a2; - m0 = 1; - m1 = -k; - m2 = 0; - svf_set_coeffs(g, k, a1, a2, a3, m0, m1, m2); - end - - function svf_bs(freq, q) - nlp = 1; - onepole = 0; - _svf_bs(freq, q); - end - - function svf_bp(freq, q) - nlp = 1; - onepole = 0; - _svf_bp(freq, q); - end - - function per_to_q(x, range) - Q_LOG_MAX = math.log(MAX_Q / MIN_Q, 5); - - return MIN_Q * (Euler ^ (Q_LOG_MAX * x / range)) - end - - function q_to_per(q, range) - return range * math.log(q / MIN_Q) / Q_LOG_MAX; - end - - function _zdf_eq(freq, q, gain) - A = gain; --10.0 ^ (gain / 20.0); - g = math.tan(math.pi * freq / SAMPLE_RATE); - k = 1.0 / (q * A); - a1 = 1.0 / (1.0 + g * (g + k)); - a2 = g * a1; - a3 = g * a2; - m0 = 1; - m1 = k * (A * A - 1); - m2 = 0; - rbj_eq(freq, q, gain); - return zdf_set_coeffs(a1, a2, a3, m0, m1, m2); - end - - function zdf_eq(freq, q, gain) - --instance(nlp, onepole) - - nlp = 1; - onepole = 0; - this._zdf_eq(freq, q, gain); - end - - function rbj_eq(freq, q, gain) - --instance(a1, a2, b0, b1, b2) - - - w0 = 2 * math.pi * math.min(freq / SAMPLE_RATE, 0.49); - alpha = math.sin(w0) / (2 * q); - a = gain; --math.sqrt(gain); - - b0 = 1 + alpha * a; - b1 = a1 - a1 = -2 * math.cos(w0); - b2 = 1 - alpha * a; - a0 = 1 + alpha / a; - a2 = 1 - alpha / a; - - return rbj_scale(a0) - end - - function db_to_y(db) - DB_EQ_RANGE = 60 - m = 1.0 - (((db / DB_EQ_RANGE) / 2) + 0.5); - return -(m * 200 - 100) - --return TOP_MARGIN+(m * (gfx_h - (gfx_texth*2) - BOTTOM_MARGIN - (RAISED_BOTTOM * ENABLE_RAISED_BOTTOM))); - end - - function freq_to_x(freq) - ProQ3.Width = 340 - return 0 + (340 * math.log(freq / 10) / 30000); - end - - function spectrum1_to_y(zo) - gfx_h = 190 - return 0 + (1.0 - zo) * gfx_h; - end - - function _svf_ls(freq, q, gain) - A = gain; --10 ^ (gain / 40.0); - g = math.tan(math.pi * freq / SAMPLE_RATE) / math.sqrt(A); - k = 1.0 / q; - a1 = 1.0 / (1.0 + g * (g + k)); - a2 = g * a1; - a3 = g * a2; - m0 = 1; - m1 = k * (A - 1); - m2 = (A * A - 1); - svf_set_coeffs(g, k, a1, a2, a3, m0, m1, m2); - end - - function svf_ls(freq, q, gain) - nlp = 1; - onepole = 0; - _svf_ls(freq, q, gain); - end - - function _svf_hs(freq, q, gain) - A = gain; --10 ^ (gain / 40.0); - g = math.tan(math.pi * freq / SAMPLE_RATE) * math.sqrt(A); - k = 1.0 / q; - a1 = 1.0 / (1.0 + g * (g + k)); - a2 = g * a1; - a3 = g * a2; - m0 = A * A; - m1 = k * (1 - A) * A; - m2 = (1 - A * A); - svf_set_coeffs(g, k, a1, a2, a3, m0, m1, m2); - end - - function svf_st(freq, q, gain) - nlp = 3; - onepole = 0; - gain2 = 10 ^ ((-gain) / 40); - gainn = 10 ^ (gain / 40); - - _svf_hs(freq, q, gainn); - - --_svf_ls(freq, q, gain2) - A = gain2; --10 ^ (gain / 40.0); - g = math.tan(math.pi * freq / SAMPLE_RATE) / math.sqrt(A); - k = 1.0 / q; - a1 = 1.0 / (1.0 + g * (g + k)); - a2 = g * a1; - a3 = a3 + g * a2; - m0 = m0; - m1 = m1 + k * (A - 1); - m2 = m2 + (A * A - 1); - end - - function svf_hs(freq, q, gain) - nlp = 1; - onepole = 0; - _svf_hs(freq, q, gain); - end - - function rbj_ls(freq, q, gain) - w0 = 2 * math.pi * math.min(freq / SAMPLE_RATE, 0.49); - cos_w0 = math.cos(w0); - a = gain; --sqrt(gain); - - tmp0 = 2 * math.sqrt(a) * math.sin(w0) / (2 * q); - tmp1 = (a + 1) - (a - 1) * cos_w0; - tmp2 = (a + 1) + (a - 1) * cos_w0; - - b0 = a * (tmp1 + tmp0); - b1 = 2 * a * ((a - 1) - (a + 1) * cos_w0); - b2 = a * (tmp1 - tmp0); - a0 = tmp2 + tmp0; - a1 = -2 * ((a - 1) + (a + 1) * cos_w0); - a2 = tmp2 - tmp0; - - - return rbj_scale(a0); - end - - function rbj_hs(freq, q, gain) - w0 = 2 * math.pi * math.min(freq / SAMPLE_RATE, 0.49); - cos_w0 = math.cos(w0); - a = gain; --sqrt(gain); - - tmp0 = 2 * math.sqrt(a) * math.sin(w0) / (2 * q); - tmp1 = (a + 1) - (a - 1) * cos_w0; - tmp2 = (a + 1) + (a - 1) * cos_w0; - - b0 = a * (tmp2 + tmp0); - b1 = -2 * a * ((a - 1) + (a + 1) * cos_w0); - b2 = a * (tmp2 - tmp0); - a0 = tmp1 + tmp0; - a1 = 2 * ((a - 1) - (a + 1) * cos_w0); - a2 = tmp1 - tmp0; - - return rbj_scale(a0); - end - - function rbj_hp(freq, q) - w0 = 2 * math.pi * math.min(freq / SAMPLE_RATE, 0.49); - cos_w0 = math.cos(w0); - alpha = math.sin(w0) / (2 * q); - - b1 = -1 - math.cos_w0; - b0 = b2 - b2 = -0.5 * b1; - a0 = 1 + alpha; - a1 = -2 * math.cos_w0; - a2 = 1 - alpha; - - return rbj_scale(a0); - end - - function rbj_scale(a0) - local scale = 1 / a0; - - a1 = a1 * scale; - a2 = a2 * scale; - - b0 = b0 * scale; - b1 = b1 * scale; - b2 = b2 * scale; - - return a0 - end - - SAMPLE_RATE = 60000 - - function freq_to_scx(freq) - MAX_FREQ = 30000 - MIN_FREQ = 10; - FREQ_LOG_MAX = math.log(MAX_FREQ / MIN_FREQ); - Witdth = 340 - return ProQ3.Width * math.log(freq / MIN_FREQ) / FREQ_LOG_MAX; - end - - function rbj_hp(freq, q) - w0 = 2 * math.pi * math.min(freq / 60000, 0.49); --60000 is supposed to be sample rate - cos_w0 = math.cos(w0); - alpha = math.sin(w0) / (2 * q); - - b1 = -1 - cos_w0; - b0 = -0.5 * b1; - b2 = -0.5 * b1; - a0 = 1 + alpha; - a1 = -2 * cos_w0; - a2 = 1 - alpha; - - - return rbj_scale(a0) - end - - function rbj_lp(freq, q) - w0 = 2 * math.pi * math.min(freq / 60000, 0.49); - cos_w0 = math.cos(w0); - alpha = math.sin(w0) / (2 * q); - - b1 = 1 - cos_w0; - b0 = 0.5 * b1; - b2 = 0.5 * b1; - a0 = 1 + alpha; - a1 = -2 * cos_w0; - a2 = 1 - alpha; - - return rbj_scale(a0); - end - - function svf_onepole(mode, cutoff) - passtype = mode; - if passtype == 0 then - -- Low pass - W = math.tan(math.pi * cutoff / SAMPLE_RATE); - N = 1 / (1 + W); - B0 = W * N; - B1 = B0; - A1 = N * (W - 1); - return A1 - else - -- High pass - - W = math.tan(math.pi * cutoff / SAMPLE_RATE); - N = 1 / (1 + W); - B0 = N; - B1 = -B0; - A1 = N * (W - 1); - return A1 - end - end - - function svf_single_hp(freq, q) - g = math.tan(math.pi * freq / SAMPLE_RATE); - k = 1.0 / q; - a1 = 1.0 / (1.0 + g * (g + k)); - a2 = g * a1; - a3 = g * a2; - m0 = 1.0; - m1 = -k; - m2 = -1.0; - --rbj_hp(freq, q); - svf_set_coeffs(g, k, a1, a2, a3, m0, m1, m2); - - --svf_set_coeffs(g, k, a1, a2, a3, m0, m1, m2); - - cutoff = freq; - - op0 = svf_onepole(1, cutoff); - op1 = svf_onepole(1, cutoff); - return op0, op1 - end - - function zdf_single_lp(freq, q) - g = math.tan(math.pi * freq / SAMPLE_RATE); - k = 1.0 / q; - a1 = 1.0 / (1.0 + g * (g + k)); - a2 = g * a1; - a3 = g * a2; - m0 = 0; - m1 = 0; - m2 = 1; - --rbj_lp(freq, q); - svf_set_coeffs(g, k, a1, a2, a3, m0, m1, m2); - - --a1,a2,a3,m0,m1,m2 = zdf_set_coeffs(a1, a2, a3, m0, m1, m2); - cutoff = freq; - - op0 = svf_onepole(0, cutoff) - op1 = svf_onepole(0, cutoff) - return op0, op1 - end - - function magnitude_to_01(m, freq) - ceiling = 0; - noise_floor = -90; - - db = 10 * math.log10(m); - - -- Tilt around 1kHz - if tilt ~= 0.0 then db = db + tilt * ((math.log(freq) / math.log(2)) - (math.log(1024) / math.log(2))) end - - return 1.0 - ((db - ceiling) / (noise_floor - ceiling)); - end - - function db_to_gain(db) - return 10 ^ (db / 21); -- 21 is 40 in original script - end - - function db_to_gain30(db) - return 10 ^ (db / 21); -- 21 is 40 in original script - end - - function zdf_lp(freq, q, slope) - --instance(nlp, cas1, cas2, cas3, cas4, cas5, cas6, cas7, cas8, cas9, onepole) - - nlp = slope; - if slope == 0 then onepole = 1 else onepole = 0 end - - cas0 = zdf_single_lp(freq, q); - cas1 = zdf_single_lp(freq, q); - cas2 = zdf_single_lp(freq, q); - cas3 = zdf_single_lp(freq, q); - cas4 = zdf_single_lp(freq, q); - cas5 = zdf_single_lp(freq, q); - cas6 = zdf_single_lp(freq, q); - cas7 = zdf_single_lp(freq, q); - cas8 = zdf_single_lp(freq, q); - cas9 = zdf_single_lp(freq, q); - - return cas0, cas1, cas2, cas3, cas4, cas5, cas6, cas7, cas8, cas9 - end - - function svf_hp(freq, q, slope) - nlp = slope; - if slope == 0 then onepole = 1 else onepole = 0 end - - cas0 = svf_single_hp(freq, q); - cas1 = svf_single_hp(freq, q); - cas2 = svf_single_hp(freq, q); - cas3 = svf_single_hp(freq, q); - cas4 = svf_single_hp(freq, q); - cas5 = svf_single_hp(freq, q); - cas6 = svf_single_hp(freq, q); - cas7 = svf_single_hp(freq, q); - cas8 = svf_single_hp(freq, q); - cas9 = svf_single_hp(freq, q); - - return cas0, cas1, cas2, cas3, cas4, cas5, cas6, cas7, cas8, cas9 - end - - function svf_set_coeffs(tg, tk, ta1, ta2, ta3, tm0, tm1, tm2) - --instance(g, k, a1, a2, a3, m0, m1, m2, t_g, t_k, t_a1, t_a2, t_a3, t_m0, t_m1, t_m2, s_g, s_k, s_a1, s_a2, s_a3, s_m0, s_m1, s_m2, iter_t) - - iter_t = 0.0; - - -- Start coefficients - s_g = g; - s_k = k; - s_a1 = a1; - s_a2 = a2; - s_a3 = a3; - s_m0 = m0; - s_m1 = m1; - s_m2 = m2; - - -- Target coefficients - t_g = tg; - t_k = tk; - t_a1 = ta1; - t_a2 = ta2; - t_a3 = ta3; - t_m0 = tm0; - t_m1 = tm1; - t_m2 = tm2; - end - - function magnitude(freq) - -- instance(g, k, m0, m1, m2, a1, a2, a3) - --local(zr, zi, zrr, gsq, gm1, gk, twogsq, a, zsq_i, zsq_r, twoz_r, twoz_i, nr, ni, dr, di, norm, ddi, ddr, x, y, s) - - -- exp(complex(0.0, -2.0 * pi) * frequency / sampleRate) - zr = 0.0; - zi = -2.0 * math.pi; - - zr = zr * freq * ONE_OVER_SAMPLE_RATE; - zi = zi * freq * ONE_OVER_SAMPLE_RATE; - zr = math.exp(zr); - - zrr = zr; - zr = zrr * math.cos(zi); - zi = zrr * math.sin(zi); - - gsq = g * g; - gm1 = g * m1; - gk = g * k; - twogsq = gsq * 2.0; - - -- z * z - a = zr * zr - zi * zi; - zsq_i = zi * zr + zr * zi; - zsq_r = a; - - -- z * 2.0 - twoz_r = zr * 2; - twoz_i = zi * 2; - - -- Numerator complex - nr = gsq * m2 * (zsq_r + twoz_r + 1.0) - gm1 * (zsq_r - 1.0); - ni = gsq * m2 * (zsq_i + twoz_i) - gm1 * (zsq_i); - - -- Denominator complex - dr = gsq + gk + zsq_r * (gsq - gk + 1.0) + zr * (twogsq - 2.0) + 1.0; - di = zsq_i * (gsq - gk + 1.0) + zi * (twogsq - 2.0); - - -- Numerator / Denominator - norm = dr * dr + di * di; - a = (nr * dr + ni * di) / norm; - ddi = (ni * dr - nr * di) / norm; - ddr = a; - - -- abs(m0_ + (Numerator / Denominator) - x = m0 + ddr; - y = ddi; - s = math.max(math.abs(x), math.abs(y)); - x = x / s; - y = y / s; - - -- Return magnitude - return s * math.sqrt(x * x + y * y); - end - - function zdf_magnitude(freq) - --instance(rbj, nlp, onepole, cas1, cas2, cas3, cas4, cas5, cas6, cas7, cas8, cas9, cutoff, op0, op1) - --local(m) - - -- Our svf magnitude maps to the same magnitude z transfer function as biquad - - m = 1.0; - - -- Apply two pole (12dB steps) - if nlp > 0 then m = m * magnitude(freq) end --12 - if nlp > 2 then m = m * magnitude(freq) end - if nlp > 4 then m = m * magnitude(freq) end - if nlp > 6 then m = m * magnitude(freq) end - if nlp > 8 then m = m * magnitude(freq) end - if nlp > 10 then m = m * magnitude(freq) end - if nlp > 12 then m = m * magnitude(freq) end - if nlp > 14 then m = m * magnitude(freq) end - if nlp > 16 then m = m * magnitude(freq) end - if nlp > 18 then m = m * magnitude(freq) end --120 - - -- Apply one pole (6dB) - - if onepole == 1 then - wdcutoff = math.pi * (cutoff / SAMPLE_RATE); - coff = math.tan(wdcutoff); - - wdeval = math.pi * (freq / SAMPLE_RATE); - svalue = math.tan(wdeval); - - if passtype == 0 then - -- lp - m = m * 1.0 / math.sqrt(1 + ((svalue / coff) ^ 2)); - else - -- hp - m = m * 1.0 / math.sqrt(1 + ((coff / svalue) ^ 2)); - end - end - - return m - end - - function x_to_freq(x) - max_freq = 30000 - min_freq = 10 - x = min_freq * (Euler ^ (freq_log_max * (x) / (340))); -- 340 is width - return math.max(math.min(x, max_freq), min_freq); - end - - function freq_to_x_MyOwn(y) - Euler = 2.71828182845904523 - return (340 * math.log(y / 10, Euler)) / 8.00636757 - end - - for i = 1, 340, 1 do -- 340 is width - iToFreq = x_to_freq(i) - if iToFreq > 50 and iToFreq < 51 then iPos50 = i end - if iToFreq > 99 and iToFreq < 102 then iPos100 = i end - if iToFreq > 198 and iToFreq < 201 then iPos200 = i end - if iToFreq > 490 and iToFreq < 500 then iPos500 = i end - if iToFreq > 990 and iToFreq < 1020 then iPos1k = i end - if iToFreq > 1980 and iToFreq < 2010 then iPos2k = i end - if iToFreq > 4900 and iToFreq < 5050 then iPos5k = i end - if iToFreq > 9990 and iToFreq < 10300 then iPos10k = i end - end - - - - - function Calc_4ptBezier(x1, y1, x2, y2, x3, y3, x4, y4, t) - X = (1 - t) ^ 3 * x1 + 3 * (1 - t) ^ 2 * t * x2 + 3 * (1 - t) * t ^ 2 * x3 + t ^ 3 * x4 - Y = (1 - t) ^ 3 * y1 + 3 * (1 - t) ^ 2 * t * y2 + 3 * (1 - t) * t ^ 2 * y3 + t ^ 3 * y4 - - return X, Y - end - - function syncProQ_DispRange(Actual_dB_Val) - if Actual_dB_Val == 30 then - Output = 1 - elseif Actual_dB_Val == 12 then - Output = 2.5 - elseif Actual_dB_Val == 6 then - Output = 5 - elseif Actual_dB_Val == 3 then - Output = 10 - end - return Output - end -end - -GeneralFunctions() -LayoutEditorFunctions() -FXLayeringFunctions() -ModulationFunctions() -ThemeEditorFunctions() ---FXAdderFunctions() -EQFunctions() - - - - - - -----------------------------End declare Initial Variables ------------------------ - ---------------------------== Before GUI (No Loop) ---------------------------- - - -GetLTParam() - -ctx = r.ImGui_CreateContext('FX Device', r.ImGui_ConfigFlags_DockingEnable()) - - - - - - - - ------ Get plugin scripts path ------- -local pluginScriptPath = r.GetResourcePath() .. '/Scripts/ReaTeam Scripts/FX/BryanChi_FX Devices/FX Layout Plugin Scripts' -PluginScripts= scandir(pluginScriptPath) -for i, v in ipairs(PluginScripts) do - - if not v:find('.lua') then - - PluginScripts[i] = nil - else PluginScripts[i] = v:sub( 0,v:find('.lua') -1) - end - - -end - - - -local script_folder = select(2, r.get_action_context()):match('^(.+)[\\//]') -script_folder = script_folder .. '/BryanChi_FX Devices' -FontAwesome = r.ImGui_CreateFont(script_folder .. '/IconFont1.ttf', 30) - - -NumOfTotalTracks = reaper.CountTracks(0) --- Repeat for every track, at the beginning of script -for Track_Idx = 0, NumOfTotalTracks - 1, 1 do - local Track = reaper.GetTrack(0, Track_Idx) - local TrkID = r.GetTrackGUID(Track) - - Trk[TrkID] = Trk[TrkID] or {} - Trk[TrkID].Mod = {} - Trk[TrkID].SEQL = Trk[TrkID].SEQL or {} - Trk[TrkID].SEQ_Dnom = Trk[TrkID].SEQ_Dnom or {} - for i = 1, 8, 1 do -- for every modulator - Trk[TrkID].Mod[i] = {} - local m = Trk[TrkID].Mod[i] - m.ATK = tonumber(select(2, - r.GetSetMediaTrackInfo_String(Track, 'P_EXT: Macro ' .. i .. ' Atk', '', false))) - m.REL = tonumber(select(2, - r.GetSetMediaTrackInfo_String(Track, 'P_EXT: Macro ' .. i .. ' Rel', '', false))) - Trk[TrkID].SEQL[i] = tonumber(select(2, - r.GetSetMediaTrackInfo_String(Track, 'P_EXT: Macro ' .. i .. ' SEQ Length', '', false))) - Trk[TrkID].SEQ_Dnom[i] = tonumber(select(2, - r.GetSetMediaTrackInfo_String(Track, 'P_EXT: Macro ' .. i .. ' SEQ Denominator', '', false))) - m.Smooth = tonumber(select(2, - r.GetSetMediaTrackInfo_String(Track, 'P_EXT: Macro ' .. i .. ' Follower Speed', '', false))) - - m.Gain = tonumber(select(2, - r.GetSetMediaTrackInfo_String(Track, 'P_EXT: Macro ' .. i .. ' Follower Gain', '', false))) - - Trk[TrkID].Mod[i].SEQ = Trk[TrkID].Mod[i].SEQ or {} - --Get Seq Steps - if Trk[TrkID].SEQL[i] then - for St = 1, Trk[TrkID].SEQL[i], 1 do - Trk[TrkID].Mod[i].SEQ[St] = tonumber(select(2, - r.GetSetMediaTrackInfo_String(Track, 'P_EXT: Macro ' .. i .. ' SEQ Step = ' .. St .. ' Val', '', - false))) - end - end - end - - - - local FXCount = reaper.TrackFX_GetCount(Track) - Trk[TrkID] = Trk[TrkID] or {} - Trk[TrkID].PreFX = Trk[TrkID].PreFX or {} - Trk[TrkID].PostFX = Trk[TrkID].PostFX or {} - - - - function attachImagesAndFonts() - Img = { - Trash = r.ImGui_CreateImage(r.GetResourcePath() .. - '/Scripts/ReaTeam Scripts/FX/BryanChi_FX Devices/Images/trash.png') - } - - - for i= 6, 64, 1 do - _G['Font_Andale_Mono_'..i]= r.ImGui_CreateFont('andale mono', i) - end - - - Font_Andale_Mono_20_B = r.ImGui_CreateFont('andale mono', 20, r.ImGui_FontFlags_Bold()) - r.ImGui_Attach(ctx, Font_Andale_Mono_20_B) - for i= 6, 64, 1 do - r.ImGui_Attach(ctx, _G['Font_Andale_Mono_'..i]) - end - r.ImGui_Attach(ctx, FontAwesome) - r.ImGui_Attach(ctx, Img.Trash) - - - for i=6, 64, 1 do - _G['Arial_'..i]= r.ImGui_CreateFont('Arial', i) - r.ImGui_Attach(ctx, _G['Arial_'..i]) - end - - Arial = r.ImGui_CreateFont('Arial', 12) - - end - - function TrashIcon (size, lbl,ClrBG , ClrTint) - local rv = r.ImGui_ImageButton(ctx,'##'..lbl,Img.Trash, size, size, nil,nil,nil,nil, ClrBG ,ClrTint ) - if r.ImGui_IsItemHovered(ctx) then - - TintClr = 0xCE1A28ff - return rv, TintClr - end - end - - - RetrieveFXsSavedLayout(FXCount) - - Trk[TrkID].ModPrmInst = tonumber(select(2, r.GetSetMediaTrackInfo_String(Track, 'P_EXT: ModPrmInst', '', false))) - for CC = 1, Trk[TrkID].ModPrmInst or 0, 1 do - _, Trk.Prm.WhichMcros[CC .. TrkID] = r.GetSetMediaTrackInfo_String(Track, - 'P_EXT: CC Linked to which Modulation' .. CC, '', false) - end - - _, PM.DIY_TrkID[TrkID] = r.GetProjExtState(0, 'FX Devices', 'Track GUID Number for jsfx' .. TrkID) - PM.DIY_TrkID[TrkID] = tonumber(PM.DIY_TrkID[TrkID]) - - _, Trk.Prm.Inst[TrkID] = r.GetSetMediaTrackInfo_String(Track, 'P_EXT: Trk Prm Count', '', false) - Trk.Prm.Inst[TrkID] = tonumber(Trk.Prm.Inst[TrkID]) - - i = 1 - while i do - local rv, str = r.GetSetMediaTrackInfo_String(Track, 'P_EXT: PreFX ' .. i, '', false) - if rv then - Trk[TrkID].PreFX[i] = str; i = i + 1 - else - i = nil - end - end - - i = 1 - while i do - local rv, str = r.GetSetMediaTrackInfo_String(Track, 'P_EXT: PostFX ' .. i, '', false) - if rv then - Trk[TrkID].PostFX[i] = str; i = i + 1 - else - i = nil - end - end - - - - if Trk[TrkID].PreFX == {} then Trk[TrkID].PreFX = nil end - for P = 1, Trk.Prm.Inst[TrkID] or 0, 1 do - _, Trk.Prm.Num[P .. TrkID] = r.GetProjExtState(0, 'FX Devices', 'Track' .. TrkID .. ' P =' .. P) - _, Trk.Prm.WhichMcros[P .. TrkID] = r.GetProjExtState(0, 'FX Devices', - 'Prm' .. P .. 'Has Which Macro Assigned, TrkID =' .. TrkID) - if Trk.Prm.WhichMcros[P .. TrkID] == '' then Trk.Prm.WhichMcros[P .. TrkID] = nil end - - Trk.Prm.Num[P .. TrkID] = tonumber(Trk.Prm.Num[P .. TrkID]) - - for FX_Idx = 0, FXCount - 1, 1 do --repeat as many times as fx instances - local FxGUID = r.TrackFX_GetFXGUID(Track, FX_Idx) - _, Trk.Prm.FXGUID[P .. TrkID] = r.GetProjExtState(0, 'FX Devices', 'P_Trk :' .. P .. 'Trk-' .. TrkID) - end - end - - for FX_Idx = 0, FXCount - 1, 1 do --repeat as many times as fx instances - local FxGUID = r.TrackFX_GetFXGUID(Track, FX_Idx) - local _, FX_Name = r.TrackFX_GetFXName(Track, FX_Idx) - - - - - local _, DefaultSldr_W = r.GetProjExtState(0, 'FX Devices', 'Default Slider Width for FX:' .. FxGUID) - if DefaultSldr_W ~= '' then FX.Def_Sldr_W[FxGUID] = DefaultSldr_W end - local _, Def_Type = r.GetProjExtState(0, 'FX Devices', 'Default Param type for FX:' .. FxGUID) - if Def_Type ~= '' then FX.Def_Type[FxGUID] = Def_Type end - - if FxGUID ~= nil then - GetProjExt_FxNameNum(FxGUID) - - _, FX.InLyr[FxGUID] = r.GetProjExtState(0, 'FX Devices', 'FXLayer - ' .. 'is FX' .. - FxGUID .. 'in layer') - --FX.InLyr[FxGUID] = StringToBool[FX.InLyr[FxGUID]] - _, FX.LyrNum[FxGUID] = r.GetProjExtState(0, 'FX Devices', 'FXLayer ' .. FxGUID .. 'LayerNum') - _, FX[FxGUID].inWhichLyr = r.GetProjExtState(0, 'FX Devices', 'FXLayer - ' .. FxGUID .. 'is in Layer ID') - _, FX[FxGUID].ContainerTitle = r.GetProjExtState(0, 'FX Devices - ', - 'FX' .. FxGUID .. 'FX Layer Container Title ') - if FX[FxGUID].ContainerTitle == '' then FX[FxGUID].ContainerTitle = nil end - - FX[FxGUID].inWhichLyr = tonumber(FX[FxGUID].inWhichLyr) - FX.LyrNum[FxGUID] = tonumber(FX.LyrNum[FxGUID]) - _, Lyr.SplitrAttachTo[FxGUID] = r.GetProjExtState(0, 'FX Devices', 'SplitrAttachTo' .. FxGUID) - _, Prm.InstAdded[FxGUID] = r.GetProjExtState(0, 'FX Devices', 'FX' .. FxGUID .. 'Params Added') - if Prm.InstAdded[FxGUID] == 'true' then Prm.InstAdded[FxGUID] = true end - - if FX.InLyr[FxGUID] == "" then FX.InLyr[FxGUID] = nil end - FX[FxGUID].Morph_ID = tonumber(select(2, - r.GetSetMediaTrackInfo_String(Track, 'P_EXT: FXs Morph_ID' .. FxGUID, '', false))) - _, FX[FxGUID].Unlink = r.GetSetMediaTrackInfo_String(Track, 'P_EXT: FXs Morph_ID' .. FxGUID .. 'Unlink', '', - false) - if FX[FxGUID].Unlink == 'Unlink' then FX[FxGUID].Unlink = true elseif FX[FxGUID].Unlink == '' then FX[FxGUID].Unlink = nil end - - if FX[FxGUID].Morph_ID then - Trk[TrkID].Morph_ID = Trk[TrkID].Morph_ID or {} - Trk[TrkID].Morph_ID[FX[FxGUID].Morph_ID] = FxGUID - end - - local rv, ProC_ID = r.GetSetMediaTrackInfo_String(Track, 'P_EXT: ProC_ID ' .. FxGUID, '', false) - if rv then FX[FxGUID].ProC_ID = tonumber(ProC_ID) end - - if FX[FxGUID].Unlink == 'Unlink' then FX[FxGUID].Unlink = true elseif FX[FxGUID].Unlink == '' then FX[FxGUID].Unlink = nil end - - for Fx_P = 1, #FX[FxGUID] or 0, 1 do - FX[FxGUID][Fx_P].V = tonumber(select(2, - r.GetSetMediaTrackInfo_String(Track, 'P_EXT: FX' .. FxGUID .. 'Prm' .. - Fx_P .. 'Value before modulation', '', false))) - - - local ParamX_Value = 'Param' .. - tostring(FX[FxGUID][Fx_P].Name) .. 'On ID:' .. tostring(Fx_P) .. 'value' .. FxGUID - ParamValue_At_Script_Start = r.TrackFX_GetParamNormalized(Track, FX_Idx, FX[FxGUID][Fx_P].Num or 0) - _G[ParamX_Value] = ParamValue_At_Script_Start - _, FX.Prm.ToTrkPrm[FxGUID .. Fx_P] = r.GetProjExtState(0, 'FX Devices', - 'FX' .. FxGUID .. 'Prm' .. Fx_P .. 'to Trk Prm') - FX.Prm.ToTrkPrm[FxGUID .. Fx_P] = tonumber(FX.Prm.ToTrkPrm[FxGUID .. Fx_P]) - - local F_Tp = FX.Prm.ToTrkPrm[FxGUID .. Fx_P] - - _G[ParamX_Value] = FX[FxGUID][Fx_P].V or 0 - FX[FxGUID][Fx_P].WhichCC = tonumber(select(2, - r.GetSetMediaTrackInfo_String(Track, 'P_EXT: FX' .. FxGUID .. 'WhichCC' .. - (FX[FxGUID][Fx_P].Num or 0), '', false))) - _, FX[FxGUID][Fx_P].WhichMODs = r.GetSetMediaTrackInfo_String(Track, - 'P_EXT: FX' .. FxGUID .. 'Prm' .. Fx_P .. 'Linked to which Mods', '', false) - if FX[FxGUID][Fx_P].WhichMODs == '' then FX[FxGUID][Fx_P].WhichMODs = nil end - FX[FxGUID][Fx_P].ModAMT = {} - - - local CC = FX[FxGUID][Fx_P].WhichCC - local HasModAmt - for m, v in ipairs(MacroNums) do - local FP = FX[FxGUID][Fx_P] - FX[FxGUID][Fx_P].ModAMT[m] = tonumber(select(2, - r.GetSetMediaTrackInfo_String(Track, 'P_EXT: FX' .. FxGUID .. 'Prm' .. - Fx_P .. 'Macro' .. m .. 'Mod Amt', '', false))) - if FX[FxGUID][Fx_P].ModAMT[m] then HasModAmt = true end - - - - Trk[TrkID].Mod = Trk[TrkID].Mod or {} - Trk[TrkID].Mod[m] = Trk[TrkID].Mod[m] or {} - Trk[TrkID].Mod[m].Val = tonumber(select(2, - r.GetProjExtState(0, 'FX Devices', 'Macro' .. m .. 'Value of Track' .. TrkID))) - - FP.ModBypass = RemoveEmptyStr(select(2, - r.GetSetMediaTrackInfo_String(Track, 'P_EXT: FX' .. FxGUID .. 'Prm' .. Fx_P .. 'Mod bypass', '', - false))) - - - - - if Prm.McroModAmt[IdM] ~= nil then - local width = FX.Width[FxGUID] or DefaultWidth or 270 - Prm.McroModAmt_Norm[IdM] = Prm.McroModAmt --[[ [IdM]/(width*0.65) ]] - end - end - - - if not HasModAmt then FX[FxGUID][Fx_P].ModAMT = nil end - end - - FX[FxGUID] = FX[FxGUID] or {} - if r.GetSetMediaTrackInfo_String(Track, 'P_EXT: FX Morph A' .. '1' .. FxGUID, '', false) then - FX[FxGUID].MorphA = FX[FxGUID].MorphA or {} - FX[FxGUID].MorphB = FX[FxGUID].MorphB or {} - FX[FxGUID].PrmList = {} - local PrmCount = r.TrackFX_GetNumParams(Track, FX_Idx) - - RestoreBlacklistSettings(FxGUID, FX_Idx, Track, PrmCount) - - for i = 0, PrmCount - 4, 1 do - _, FX[FxGUID].MorphA[i] = r.GetSetMediaTrackInfo_String(Track, 'P_EXT: FX Morph A' .. i .. FxGUID, '', - false) - FX[FxGUID].MorphA[i] = tonumber(FX[FxGUID].MorphA[i]) - _, FX[FxGUID].MorphB[i] = r.GetSetMediaTrackInfo_String(Track, 'P_EXT: FX Morph B' .. i .. FxGUID, '', - false) - FX[FxGUID].MorphB[i] = tonumber(FX[FxGUID].MorphB[i]) - end - - _, FX[FxGUID].MorphA_Name = r.GetSetMediaTrackInfo_String(Track, - 'P_EXT: FX Morph A' .. FxGUID .. 'Preset Name', '', false) - if FX[FxGUID].MorphA_Name == '' then FX[FxGUID].MorphA_Name = nil end - _, FX[FxGUID].MorphB_Name = r.GetSetMediaTrackInfo_String(Track, - 'P_EXT: FX Morph B' .. FxGUID .. 'Preset Name', '', false) - if FX[FxGUID].MorphB_Name == '' then FX[FxGUID].MorphB_Name = nil end - end - end - - _, FX_Name = r.TrackFX_GetFXName(Track, FX_Idx) - if string.find(FX_Name, 'FXD %(Mix%)RackMixer') or string.find(FX_Name, 'FXRack') then - local FXGUIDofRackMixer = r.TrackFX_GetFXGUID(Track, FX_Idx) - FX[FXGUIDofRackMixer].LyrID = FX[FXGUIDofRackMixer].LyrID or {} - FX[FXGUIDofRackMixer].LyrTitle = FX[FXGUIDofRackMixer].LyrTitle or {} - FX[FXGUIDofRackMixer].ActiveLyrCount = 0 - - for i = 1, 8, 1 do - _, FX[FXGUIDofRackMixer].LyrID[i] = r.GetProjExtState(0, 'FX Devices', - 'FX' .. FXGUIDofRackMixer .. 'Layer ID ' .. i) - _, FX[FXGUIDofRackMixer].LyrTitle[i] = r.GetProjExtState(0, 'FX Devices - ', - 'FX' .. FXGUIDofRackMixer .. 'Layer Title ' .. i) - if FX[FXGUIDofRackMixer].LyrTitle[i] == '' then FX[FXGUIDofRackMixer].LyrTitle[i] = nil end - FX[FXGUIDofRackMixer].LyrID[i] = tonumber(FX[FXGUIDofRackMixer].LyrID[i]) - if FX[FXGUIDofRackMixer].LyrID[i] ~= -1 and FX[FXGUIDofRackMixer].LyrID[i] then - FX[FXGUIDofRackMixer].ActiveLyrCount = - FX[FXGUIDofRackMixer].ActiveLyrCount + 1 - end - end - - - _, Lyr.FX_Ins[FXGUIDofRackMixer] = r.GetProjExtState(0, 'FX Devices', 'FX Inst in Layer' .. FxGUID) - if Lyr.FX_Ins[FXGUIDofRackMixer] == "" then Lyr.FX_Ins[FXGUIDofRackMixer] = nil end - Lyr.FX_Ins[FXGUIDofRackMixer] = tonumber(Lyr.FX_Ins[FXGUIDofRackMixer]) - elseif FX_Name:find('FXD Saike BandSplitter') then - FX[FxGUID].BandSplitID = tonumber(select(2, - r.GetSetMediaTrackInfo_String(Track, 'P_EXT: BandSplitterID' .. FxGUID, '', false))) - _, FX[FxGUID].AttachToJoiner = r.GetSetMediaTrackInfo_String(Track, 'P_EXT: Splitter\'s Joiner FxID ' .. - FxGUID, '', false) - - for FX_Idx = 0, FXCount - 1, 1 do --repeat as many times as fx instances - --Restore Band Split - local FxID = r.TrackFX_GetFXGUID(Track, FX_Idx) - if select(2, r.GetSetMediaTrackInfo_String(Track, 'P_EXT: FX is in which BS' .. FxID, '', false)) == FxGUID then - --local _, Guid_FX_In_BS = r.GetSetMediaTrackInfo_String(LT_Track,'P_EXT: FX is in which BS'..FxID, '', false ) - FX[FxID] = FX[FxID] or {} - FX[FxID].InWhichBand = tonumber(select(2, - r.GetSetMediaTrackInfo_String(Track, 'P_EXT: FX is in which Band' .. FxID, '', false))) - - FX[FxGUID].FXsInBS = FX[FxGUID].FXsInBS or {} - table.insert(FX[FxGUID].FXsInBS, FxID) - end - end - end - - - - if Track == LT_Track and string.find(FX_Name, 'Pro%-Q 3') ~= nil then - _, ProQ3.DspRange[FX_Idx] = r.TrackFX_GetFormattedParamValue(LT_Track, FX_Idx, 331) - ProQ3['scaleLabel' .. ' ID' .. FxGUID] = ProQ3.DspRange[FX_Idx] - ProQ3['scale' .. ' ID' .. FxGUID] = syncProQ_DispRange(ProQ3.DspRange[FX_Idx]) - end - end - - for m = 1, 8, 1 do - _, Trk[TrkID].Mod[m].Name = r.GetSetMediaTrackInfo_String(Track, 'P_EXT: Macro' .. m .. 's Name' .. TrkID, '', - false) - if Trk[TrkID].Mod[m].Name == '' then Trk[TrkID].Mod[m].Name = nil end - _, Trk[TrkID].Mod[m].Type = r.GetSetMediaTrackInfo_String(Track, 'P_EXT: Mod' .. m .. 'Type', '', false) - if Trk[TrkID].Mod[m].Type == '' then Trk[TrkID].Mod[m].Type = nil end - end -end - -attachImagesAndFonts() - ---------------------------------------------------------------- ------------Retrieve Keyboard Shortcut Settings ---------------- ---------------------------------------------------------------- -if CallFile('r', 'Keyboard Shortcuts.ini') then - local file, filepath = CallFile('r', 'Keyboard Shortcuts.ini') - Content = file:read('*a') - local L = get_lines(filepath) - for i, v in ipairs(L) do - KB_Shortcut[i] = v:sub(0, v:find(' =') - 1) - Command_ID[i] = v:sub(v:find(' =') + 3, nil) - end -end - - - - - ----------------------------- End For Before GUI ---------------------------- - -function loop() - - GetLT_FX_Num() - GetLTParam() - if ChangeFont then - - - - r.ImGui_Attach(ctx, _G[ (ChangeFont_Font or 'Font_Andale_Mono' ).. '_'..(ChangeFont_Size or ChangeFont.FtSize )] ) - ChangeFont = nil - ChangeFont_Size =nil - ChangeFont_Font=nil - ChangeFont_Var=nil - end - - - - if Dock_Now then - r.ImGui_SetNextWindowDockID(ctx, -1) - end - Dock_Now = nil - ProC.ChanSplit = nil - - - - - - if LT_Track then TrkClr = r.ImGui_ColorConvertNative(r.GetTrackColor(LT_Track)) end - TrkClr = ((TrkClr or 0) << 8) | 0x66 -- shift 0x00RRGGBB to 0xRRGGBB00 then add 0xFF for 100% opacity - - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_MenuBarBg(), TrkClr or 0x00000000) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_WindowBg(), Window_BG or CustomColorsDefault.Window_BG) - --------------------------== BEGIN GUI---------------------------------------------------------------------------- - local visible, open = r.ImGui_Begin(ctx, 'FX Device', true, - r.ImGui_WindowFlags_NoScrollWithMouse() + r.ImGui_WindowFlags_NoScrollbar() + r.ImGui_WindowFlags_MenuBar() + - r.ImGui_WindowFlags_NoCollapse()) - r.ImGui_PopStyleColor(ctx, 2) -- for menu bar and window BG - - - local Viewport = r.ImGui_GetWindowViewport(ctx) - - VP.w, VP.h = r.ImGui_Viewport_GetSize(Viewport) - VP.x, VP.y = r.ImGui_GetCursorScreenPos(ctx) - - ---------------------------------------------------------------------------- - -- ImGUI Variables----------------------------------------------------------- - ---------------------------------------------------------------------------- - Mods = r.ImGui_GetKeyMods(ctx) - Alt = r.ImGui_Mod_Alt() - Ctrl = r.ImGui_Mod_Ctrl() - Shift = r.ImGui_Mod_Shift() - Apl = r.ImGui_Mod_Super() - - - - - - if visible then - VP.w, VP.h = r.ImGui_Viewport_GetSize(Viewport) - VP.FDL = VP.FDL or r.ImGui_GetForegroundDrawList(ctx) - VP.X, VP.Y = r.ImGui_GetCursorScreenPos(ctx) - - ----------------- Keyboard Shortcuts --------------- - if not r.ImGui_IsAnyItemActive(ctx) then - for i, v in pairs(KB_Shortcut) do - if not v:find('+') then --if shortcut has no modifier - if r.ImGui_IsKeyPressed(ctx, AllAvailableKeys[v]) and Mods == 0 then - --[[ local commandID = r.NamedCommandLookup('_BR_FOCUS_ARRANGE_WND') - local CommandTxt = r.CF_GetCommandText(0, commandID) -- 0 prob means arrange window, it's the section drop down from action window's top right corner - r.Main_OnCommand(commandID, 0) ]] - if Command_ID[i] then - local Cmd_Num = r.NamedCommandLookup(Command_ID[i]) - r.Main_OnCommand(Cmd_Num, 0) - end - end - else - local Mod = 0 - if v:find('Shift') then Mod = Mod + r.ImGui_Mod_Shift() end - if v:find('Alt') then Mod = Mod + r.ImGui_Mod_Alt() end - if v:find('Ctrl') then Mod = Mod + r.ImGui_Mod_Ctrl() end - if v:find('Cmd') then Mod = Mod + r.ImGui_Mod_Super() end - - - local rev = v:reverse() - local lastPlus = rev:find('+') - local Ltr = rev:sub(1, rev:find('+') - 2) - local AftrLastPlus = Ltr:reverse() - - - if Mods == Mod and r.ImGui_IsKeyPressed(ctx, AllAvailableKeys[AftrLastPlus]) then - if Command_ID[i] then - local Cmd_Num = r.NamedCommandLookup(Command_ID[i]) - r.Main_OnCommand(Cmd_Num, 0) - end - end - end - end - end - - - - if LT_Track == nil then - local Viewport = r.ImGui_GetWindowViewport(ctx) - - r.ImGui_DrawList_AddTextEx(VP.FDL, Font_Andale_Mono_20_B, 20, VP.X, VP.Y + VP.h / 2, 0xffffffff, - 'Select a track to start') - else - function GetAllInfoNeededEachLoop() - TimeEachFrame = r.ImGui_GetDeltaTime(ctx) - if ImGUI_Time == nil then ImGUI_Time = 0 end - ImGUI_Time = ImGUI_Time + TimeEachFrame - _, TrkName = r.GetTrackName(LT_Track) - - Wheel_V, Wheel_H = r.ImGui_GetMouseWheel(ctx) - LT_Track = r.GetLastTouchedTrack() - IsAnyMouseDown = r.ImGui_IsAnyMouseDown(ctx) - LBtn_MousdDownDuration = r.ImGui_GetMouseDownDuration(ctx, 0) - LBtnRel = r.ImGui_IsMouseReleased(ctx, 0) - RBtnRel = r.ImGui_IsMouseReleased(ctx, 1) - IsLBtnClicked = r.ImGui_IsMouseClicked(ctx, 0) - LBtnClickCount = r.ImGui_GetMouseClickedCount(ctx, 0) - IsLBtnHeld = r.ImGui_IsMouseDown(ctx, 0) - IsRBtnHeld = r.ImGui_IsMouseDown(ctx, 1) - Mods = r.ImGui_GetKeyMods(ctx) -- Alt = 4 shift =2 ctrl = 1 Command=8 - IsRBtnClicked = r.ImGui_IsMouseClicked(ctx, 1) - LT_FXGUID = r.TrackFX_GetFXGUID(LT_Track or r.GetTrack(0, 0), LT_FX_Number or 0) - TrkID = r.GetTrackGUID(LT_Track or r.GetTrack(0, 0)) - Sel_Track_FX_Count = r.TrackFX_GetCount(LT_Track) - LBtnDrag = r.ImGui_IsMouseDragging(ctx, 0) - LBtnDC = r.ImGui_IsMouseDoubleClicked(ctx, 0) - - - end - - HintMessage = nil - GetAllInfoNeededEachLoop() - - -- if action to record last touch is triggered - if r.GetExtState('FXD','Record last touch') ~= '' then - if not IsPrmAlreadyAdded(true ) then StoreNewParam(LT_FXGUID, LT_ParamName, LT_ParamNum, LT_FXNum,true) end - r.SetExtState('FXD','Record last touch', '', false) - end - - - ------- Add FX --------- - for i, v in ipairs(AddFX.Name) do - if v:find('FXD Gain Reduction Scope') then - local FxGUID = ProC.GainSc_FXGUID - - FX[FxGUID] = FX[FxGUID] or {} - FX[FxGUID].ProC_ID = math.random(1000000, 9999999) - r.gmem_attach('CompReductionScope') - r.gmem_write(2002, FX[FxGUID].ProC_ID) - r.gmem_write(FX[FxGUID].ProC_ID, AddFX.Pos[i]) - r.gmem_write(2000, PM.DIY_TrkID[TrkID]) - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: ProC_ID ' .. FxGUID, FX[FxGUID].ProC_ID, true) - elseif v:find('FXD Saike BandSplitter') then - r.gmem_attach('FXD_BandSplit') - BandSplitID = BandSplitID or math.random(1000000, 9999999) - r.gmem_write(0, BandSplitID) - elseif v:find('FXD Band Joiner') then - - end - - - - AddFX_HideWindow(LT_Track, v, -1000 - AddFX.Pos[i]) - if v:find('FXD Band Joiner') then - local SplittrID = r.TrackFX_GetFXGUID(LT_Track, AddFX.Pos[i] - 1) - local JoinerID = r.TrackFX_GetFXGUID(LT_Track, AddFX.Pos[i]) - FX[SplittrID] = FX[SplittrID] or {} - FX[SplittrID].AttachToJoiner = JoinerID - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: Splitter\'s Joiner FxID ' .. SplittrID, JoinerID, - true) - elseif v:find('FXD Gain Reduction Scope') then - local _, FX_Name = r.TrackFX_GetFXName(LT_Track, AddFX.Pos[i]) - - SyncAnalyzerPinWithFX(AddFX.Pos[i], AddFX.Pos[i] - 1, FX_Name) - end - end - - - - - ----- Del FX ------ - if Sel_Track_FX_Count then - for FX_Idx = 0, Sel_Track_FX_Count - 1, 1 do - local _, FX_Name = r.TrackFX_GetFXName(LT_Track, FX_Idx or 0) - - if FX_Name == 'JS: FXD Gain Reduction Scope' then - local _, FX_Name_Before = r.TrackFX_GetFXName(LT_Track, FX_Idx - 1) - if string.find(FX_Name_Before, 'Pro%-C 2') == nil then - r.TrackFX_Delete(LT_Track, FX_Idx) - end - end - if FX_Name == 'JS: FXD Split to 4 channels' then - local _, FX_Name_After = r.TrackFX_GetFXName(LT_Track, FX_Idx + 1) - if string.find(FX_Name_After, 'Pro%-C 2') == nil and not AddFX.Name[1] then - r.TrackFX_Delete(LT_Track, FX_Idx) - end - local ProC_pin = r.TrackFX_GetPinMappings(LT_Track, FX_Idx + 1, 0, 0) - local SplitPin = r.TrackFX_GetPinMappings(LT_Track, FX_Idx, 0, 0) - - if ProC_pin ~= SplitPin then - r.TrackFX_SetPinMappings(LT_Track, FX_Idx, 0, 0, ProC_pin, 0) -- input L - local R = r.TrackFX_GetPinMappings(LT_Track, FX_Idx + 1, 0, 1) - r.TrackFX_SetPinMappings(LT_Track, FX_Idx, 0, 1, R, 0) -- input R - - r.TrackFX_SetPinMappings(LT_Track, FX_Idx, 1, 0, ProC_pin, 0) -- out L - r.TrackFX_SetPinMappings(LT_Track, FX_Idx, 1, 1, R, 0) -- out R - r.TrackFX_SetPinMappings(LT_Track, FX_Idx, 1, 2, 2 * R, 0) -- out L Compare - r.TrackFX_SetPinMappings(LT_Track, FX_Idx, 1, 3, 4 * R, 0) -- out R Compare - end - end - end - end - - ----- Move FX ----- - if MovFX.FromPos[1] then - local UndoLbl - r.Undo_BeginBlock() - for i, v in ipairs(MovFX.FromPos) do - if NeedCopyFX then - if v >= DropPos then offset = 1 else offset = 0 end - MovFX.ToPos[i] = math.max(MovFX.ToPos[i] - (offset or 0), 0) - r.TrackFX_CopyToTrack(LT_Track, v, LT_Track, v, false) - end - end - - for i, v in ipairs(MovFX.FromPos) do - r.TrackFX_CopyToTrack(LT_Track, v, LT_Track, MovFX.ToPos[i], true) - end - r.Undo_EndBlock(MovFX.Lbl[i] or (UndoLbl or 'Move' .. 'FX'), 0) - MovFX = { FromPos = {}, ToPos = {}, Lbl = {}, Copy = {} } - NeedCopyFX = nil - DropPos = nil - --[[ MovFX.ToPos = {} - MovFX.Lbl = {} ]] - end - - - --------- Don't remove this --------- - AddFX.Name = {} - AddFX.Pos = {} - ProC.GainSc_FXGUID = nil - ---------------------------------------- - - ----- Duplicating FX to Layer ------- - if DragFX_Dest then - MoveFX(DragFX_Src, DragFX_Src + 1, false) - DropFXtoLayerNoMove(DroptoRack, DropToLyrID, DragFX_Src) - MoveFX(DragFX_Src, DragFX_Dest + 1, true) - - DragFX_Src, DragFX_Dest, DropToLyrID = nil - end - - - - - - - demo.PushStyle() - - - - r.gmem_attach('ParamValues') - - - - if PM.DIY_TrkID[TrkID] == nil then - PM.DIY_TrkID[TrkID] = math.random(100000000, 999999999) - r.SetProjExtState(0, 'FX Devices', 'Track GUID Number for jsfx' .. TrkID, PM.DIY_TrkID[TrkID]) - end - - if r.ImGui_IsKeyPressed(ctx, r.ImGui_Key_D()) and Mods == Shift + Alt then - DebugMode = true - end - - - - -- if user switch selected track... - if TrkID ~= TrkID_End then - if TrkID_End ~= nil and TrkID ~= nil then - NumOfTotalTracks = reaper.CountTracks(0) - --[[ r.gmem_attach('TrackNameForMacro') - reaper .gmem_write(0,NumOfTotalTracks )]] - end - for P = 1, Trk.Prm.Inst[TrkID] or 0, 1 do - for m = 1, 8, 1 do - r.gmem_write(1000 * m + P, 0) - end - end - - RetrieveFXsSavedLayout(Sel_Track_FX_Count) - - SyncTrkPrmVtoActualValue() - LT_TrackNum = math.floor(r.GetMediaTrackInfo_Value(LT_Track, 'IP_TRACKNUMBER')) - end - - if RepeatTimeForWindows ~= r.TrackFX_GetCount(LT_Track) then - - RetrieveFXsSavedLayout(Sel_Track_FX_Count) - end - - - - ----Functions & Variables ------------- - Glob.FDL = r.ImGui_GetForegroundDrawList(ctx) - - - if IsLBtnClicked then Max_L_MouseDownDuration = nil end - if IsLBtnHeld then - Max_L_MouseDownDuration = math.max(LBtn_MousdDownDuration or -1, - Max_L_MouseDownDuration or -1) - end - - - - if r.ImGui_IsKeyDown(ctx, 49) then -- if number 1 is pressed - ShowKeyCode = true - end - - -- if ShowKeyCode then - if ShowKeyCode then - for keynum = 0, 300, 1 do -- - KeyDown = r.ImGui_IsKeyDown(ctx, keynum) - if KeyDown then - tooltip(tostring(keynum)) - end - end - end - - - -- end - - ----Colors & Font ------------ - --[[ reaper.ImGui_PushStyleColor(ctx, reaper.ImGui_Col_FrameBgHovered(), 0xaaaaaa44) - reaper.ImGui_PushStyleColor(ctx, reaper.ImGui_Col_FrameBg(), 0x474747ff) - reaper.ImGui_PushStyleColor(ctx, reaper.ImGui_Col_Text(), 0x6e6e6eff) --Use Hex + FF in the end - reaper.ImGui_PushStyleColor(ctx, reaper.ImGui_Col_SliderGrab(), 0x808080ff) - reaper.ImGui_PushStyleColor(ctx, reaper.ImGui_Col_FrameBgActive(), 0x808080ff) ]] - - reaper.ImGui_PushFont(ctx, Font_Andale_Mono) - - - - - ------------------------------ - ------Menu Bar--------------- - ------------------------------ - - - - r.ImGui_BeginMenuBar(ctx) - BarR, BarB = r.ImGui_GetItemRectMax(ctx) - - if r.ImGui_BeginMenu(ctx, 'Settings') then - if select(2, r.ImGui_MenuItem(ctx, 'Style Editor', shoirtcutIn, p_selected, enabledIn)) then - OpenStyleEditor = toggle(OpenStyleEditor) - end - - if select(2, r.ImGui_MenuItem(ctx, 'Keyboard Shortcut Editor', shoirtcutIn, p_selected, enabledIn)) then - OpenKBEditor = toggle(OpenKBEditor) - end - if r.ImGui_GetWindowDockID(ctx) ~= -1 then - if select(2, r.ImGui_MenuItem(ctx, 'Dock script', shoirtcutIn, p_selected, enabledIn)) then - Dock_Now = true - end - end - - MyText('Version : ' .. VersionNumber, font, 0x777777ff, WrapPosX) - r.ImGui_EndMenu(ctx) - end - - if OpenStyleEditor then ShowStyleEditor() end - if OpenKBEditor then Show_KBShortcutEditor() end - ------------------------------ - ------Record Last Touch--------------- - ------------------------------ - - if r.ImGui_Button(ctx, 'Record Last Touch') then - --[[ local FX_Count = reaper.TrackFX_GetCount(LT_Track); local RptPrmFound - local F = FX[LT_FXGUID] or {} - - if F then - for i, v in ipairs(F) do - if FX[LT_FXGUID][i].Num == LT_ParamNum then - RptPrmFound = true - TryingToAddExistingPrm = i .. LT_FXGUID - TimeNow = r.time_precise() - end - end - if not RptPrmFound and LT_FXGUID then - StoreNewParam(LT_FXGUID, LT_ParamName, LT_ParamNum, LT_FXNum,true) - end - end ]] - - if not IsPrmAlreadyAdded(true ) then StoreNewParam(LT_FXGUID, LT_ParamName, LT_ParamNum, LT_FXNum,true) end - - - - end - - - - if r.ImGui_IsItemClicked(ctx, 1) then Cont_Param_Add_Mode = toggle(Cont_Param_Add_Mode) end - - - - - - - - if FX.LayEdit then - local FxGUID = FX.LayEdit - - if r.ImGui_Button(ctx, 'Grid +') then - LE.GridSize = LE.GridSize + 5 - elseif r.ImGui_Button(ctx, 'Grid -') then - LE.GridSize = LE.GridSize - 5 - end - - if #LE.Sel_Items > 1 then - SL() - if r.ImGui_Button(ctx, 'Align Y-Axis') then - for i, v in ipairs(LE.Sel_Items) do FX[FxGUID][v].PosX = FX[FxGUID][LE.Sel_Items[1]].PosX end - elseif r.ImGui_Button(ctx, 'Align X-Axis') then - for i, v in ipairs(LE.Sel_Items) do FX[FxGUID][v].PosY = FX[FxGUID][LE.Sel_Items[1]].PosY end - end - end - if #LE.Sel_Items > 2 then - if r.ImGui_Button(ctx, 'Equalize X Spacing') then - local Spc, max, min - local tab = {} - for i, v in ipairs(LE.Sel_Items) do - table.insert(tab, FX[FxGUID][v].PosX) - end - - max = math.max(table.unpack(tab)) - min = math.min(table.unpack(tab)) - Spc = (max - min) / (#LE.Sel_Items - 1) - for i, v in ipairs(LE.Sel_Items) do - FX[FxGUID][v].PosX = min + Spc * (i - 1) - end - elseif r.ImGui_Button(ctx, 'Equalize Y Spacing') then - local Spc, max, min - local tab = {} - for i, v in ipairs(LE.Sel_Items) do - table.insert(tab, FX[FxGUID][v].PosY) - end - max = math.max(table.unpack(tab)) - min = math.min(table.unpack(tab)) - Spc = (max - min) / (#LE.Sel_Items - 1) - for i, v in ipairs(LE.Sel_Items) do - FX[FxGUID][v].PosY = min + Spc * (i - 1) - end - end - end - else --- only show if not in Layout edit mode - r.ImGui_Text(ctx, TrkName) - end - TxtSz = r.ImGui_CalcTextSize(ctx, TrkName) - r.ImGui_SameLine(ctx, VP.w - TxtSz - 20, nil) --r.ImGui_SetCursorPosX( ctx, BarR-50) - - - - - r.ImGui_EndMenuBar(ctx) - - - - - function DeleteAllParamOfFX(FXGUID, TrkID) - for p, v in pairs(Trk.Prm.FXGUID) do - if Trk.Prm.FXGUID[p] == FXGUID and FXGUID ~= nil then - Trk.Prm.Inst[TrkID] = Trk.Prm.Inst[TrkID] - 1 - Prm.Num[p] = nil - PM.HasMod[p] = nil - - r.SetProjExtState(0, 'FX Devices', 'Params fxGUID of Param Inst' .. p, '') - elseif Trk.Prm.FXGUID[p] == nil and FXGUID == nil then - - end - end - end - - if Cont_Param_Add_Mode == true then - --TimeAfter_ContAdd= TimeAfter_ContAdd+1 - - GetLT_FX_Num() - GetLTParam() - tooltip('Continuously Adding Last Touched Parameters..') - - local F = FX[LT_FXGUID] or {}; local RptPrmFound - if LT_FXGUID and type(F) == 'table' then - for i, v in ipairs(F) do - F[i] = F[i] or {} - if F[i].Num == LT_ParamNum then - RptPrmFound = true - TryingToAddExistingPrm_Cont = i .. LT_FXGUID; TryingToAddExistingPrm = nil - TimeNow = r.time_precise() - end - end - if not RptPrmFound then StoreNewParam(LT_FXGUID, LT_ParamName, LT_ParamNum, LT_FXNum, true) end - end - else - TryingToAddExistingPrm_Cont = nil - end - - local FLT_MIN, FLT_MAX = r.ImGui_NumericLimits_Float() - - ------------------------------ - ------Layout Editing --------- - ------------------------------ - - - ------------------Help Tips------------------- - - - - - -----------== Create Macros (Headers)------------- - MacroNums = { 1, 2, 3, 4, 5, 6, 7, 8, } - r.ImGui_BeginTable(ctx, 'table1', 16, r.ImGui_TableFlags_NoPadInnerX()) - - Trk[TrkID] = Trk[TrkID] or {} - Trk[TrkID].Mod = Trk[TrkID].Mod or {} - for m = 1, 16, 1 do - if m == 1 or m == 3 or m == 5 or m == 7 or m == 9 or m == 11 or m == 13 or m == 15 then - r.ImGui_TableSetupColumn(ctx, '', r.ImGui_TableColumnFlags_WidthStretch(), 2) - elseif m == 2 or m == 4 or m == 6 or m == 8 or m == 10 or m == 12 or m == 14 or m == 16 then - local weight, flag - if Trk[TrkID].Mod[m / 2] then - if Trk[TrkID].Mod[m / 2].Type == 'Step' then - weight, flag = 0, - r.ImGui_TableColumnFlags_WidthFixed() - end - end - r.ImGui_TableSetupColumn(ctx, '', flag or r.ImGui_TableColumnFlags_WidthStretch(), weight or 1) - end - end - - reaper.ImGui_PushStyleColor(ctx, reaper.ImGui_Col_HeaderHovered(), 0x373737ff) - - reaper.ImGui_TableHeadersRow(ctx) --create header row - r.gmem_attach('ParamValues') - - Trk[TrkID] = Trk[TrkID] or {} - Trk[TrkID].Mod = Trk[TrkID].Mod or {} - - - - - - - - for i, v in ipairs(MacroNums) do --Do 8 Times - Mcro_Asgn_Md_Idx = 'Macro' .. tostring(MacroNums[i]) - - Trk[TrkID].Mod[i] = Trk[TrkID].Mod[i] or {} - local I, Name, CurX = Trk[TrkID].Mod[i], nil, r.ImGui_GetCursorPosX(ctx) - local frameBgColor = reaper.ImGui_ColorConvertHSVtoRGB((i - 1) / 7.0, 0.5, 0.5, 0.2) - local frameBgHoveredColor = reaper.ImGui_ColorConvertHSVtoRGB((i - 1) / 7.0, 0.6, 0.5, 0.2) - local frameBgActiveColor = reaper.ImGui_ColorConvertHSVtoRGB((i - 1) / 7.0, 0.7, 0.5, 0.2) - local sliderGrabColor = reaper.ImGui_ColorConvertHSVtoRGB((i - 1) / 7.0, 0.9, 0.9, 0.2) - local sliderGrabActiveColor = reaper.ImGui_ColorConvertHSVtoRGB((i - 1) / 7.0, 0.9, 0.9, 0.8) - r.ImGui_PushID(ctx, i) - local function PushClr(AssigningMacro) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_FrameBg(), EightColors.LowMidSat[i]) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_FrameBgHovered(), EightColors.MidSat[i]) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_FrameBgActive(), EightColors.Bright[i]) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_SliderGrab(), EightColors.HighSat_MidBright[i]) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_SliderGrabActive(), EightColors.Bright_HighSat[i]) - - if AssigningMacro == i then - reaper.ImGui_PushStyleColor(ctx, r.ImGui_Col_FrameBg(), EightColors.HighSat_MidBright[i]) - reaper.ImGui_PushStyleColor(ctx, r.ImGui_Col_FrameBgHovered(), EightColors.bgWhenAsgnModAct[i]) - PopColorTime = 2 - end - clrPop = 6 - return PopColorTime - end - - - - Trk[TrkID].Mod[i].Type = Trk[TrkID].Mod[i].Type or 'Macro' - if Trk[TrkID].Mod[i].Type == 'Macro' then - PopColorTime = PushClr(AssigningMacro) - - r.ImGui_TableSetColumnIndex(ctx, (MacroNums[i] - 1) * 2) - MacroX_Label = 'Macro' .. tostring(MacroNums[i]) - - - MacroValueLBL = TrkID .. 'Macro' .. MacroNums[i] - - r.ImGui_PushItemWidth(ctx, -FLT_MIN) - - IsMacroSlidersEdited, I.Val = reaper.ImGui_SliderDouble(ctx, i .. '##', I.Val, Slider1Min or 0, - Slider1Max or 1) - IsMacroActive = r.ImGui_IsItemActive(ctx) - if IsMacroActive == true then Mc.AnyActive = true end - R_ClickOnMacroSliders = reaper.ImGui_IsItemClicked(ctx, 1) - -- if r.ImGui_IsItemClicked( ctx,1) ==true and Mods==nil then R_ClickOnMacroSliders = true end - if r.ImGui_IsItemClicked(ctx, 1) == true and Mods == Ctrl then - r.ImGui_OpenPopup(ctx, 'Macro' .. i .. 'Menu') - end - - if AssigningMacro == i then - BlinkItem(0.3, nil, nil, highlightEdge, EdgeNoBlink) - end - - - - --- Macro Label - reaper.ImGui_TableSetColumnIndex(ctx, MacroNums[i] * 2 - 1) - reaper.ImGui_PushStyleColor(ctx, reaper.ImGui_Col_FrameBg(), EightColors.LowSat[i]) - r.ImGui_PushItemWidth(ctx, -FLT_MIN) - MacroNameEdited, I.Name = reaper.ImGui_InputText(ctx, '##', I.Name or 'Macro ' .. i) - if MacroNameEdited then - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: Macro' .. i .. 's Name' .. TrkID, I.Name, true) - end - - if IsMacroActive then - if r.TrackFX_AddByName(LT_Track, 'FXD Macros', 0, 0) ~= -1 then - r.TrackFX_SetParamNormalized(LT_Track, 0, v - 1, I.Val) - r.SetProjExtState(0, 'FX Devices', 'Macro' .. i .. 'Value of Track' .. TrkID, I.Val) - end - else - end - - - if AssigningMacro == i then r.ImGui_PopStyleColor(ctx, PopColorTime) end - - if R_ClickOnMacroSliders and AssigningMacro == nil and Mods == 0 then - AssigningMacro = i - elseif R_ClickOnMacroSliders and AssigningMacro ~= nil then - AssigningMacro = nil - end - - - - - r.ImGui_PopStyleColor(ctx, clrPop) - elseif Trk[TrkID].Mod[i].Type == 'env' then - if Mods == Shift then DragSpeed = 0.0001 else DragSpeed = 0.01 end - PopColorTime = PushClr(AssigningMacro) - r.ImGui_TableSetColumnIndex(ctx, (i - 1) * 2) - r.ImGui_PushItemWidth(ctx, -FLT_MIN) - r.ImGui_SetNextItemWidth(ctx, 60) - local Mc = Trk[TrkID].Mod[i] - - local atk, rel = Mc.atk, Mc.rel - at, Mc.ATK = r.ImGui_DragDouble(ctx, '## atk' .. i, Mc.ATK, DragSpeed, 0, 1, '', - r.ImGui_SliderFlags_NoInput()) - SL(nil, 0) - RCat = r.ImGui_IsItemClicked(ctx, 1) - local L, T = r.ImGui_GetItemRectMin(ctx) - local W, H = r.ImGui_GetItemRectSize(ctx) - local R, B = L + W, T + H - local Atk = Mc.atk - if at then - Mc.atk = 0.000001 ^ (1 - Mc.ATK) - r.gmem_write(4, 2) -- tells jsfx user is adjusting atk - r.gmem_write(9 + ((i - 1) * 2), Mc.atk) -- tells atk value - r.gmem_write(5, i) -- tells which macro is being tweaked - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: Macro ' .. i .. ' Atk', Mc.ATK, true) - end - if r.ImGui_IsItemActive(ctx) then - r.ImGui_SetNextWindowPos(ctx, L, T - H - 10) - r.ImGui_BeginTooltip(ctx) - local f = '%.1f' - if Mods == Alt then f = '%.3f' end - local num = (Mc.atk or 0.001) * 1000 - if num > 100 then f = '%.0f' end - if num < 10 then f = '%.2f' end - if num < 1 then f = '%.3f' end - r.ImGui_Text(ctx, (f):format(num)) - r.ImGui_EndTooltip(ctx) - end - local WDL = r.ImGui_GetWindowDrawList(ctx) - r.ImGui_DrawList_AddLine(WDL, L + W * Mc.ATK, T, R, T, 0xffffffff) - r.ImGui_DrawList_AddLine(WDL, L, B, L + W * Mc.ATK, T, 0xffffffff) - - if AssigningMacro == i then - BlinkItem(0.3, nil, nil, highlightEdge, EdgeNoBlink) - end - - r.ImGui_SetNextItemWidth(ctx, 60) - - re, Mc.REL = r.ImGui_DragDouble(ctx, '## rel' .. i, Mc.REL, DragSpeed, 0.001, 1, '', - r.ImGui_SliderFlags_NoInput()) - local RCrel = r.ImGui_IsItemClicked(ctx, 1) - if re then - --Mc.rel = 10^(rel or 0.001) /10 - Mc.rel = 0.001 ^ (1 - Mc.REL) - r.gmem_write(4, 3) -- tells jsfx user is adjusting rel - r.gmem_write(10 + ((i - 1) * 2), Mc.rel) -- tells rel value - r.gmem_write(5, i) -- tells which macro is being tweaked - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: Macro ' .. i .. ' Rel', Mc.REL, true) - end - if r.ImGui_IsItemActive(ctx) then - r.ImGui_SetNextWindowPos(ctx, L, T - H - 30) - r.ImGui_BeginTooltip(ctx) - r.ImGui_Text(ctx, ('%.3f'):format(Mc.rel or 0.001)) - r.ImGui_EndTooltip(ctx) - end - local L, T = r.ImGui_GetItemRectMin(ctx) - local W, H = r.ImGui_GetItemRectSize(ctx) - local R, B = L + W, T + H - local Rel = Mc.rel or 0.001 - --r.ImGui_DrawList_AddLine(Glob.FDL, L ,T,L+W*Rel,T, 0xffffffff) - r.ImGui_DrawList_AddLine(WDL, L, T, L + W * Mc.REL, B, 0xffffffff) - if AssigningMacro == i then - BlinkItem(0.3, nil, nil, highlightEdge, EdgeNoBlink) - end - r.ImGui_TableSetColumnIndex(ctx, i * 2 - 1) - r.ImGui_PushItemWidth(ctx, -FLT_MIN) - reaper.ImGui_PushStyleColor(ctx, reaper.ImGui_Col_FrameBg(), EightColors.LowSat[i]) - if I.Name == 'Macro ' .. i then I.Name = 'Env ' .. i end - MacroNameEdited, I.Name = reaper.ImGui_InputText(ctx, '##', I.Name or 'Env ' .. i) - if MacroNameEdited then - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: Macro' .. i .. 's Name' .. TrkID, I.Name, true) - end - if (r.ImGui_IsItemClicked(ctx, 1) or RCat or RCrel) and Mods == Ctrl then - r.ImGui_OpenPopup(ctx, 'Env' .. i .. 'Menu') - end - - - - if AssigningMacro == i then r.ImGui_PopStyleColor(ctx, 2) end - - if (RCat or RCrel) and not AssigningMacro and Mods == 0 then - AssigningMacro = i - elseif (RCat or RCrel) and AssigningMacro then - AssigningMacro = nil - end - - if LBtnREl then - for i = 1, 16, 1 do - r.gmem_write(8 + i, 0) - end - end - r.ImGui_PopStyleColor(ctx, clrPop) - elseif Trk[TrkID].Mod[i].Type == 'Step' then - Macros_WDL = Macros_WDL or r.ImGui_GetWindowDrawList(ctx) - r.ImGui_TableSetColumnIndex(ctx, (i - 1) * 2) --r.ImGui_PushItemWidth( ctx, -FLT_MIN) - - r.gmem_attach('ParamValues') - local CurrentPos = r.gmem_read(120 + i) + 1 - - --r.ImGui_SetNextItemWidth(ctx, 20) - Trk[TrkID].Mod[i].SEQ = Trk[TrkID].Mod[i].SEQ or {} - local S = Trk[TrkID].Mod[i].SEQ - - Trk[TrkID].SEQL = Trk[TrkID].SEQL or {} - Trk[TrkID].SEQ_Dnom = Trk[TrkID].SEQ_Dnom or {} - - local HoverOnAnyStep - local SmallSEQActive - local HdrPosL, HdrPosT = r.ImGui_GetCursorScreenPos(ctx) - for St = 1, Trk[TrkID].SEQL[i] or SEQ_Default_Num_of_Steps, 1 do -- create all steps - local W = (VP.w - 10) / 12 - local L, T = r.ImGui_GetCursorScreenPos(ctx) - if St == 1 and AssigningMacro == i then - local H = 20 - local W = (VP.w - 10) / 12 - BlinkItem(0.3, nil, nil, highlightEdge, EdgeNoBlink, L, T, L + W, T + H, H, W) - - --HighlightSelectedItem(0xffffff77,0xffffff33, 0, L,T,L+W,T+H,H,W, 1, 1,GetItemRect, Foreground) - end - --_, S[St]= r.ImGui_DragDouble(ctx, '##SEQ '..St , S[St], 0 ,0, 1, ' ',r.ImGui_SliderFlags_NoInput()) - r.ImGui_InvisibleButton(ctx, '##SEQ' .. St .. TrkID, W / 8, 20) - local L, T = r.ImGui_GetItemRectMin(ctx); local R, B = r.ImGui_GetItemRectMax(ctx); local w, h = - r.ImGui_GetItemRectSize(ctx) - local FillClr = 0x00000000 - - - - SEQ_Popup_L = SEQ_Popup_L or L - SEQ_Popup_T = SEQ_Popup_T or T - - if r.ImGui_IsMouseHoveringRect(ctx, L, T, R, B) and not r.ImGui_IsMouseDown(ctx,0) then - HoverOnAnyStep = true - end - if HoverOnAnyStep then WhichMacroIsHovered = i end - - - if r.ImGui_IsItemHovered(ctx) then FillClr = 0xffffff22 end - HighlightSelectedItem(FillClr, 0xffffff33, 0, L - 1, T, R - 1, B, h, w, 1, 1, GetItemRect,Foreground) - - - - S[St] = SetMinMax(S[St] or 0, 0, 1) - if r.ImGui_IsItemActive(ctx) then - local _, v = r.ImGui_GetMouseDelta(ctx, nil, nil) - - if Mods == Shift then DrgSpdMod = 4 end - if v ~= 0 then - v = v * (-1) - if not (S[St] == 1 and v > 0) and not (S[St] == 0 and v < 0) then - S[St] = S[St] + v / 100 - r.gmem_write(4, 7) -- tells jsfx user is changing a step's value - r.gmem_write(5, i) -- tells which macro user is tweaking - r.gmem_write(112, SetMinMax(S[St], 0, 1) * (-1) + 1) -- tells the step's value - r.gmem_write(113, St) -- tells which step - end - r.ImGui_ResetMouseDragDelta(ctx) - end - SmallSEQActive = true - elseif r.ImGui_IsItemClicked(ctx, 1) and Mods == 0 then - if AssigningMacro then AssigningMacro = nil else AssigningMacro = i end - elseif r.ImGui_IsItemDeactivated(ctx) then - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: Macro ' .. i .. ' SEQ Step = ' .. St .. - ' Val', S[St], true) - end - - - local W, H = r.ImGui_GetItemRectSize(ctx) - local Clr = Change_Clr_A(EightColors.Bright_HighSat[i], -0.5) - if r.ImGui_IsItemActive(ctx) then - Clr = EightColors.Bright_HighSat[i] - elseif r.ImGui_IsItemHovered(ctx) then - Clr = Change_Clr_A(EightColors.Bright_HighSat[i], -0.3) - end - - r.ImGui_DrawList_AddRectFilled(Macros_WDL, L, T + H, L + W - 1, math.max(B - H * (S[St] or 0), T), - Clr) - if CurrentPos == St then -- if Step SEQ 'playhead' is now on current step - r.ImGui_DrawList_AddRect(Macros_WDL, L, T + H, L + W - 1, T, 0xffffff99) - end - SL(nil, 0) - if (r.ImGui_IsItemClicked(ctx, 1)) and Mods == Ctrl then - r.ImGui_OpenPopup(ctx, 'Step' .. i .. 'Menu') - end - end - - - - r.ImGui_SetNextWindowPos(ctx, HdrPosL, VP.y - StepSEQ_H - 100) - - function openSEQWin(Track, i) - if not HoveringSmoothness then - if r.ImGui_Begin(ctx, 'SEQ Window' .. i, true, r.ImGui_WindowFlags_NoResize() + r.ImGui_WindowFlags_NoDocking() + r.ImGui_WindowFlags_NoCollapse() + r.ImGui_WindowFlags_NoTitleBar() + r.ImGui_WindowFlags_AlwaysAutoResize()) then - local WDL = r.ImGui_GetWindowDrawList(ctx) - r.ImGui_Text(ctx, 'Sequence Length : ') - local function writeSEQDNom() - if AddMacroJSFX() then - r.gmem_write(4, 8) --[[tells JSFX user is tweaking seq length or DNom]] - r.gmem_write(5, i) --[[tells JSFX the macro]] - r.gmem_write(111, Trk[TrkID].SEQ_Dnom[i]) - r.gmem_write(110, Trk[TrkID].SEQL[i] or SEQ_Default_Num_of_Steps) - r.GetSetMediaTrackInfo_String(LT_Track, - 'P_EXT: Macro ' .. i .. ' SEQ Denominator', - Trk[TrkID].SEQ_Dnom[i], true) - end - end - - local function writeSEQGmem() - if AddMacroJSFX() then - r.gmem_write(4, 8) - r.gmem_write(5, i) - r.gmem_write(110, Trk[TrkID].SEQL[i]) - r.gmem_write(111, Trk[TrkID].SEQ_Dnom[i] or SEQ_Default_Denom) - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: Macro ' .. i .. ' SEQ Length', - Trk[TrkID].SEQL[i], true) - end - end - - - - Trk[TrkID].SEQL = Trk[TrkID].SEQL or {} - rv, Trk[TrkID].SEQL[i] = r.ImGui_SliderInt(ctx, '##' .. 'Macro' .. i .. 'SEQ Length', - Trk[TrkID].SEQL[i] or SEQ_Default_Num_of_Steps, 2, 64) - if r.ImGui_IsItemActive(ctx) then writeSEQGmem() end - SL() - if r.ImGui_Button(ctx, 'x2##' .. i) then - Trk[TrkID].SEQL[i] = math.floor((Trk[TrkID].SEQL[i] or SEQ_Default_Num_of_Steps) * 2) - writeSEQGmem() - end - SL() - if r.ImGui_Button(ctx, '/2##' .. i) then - Trk[TrkID].SEQL[i] = math.floor((Trk[TrkID].SEQL[i] or SEQ_Default_Num_of_Steps) / 2) - writeSEQGmem() - end - - r.ImGui_Text(ctx, 'Step Length : ') - if r.ImGui_Button(ctx, '2 ##' .. 'Macro' .. i .. 'SEQ Denom') then - Trk[TrkID].SEQ_Dnom[i] = 0.125 - writeSEQDNom() - end - if Trk[TrkID].SEQ_Dnom[i] == 0.125 then - HighlightSelectedItem(0xffffff22, 0xffffff77, 0, L, T, - R, B, h, w, H_OutlineSc, V_OutlineSc, 'GetItemRect', Foreground) - end - SL() - if r.ImGui_Button(ctx, '1 ##' .. 'Macro' .. i .. 'SEQ Denom') then - Trk[TrkID].SEQ_Dnom[i] = 0.25 - writeSEQDNom() - end - if Trk[TrkID].SEQ_Dnom[i] == 0.25 then - HighlightSelectedItem(0xffffff22, 0xffffff77, 0, L, T, - R, B, h, w, H_OutlineSc, V_OutlineSc, 'GetItemRect', Foreground) - end - SL() - if r.ImGui_Button(ctx, '1/2 ##' .. 'Macro' .. i .. 'SEQ Denom') then - Trk[TrkID].SEQ_Dnom[i] = 0.5 - writeSEQDNom() - end - if Trk[TrkID].SEQ_Dnom[i] == 0.5 then - HighlightSelectedItem(0xffffff22, 0xffffff77, 0, L, T, - R, B, h, w, H_OutlineSc, V_OutlineSc, 'GetItemRect', Foreground) - end - SL() - if r.ImGui_Button(ctx, '1/4 ##' .. 'Macro' .. i .. 'SEQ Denom') then - Trk[TrkID].SEQ_Dnom[i] = 1 - writeSEQDNom() - end - if Trk[TrkID].SEQ_Dnom[i] == 1 then - HighlightSelectedItem(0xffffff22, 0xffffff77, 0, L, T, R, - B, h, w, H_OutlineSc, V_OutlineSc, 'GetItemRect', Foreground) - end - SL() - if r.ImGui_Button(ctx, '1/8 ##' .. 'Macro' .. i .. 'SEQ Denom') then - Trk[TrkID].SEQ_Dnom[i] = 2 - writeSEQDNom() - end - if Trk[TrkID].SEQ_Dnom[i] == 2 then - HighlightSelectedItem(0xffffff22, 0xffffff77, 0, L, T, R, - B, h, w, H_OutlineSc, V_OutlineSc, 'GetItemRect', Foreground) - end - SL() - if r.ImGui_Button(ctx, '1/16 ##' .. 'Macro' .. i .. 'SEQ Denom') then - Trk[TrkID].SEQ_Dnom[i] = 4 - writeSEQDNom() - end - if Trk[TrkID].SEQ_Dnom[i] == 4 then - HighlightSelectedItem(0xffffff22, 0xffffff77, 0, L, T, R, - B, h, w, H_OutlineSc, V_OutlineSc, 'GetItemRect', Foreground) - end - SL() - if r.ImGui_Button(ctx, '1/32 ##' .. 'Macro' .. i .. 'SEQ Denom') then - Trk[TrkID].SEQ_Dnom[i] = 8 - writeSEQDNom() - end - SL() - if Trk[TrkID].SEQ_Dnom[i] == 8 then - HighlightSelectedItem(0xffffff22, 0xffffff77, 0, L, T, R, - B, h, w, H_OutlineSc, V_OutlineSc, 'GetItemRect', Foreground) - end - if r.ImGui_Button(ctx, '1/64 ##' .. 'Macro' .. i .. 'SEQ Denom') then - Trk[TrkID].SEQ_Dnom[i] = 16 - writeSEQDNom() - end - if Trk[TrkID].SEQ_Dnom[i] == 16 then - HighlightSelectedItem(0xffffff22, 0xffffff77, 0, L, T, R, - B, h, w, H_OutlineSc, V_OutlineSc, 'GetItemRect', Foreground) - end - - - - for St = 1, Trk[TrkID].SEQL[i] or SEQ_Default_Num_of_Steps, 1 do - r.ImGui_InvisibleButton(ctx, '##SEQ' .. St .. TrkID, StepSEQ_W, StepSEQ_H) - local L, T = r.ImGui_GetItemRectMin(ctx); local R, B = r.ImGui_GetItemRectMax(ctx); local w, h = - r.ImGui_GetItemRectSize(ctx) - r.ImGui_DrawList_AddText(WDL, L + StepSEQ_W / 2 / 2, B - 15, 0x999999ff, St) - SL(nil, 0) - local FillClr = 0x00000000 - if IsLBtnHeld and r.ImGui_IsMouseHoveringRect(ctx, L, T, R, B) and not SmallSEQActive then - --Calculate Value at Mouse pos - local MsX, MsY = r.ImGui_GetMousePos(ctx) - - S[St] = ((B - MsY) / StepSEQ_H) --[[ *(-1) ]] - r.gmem_write(4, 7) -- tells jsfx user is changing a step's value - r.gmem_write(5, i) -- tells which macro user is tweaking - r.gmem_write(112, SetMinMax(S[St], 0, 1)) -- tells the step's value - r.gmem_write(113, St) -- tells which step - - r.GetSetMediaTrackInfo_String(LT_Track, - 'P_EXT: Macro ' .. i .. ' SEQ Step = ' .. St .. ' Val', S[St], true) - elseif IsRBtnHeld and r.ImGui_IsMouseHoveringRect(ctx, L, T, R, B) and not SmallSEQActive then - SEQ_RMB_Val = 0 - S[St] = SEQ_RMB_Val - r.gmem_write(4, 7) -- tells jsfx user is changing a step's value - r.gmem_write(5, i) -- tells which macro user is tweaking - r.gmem_write(112, SEQ_RMB_Val) -- tells the step's value - r.gmem_write(113, St) -- tells which step - r.GetSetMediaTrackInfo_String(LT_Track, - 'P_EXT: Macro ' .. i .. ' SEQ Step = ' .. St .. ' Val', SEQ_RMB_Val, true) - end - local Clr = Change_Clr_A(EightColors.Bright_HighSat[i], -0.5) - - if r.ImGui_IsItemHovered(ctx, r.ImGui_HoveredFlags_RectOnly()) and not SmallSEQActive then - FillClr = 0xffffff22 - Clr = Change_Clr_A(EightColors.Bright_HighSat[i], -0.3) - end - HighlightSelectedItem(FillClr, 0xffffff33, 0, L - 1, T, R - 1, B, h, w, 1, 1, GetItemRect, Foreground) - - - - r.ImGui_DrawList_AddRectFilled(WDL, L, T + StepSEQ_H, L + StepSEQ_W - 1, - math.max(B - StepSEQ_H * (S[St] or 0), T), Clr) - - if CurrentPos == St then - r.ImGui_DrawList_AddRect(WDL, L, B, L + StepSEQ_W - 1, T, 0xffffff88) - end - end - - - - - local x, y = r.ImGui_GetWindowPos(ctx) - local w, h = r.ImGui_GetWindowSize(ctx) - - - if r.ImGui_IsMouseHoveringRect(ctx, x, y, x + w, y + h) then notHoverSEQ_Time = 0 end - - r.ImGui_End(ctx) - end - end - end - - if WhichMacroIsHovered == i and HoverOnAnyStep or SmallSEQActive then - openSEQWin(Track, i) - notHoverSEQ_Time = 0 - end - - if WhichMacroIsHovered == i and not HoverOnAnyStep and not SmallSEQActive then - notHoverSEQ_Time = math.min((notHoverSEQ_Time or 0), 11) + 1 - if notHoverSEQ_Time < 10 then - openSEQWin(Track, i) - else - WhichMacroIsHovered = nil - notHoverSEQ_Time = 0 - end - end - elseif Trk[TrkID].Mod[i].Type == 'Follower' then - r.ImGui_TableSetColumnIndex(ctx, (i - 1) * 2) - - r.ImGui_Button(ctx, 'Follower ') - if r.ImGui_IsItemClicked(ctx, 1) and Mods == Ctrl then - r.ImGui_OpenPopup(ctx, 'Follower' .. i .. 'Menu') - elseif r.ImGui_IsItemClicked(ctx, 1) then - if not AssigningMacro then - AssigningMacro = i - else - AssigningMacro = nil - end - end - if AssigningMacro == i then - BlinkItem(0.3, nil, nil, highlightEdge, EdgeNoBlink) - end - - if r.ImGui_IsItemHovered(ctx) then FolMacroHover = i end - - - - function openFollowerWin(Track, i) - local HoveringSmoothness - - local HdrPosL, HdrPosT = r.ImGui_GetCursorScreenPos(ctx) - - r.ImGui_SetNextWindowPos(ctx, HdrPosL, VP.y - 55) - r.ImGui_SetNextWindowSize(ctx, 350, 55) - if r.ImGui_Begin(ctx, 'Follower Windowww' .. i, true, r.ImGui_WindowFlags_NoResize() + r.ImGui_WindowFlags_NoDocking() + r.ImGui_WindowFlags_NoCollapse() + r.ImGui_WindowFlags_NoScrollbar() + r.ImGui_WindowFlags_NoTitleBar()) then - r.ImGui_Text(ctx, 'Speed : ') - SL() - local m = Trk[TrkID].Mod[i] - local CurX = r.ImGui_GetCursorPosX(ctx) - retval, m.Smooth = r.ImGui_DragDouble(ctx, '##Smoothness', m.Smooth or 1, 1, 0, 300, - '%.1f') - - - if r.ImGui_IsItemHovered(ctx) or r.ImGui_IsItemActive(ctx) then - HoveringSmoothness = i - end - local x, y = r.ImGui_GetWindowPos(ctx) - local w, h = r.ImGui_GetWindowSize(ctx) - - - if r.ImGui_IsMouseHoveringRect(ctx, x, y, x + w, y + h) then - notHoverFOL_Time = 0 - HoveringSmoothness = i - end - - if retval then - m.smooth = SetMinMax(0.1 ^ (1 - m.Smooth * 0.01), 0.1, 100) - r.gmem_write(4, 10) ---tells jsfx macro type = Follower, and user is adjusting smoothness - r.gmem_write(5, i) ---tells jsfx which macro - r.gmem_write(9, m.smooth) -- Sets the smoothness - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: Macro ' .. i .. ' Follower Speed', - m.Smooth, - true) - end - - --r.ImGui_Text(ctx, ('S = ' .. (m.Smooth or '') .. 's= ' .. (m.smooth or ''))) - r.ImGui_Text(ctx, 'Gain : ') - SL(CurX) - - rv, m.Gain = r.ImGui_DragDouble(ctx, '##Gain' .. i, m.Gain or 100, 1, 0, 400, '%.0f' .. '%%') - if r.ImGui_IsItemActive(ctx) then - r.gmem_write(4, 11) ---tells jsfx macro type = Follower, and user is adjusting gain - r.gmem_write(5, i) - r.gmem_write(9, m.Gain / 100) - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: Macro ' .. i .. ' Follower Gain', m.Gain, - true) - end - - if r.ImGui_IsItemHovered(ctx) or r.ImGui_IsItemActive(ctx) then HoveringSmoothness = i end - - r.ImGui_End(ctx) - end - - - return HoveringSmoothness - end - - if HoveringSmoothness == i then - HoveringSmoothness = openFollowerWin(Track, i) - end - - if FolMacroHover == i and not HoveringSmoothness then - local timeout = 20 - notHoverFOL_Time = math.min((notHoverFOL_Time or 0), timeout + 1) + 1 - if notHoverFOL_Time < timeout then - HoveringSmoothness = openFollowerWin(Track, i) - else - HoveringSmoothness = openFollowerWin(Track, i) - FolMacroHover = nil - notHoverFOL_Time = 0 - end - end - end - - - - - --check if there's envelope - --[[ IsThereEnvOnMacro[i] = reaper.GetFXEnvelope(LT_Track, 0, i-1, false) - Str_IsThereEnvOnMacro = tostring(IsThereEnvOnMacro[i]) - if Str_IsThereEnvOnMacro ~= 'nil' then --if theres env on macros, Sync Macro on Gui to Actual Values - - Mc.Val_Trk[MacroValueLBL]= reaper.TrackFX_GetParamNormalized( LT_Track, 0, i-1 ) - PosX_Left, PosY_Top = reaper.ImGui_GetItemRectMin(ctx) - Array_Parameter.PosX_Left[i]=PosX_Left - Array_Parameter.PosY_Top[i]=PosY_Top - drawlist=reaper.ImGui_GetForegroundDrawList(ctx) - MacroColor= 'Macro'..i..'Color' - reaper.ImGui_DrawList_AddCircleFilled(drawlist, Array_Parameter.PosX_Left[i], Array_Parameter.PosY_Top[i],4,_G[MacroColor]) - else IsThereEnvOnMacro[i]=0 - end ]] - local function SetTypeToEnv() - if r.ImGui_Selectable(ctx, 'Set Type to Envelope') then - Trk[TrkID].Mod[i].Type = 'env' - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: Mod' .. i .. 'Type', 'env', true) - r.gmem_write(4, 4) -- tells jsfx macro type = env - r.gmem_write(5, i) -- tells jsfx which macro - end - end - - local function SetTypeToStepSEQ() - if r.ImGui_Selectable(ctx, 'Set Type to Step Sequencer') then - Trk[TrkID].Mod[i].Type = 'Step' - r.gmem_write(4, 6) -- tells jsfx macro type = step seq - r.gmem_write(5, i) - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: Mod' .. i .. 'Type', 'Step', true) - Trk[TrkID].SEQL = Trk[TrkID].SEQL or {} - Trk[TrkID].SEQ_Dnom = Trk[TrkID].SEQ_Dnom or {} - Trk[TrkID].SEQL[i] = Trk[TrkID].SEQL[i] or SEQ_Default_Num_of_Steps - Trk[TrkID].SEQ_Dnom[i] = Trk[TrkID].SEQ_Dnom[i] or SEQ_Default_Denom - - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: Macro ' .. i .. ' SEQ Length', - Trk[TrkID].SEQL[i] or SEQ_Default_Num_of_Steps, true) - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: Macro ' .. i .. ' SEQ Denominator', - Trk[TrkID].SEQ_Dnom[i] or SEQ_Default_Denom, true) - - if I.Name == 'Env ' .. i or I.Name == 'Macro ' .. i then I.Name = 'Step ' .. i end - end - end - - local function SetTypeToFollower() - if r.ImGui_Selectable(ctx, 'Set Type to Audio Follower') then - r.gmem_write(4, 9) -- tells jsfx macro type = Follower - r.gmem_write(5, i) -- tells jsfx which macro - Trk[TrkID].Mod[i].Type = 'Follower' - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: Mod' .. i .. 'Type', 'Follower', true) - end - end - local function SetTypeToMacro() - if r.ImGui_Selectable(ctx, 'Set Type to Macro') then - Trk[TrkID].Mod[i].Type = 'Macro' - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: Mod' .. i .. 'Type', 'Macro', true) - r.gmem_write(4, 5) -- tells jsfx macro type = Macro - r.gmem_write(5, i) -- tells jsfx which macro - if I.Name == 'Env ' .. i then I.Name = 'Macro ' .. i end - end - end - - - if r.ImGui_BeginPopup(ctx, 'Macro' .. i .. 'Menu') then - if r.ImGui_Selectable(ctx, 'Automate') then - AddMacroJSFX() - -- Show Envelope for Morph Slider - local env = r.GetFXEnvelope(LT_Track, 0, i - 1, true) - SetPrmAlias(LT_TrackNum, 1, i, Trk[TrkID].Mod[i].Name or ('Macro' .. i)) --don't know what this line does, but without it Envelope won't show.... - local active, visible, armed, inLane, laneHeight, defaultShape, minValue, maxValue, centerValue, Tp, faderScaling = - r.BR_EnvGetProperties(env) - r.BR_EnvSetProperties(env, true, true, armed, inLane, laneHeight, defaultShape, faderScaling) - r.UpdateArrange() - r.ImGui_CloseCurrentPopup(ctx) - end - SetTypeToEnv() - SetTypeToStepSEQ() - SetTypeToFollower() - r.ImGui_EndPopup(ctx) - elseif r.ImGui_BeginPopup(ctx, 'Env' .. i .. 'Menu') then - SetTypeToMacro() - SetTypeToStepSEQ() - SetTypeToFollower() - r.ImGui_EndPopup(ctx) - elseif r.ImGui_BeginPopup(ctx, 'Step' .. i .. 'Menu') then - SetTypeToMacro() - SetTypeToEnv() - SetTypeToFollower() - r.ImGui_EndPopup(ctx) - elseif r.ImGui_BeginPopup(ctx, 'Follower' .. i .. 'Menu') then - SetTypeToMacro() - SetTypeToEnv() - SetTypeToStepSEQ() - r.ImGui_EndPopup(ctx) - end - - - r.ImGui_PopID(ctx) - end - - if not FX_Dvs_BgDL then FX_Dvs_BgDL = r.ImGui_GetWindowDrawList(ctx) end - r.ImGui_PopStyleColor(ctx, 1) - r.ImGui_EndTable(ctx) - ---------------End Of header----------------------- - - - if ImGUI_Time > 3 then - CompareFXCount = r.TrackFX_GetCount(LT_Track); - ImGUI_Time = 0 - end - - if not r.ImGui_IsPopupOpen(ctx, '', r.ImGui_PopupFlags_AnyPopup()) then - FX_Idx_OpenedPopup = nil - end - - - - --------------== Space between FXs-------------------- - function AddSpaceBtwnFXs(FX_Idx, SpaceIsBeforeRackMixer, AddLastSpace, LyrID, SpcIDinPost, FxGUID_Container, - AdditionalWidth) - local SpcIsInPre, Hide, SpcInPost, MoveTarget - - - if FX_Idx == 0 and r.TrackFX_AddByName(LT_Track, 'FXD Macros', 0, 0) ~= -1 then FX_Idx = 1 end - --if FX_Idx == 1 and r.TrackFX_AddByName(LT_Track, 'FXD Macros', 0, 0) ~= -1 then FX_Idx=FX_Idx-1 else FX_Idx =FX_Idx end - TblIdxForSpace = FX_Idx .. tostring(SpaceIsBeforeRackMixer) - FXGUID_To_Check_If_InLayer = r.TrackFX_GetFXGUID(LT_Track, FX_Idx) - if Trk[TrkID].PreFX[1] then - local offset - if r.TrackFX_AddByName(LT_Track, 'FXD Macros', 0, 0) ~= -1 then offset = 1 else offset = 0 end - if SpaceIsBeforeRackMixer == 'End of PreFX' then - SpcIsInPre = true - if Trk[TrkID].PreFX_Hide then Hide = true end - MoveTarget = FX_Idx + 1 - elseif FX_Idx + 1 - offset <= #Trk[TrkID].PreFX and SpaceIsBeforeRackMixer ~= 'End of PreFX' then - SpcIsInPre = true; if Trk[TrkID].PreFX_Hide then Hide = true end - end - end - if SpaceIsBeforeRackMixer == 'SpcInPost' or SpaceIsBeforeRackMixer == 'SpcInPost 1st spc' then - SpcInPost = true - if PostFX_LastSpc == 30 then Dvdr.Spc_Hover[TblIdxForSpace] = 30 end - end - local ClrLbl = FX_Idx .. (tostring(SpaceIsBeforeRackMixer) or '') - - - Dvdr.Clr[ClrLbl] = Space_Between_FXs - Dvdr.Width[TblIdxForSpace] = Dvdr.Width[TblIdxForSpace] or 0 - if FX_Idx == 0 and DragDroppingFX and not SpcIsInPre then - if r.ImGui_IsMouseHoveringRect(ctx, Cx_LeftEdge + 10, Cy_BeforeFXdevices, Cx_LeftEdge + 25, Cy_BeforeFXdevices + 220) and DragFX_ID ~= 0 then - Dvdr.Width[TblIdxForSpace] = Df.Dvdr_Width - end - end - - if FX_Idx == RepeatTimeForWindows then - Dvdr.Width[TblIdxForSpace] = 15 - end - - if FX_Idx_OpenedPopup == (FX_Idx or 0) .. (tostring(SpaceIsBeforeRackMixer) or '') then - Dvdr.Clr[ClrLbl] = Clr.Dvdr.Active - else - Dvdr.Clr[ClrLbl] = Dvdr.Clr[ClrLbl] or Clr.Dvdr.In_Layer - end - - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_FrameBg(), Dvdr.Clr[ClrLbl]) - - -- StyleColor For Space Btwn Fx Windows - if not Hide then - if r.ImGui_BeginChildFrame(ctx, '##SpaceBetweenWindows' .. FX_Idx .. tostring(SpaceIsBeforeRackMixer) .. 'Last SPC in Rack = ' .. tostring(AddLastSPCinRack), 10 + Dvdr.Width[TblIdxForSpace] + (Dvdr.Spc_Hover[TblIdxForSpace] or 0) + (AdditionalWidth or 0), 220, r.ImGui_WindowFlags_NoScrollbar()|r.ImGui_WindowFlags_NoScrollWithMouse()|r.ImGui_WindowFlags_NoNavFocus()|r.ImGui_WindowFlags_NoNav()) then - --HOVER_RECT = reaper.ImGui_IsWindowHovered(ctx, reaper.ImGui_HoveredFlags_RectOnly()) - HoverOnWindow = r.ImGui_IsWindowHovered(ctx, r.ImGui_HoveredFlags_AllowWhenBlockedByActiveItem()) - - if HoverOnWindow == true and Dragging_TrueUntilMouseUp ~= true and DragDroppingFX ~= true and AssignWhichParam == nil and Is_ParamSliders_Active ~= true and Wet.ActiveAny ~= true and Knob_Active ~= true and not Dvdr.JustDroppedFX and LBtn_MousdDownDuration < 0.2 then - Dvdr.Spc_Hover[TblIdxForSpace] = Df.Dvdr_Hvr_W - if DebugMode then - tooltip('FX_Idx :' .. - FX_Idx .. - '\n Pre/Post/Norm : ' .. - tostring(SpaceIsBeforeRackMixer) .. '\n SpcIDinPost: ' .. tostring(SpcIDinPost)) - end - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_ButtonHovered(), CLR_BtwnFXs_Btn_Hover) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_ButtonActive(), CLR_BtwnFXs_Btn_Active) - local x, y = r.ImGui_GetCursorScreenPos(ctx) - r.ImGui_SetCursorScreenPos(ctx, x, Glob.WinT) - BTN_Btwn_FXWindows = r.ImGui_Button(ctx, '##Button between Windows', 99, 217) - FX_Insert_Pos = FX_Idx - - if BTN_Btwn_FXWindows then - FX_Idx_OpenedPopup = FX_Idx .. (tostring(SpaceIsBeforeRackMixer) or '') - - r.ImGui_OpenPopup(ctx, 'Btwn FX Windows' .. FX_Idx) - end - r.ImGui_PopStyleColor(ctx, 2) - Dvdr.RestoreNormWidthWait[FX_Idx] = 0 - else - Dvdr.RestoreNormWidthWait[FX_Idx] = (Dvdr.RestoreNormWidthWait[FX_Idx] or 0) + 1 - if Dvdr.RestoreNormWidthWait[FX_Idx] >= 8 then - Dvdr.Spc_Hover[TblIdxForSpace] = Dvdr_Hvr_W - Dvdr.RestoreNormWidthWait[FX_Idx] = 0 - end - end - - - - if HoverOnWindow then - -- tooltip ('fx idx = ' .. tostring (FX_Idx) .. 'space is before mixer- '.. tostring (SpaceIsBeforeRackMixer).. 'AddLastSPCinRack - '.. tostring(AddLastSPCinRack)) - end - - if r.ImGui_BeginPopup(ctx, 'Btwn FX Windows' .. FX_Idx) then - FX_Idx_OpenedPopup = FX_Idx .. (tostring(SpaceIsBeforeRackMixer) or '') - - if FilterBox(FX_Idx, LyrID, SpaceIsBeforeRackMixer, FxGUID_Container, SpcIsInPre, SpcInPost, - SpcIDinPost) then - r.ImGui_CloseCurrentPopup(ctx) - end-- Add FX Window - if r.ImGui_BeginMenu(ctx, 'FX Browser') then - for i = 1, #CAT do - if r.ImGui_BeginMenu(ctx, CAT[i].name) then - if CAT[i].name == "FX CHAINS" then - DrawChildMenu(CAT[i].list) - end - for j = 1, #CAT[i].list do - if CAT[i].name ~= "FX CHAINS" then - if r.ImGui_BeginMenu(ctx, CAT[i].list[j].name) then - for p = 1, #CAT[i].list[j].fx do - if CAT[i].list[j].fx[p] then - if r.ImGui_Selectable(ctx, CAT[i].list[j].fx[p]) then - if TRACK then - r.TrackFX_AddByName(TRACK, CAT[i].list[j].fx[p], false, - -1000 - FX_Idx) - LAST_USED_FX = CAT[i].list[j].fx[p] - end - end - end - end - r.ImGui_EndMenu(ctx) - end - end - end - r.ImGui_EndMenu(ctx) - end - end - TRACK = r.GetSelectedTrack(0, 0) - if r.ImGui_Selectable(ctx, "CONTAINER") then - r.TrackFX_AddByName(TRACK, "Container", false, - -1000 - r.TrackFX_GetCount(TRACK)) - LAST_USED_FX = "Container" - end - if r.ImGui_Selectable(ctx, "VIDEO PROCESSOR") then - r.TrackFX_AddByName(TRACK, "Video processor", false, - -1000 - r.TrackFX_GetCount(TRACK)) - LAST_USED_FX = "Video processor" - end - if LAST_USED_FX then - if r.ImGui_Selectable(ctx, "RECENT: " .. LAST_USED_FX) then - r.TrackFX_AddByName(TRACK, LAST_USED_FX, false, - -1000 - r.TrackFX_GetCount(TRACK)) - end - end - r.ImGui_EndMenu(ctx) - end - if r.ImGui_Selectable(ctx, 'Add FX Layering') then - local FX_Idx = FX_Idx - --[[ if FX_Name:find('Pro%-C 2') then FX_Idx = FX_Idx-1 end ]] - local val = r.SNM_GetIntConfigVar("fxfloat_focus", 0) - if val & 4 ~= 0 then - r.SNM_SetIntConfigVar("fxfloat_focus", val & (~4)) - end - - if r.GetMediaTrackInfo_Value(LT_Track, 'I_NCHAN') < 16 then - r.SetMediaTrackInfo_Value(LT_Track, 'I_NCHAN', 16) - end - FXRack = r.TrackFX_AddByName(LT_Track, 'FXD (Mix)RackMixer', 0, -1000 - FX_Idx) - local RackFXGUID = r.TrackFX_GetFXGUID(LT_Track, FX_Idx) - - ChanSplitr = r.TrackFX_AddByName(LT_Track, 'FXD Split to 32 Channels', 0, -1000 - FX_Idx) - local SplitrGUID = r.TrackFX_GetFXGUID(LT_Track, FX_Idx) - Lyr.SplitrAttachTo[SplitrGUID] = RackFXGUID - r.SetProjExtState(0, 'FX Devices', 'SplitrAttachTo' .. SplitrGUID, RackFXGUID) - _, ChanSplitFXName = r.TrackFX_GetFXName(LT_Track, FX_Idx - 1) - - FX[RackFXGUID] = FX[RackFXGUID] or {} - FX[RackFXGUID].LyrID = FX[RackFXGUID].LyrID or {} - table.insert(FX[RackFXGUID].LyrID, 1) - table.insert(FX[RackFXGUID].LyrID, 2) - - r.SetProjExtState(0, 'FX Devices', 'FX' .. RackFXGUID .. 'Layer ID 1', 1) - r.SetProjExtState(0, 'FX Devices', 'FX' .. RackFXGUID .. 'Layer ID 2', 2) - FX[RackFXGUID].ActiveLyrCount = 2 - - FX_Layr_Inst = 0 - for F = 0, Sel_Track_FX_Count, 1 do - local FXGUID = r.TrackFX_GetFXGUID(LT_Track, F) - local _, FX_Name = reaper.TrackFX_GetFXName(LT_Track, F) - if string.find(FX_Name, 'FXD Split to 32 Channels') ~= nil then - FX_Layr_Inst = FX_Layr_Inst + 1 - Lyr.SpltrID[FX_Layr_Inst .. TrkID] = r.TrackFX_GetFXGUID(LT_Track, FX_Idx - 1) - end - end - - Spltr[SplitrGUID] = Spltr[SplitrGUID] or {} - Spltr[SplitrGUID].New = true - - - if FX_Layr_Inst == 1 then - --sets input channels to 1 and 2 - r.TrackFX_SetPinMappings(LT_Track, FX_Idx - 1, 0, 0, 1, 0) - r.TrackFX_SetPinMappings(LT_Track, FX_Idx - 1, 0, 1, 2, 0) - r.TrackFX_SetPinMappings(LT_Track, FX_Idx - 1, 0, 2, 1, 0) - r.TrackFX_SetPinMappings(LT_Track, FX_Idx - 1, 0, 3, 2, 0) - for i = 2, 16, 1 do - r.TrackFX_SetPinMappings(LT_Track, FX_Idx - 1, 0, i, 0, 0) - end - --sets Output to all channels - r.TrackFX_SetPinMappings(LT_Track, FX_Idx - 1, 1, 0, 21845, 0) - r.TrackFX_SetPinMappings(LT_Track, FX_Idx - 1, 1, 1, 43690, 0) - for i = 2, 16, 1 do - r.TrackFX_SetPinMappings(LT_Track, FX_Idx - 1, 1, i, 0, 0) - end - elseif FX_Layr_Inst > 1 then - - end - - - - - FX_Idx_OpenedPopup = nil - r.ImGui_CloseCurrentPopup(ctx) - if val & 4 ~= 0 then - reaper.SNM_SetIntConfigVar("fxfloat_focus", val|4) -- re-enable Auto-float - end - elseif r.ImGui_Selectable(ctx, 'Add Band Split') then - - r.gmem_attach('FXD_BandSplit') - table.insert(AddFX.Name, 'FXD Saike BandSplitter') - table.insert(AddFX.Pos, FX_Idx) - table.insert(AddFX.Name, 'FXD Band Joiner') - table.insert(AddFX.Pos, FX_Idx + 1) - if r.GetMediaTrackInfo_Value(LT_Track, 'I_NCHAN') < 12 then -- Set track channels to 10 if it's lower than 10 - r.SetMediaTrackInfo_Value(LT_Track, 'I_NCHAN', 12) - end - - FX_Idx_OpenedPopup = nil - --r.TrackFX_AddByName(LT_Track, 'FXD Bandjoiner', 0, -1000-FX_Idx) - end - - - Dvdr.Spc_Hover[TblIdxForSpace] = Dvdr_Hvr_W - --Dvdr.Clr[ClrLbl] = 0x999999ff - - if IsLBtnClicked then FX_Idx_OpenedPopup = nil end - if CloseAddFX_Popup then r.ImGui_CloseCurrentPopup(ctx) CloseAddFX_Popup = nil end - r.ImGui_EndPopup(ctx) - else - Dvdr.Clr[ClrLbl] = 0x131313ff - end - - - reaper.ImGui_EndChildFrame(ctx) - end - end - r.ImGui_PopStyleColor(ctx) - local FXGUID_FX_Idx = r.TrackFX_GetFXGUID(LT_Track, FX_Idx - 1) - - function MoveFX(DragFX_ID, FX_Idx, isMove, AddLastSpace) - local AltDest, AltDestLow, AltDestHigh, DontMove - - if SpcInPost then SpcIsInPre = false end - - if SpcIsInPre then - if not tablefind(Trk[TrkID].PreFX, FXGUID[DragFX_ID]) then -- if fx is not in pre fx - if SpaceIsBeforeRackMixer == 'End of PreFX' then - table.insert(Trk[TrkID].PreFX, #Trk[TrkID].PreFX + 1, FXGUID[DragFX_ID]) - r.TrackFX_CopyToTrack(LT_Track, DragFX_ID, LT_Track, FX_Idx + 1, true) - DontMove = true - else - table.insert(Trk[TrkID].PreFX, FX_Idx + 1, FXGUID[DragFX_ID]) - end - else -- if fx is in pre fx - local offset = 0 - if r.TrackFX_AddByName(LT_Track, 'FXD Macros', 0, 0) ~= -1 then offset = -1 end - if FX_Idx < DragFX_ID then -- if drag towards left - table.remove(Trk[TrkID].PreFX, DragFX_ID + 1 + offset) - table.insert(Trk[TrkID].PreFX, FX_Idx + 1 + offset, FXGUID[DragFX_ID]) - elseif SpaceIsBeforeRackMixer == 'End of PreFX' then - table.insert(Trk[TrkID].PreFX, #Trk[TrkID].PreFX + 1, FXGUID[DragFX_ID]) - table.remove(Trk[TrkID].PreFX, DragFX_ID + 1 + offset) - --move fx down - else - table.insert(Trk[TrkID].PreFX, FX_Idx + 1 + offset, FXGUID[DragFX_ID]) - table.remove(Trk[TrkID].PreFX, DragFX_ID + 1 + offset) - end - end - - for i, v in pairs(Trk[TrkID].PreFX) do - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: PreFX ' .. - i, v, true) - end - if tablefind(Trk[TrkID].PostFX, FXGUID[DragFX_ID]) then - table.remove(Trk[TrkID].PostFX, tablefind(Trk[TrkID].PostFX, FXGUID[DragFX_ID])) - end - FX.InLyr[FXGUID[DragFX_ID]] = nil - elseif SpcInPost then - local offset - - if r.TrackFX_AddByName(LT_Track, 'FXD Macros', 0, 0) == -1 then offset = -1 else offset = 0 end - - if not tablefind(Trk[TrkID].PostFX, FXGUID[DragFX_ID]) then -- if fx is not yet in post-fx chain - InsertToPost_Src = DragFX_ID + offset + 1 - - InsertToPost_Dest = SpcIDinPost - - - if tablefind(Trk[TrkID].PreFX, FXGUID[DragFX_ID]) then - table.remove(Trk[TrkID].PreFX, tablefind(Trk[TrkID].PreFX, FXGUID[DragFX_ID])) - end - else -- if fx is already in post-fx chain - local IDinPost = tablefind(Trk[TrkID].PostFX, FXGUID[DragFX_ID]) - if SpcIDinPost <= IDinPost then -- if drag towards left - table.remove(Trk[TrkID].PostFX, IDinPost) - table.insert(Trk[TrkID].PostFX, SpcIDinPost, FXGUID[DragFX_ID]) - table.insert(MovFX.ToPos, FX_Idx + 1) - else - table.insert(Trk[TrkID].PostFX, SpcIDinPost, Trk[TrkID].PostFX[IDinPost]) - table.remove(Trk[TrkID].PostFX, IDinPost) - table.insert(MovFX.ToPos, FX_Idx) - end - DontMove = true - table.insert(MovFX.FromPos, DragFX_ID) - end - FX.InLyr[FXGUID[DragFX_ID]] = nil - else -- if space is not in pre or post - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: PreFX ' .. DragFX_ID, '', true) - if not MoveFromPostToNorm then - if tablefind(Trk[TrkID].PreFX, FXGUID[DragFX_ID]) then - table.remove(Trk[TrkID].PreFX, - tablefind(Trk[TrkID].PreFX, FXGUID[DragFX_ID])) - end - end - if tablefind(Trk[TrkID].PostFX, FXGUID[DragFX_ID]) then - table.remove(Trk[TrkID].PostFX, - tablefind(Trk[TrkID].PostFX, FXGUID[DragFX_ID])) - end - end - for i = 1, #Trk[TrkID].PostFX + 1, 1 do - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: PostFX ' .. i, Trk[TrkID].PostFX[i] or '', true) - end - for i = 1, #Trk[TrkID].PreFX + 1, 1 do - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: PreFX ' .. i, Trk[TrkID].PreFX[i] or '', true) - end - if not DontMove then - if FX_Idx ~= RepeatTimeForWindows and SpaceIsBeforeRackMixer ~= 'End of PreFX' then - --[[ if ((FX.Win_Name_S[FX_Idx]or''):find('Pro%-Q 3') or (FX.Win_Name_S[FX_Idx]or''):find('Pro%-C 2')) and not tablefind (Trk[TrkID].PreFX, FXGUID[FX_Idx]) then - AltDestLow = FX_Idx-1 - end ]] - if (FX.Win_Name_S[FX_Idx] or ''):find('Pro%-C 2') then - AltDestHigh = FX_Idx - 1 - end - FX_Idx = tonumber(FX_Idx) - DragFX_ID = tonumber(DragFX_ID) - - if FX_Idx > DragFX_ID then offset = 1 end - - - table.insert(MovFX.ToPos, AltDestLow or FX_Idx - (offset or 0)) - table.insert(MovFX.FromPos, DragFX_ID) - elseif FX_Idx == RepeatTimeForWindows and AddLastSpace == 'LastSpc' or SpaceIsBeforeRackMixer == 'End of PreFX' then - local offset - - if Trk[TrkID].PostFX[1] then offset = #Trk[TrkID].PostFX end - table.insert(MovFX.ToPos, FX_Idx - (offset or 0)) - table.insert(MovFX.FromPos, DragFX_ID) - else - table.insert(MovFX.ToPos, FX_Idx - (offset or 0)) - table.insert(MovFX.FromPos, DragFX_ID) - end - end - if isMove == false then - NeedCopyFX = true - DropPos = FX_Idx - end - end - - function MoveFXwith1PreFXand1PosFX(DragFX_ID, FX_Idx, Undo_Lbl) - r.Undo_BeginBlock() - table.remove(Trk[TrkID].PreFX, tablefind(Trk[TrkID].PreFX, FXGUID[DragFX_ID])) - for i = 1, #Trk[TrkID].PreFX + 1, 1 do - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: PreFX ' .. i, Trk[TrkID].PreFX[i] or '', true) - end - table.remove(Trk[TrkID].PostFX, tablefind(Trk[TrkID].PostFX, FXGUID[DragFX_ID])) - for i = 1, #Trk[TrkID].PostFX + 1, 1 do - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: PostFX ' .. i, Trk[TrkID].PostFX[i] or '', true) - end - if FX_Idx ~= RepeatTimeForWindows then - if DragFX_ID > FX_Idx then - table.insert(MovFX.FromPos, DragFX_ID) - table.insert(MovFX.ToPos, FX_Idx) - table.insert(MovFX.FromPos, DragFX_ID) - table.insert(MovFX.ToPos, FX_Idx) - table.insert(MovFX.FromPos, DragFX_ID + 1) - table.insert(MovFX.ToPos, FX_Idx + 2) - - - --[[ r.TrackFX_CopyToTrack( LT_Track, DragFX_ID, LT_Track, FX_Idx, true ) - r.TrackFX_CopyToTrack( LT_Track, DragFX_ID, LT_Track, FX_Idx, true ) - r.TrackFX_CopyToTrack( LT_Track, DragFX_ID+1, LT_Track, FX_Idx+2, true ) ]] - elseif FX_Idx > DragFX_ID then - table.insert(MovFX.FromPos, DragFX_ID) - table.insert(MovFX.ToPos, FX_Idx - 1) - table.insert(MovFX.FromPos, DragFX_ID - 1) - table.insert(MovFX.ToPos, FX_Idx - 2) - table.insert(MovFX.FromPos, DragFX_ID - 1) - table.insert(MovFX.ToPos, FX_Idx - 1) - - --[[ r.TrackFX_CopyToTrack( LT_Track, DragFX_ID, LT_Track, FX_Idx-1 , true ) - r.TrackFX_CopyToTrack( LT_Track, DragFX_ID-1, LT_Track, FX_Idx-2 , true ) - r.TrackFX_CopyToTrack( LT_Track, DragFX_ID-1, LT_Track, FX_Idx-1 , true ) ]] - end - else - if AddLastSpace == 'LastSpc' then - r.TrackFX_CopyToTrack(LT_Track, DragFX_ID, LT_Track, FX_Idx, true) - r.TrackFX_CopyToTrack(LT_Track, DragFX_ID - 1, LT_Track, FX_Idx - 2, true) - end - end - r.Undo_EndBlock(Undo_Lbl, 0) - end - - function MoveFXwith1PreFX(DragFX_ID, FX_Idx, Undo_Lbl) - r.Undo_BeginBlock() - if FX_Idx ~= RepeatTimeForWindows then - if payload > FX_Idx then - r.TrackFX_CopyToTrack(LT_Track, payload, LT_Track, FX_Idx, true) - r.TrackFX_CopyToTrack(LT_Track, payload, LT_Track, FX_Idx, true) - elseif FX_Idx > payload then - r.TrackFX_CopyToTrack(LT_Track, payload, LT_Track, FX_Idx - 1, true) - r.TrackFX_CopyToTrack(LT_Track, payload - 1, LT_Track, FX_Idx - 2, true) - end - else - if AddLastSpace == 'LastSpc' then - r.TrackFX_CopyToTrack(LT_Track, payload, LT_Track, FX_Idx, true) - r.TrackFX_CopyToTrack(LT_Track, payload - 1, LT_Track, FX_Idx - 2, true) - end - end - r.Undo_EndBlock(Undo_Lbl, 0) - end - - --- if the space is in FX layer - if FX.InLyr[FXGUID_To_Check_If_InLayer] == FXGUID_RackMixer and SpaceIsBeforeRackMixer == false or AddLastSPCinRack == true then - Dvdr.Clr[ClrLbl] = Clr.Dvdr.In_Layer - FXGUID_of_DraggingFX = r.TrackFX_GetFXGUID(LT_Track, DragFX_ID or 0) - - if DragFX_ID == FX_Idx or DragFX_ID == FX_Idx - 1 and FX.InLyr[FXGUID_of_DraggingFX] == FXGUID[FX_Idx] then - Dvdr.Width[TblIdxForSpace] = 0 - else - if r.ImGui_BeginDragDropTarget(ctx) then - FxDroppingTo = FX_Idx - ----- Drag Drop FX ------- - dropped, payload = r.ImGui_AcceptDragDropPayload(ctx, 'FX_Drag') - if FxGUID == FXGUID[DragFX_ID] then - Dvdr.Width[TblIdxForSpace] = 0 - else - Dvdr.Width[TblIdxForSpace] = Df.Dvdr_Width - end - - r.ImGui_SameLine(ctx, 100, 10) - - - if dropped and Mods == 0 then - DropFXtoLayer(FX_Idx, LyrID) - Dvdr.Width[TblIdxForSpace] = 0 - FxDroppingTo = nil - elseif dropped and Mods == Apl then - DragFX_Src = DragFX_ID - - if DragFX_ID > FX_Idx then DragFX_Dest = FX_Idx - 1 else DragFX_Dest = FX_Idx end - DropToLyrID = LyrID - DroptoRack = FXGUID_RackMixer - --MoveFX(DragFX_Src, DragFX_Dest ,false ) - - Dvdr.Width[TblIdxForSpace] = 0 - FxDroppingTo = nil - end - ----------- Add FX --------------- - if Payload_Type == 'AddFX_Sexan' then - AddFX_Sexan(nil, ClrLbl) - end - - r.ImGui_EndDragDropTarget(ctx) - else - Dvdr.Width[TblIdxForSpace] = 0 - FxDroppingTo = nil - end - end - r.ImGui_SameLine(ctx, 100, 10) - elseif SpaceIsBeforeRackMixer == 'SpcInBS' then - if DragFX_ID == FX_Idx or DragFX_ID == FX_Idx - 1 and FX.InLyr[FXGUID_of_DraggingFX] == FXGUID[FX_Idx] then - Dvdr.Width[TblIdxForSpace] = 0 - else - if r.ImGui_BeginDragDropTarget(ctx) then - FxDroppingTo = FX_Idx - dropped, payload = r.ImGui_AcceptDragDropPayload(ctx, 'FX_Drag') - if FxGUID == FXGUID[DragFX_ID] then - Dvdr.Width[TblIdxForSpace] = 0 - else - Dvdr.Width[TblIdxForSpace] = Df.Dvdr_Width - end - - r.ImGui_SameLine(ctx, 100, 10) - local ContainerIdx = tablefind(FXGUID, FxGUID_Container) - local InsPos = math.min(FX_Idx - ContainerIdx + 1, #FX[FxGUID_Container].FXsInBS) - - - if dropped and Mods == 0 then - local ContainerIdx = tablefind(FXGUID, FxGUID_Container) - local InsPos = SetMinMax(FX_Idx - ContainerIdx + 1, 1, #FX[FxGUID_Container].FXsInBS) - - - - DropFXintoBS(FXGUID[DragFX_ID], FxGUID_Container, FX[FxGUID_Container].Sel_Band, - DragFX_ID, FX_Idx, 'DontMove') - Dvdr.Width[TblIdxForSpace] = 0 - FxDroppingTo = nil - - MoveFX(Payload, FX_Idx + 1, true) - elseif dropped and Mods == Apl then - DragFX_Src = DragFX_ID - - if DragFX_ID > FX_Idx then DragFX_Dest = FX_Idx - 1 else DragFX_Dest = FX_Idx end - DropToLyrID = LyrID - DroptoRack = FXGUID_RackMixer - --MoveFX(DragFX_Src, DragFX_Dest ,false ) - - Dvdr.Width[TblIdxForSpace] = 0 - FxDroppingTo = nil - end - -- Add from Sexan Add FX - if Payload_Type == 'AddFX_Sexan' then - AddFX_Sexan(FX_Idx, ClrLbl) - end - - r.ImGui_EndDragDropTarget(ctx) - else - Dvdr.Width[TblIdxForSpace] = 0 - FxDroppingTo = nil - end - end - else -- if Space is not in FX Layer - function MoveFX_Out_Of_BS() - for i = 0, Sel_Track_FX_Count - 1, 1 do - if FX[FXGUID[i]].FXsInBS then -- i is Band Splitter - table.remove(FX[FXGUID[i]].FXsInBS, tablefind(FX[FXGUID[i]].FXsInBS, FXGUID[DragFX_ID])) - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: FX is in which BS' .. FXGUID[DragFX_ID], - '', true) - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: FX is in which Band' .. FXGUID - [DragFX_ID], '', true) - end - end - FX[FXGUID[DragFX_ID]].InWhichBand = nil - end - - if r.ImGui_BeginDragDropTarget(ctx) then - if Payload_Type == 'FX_Drag' then - local allowDropNext, MoveFromPostToNorm, DontAllowDrop - local FX_Idx = FX_Idx - if Mods == Apl then allowDropNext = true end - - - - if tablefind(Trk[TrkID].PreFX, FXGUID[DragFX_ID]) and (not SpcIsInPre or SpaceIsBeforeRackMixer == 'End of PreFX') then allowDropNext = true end - if tablefind(Trk[TrkID].PostFX, FXGUID[DragFX_ID]) and (not SpcInPost or AddLastSpace == 'LastSpc') then - allowDropNext = true; MoveFromPostToNorm = true - end - if FX[FXGUID[DragFX_ID]].InWhichBand then allowDropNext = true end - if not FX[FXGUID[DragFX_ID]].InWhichBand and SpaceIsBeforeRackMixer == 'SpcInBS' then allowDropNext = true end - --[[ if (FX.Win_Name_S[DragFX_ID]or''):find('Pro%-C 2') then - FX_Idx = FX_Idx-1 - if (DragFX_ID == FX_Idx +1) or (DragFX_ID == FX_Idx-1) then DontAllowDrop = true end - end ]] - - if r.TrackFX_AddByName(LT_Track, 'FXD Macros', 0, 0) ~= -1 then offset = 0 else offset = 0 end - - if (DragFX_ID + offset == FX_Idx or DragFX_ID + offset == FX_Idx - 1) and SpaceIsBeforeRackMixer ~= true and FX.InLyr[FXGUID[DragFX_ID]] == nil and not SpcInPost and not allowDropNext - or (Trk[TrkID].PreFX[#Trk[TrkID].PreFX] == FXGUID[DragFX_ID] and SpaceIsBeforeRackMixer == 'End of PreFX') or DontAllowDrop then - r.ImGui_SameLine(ctx, nil, 0) - - Dvdr.Width[TblIdxForSpace] = 0 - r.ImGui_EndDragDropTarget(ctx) - else - HighlightSelectedItem(0xffffff22, nil, 0, L, T, R, B, h, w, 0, 0, 'GetItemRect', Foreground) - - - Dvdr.Clr[ClrLbl] = r.ImGui_GetStyleColor(ctx, r.ImGui_Col_Button()) - Dvdr.Width[TblIdxForSpace] = Df.Dvdr_Width - - dropped, payload = r.ImGui_AcceptDragDropPayload(ctx, 'FX_Drag') - FXGUID_To_Check_If_InLayer = r.TrackFX_GetFXGUID(LT_Track, DragFX_ID) - if dropped and Mods == 0 then - payload = tonumber(payload) - r.TrackFX_SetPinMappings(LT_Track, DragFX_ID, 0, 0, 1, 0) - r.TrackFX_SetPinMappings(LT_Track, DragFX_ID, 0, 1, 2, 0) - - r.TrackFX_SetPinMappings(LT_Track, DragFX_ID, 1, 0, 1, 0) - r.TrackFX_SetPinMappings(LT_Track, DragFX_ID, 1, 1, 2, 0) - - - if FX.Win_Name_S[payload]:find('Pro%-Q 3') and not tablefind(Trk[TrkID].PostFX, FXGUID[payload]) and not SpcInPost and not SpcIsInPre and not tablefind(Trk[TrkID].PreFX, FXGUID[DragFX_ID]) then - MoveFXwith1PreFX(DragFX_ID, FX_Idx, 'Move Pro-Q 3 and it\'s analyzer') - --[[ elseif FX.Win_Name_S[payload]:find('Pro%-C 2') and not tablefind(Trk[TrkID].PostFX, FXGUID[payload])and not SpcInPost and not SpcIsInPre then - MoveFXwith1PreFXand1PosFX(DragFX_ID,FX_Idx, 'Move Pro-C 2 and it\'s analyzer') ]] - else - MoveFX(payload, FX_Idx, true, nil) - end - - -- Move FX Out of BandSplit - if FX[FXGUID[DragFX_ID]].InWhichBand then - for i = 0, Sel_Track_FX_Count - 1, 1 do - if FX[FXGUID[i]].FXsInBS then -- i is Band Splitter - table.remove(FX[FXGUID[i]].FXsInBS, - tablefind(FX[FXGUID[i]].FXsInBS, FXGUID[DragFX_ID])) - r.GetSetMediaTrackInfo_String(LT_Track, - 'P_EXT: FX is in which BS' .. FXGUID[DragFX_ID], '', true) - r.GetSetMediaTrackInfo_String(LT_Track, - 'P_EXT: FX is in which Band' .. FXGUID[DragFX_ID], '', true) - end - end - FX[FXGUID[DragFX_ID]].InWhichBand = nil - end - - - -- Move FX Out of Layer - if Lyr.FX_Ins[FX.InLyr[FXGUID_To_Check_If_InLayer]] ~= nil then - Lyr.FX_Ins[FX.InLyr[FXGUID_To_Check_If_InLayer]] = Lyr.FX_Ins - [FX.InLyr[FXGUID_To_Check_If_InLayer]] - 1 - end - r.SetProjExtState(0, 'FX Devices', - 'FXLayer - ' .. 'is FX' .. FXGUID_To_Check_If_InLayer .. 'in layer', "") - FX.InLyr[FXGUID_To_Check_If_InLayer] = nil - Dvdr.JustDroppedFX = true - elseif dropped and Mods == Apl then - local copypos = FX_Idx + 1 - payload = tonumber(payload) - - if FX_Idx == 0 then copypos = 0 end - MoveFX(payload, copypos, false) - end - r.ImGui_SameLine(ctx, nil, 0) - end - elseif Payload_Type == 'FX Layer Repositioning' then -- FX Layer Repositioning - local FXGUID_RackMixer = r.TrackFX_GetFXGUID(LT_Track, DragFX_ID) - - local lyrFxInst - if Lyr[FXGUID_RackMixer] then - lyrFxInst = Lyr[FXGUID_RackMixer].HowManyFX - else - lyrFxInst = 0 - end - - - if (DragFX_ID - (math.max(lyrFxInst, 1)) <= FX_Idx and FX_Idx <= DragFX_ID + 1) or DragFX_ID - lyrFxInst == FX_Idx then - DontAllowDrop = true - reaper.ImGui_SameLine(ctx, nil, 0) - Dvdr.Width[TblIdxForSpace] = 0 - r.ImGui_EndDragDropTarget(ctx) - - --[[ ]] - Dvdr.Width[FX_Idx] = 0 - else --if dragging to an adequate space - Dvdr.Clr[ClrLbl] = r.ImGui_GetStyleColor(ctx, r.ImGui_Col_Button()) - dropped, payload = r.ImGui_AcceptDragDropPayload(ctx, 'FX Layer Repositioning') - Dvdr.Width[TblIdxForSpace] = 30 - - if dropped then - RepositionFXsInContainer(FX_Idx) - --r.Undo_EndBlock('Undo for moving FX layer',0) - end - end - elseif Payload_Type == 'BS_Drag' then - local Pl = tonumber(Payload) - - - if SpaceIsBeforeRackMixer == 'SpcInBS' or FX_Idx == Pl or Pl + (#FX[FXGUID[Pl]].FXsInBS or 0) + 2 == FX_Idx then - Dvdr.Width[TblIdxForSpace] = 0 - else - dropped, payload = r.ImGui_AcceptDragDropPayload(ctx, 'BS_Drag') - Dvdr.Width[TblIdxForSpace] = 30 - if dropped then - RepositionFXsInContainer(FX_Idx, Payload) - end - end - elseif Payload_Type == 'AddFX_Sexan' then - AddFX_Sexan(FX_Idx,ClrLbl) - r.ImGui_EndDragDropTarget(ctx) - end - else - Dvdr.Width[TblIdxForSpace] = 0 - Dvdr.Clr[ClrLbl] = 0x131313ff - reaper.ImGui_SameLine(ctx, nil, 0) - end - r.ImGui_SameLine(ctx, nil, 0) - end - return 10 + Dvdr.Width[TblIdxForSpace] + (Dvdr.Spc_Hover[TblIdxForSpace] or 0) - end - - RepeatTimeForWindows = Sel_Track_FX_Count - - MaxX, MaxY = reaper.ImGui_GetContentRegionMax(ctx) - framepadding = reaper.ImGui_StyleVar_FramePadding() - BorderSize = reaper.ImGui_StyleVar_FrameBorderSize() - FrameRounding = reaper.ImGui_StyleVar_FrameRounding() - BtnTxtAlign = reaper.ImGui_StyleVar_ButtonTextAlign() - - r.ImGui_PushStyleVar(ctx, framepadding, 0, 3) --StyleVar#1 (Child Frame for all FX Devices) - --r.ImGui_PushStyleColor(ctx, r.ImGui_Col_FrameBg(), 0x121212ff) - - - for FX_Idx = 0, RepeatTimeForWindows - 1, 1 do - FXGUID[FX_Idx] = r.TrackFX_GetFXGUID(LT_Track, FX_Idx) - local _, FX_Name = r.TrackFX_GetFXName(LT_Track, FX_Idx) - - if string.find(FX_Name, 'FXD %(Mix%)RackMixer') or string.find(FX_Name, 'FXRack') then - FXGUID_RackMixer = r.TrackFX_GetFXGUID(LT_Track, FX_Idx) - end - end - - - if FXGUID_RackMixer ~= nil then - Lyr.FX_Ins[FXGUID_RackMixer] = 0 - for FX_Idx = 0, RepeatTimeForWindows - 1, 1 do - if FX.InLyr[FXGUID[FX_Idx]] == FXGUID_RackMixer then - Lyr.FX_Ins[FXGUID_RackMixer] = Lyr.FX_Ins[FXGUID_RackMixer] + 1 - end - end - end - - - Glob.WDL = r.ImGui_GetWindowDrawList(ctx) - Glob.FDL = r.ImGui_GetForegroundDrawList(ctx) - if Dvdr.JustDroppedFX then - if not Dvdr.JustDrop.X then - Dvdr.JustDrop.X, Dvdr.JustDrop.Y = r.ImGui_GetMousePos(ctx) - end - local X, Y = r.ImGui_GetMousePos(ctx) - - if X > Dvdr.JustDrop.X + 15 or X < Dvdr.JustDrop.X - 15 then - Dvdr.JustDroppedFX = nil - Dvdr.JustDrop.X = nil - Dvdr.JustDrop.Y = nil - end - end - - - Trk[TrkID] = Trk[TrkID] or {} - Trk[TrkID].PreFX = Trk[TrkID].PreFX or {} - - - r.ImGui_PushStyleVar(ctx, reaper.ImGui_StyleVar_ChildBorderSize(), 0) - Cx_LeftEdge, Cy_BeforeFXdevices = r.ImGui_GetCursorScreenPos(ctx) - MouseAtLeftEdge = r.ImGui_IsMouseHoveringRect(ctx, Cx_LeftEdge - 50, Cy_BeforeFXdevices, Cx_LeftEdge + 5, - Cy_BeforeFXdevices + 220) - - if MouseAtLeftEdge and not Trk[TrkID].PreFX[1] and string.len(Payload_Type) > 1 then - rv = r.ImGui_Button(ctx, 'P\nr\ne\n \nF\nX\n \nC\nh\na\ni\nn', 20, 220) - SL(nil, 0) - HighlightSelectedItem(0xffffff22, 0xffffffff, -1, L, T, R, B, h, w, H_OutlineSc, V_OutlineSc, - 'GetItemRect', WDL) - - if Payload_Type == 'FX_Drag' then - dropped, payload = r.ImGui_AcceptDragDropPayload(ctx, 'FX_Drag') - r.ImGui_SameLine(ctx, nil, 0) - elseif Payload_Type == 'AddFX_Sexan' then - dropped, payload = r.ImGui_AcceptDragDropPayload(ctx, 'AddFX_Sexan') -- - end - end - - - if Trk[TrkID].PreFX[1] then - rv = r.ImGui_Button(ctx, (#Trk[TrkID].PreFX or '') .. '\n\n' .. 'P\nr\ne\n \nF\nX\n \nC\nh\na\ni\nn', 20, - 220) - r.ImGui_SameLine(ctx, nil, 0) - if r.ImGui_IsItemClicked(ctx, 1) then - if Trk[TrkID].PreFX_Hide then Trk[TrkID].PreFX_Hide = false else Trk[TrkID].PreFX_Hide = true end - end - end - - if r.ImGui_BeginDragDropTarget(ctx) then - if Payload_Type == 'FX_Drag' then - rv, payload = r.ImGui_AcceptDragDropPayload(ctx, 'FX_Drag') - HighlightSelectedItem(0xffffff22, 0xffffffff, -1, L, T, R, B, h, w, H_OutlineSc, V_OutlineSc, - 'GetItemRect', WDL) - - if rv then - if not tablefind(Trk[TrkID].PreFX, FXGUID[DragFX_ID]) then - table.insert(Trk[TrkID].PreFX, FXGUID[DragFX_ID]) - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: PreFX ' .. #Trk[TrkID].PreFX, - FXGUID[DragFX_ID], true) - end - - -- move fx out of post chain - local IDinPost = tablefind(Trk[TrkID].PostFX, FXGUID[DragFX_ID]) - if IDinPost then MoveFX_Out_Of_Post(IDinPost) end - - --Move FX out of layer - if FX.InLyr[FXGUID[DragFX_ID]] then - FX.InLyr[FXGUID[DragFX_ID]] = nil - r.SetProjExtState(0, 'FX Devices', 'FXLayer - ' .. 'is FX' .. FXGUID[DragFX_ID] .. 'in layer', - '') - end - RemoveFXfromBS() - end - elseif Payload_Type == 'AddFX_Sexan' then - dropped, payload = r.ImGui_AcceptDragDropPayload(ctx, 'AddFX_Sexan') -- - if dropped then - r.TrackFX_AddByName(LT_Track, payload, false, -1000) - local FxID = r.TrackFX_GetFXGUID(LT_Track, 0) - table.insert(Trk[TrkID].PreFX, FxID) - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: PreFX ' .. #Trk[TrkID].PreFX, FxID, true) - - for FX_Idx = 0, Sel_Track_FX_Count - 1, 1 do - FXGUID[FX_Idx] = r.TrackFX_GetFXGUID(LT_Track, FX_Idx) - end - end - end - - - - r.ImGui_EndDragDropTarget(ctx) - end - - - - Trk[TrkID].PostFX = Trk[TrkID].PostFX or {} - if ((DragDroppingFX and MouseAtRightEdge) and not Trk[TrkID].PostFX[1]) then - if Trk[TrkID].PreFX[1] then MakeSpaceForPostFX = 30 else MakeSpaceForPostFX = 0 end - elseif Trk[TrkID].PostFX_Hide and Trk[TrkID].PreFX[1] then - MakeSpaceForPostFX = 20 - else - MakeSpaceForPostFX = 0 - end - - - - MacroPos = r.TrackFX_AddByName(LT_Track, 'FXD Macros', 0, 0) - local ReSpectrumPos = r.TrackFX_AddByName(LT_Track, 'FXD ReSpectrum', 0, 0) - if MacroPos ~= -1 and MacroPos ~= 0 then -- if macro exists on track, and Macro is not the 1st fx - if FX.Win_Name[0] ~= 'JS: FXD Macros' then r.TrackFX_CopyToTrack(LT_Track, MacroPos, LT_Track, 0, true) end -- move it to 1st slot - end - - - - if MacroPos ~= -1 or ReSpectrumPos == 0 then offset = 0 else offset = 1 end -- if no Macros is found - - - for i, v in pairs(Trk[TrkID].PreFX or {}) do - if FXGUID[i - offset] ~= v then - if not AddFX.Name[1] then - table.insert(MovFX.FromPos, tablefind(FXGUID, v)) - table.insert(MovFX.ToPos, i - offset) - table.insert(MovFX.Lbl, 'Move FX into Pre-Chain') - end - end - end - offset = nil - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_ChildBg(), Window_BG or CustomColorsDefault.Window_BG) - - local spaceIfPreFX = 0 - if Trk[TrkID].PreFX[1] and Trk[TrkID].PostFX[1] and not Trk[TrkID].PostFX_Hide then spaceIfPreFX = 20 end - if Wheel_V ~= 0 and not DisableScroll then r.ImGui_SetNextWindowScroll(ctx, -CursorStartX + Wheel_V * 10, 0) end - - if r.ImGui_BeginChild(ctx, 'fx devices', MaxX - (PostFX_Width or 0) - spaceIfPreFX, 240, nil, r.ImGui_WindowFlags_HorizontalScrollbar() + FX_DeviceWindow_NoScroll) then - ------------------------------------------------------ - ----- Loop for every FX on the track ----------------- - ------------------------------------------------------ - - - CursorStartX = r.ImGui_GetCursorStartPos(ctx) - Glob.WinL, Glob.WinT = r.ImGui_GetCursorScreenPos(ctx) - Glob.Height = 220 - Glob.WinB = Glob.WinT + Glob.Height - AnySplitBandHvred = false - - - local ViewPort_DL = r.ImGui_GetWindowDrawList(ctx) - r.ImGui_DrawList_AddLine(ViewPort_DL, 0, 0, 0, 0, Clr.Dvdr.outline) -- Needed for drawlist to be active - - for FX_Idx = 0, Sel_Track_FX_Count - 1, 1 do - retval, FX_Name = r.TrackFX_GetFXName(LT_Track, FX_Idx) --i used to be i-1 - FXGUID[FX_Idx] = r.TrackFX_GetFXGUID(LT_Track, FX_Idx) - - - local FxGUID = FXGUID[FX_Idx] - FX.Win_Name[FX_Idx] = FX_Name - focusedFXState, trackNumOfFocusFX, _, FX_Index_FocusFX = reaper.GetFocusedFX2() - - if FXGUID[FX_Idx] then - FX[FxGUID] = FX[FxGUID] or {} - end - - - function GetFormatPrmV(V, OrigV, i) - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, i, V) - local _, RV = r.TrackFX_GetFormattedParamValue(LT_Track, FX_Idx, i) - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, i, OrigV) - return RV - end - - FXGUID_To_Check_If_InLayer = reaper.TrackFX_GetFXGUID(LT_Track, FX_Idx) - - if not tablefind(Trk[TrkID].PostFX, FxGUID) and FXGUID[FX_Idx] ~= FXGUID[FX_Idx - 1] then - if FX.InLyr[FXGUID_To_Check_If_InLayer] == nil --not in layer - and FindStringInTable(BlackListFXs, FX_Name) ~= true -- not blacklisted - and string.find(FX_Name, 'RackMixer') == nil - and FX_Idx ~= RepeatTimeForWindows --not last fx - and not FX[FxGUID].InWhichBand --[[Not in Band Split]] then - local Idx = FX_Idx - if FX_Idx == 1 then - local Nm = FX.Win_Name[0] - if Nm == 'JS: FXD Macros' or FindStringInTable(BlackListFXs, Nm) then Idx = 0 end - end - AddSpaceBtwnFXs(Idx) - elseif FX.InLyr[FXGUID_To_Check_If_InLayer] == FXGUID[FX_Idx] and FXGUID[FX_Idx] then - AddSpaceBtwnFXs(FX_Idx, true) - elseif FX_Idx == RepeatTimeForWindows then - end - end - - - ------------END Space between FXs-------------------- - - - - ---------------== FX Devices-------------------- - - DragFX_ID = DragFX_ID or -1000 - if DragDroppingFX == true and DragFX_ID == FX_Idx then - BGColor_FXWindow = FX_Window_Clr_When_Dragging - else - BGColor_FXWindow = FX_Window_Clr_Default - end - BGColor_FXWindow = BGColor_FXWindow or 0x434343ff - - - function createFXWindow(FX_Idx) - local FxGUID = r.TrackFX_GetFXGUID(LT_Track, FX_Idx) - - if FXGUID[FX_Idx] ~= FXGUID[FX_Idx - 1] --[[ findDuplicates(FXGUID) ]] and FxGUID then - r.ImGui_BeginGroup(ctx) - - FX.Enable[FX_Idx] = reaper.TrackFX_GetEnabled(LT_Track, FX_Idx) - local _, FX_Name = r.TrackFX_GetFXName(LT_Track, FX_Idx); local FxGUID = FXGUID[FX_Idx]; - local FxNameS = FX.Win_Name_S[FX_Idx] - local Hide - FX.DL = r.ImGui_GetWindowDrawList(ctx) - - - FX_Name = string.sub(FX_Name, 1, (string.find(FX_Name, '%(') or 30) - 1) - FX_Name = string.gsub(FX_Name, '-', ' ') - WDL = FX.DL - FX[FxGUID] = FX[FxGUID] or {} - if FX[FxGUID].MorphA and not FX[FxGUID].MorphHide then - local OrigCurX, OrigCurY = r.ImGui_GetCursorPos(ctx) - - DefClr_A_Act = Morph_A or CustomColorsDefault.Morph_A - DefClr_A = Change_Clr_A(DefClr_A_Act, -0.2) - DefClr_A_Hvr = Change_Clr_A(DefClr_A_Act, -0.1) - DefClr_B_Act = Morph_B or CustomColorsDefault.Morph_B - DefClr_B = Change_Clr_A(DefClr_B_Act, -0.2) - DefClr_B_Hvr = Change_Clr_A(DefClr_B_Act, -0.1) - - - function StoreAllPrmVal(AB, DontStoreCurrentVal, LinkCC) - local PrmCount = r.TrackFX_GetNumParams(LT_Track, FX_Idx) - for i = 0, PrmCount - 4, 1 do - local _, name = r.TrackFX_GetParamName(LT_Track, FX_Idx, i) - local Prm_Val, minval, maxval = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, i) - if AB == 'A' then - if DontStoreCurrentVal ~= 'Dont' then FX[FxGUID].MorphA[i] = Prm_Val end - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: FX Morph A' .. i .. FxGUID, - FX[FxGUID].MorphA[i], true) - if LinkCC then - Link_Param_to_CC(LT_TrackNum, FX_Idx, i, true, true, 160, - LinkCC, Prm_Val, FX[FxGUID].MorphB[i]) - end - else - if DontStoreCurrentVal ~= 'Dont' then FX[FxGUID].MorphB[i] = Prm_Val end - if FX[FxGUID].MorphB[i] then - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: FX Morph B' .. i .. - FxGUID, FX[FxGUID].MorphB[i], true) - if LinkCC then - Link_Param_to_CC(LT_TrackNum, FX_Idx, i, true, true, 160, - LinkCC, FX[FxGUID].MorphA[i], Prm_Val - FX[FxGUID].MorphA[i]) - end - end - end - end - if DontStoreCurrentVal ~= 'Dont' then - local rv, presetname = r.TrackFX_GetPreset(LT_Track, FX_Idx) - if rv and AB == 'A' then - FX[FxGUID].MorphA_Name = presetname - r.GetSetMediaTrackInfo_String(LT_Track, - 'P_EXT: FX Morph A' .. FxGUID .. 'Preset Name', presetname, true) - elseif rv and AB == 'B' then - FX[FxGUID].MorphB_Name = presetname - r.GetSetMediaTrackInfo_String(LT_Track, - 'P_EXT: FX Morph B' .. FxGUID .. 'Preset Name', presetname, true) - end - end - end - - r.ImGui_SetNextItemWidth(ctx, 20) - local x, y = r.ImGui_GetCursorPos(ctx) - x = x - 2 - local SCx, SCy = r.ImGui_GetCursorScreenPos(ctx) - SCx = SCx - 2 - r.ImGui_SetCursorPosX(ctx, x) - - --r.ImGui_PushStyleColor(ctx, r.ImGui_Col_Button(),DefClr_A) r.ImGui_PushStyleColor(ctx, r.ImGui_Col_ButtonHovered(), DefClr_A_Hvr) r.ImGui_PushStyleColor(ctx, r.ImGui_Col_ButtonActive(), DefClr_A_Act) - - if r.ImGui_Button(ctx, 'A##' .. FxGUID, 20, 20) then - StoreAllPrmVal('A', nil, FX[FxGUID].Morph_ID) - end - --r.ImGui_PopStyleColor(ctx,3) - - - if r.ImGui_IsItemHovered(ctx) and FX[FxGUID].MorphA_Name then - if FX[FxGUID].MorphA_Name ~= '' then - HintToolTip(FX[FxGUID].MorphA_Name) - end - end - - local H = 180 - r.ImGui_SetCursorPos(ctx, x, y + 20) - - r.ImGui_InvisibleButton(ctx, '##Morph' .. FxGUID, 20, H) - - local BgClrA, isActive, V_Pos, DrgSpdMod, SldrActClr, BtnB_TxtClr, ifHvr - local M = PresetMorph - - - if r.ImGui_IsItemActive(ctx) then - BgClr = r.ImGui_GetStyleColor(ctx, r.ImGui_Col_FrameBgActive()) - isActive = true - BgClrA = DefClr_A_Act - BgClrB = - DefClr_B_Act -- shift 0x00RRGGBB to 0xRRGGBB00 then add 0xFF for 100% opacity - elseif r.ImGui_IsItemHovered(ctx) then - ifHvr = true - BgClrA = DefClr_A_Hvr - BgClrB = DefClr_B_Hvr - else - BgClr = r.ImGui_GetStyleColor(ctx, r.ImGui_Col_FrameBg()) - BgClrA = DefClr_A - BgClrB = DefClr_B - end - if --[[Ctrl + R click]] r.ImGui_IsItemClicked(ctx, 1) and Mods == Ctrl then - r.ImGui_OpenPopup(ctx, 'Morphing menu' .. FX_Idx) - end - - - - - local L, T = r.ImGui_GetItemRectMin(ctx) - local R, B = r.ImGui_GetItemRectMax(ctx) - r.ImGui_DrawList_AddRectFilledMultiColor(WDL, L, T, R, B, BgClrA, BgClrA, DefClr_B, - DefClr_B) - - r.ImGui_SameLine(ctx, nil, 0) - - if isActive then - local _, v = r.ImGui_GetMouseDelta(ctx, nil, nil) - if Mods == Shift then DrgSpdMod = 4 end - DraggingMorph = FxGUID - FX[FxGUID].MorphAB_Sldr = SetMinMax( - (FX[FxGUID].MorphAB_Sldr or 0) + v / (DrgSpdMod or 2), 0, 100) - SldrActClr = r.ImGui_GetStyleColor(ctx, r.ImGui_Col_SliderGrabActive()) - if FX[FxGUID].MorphB[1] ~= nil then - local M_ID - if FX[FxGUID].Morph_ID then - r.TrackFX_SetParamNormalized(LT_Track, 0 --[[Macro.jsfx]], - 7 + FX[FxGUID].Morph_ID, FX[FxGUID].MorphAB_Sldr / 100) - else - for i, v in ipairs(FX[FxGUID].MorphA), FX[FxGUID].MorphA, -1 do - if v ~= FX[FxGUID].MorphB[i] then - if FX[FxGUID].PrmList[i] then - if FX[FxGUID].PrmList[i].BL ~= true then - Fv = v + - (FX[FxGUID].MorphB[i] - v) * - (FX[FxGUID].MorphAB_Sldr / 100) - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, i, Fv) - end - else - Fv = v + (FX[FxGUID].MorphB[i] - v) * - (FX[FxGUID].MorphAB_Sldr / 100) - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, i, Fv) - end - end - end - end - end - end - - --[[ if ifHvr then - - --r.ImGui_SetNextWindowPos(ctx,SCx+20, SCy+20) - r.ImGui_OpenPopup(ctx, 'Hover On Preset Morph Drag') - - M.JustHvrd = true - end - if M.JustHvrd then - - M.JustHvrd = nil - end ]] - - if r.ImGui_BeginPopup(ctx, 'Morphing menu' .. FX_Idx) then - local Disable - MorphingMenuOpen = true - if not FX[FxGUID].MorphA[1] or not FX[FxGUID].MorphB[1] then - r.ImGui_BeginDisabled( - ctx) - end - - if not FX[FxGUID].Morph_ID or FX[FxGUID].Unlink then - if r.ImGui_Selectable(ctx, 'Automate') then - r.gmem_attach('ParamValues') - - if not Trk[TrkID].Morph_ID then - Trk[TrkID].Morph_ID = {} -- Morph_ID is the CC number jsfx sends - Trk[TrkID].Morph_ID[1] = FxGUID - FX[FxGUID].Morph_ID = 1 - else - if not FX[FxGUID].Morph_ID then - table.insert(Trk[TrkID].Morph_ID, FxGUID) - FX[FxGUID].Morph_ID = tablefind(Trk[TrkID].Morph_ID, FxGUID) - end - end - - if --[[Add Macros JSFX if not found]] r.TrackFX_AddByName(LT_Track, 'FXD Macros', 0, 0) == -1 and r.TrackFX_AddByName(LT_Track, 'FXD Macros', 0, 0) == -1 then - r.gmem_write(1, PM.DIY_TrkID[TrkID]) --gives jsfx a guid when it's being created, this will not change becuase it's in the @init. - AddMacroJSFX() - end - for i, v in ipairs(FX[FxGUID].MorphA), FX[FxGUID].MorphA, -1 do - local Scale = FX[FxGUID].MorphB[i] - v - - if v ~= FX[FxGUID].MorphB[i] then - local function LinkPrm() - Link_Param_to_CC(LT_TrackNum, FX_Idx, i, true, true, 160, - FX[FxGUID].Morph_ID, v, Scale) - FX[FxGUID][i] = FX[FxGUID][i] or {} - r.GetSetMediaTrackInfo_String(LT_Track, - 'P_EXT: FXs Morph_ID' .. FxGUID, FX[FxGUID].Morph_ID, true) - end - - if FX[FxGUID].PrmList[i] then - if FX[FxGUID].PrmList[i].BL ~= true then - LinkPrm() - end - else - LinkPrm() - end - end - end - - - -- Show Envelope for Morph Slider - r.GetFXEnvelope(LT_Track, 0, 7 + FX[FxGUID].Morph_ID, true) - - - FX[FxGUID].Unlink = false - r.GetSetMediaTrackInfo_String(LT_Track, - 'P_EXT: FXs Morph_ID' .. FxGUID .. 'Unlink', '', true) - - SetPrmAlias(LT_TrackNum, 1, 8 + FX[FxGUID].Morph_ID, - FX.Win_Name_S[FX_Idx]:gsub("%b()", "") .. ' - Morph AB ') - end - elseif FX[FxGUID].Morph_ID or not FX[FxGUID].Unlink then - if r.ImGui_Selectable(ctx, 'Unlink Parameters to Morph Automation') then - for i, v in ipairs(FX[FxGUID].MorphA), FX[FxGUID].MorphA, -1 do - Unlink_Parm(LT_TrackNum, FX_Idx, i) - end - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: FXs Morph_ID' .. FxGUID, - FX[FxGUID].Morph_ID, true) - FX[FxGUID].Unlink = true - r.GetSetMediaTrackInfo_String(LT_Track, - 'P_EXT: FXs Morph_ID' .. FxGUID .. 'Unlink', 'Unlink', true) - end - end - - if FX[FxGUID].Morph_Value_Edit then - if r.ImGui_Selectable(ctx, 'EXIT Edit Preset Value Mode') then - FX[FxGUID].Morph_Value_Edit = false - end - else - if Disable then r.ImGui_BeginDisabled(ctx) end - if r.ImGui_Selectable(ctx, 'ENTER Edit Preset Value Mode') then - FX[FxGUID].Morph_Value_Edit = true - end - end - if not FX[FxGUID].MorphA[1] or not FX[FxGUID].MorphB[1] then r.ImGui_EndDisabled(ctx) end - - if r.ImGui_Selectable(ctx, 'Morphing Blacklist Settings') then - if OpenMorphSettings then - OpenMorphSettings = FxGUID - else - OpenMorphSettings = - FxGUID - end - local Ct = r.TrackFX_GetNumParams(LT_Track, FX_Idx) - FX[FxGUID].PrmList = FX[FxGUID].PrmList or {} - for i = 0, Ct - 4, 1 do --get param names - FX[FxGUID].PrmList[i] = FX[FxGUID].PrmList[i] or {} - local rv, name = r.TrackFX_GetParamName(LT_Track, FX_Idx, i) - FX[FxGUID].PrmList[i].Name = name - end - end - - if r.ImGui_Selectable(ctx, 'Hide Morph Slider') then - FX[FxGUID].MorphHide = true - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: FX Morph Hide' ..FxGUID, 'true', true) - end - - r.ImGui_EndPopup(ctx) - else - MorphingMenuOpen = false - end - - - - - if not ifHvr and M.JustHvrd then - M.timer = M.timer + 1 - else - M.timer = 0 - end - - - - - - V_Pos = T + (FX[FxGUID].MorphAB_Sldr or 0) / 100 * H * 0.95 - r.ImGui_DrawList_AddRectFilled(WDL, L, V_Pos, R, V_Pos + 10, 0xffffff22) - r.ImGui_DrawList_AddRect(WDL, L, V_Pos, R, V_Pos + 10, 0xffffff44) - - - r.ImGui_SameLine(ctx) - r.ImGui_SetCursorPos(ctx, x, y + 200) - if not FX[FxGUID].MorphB[1] then - BtnB_TxtClr = r.ImGui_GetStyleColor(ctx, - r.ImGui_Col_TextDisabled()) - end - - if BtnB_TxtClr then - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_Text(), - r.ImGui_GetStyleColor(ctx, r.ImGui_Col_TextDisabled())) - end - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_Button(), DefClr_B) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_ButtonHovered(), DefClr_B_Hvr) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_ButtonActive(), DefClr_B_Act) - - if r.ImGui_Button(ctx, 'B##' .. FxGUID, 20, 20) then - StoreAllPrmVal('B', nil, FX[FxGUID].Morph_ID) - local rv, presetname = r.TrackFX_GetPreset(LT_Track, FX_Idx) - if rv then FX[FxGUID].MorphB_Name = presetname end - end - if r.ImGui_IsItemHovered(ctx) and FX[FxGUID].MorphB_Name then - HintToolTip(FX[FxGUID] - .MorphB_Name) - end - r.ImGui_PopStyleColor(ctx, 3) - - if BtnB_TxtClr then r.ImGui_PopStyleColor(ctx) end - if FX.Enable[FX_Idx] == false then - r.ImGui_DrawList_AddRectFilled(WDL, L, T - 20, R, B + - 20, 0x00000088) - end - - r.ImGui_SetCursorPos(ctx, OrigCurX + 19, OrigCurY) - end - - local FX_Devices_Bg = FX_Devices_Bg - if string.find(FX_Name, 'Pro Q 3') then FX_Devices_Bg = 0x000000ff end - - -- FX window color - - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_ChildBg(), - FX.BgClr[FxGUID] or FX_Devices_Bg or 0x151515ff); local poptimes = 1 - - - FX[FxGUID] = FX[FxGUID] or {} - - local PrmCount = tonumber(select(2, r.GetProjExtState(0, 'FX Devices', 'Prm Count' .. FxGUID))) or 0 - - - local Def_Sldr_W = 160 - if FX.Def_Sldr_W[FxGUID] then Def_Sldr_W = FX.Def_Sldr_W[FxGUID] end - - if FX.Def_Type[FxGUID] == 'Slider' or FX.Def_Type[FxGUID] == 'Drag' or not FX.Def_Type[FxGUID] then - - local DF = (FX.Def_Sldr_W[FxGUID] or Df.Sldr_W) - - local Ct = math.max( math.floor ((PrmCount/6-0.01)) +1 , 1) - - DefaultWidth = (DF+ GapBtwnPrmColumns)* Ct - - - elseif FX.Def_Type[FxGUID] == 'Knob' then - - local Ct = math.max( math.floor ((PrmCount/3)-0.1) +1 ,1) -- need to -0.1 so flooring 3/3 -0.1 will return 0 and 3/4 -0.1 will be 1 - DefaultWidth = Df.KnobSize *Ct + GapBtwnPrmColumns - --[[ - if PrmCount <= 6 then - DefaultWidth = Df.KnobSize * 3 - elseif PrmCount > 6 and PrmCount <= 9 then - DefaultWidth = Df.KnobSize * 4 - elseif PrmCount > 9 and PrmCount <= 12 then - DefaultWidth = (Df.KnobSize + 10) * 4 - elseif PrmCount > 16 and PrmCount <= 20 then - DefaultWidth = Df.KnobSize * 5 - elseif PrmCount > 20 and PrmCount <= 24 then - DefaultWidth = Df.KnobSize * 6 - else - DefaultWidth = Df.Sldr_W + 10 - end ]] - end - - if string.find(FX_Name, 'Pro Q 3') then - FX.Width[FxGUID] = 340 - elseif string.find(FX_Name, 'Pro C 2') then - FX.Width[FxGUID] = ProC.Width - elseif FindStringInTable(BlackListFXs, FX_Name) then - Hide = true - elseif FX.Width[FxGUID] == 340 then - FX.Width[FxGUID] = nil - end - - if Trk[TrkID].PreFX_Hide then - if FindStringInTable(Trk[TrkID].PreFX, FxGUID) then - Hide = true - end - if Trk[TrkID].PreFX[FX_Idx + 1] == FxGUID then - Hide = true - end - end - if not Hide then - local CurPosX - if FxGUID == FXGUID[(tablefind(Trk[TrkID].PostFX, FxGUID) or 0) - 1] then - --[[ CurPosX = r.ImGui_GetCursorPosX(ctx) - r.ImGui_SetCursorPosX(ctx,VP.X+VP.w- (FX[FxGUID].PostWin_SzX or 0)) ]] - end - if r.ImGui_BeginChild(ctx, FX_Name .. FX_Idx, FX.WidthCollapse[FxGUID] or FX.Width[FXGUID[FX_Idx]] or DefaultWidth or 220, 220, nil, r.ImGui_WindowFlags_NoScrollWithMouse() +r.ImGui_WindowFlags_NoScrollbar() ) and not Hide then ----START CHILD WINDOW------ - if Draw[FxNameS] ~= nil then - local D = Draw[FxNameS] - end - - - Glob.FDL = r.ImGui_GetForegroundDrawList(ctx) - - WDL = r.ImGui_GetWindowDrawList(ctx) - Win_L, Win_T = r.ImGui_GetItemRectMin(ctx); Win_W, Win_H = r.ImGui_GetItemRectSize( - ctx) - Win_R, _ = r.ImGui_GetItemRectMax(ctx); Win_B = Win_T + 220 - - if Draw.DrawMode[FxGUID] == true then - local D = Draw[FxNameS] - r.ImGui_DrawList_AddRectFilled(WDL, Win_L, Win_T, Win_R, Win_B, 0x00000033) - for i = 0, 220, LE.GridSize do - r.ImGui_DrawList_AddLine(WinDrawList, Win_L, - Win_T + i, Win_R, Win_T + i, 0x44444411) - end - for i = 0, FX.Width[FXGUID[FX_Idx]] or DefaultWidth, LE.GridSize do - r.ImGui_DrawList_AddLine(WinDrawList, Win_L + i, Win_T, Win_L + i, Win_B, 0x44444411) - end - if r.ImGui_IsMouseHoveringRect(ctx, Win_L, Win_T, Win_R, Win_B) and HvringItmSelector == nil and not Draw.SelItm and Draw.Time == 0 then - if Draw.Type == 'Text' then - r.ImGui_SetMouseCursor(ctx, - r.ImGui_MouseCursor_TextInput()) - end - if r.ImGui_IsMouseClicked(ctx,0) and Mods == 0 then - Draw.CurrentylDrawing = true - MsX_Start, MsY_Start = r.ImGui_GetMousePos(ctx); - CurX, CurY = r.ImGui_GetCursorScreenPos(ctx) - Win_MsX_Start = MsX_Start - CurX; Win_MsY_Start = MsY_Start - CurY + 3 - end - - if Draw.CurrentylDrawing then - - if IsLBtnHeld and Mods == 0 and MsX_Start then - MsX, MsY = r.ImGui_GetMousePos(ctx) - CurX, CurY = r.ImGui_GetCursorScreenPos(ctx) - Win_MsX = MsX - CurX; Win_MsY = MsY - CurY - - Rad = MsX - MsX_Start - if Rad < 0 then Rad = Rad * (-1) end - if Draw.Type == 'line' then - r.ImGui_DrawList_AddLine(WDL, MsX_Start, MsY_Start, MsX, MsY_Start, - Draw.clr) - elseif Draw.Type == 'V-line' then - r.ImGui_DrawList_AddLine(WDL, MsX_Start, MsY_Start, MsX_Start, MsY, Draw.clr) - elseif Draw.Type == 'rectangle' then - r.ImGui_DrawList_AddRect(WDL, MsX_Start, MsY_Start, MsX, MsY, - Draw.clr, Draw.Df_EdgeRound[FxGUID] or 0) - elseif Draw.Type == 'Picture' then - - r.ImGui_DrawList_AddRect(WDL, MsX_Start, MsY_Start, MsX, MsY,Draw.clr, Draw.Df_EdgeRound[FxGUID] or 0) - elseif Draw.Type == 'rect fill' then - r.ImGui_DrawList_AddRectFilled(WDL, MsX_Start, MsY_Start, MsX, MsY, - Draw.clr, Draw.Df_EdgeRound[FxGUID] or 0) - elseif Draw.Type == 'circle' then - reaper.ImGui_DrawList_AddCircle(WDL, MsX_Start, MsY_Start, Rad, - Draw.clr) - elseif Draw.Type == 'circle fill' then - r.ImGui_DrawList_AddCircleFilled(WDL, MsX_Start, MsY_Start, Rad, - Draw.clr) - elseif Draw.Type == 'Text' then - --r.ImGui_DrawList_AddTextEx(WDL, Font_Andale_Mono_20, 20 , MsX, MsY , Draw.clr, D.Txt) - r.ImGui_SetMouseCursor(ctx, r.ImGui_MouseCursor_TextInput()) - end - - end - - if r.ImGui_IsMouseReleased(ctx,0) and Mods == 0 and Draw.Type ~='Text' then - local D = Draw[FxNameS] - LE.BeenEdited = true - --find the next available slot in table - - if Draw.Type == 'circle' or Draw.Type == 'circle fill' then - table.insert(D.R, Rad) - else - table.insert(D.R, Win_MsX) - end - - table.insert(D.L, Win_MsX_Start); - table.insert(D.T, Win_MsY_Start);; - table.insert(D.Type, Draw.Type) - table.insert(D.B, Win_MsY) - table.insert(D.clr, Draw.clr or 0xffffffff) - if not Draw.SelItm then Draw.SelItm= #D.Type end - - end - - - - - if Draw.Type == 'Text' and IsLBtnClicked and Mods==0 then AddText = #D.Type+1 end - - end - end - HvringItmSelector = nil - if AddText then - r.ImGui_OpenPopup(ctx, 'Drawlist Add Text Menu') - end - - if r.ImGui_BeginPopup(ctx, 'Drawlist Add Text Menu') then - - r.ImGui_SetKeyboardFocusHere( ctx) - - enter, NewDrawTxt = r.ImGui_InputText(ctx, '##' .. 'DrawTxt', NewDrawTxt) - --r.ImGui_SetItemDefaultFocus( ctx) - - if r.ImGui_IsWindowAppearing( ctx) then - table.insert(D.L, Win_MsX_Start); - table.insert(D.T, Win_MsY_Start);; - table.insert(D.Type, Draw.Type) - table.insert(D.B, Win_MsY) - table.insert(D.clr, Draw.clr ) - - end - - - if AddText then - D.Txt[AddText]= NewDrawTxt - end - - if r.ImGui_IsItemDeactivatedAfterEdit(ctx) then - - D.Txt[#D.Txt]= NewDrawTxt - AddText = nil; - NewDrawTxt = nil - - - - r .ImGui_CloseCurrentPopup(ctx) - end - - r.ImGui_SetItemDefaultFocus(ctx) - - - - r.ImGui_EndPopup(ctx) - end - if LBtnRel then Draw.CurrentylDrawing = nil end - - if r.ImGui_IsMouseHoveringRect(ctx, Win_L, Win_T, Win_R, Win_B) and HvringItmSelector == nil then - if IsLBtnClicked then - Draw.SelItm = nil - Draw.Time = 1 - end - end - if Draw.Time > 0 then Draw.Time = Draw.Time + 1 end - if Draw.Time > 6 then Draw.Time = 0 end - - if Draw[FxNameS] then - - for i, Type in pairs(D.Type) do - local ID = FX_Name .. i - local CircleX, CircleY = Win_L + D.L[i], Win_T + D.T[i] - local FDL = r.ImGui_GetForegroundDrawList(ctx) - r.ImGui_DrawList_AddCircle(FDL, CircleX, CircleY, 7, 0x99999999) - r.ImGui_DrawList_AddText(FDL, Win_L + D.L[i] - 2, Win_T + D.T[i] - 7, 0x999999ff, i) - - - if Draw.SelItm == i then - r.ImGui_DrawList_AddCircleFilled(WDL, CircleX, - CircleY, 7, 0x99999955) - end - - - --if hover on item node ... - if r.ImGui_IsMouseHoveringRect(ctx, CircleX - 5, CircleY - 5, CircleX + 5, CircleY + 10) then - HvringItmSelector = true - r.ImGui_SetMouseCursor(ctx, r.ImGui_MouseCursor_ResizeAll()) - if DragItm == nil then - r.ImGui_DrawList_AddCircle(WDL, CircleX, CircleY,9, 0x999999ff) - end - if IsLBtnClicked and Mods == 0 then - Draw.SelItm = i - DragItm = i - end - - - if IsLBtnClicked and Mods == Alt then - table.remove(D.Type, i) - table.remove(D.L, i) - table.remove(D.R, i) - table.remove(D.T, i) - table.remove(D.B, i) - if D.Txt[i] then table.remove(D.Txt,SetMinMax( i, 1, #D.Txt )) end - if D.clr[i] then table.remove(D.clr,SetMinMax( i, 1, #D.clr )) end - if r.ImGui_BeginPopup(ctx, 'Drawlist Add Text Menu') then - r.ImGui_CloseCurrentPopup(ctx) - r.ImGui_EndPopup(ctx) - end - end - end - - if not IsLBtnHeld then DragItm = nil end - if LBtnDrag and DragItm == i then --- Drag node to reposition - r.ImGui_SetMouseCursor(ctx, r.ImGui_MouseCursor_ResizeAll()) - r.ImGui_DrawList_AddCircleFilled(WDL, CircleX, CircleY, 7, 0x00000033) - local Dx, Dy = r.ImGui_GetMouseDelta(ctx) - if D.Type[DragItm] ~= 'circle' and D.Type[DragItm] ~= 'circle fill' then - D.R[i] = D.R[i] + Dx -- this is circle's radius - end - D.L[i] = D.L[i] + Dx - D.T[i] = D.T[i] + Dy - D.B[i] = D.B[i] + Dy - end - end - end - end - - if Draw[FX.Win_Name_S[FX_Idx]] and not FX[FxGUID].Collapse then - local D = Draw[FX.Win_Name_S[FX_Idx]] - for i, Type in pairs(D.Type) do - D[i] = D[i] or {} - local L = Win_L + D.L[i] - local T = Win_T + D.T[i] - local R = Win_L + (D.R[i] or 0) - local B = Win_T + D.B[i] - local Round = Draw.Df_EdgeRound[FxGUID] or 0 - - if D.Type[i] == 'line' then - - r.ImGui_DrawList_AddLine(WDL, L, T, R, T, D.clr[i] or 0xffffffff) - elseif D.Type[i] == 'V-line' then - - r.ImGui_DrawList_AddLine(WDL, Win_L + D.L[i], Win_T + D.T[i], - Win_L + D.L[i], Win_T + D.B[i], D.clr[i] or 0xffffffff) - elseif D.Type[i] == 'rectangle' then - r.ImGui_DrawList_AddRect(WDL, L, T, R, B, D.clr[i] or 0xffffffff, Round) - elseif D.Type[i] == 'rect fill' then - r.ImGui_DrawList_AddRectFilled(WDL, L, T, R, B, D.clr[i] or 0xffffffff, Round) - elseif D.Type[i] == 'circle' then - r.ImGui_DrawList_AddCircle(WDL, L, T, D.R[i], D.clr[i] or 0xffffffff) - elseif D.Type[i] == 'circle fill' then - r.ImGui_DrawList_AddCircleFilled(WDL, L, T, D.R[i], D.clr[i] or 0xffffffff) - elseif D.Type[i] == 'Text' and D.Txt[i] then - r.ImGui_DrawList_AddTextEx(WDL, D[i].Font or Font_Andale_Mono_13, D[i].FtSize or 13, L, T, D.clr[i] or 0xffffffff, D.Txt[i]) - elseif D.Type[i] == 'Picture' then - - if not D[i].Image then - r.ImGui_DrawList_AddRectFilled(WDL, L, T, R, B, 0xffffff33, Round) - r.ImGui_DrawList_AddTextEx(WDL, nil, 12, L,T+ (B-T)/2, 0xffffffff, 'Add Image path', R-L) - - else - if D[i].KeepImgRatio then - local w, h = r.ImGui_Image_GetSize(D[i].Image) - - local H_ratio = w / h - local size = R - L - - - r.ImGui_DrawList_AddImage(WDL, D[i].Image, L, T, L + size, - T + size * H_ratio, 0, 0, 1, 1, D.clr[i] or 0xffffffff) - else - r.ImGui_DrawList_AddImageQuad(WDL, D[i].Image, L, T, R, T, R, B, L, B, - _1, _2, _3, _4, _5, _6, _7, _8, D.clr[i] or 0xffffffff) - end - end - -- ImageAngle(ctx, Image, 0, R - L, B - T, L, T) - end - end - end - - - - if FX.LayEdit == FxGUID and Draw.DrawMode[FxGUID] ~= true and Mods~= Apl then -- Resize FX or title btn - MouseX, MouseY = r.ImGui_GetMousePos(ctx) - Win_L, Win_T = r.ImGui_GetItemRectMin(ctx) - Win_R, _ = r.ImGui_GetItemRectMax(ctx); Win_B = Win_T + 220 - WinDrawList = r.ImGui_GetWindowDrawList(ctx) - r.ImGui_DrawList_AddRectFilled(WinDrawList, Win_L or 0, Win_T or 0, Win_R or 0, - Win_B, 0x00000055) - --draw grid - - if r.ImGui_IsKeyPressed(ctx, r.ImGui_Key_Equal()) then - LE.GridSize = LE.GridSize + 5 - elseif r.ImGui_IsKeyPressed(ctx, r.ImGui_Key_Minus()) then - LE.GridSize = LE.GridSize - 5 - end - - for i = 0, FX.Width[FXGUID[FX_Idx]] or DefaultWidth, LE.GridSize do - r - .ImGui_DrawList_AddLine(WinDrawList, Win_L + i, Win_T, Win_L + i, Win_B, - 0x44444455) - end - for i = 0, 220, LE.GridSize do - r.ImGui_DrawList_AddLine(WinDrawList, Win_L, - Win_T + i, Win_R, Win_T + i, 0x44444455) - end - - r.ImGui_DrawList_AddLine(WinDrawList, Win_R - 3, Win_T, Win_R - 3, Win_B, - 0x66666677, 1) - - - if r.ImGui_IsMouseHoveringRect(ctx, Win_R - 5, Win_T, Win_R + 5, Win_B) then - r.ImGui_DrawList_AddLine(WinDrawList, Win_R - 3, Win_T, Win_R - 3, Win_B, - 0xffffffff, 3) - r.ImGui_SetMouseCursor(ctx, r.ImGui_MouseCursor_ResizeEW()) - - if IsLBtnClicked then - LE.ResizingFX = FX_Idx --@Todo change fxidx to fxguid - end - end - - - if LE.ResizingFX == FX_Idx and IsLBtnHeld then - r.ImGui_SetMouseCursor(ctx, r.ImGui_MouseCursor_ResizeEW()) - - r.ImGui_DrawList_AddRectFilled(WinDrawList, Win_L or 0, Win_T or 0, - Win_R or 0, Win_B, 0x00000055) - local MsDragDeltaX, MsDragDeltaY = r.ImGui_GetMouseDragDelta(ctx); local Dx, Dy = - r.ImGui_GetMouseDelta(ctx) - if not FX.Width[FXGUID[FX_Idx]] then FX.Width[FXGUID[FX_Idx]] = DefaultWidth end - FX.Width[FXGUID[FX_Idx]] = FX.Width[FXGUID[FX_Idx]] + Dx; LE.BeenEdited = true - end - if not IsLBtnHeld then LE.ResizingFX = nil end - end - - - if FX.Enable[FX_Idx] == nil then - FX.Enable[FX_Idx] = reaper.TrackFX_GetEnabled(LT_Track, FX_Idx) - end - - reaper.ImGui_SameLine(ctx, nil, 0) - if FX.LayEdit == FxGUID and Draw.DrawMode[FxGUID] ~= true then - r.ImGui_BeginDisabled(ctx); R, T = r.ImGui_GetItemRectMax(ctx) - end - - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_Button(), FX[FxGUID].TitleClr or 0x22222233) - if FX[FxGUID].TitleClr then - WinbtnClrPop = 3 - if not FX[FxGUID].TitleClrHvr then - FX[FxGUID].TitleClrAct, FX[FxGUID].TitleClrHvr = Generate_Active_And_Hvr_CLRs( - FX[FxGUID].TitleClr) - end - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_ButtonHovered(), - FX[FxGUID].TitleClrHvr or 0x22222233) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_ButtonActive(), - FX[FxGUID].TitleClrAct or 0x22222233) - else - WinbtnClrPop = 1 - end - - - - local WindowBtn - --[[ r.ImGui_PushStyleColor(ctx, ) ]] - if FX[FxGUID].Collapse ~= true then - if string.find(FX_Name, 'Pro Q 3') ~= nil then - WindowBtn = r.ImGui_Button(ctx, 'Pro-Q 3' .. '##', 60, 20) -- create window name button - ProQ_TitlePosX_L, ProQ_TitlePosY_T = reaper.ImGui_GetItemRectMin(ctx) - ProQ_TitlePosX_R, ProQ_TitlePosY_B = reaper.ImGui_GetItemRectMax(ctx) - elseif string.find(FX_Name, 'Pro C 2') ~= nil then - WindowBtn = reaper.ImGui_Button(ctx, 'Pro-C 2' .. '##', 60, 20) -- create window name button - else - if DebugMode then - FX.Win_Name[FX_Idx] = FxGUID - WindowBtn = reaper.ImGui_Button(ctx, FxGUID .. '## ', - FX.TitleWidth[FxGUID] or DefaultWidth - 30, 20) -- create window name button - else - WindowBtn = r.ImGui_Button(ctx, - (FX[FxGUID].CustomTitle or FX.Win_Name[FX_Idx] or '') .. '## ', - FX.TitleWidth[FxGUID] or DefaultWidth - 30, 20) -- create window name button - end - end - if r.ImGui_IsItemHovered(ctx) and FindStringInTable(SpecialLayoutFXs, FX_Name) == false then - FX[FxGUID].TtlHvr = true - TtlR, TtlB = r.ImGui_GetItemRectMax(ctx) - if r.ImGui_IsMouseHoveringRect(ctx, TtlR - 20, TtlB - 20, TtlR, TtlB) then - r.ImGui_DrawList_AddRectFilled(WDL, TtlR, TtlB, TtlR - 20, TtlB - 20, - getClr(r.ImGui_Col_ButtonHovered())) - r.ImGui_DrawList_AddRect(WDL, TtlR, TtlB, TtlR - 20, TtlB - 19, - getClr(r.ImGui_Col_Text())) - r.ImGui_DrawList_AddTextEx(WDL, Font_Andale_Mono_20_B, 20, TtlR - 15, - TtlB - 20, getClr(r.ImGui_Col_Text()), '+') - if IsLBtnClicked then - r.ImGui_OpenPopup(ctx, 'Add Parameter' .. FxGUID) - r.ImGui_SetNextWindowPos(ctx, TtlR, TtlB) - AddPrmPopupOpen = FxGUID - end - end - else - FX[FxGUID].TtlHvr = nil - end - else -- if collapsed - FX.WidthCollapse[FxGUID] = 27 - - local Name = ChangeFX_Name(FX_Name) - - local Name = Name:gsub('%S+', { ['Valhalla'] = "", ['FabFilter'] = "" }) - local Name = Name:gsub('-', '|') - --if Name:find('FabFilter Pro%-C 2') then Name = 'Pro|C 2' end - local Name_V = Name:gsub("(.)", "%1\n") - local Name_V_NoManuFacturer = Name_V:gsub("%b()", "") - reaper.ImGui_PushStyleVar(ctx, BtnTxtAlign, 0.5, 0.2) --StyleVar#3 - r.ImGui_SameLine(ctx, nil, 0) - - WindowBtn = r.ImGui_Button(ctx, Name_V_NoManuFacturer, 25, 220) - - - r.ImGui_PopStyleVar(ctx) --StyleVar#3 POP - end - r.ImGui_PopStyleColor(ctx, WinbtnClrPop) -- win btn clr - HighlightSelectedItem(nil, 0xffffff11, -1, L, T, R, B, h, w, 1, 1, 'GetItemRect', WDL, FX.Round[FxGUID] --[[rounding]]) - - - r.ImGui_SetNextWindowSizeConstraints(ctx, AddPrmWin_W or 50, 50, 9999, 500) - local R_ClickOnWindowBtn = r.ImGui_IsItemClicked(ctx, 1) - local L_ClickOnWindowBtn = r.ImGui_IsItemClicked(ctx) - - if R_ClickOnWindowBtn and Mods == Ctrl then - r.ImGui_OpenPopup(ctx, 'Fx Module Menu') - elseif R_ClickOnWindowBtn and Mods == 0 then - FX[FxGUID].Collapse = toggle(FX[FxGUID].Collapse) - if not FX[FxGUID].Collapse then FX.WidthCollapse[FxGUID] = nil end - elseif R_ClickOnWindowBtn and Mods == Alt then - -- check if all are collapsed - - - BlinkFX = ToggleCollapseAll() - elseif WindowBtn and Mods == 0 then - openFXwindow(LT_Track, FX_Idx) - elseif WindowBtn and Mods == Shift then - ToggleBypassFX(LT_Track, FX_Idx) - elseif WindowBtn and Mods == Alt then - DeleteFX(FX_Idx) - end - - if r.ImGui_IsItemHovered(ctx) then - HintMessage = - 'Mouse: L=Open FX Window | Shift+L = Toggle Bypass | Alt+L = Delete | R = Collapse | Alt+R = Collapse All' - end - - - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_Border(), getClr(r.ImGui_Col_FrameBg())) - - - -- Add Prm popup - PrmFilter = r.ImGui_CreateTextFilter(PrmFilterTxt) - if r.ImGui_BeginPopup(ctx, 'Add Parameter' .. FxGUID, r.ImGui_WindowFlags_AlwaysVerticalScrollbar()) then - local CheckBox, rv = {}, {} - if r.ImGui_Button(ctx, 'Add all parameters', -1) then - - for i = 1, r.TrackFX_GetNumParams(LT_Track, FX_Idx), 1 do - local P_Name = select(2, r.TrackFX_GetParamName(LT_Track, FX_Idx, i - 1)) - CheckBox[i - 1] = true - if not IsPrmAlreadyAdded() then - StoreNewParam(FxGUID, P_Name, i - 1, FX_Idx, true) - SyncTrkPrmVtoActualValue() - end - end - end - - - AddPrmPopupOpen = FxGUID - if not PrmFilterTxt then AddPrmWin_W, AddPrmWin_H = r.ImGui_GetWindowSize(ctx) end - r.ImGui_SetWindowSize(ctx, 500, 500, condIn) - - local Ct = r.TrackFX_GetNumParams(LT_Track, FX_Idx) - - - r.ImGui_SetNextItemWidth(ctx, 60) - - if not FX[FxGUID].NotFirstOpenPrmWin then - r.ImGui_SetKeyboardFocusHere(ctx,offsetIn) - end - - if r.ImGui_TextFilter_Draw(PrmFilter, ctx, '##PrmFilterTxt', -1 - (SpaceForBtn or 0)) then - PrmFilterTxt = r.ImGui_TextFilter_Get(PrmFilter) - r.ImGui_TextFilter_Set(PrmFilter, PrmFilterTxt) - end - - for i = 1, Ct, 1 do - if FX[FxGUID][i] then - CheckBox[FX[FxGUID][i].Num] = true - end - end - - for i = 1, Ct, 1 do - local P_Name = select(2, r.TrackFX_GetParamName(LT_Track, FX_Idx, i - 1)) - if r.ImGui_TextFilter_PassFilter(PrmFilter, P_Name) then - rv[i], CheckBox[i - 1] = r.ImGui_Checkbox(ctx, (i - 1) .. '. ' .. P_Name, CheckBox[i - 1]) - if rv[i] then - local RepeatPrmFound - - for I = 1, Ct, 1 do - if FX[FxGUID][I] then - if FX[FxGUID][I].Num == i - 1 then RepeatPrmFound = I end - end - end - if RepeatPrmFound then - DeletePrm(FxGUID, RepeatPrmFound, FX_Idx) - else - StoreNewParam(FxGUID, P_Name, i - 1, FX_Idx, true) - SyncTrkPrmVtoActualValue() - end - end - end - end - FX[FxGUID].NotFirstOpenPrmWin = true - r.ImGui_EndPopup(ctx) - elseif AddPrmPopupOpen == FxGUID then - PrmFilterTxt = nil - FX[FxGUID].NotFirstOpenPrmWin = nil - end - - - r.ImGui_PopStyleColor(ctx) - - - if FX.LayEdit == FxGUID and Draw.DrawMode[FxGUID] ~= true then - local L, T = r.ImGui_GetItemRectMin(ctx); local R, _ = r.ImGui_GetItemRectMax( - ctx); B = T + 20 - r.ImGui_DrawList_AddCircleFilled(WinDrawList, R, T + 10, 3, 0x999999ff) - r.ImGui_DrawList_AddRect(WinDrawList, L, T, R, T + 20, 0x999999ff) - - if MouseX > L and MouseX < R and MouseY > T and MouseY < B then - r.ImGui_DrawList_AddRectFilled(WinDrawList, L, T, R, T + 20, 0x99999955) - if IsLBtnClicked then - LE.SelectedItem = 'Title' - LE.ChangingTitleSize = true - LE.MouseX_before, _ = r.ImGui_GetMousePos(ctx) - elseif IsRBtnClicked then - r.ImGui_OpenPopup(ctx, 'Fx Module Menu') - end - end - - if LE.SelectedItem == 'Title' then - r.ImGui_DrawList_AddRect(WinDrawList, L, T, R, - T + 20, 0x999999ff) - end - - if MouseX > R - 5 and MouseX < R + 5 and MouseY > T and MouseY < B then --if hover on right edge - if IsLBtnClicked then LE.ChangingTitleSize = true end - end - - if LBtnDrag and LE.ChangingTitleSize then - r.ImGui_SetMouseCursor(ctx, r.ImGui_MouseCursor_ResizeEW()) - DeltaX, DeltaY = r.ImGui_GetMouseDelta(ctx) - local AddedDelta = AddedDelta or 0 + DeltaX - LE.MouseX_after, _ = r.ImGui_GetMousePos(ctx) - local MouseDiff = LE.MouseX_after - LE.MouseX_before - - if FX.TitleWidth[FxGUID] == nil then - FX.TitleWidth[FxGUID] = DefaultWidth - - 30 - end - if Mods == 0 then - if MouseDiff > LE.GridSize then - FX.TitleWidth[FxGUID] = FX.TitleWidth[FxGUID] + LE.GridSize; LE.MouseX_before = - r.ImGui_GetMousePos(ctx); LE.BeenEdited = true - elseif MouseDiff < -LE.GridSize then - FX.TitleWidth[FxGUID] = FX.TitleWidth[FxGUID] - LE.GridSize; LE.MouseX_before = - r.ImGui_GetMousePos(ctx); LE.BeenEdited = true - end - end - if Mods == Shift then - FX.TitleWidth[FxGUID] = FX.TitleWidth[FxGUID] + DeltaX; LE.BeenEdited = true - end - end - if IsLBtnHeld == false then LE.ChangingTitleSize = nil end - - r.ImGui_EndDisabled(ctx) - end - - - - - - - - - if DebugMode and r.ImGui_IsItemHovered(ctx) then tooltip(FX_Idx) end - if DebugMode and r.ImGui_IsKeyDown(ctx, 84) then tooltip(TrkID) end - - - - - - --r.Undo_OnStateChangeEx(string descchange, integer whichStates, integer trackparm) -- @todo Detect FX deletion - - - - - - - if r.ImGui_BeginPopup(ctx, 'Fx Module Menu') then - if not FX[FxGUID].MorphA then - if r.ImGui_Button(ctx, 'Preset Morphing', 160) then - FX[FxGUID].MorphA = {} - FX[FxGUID].MorphB = {} - local PrmCount = r.TrackFX_GetNumParams(LT_Track, FX_Idx) - for i = 0, PrmCount - 4, 1 do - local Prm_Val, minval, maxval = reaper.TrackFX_GetParamNormalized( - LT_Track, FX_Idx, i) - FX[FxGUID].MorphA[i] = Prm_Val - r.GetSetMediaTrackInfo_String(LT_Track,'P_EXT: FX Morph A' .. i .. FxGUID, Prm_Val, true) - end - RestoreBlacklistSettings(FxGUID, FX_Idx, LT_Track, PrmCount) - --[[ r.SetProjExtState(r0oj, 'FX Devices', string key, string value) ]] - - r.ImGui_CloseCurrentPopup(ctx) - end - else - if not FX[FxGUID].MorphHide then - if r.ImGui_Button(ctx, 'Hide Morph Slider', 160) then - FX[FxGUID].MorphHide = true - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: FX Morph Hide' ..FxGUID, 'true', true) - r.ImGui_CloseCurrentPopup(ctx) - end - else - if r.ImGui_Button(ctx, 'Show Morph Slider', 160) then - FX[FxGUID].MorphHide = nil - r.ImGui_CloseCurrentPopup(ctx) - end - end - end - - r.ImGui_SameLine(ctx) - if not FX[FxGUID].MorphA then - r.ImGui_BeginDisabled(ctx) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_Text(), - getClr(r.ImGui_Col_TextDisabled())) - end - if IconBtn(20, 20, 'Y') then -- settings icon - if OpenMorphSettings then - OpenMorphSettings = FxGUID - else - OpenMorphSettings = - FxGUID - end - local Ct = r.TrackFX_GetNumParams(LT_Track, FX_Idx) - FX[FxGUID].PrmList = FX[FxGUID].PrmList or {} - for i = 0, Ct - 4, 1 do --get param names - FX[FxGUID].PrmList[i] = FX[FxGUID].PrmList[i] or {} - local rv, name = r.TrackFX_GetParamName(LT_Track, FX_Idx, i) - FX[FxGUID].PrmList[i].Name = name - end - r.ImGui_CloseCurrentPopup(ctx) - end - if not FX[FxGUID].MorphA then - r.ImGui_EndDisabled(ctx) - r.ImGui_PopStyleColor(ctx) - end - - - - if r.ImGui_Button(ctx, 'Layout Edit mode', -FLT_MIN) then - if not FX.LayEdit then - FX.LayEdit = FxGUID - else - FX.LayEdit = false - end - CloseLayEdit = nil - r.ImGui_CloseCurrentPopup(ctx) - if Draw.DrawMode[FxGUID] then Draw.DrawMode[FxGUID] = nil end - end - - - if r.ImGui_Button(ctx, 'Save all values as default', -FLT_MIN) then - local dir_path = ConcatPath(reaper.GetResourcePath(), 'Scripts', - 'ReaTeam Scripts', 'FX', 'BryanChi_FX Devices') - local file_path = ConcatPath(dir_path, 'FX Default Values.ini') - local file = io.open(file_path, 'a+') - - if file then - local FX_Name = ChangeFX_Name(FX_Name) - Content = file:read('*a') - local Ct = Content - - local pos = Ct:find(FX_Name) - if pos then - file:seek('set', pos - 1) - else - file:seek('end') - end - - file:write(FX_Name, '\n') - local PrmCount = r.TrackFX_GetNumParams(LT_Track, FX_Idx) - PrmCount = PrmCount - 4 - file:write('Number of Params: ', PrmCount, '\n') - - local function write(i, name, Value) - file:write(i, '. ', name, ' = ', Value or '', '\n') - end - - for i = 0, PrmCount, 1 do - local V = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, i) - local _, N = r.TrackFX_GetParamName(LT_Track, FX_Idx, i) - write(i, N, V) - end - - file:write('\n') - - - file:close() - end - r.ImGui_CloseCurrentPopup(ctx) - end - - - - if FX.Def_Type[FxGUID] ~= 'Knob' then - r.ImGui_Text(ctx, 'Default Sldr Width:') - r.ImGui_SameLine(ctx) - local SldrW_DrgSpd - if Mods == Shift then SldrW_DrgSpd = 1 else SldrW_DrgSpd = LE.GridSize end - r.ImGui_SetNextItemWidth(ctx, -FLT_MIN) - - - Edited, FX.Def_Sldr_W[FxGUID] = r.ImGui_DragInt(ctx, - '##' .. FxGUID .. 'Default Width', FX.Def_Sldr_W[FxGUID] or 160, - LE.GridSize, 50, 300) - - - if Edited then - r.SetProjExtState(0, 'FX Devices', - 'Default Slider Width for FX:' .. FxGUID, FX.Def_Sldr_W[FxGUID]) - end - end - - - - r.ImGui_Text(ctx, 'Default Param Type:') - r.ImGui_SameLine(ctx) - r.ImGui_SetNextItemWidth(ctx, -FLT_MIN) - - - if r.ImGui_BeginCombo(ctx, '## P type', FX.Def_Type[FxGUID] or 'Slider', r.ImGui_ComboFlags_NoArrowButton()) then - if r.ImGui_Selectable(ctx, 'Slider') then - FX.Def_Type[FxGUID] = 'Slider' - r.SetProjExtState(0, 'FX Devices', 'Default Param type for FX:' .. FxGUID,FX.Def_Type[FxGUID]) - elseif r.ImGui_Selectable(ctx, 'Knob') then - FX.Def_Type[FxGUID] = 'Knob' - r.SetProjExtState(0, 'FX Devices', 'Default Param type for FX:' .. FxGUID, - FX.Def_Type[FxGUID]) - elseif r.ImGui_Selectable(ctx, 'Drag') then - FX.Def_Type[FxGUID] = 'Drag' - r.SetProjExtState(0, 'FX Devices', 'Default Param type for FX:' .. FxGUID, FX.Def_Type[FxGUID]) - end - r.ImGui_EndCombo(ctx) - end - r.ImGui_EndPopup(ctx) - end - FXModuleMenu_W, FXModuleMenu_H = r.ImGui_GetItemRectSize(ctx) - - - if OpenMorphSettings then - Open, Oms = r.ImGui_Begin(ctx, 'Preset Morph Settings ', Oms, - r.ImGui_WindowFlags_NoCollapse() + r.ImGui_WindowFlags_NoDocking()) - if Oms then - if FxGUID == OpenMorphSettings then - r.ImGui_Text(ctx, 'Set blacklist parameters here: ') - local SpaceForBtn - Filter = r.ImGui_CreateTextFilter(FilterTxt) - r.ImGui_Text(ctx, 'Filter :') - r.ImGui_SameLine(ctx) - if FilterTxt then SpaceForBtn = 170 end - if r.ImGui_TextFilter_Draw(Filter, ctx, '##', -1 - (SpaceForBtn or 0)) then - FilterTxt = r.ImGui_TextFilter_Get(Filter) - reaper.ImGui_TextFilter_Set(Filter, Txt) - end - if FilterTxt then - SL() - BL_All = r.ImGui_Button(ctx, 'Blacklist all results') - end - - r.ImGui_Text(ctx, 'Save morphing settings to : ') - SL() - local Save_FX = r.ImGui_Button(ctx, 'FX Instance', 80) - SL() - local Save_Proj = r.ImGui_Button(ctx, 'Project', 80) - SL() - local Save_Glob = r.ImGui_Button(ctx, 'Global', 80) - SL() - local FxNam = FX.Win_Name_S[FX_Idx]:gsub("%b()", "") - demo.HelpMarker( - 'FX Instance: \nBlacklist will only apply to the current instance of' .. - FxNam .. - '\n\nProject:\nBlacklist will apply to all instances of ' .. - FxNam .. - 'in the current project\n\nGlobal:\nBlacklist will be applied to all instances of ' .. - FxNam .. - ' across all projects.\n\nOrder of precedence goes from: FX Instance -> Project -> Global') - - - - if Save_FX or Save_Proj or Save_Glob then - Tooltip_Timer = r.time_precise() - TTP_x, TTP_y = r.ImGui_GetMousePos(ctx) - r.ImGui_OpenPopup(ctx, '## Successfully saved preset morph') - end - - if Tooltip_Timer then - if r.ImGui_BeginPopupModal(ctx, '## Successfully saved preset morph', nil, r.ImGui_WindowFlags_NoTitleBar()|r.ImGui_WindowFlags_NoResize()) then - r.ImGui_Text(ctx, 'Successfully saved ') - if r.ImGui_IsMouseClicked(ctx, 0) then - r.ImGui_CloseCurrentPopup( - ctx) - end - r.ImGui_EndPopup(ctx) - end - - if Tooltip_Timer + 3 < r.time_precise() then - Tooltip_Timer = nil - TTP_x = nil - TTP_y = nil - end - end - - -- - - - if not FX[FxGUID].PrmList[1].Name then - FX[FxGUID].PrmList = FX[FxGUID].PrmList or {} - --[[ local Ct = r.TrackFX_GetNumParams(LT_Track, FX_Idx) - for i=0, Ct-4, 1 do - FX[FxGUID].PrmList[i]=FX[FxGUID].PrmList[i] or {} - local rv, name = r.TrackFX_GetParamName(LT_Track, FX_Idx, i) - FX[FxGUID].PrmList[i].Name = name - end ]] - - RestoreBlacklistSettings(FxGUID, FX_Idx, LT_Track, - r.TrackFX_GetNumParams(LT_Track, FX_Idx), FX_Name) - else - r.ImGui_BeginTable(ctx, 'Parameter List', 5, - r.ImGui_TableFlags_Resizable()) - --r.ImGui_TableSetupColumn( ctx, 'BL', flagsIn, 20, user_idIn) - - r.ImGui_TableHeadersRow(ctx) - r.ImGui_SetNextItemWidth(ctx, 20) - r.ImGui_TableSetColumnIndex(ctx, 0) - - IconBtn(20, 20, 'M', 0x00000000) - - r.ImGui_TableSetColumnIndex(ctx, 1) - r.ImGui_AlignTextToFramePadding(ctx) - r.ImGui_Text(ctx, 'Parameter Name ') - r.ImGui_TableSetColumnIndex(ctx, 2) - r.ImGui_AlignTextToFramePadding(ctx) - r.ImGui_Text(ctx, 'A') - r.ImGui_TableSetColumnIndex(ctx, 3) - r.ImGui_AlignTextToFramePadding(ctx) - r.ImGui_Text(ctx, 'B') - r.ImGui_TableNextRow(ctx) - r.ImGui_TableSetColumnIndex(ctx, 0) - - - - - if --[[Last Touch]] LT_ParamNum and LT_FXGUID == FxGUID then - local P = FX[FxGUID].PrmList - local N = math.max(LT_ParamNum, 1) - r.ImGui_TableSetBgColor(ctx, 1, - getClr(r.ImGui_Col_TabUnfocused())) - r.ImGui_PushStyleVar(ctx, r.ImGui_StyleVar_FramePadding(), 0, 9) - - rv, P[N].BL = r.ImGui_Checkbox(ctx, '##' .. N, P[N].BL) - if P[N].BL then r.ImGui_BeginDisabled(ctx) end - - r.ImGui_TableSetColumnIndex(ctx, 1) - r.ImGui_Text(ctx, N .. '. ' .. (P[N].Name or '')) - - - ------- A -------------------- - r.ImGui_TableSetColumnIndex(ctx, 2) - r.ImGui_Text(ctx, 'A:') - SL() - r.ImGui_SetNextItemWidth(ctx, -FLT_MIN) - - local i = LT_ParamNum or 0 - local OrigV = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, i) - if not P.FormatV_A and FX[FxGUID].MorphA[1] then - P.FormatV_A = - GetFormatPrmV(FX[FxGUID].MorphA[i], OrigV, i) - end - - - P.Drag_A, FX[FxGUID].MorphA[i] = r.ImGui_DragDouble(ctx, - '## MorphVal_A' .. i, FX[FxGUID].MorphA[i], 0.01, 0, 1, - P.FormatV_A or '') - if P.Drag_A then - P.FormatV_A = GetFormatPrmV(FX[FxGUID].MorphA[i], OrigV, i) - end - - SL() - --------- B -------------------- - r.ImGui_TableSetColumnIndex(ctx, 3) - r.ImGui_Text(ctx, 'B:') - SL() - - local OrigV = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, i) - r.ImGui_SetNextItemWidth(ctx, -FLT_MIN) - if not P.FormatV_B and FX[FxGUID].MorphB[1] then - P.FormatV_B = GetFormatPrmV(FX[FxGUID].MorphB[i], OrigV, i) - end - - - P.Drag_B, FX[FxGUID].MorphB[i] = r.ImGui_DragDouble(ctx, - '## MorphVal_B' .. i, FX[FxGUID].MorphB[i], 0.01, 0, 1, - P.FormatV_B) - if P.Drag_B then - P.FormatV_B = GetFormatPrmV(FX[FxGUID].MorphB[i], OrigV, i) - end - - - if P[N].BL then r.ImGui_EndDisabled(ctx) end - --HighlightSelectedItem( 0xffffff33 , OutlineClr, 1, L,T,R,B,h,w, H_OutlineSc, V_OutlineSc,'GetItemRect', Foreground) - - r.ImGui_PopStyleVar(ctx) - r.ImGui_TableNextRow(ctx) - r.ImGui_TableSetColumnIndex(ctx, 0) - end - local Load_FX_Proj_Glob - local _, FXsBL = r.GetSetMediaTrackInfo_String(LT_Track, - 'P_EXT: Morph_BL' .. FxGUID, '', false) - if FXsBL == 'Has Blacklist saved to FX' then -- if there's FX-specific BL settings - Load_FX_Proj_Glob = 'FX' - else - local _, whether = r.GetProjExtState(0, - 'FX Devices - Preset Morph', - 'Whether FX has Blacklist' .. (FX.Win_Name_S[FX_Idx] or '')) - if whether == 'Yes' then Load_FX_Proj_Glob = 'Proj' end - end - - local TheresBL = TheresBL or {} - local hasBL - for i, v in ipairs(FX[FxGUID].PrmList) do - local P = FX[FxGUID].PrmList[i - 1] - local prm = FX[FxGUID].PrmList - - if r.ImGui_TextFilter_PassFilter(Filter, P.Name) --[[ and (i~=LT_ParamNum and LT_FXGUID==FxGUID) ]] then - i = i - 1 - if prm[i].BL == nil then - if Load_FX_Proj_Glob == 'FX' then - local _, V = r.GetSetMediaTrackInfo_String(LT_Track, - 'P_EXT: Morph_BL' .. FxGUID .. i, '', false) - if V == 'Blacklisted' then prm[i].BL = true end - end - --[[ elseif Load_FX_Proj_Glob== 'Proj' then - local rv, BLprm = r.GetProjExtState(0,'FX Devices - Preset Morph', FX.Win_Name_S[FX_Idx]..' Blacklist '..i) - if BLprm~='' and BLprm then BLpm = tonumber(BLprm) - if BLprm then prm[1].BL = true end - end - end ]] - end - if BL_All --[[BL all filtered params ]] then if P.BL then P.BL = false else P.BL = true end end - rv, prm[i].BL = r.ImGui_Checkbox(ctx, '## BlackList' .. i, - prm[i].BL) - - r.ImGui_TableSetColumnIndex(ctx, 1) - if P.BL then - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_Text(), - getClr(r.ImGui_Col_TextDisabled())) - end - - - r.ImGui_Text(ctx, i .. '. ' .. (P.Name or '')) - - - - ------- A -------------------- - r.ImGui_TableSetColumnIndex(ctx, 2) - r.ImGui_Text(ctx, 'A:') - SL() - - local OrigV = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, - i) - r.ImGui_SetNextItemWidth(ctx, -FLT_MIN) - if not P.FormatV_A and FX[FxGUID].MorphA[1] then - P.FormatV_A = - GetFormatPrmV(FX[FxGUID].MorphA[i + 1], OrigV, i) - end - - - P.Drag_A, FX[FxGUID].MorphA[i] = r.ImGui_DragDouble(ctx, - '## MorphVal_A' .. i, FX[FxGUID].MorphA[i], 0.01, 0, 1, - P.FormatV_A or '') - if P.Drag_A then - P.FormatV_A = GetFormatPrmV(FX[FxGUID].MorphA[i], OrigV, - i) - --[[ r.TrackFX_SetParamNormalized(LT_Track, FX_Idx,i, FX[FxGUID].MorphA[i]) - _,P.FormatV_A = r.TrackFX_GetFormattedParamValue(LT_Track, FX_Idx,i) - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx,i, OrigV) ]] - end - - SL() - - --------- B -------------------- - r.ImGui_TableSetColumnIndex(ctx, 3) - r.ImGui_Text(ctx, 'B:') - SL() - - local OrigV = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, - i) - r.ImGui_SetNextItemWidth(ctx, -FLT_MIN) - if not P.FormatV_B and FX[FxGUID].MorphB[1] then - P.FormatV_B = GetFormatPrmV(FX[FxGUID].MorphB[i] or 0, - OrigV, i) - end - - P.Drag_B, FX[FxGUID].MorphB[i] = r.ImGui_DragDouble(ctx, - '## MorphVal_B' .. i, FX[FxGUID].MorphB[i], 0.01, 0, 1, - P.FormatV_B) - if P.Drag_B then - P.FormatV_B = GetFormatPrmV(FX[FxGUID].MorphB[i], OrigV, - i) - end - - - if Save_FX then - if P.BL then - hasBL = true - r.GetSetMediaTrackInfo_String(LT_Track, - 'P_EXT: Morph_BL' .. FxGUID .. i, 'Blacklisted', - true) - else - r.GetSetMediaTrackInfo_String(LT_Track, - 'P_EXT: Morph_BL' .. FxGUID .. i, '', true) - end - if hasBL then - r.GetSetMediaTrackInfo_String(LT_Track, - 'P_EXT: Morph_BL' .. FxGUID, - 'Has Blacklist saved to FX', true) - else - r.GetSetMediaTrackInfo_String(LT_Track, - 'P_EXT: Morph_BL' .. FxGUID, '', true) - end - elseif Save_Proj then - if P.BL then table.insert(TheresBL, i) end - elseif Save_Glob then - if P.BL then table.insert(TheresBL, i) end - end - - r.ImGui_SetNextItemWidth(ctx, -1) - - if P.BL then r.ImGui_PopStyleColor(ctx) end - - r.ImGui_TableNextRow(ctx) - r.ImGui_TableSetColumnIndex(ctx, 0) - end - end - - if Save_Proj then - if TheresBL[1] then - r.SetProjExtState(0, 'FX Devices - Preset Morph', - 'Whether FX has Blacklist' .. FX.Win_Name_S[FX_Idx], - 'Yes') - else - r.SetProjExtState(0, 'FX Devices - Preset Morph', - 'Whether FX has Blacklist' .. FX.Win_Name_S[FX_Idx], 'No') - end - for i, V in ipairs(FX[FxGUID].MorphA) do - local PrmBLed - for I, v in ipairs(TheresBL) do - if i == v then PrmBLed = v end - end - if PrmBLed then - r.SetProjExtState(0, 'FX Devices - Preset Morph', - FX.Win_Name_S[FX_Idx] .. ' Blacklist ' .. i, PrmBLed) - else - r.SetProjExtState(0, 'FX Devices - Preset Morph', - FX.Win_Name_S[FX_Idx] .. ' Blacklist ' .. i, '') - end - end - --else r.SetProjExtState(0,'FX Devices - Preset Morph','Whether FX has Blacklist'..FX.Win_Name_S[FX_Idx], '') - elseif TheresBL[1] and Save_Glob then - file, file_path = CallFile('w', FX.Win_Name_S[FX_Idx] .. '.ini', - 'Preset Morphing') - if file then - for i, V in ipairs(TheresBL) do - file:write(i, ' = ', V, '\n') - end - file:close() - end - end - - r.ImGui_EndTable(ctx) - end - end - r.ImGui_End(ctx) - else - r.ImGui_End(ctx) - OpenMorphSettings = false - end - end - - ------------------------------------------ - ------ Collapse Window - ------------------------------------------ - - FX_Idx = FX_Idx or 1 - - - if R_Click_WindowBtnVertical then - FX[FXGUID[FX_Idx]].Collapse = false - end - - - - r.gmem_attach('ParamValues') - FX.Win_Name_S[FX_Idx] = ChangeFX_Name(FX.Win_Name[FX_Idx]) - - FX_Name = string.sub(FX_Name, 1, (string.find(FX_Name, '%(') or 30) - 1) - FX_Name = string.gsub(FX_Name, '%-', ' ') - - - - - - ----== Drag and drop---- - if r.ImGui_BeginDragDropSource(ctx, r.ImGui_DragDropFlags_AcceptNoDrawDefaultRect()) then - DragFX_ID = FX_Idx - r.ImGui_SetDragDropPayload(ctx, 'FX_Drag', FX_Idx) - r.ImGui_EndDragDropSource(ctx) - - DragDroppingFX = true - if IsAnyMouseDown == false then DragDroppingFX = false end - HighlightSelectedItem(0xffffff22, 0xffffffff, 0, L, T, R, B, h, w, H_OutlineSc, - V_OutlineSc, 'GetItemRect', WDL) - Post_DragFX_ID = tablefind(Trk[TrkID].PostFX, FXGUID[DragFX_ID]) - end - - if IsAnyMouseDown == false and DragDroppingFX == true then - DragDroppingFX = false - end - - ----Drag and drop END---- - - r.ImGui_SameLine(ctx) - - -------------------------------- - ----Area right of window title - -------------------------------- - function SyncWetValues() - --when track change - if Wet.Val[FX_Idx] == nil or TrkID ~= TrkID_End or FXCountEndLoop ~= Sel_Track_FX_Count then -- if it's nil - SyncWetValues = true - end - - if SyncWetValues == true then - Wet.P_Num[FX_Idx] = reaper.TrackFX_GetParamFromIdent(LT_Track, FX_Idx, ':wet') - Wet.Get = reaper.TrackFX_GetParamNormalized(LT_Track, FX_Idx, - Wet.P_Num[FX_Idx]) - Wet.Val[FX_Idx] = Wet.Get - end - if SyncWetValues == true and FX_Idx == Sel_Track_FX_Count - 1 then - SyncWetValues = false - end - if LT_ParamNum == Wet.P_Num[FX_Idx] and focusedFXState == 1 then - Wet.Get = reaper.TrackFX_GetParamNormalized(LT_Track, FX_Idx, - Wet.P_Num[FX_Idx]) - Wet.Val[FX_Idx] = Wet.Get - elseif LT_ParamNum == FX[FxGUID].DeltaP then - FX[FxGUID].DeltaP_V = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, - FX[FxGUID].DeltaP) - end - end - - - if FindStringInTable(SpecialLayoutFXs, FX_Name) == false then - SyncWetValues() - - if FX[FXGUID[FX_Idx]].Collapse ~= true then - Wet.ActiveAny, Wet.Active, Wet.Val[FX_Idx] = Add_WetDryKnob(ctx, 'a', '', - Wet.Val[FX_Idx] or 0, 0, 1, FX_Idx) - end - - if r.ImGui_BeginDragDropTarget(ctx) then - rv, payload = r.ImGui_AcceptDragDropPayload(ctx, 'FX_Drag') - if rv then - end - r.ImGui_EndDragDropTarget(ctx) - end - - end - -- r.ImGui_PopStyleVar(ctx) --StyleVar#4 POP (Things in the header of FX window) - - ------------------------------------------ - ------ Generic FX's knobs and sliders area - ------------------------------------------ - if not FX[FXGUID[FX_Idx]].Collapse and FindStringInTable(BlackListFXs, FX_Name) ~= true and FindStringInTable(SpecialLayoutFXs, FX_Name) == false then - local WinP_X; local WinP_Y; - --_, foo = AddKnob(ctx, 'test', foo or 0 , 0, 100 ) - if FX.Enable[FX_Idx] == true then - -- Params Colors----- - --[[ reaper.ImGui_PushStyleColor(ctx, reaper.ImGui_Col_FrameBg(), 0x32403aff) - reaper.ImGui_PushStyleColor(ctx, reaper.ImGui_Col_FrameBgActive(), 0x44444488) - - times = 2 ]] - else - --[[ r.ImGui_PushStyleColor(ctx, reaper.ImGui_Col_FrameBg(), 0x17171744) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_Text(), 0x66666644) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_SliderGrab(), 0x66666644) - r.ImGui_PushStyleColor(ctx, reaper.ImGui_Col_FrameBgActive(), 0x66666622) - r.ImGui_PushStyleColor(ctx, reaper.ImGui_Col_FrameBgHovered(), 0x44444422) - times = 5 ]] - end - - if FX.Round[FxGUID] then - r.ImGui_PushStyleVar(ctx, - r.ImGui_StyleVar_FrameRounding(), FX.Round[FxGUID]) - end - if FX.GrbRound[FxGUID] then - r.ImGui_PushStyleVar(ctx, - r.ImGui_StyleVar_GrabRounding(), FX.GrbRound[FxGUID]) - end - - if (FX.LayEdit == FxGUID or Draw.DrawMode[FxGUID] == true) and Mods~= Apl then - r.ImGui_BeginDisabled(ctx, true) - end - if FX.LayEdit then - LE.DragX, LE.DragY = r.ImGui_GetMouseDragDelta(ctx, 0) - end - - ------------------------------------------------------ - -- Repeat as many times as stored Param on FX ------------- - ------------------------------------------------------ - --[[ for Fx_P, v in ipairs(FX[FxGUID]) do - if not FX[FxGUID][Fx_P].Name then table.remove(FX[FxGUID],Fx_P) end - end ]] - for Fx_P, v in ipairs(FX[FxGUID]) do --parameter faders - --FX[FxGUID][Fx_P]= FX[FxGUID][Fx_P] or {} - - local FP = FX[FxGUID][Fx_P] - - local F_Tp = FX.Prm.ToTrkPrm[FXGUID[FX_Idx] .. Fx_P]; local ID = FxGUID .. - Fx_P - Rounding = 0.5 - - ParamX_Value = 'Param' .. - tostring(FP.Name) .. 'On ID:' .. tostring(Fx_P) .. 'value' .. FxGUID - - ----Default Layouts - if not FP.PosX and not FP.PosY then - if FP.Type == 'Slider' or (not FP.Type and not FX.Def_Type[FxGUID]) or FX.Def_Type[FxGUID] == 'Slider' or FP.Type == 'Drag' or (FX.Def_Type[FxGUID] == 'Drag' and FP.Type == nil) then - local Column = math.floor((Fx_P/6)-0.01) - local W = ((FX[FxGUID][Fx_P - Column * 6].Sldr_W or FX.Def_Sldr_W[FxGUID] or 160)+ GapBtwnPrmColumns) * Column - local Y = 30 * (Fx_P - (Column * 6)) - r.ImGui_SetCursorPos(ctx, W,Y) - - elseif FP.Type == 'V-Slider' or (FX.Def_Type[FxGUID] == 'V-Slider' and FP.Type == nil) then - - r.ImGui_SetCursorPos(ctx, 17 * (Fx_P - 1), 30) - - elseif FP.Type == 'Knob' or (FX.Def_Type[FxGUID] == 'Knob' and FP.Type == nil) then - local KSz = Df.KnobSize - local G = 15 - local Column = math.floor (Fx_P/3 - 0.1) - - r.ImGui_SetCursorPos(ctx,KSz * (Column) , 26 + (KSz + G) * (Fx_P -( Column*3) -1)) - end - end - - if FP.PosX then r.ImGui_SetCursorPosX(ctx, FP.PosX) end - if FP.PosY then r.ImGui_SetCursorPosY(ctx, FP.PosY) end - - rectminX, RectMinY = r.ImGui_GetItemRectMin(ctx) - curX, CurY = r.ImGui_GetCursorPos(ctx) - if CurY > 210 then - r.ImGui_SetCursorPosY(ctx, 210) - CurY = 210 - end - if curX < 0 then - r.ImGui_SetCursorPosX(ctx, 0) - elseif curX > (FX.Width[FxGUID] or DefaultWidth) then - r.ImGui_SetCursorPosX(ctx, (FX.Width[FxGUID] or DefaultWidth) - 10) - end - - -- if prm has clr set, calculate colors for active and hvr clrs - if FP.BgClr then - local R, G, B, A = r.ImGui_ColorConvertU32ToDouble4(FP.BgClr) - local H, S, V = r.ImGui_ColorConvertRGBtoHSV(R, G, B) - local HvrV, ActV - if V > 0.9 then - HvrV = V - 0.1 - ActV = V - 0.5 - end - local R, G, B = r.ImGui_ColorConvertHSVtoRGB(H, S, HvrV or V + - 0.1) - local HvrClr = r.ImGui_ColorConvertDouble4ToU32(R, G, B, A) - local R, G, B = r.ImGui_ColorConvertHSVtoRGB(H, S, ActV or V + 0.2) - local ActClr = r.ImGui_ColorConvertDouble4ToU32(R, G, B, A) - FP.BgClrHvr = HvrClr - FP.BgClrAct = ActClr - end - - - --- if there's condition for parameters -------- - local CreateParam, ConditionPrms, Pass = nil, {}, {} - local function CheckIfCreate(ConditionPrm, ConditionPrm_PID,ConditionPrm_V_Norm, ConditionPrm_V) - - local Pass - if FP[ConditionPrm] then - if not FX[FxGUID][Fx_P][ConditionPrm_PID] then - for i, v in ipairs(FX[FxGUID]) do - if v.Num == FX[FxGUID][Fx_P][ConditionPrm] then - FX[FxGUID][Fx_P][ConditionPrm_PID] = - i - end - end - end - local PID = FP[ConditionPrm_PID] - - if FX[FxGUID][PID].ManualValues then - local V = round( - r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, - FP[ConditionPrm]), - 3) - if FP[ConditionPrm_V_Norm] then - for i, v in ipairs(FP[ConditionPrm_V_Norm]) do - if V == round(v, 3) then Pass = true end - end - end - else - local _, V = r.TrackFX_GetFormattedParamValue(LT_Track, FX_Idx, - FP[ConditionPrm]) - for i, v in ipairs(FP[ConditionPrm_V]) do - if V == v then Pass = true end - end - end - else - Pass = true - end - return Pass - end - - if FP['ConditionPrm'] then - if CheckIfCreate('ConditionPrm', 'ConditionPrm_PID', 'ConditionPrm_V_Norm', 'ConditionPrm_V') then - local DontCretePrm - for i = 2, 5, 1 do - if CheckIfCreate('ConditionPrm' .. i, 'ConditionPrm_PID' .. i, 'ConditionPrm_V_Norm' .. i, 'ConditionPrm_V' .. i) then - else - DontCretePrm = true - end - end - if not DontCretePrm then CreateParam = true end - end - end - - - - - if CreateParam or not FP.ConditionPrm then - local Prm = FP - local F_Tp = FX.Prm.ToTrkPrm[FxGUID .. Fx_P] - - - - - if Prm then - DL_SPLITER = r.ImGui_CreateDrawListSplitter(WDL) - r.ImGui_DrawListSplitter_Split(DL_SPLITER , 2) - r.ImGui_DrawListSplitter_SetCurrentChannel( DL_SPLITER, 1 ) - - --Prm.V = Prm.V or r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, Prm.Num) - --- Add Parameter controls --------- - if Prm.Type == 'Slider' or (not Prm.Type and not FX.Def_Type[FxGUID]) or FX.Def_Type[FxGUID] == 'Slider' then - AddSlider(ctx, '##' .. (Prm.Name or Fx_P), Prm.CustomLbl, - Prm.V or 0, 0, 1, Fx_P, FX_Idx, Prm.Num, Style, Prm.Sldr_W or FX.Def_Sldr_W[FxGUID], 0, Disable, Vertical, GrabSize, Prm.Lbl, 8) - MakeItemEditable(FxGUID, Fx_P, Prm.Sldr_W, 'Sldr', curX, CurY) - elseif FP.Type == 'Knob' or (FX.Def_Type[FxGUID] == 'Knob' and Prm.Type == nil) then - AddKnob(ctx, '##' .. Prm.Name, Prm.CustomLbl, Prm.V, 0, 1, Fx_P, - FX_Idx, Prm.Num, Prm.Style, Prm.Sldr_W or Df.KnobRadius, 0, - Disabled, Prm.FontSize, Prm.Lbl_Pos or 'Bottom', Prm.V_Pos) - MakeItemEditable(FxGUID, Fx_P, Prm.Sldr_W, 'Knob', curX, CurY) - elseif Prm.Type == 'V-Slider' or (FX.Def_Type[FxGUID] == 'V-Slider') then - AddSlider(ctx, '##' .. Prm.Name, Prm.CustomLbl, Prm.V or 0, 0, 1, - Fx_P, FX_Idx, Prm.Num, Style, Prm.Sldr_W or 15, 0, Disable, - 'Vert', GrabSize, Prm.Lbl, nil, Prm.Sldr_H or 160) - MakeItemEditable(FxGUID, Fx_P, Prm.Sldr_W, 'V-Slider', curX, CurY) - elseif Prm.Type == 'Switch' then - AddSwitch(LT_Track, FX_Idx, Prm.V or 0, Prm.Num, Prm.BgClr, - Prm.CustomLbl or 'Use Prm Name as Lbl', Fx_P, F_Tp, - Prm.FontSize, FxGUID) - MakeItemEditable(FxGUID, Fx_P, Prm.Sldr_W, 'Switch', curX, CurY) - elseif Prm.Type == 'Drag' or (FX.Def_Type[FxGUID] == 'Drag') then - AddDrag(ctx, '##' .. Prm.Name, Prm.CustomLbl or Prm.Name, - Prm.V or 0, 0, 1, Fx_P, FX_Idx, Prm.Num, Prm.Style, - Prm.Sldr_W or FX.Def_Sldr_W[FxGUID] or Df.Sldr_W, -1, Disable, - Lbl_Clickable, Prm.Lbl_Pos, Prm.V_Pos, Prm.DragDir) - MakeItemEditable(FxGUID, Fx_P, Prm.Sldr_W, 'Drag', curX, CurY) - elseif Prm.Type == 'Selection' then - AddCombo(ctx, LT_Track, FX_Idx, Prm.Name .. FxGUID..'## actual', Prm.Num, - FP.ManualValuesFormat or 'Get Options', Prm.Sldr_W, Prm - .Style, FxGUID, Fx_P, FP.ManualValues) - MakeItemEditable(FxGUID, Fx_P, Prm.Sldr_W, 'Selection', curX, - CurY) - end - - if r.ImGui_IsItemClicked(ctx) and LBtnDC then - if Mods == 0 then - local dir_path = ConcatPath(r.GetResourcePath(), 'Scripts', - 'ReaTeam Scripts', 'FX', 'BryanChi_FX Devices') - local file_path = ConcatPath(dir_path, 'FX Default Values.ini') - local file = io.open(file_path, 'r') - - if file then - local FX_Name = ChangeFX_Name(FX_Name) - Content = file:read('*a') - local Ct = Content - local P_Num = Prm.Num - local _, P_Nm = r.TrackFX_GetParamName(LT_Track, FX_Idx, - P_Num) - local Df = RecallGlobInfo(Ct, P_Num .. '. ' .. P_Nm .. ' = ', 'Num') - if Df then - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, P_Num, Df) - ToDef = { ID = FX_Idx, P = P_Num, V = Df } - end - end - elseif Mods == Alt then - if Prm.Deletable then - DeletePrm(FxGUID, Fx_P, FX_Idx) - end - - - end - end - - if ToDef.ID and ToDef.V then - r.TrackFX_SetParamNormalized(LT_Track, ToDef.ID, ToDef.P, ToDef - .V) - if Prm.WhichCC then - if Trk.Prm.WhichMcros[Prm.WhichCC .. TrkID] then - Unlink_Parm(LT_TrackNum, ToDef.ID, ToDef.P) - r.TrackFX_SetParamNormalized(LT_Track, ToDef.ID, ToDef.P, - ToDef.V) - r.GetSetMediaTrackInfo_String(LT_Track, - 'P_EXT: FX' .. - FxGUID .. - 'Prm' .. ToDef.P .. 'Value before modulation', - ToDef.V, true) - r.gmem_write(7, Prm.WhichCC) --tells jsfx to retrieve P value - PM.TimeNow = r.time_precise() - r.gmem_write(11000 + Prm.WhichCC, ToDef.V) - Link_Param_to_CC(LT_TrackNum, ToDef.ID, ToDef.P, true, - true, 176, Prm.WhichCC) - end - end - Prm.V = ToDef.V - - ToDef = {} - end - - - if FP.Draw then - - - r.ImGui_DrawListSplitter_SetCurrentChannel( DL_SPLITER, 0 ) - - local function Repeat(rpt, va, Xgap, Ygap, func, Gap, RPTClr, CLR) - if rpt and rpt ~= 0 then - local RPT =rpt - if va and va~=0 then RPT = rpt * Prm.V * va end - for i=0, RPT -1 , 1 do - local Clr = BlendColors(CLR or 0xffffffff, RPTClr or 0xffffffff, i/RPT) - - func(i * (Xgap or 0), i * (Ygap or 0), i* (Gap or 0), Clr) - end - - else - func(Xgap) - end - - - end - - - - - - - for i, v in ipairs(FP.Draw) do - local x, y = r.ImGui_GetItemRectMin(ctx) - local x = x + (v.X_Offset or 0) + (Prm.V * (v.X_Offset_VA or 0)) - local y = y + (v.Y_Offset or 0) + (Prm.V * (v.Y_Offset_VA or 0)) - local Thick = (v.Thick or 2 ) - local Gap,X_Gap ,Y_Gap = v.Gap, v.X_Gap, v.Y_Gap - local Clr_VA - if v.Clr_VA then Clr_VA = BlendColors(v.Clr or 0xffffffff, v.Clr_VA, Prm.V) end - - - - if v.X_Gap_VA and v.X_Gap_VA ~= 0 then X_Gap = (v.X_Gap or 0)* Prm.V * v.X_Gap_VA end - if v.Y_Gap_VA and v.Y_Gap_VA ~= 0 then Y_Gap = (v.Y_Gap or 0) * Prm.V * v.Y_Gap_VA end - - if v.Gap_VA and v.Gap_VA ~= 0 then Gap = v.Gap * Prm.V * v.Gap_VA end - - if v.Thick_VA then Thick = (v.Thick or 2 ) * (v.Thick_VA * Prm.V) end - - if v.Type == 'Line' or v.Type =='Rect' or v.Type =='Rect Filled' then - - local w = v.Width or r.ImGui_GetItemRectSize(ctx) - local h = v.Height or select(2, r.ImGui_GetItemRectSize(ctx)) - - local x2 = x +w - local y2 = y +h - - if v.Width_VA and v.Width_VA ~= 0 then x2 = x + (w or 10) * Prm.V * (v.Width_VA ) end - if v.Height_VA and v.Height_VA ~= 0 then y2 = y + (h or 10) * Prm.V * (v.Height_VA ) end - - - TESTCLR = HSV_Change(0xff00ff,0, 0, 0.7 ) - - if v.Type == 'Line' then - - if Prm.Type =='Slider' or Prm.Type =='Drag' or (not Prm.Type ) then - - v.Height = v.Height or 0 ; v.Width = v.Width or w - h = v.Height or 0 ; w = v.Width or w - elseif Prm.Type =='V-Slider' then - v.Height = v.Height or h ; v.Width = v.Width or 0 - h = v.Height or h ; w = v.Width or 0 - end - - - local function Addline(Xg, Yg , none, RptClr) - r.ImGui_DrawList_AddLine(WDL, x + (Xg or 0), y + (Yg or 0) ,x2+(Xg or 0), y2 + (Yg or 0), RptClr or Clr_VA or v.Clr or 0xffffffff, Thick) - end - - Repeat(v.Repeat, v.Repeat_VA, X_Gap , Y_Gap, Addline, nil, v.RPT_Clr, v.Clr ) - - - elseif v.Type =='Rect' then - local function AddRect(Xg, Yg , none , RptClr) - r.ImGui_DrawList_AddRect(WDL, x+ (Xg or 0),y+ (Yg or 0),x2+ (Xg or 0),y2+ (Yg or 0), RptClr or Clr_VA or v.Clr or 0xffffffff, v.Round, flag ,Thick ) - end - Repeat(v.Repeat, v.Repeat_VA, X_Gap , Y_Gap, AddRect,nil, v.RPT_Clr, v.Clr ) - - elseif v.Type =='Rect Filled' then - local function AddRectFill(Xg, Yg, none , RptClr) - r.ImGui_DrawList_AddRectFilled(WDL, x+ (Xg or 0),y+ (Yg or 0),x2+ (Xg or 0),y2+ (Yg or 0), RptClr or Clr_VA or v.Clr or 0xffffffff, v.Round ) - end - Repeat(v.Repeat, v.Repeat_VA, X_Gap , Y_Gap, AddRectFill,nil, v.RPT_Clr, v.Clr ) - - end - - if v.AdjustingX or v.AdjustingY then - local l = 4 - r.ImGui_DrawList_AddLine(WDL,x-l,y-l,x+l,y+l , 0xffffffdd ) - r.ImGui_DrawList_AddLine(WDL,x-l,y+l,x+l,y-l , 0xffffffdd ) - end - - elseif v.Type == 'Circle' or v.Type =='Circle Filled' then - local w ,h = 10 - if Prm.Type =='Knob' then w, h= r.ImGui_GetItemRectSize(ctx) else v.Width = v.Width or 10 end - local Rad = v.Width or w - if v.Width_VA and v.Width_VA~= 0 then Rad = Rad * Prm.V * v.Width_VA end - - local function AddCircle (X_Gap, Y_Gap, Gap, RptClr) - r.ImGui_DrawList_AddCircle(WDL, x + w / 2 + (X_Gap or 0) , y + w / 2 + (Y_Gap or 0) , Rad+(Gap or 0), RptClr or Clr_VA or v.Clr or 0xffffffff,nil,Thick) - end - local function AddCircleFill(X_Gap, Y_Gap, Gap, RptClr) - r.ImGui_DrawList_AddCircleFilled(WDL, x + w / 2 + (X_Gap or 0) , y + w / 2 + (Y_Gap or 0) , Rad+(Gap or 0), RptClr or Clr_VA or v.Clr or 0xffffffff) - end - - - if v.Type == 'Circle' then - Repeat(v.Repeat, v.Repeat_VA, X_Gap, Y_Gap, AddCircle , Gap, v.RPT_Clr, v.Clr ) - elseif v.Type == 'Circle Filled' then - Repeat(v.Repeat, v.Repeat_VA, X_Gap, Y_Gap, AddCircleFill , Gap, v.RPT_Clr, v.Clr ) - end - - if v.AdjustingX or v.AdjustingY then - local l = 4 - local x,y = x+ Rad/2 , y+Rad/2 - r.ImGui_DrawList_AddLine(WDL,x-l,y-l,x+l,y+l , 0xffffffdd ) - r.ImGui_DrawList_AddLine(WDL,x-l,y+l,x+l,y-l , 0xffffffdd ) - end - - - elseif v.Type == 'Knob Pointer' or v.Type =='Knob Range' or v.Type == 'Knob Image' or v.Type =='Knob Circle' then - local w, h = r.ImGui_GetItemRectSize(ctx) - local x, y = x + w / 2 + (v.X_Offset or 0) , y + h / 2 + (v.Y_Offset or 0) - local ANGLE_MIN = 3.141592 * (v.Angle_Min or 0.75) - local ANGLE_MAX = 3.141592 * (v.Angle_Max or 2.25) - local t = (Prm.V - 0) / (1 - 0) - local angle = ANGLE_MIN + (ANGLE_MAX - ANGLE_MIN) * t - local angle_cos, angle_sin = math.cos(angle), math.sin(angle) - local IN = v.Rad_In or 0 -- modify this for the center begin point - local OUT = v.Rad_Out or 30 - - if v.Type == 'Knob Pointer' then - r.ImGui_DrawList_AddLine(WDL, x + angle_cos * IN, y + angle_sin *IN, x+ angle_cos * (OUT - Thick), y + angle_sin * (OUT - Thick), Clr_VA or v.Clr or 0x999999aa , Thick) - elseif v.Type == 'Knob Range' then - - - local function AddRange(G) - - for i= IN, OUT , (1 + (v.Gap or 0)) do - - r.ImGui_DrawList_PathArcTo(WDL,x,y ,i, ANGLE_MIN,SetMinMax(ANGLE_MIN + (ANGLE_MAX - ANGLE_MIN) * Prm.V, ANGLE_MIN, ANGLE_MAX)) - r.ImGui_DrawList_PathStroke(WDL, Clr_VA or v.Clr or 0x999999aa, nil, Thick) - r.ImGui_DrawList_PathClear(WDL) - end - end - - - Repeat(1, 0, X_Gap , X_Gap, AddRange) - elseif v.Type =='Knob Circle' then - r.ImGui_DrawList_AddCircle(WDL, x + angle_cos * IN, y + angle_sin *IN, v.Width, Clr_VA or v.Clr or 0x999999aa , nil, Thick) - - - elseif v.Type =='Knob Image' and v.Image then - local X ,Y = x + angle_cos * IN, y + angle_sin *IN - r.ImGui_DrawList_AddImage(WDL,v.Image, X,Y, X+ v.Width, Y+v.Width, nil,nil,nil,nil, Clr_VA or v.Clr or 0x999999aa ) - - end - - - - if v.AdjustingX or v.AdjustingY then - local l = 4 - - r.ImGui_DrawList_AddLine(WDL,x-l,y-l,x+l,y+l , 0xffffffdd ) - r.ImGui_DrawList_AddLine(WDL,x-l,y+l,x+l,y-l , 0xffffffdd ) - end - - - elseif v.Type == 'Image' and v.Image then - local w, h = r.ImGui_Image_GetSize (v.Image) - local w,h = (v.Width or w) , ( v.Height or h) - if v.Width_VA and v.Width_VA~= 0 then w = (v.Width or w) * v.Width_VA * Prm.V end - if v.Height_VA and v.Height_VA~=0 then h = (v.Height or h) * v.Height_VA * Prm.V end - local function AddImage (X_Gap, Y_Gap, none, RptClr) - r.ImGui_DrawList_AddImage(WDL,v.Image, x +X_Gap, y+(Y_Gap or 0) , x + w+X_Gap, y + h+(Y_Gap or 0) , 0,0,1,1, RptClr or Clr_VA or v.Clr ) - end - - - Repeat(v.Repeat, v.Repeat_VA, v.X_Gap or 0 , v.Y_Gap or 0, AddImage, nil, v.RPT_Clr, v.Clr ) - - end - - - - end - - - end - r.ImGui_DrawListSplitter_Merge(DL_SPLITER) - --Try another method: use undo history to detect if user has changed a preset, if so, unlink all params - --[[ if r.TrackFX_GetOpen(LT_Track, FX_Idx) and focusedFXState==1 and FX_Index_FocusFX==FX_Idx then - - if FX[FxGUID].Morph_ID and not FP.UnlinkedModTable then - _,TrackStateChunk, FXStateChunk, FP.UnlinkedModTable= GetParmModTable(LT_TrackNum, FX_Idx, Prm.Num, TableIndex_Str) - Unlink_Parm (trackNumOfFocusFX, FX_Idx, Prm.Num ) - FocusedFX = FX_Idx - end - elseif focusedFXState==0 and UnlinkedModTable then - - end --FX_Index_FocusFX - if FP.UnlinkedModTable then - if not r.TrackFX_GetOpen(LT_Track, FocusedFX) then -- if the fx is closed - Link_Param_to_CC(LT_TrackNum, FocusedFX, Prm.Num, true, true, 160, FX[FxGUID].Morph_ID, UnlinkedModTable['PARAMOD_BASELINE'], UnlinkedModTable['PARMLINK_SCALE']) - FocusedFX=nil FP.UnlinkedModTable = nil - end - end ]] - end - - if r.ImGui_IsItemClicked(ctx, 1) and Mods == Ctrl then - r.ImGui_OpenPopup(ctx, '##prm Context menu' .. FP.Num) - end - if r.ImGui_BeginPopup(ctx, '##prm Context menu' .. FP.Num) then - if r.ImGui_Selectable(ctx, 'Add Parameter to Envelope') then - local env = r.GetFXEnvelope(LT_Track, 0, FP.Num, true) - local active, visible, armed, inLane, laneHeight, defaultShape, minValue, maxValue, centerValue, Tp, faderScaling = - r.BR_EnvGetProperties(env) - - r.BR_EnvSetProperties(env, true, true, armed, inLane, laneHeight, - defaultShape, faderScaling) - r.UpdateArrange() - end - r.ImGui_BeginPopupContextItem(ctx, 'optional string str_idIn') - r.ImGui_EndPopup(ctx) - end - end - end -- Rpt for every param - - - if FX.LayEdit then - if LE.DragY > LE.GridSize or LE.DragX > LE.GridSize or LE.DragY < -LE.GridSize or LE.DragX < -LE.GridSize then - r.ImGui_ResetMouseDragDelta(ctx) - end - end - - - if r.ImGui_IsMouseHoveringRect(ctx, Win_L, Win_T, Win_R, Win_B) and - r.ImGui_IsWindowHovered( ctx, r.ImGui_HoveredFlags_RootAndChildWindows()) - then - if ClickOnAnyItem == nil and LBtnRel and AdjustPrmWidth ~= true and Mods == 0 then - LE.Sel_Items = {}; - elseif ClickOnAnyItem and LBtnRel then - ClickOnAnyItem = nil - elseif AdjustPrmWidth == true then - AdjustPrmWidth = nil - end - end - - - - - if FX.Round[FxGUID] then r.ImGui_PopStyleVar(ctx) end - if FX.GrbRound[FxGUID] then r.ImGui_PopStyleVar(ctx) end - - - - if (FX.LayEdit == FxGUID or Draw.DrawMode[FxGUID] == true) and Mods ~= Apl then - r.ImGui_EndDisabled(ctx) - end - - - end - - - - - for i, v in pairs(PluginScripts ) do - if FX_Name:find(v) then - r.SetExtState('FXD', 'Plugin Script FX_Id', FX_Idx, false ) - PluginScript.FX_Idx = FX_Idx - PluginScript.Guid = FXGUID[FX_Idx] - if Prm.InstAdded[FXGUID[FX_Idx]] ~= true and FX.Win_Name[FX_Idx]:find('Pro%-C 2') then - --- number in green represents FX Prm Index - end - dofile(pluginScriptPath .. '/'.. v..'.lua') - end - end - - - if FX.Enable[FX_Idx] == false then - r.ImGui_DrawList_AddRectFilled(WDL, Win_L, Win_T,Win_R, Win_B, 0x00000088) - end - - if r.ImGui_IsWindowHovered(ctx,r.ImGui_HoveredFlags_RootAndChildWindows()) then DisableScroll = nil else DisableScroll = true end - - r.ImGui_Dummy( ctx, FX.Width[FXGUID[FX_Idx]] or DefaultWidth, 220) - r.ImGui_EndChild(ctx) - - end - - - end - - - -------------------------------------------------------------------------------------- - --------------------------------------Draw Mode -------------------------------------- - -------------------------------------------------------------------------------------- - - --------------------FX Devices-------------------- - - reaper.ImGui_PopStyleColor(ctx, poptimes) -- -- PopColor #1 FX Window - reaper.ImGui_SameLine(ctx, nil, 0) - - - - - - - - - r.ImGui_EndGroup(ctx) - - end - if BlinkFX == FX_Idx then BlinkFX = BlinkItem(0.2, 2, BlinkFX) end - end --of Create fx window function - - if --[[Normal Window]] (not string.find(FX_Name, 'FXD %(Mix%)RackMixer')) and FX.InLyr[FXGUID[FX_Idx]] == nil and FX_Idx ~= RepeatTimeForWindows and FindStringInTable(BlackListFXs, FX_Name) ~= true then - --FX_IdxREAL = FX_Idx+Lyr.FX_Ins[FXGUID[FX_Idx]] - - if not tablefind(Trk[TrkID].PostFX, FxGUID) and not FX[FxGUID].InWhichBand then - createFXWindow(FX_Idx) - local rv, inputPins, outputPins = r.TrackFX_GetIOSize(LT_Track, FX_Idx) - end - if FX.LayEdit == FXGUID[FX_Idx] then - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_HeaderHovered(), 0xffffff00) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_HeaderActive(), 0xffffff00) - - --if not ctx then ctx = r.ImGui_CreateContext('Layout Editor') end - --r.ImGui_BeginTooltip( ctx) - - --attachfonts(ctx) - - --[[ rv, LayEdProp_Open = r.ImGui_Begin(ctx, 'LayoutEdit Propertiess', true, - r.ImGui_WindowFlags_MenuBar() + r.ImGui_WindowFlags_NoCollapse() + - r.ImGui_WindowFlags_NoTitleBar() + r.ImGui_WindowFlags_NoDocking()) ]] - --r.ImGui_PushStyleColor(ctx, r.ImGui_Col_FrameBg(), 0x191919ff ) ; - local FxGUID = FXGUID[FX_Idx] - - if not CloseLayEdit and r.ImGui_Begin(ctx, 'LayoutEdit Propertiess', true, r.ImGui_WindowFlags_NoCollapse() + r.ImGui_WindowFlags_NoTitleBar() + r.ImGui_WindowFlags_NoDocking()) then - --if not CloseLayEdit then ----START CHILD WINDOW------ - DisableScroll = true - - - - if r.ImGui_Button(ctx, 'Save') then - SaveLayoutEditings(FX_Name, ID or 1, FXGUID[FX_Idx]) - CloseLayEdit = true; FX.LayEdit = nil - end - SL() - if r.ImGui_Button(ctx, 'Exit##Lay') then - r.ImGui_OpenPopup(ctx, 'Save Editing?') - end - SL() - - if LE.Sel_Items[1] then - local I = FX[FxGUID][LE.Sel_Items[1]] - if r.ImGui_Button(ctx, 'Delete') then - local tb = {} - - for i, v in pairs(LE.Sel_Items) do - tb[i] = v - end - table.sort(tb) - - for i = #tb, 1, -1 do - DeletePrm(FxGUID, tb[i]) - end - - if not FX[FxGUID][1] then FX[FxGUID].AllPrmHasBeenDeleted = true else FX[FxGUID].AllPrmHasBeenDeleted = nil end - - - LE.Sel_Items = {} - end - - SL(nil, 30) - - if r.ImGui_Button(ctx, 'Copy Properties') then - CopyPrm = {} - CopyPrm = I - - for i, v in pairs(LE.Sel_Items) do - - end - end - - SL() - if r.ImGui_Button(ctx, 'Paste Properties') then - for i, v in pairs(LE.Sel_Items) do - I.Type = CopyPrm.Type - I.Sldr_W = CopyPrm.Sldr_W - I.Style = CopyPrm.Style - I.V_FontSize = CopyPrm.V_FontSize - I.CustomLbl = CopyPrm.CustomLbl - I.FontSize = CopyPrm.FontSize - I.Sldr_H = CopyPrm.Sldr_H - I.BgClr = CopyPrm.BgClr - I.GrbClr = CopyPrm.GrbClr - I.Lbl_Pos = CopyPrm.Lbl_Pos - I.V_Pos = CopyPrm.V_Pos - I.Lbl_Clr = CopyPrm.Lbl_Clr - I.V_Clr = CopyPrm.V_Clr - I.DragDir = CopyPrm.DragDir - I.Value_Thick = CopyPrm.Value_Thick - I.V_Pos_X = CopyPrm.V_Pos_X - I.V_Pos_Y = CopyPrm.V_Pos_Y - I.ImagePath = CopyPrm.ImagePath - if CopyPrm.Draw then - -- use this line to pool - --I.Draw = CopyPrm.Draw - - I.Draw = I.Draw or {} - for i, v in pairs(CopyPrm.Draw) do - I.Draw[i] = I.Draw[i] or {} - for d, v in pairs(v) do - I.Draw[i][d] = v - end - end - end - end - end - end - SL(nil, 30) - - if Draw.DrawMode[FxGUID] then - if r.ImGui_Button(ctx, 'Exit Background Edit') then Draw.DrawMode[FxGUID] = false end - else - if r.ImGui_Button(ctx, 'Enter Background Edit') then - Draw.DrawMode[FxGUID] = true - if Draw[FX.Win_Name_S[FX_Idx]] == nil then - Draw[FX.Win_Name_S[FX_Idx]] = { - Rect = {}, - clr = {}, - ItemInst = {}, - L = {}, - R = {}, - Y = {}, - T = {}, - B = {}, - Type = {}, - FxGUID = {}, - Txt = {} - } - end - LE.Sel_Items = {} - end - end - - - - - r.ImGui_Separator(ctx) - - - local ColorPaletteTop = r.ImGui_GetCursorPosY - - - - - -- Add Drawings ---- - if not LE.Sel_Items[1] then - if Draw.DrawMode[FxGUID] ~= true then - r.ImGui_TextWrapped(ctx, 'Select an item to start editing') - AddSpacing(15) - else - r.ImGui_Text(ctx, '(!) Hold down Left button to Draw in FX Devices') - AddSpacing (5) - r.ImGui_Text(ctx, 'Type:') - r.ImGui_SameLine(ctx) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_FrameBg(), 0x99999933) - local D = Draw[FX.Win_Name_S[FX_Idx]] - local FullWidth = -50 - - local typelbl; local It = Draw.SelItm - D[It or 1] = D[It or 1] or {} - - if Draw.SelItm then typelbl = D.Type[Draw.SelItm] end - if Draw.Type == nil then Draw.Type = 'line' end - r.ImGui_SetNextItemWidth(ctx, FullWidth) - if r.ImGui_BeginCombo(ctx, '##', typelbl or Draw.Type or 'line', r.ImGui_ComboFlags_NoArrowButton()) then - local function setType(str) - if r.ImGui_Selectable(ctx, str) then - if It then D.Type[It] = str end - Draw.Type = str - end - end - setType('Picture') - setType('line') - setType('V-line') - setType('rectangle') - setType('rect fill') - setType('circle') - setType('circle fill') - setType('Text') - - r.ImGui_EndCombo(ctx) - end - r.ImGui_Text(ctx, 'Color :') - r.ImGui_SameLine(ctx) - if Draw.SelItm and D.clr[Draw.SelItm] then - clrpick, D.clr[Draw.SelItm] = r.ImGui_ColorEdit4(ctx, '##', - D.clr[Draw.SelItm] or 0xffffffff, - r.ImGui_ColorEditFlags_NoInputs()| - r.ImGui_ColorEditFlags_AlphaPreviewHalf()| - reaper.ImGui_ColorEditFlags_AlphaBar()) - else - clrpick, Draw.clr = r.ImGui_ColorEdit4(ctx, '##', Draw.clr or 0xffffffff, - r.ImGui_ColorEditFlags_NoInputs()| - r.ImGui_ColorEditFlags_AlphaPreviewHalf()| - reaper.ImGui_ColorEditFlags_AlphaBar()) - end - r.ImGui_Text(ctx, 'Default edge rounding :') - r.ImGui_SameLine(ctx) - r.ImGui_SetNextItemWidth(ctx, 40) - EditER, Draw.Df_EdgeRound[FxGUID] = r.ImGui_DragDouble(ctx, '##' .. FxGUID, Draw.Df_EdgeRound[FxGUID], 0.05, 0, 30, '%.2f') - - - - if D.Type[It] == 'Picture' then - r.ImGui_Text(ctx, 'File Path:') - SL() - DragDropPics = DragDropPics or {} - - if r.ImGui_BeginChildFrame(ctx, '##drop_files', FullWidth, 40) then - if not D[It].FilePath then - r.ImGui_Text(ctx, 'Drag and drop files here...') - else - r.ImGui_Text(ctx, D[It].FilePath) - - if r.ImGui_SmallButton(ctx, 'Clear') then - - end - end - if D[It].FilePath then - r.ImGui_Bullet(ctx) - r.ImGui_TextWrapped(ctx, D[It].FilePath) - end - r.ImGui_EndChildFrame(ctx) - end - - - if r.ImGui_BeginDragDropTarget(ctx) then - local rv, count = r.ImGui_AcceptDragDropPayloadFiles(ctx) - if rv then - for i = 0, count - 1 do - local filename - rv, filename = r.ImGui_GetDragDropPayloadFile(ctx, i) - D[It].FilePath = filename - - D[It].Image = r.ImGui_CreateImage(filename) - r.ImGui_Attach(ctx, D[It].Image) - - end - end - r.ImGui_EndDragDropTarget(ctx) - end - - rv, D[It].KeepImgRatio = r.ImGui_Checkbox(ctx, 'Keep Image Ratio', - D[It].KeepImgRatio) - end - - if Draw.SelItm then - r.ImGui_Text(ctx, 'Start Pos X:') - r.ImGui_SameLine(ctx) - local CurX = r.ImGui_GetCursorPosX(ctx) - r.ImGui_SetNextItemWidth(ctx, FullWidth) - _, D.L[It] = r.ImGui_DragDouble(ctx, '##' .. Draw.SelItm .. 'L', D.L[Draw.SelItm], 1, 0, Win_W, '%.0f') - if D.Type[It] ~= 'V-line' and D.Type[It] ~= 'circle' and D.Type[It] ~= 'circle fill' then - r.ImGui_Text(ctx, 'End Pos X:') - r.ImGui_SetNextItemWidth(ctx, FullWidth) - - r.ImGui_SameLine(ctx, CurX) - _, D.R[It] = r.ImGui_DragDouble(ctx, '##' .. Draw.SelItm .. 'R', - D.R[Draw.SelItm], 1, 0, Win_W, '%.0f') - end - - if D.Type[It] == 'circle' or D.Type[It] == 'circle fill' then - r.ImGui_Text(ctx, 'Radius:') - r.ImGui_SameLine(ctx) - r.ImGui_SetNextItemWidth(ctx, FullWidth) - _, D.R[It] = r.ImGui_DragDouble(ctx, '##' .. Draw.SelItm .. 'R', D.R[Draw.SelItm], 1, 0, Win_W, '%.0f') - end - - - r.ImGui_Text(ctx, 'Start Pos Y:') - - r.ImGui_SameLine(ctx) - r.ImGui_SetNextItemWidth(ctx, FullWidth) - - _, D.T[Draw.SelItm] = r.ImGui_DragDouble(ctx, '##' .. Draw.SelItm .. 'T', - D.T[Draw.SelItm], 1, 0, Win_W, '%.0f') - - - if D.Type[It] ~= 'line' and D.Type[It] ~= 'circle fill' and D.Type[It] ~= 'circle' then - r.ImGui_Text(ctx, 'End Pos Y:') - r.ImGui_SameLine(ctx, CurX) - r.ImGui_SetNextItemWidth(ctx, FullWidth) - - _, D.B[It] = r.ImGui_DragDouble(ctx, '##' .. It .. 'B', D.B[It], 1, 0, - Win_W, '%.0f') - end - - if D.Type[It] == 'Text' then - r.ImGui_Text(ctx, 'Text:') - r.ImGui_SameLine(ctx) - - _, D.Txt[It] = r.ImGui_InputText(ctx, '##' .. It .. 'Txt', D.Txt[It]) - - SL() - r.ImGui_Text(ctx, 'Font Size:') - local rv, Sz = r.ImGui_InputInt(ctx, '## font size '.. It , D[It].FtSize or 12) - if rv then - D[It].FtSize = Sz - if not _G['Font_Andale_Mono' .. '_'..Sz] then - _G['Font_Andale_Mono' .. '_'..Sz] = r.ImGui_CreateFont('andale mono', Sz) - ChangeFont = D[It] - else D[It].Font = _G['Font_Andale_Mono' .. '_'..Sz] - end - - end - end - end - - - - r.ImGui_PopStyleColor(ctx) - end - elseif LE.Sel_Items[1] then - local ID, TypeID; local FrstSelItm = FX[FxGUID][LE.Sel_Items[1]]; local FItm = LE - .Sel_Items[1] - local R_ofs = 50 - if LE.Sel_Items[1] and not LE.Sel_Items[2] then - ID = FxGUID .. LE.Sel_Items[1] - WidthID = FxGUID .. LE.Sel_Items[1] - ClrID = FxGUID .. LE.Sel_Items[1] - GrbClrID = FxGUID .. LE.Sel_Items[1] - TypeID = FxGUID .. LE.Sel_Items[1] - elseif LE.Sel_Items[2] then - local Diff_Types_Found, Diff_Width_Found, Diff_Clr_Found, Diff_GrbClr_Found - for i, v in pairs(LE.Sel_Items) do - local lastV - if i > 1 then - local frst = LE.Sel_Items[1]; local other = LE.Sel_Items[i]; - if FX[FxGUID][1].Type ~= FX[FxGUID][v].Type then Diff_Types_Found = true end - --if FX[FxGUID][frst].Sldr_W ~= FX[FxGUID][v].Sldr_W then Diff_Width_Found = true end - --if FX[FxGUID][frst].BgClr ~= FX[FxGUID][v].BgClr then Diff_Clr_Found = true end - --if FX[FxGUID][frst].GrbClr ~= FX[FxGUID][v].GrbClr then Diff_GrbClr_Found = true end - end - end - if Diff_Types_Found then - TypeID = 'Group' - else - TypeID = FxGUID .. LE.Sel_Items - [1] - end - if Diff_Width_Found then - WidthID = 'Group' - else - WidthID = FxGUID .. - LE.Sel_Items[1] - end - if Diff_Clr_Found then ClrID = 'Group' else ClrID = FxGUID .. LE.Sel_Items[1] end - if Diff_GrbClr_Found then - GrbClrID = 'Group' - else - GrbClrID = FxGUID .. - LE.Sel_Items[1] - end - ID = FxGUID .. LE.Sel_Items[1] - else - ID = FxGUID .. LE.Sel_Items[1] - end - local function FreeValuePosSettings() - if FrstSelItm.V_Pos == 'Free' then - r.ImGui_Text(ctx, 'X:') - SL() - r.ImGui_SetNextItemWidth(ctx, 50) - local EditPosX, PosX = r.ImGui_DragDouble(ctx, - ' ##EditValuePosX' .. FxGUID .. LE.Sel_Items[1], FrstSelItm.V_Pos_X or 0, - 0.25, nil, nil, '%.2f') - SL() - if EditPosX then - for i, v in pairs(LE.Sel_Items) do FrstSelItm.V_Pos_X = PosX end - end - r.ImGui_Text(ctx, 'Y:') - SL() - r.ImGui_SetNextItemWidth(ctx, 50) - local EditPosY, PosY = r.ImGui_DragDouble(ctx, - ' ##EditValuePosY' .. FxGUID .. LE.Sel_Items[1], FrstSelItm.V_Pos_Y or 0, - 0.25, nil, nil, '%.2f') - SL() - if EditPosY then - for i, v in pairs(LE.Sel_Items) do FrstSelItm.V_Pos_Y = PosY end - end - end - end - local function FreeLblPosSettings() - if FrstSelItm.Lbl_Pos == 'Free' then - r.ImGui_Text(ctx, 'X:') - SL() - r.ImGui_SetNextItemWidth(ctx, 50) - local EditPosX, PosX = r.ImGui_DragDouble(ctx, - ' ##EditLblPosX' .. FxGUID .. LE.Sel_Items[1], FrstSelItm.Lbl_Pos_X or 0, - 0.25, nil, nil, '%.2f') - SL() - if EditPosX then - for i, v in pairs(LE.Sel_Items) do FrstSelItm.Lbl_Pos_X = PosX end - end - r.ImGui_Text(ctx, 'Y:') - SL() - r.ImGui_SetNextItemWidth(ctx, 50) - local EditPosY, PosY = r.ImGui_DragDouble(ctx, - ' ##EditLblPosY' .. FxGUID .. LE.Sel_Items[1], FrstSelItm.Lbl_Pos_Y or 0, - 0.25, nil, nil, '%.2f') - SL() - if EditPosY then - for i, v in pairs(LE.Sel_Items) do FrstSelItm.Lbl_Pos_Y = PosY end - end - end - end - local function AddOption(Name, TargetVar, TypeCondition) - if FrstSelItm.Type == TypeCondition or not TypeCondition then - if r.ImGui_Selectable(ctx, Name) then - for i, v in pairs(LE.Sel_Items) do FX[FxGUID][v][TargetVar] = Name end - end - end - end - - -----Type-------- - - local PrmTypeLbl - - if TypeID == 'Group' then - PrmTypeLbl = 'Multiple Values' - else - PrmTypeLbl = FrstSelItm.Type or '' - end - if not FrstSelItm.Type then FrstSelItm.Type = FX.Def_Type[FxGUID] end - r.ImGui_Text(ctx, 'Type : '); r.ImGui_SameLine(ctx); r.ImGui_PushStyleColor(ctx, - r.ImGui_Col_FrameBg(), 0x444444aa) - r.ImGui_SetNextItemWidth(ctx, -R_ofs) - if r.ImGui_BeginCombo(ctx, '##', PrmTypeLbl, r.ImGui_ComboFlags_NoArrowButton()) then - local function SetItemType(Type) - for i, v in pairs(LE.Sel_Items) do - FX[FxGUID][v].Sldr_W = nil - FX[FxGUID][v].Type = Type - end - end - - if r.ImGui_Selectable(ctx, 'Slider') then - SetItemType('Slider') - elseif r.ImGui_Selectable(ctx, 'Knob') then - SetItemType('Knob') - elseif r.ImGui_Selectable(ctx, 'V-Slider') then - SetItemType('V-Slider') - elseif r.ImGui_Selectable(ctx, 'Drag') then - SetItemType('Drag') - elseif r.ImGui_Selectable(ctx, 'Switch') then - SetItemType('Switch') - elseif r.ImGui_Selectable(ctx, 'Selection') then - SetItemType('Selection') - end - r.ImGui_EndCombo(ctx) - end - - ---Label Show only when there's one item selected----- - if LE.Sel_Items[1] and not LE.Sel_Items[2] then - r.ImGui_Text(ctx, 'Label: '); r.ImGui_SameLine(ctx) - r.ImGui_SetNextItemWidth(ctx, -R_ofs) - local LblEdited, buf = r.ImGui_InputText(ctx, - ' ##Edit Title' .. FxGUID .. LE.Sel_Items[1], FrstSelItm.CustomLbl or buf) - if r.ImGui_IsItemActivated(ctx) then EditingPrmLbl = LE.Sel_Items[1] end - if r.ImGui_IsItemDeactivatedAfterEdit(ctx) then FrstSelItm.CustomLbl = buf end - end - - --Label Pos - r.ImGui_Text(ctx, 'Label Pos: '); r.ImGui_SameLine(ctx); r.ImGui_SetNextItemWidth( - ctx, 100) - if r.ImGui_BeginCombo(ctx, '## Lbl Pos' .. LE.Sel_Items[1], FrstSelItm.Lbl_Pos or 'Default', r.ImGui_ComboFlags_NoArrowButton()) then - if FrstSelItm.Type == 'Knob' or FrstSelItm.Type == 'V-Slider' then - AddOption('Top', 'Lbl_Pos') - AddOption('Bottom', 'Lbl_Pos') - elseif FrstSelItm.Type == 'Slider' or FrstSelItm.Type == 'Drag' then - AddOption('Left', 'Lbl_Pos') - AddOption('Bottom', 'Lbl_Pos') - elseif FrstSelItm.Type == 'Selection' or FrstSelItm.Type == 'Switch' then - AddOption('Top', 'Lbl_Pos') - AddOption('Left', 'Lbl_Pos') - if FrstSelItm.Type == 'Switch' then AddOption('Within', 'Lbl_Pos') end - AddOption('Bottom', 'Lbl_Pos') - AddOption('Right', 'Lbl_Pos') - AddOption("None", 'Lbl_Pos') - end - AddOption('Free', 'Lbl_Pos') - r.ImGui_EndCombo(ctx) - end - r.ImGui_SameLine(ctx) - FreeLblPosSettings() - -- Label Color - DragLbl_Clr_Edited, Lbl_V_Clr = r.ImGui_ColorEdit4(ctx, '##Lbl Clr' .. - LE.Sel_Items[1], FrstSelItm.Lbl_Clr or r.ImGui_GetColor(ctx, r.ImGui_Col_Text()), - r.ImGui_ColorEditFlags_NoInputs()| r.ImGui_ColorEditFlags_AlphaPreviewHalf()| - r.ImGui_ColorEditFlags_AlphaBar()) - if DragLbl_Clr_Edited then - for i, v in pairs(LE.Sel_Items) do FX[FxGUID][v].Lbl_Clr = Lbl_V_Clr end - end - - - r.ImGui_Text(ctx, 'Value Pos: '); r.ImGui_SameLine(ctx); r.ImGui_SetNextItemWidth( - ctx, 100) - if r.ImGui_BeginCombo(ctx, '## V Pos' .. LE.Sel_Items[1], FrstSelItm.V_Pos or 'Default', r.ImGui_ComboFlags_NoArrowButton()) then - if FrstSelItm.Type == 'V-Slider' then - AddOption('Bottom', 'V_Pos') - AddOption('Top', 'V_Pos') - elseif FrstSelItm.Type == 'Knob' then - AddOption('Bottom', 'V_Pos') - AddOption('Within', 'V_Pos') - elseif FrstSelItm.Type == 'Switch' or FrstSelItm.Type == 'Selection' then - AddOption('Within', 'V_Pos') - elseif FrstSelItm.Type == 'Drag' then - AddOption('Right', 'V_Pos') - AddOption('Within', 'V_Pos') - elseif FrstSelItm.Type == 'Slider' then - AddOption('Right', 'V_Pos') - end - if FrstSelItm.Type ~= 'Selection' then AddOption('None', 'V_Pos') end - - AddOption('Free', 'V_Pos') - - r.ImGui_EndCombo(ctx) - end - r.ImGui_SameLine(ctx) - - FreeValuePosSettings() - DragV_Clr_edited, Drag_V_Clr = r.ImGui_ColorEdit4(ctx, '##V Clr' .. LE.Sel_Items[1], - FrstSelItm.V_Clr or r.ImGui_GetColor(ctx, r.ImGui_Col_Text()), - r.ImGui_ColorEditFlags_NoInputs()| r.ImGui_ColorEditFlags_AlphaPreviewHalf()| - r.ImGui_ColorEditFlags_AlphaBar()) - if DragV_Clr_edited then - for i, v in pairs(LE.Sel_Items) do FX[FxGUID][v].V_Clr = Drag_V_Clr end - end - - if FrstSelItm.Type == 'Drag' then - r.ImGui_Text(ctx, 'Direction: ') - r.ImGui_SameLine(ctx) - r.ImGui_SetNextItemWidth(ctx, -R_ofs) - if r.ImGui_BeginCombo(ctx, '## Drag Dir' .. LE.Sel_Items[1], FrstSelItm.DragDir or '', r.ImGui_ComboFlags_NoArrowButton()) then - if r.ImGui_Selectable(ctx, 'Right') then - for i, v in pairs(LE.Sel_Items) do FX[FxGUID][v].DragDir = 'Right' end - elseif r.ImGui_Selectable(ctx, 'Left-Right') then - for i, v in pairs(LE.Sel_Items) do FX[FxGUID][v].DragDir = 'Left-Right' end - elseif r.ImGui_Selectable(ctx, 'Left') then - for i, v in pairs(LE.Sel_Items) do FX[FxGUID][v].DragDir = 'Left' end - end - r.ImGui_EndCombo(ctx) - end - end - - - - - - - - - if FrstSelItm.Type == 'Switch' then - local Momentary, Toggle - if FrstSelItm.SwitchType == 'Momentary' then - Momentary = true - else - Toggle = true - end - EdT, Tg = r.ImGui_Checkbox(ctx, 'Toggle##' .. FxGUID .. LE.Sel_Items[1], Toggle) - r.ImGui_SameLine(ctx); - EdM, Mt = r.ImGui_Checkbox(ctx, 'Momentary##' .. FxGUID .. LE.Sel_Items[1], - Momentary) - if EdT then - for i, v in pairs(LE.Sel_Items) do FX[FxGUID][v].SwitchType = 'Toggle' end - elseif EdM then - for i, v in pairs(LE.Sel_Items) do FX[FxGUID][v].SwitchType = 'Momentary' end - end - end - - - - -- set base and target value - if FrstSelItm.SwitchType == 'Momentary' and FrstSelItm.Type == 'Switch' then - r.ImGui_Text(ctx, 'Base Value: ') - r.ImGui_SameLine(ctx); r.ImGui_SetNextItemWidth(ctx, 80) - local Drag, Bv = r.ImGui_DragDouble(ctx, - '##EditBaseV' .. FxGUID .. (LE.Sel_Items[1] or ''), - FX[FxGUID][LE.Sel_Items[1]].SwitchBaseV or 0, 0.05, 0, 1, '%.2f') - if Drag then - for i, v in pairs(LE.Sel_Items) do - FX[FxGUID][LE.Sel_Items[1]].SwitchBaseV =Bv - end - end - r.ImGui_Text(ctx, 'Target Value: ') - r.ImGui_SameLine(ctx); r.ImGui_SetNextItemWidth(ctx, 80) - local Drag, Tv = r.ImGui_DragDouble(ctx, - '##EditTargV' .. FxGUID .. (LE.Sel_Items[1] or ''), - FX[FxGUID][LE.Sel_Items[1]].SwitchTargV or 1, 0.05, 0, 1, '%.2f') - if Drag then - for i, v in pairs(LE.Sel_Items) do - FX[FxGUID][LE.Sel_Items[1]].SwitchTargV = - Tv - end - end - end - - - - - - - - - - local FLT_MIN, FLT_MAX = r.ImGui_NumericLimits_Float() - ----Font Size----- - - - r.ImGui_Text(ctx, 'Label Font Size: '); r.ImGui_SameLine(ctx) - r.ImGui_SetNextItemWidth(ctx, 50) - local Drag, ft = r.ImGui_DragDouble(ctx, '##EditFontSize' .. FxGUID ..(LE.Sel_Items[1] or ''),FrstSelItm.FontSize or Knob_DefaultFontSize, 0.25, 6, 64, '%.2f') - if Drag then - local sz = roundUp( ft , 1) - if not _G['Font_Andale_Mono' .. '_'..sz] then - _G['Font_Andale_Mono' .. '_'..sz] = r.ImGui_CreateFont('andale mono', sz) - ChangeFont = FrstSelItm - ChangeFont_Size = sz - end - - for i, v in pairs(LE.Sel_Items) do - FX[FxGUID][v].FontSize = ft - end - end - - - - - - - SL() - r.ImGui_Text(ctx, 'Value Font Size: '); r.ImGui_SameLine(ctx) - r.ImGui_SetNextItemWidth(ctx, 50) - local Drag, ft = r.ImGui_DragDouble(ctx,'##EditV_FontSize' .. FxGUID .. (LE.Sel_Items[1] or ''),FX[FxGUID][LE.Sel_Items[1]].V_FontSize or Knob_DefaultFontSize, 0.25, 6, 64,'%.2f') - if Drag then - local sz = roundUp( ft , 1) - if not _G['Arial' .. '_'..sz] then - _G['Arial' .. '_'..sz] = r.ImGui_CreateFont('Arial', sz) - ChangeFont = FrstSelItm - ChangeFont_Size = sz - ChangeFont_Font = 'Arial' - end - for i, v in pairs(LE.Sel_Items) do - FX[FxGUID][v].V_FontSize = ft - end - end - - - - - - - - - ----Width ------- - r.ImGui_Text(ctx, 'Width: '); r.ImGui_SameLine(ctx) - r.ImGui_SetNextItemWidth(ctx, -R_ofs) - local DefaultW, MaxW, MinW - if FrstSelItm.Type == 'Knob' then - DefaultW = Df.KnobRadius - MaxW = 80 - MinW = 7.5 - elseif FrstSelItm.Type == 'Slider' or FrstSelItm.Type == 'Drag' or not FrstSelItm.Type then - DefaultW = Df.Sldr_W - MaxW = 300 - MinW = 40 - elseif FrstSelItm.Type == 'Selection' then - DefaultW = FrstSelItm.Combo_W - MaxW = 300 - MinW = 20 - elseif FrstSelItm.Type == 'Switch' then - DefaultW = FrstSelItm.Switch_W - MaxW = 300 - MinW = 15 - elseif FrstSelItm.Type == 'V-Slider' then - DefaultW = FrstSelItm.V_Sldr_W - MaxW = 60 - MinW = 7 - end - local DragSpeed = 5 - - - - local _, W = r.ImGui_DragDouble(ctx, - '##EditWidth' .. FxGUID .. (LE.Sel_Items[1] or ''), - FX[FxGUID][LE.Sel_Items[1] or ''].Sldr_W or DefaultW, LE.GridSize / 4, MinW, MaxW, - '%.1f') - - if r.ImGui_IsItemEdited(ctx) then - for i, v in pairs(LE.Sel_Items) do - FX[FxGUID][v].Sldr_W = W - - end - end - - if FrstSelItm.Type == 'Knob' or FrstSelItm.Type == 'Drag' or FrstSelItm.Type == 'Slider' then - r.ImGui_Text(ctx, 'Value Decimal Places: '); r.ImGui_SameLine(ctx) - r.ImGui_SetNextItemWidth(ctx, 80) - if not FX[FxGUID][LE.Sel_Items[1]].V_Round then - local _, FormatV = r.TrackFX_GetFormattedParamValue(LT_Track, FX_Idx, - FX[FxGUID][LE.Sel_Items[1]].Num) - local _, LastNum = FormatV:find('^.*()%d') - local dcm = FormatV:find('%.') - if dcm then - rd = LastNum - dcm - end - end - - local Edit, rd = r.ImGui_InputInt(ctx, - '##EditValueDecimals' .. FxGUID .. (LE.Sel_Items[1] or ''), - FrstSelItm.V_Round or rd, 1) - if Edit then - for i, v in pairs(LE.Sel_Items) do - FX[FxGUID][v].V_Round = math.max( - rd, 0) - end - end - end - - r.ImGui_Text(ctx, 'Value to Note Length: '); r.ImGui_SameLine(ctx) - r.ImGui_SetNextItemWidth(ctx, 80) - local Edit = r.ImGui_Checkbox(ctx, - '##Value to Note Length' .. FxGUID .. (LE.Sel_Items[1] or ''), - FrstSelItm.ValToNoteL or nil) - if Edit then - for i, v in pairs(LE.Sel_Items) do - if not FX[FxGUID][v].ValToNoteL then - FX[FxGUID][v].ValToNoteL = true - else - FX[FxGUID][v].ValToNoteL = false - end - end - end - if FrstSelItm.Type == 'Selection' then --r.ImGui_Text(ctx,'Edit Values Manually: ') ;r.ImGui_SameLine(ctx) - local Itm = LE.Sel_Items[1] - local FP = FX[FxGUID][Itm] - - - - if r.ImGui_TreeNode(ctx, 'Edit Values Manually') then - FX[FxGUID][Itm].ManualValues = FX[FxGUID][Itm].ManualValues or {} - FX[FxGUID][Itm].ManualValuesFormat = FX[FxGUID][Itm].ManualValuesFormat or {} - if r.ImGui_Button(ctx, 'Get Current Value##' .. FxGUID .. (Itm or '')) then - local Val = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, FP.Num) - if not tablefind(FP.ManualValues, Val) then - table.insert(FX[FxGUID][Itm].ManualValues, Val) - end - end - for i, V in ipairs(FX[FxGUID][Itm].ManualValues) do - r.ImGui_AlignTextToFramePadding(ctx) - r.ImGui_Text(ctx, i .. ':' .. (round(V, 2) or 0)) - SL() - --r.ImGui_SetNextItemWidth(ctx, -R_ofs) - rv, FX[FxGUID][Itm].ManualValuesFormat[i] = r.ImGui_InputText(ctx, - '##' .. FxGUID .. "Itm=" .. (Itm or '') .. 'i=' .. i, - FX[FxGUID][Itm].ManualValuesFormat[i]) - SL() - local LH = r.ImGui_GetTextLineHeight(ctx) - if IconBtn(20, 20, 'T', BgClr, 'center', '##' .. FxGUID .. "Itm=" .. (Itm or '') .. 'i=' .. i) then - table.remove(FX[FxGUID][Itm].ManualValuesFormat, i) - table.remove(FX[FxGUID][Itm].ManualValues, i) - end - end - --FX[FxGUID][Itm].EditValuesManual = true - r.ImGui_TreePop(ctx) - end - end - - function ToAllSelItm(x,y) - for i, v in ipairs(LE.Sel_Items) do - FX[FxGUID][v][x] = y - end - end - - - local FLT_MIN, FLT_MAX = r.ImGui_NumericLimits_Float() - - --- Style ------ - r.ImGui_Text(ctx, 'Style: '); r.ImGui_SameLine(ctx) - w = r.ImGui_CalcTextSize(ctx, 'Style: ') - local stylename - if FrstSelItm.Style == 'Pro C' then stylename = 'Minimalistic' end - if r.ImGui_Button(ctx, (stylename or FrstSelItm.Style or 'Choose Style') .. '##' .. (LE.Sel_Items[1] or 'Style'), 130) then - r.ImGui_OpenPopup(ctx, 'Choose style window') - end - - - r.ImGui_Text(ctx, 'Add Custom Image:') - - DragDropPics = DragDropPics or {} - - rv , ImgTrashTint = TrashIcon (16, 'Clear',ClrBG , ImgTrashTint) - if rv then - ToAllSelItm('Style', nil) - ToAllSelItm('ImagePath', nil) - ToAllSelItm('Image', nil) - end - - - SL() - if r.ImGui_BeginChildFrame(ctx, '##drop_files', -R_ofs, 20) then - if not FrstSelItm.ImagePath then - r.ImGui_Text(ctx, 'Drag and drop files here...') - else - --FrstSelItm.Style = 'Custom Image' - - r.ImGui_Text(ctx, FrstSelItm.ImagePath) - - - end - - r.ImGui_EndChildFrame(ctx) - end - - if r.ImGui_BeginDragDropTarget(ctx) then - local rv, count = r.ImGui_AcceptDragDropPayloadFiles(ctx) - if rv then - for i = 0, count - 1 do - - - local rv, filename = r.ImGui_GetDragDropPayloadFile(ctx, i) - if rv then - FrstSelItm.Style = 'Custom Image' - --[[ local UserOS = r.GetOS() - local slash = '%\\' - if UserOS == "OSX32" or UserOS == "OSX64" or UserOS == "macOS-arm64" then - slash = '/' - end - local index = filename:match ('^.*()'..slash) - local SubFolder = '' - if FrstSelItm.Type == 'Knob' then - SubFolder = 'Knobs' - end - - local NewFileName = r.GetResourcePath() .. '/Scripts/ReaTeam Scripts/FX/BryanChi_FX Devices/Images/' .. SubFolder .. filename:sub(index) - CopyFile(filename, NewFileName) ]] - - AbsPath, FrstSelItm.ImagePath = CopyImageFile(filename, 'Knobs') - ToAllSelItm('Image', r.ImGui_CreateImage(AbsPath)) - end - - --[[ AttachImage = { Path = FrstSelItm.ImagePath, DrawItemNum = It, } - if AttachImage then - local FX_Name_Short = ChangeFX_Name(FX_Name) - FrstSelItm.Image = r.ImGui_CreateImage(AttachImage.Path) - r.ImGui_Attach(ctx, FrstSelItm.Image) - AttachImage = nil - end ]] - end - end - r.ImGui_EndDragDropTarget(ctx) - end - - --[[ if r.ImGui_BeginCombo( ctx, '##'..(LE.Sel_Items[1] or 'Style') , FrstSelItm.Style or 'Choose Style', nil) then - local function AddStyle (Name, Style) - if r.ImGui_Selectable(ctx, Name) then - for i, v in pairs (LE.Sel_Items) do - FX[FxGUID][v].Style = Style ; r.ImGui_CloseCurrentPopup(ctx) - end - end - end - local T = {Name ={}; Style = {}} - T.Name={'Default', 'Minimalistic', 'Analog 1'} - T.Style = {'Default', 'Pro C', 'Analog 1'} - - for i, v in ipairs(T.Name) do - AddStyle(v, T.Style[i]) - end - - r.ImGui_EndCombo(ctx) - - end ]] - - - if r.ImGui_BeginPopup(ctx, 'Choose style window') then - r.ImGui_BeginDisabled(ctx) - - local function setItmStyle(Style, img, ImgPath) - for i, v in pairs(LE.Sel_Items) do - FX[FxGUID][v].Style = Style; - if img then - FX[FxGUID][v].Image = img - FX[FxGUID][v].ImagePath = ImgPath - else - FX[FxGUID][v].ImagePath = nil - end - - r.ImGui_CloseCurrentPopup(ctx) - end - end - if FrstSelItm.Type == 'Slider' or (not FrstSelItm.Type and FX.Def_Type[FxGUID] == 'Slider') then -- if all selected itms are Sliders - --AddSlider(ctx, '##'..FrstSelItm.Name , 'Default', 0, 0, 1, v,FX_Idx, FrstSelItm.Num ,Style, FrstSelItm.Sldr_W or FX.Def_Sldr_W[FxGUID] ,0, Disable, Vertical, GrabSize, FrstSelItm.Lbl, 8) - --AddSlider(ctx, '##'..FrstSelItm.Name , 'Default', 0, 0, 1, v,FX_Idx, FrstSelItm.Num ,Style, FrstSelItm.Sldr_W or FX.Def_Sldr_W[FxGUID] ,0, Disable, Vertical, GrabSize, FrstSelItm.Lbl, 8) - end - StyleWinFilter = r.ImGui_CreateTextFilter(FilterText) - if FrstSelItm.Type == 'Knob' or (not FrstSelItm.Type and FX.Def_Type[FxGUID] == 'Knob') then -- if all selected itms are knobs - StyleWinImg = StyleWinImg or {} - StyleWinImgName = StyleWinImgName or {} - local function SetStyle(Name, Style,Img, ImagePath) - - - if r.ImGui_TextFilter_PassFilter(StyleWinFilter, Name) then - r.ImGui_Text(ctx, Name) - AddKnob(ctx, '##' .. FrstSelItm.Name, '', 0, 0, 1, FItm, FX_Idx,FrstSelItm.Num, Style, 15, 0, Disabled, 12, Lbl_Pos, V_Pos, Img) - if HighlightHvredItem() then --if clicked on highlighted itm - setItmStyle(Style, Img,ImagePath) - r.ImGui_CloseCurrentPopup(ctx) - end - AddSpacing(6) - end - - end - - - r.ImGui_EndDisabled(ctx) - if r.ImGui_TextFilter_Draw(StyleWinFilter, ctx, '##StyleWinFilterTxt', -1) then - FilterText = r.ImGui_TextFilter_Get(StyleWinFilter) - r.ImGui_TextFilter_Set(StyleWinFilter, FilterText) - end - if r.ImGui_IsWindowAppearing(ctx ) then - r.ImGui_SetKeyboardFocusHere(ctx) - end - - r.ImGui_BeginDisabled(ctx) - - - SetStyle('Default', Style) - SetStyle('Minimalistic', 'Pro C') - SetStyle('Invisible', 'Invisible') - local Dir = r.GetResourcePath() ..'/Scripts/ReaTeam Scripts/FX/BryanChi_FX Devices/Images/Knobs' - - if r.ImGui_IsWindowAppearing(ctx) then - - StyleWindowImgFiles = scandir (Dir) - if StyleWindowImgFiles then - for i, v in ipairs( StyleWindowImgFiles) do - if v ~= '.DS_Store' then - - StyleWinImg[i] = r.ImGui_CreateImage (Dir..'/'..v) - r.ImGui_Attach(ctx, StyleWinImg[i]) - StyleWinImgName[i] = v - end - end - end - end - - for i, v in pairs(StyleWinImg )do - SetStyle(StyleWinImgName[i], 'Custom Image', StyleWinImg[i], Dir..'/'..StyleWinImgName[i]) - end - - - - - end - - if FrstSelItm.Type == 'Selection' then - local function SetStyle(Name, Style, Width, CustomLbl) - AddCombo(ctx, LT_Track, FX_Idx, Name .. '##' .. FrstSelItm.Name, - FrstSelItm.Num, Options, Width, Style, FxGUID, LE.Sel_Items[1], - OptionValues, 'Options', CustomLbl) - if HighlightHvredItem() then - setItmStyle(Style) - r.ImGui_CloseCurrentPopup(ctx) - end - AddSpacing(3) - end - local w = 60 - SetStyle('Default', nil, w, 'Default: ') - - SetStyle('up-down arrow', 'up-down arrow', w + 20, 'up-down arrow: ') - end - - r.ImGui_EndDisabled(ctx) - r.ImGui_EndPopup(ctx) - end - ---Pos ------- - - r.ImGui_Text(ctx, 'Pos-X: '); r.ImGui_SameLine(ctx) - r.ImGui_SetNextItemWidth(ctx, 80) - local EditPosX, PosX = r.ImGui_DragDouble(ctx, ' ##EditPosX' .. - FxGUID .. LE.Sel_Items[1], PosX or FrstSelItm.PosX, LE.GridSize, 0, Win_W - 10, - '%.0f') - if EditPosX then - for i, v in pairs(LE.Sel_Items) do FX[FxGUID][v].PosX = PosX end - end - SL() - r.ImGui_Text(ctx, 'Pos-Y: '); r.ImGui_SameLine(ctx) - r.ImGui_SetNextItemWidth(ctx, 80) - local EditPosY, PosY = r.ImGui_DragDouble(ctx, ' ##EditPosY' .. - FxGUID .. LE.Sel_Items[1], PosY or FrstSelItm.PosY, LE.GridSize, 20, 210, '%.0f') - if EditPosY then for i, v in pairs(LE.Sel_Items) do FX[FxGUID][v].PosY = PosY end end - - ---Color ----- - - r.ImGui_Text(ctx, 'Color: ') - r.ImGui_SameLine(ctx) - ClrEdited, PrmBgClr = r.ImGui_ColorEdit4(ctx, '##Clr' .. ID, - FrstSelItm.BgClr or r.ImGui_GetColor(ctx, r.ImGui_Col_FrameBg()), - r.ImGui_ColorEditFlags_NoInputs()| r.ImGui_ColorEditFlags_AlphaPreviewHalf()| - reaper.ImGui_ColorEditFlags_AlphaBar()) - if not FX[FxGUID][LE.Sel_Items[1]].BgClr or FX[FxGUID][LE.Sel_Items[1]] == r.ImGui_GetColor(ctx, r.ImGui_Col_FrameBg()) then - HighlightSelectedItem(nil, 0xffffffdd, 0, L, T, R, B, h, w, 0, 0, 'GetItemRect') - end - if ClrEdited then - for i, v in pairs(LE.Sel_Items) do FX[FxGUID][v].BgClr = PrmBgClr end - end - - - if FrstSelItm.Type ~= 'Switch' and FrstSelItm.Type ~= 'Selection' then - r.ImGui_Text(ctx, 'Grab Color: ') - r.ImGui_SameLine(ctx) - GrbClrEdited, GrbClr = r.ImGui_ColorEdit4(ctx, '##GrbClr' .. ID, - FrstSelItm.GrbClr or r.ImGui_GetColor(ctx, r.ImGui_Col_SliderGrab()), - r.ImGui_ColorEditFlags_NoInputs()| r - .ImGui_ColorEditFlags_AlphaPreviewHalf()| - reaper.ImGui_ColorEditFlags_AlphaBar()) - if not FX[FxGUID][LE.Sel_Items[1]].GrbClr or FX[FxGUID][LE.Sel_Items[1]].GrbClr == r.ImGui_GetColor(ctx, r.ImGui_Col_SliderGrab()) then - HighlightSelectedItem(nil, 0xffffffdd, 0, L, T, R, B, h, w, 0, 0,'GetItemRect') - end - if GrbClrEdited then - for i, v in pairs(LE.Sel_Items) do - FX[FxGUID][v].GrbClr = - GrbClr - end - end - end - - if FrstSelItm.Type == 'Knob' then - SL() - r.ImGui_Text(ctx, 'Thickness : ') - SL() - r.ImGui_SetNextItemWidth(ctx, 40) - local TD, Thick = r.ImGui_DragDouble(ctx, - '##EditValueFontSize' .. FxGUID .. (LE.Sel_Items[1] or ''), - FX[FxGUID][LE.Sel_Items[1] or ''].Value_Thick or 2, 0.1, 0.5, 8, '%.1f') - if TD then - for i, v in pairs(LE.Sel_Items) do FX[FxGUID][v].Value_Thick = Thick end - end - end - - - if FrstSelItm.Type == 'Selection' then - r.ImGui_SameLine(ctx) - r.ImGui_Text(ctx, 'Text Color: ') - r.ImGui_SameLine(ctx) - local DragLbl_Clr_Edited, V_Clr = r.ImGui_ColorEdit4(ctx, - '##V Clr' .. LE.Sel_Items[1], - FX[FxGUID][LE.Sel_Items[1] or ''].V_Clr or - r.ImGui_GetColor(ctx, r.ImGui_Col_Text()), - r.ImGui_ColorEditFlags_NoInputs()| r - .ImGui_ColorEditFlags_AlphaPreviewHalf()|r.ImGui_ColorEditFlags_AlphaBar()) - if DragLbl_Clr_Edited then - for i, v in pairs(LE.Sel_Items) do FX[FxGUID][v].V_Clr = V_Clr end - end - elseif FrstSelItm.Type == 'Switch' then - SL() - r.ImGui_Text(ctx, 'On Color: ') - r.ImGui_SameLine(ctx) - local DragLbl_Clr_Edited, V_Clr = r.ImGui_ColorEdit4(ctx, - '##Switch on Clr' .. LE.Sel_Items[1], FX[FxGUID][LE.Sel_Items[1] or ''].Switch_On_Clr or - 0xffffff55,r.ImGui_ColorEditFlags_NoInputs()| r.ImGui_ColorEditFlags_AlphaPreviewHalf()|r.ImGui_ColorEditFlags_AlphaBar()) - if DragLbl_Clr_Edited then - for i, v in pairs(LE.Sel_Items) do FX[FxGUID][v].Switch_On_Clr = V_Clr end - end - end - - ----- Condition to show ------ - - local P = LE.Sel_Items[1] - local fp = FX[FxGUID][LE.Sel_Items[1]] - - - - - local function Condition(ConditionPrm, ConditionPrm_PID, ConditionPrm_V, - ConditionPrm_V_Norm, BtnTitle, ShowCondition) - if r.ImGui_Button(ctx, BtnTitle) then - if Mods == 0 then - for i, v in pairs(LE.Sel_Items) do - if not FX[FxGUID][v][ShowCondition] then FX[FxGUID][v][ShowCondition] = true else FX[FxGUID][v][ShowCondition] = nil end - FX[FxGUID][v][ConditionPrm_V] = FX[FxGUID][v][ConditionPrm_V] or {} - end - elseif Mods == Alt then - for i, v in pairs(FX[FxGUID][P][ConditionPrm_V]) do - FX[FxGUID][P][ConditionPrm_V][i] = nil - end - FX[FxGUID][P][ConditionPrm] = nil - FrstSelItm[ShowCondition] = nil - DeleteAllConditionPrmV = nil - end - end - - if r.ImGui_IsItemHovered(ctx) then - HintToolTip( - 'Alt-Click to Delete All Conditions') - end - - - - if FrstSelItm[ShowCondition] or FX[FxGUID][P][ConditionPrm] then - SL() - if not FX[FxGUID][P][ConditionPrm_PID] then - for i, v in ipairs(FX[FxGUID]) do - if FX[FxGUID][i].Num == FrstSelItm[ConditionPrm] then - FrstSelItm[ConditionPrm_PID] =i - end - end - end - local PID = FX[FxGUID][P][ConditionPrm_PID] or 1 - - if r.ImGui_Button(ctx, 'Parameter:##' .. ConditionPrm) then - FX[FxGUID][P].ConditionPrm = LT_ParamNum - local found - for i, v in ipairs(FX[FxGUID]) do - if FX[FxGUID][i].Num == LT_ParamNum then - FrstSelItm[ConditionPrm_PID] =i - found = true - - fp.Sldr_W = nil - end - end - if not found then - - local P = StoreNewParam(LT_FXGUID, LT_ParamName, LT_ParamNum, LT_FXNum,true --[[ , nil, #F+1 ]]) - fp[ConditionPrm_PID] = P - - fp[ConditionPrm] = tonumber( LT_ParamNum) - fp.Sldr_W = nil - - end - - --GetParamOptions ('get', FxGUID,FX_Idx, LE.Sel_Items[1],LT_ParamNum) - end - if r.ImGui_IsItemHovered(ctx) then - tooltip('Click to set to last touched parameter') - end - - - r.ImGui_SameLine(ctx) - r.ImGui_SetNextItemWidth(ctx, 80) - local PrmName, PrmValue - if fp[ConditionPrm] then _, PrmName = r.TrackFX_GetParamName(LT_Track, FX_Idx, fp[ConditionPrm] ) end - - --[[ local Edit, Cond = r.ImGui_InputInt(ctx,'##' .. ConditionPrm .. LE.Sel_Items[1] .. FxGUID, FX[FxGUID][P][ConditionPrm] or 0) - - if FX[FxGUID][P][ConditionPrm] then - _, PrmName = r.TrackFX_GetParamName( - LT_Track, FX_Idx, FX[FxGUID][P][ConditionPrm]) - end - - if Edit then - FX[FxGUID][P][ConditionPrm] = Cond - for i, v in ipairs(FX[FxGUID]) do - if FX[FxGUID][i].Num == FrstSelItm[ConditionPrm] then - FrstSelItm[ConditionPrm_PID] =i - end - end - end ]] - - r.ImGui_SameLine(ctx) - r.ImGui_Text(ctx,(PrmName or '')) - r.ImGui_AlignTextToFramePadding(ctx) - if PrmName then - r.ImGui_Text(ctx, 'is at Value:') - - r.ImGui_SameLine(ctx) - local FP = FX[FxGUID][LE.Sel_Items[1]] - local CP = FX[FxGUID][P][ConditionPrm] - --!!!!!! LE.Sel_Items[1] = Fx_P -1 !!!!!! -- - Value_Selected, V_Formatted = AddCombo(ctx, LT_Track, FX_Idx, - 'ConditionPrm'..FP.ConditionPrm .. (PrmName or '') .. '1## CP', FX[FxGUID][P][ConditionPrm] or 0, - FX[FxGUID][PID].ManualValuesFormat or 'Get Options', -R_ofs, Style, FxGUID,PID, FX[FxGUID][PID].ManualValues, - FX[FxGUID][P][ConditionPrm_V][1] or 'Unassigned', nil, 'No Lbl') - - if Value_Selected then - for i, v in pairs(LE.Sel_Items) do - FX[FxGUID][v][ConditionPrm_V] = FX[FxGUID][v][ConditionPrm_V] or {} - FX[FxGUID][v][ConditionPrm_V_Norm] = FX[FxGUID][v][ConditionPrm_V_Norm] or {} - FX[FxGUID][v][ConditionPrm_V][1] = V_Formatted - FX[FxGUID][v][ConditionPrm_V_Norm][1] = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, fp[ConditionPrm]) - end - end - if not FX[FxGUID][P][ConditionPrm_V][1] then - FX[FxGUID][P][ConditionPrm_V][1] ='' - end - - if FX[FxGUID][P][ConditionPrm_V] then - if FX[FxGUID][P][ConditionPrm_V][2] then - for i, v in pairs(FX[FxGUID][P][ConditionPrm_V]) do - if i > 1 then - r.ImGui_Text(ctx, 'or at value:') - r.ImGui_SameLine(ctx) - local Value_Selected, V_Formatted = AddCombo(ctx, LT_Track, - FX_Idx, 'CondPrmV' .. (PrmName or '') .. v .. - ConditionPrm, FX[FxGUID][P][ConditionPrm] or 0, - FX[FxGUID][PID].ManualValuesFormat or 'Get Options', - -R_ofs, Style, FxGUID, PID, FX[FxGUID][PID].ManualValues, - v, nil, 'No Lbl') - if Value_Selected then - for I, v in pairs(LE.Sel_Items) do - FX[FxGUID][v][ConditionPrm_V][i] = V_Formatted - FX[FxGUID][v][ConditionPrm_V_Norm][i] = r - .TrackFX_GetParamNormalized(LT_Track, FX_Idx, - FX[FxGUID][P][ConditionPrm]) - end - end - end - end - end - end - if r.ImGui_Button(ctx, ' + or at value:##' .. ConditionPrm) then - FX[FxGUID][P][ConditionPrm_V] = FX[FxGUID][P][ConditionPrm_V] or {} - table.insert(FX[FxGUID][P][ConditionPrm_V], '') - end - r.ImGui_SameLine(ctx) - r.ImGui_SetNextItemWidth(ctx, 120) - if r.ImGui_BeginCombo(ctx, '##- delete value ' .. ConditionPrm, '- delete value', r.ImGui_ComboFlags_NoArrowButton()) then - for i, v in pairs(FX[FxGUID][P][ConditionPrm_V]) do - if r.ImGui_Selectable(ctx, v or '##', i) then - table.remove(FX[FxGUID][P][ConditionPrm_V], i) - if not FX[FxGUID][P][ConditionPrm_V][1] then - FX[FxGUID][P][ConditionPrm] = nil - end - end - end - r.ImGui_EndCombo(ctx) - end - end - end - end - - - - if r.ImGui_TreeNode(ctx, 'Conditional Parameter') then - - Condition('ConditionPrm', 'ConditionPrm_PID', 'ConditionPrm_V', - 'ConditionPrm_V_Norm', - 'Show only if:', 'ShowCondition') - if FrstSelItm.ConditionPrm then - Condition('ConditionPrm2', 'ConditionPrm_PID2', - 'ConditionPrm_V2', 'ConditionPrm_V_Norm2', 'And if:', 'ShowCondition2') - end - if FrstSelItm.ConditionPrm2 then - Condition('ConditionPrm3', 'ConditionPrm_PID3', - 'ConditionPrm_V3', 'ConditionPrm_V_Norm3', 'And if:', 'ShowCondition3') - end - if FrstSelItm.ConditionPrm3 then - Condition('ConditionPrm4', 'ConditionPrm_PID4', - 'ConditionPrm_V4', 'ConditionPrm_V_Norm4', 'And if:', 'ShowCondition4') - end - if FrstSelItm.ConditionPrm4 then - Condition('ConditionPrm5', 'ConditionPrm_PID5', - 'ConditionPrm_V5', 'ConditionPrm_V_Norm5', 'And if:', 'ShowCondition5') - end - r.ImGui_TreePop(ctx) - end - - - - - - if r.ImGui_TreeNode(ctx, 'Attach Drawing') then - FrstSelItm.Draw = FrstSelItm.Draw or {} - if RemoveDraw then - table.remove(FrstSelItm.Draw, RemoveDraw) - RemoveDraw = nil - end - - for i = 1, #FrstSelItm.Draw, 1 do - r.ImGui_AlignTextToFramePadding(ctx) - local rv = r.ImGui_TreeNode(ctx, 'Drawing ' .. i) - - SL() - r.ImGui_Text(ctx, ' Type : ') - SL() - r.ImGui_SetNextItemWidth(ctx, 100) - - - local D = FrstSelItm.Draw[i] - local LBL = FxGUID .. LE.Sel_Items[1] .. i - local H = Glob.Height - local W = Win_W - if r.ImGui_BeginCombo(ctx, '## Combo type' .. LBL, D.Type or '', r.ImGui_ComboFlags_NoArrowButton()) then - local function AddOption(str) - if r.ImGui_Selectable(ctx,str ) then - D.Type=str; D.T = str ; - end - end - AddOption('Image') - AddOption('Line') - AddOption('Circle') - AddOption('Circle Filled') - AddOption('Knob Pointer') - AddOption('Knob Range') - AddOption('Knob Circle') - AddOption('Knob Image') - AddOption('Rect') - AddOption('Rect Filled') - - - r.ImGui_EndCombo(ctx) - end - - SL() - if r.ImGui_Button(ctx, 'Delete##' .. i) then - RemoveDraw = i - end - - - - if rv then - - - - - local function AddProp(ShownName, Name, width, sl, defaultV, stepSize, min,max, format) - if ShownName then - r.ImGui_Text(ctx, ShownName) - SL() - end - if width then r.ImGui_SetNextItemWidth(ctx, width) end - local FORMAT =format - if not D[Name] and not defaultV then FORMAT = '' end - - local rv, V = r.ImGui_DragDouble(ctx, '##' .. Name .. LBL, - D[Name] or defaultV , stepSize or LE.GridSize, min or -W, - max or W - 10, FORMAT) - - if rv then D[Name] = V end - if sl then SL() end - return r.ImGui_IsItemActive(ctx) - end - - local BL_Width = {'Knob Pointer', 'Knob Range'} - local BL_Height = {'Knob Pointer', 'Knob Range' , 'Circle', 'Circle Filled','Knob Circle','Knob Image'} - local Thick ={'Knob Pointer', 'Line', 'Rect', 'Circle' } - local Round = {'Rect', 'Rect Filled' } - local Gap = {'Circle', 'Circle Filled','Knob Range'} - local BL_XYGap = {'Knob Pointer', 'Knob Range' , 'Knob Circle', 'Knob Image'} - local RadiusInOut={'Knob Pointer', 'Knob Range'} - local Radius ={'Knob Circle', 'Knob Image'} - local BL_Repeat= {'Knob Range', 'Knob Circle', 'Knob Image', 'Knob Pointer'} - - - - local X_Gap_Shown_Name = 'X Gap:' - - local DefW, DefH - - local WidthLBL, WidthStepSize = 'Width: ', LE.GridSize - - - if D.Type =='Image' or D.Type == 'Knob Image' then - - - - if r.ImGui_BeginChildFrame(ctx, '##drop_files', -R_ofs, 25) then - if D.Image then - if TrashIcon (13, 'Image Delete',ClrBG , ClrTint) then - D.Image, D.FilePath = nil - end - SL() - end - if not D.FilePath then - r.ImGui_Text(ctx, 'Drag and drop files here...') - else - r.ImGui_Text(ctx, D.FilePath) - end - if D.FilePath then - r.ImGui_Bullet(ctx) - r.ImGui_TextWrapped(ctx, D.FilePath) - end - r.ImGui_EndChildFrame(ctx) - end - - if r.ImGui_BeginDragDropTarget(ctx) then - local rv, count = r.ImGui_AcceptDragDropPayloadFiles(ctx) - if rv then - for i = 0, count - 1 do - local rv, filename = r.ImGui_GetDragDropPayloadFile(ctx, i) - - - path,D.FilePath = CopyImageFile(filename, 'Attached Drawings') - - - D.Image = r.ImGui_CreateImage(path) - r.ImGui_Attach(ctx, D.Image) - - - - end - end - r.ImGui_EndDragDropTarget(ctx) - end - - - - end - - local ClrFLG = r.ImGui_ColorEditFlags_NoInputs() + r.ImGui_ColorEditFlags_AlphaPreviewHalf() + r.ImGui_ColorEditFlags_NoLabel() + r.ImGui_ColorEditFlags_AlphaBar() - - r.ImGui_AlignTextToFramePadding( ctx) - - local flags = r.ImGui_TableFlags_SizingStretchSame() | - r.ImGui_TableFlags_Resizable() | - r.ImGui_TableFlags_BordersOuter() | - r.ImGui_TableFlags_BordersV() | - r.ImGui_TableFlags_ContextMenuInBody()| - r.ImGui_TableFlags_RowBg() - - - - if r.ImGui_BeginTable( ctx, 'testtable', 3,flags, -R_ofs) then - - local function SetRowName ( str, notTAB, TAB) - r.ImGui_TableSetColumnIndex(ctx, 0) - if TAB then - if FindExactStringInTable(TAB, D.Type ) then - r.ImGui_Text(ctx, str ) - return true - end - - elseif notTAB then - if not FindExactStringInTable(notTAB, D.Type ) then - r.ImGui_Text(ctx, str ) - return true - end - - else - r.ImGui_Text(ctx, str ) - end - - end - - - --[[ if r.ImGui_IsItemHovered(ctx) then - tooltip('How much the value is affected by parameter"\"s value ') - end ]] - - local function AddVal (Name, defaultV, stepSize, min,max, format, NextRow) - local Column=1 - if Name:find('_VA')then Column =2 end - r.ImGui_TableSetColumnIndex(ctx, Column ) - - r.ImGui_PushItemWidth(ctx, -FLT_MIN) - - local FORMAT =format - if not D[Name] and not defaultV then FORMAT = '' end - - rv, V = r.ImGui_DragDouble(ctx, '##' .. Name .. LBL,D[Name] or defaultV , stepSize or LE.GridSize, min or -W,max or W - 10, FORMAT) - - if rv then D[Name] = V end - - -- if want to show preview use this. - --if r.ImGui_IsItemActive(ctx) then FrstSelItm.ShowPreview = FrstSelItm.Num end - - - - if FrstSelItm.ShowPreview and r.ImGui_IsItemDeactivated(ctx) then FrstSelItm.ShowPreview = nil end - - r.ImGui_PopItemWidth(ctx) - if Name:find('_VA') or NextRow then r.ImGui_TableNextRow(ctx) end - - return r.ImGui_IsItemActive(ctx) - - end - - local function AddRatio(Name ) - r.ImGui_TableSetColumnIndex(ctx, 3 ) - r.ImGui_PushItemWidth(ctx, -FLT_MIN) - local v =(D[Name] or 1)/ (FrstSelItm.Sldr_W or 160) - local rv, V = r.ImGui_DragDouble(ctx, '##' .. Name ..' ratio',v , 0.001 , 0, 100, '%.2f') - r.ImGui_TableNextRow(ctx) - if rv then return rv, V * (FrstSelItm.Sldr_W or 160) end - - end - - r.ImGui_TableSetupColumn( ctx, '##') - r.ImGui_TableSetupColumn( ctx, 'Values') - r.ImGui_TableSetupColumn( ctx, 'Affected Amount') - r.ImGui_TableNextRow(ctx, r.ImGui_TableRowFlags_Headers()) - - - - - - r.ImGui_TableHeadersRow(ctx) - - local Sz = FrstSelItm.Sldr_W or 160 - - r.ImGui_TableNextRow( ctx) - - local WidthLBL, WidthStepSize = 'Width: ', LE.GridSize - if D.Type =='Circle' or D.Type == 'Cicle Filled' then WidthLBL = 'Size' ; WidthStepSize=1 end - - - - - SetRowName ( 'X offset') AddVal('X_Offset', 0, LE.GridSize, min, max, nil) AddVal('X_Offset_VA') - SetRowName ( 'Y offset') AddVal('Y_Offset', 0, LE.GridSize, -220, 220, nil) AddVal('Y_Offset_VA') - if SetRowName ( WidthLBL , BL_Width) then AddVal('Width', nil, WidthStepSize, min, max, nil) AddVal('Width_VA', 0, 0.01, -1,1) end --[[ local rv, R = AddRatio('Width' ) if rv then D.Width = R end ]] - if SetRowName ( 'Height', BL_Height) then AddVal('Height', 0, LE.GridSize, -220, 220, nil) AddVal ('Height_VA', 0, 0.01, -1,1) end - if SetRowName ( 'Repeat', BL_Repeat) then AddVal('Repeat', 0, 1 , 0 , 300 , '%.0f') AddVal('Repeat_VA', 0, 0.01, -1,1) end - - if SetRowName('Gap', nil,Gap) then AddVal('Gap', 0, 0.2 , 0 , 300 , '%.1f') AddVal('Gap_VA', 0, 0.01, -1,1) end - if SetRowName('X Gap', BL_XYGap) then AddVal('X_Gap', 0, 0.2 , 0 , 300 , '%.1f') AddVal('X_Gap_VA', 0, 0.01, -1,1) end - if SetRowName('Y Gap', BL_XYGap) then AddVal('Y_Gap', 0, 0.2 , 0 , 300 , '%.1f') AddVal('Y_Gap_VA', 0, 0.01, -1,1) end - if SetRowName('Angle Min', nil, BL_XYGap) then AddVal('Angle_Min', 0.75, 0.01, 0, 3.14, '%.3f',true) end - if SetRowName('Angle Max', nil, BL_XYGap) then AddVal('Angle_Max', 2.25, 0.01, 0, 3.14, '%.3f',true) end - if SetRowName('Radius Inner', nil, RadiusInOut) then AddVal('Rad_In', 0, 0.1, 0, 300, '%.3f',true) end - if SetRowName('Radius Outer', nil, RadiusInOut) then AddVal('Rad_Out', 30, 0.1, 0, 300, '%.3f',true) end - if SetRowName('Radius',nil, Radius) then AddVal('Rad_In', 0, 0.1, 0, 300, '%.3f',true) end - - if SetRowName('Thickness', nil, Thick) then AddVal('Thick', 2, 0.5, 0,60, '%.1f',true) end - if SetRowName('Edge Round', nil, Round) then AddVal('Round', 0, 0.1, 0, 100, '%.1f',true) end - SetRowName('Color') - r.ImGui_TableSetColumnIndex(ctx, 1) - - local rv, Clr = r.ImGui_ColorEdit4(ctx, 'Color' .. LBL, D.Clr or 0xffffffff, ClrFLG) - if rv then D.Clr = Clr end - - r.ImGui_TableSetColumnIndex(ctx, 2) - local rv, Clr_VA = r.ImGui_ColorEdit4(ctx, 'Color_VA' .. LBL, D.Clr_VA or 0xffffffff, ClrFLG) - if rv then D.Clr_VA = Clr_VA end - - - r.ImGui_TableNextRow(ctx) - - if D.Repeat and D.Repeat ~= 0 then - SetRowName('Last Repeat\'s Color') - r.ImGui_TableSetColumnIndex(ctx, 1) - - local rv, Clr = r.ImGui_ColorEdit4(ctx, 'Repeat Color' .. LBL, D.RPT_Clr or 0xffffffff,ClrFLG) - if rv then D.RPT_Clr = Clr end - r.ImGui_TableNextRow(ctx) - end - - - r.ImGui_EndTable(ctx) - end - - - r.ImGui_TreePop(ctx) - end - end - - - - - if r.ImGui_Button(ctx, 'attach a new drawing') then - table.insert(FrstSelItm.Draw, {}) - end - - - r.ImGui_TreePop(ctx) - end - - r.ImGui_PopStyleColor(ctx) - end -------------------- End of Repeat for every selected item - if LE.SelectedItem == 'Title' then - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_FrameBgActive(), 0x66666688) - - r.ImGui_Text(ctx, 'Edge Round:') - r.ImGui_SameLine(ctx) - Edited, FX.Round[FxGUID] = r.ImGui_DragDouble(ctx, '##' .. FxGUID .. 'Round', - FX.Round[FxGUID], 0.01, 0, 40, '%.2f') - - r.ImGui_Text(ctx, 'Grab Round:') - r.ImGui_SameLine(ctx) - Edited, FX.GrbRound[FxGUID] = r.ImGui_DragDouble(ctx, '##' .. FxGUID .. 'GrbRound', - FX.GrbRound[FxGUID], 0.01, 0, 40, '%.2f') - - r.ImGui_Text(ctx, 'Background Color:') - r.ImGui_SameLine(ctx) - _, FX.BgClr[FxGUID] = r.ImGui_ColorEdit4(ctx, '##' .. FxGUID .. 'BgClr', - FX.BgClr[FxGUID] or FX_Devices_Bg or 0x151515ff, - r.ImGui_ColorEditFlags_NoInputs()| r.ImGui_ColorEditFlags_AlphaPreviewHalf()| - r.ImGui_ColorEditFlags_AlphaBar()) - if FX.BgClr[FxGUID] == r.ImGui_GetColor(ctx, r.ImGui_Col_FrameBg()) then - HighlightSelectedItem(nil, 0xffffffdd, 0, L, T, R, B, h, w, 1, 1, 'GetItemRect') - end - - r.ImGui_Text(ctx, 'FX Title Color:') - r.ImGui_SameLine(ctx) - _, FX[FxGUID].TitleClr = r.ImGui_ColorEdit4(ctx, '##' .. FxGUID .. 'Title Clr', - FX[FxGUID].TitleClr or 0x22222233, - r.ImGui_ColorEditFlags_NoInputs()| r.ImGui_ColorEditFlags_AlphaPreviewHalf()| - r.ImGui_ColorEditFlags_AlphaBar()) - - r.ImGui_Text(ctx, 'Custom Title:') - r.ImGui_SameLine(ctx) - local _, CustomTitle = r.ImGui_InputText(ctx, '##CustomTitle' .. FxGUID, - FX[FxGUID].CustomTitle or FX_Name) - if r.ImGui_IsItemDeactivatedAfterEdit(ctx) then - FX[FxGUID].CustomTitle = CustomTitle - end - - r.ImGui_PopStyleColor(ctx) - end - - - - - - - - - if r.ImGui_BeginPopupModal(ctx, 'Save Editing?') then - SaveEditingPopupModal = true - r.ImGui_Text(ctx, 'Would you like to save the editings?') - if r.ImGui_Button(ctx, '(n) No') or r.ImGui_IsKeyPressed(ctx, 78) then - RetrieveFXsSavedLayout(Sel_Track_FX_Count) - r.ImGui_CloseCurrentPopup(ctx) - FX.LayEdit = nil - LE.SelectedItem = nil - CloseLayEdit = true - end - r.ImGui_SameLine(ctx) - - if r.ImGui_Button(ctx, '(y) Yes') or r.ImGui_IsKeyPressed(ctx, 89) then - SaveLayoutEditings(FX_Name, ID, FXGUID[FX_Idx]) - r.ImGui_CloseCurrentPopup(ctx) - FX.LayEdit = nil - LE.SelectedItem = nil - CloseLayEdit = true - end - r.ImGui_SameLine(ctx) - - if r.ImGui_Button(ctx, '(c) Cancel') or r.ImGui_IsKeyPressed(ctx, 67) or r.ImGui_IsKeyPressed(ctx, 27) then - r.ImGui_CloseCurrentPopup(ctx) - end - - - - r.ImGui_EndPopup(ctx) - end - - - local PalletteW = 25 - local Pad = 10 - if not CloseLayEdit then - w, h = r.ImGui_GetWindowSize(ctx) - r.ImGui_SetCursorPos(ctx, w - PalletteW - Pad, PalletteW + Pad) - end - - - - - for Pal = 1, NumOfColumns or 1, 1 do - if not CloseLayEdit and r.ImGui_BeginChildFrame(ctx, 'Color Palette' .. Pal, PalletteW, h - PalletteW - Pad * 2, r.ImGui_WindowFlags_NoScrollbar()) then - local NumOfPaletteClr = 9 - - for i, v in ipairs(FX[FxGUID]) do - local function CheckClr(Clr) - if Clr and not r.ImGui_IsPopupOpen(ctx, '', r.ImGui_PopupFlags_AnyPopupId()) then - if not tablefind(ClrPallet, Clr) and ClrPallet then - local R, G, B, A = r.ImGui_ColorConvertU32ToDouble4(Clr) - if A ~= 0 then - table.insert(ClrPallet, Clr) - end - end - end - end - CheckClr(v.Lbl_Clr) - CheckClr(v.V_Clr) - CheckClr(v.BgClr) - CheckClr(v.GrbClr) - end - - if FX.Win_Name_S[FX_Idx] then - if Draw[FX.Win_Name_S[FX_Idx]] then - for i, v in ipairs(Draw[FX.Win_Name_S[FX_Idx]].clr) do - local Clr = v - if Clr and not r.ImGui_IsPopupOpen(ctx, '', r.ImGui_PopupFlags_AnyPopupId()) then - if not tablefind(ClrPallet, Clr) and ClrPallet then - table.insert(ClrPallet, Clr) - end - end - end - end - end - - for i, v in ipairs(ClrPallet) do - clrpick, LblColor1 = r.ImGui_ColorEdit4(ctx, '##ClrPalette' .. Pal .. - i .. FxGUID, v, - r.ImGui_ColorEditFlags_NoInputs()| - r.ImGui_ColorEditFlags_AlphaPreviewHalf()| - r.ImGui_ColorEditFlags_AlphaBar()) - if r.ImGui_IsItemClicked(ctx) and Mods == Alt then - table.remove(ClrPallet, tablefind(v)) - end - end - - - --[[ for i=1, NumOfPaletteClr , 1 do - PaletteClr= 'PaletteClr'..Pal..i..FxGUID - local DefaultClr = r.ImGui_ColorConvertHSVtoRGB((i-0.5)*(NumOfColumns or 1) / 7.0, 0.5, 0.5, 1) - clrpick, _G[PaletteClr] = r.ImGui_ColorEdit4( ctx, '##ClrPalette'..Pal..i..FxGUID, _G[PaletteClr] or DefaultClr , r.ImGui_ColorEditFlags_NoInputs()| r.ImGui_ColorEditFlags_AlphaPreviewHalf()|r.ImGui_ColorEditFlags_AlphaBar()) - if r.ImGui_IsItemDeactivatedAfterEdit(ctx) and i==NumOfPaletteClr then NumOfColumns=(NumOfColumns or 1 ) +1 end - if r.ImGui_BeginDragDropTarget( ctx) then HighlightSelectedItem(0x00000000 ,0xffffffff, 0, L,T,R,B,h,w, 1, 1,'GetItemRect', 'Foreground') end - end ]] - r.ImGui_EndChildFrame(ctx) - end - if NumOfColumns or 1 > 1 then - for i = 1, NumOfColumns, 1 do r.ImGui_SameLine(ctx, nil, 0) end - end - end - - - - - - if r.ImGui_BeginPopupModal(ctx, 'Save Draw Editing?') then - r.ImGui_Text(ctx, 'Would you like to save the Drawings?') - if r.ImGui_Button(ctx, '(n) No') then - local FxNameS = FX.Win_Name_S[FX_Idx] - local HowManyToDelete - for i, Type in pairs(Draw[FxNameS].Type) do - HowManyToDelete = i - end - - for Del = 1, HowManyToDelete, 1 do - local D = Draw[FxNameS] - table.remove(D.Type, i) - table.remove(D.L, i) - table.remove(D.R, i) - table.remove(D.T, i) - table.remove(D.B, i) - if D.Txt[i] then table.remove(D.Txt, i) end - if D.clr[i] then table.remove(D.clr, i) end - end - RetrieveFXsSavedLayout(Sel_Track_FX_Count) - r.ImGui_CloseCurrentPopup(ctx) - Draw.DrawMode[FxGUID] = nil - end - r.ImGui_SameLine(ctx) - - if r.ImGui_Button(ctx, '(y) Yes') then - SaveDrawings(FX_Idx, FxGUID) - r.ImGui_CloseCurrentPopup(ctx) - Draw.DrawMode[FxGUID] = nil - end - r.ImGui_EndPopup(ctx) - end - - - - if r.ImGui_IsKeyPressed(ctx, 65) and (Mods == Apl or Mods == Alt) then - for Fx_P = 1, #FX[FxGUID] or 0, 1 do table.insert(LE.Sel_Items, Fx_P) end - end - - - r.ImGui_End(ctx) - if CloseLayEdit then - FX.LayEdit = nil - Draw.DrawMode[FxGUID] = nil - end - end - - - - - - r.ImGui_SameLine(ctx, nil, 0) - --r.ImGui_PushStyleVar( ctx,r.ImGui_StyleVar_WindowPadding(), 0,0) - --r.ImGui_PushStyleColor(ctx, r.ImGui_Col_DragDropTarget(), 0x00000000) - - - - --if ctrl+A or Command+A is pressed - - - --r.ImGui_EndTooltip(ctx) - - -- r.ImGui_PopStyleVar(ctx) - --r.ImGui_PopStyleColor(ctx,2 ) - PopClr(ctx, 2) - end - - if AdjustDrawRectPos and IsLBtnHeld then - local DtX, DtY = r.ImGui_GetMouseDelta(ctx) - Mx, My = r.ImGui_GetMousePos(ctx) - FDL = r.ImGui_GetForegroundDrawList(ctx) - - r.ImGui_DrawList_AddRectFilled(FDL, Draw.Rect.L, Draw.Rect.T, Draw.Rect.R, Draw.Rect.B, - 0xbbbbbb66) - else - AdjustDrawRectPos = nil - end - - if Draw.Rect.L then - r.ImGui_DrawList_AddRectFilled(FDL, Draw.Rect.L, Draw.Rect.T, Draw.Rect.R, - Draw.Rect.B, 0xbbbbbb66, Draw.Df_EdgeRound[FxGUID] or 0) - end - elseif --[[FX Layer Window ]] string.find(FX_Name, 'FXD %(Mix%)RackMixer') or string.find(FX_Name, 'FXRack') then --!!!! FX Layer Window - if not FX[FxGUID].Collapse then - FXGUID_RackMixer = r.TrackFX_GetFXGUID(LT_Track, FX_Idx) - r.TrackFX_Show(LT_Track, FX_Idx, 2) - - r.ImGui_SameLine(ctx, nil, 0) - --Gives the index of the specific MixRack - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_FrameBg(), - FX_Layer_Container_BG or BGColor_FXLayeringWindow) - FXLayeringWin_X = 240; local Pad = 3 - if r.ImGui_BeginChildFrame(ctx, '##FX Layer at' .. FX_Idx .. 'OnTrack ' .. TrkID, FXLayeringWin_X + Pad, 220, r.ImGui_WindowFlags_NoScrollbar()) then - local WDL = r.ImGui_GetWindowDrawList(ctx) - FXLayerFrame_PosX_L, FXLayerFrame_PosY_T = r.ImGui_GetItemRectMin(ctx) - FXLayerFrame_PosX_R, FXLayerFrame_PosY_B = r.ImGui_GetItemRectMax(ctx); FXLayerFrame_PosY_B = - FXLayerFrame_PosY_B + 220 - - local clrhdrhvr = r.ImGui_GetColor(ctx, r.ImGui_Col_ButtonHovered()) - local clrhdrAct = r.ImGui_GetColor(ctx, r.ImGui_Col_ButtonActive()) - - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_HeaderHovered(), clrhdrhvr) - local clrhdr = r.ImGui_GetColor(ctx, r.ImGui_Col_Button()) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_TableHeaderBg(), clrhdr) - - r.ImGui_PushStyleVar(ctx, reaper.ImGui_StyleVar_FramePadding(), 0, 0) - - - r.ImGui_BeginTable(ctx, '##FX Layer' .. FX_Idx, 1) - r.ImGui_TableHeadersRow(ctx) - - - if r.ImGui_BeginDragDropSource(ctx, r.ImGui_DragDropFlags_AcceptNoDrawDefaultRect()) then - DragFX_ID = FX_Idx - r.ImGui_SetDragDropPayload(ctx, 'FX Layer Repositioning', FX_Idx) - r.ImGui_EndDragDropSource(ctx) - DragDroppingFX = true - if IsAnyMouseDown == false then DragDroppingFX = false end - end - if r.ImGui_IsItemClicked(ctx, 0) and Mods == Alt then - FX[FxGUID].DeleteFXLayer = true - elseif r.ImGui_IsItemClicked(ctx, 1) then - FX[FxGUID].Collapse = true - FX[FxGUID].CollapseWidth = 27 - elseif r.ImGui_IsItemClicked(ctx) and Mods == Shift then - local Spltr, FX_Inst - if FX[FxGUID].LyrDisable == nil then FX[FxGUID].LyrDisable = false end - FX[FxGUID].AldreadyBPdFXs = FX[FxGUID].AldreadyBPdFXs or {} - - - - - - for i = 0, Sel_Track_FX_Count, 1 do - if FX.InLyr[FXGUID[i]] == FXGUID[FX_Idx] then - if not FX[FxGUID].LyrDisable then - if r.TrackFX_GetEnabled(LT_Track, i) == false then - if FX[FxGUID].AldreadyBPdFXs == {} then - table.insert(FX[FxGUID].AldreadyBPdFXs, - r.TrackFX_GetFXGUID(LT_Track, i)) - elseif not FindStringInTable(FX[FxGUID].AldreadyBPdFXs, r.TrackFX_GetFXGUID(LT_Track, i)) then - table.insert(FX[FxGUID].AldreadyBPdFXs, - r.TrackFX_GetFXGUID(LT_Track, i)) - end - else - end - r.TrackFX_SetEnabled(LT_Track, i, false) - else - r.TrackFX_SetEnabled(LT_Track, i, true) - end - - for ii, v in pairs(FX[FxGUID].AldreadyBPdFXs) do - if v == FXGUID[i] then r.TrackFX_SetEnabled(LT_Track, i, false) end - end - end - end - - - if not FX[FxGUID].LyrDisable then - r.TrackFX_SetEnabled(LT_Track, FX_Idx, false) - else - r.TrackFX_SetEnabled(LT_Track, FX_Idx, true) - FX[FxGUID].AldreadyBPdFXs = {} - end - - if FX[FxGUID].LyrDisable then FX[FxGUID].LyrDisable = false else FX[FxGUID].LyrDisable = true end - end - - - if not FXLayerRenaming then - if LBtnClickCount == 2 and r.ImGui_IsItemActivated(ctx) then - FX[FxGUID].RenameFXLayering = true - elseif r.ImGui_IsItemClicked(ctx, 1) and Mods == Alt then - BlinkFX = ToggleCollapseAll() - end - end - - - r.ImGui_SameLine(ctx) - r.ImGui_AlignTextToFramePadding(ctx) - if not FX[FxGUID].RenameFXLayering then - r.ImGui_SetNextItemWidth(ctx, 10) - local TitleShort - if string.len(FX[FxGUID].ContainerTitle or '') > 27 then - TitleShort = string.sub(FX[FxGUID].ContainerTitle, 1, 27) - end - r.ImGui_Text(ctx, TitleShort or FX[FxGUID].ContainerTitle or 'FX Layering') - else -- If Renaming - local Flag - r.ImGui_SetNextItemWidth(ctx, 180) - if FX[FxGUID].ContainerTitle == 'FX Layering' then - Flag = r - .ImGui_InputTextFlags_AutoSelectAll() - end - _, FX[FxGUID].ContainerTitle = r.ImGui_InputText(ctx, '##' .. FxGUID, - FX[FxGUID].ContainerTitle or 'FX Layering', Flag) - - r.ImGui_SetItemDefaultFocus(ctx) - r.ImGui_SetKeyboardFocusHere(ctx, -1) - - if r.ImGui_IsItemDeactivated(ctx) then - FX[FxGUID].RenameFXLayering = nil - r.SetProjExtState(0, 'FX Devices - ', 'FX' .. FxGUID .. - 'FX Layer Container Title ', FX[FxGUID].ContainerTitle) - end - end - - --r.ImGui_PushStyleColor(ctx,r.ImGui_Col_Button(), 0xffffff10) - - r.ImGui_SameLine(ctx, FXLayeringWin_X - 25, 0) - r.ImGui_AlignTextToFramePadding(ctx) - if not FX[FxGUID].SumMode then - FX[FxGUID].SumMode = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, 40) - end - local Lbl - if FX[FxGUID].SumMode == 0 then Lbl = 'Avg' else Lbl = 'Sum' end - if r.ImGui_Button(ctx, (Lbl or '') .. '##FX Lyr Mode' .. FxGUID, 30, r.ImGui_GetTextLineHeight(ctx)) then - FX[FxGUID].SumMode = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, 40) - - if FX[FxGUID].SumMode == 0 then - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, 40, 1) - FX[FxGUID].SumMode = 1 - else - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, 40, 0) - FX[FxGUID].SumMode = 0 - end - end - - --r.ImGui_PopStyleColor(ctx) - r.ImGui_PopStyleVar(ctx) - - r.ImGui_EndTable(ctx) - r.ImGui_PopStyleColor(ctx, 2) --Header Clr - r.ImGui_PushStyleVar(ctx, r.ImGui_StyleVar_FrameRounding(), 0) - --r.ImGui_PushStyleColor(ctx,r.ImGui_Col_FrameBgActive(), 0x99999999) - local StyleVarPop = 1 - local StyleClrPop = 1 - - - local FxGUID = r.TrackFX_GetFXGUID(LT_Track, FX_Idx) - - - - local MaxChars - - if FX[FxGUID].ActiveLyrCount <= 4 then - LineH = 4; Spacing = 0; Inner_Spacing = 2; BtnSizeManual = 34; MaxChars = 15 - elseif FX[FxGUID].ActiveLyrCount == 5 then - LineH, Spacing, Inner_Spacing = 3, -5, 0; BtnSizeManual = 30; MaxChars = 18 - elseif FX[FxGUID].ActiveLyrCount == 6 then - LineH, Spacing, Inner_Spacing = 5.5, -5, -8; BtnSizeManual = 24; MaxChars = 20 - elseif FX[FxGUID].ActiveLyrCount >= 7 then - LineH, Spacing, Inner_Spacing = 3, -5, -8; BtnSizeManual = 19; MaxChars = 23 - end - - - - r.ImGui_PushStyleVar(ctx, r.ImGui_StyleVar_ItemSpacing(), 1, Spacing) - r.ImGui_PushStyleVar(ctx, r.ImGui_StyleVar_FramePadding(), 4, LineH) - - local BtnSize, AnySoloChan - for LayerNum, LyrID in pairs(FX[FxGUID].LyrID) do - if Lyr.Solo[LyrID .. FxGUID] == 1 then - FX[FxGUID].AnySoloChan = true - AnySoloChan = true - end - end - if not AnySoloChan then FX[FxGUID].AnySoloChan = nil end - - - for LayerNum, LyrID in pairs(FX[FxGUID].LyrID) do - if Lyr.Solo[LyrID .. FxGUID] == nil then - Lyr.Solo[LyrID .. FxGUID] = reaper - .TrackFX_GetParamNormalized(LT_Track, FX_Idx, 4 + (5 * (LyrID - 1))) - end - if Lyr.Solo[LyrID .. FxGUID] == 1 then FX[FxGUID].AnySoloChan = true end - if Lyr.Mute[LyrID .. FxGUID] == nil then - Lyr.Mute[LyrID .. FxGUID] = reaper - .TrackFX_GetParamNormalized(LT_Track, FX_Idx, 5 * (LyrID - 1)) - end - if Lyr.Mute[LyrID .. FxGUID] == 1 then FX[FxGUID].AnyMuteChan = true end - - if Lyr.ProgBarVal[LyrID .. FxGUID] == nil then - Layer1Vol = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, 1) - Lyr.ProgBarVal[LyrID .. FxGUID] = Layer1Vol - end - - LyrFX_Inst = math.max(LyrFX_Inst or 0, LyrID) - local HowManyFXinLyr = 0 - for i = 0, Sel_Track_FX_Count, 1 do - if FX.InLyr[FXGUID[i]] == FXGUID_RackMixer and FX[FXGUID[i]].inWhichLyr == LyrID then - HowManyFXinLyr = HowManyFXinLyr + 1 - end - end - - - local Fx_P = (LyrID * 2) - 1 - - local CurY = r.ImGui_GetCursorPosY(ctx) - if FX[FxGUID][Fx_P] then - LyrCurX, LyrCurY = r.ImGui_GetCursorScreenPos(ctx) - - if Lyr.Rename[LyrID .. FxGUID] ~= true and Fx_P then - --r.ImGui_ProgressBar(ctx, Lyr.ProgBarVal[LyrID..FxGUID], FXLayeringWin_X-60, 30, '##Layer'.. LyrID) - local P_Num = 1 + (5 * (LyrID - 1)) - local ID = LyrID - FX[FxGUID].LyrTitle = FX[FxGUID].LyrTitle or {} - - local labeltoShow = FX[FxGUID].LyrTitle[ID] or LyrID - - if string.len(labeltoShow or '') > MaxChars then - labeltoShow = string.sub(FX[FxGUID].LyrTitle[ID], 1, MaxChars) - end - local Fx_P = LyrID * 2 - 1 - local Label = '##' .. LyrID .. FxGUID - FX[FxGUID][Fx_P] = FX[FxGUID][Fx_P] or {} - FX[FxGUID][Fx_P].V = FX[FxGUID][Fx_P].V or 0.5 - local p_value = FX[FxGUID][Fx_P].V or 0 - --[[ r.ImGui_PushStyleVar(ctx, r.ImGui_StyleVar_FramePadding(), 0, BtnSizeManual/3) ]] - --[[ r.ImGui_PushStyleColor(ctx, r.ImGui_Col_FrameBg(), getClr(r.ImGui_Col_Button())) ]] - SliderStyle = nil; Rounding = 0 - local CurY = r.ImGui_GetCursorPosY(ctx) - AddDrag(ctx, Label, labeltoShow, p_value, 0, 1, Fx_P, FX_Idx, P_Num, - 'FX Layering', FXLayeringWin_X - BtnSizeManual * 3 - 23, Inner_Spacing, - Disable, Lbl_Clickable, 'Bottom', 'Bottom', DragDir, 'NoInput') - --[[ r.ImGui_PopStyleColor(ctx) r.ImGui_PopStyleVar(ctx) ]] - - local L, T = r.ImGui_GetItemRectMin(ctx); B = T + BtnSizeManual - BtnSize = B - T - r.ImGui_SameLine(ctx, nil, 10) - r.ImGui_SetCursorPosY(ctx, CurY) - - if Lyr.Selected[FXGUID_RackMixer] == LyrID then - local R = L + FXLayeringWin_X - r.ImGui_DrawList_AddLine(WDL, L, T - 2, R - 2 + Pad, T - 2, 0x99999999) - r.ImGui_DrawList_AddLine(WDL, L, B, R - 2 + Pad, B, 0x99999999) - r.ImGui_DrawList_AddRectFilled(WDL, L, T - 2, R + Pad, B, 0xffffff09) - FX[FxGUID].TheresFXinLyr = nil - for FX_Idx = 1, Sel_Track_FX_Count - 1, 1 do - if FX[FXGUID[FX_Idx]] then - if FX[FXGUID[FX_Idx]].inWhichLyr == LyrID and FX.InLyr[FXGUID[FX_Idx]] == FXGUID_RackMixer then - r.ImGui_DrawList_AddLine(WDL, R - 2 + Pad, T, R - 2 + Pad, - FXLayerFrame_PosY_T, 0x99999999) - r.ImGui_DrawList_AddLine(WDL, R - 2 + Pad, B, R - 2 + Pad, - FXLayerFrame_PosY_B, 0x99999999) - FX[FxGUID].TheresFXinLyr = true - end - end - end - if not FX[FxGUID].TheresFXinLyr then - r.ImGui_DrawList_AddLine(WDL, R, T, R, B, 0x99999999) - else - end - end - - if r.ImGui_IsItemClicked(ctx) and Mods == Alt then - local TheresFXinLyr - for FX_Idx = 1, Sel_Track_FX_Count - 1, 1 do - if FX[FXGUID[FX_Idx]].inWhichLyr == FX[FXGUID_RackMixer].LyrID[LyrID] and FX.InLyr[FXGUID[FX_Idx]] == FXGUID_RackMixer then - TheresFXinLyr = true - end - end - - FX_Idx_RackMixer = FX_Idx - function DeleteOneLayer(LyrID, FxGUID, FX_Idx, LT_Track) - FX[FxGUID].LyrID[LyrID] = -1 - FX[FxGUID].LyrTitle[LyrID] = nil - FX[FxGUID].ActiveLyrCount = math.max(FX[FxGUID].ActiveLyrCount - 1, 1) - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, 5 * (LyrID - 1), 0) -- turn channel power off - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, - 1 + (5 * (LyrID - 1) + 1), - 0.5) -- set pan to center - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, 1 + (5 * (LyrID - 1)), - 0.5) -- set Vol to 0 - r.SetProjExtState(0, 'FX Devices', 'FX' .. FxGUID .. - 'Layer ID ' .. LyrID, '-1') - r.SetProjExtState(0, 'FX Devices - ', - 'FX' .. FxGUID .. 'Layer Title ' .. LyrID, '') - end - - if not TheresFXinLyr then - DeleteOneLayer(LyrID, FxGUID, FX_Idx, LT_Track) - else - local Modalw, Modalh = 225, 70 - r.ImGui_SetNextWindowPos(ctx, VP.x + VP.w / 2 - Modalw / 2, - VP.y + VP.h / 2 - Modalh / 2) - r.ImGui_SetNextWindowSize(ctx, Modalw, Modalh) - r.ImGui_OpenPopup(ctx, 'Delete FX Layer ' .. LyrID .. '? ##' .. - FxGUID) - end - elseif r.ImGui_IsItemClicked(ctx) and LBtnDC then - FX[FxGUID][Fx_P].V = 0.5 - local rv = r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, P_Num, 0.5) - elseif r.ImGui_IsItemClicked(ctx) and Mods == Ctrl and not FXLayerRenaming then - Lyr.Rename[LyrID .. FxGUID] = true - elseif r.ImGui_IsItemClicked(ctx) and Mods == 0 then - Lyr.Selected[FXGUID_RackMixer] = LyrID - end - elseif Lyr.Rename[LyrID .. FxGUID] == true then - for i = 1, 8, 1 do -- set all other layer's rename to false - if LyrID ~= i then Lyr.Rename[i .. FxGUID] = false end - end - FXLayerRenaming = true - reaper.ImGui_SetKeyboardFocusHere(ctx) - r.ImGui_SetNextItemWidth(ctx, FXLayeringWin_X - BtnSizeManual * 3 - 23) - local ID = FX[FxGUID].LyrID[LyrID] - FX[FxGUID].LyrTitle = FX[FxGUID].LyrTitle or {} - _, FX[FxGUID].LyrTitle[ID] = r.ImGui_InputText(ctx, '##' .. LyrID, - FX[FxGUID].LyrTitle[ID]) - - if r.ImGui_IsItemDeactivatedAfterEdit(ctx) then - Lyr.Rename[LyrID .. FxGUID] = false - FXLayerRenaming = nil - r.SetProjExtState(0, 'FX Devices - ', 'FX' .. - FxGUID .. 'Layer Title ' .. LyrID, FX[FxGUID].LyrTitle[ID]) - elseif r.ImGui_IsItemDeactivated(ctx) then - Lyr.Rename[LyrID .. FxGUID] = false - FXLayerRenaming = nil - end - SL(nil, 10) - end - - ------------ Confirm delete layer --------------------- - if r.ImGui_BeginPopupModal(ctx, 'Delete FX Layer ' .. LyrID .. '? ##' .. FxGUID, true, r.ImGui_WindowFlags_NoTitleBar()|r.ImGui_WindowFlags_NoResize()) then - r.ImGui_Text(ctx, 'Delete all FXs in layer ' .. LyrID .. '?') - r.ImGui_Text(ctx, ' ') - - if r.ImGui_Button(ctx, '(n) No (or Esc)') or r.ImGui_IsKeyPressed(ctx, 78) or r.ImGui_IsKeyPressed(ctx, 27) then - r.ImGui_CloseCurrentPopup(ctx) - end - r.ImGui_SameLine(ctx, nil, 20) - if r.ImGui_Button(ctx, '(y) Yes') or r.ImGui_IsKeyPressed(ctx, 89) then - r.Undo_BeginBlock() - local L, H, HowMany = 999, 0, 0 - - for FX_Idx = 0, Sel_Track_FX_Count - 1, 1 do - if FX[FXGUID[FX_Idx]].inWhichLyr == FX[FXGUID_RackMixer].LyrID[LyrID] and FX.InLyr[FXGUID[FX_Idx]] == FXGUID_RackMixer then - HowMany = HowMany + 1 - L = math.min(FX_Idx, L) - H = math.max(FX_Idx, H) - end - end - - for i = 1, HowMany, 1 do - if FX[FXGUID[L]].inWhichLyr == FX[FXGUID_RackMixer].LyrID[LyrID] and FX.InLyr[FXGUID[L]] == FXGUID_RackMixer then - r.TrackFX_Delete(LT_Track, L) - end - end - DeleteOneLayer(LyrID, FXGUID_RackMixer, FX_Idx_RackMixer, LT_Track) - - diff = H - L + 1 - r.Undo_EndBlock('Delete Layer ' .. LyrID, 0) - end - r.ImGui_EndPopup(ctx) - end - - - - - ProgBar_Pos_L, ProgBar_PosY_T = r.ImGui_GetItemRectMin(ctx) - ProgBar_Pos_R, ProgBar_PosY_B = r.ImGui_GetItemRectMax(ctx) - - - - - - if Lyr.Selected[FXGUID_RackMixer] == LyrID and Lyr.Rename[LyrID .. FxGUID] ~= true then - r.ImGui_DrawList_AddRect(drawlist, ProgBar_Pos_L, ProgBar_PosY_T, - FXLayerFrame_PosX_R, ProgBar_PosY_B, 0xffffffff) - end - - drawlistInFXLayering = r.ImGui_GetForegroundDrawList(ctx) - - - if r.ImGui_BeginDragDropTarget(ctx) then - dropped, payload = r.ImGui_AcceptDragDropPayload(ctx, 'FX_Drag') -- - - if dropped and Mods == 0 then - DropFXtoLayer(FX_Idx, LayerNum) - elseif dropped and Mods == Apl then - DragFX_Src = DragFX_ID - if DragFX_ID > FX_Idx then - DragFX_Dest = FX_Idx - 1 - else - DragFX_Dest = - FX_Idx - end - DropToLyrID = LyrID - DroptoRack = FXGUID_RackMixer - end - if Payload_Type == 'AddFX_Sexan' then - dropped, payload = r.ImGui_AcceptDragDropPayload(ctx, 'AddFX_Sexan') -- - if dropped then - r.TrackFX_AddByName(LT_Track, payload, false, -1000 - FX_Idx) - - DropFXtoLayer(FX_Idx, LyrID) - end - end - - HighlightSelectedItem(0x88888844, 0xffffffff, 0, L, T, R, B, h, w, H_OutlineSc, V_OutlineSc, 'GetItemRect') - r.ImGui_EndDragDropTarget(ctx) - end - - local Label = '##Pan' .. LyrID .. FxGUID - - local P_Num = 1 + (5 * (LyrID - 1) + 1) - local Fx_P_Knob = LyrID * 2 - local Label = '## Pan' .. LyrID .. FxGUID - local p_value_Knob = FX[FxGUID][Fx_P_Knob].V - local labeltoShow = HowManyFXinLyr - - - - AddKnob(ctx, Label, labeltoShow, p_value_Knob, 0, 1, Fx_P_Knob, FX_Idx, P_Num, - 'FX Layering', BtnSizeManual / 2, 0, Disabled, 9, 'Within', 'None') - r.ImGui_SameLine(ctx, nil, 10) - - if LBtnDC and reaper.ImGui_IsItemClicked(ctx, 0) then - FX[FxGUID][Fx_P_Knob].V = 0.5 - local rv = r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, P_Num, 0.5) - end - - r.ImGui_SetCursorPosY(ctx, CurY) - - if Lyr.Solo[LyrID .. FxGUID] == 1 then - local Clr = Layer_Solo or CustomColorsDefault.Layer_Solo - local Act, Hvr = Generate_Active_And_Hvr_CLRs(Clr) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_Button(), Clr) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_ButtonActive(), Act) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_ButtonHovered(), Hvr) - - SoloBtnClrPop = 3 - end - - ClickOnSolo = r.ImGui_Button(ctx, 'S##' .. LyrID, BtnSizeManual, BtnSizeManual) -- == lyr solo - - if Lyr.Solo[LyrID .. FxGUID] == 1 then r.ImGui_PopStyleColor(ctx, SoloBtnClrPop) end - - - if ClickOnSolo then - Lyr.Solo[LyrID .. FxGUID] = reaper.TrackFX_GetParamNormalized(LT_Track, - FX_Idx, 4 + (5 * (LyrID - 1))) - if Lyr.Solo[LyrID .. FxGUID] == 1 then - Lyr.Solo[LyrID .. FxGUID] = 0 - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, 4 + (5 * (LyrID - 1)), - Lyr.Solo[LyrID .. FxGUID]) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_Button(), 0x9ed9d3ff) - r.ImGui_PopStyleColor(ctx) - elseif Lyr.Solo[LyrID .. FxGUID] == 0 then - Lyr.Solo[LyrID .. FxGUID] = 1 - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, 4 + (5 * (LyrID - 1)), - Lyr.Solo[LyrID .. FxGUID]) - end - end - if Lyr.Solo[LyrID .. FxGUID] == nil then - Lyr.Solo[LyrID .. FxGUID] = reaper - .TrackFX_GetParamNormalized(LT_Track, FX_Idx, 4 + (5 * (LyrID - 1))) - end - - r.ImGui_SameLine(ctx, nil, 3) - r.ImGui_SetCursorPosY(ctx, CurY) - if Lyr.Mute[LyrID .. FxGUID] == 0 then - local Clr = Layer_Mute or CustomColorsDefault.Layer_Mute - local Act, Hvr = Generate_Active_And_Hvr_CLRs(Clr) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_Button(), Clr) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_ButtonActive(), Act) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_ButtonHovered(), Hvr) - LyrMuteClrPop = 3 - end - ClickOnMute = r.ImGui_Button(ctx, 'M##' .. LyrID, BtnSizeManual, BtnSizeManual) - if Lyr.Mute[LyrID .. FxGUID] == 0 then r.ImGui_PopStyleColor(ctx, LyrMuteClrPop) end - - - - if Lyr.Mute[LyrID .. FxGUID] == nil then - Lyr.Mute[LyrID .. FxGUID] = reaper - .TrackFX_GetParamNormalized(LT_Track, FX_Idx, 5 * (LyrID - 1)) - end - - if ClickOnMute then - Lyr.Mute[LyrID .. FxGUID] = reaper.TrackFX_GetParamNormalized(LT_Track, - FX_Idx, 5 * (LyrID - 1)) - if Lyr.Mute[LyrID .. FxGUID] == 1 then - Lyr.Mute[LyrID .. FxGUID] = 0 - reaper.TrackFX_SetParamNormalized(LT_Track, FX_Idx, 5 * (LyrID - 1), - Lyr.Mute[LyrID .. FxGUID]) - elseif Lyr.Mute[LyrID .. FxGUID] == 0 then - Lyr.Mute[LyrID .. FxGUID] = 1 - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, 5 * (LyrID - 1), - Lyr.Mute[LyrID .. FxGUID]) - end - end - - - - - MuteBtnR, MuteBtnB = r.ImGui_GetItemRectMax(ctx) - - if FX[FxGUID].AnySoloChan then - if Lyr.Solo[LyrID .. FxGUID] ~= 1 then - r.ImGui_DrawList_AddRectFilled(WDL, LyrCurX, LyrCurY, MuteBtnR, MuteBtnB, - 0x00000088) - end - end - if Lyr.Mute[LyrID .. FxGUID] == 0 then - r.ImGui_DrawList_AddRectFilled(WDL, LyrCurX, LyrCurY, MuteBtnR, MuteBtnB, - 0x00000088) - end - end - end - - - - - if FX[FxGUID].ActiveLyrCount ~= 8 then - AddNewLayer = r.ImGui_Button(ctx, '+', FXLayeringWin_X, 25) - if AddNewLayer then - local FxGUID = r.TrackFX_GetFXGUID(LT_Track, FX_Idx) - - if FX[FxGUID].ActiveLyrCount <= 8 then - local EmptyChan, chan1, chan2, chan3; local lastnum = 0 - for i, v in ipairs(FX[FxGUID].LyrID) do - if not EmptyChan then - if v == -1 then EmptyChan = i end - end - end - - if not EmptyChan then EmptyChan = FX[FxGUID].ActiveLyrCount + 1 end - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, 5 * (EmptyChan - 1), 1) - FX[FxGUID].ActiveLyrCount = math.min(FX[FxGUID].ActiveLyrCount + 1, 8) - FX[FxGUID][EmptyChan * 2 - 1].V = 0.5 -- init val for Vol - FX[FxGUID][EmptyChan * 2].V = 0.5 -- init val for Pan - - FX[FxGUID].LyrID[EmptyChan] = EmptyChan - - r.SetProjExtState(0, 'FX Devices', 'FX' .. FxGUID .. 'Layer ID ' .. EmptyChan, - EmptyChan) - end - end - end - r.ImGui_PopStyleVar(ctx, StyleVarPop) - r.ImGui_PopStyleVar(ctx, 2) - - r.ImGui_EndChildFrame(ctx) - end - r.ImGui_PopStyleColor(ctx, StyleClrPop) - else -- if collapsed - if r.ImGui_BeginChildFrame(ctx, '##FX Layer at' .. FX_Idx .. 'OnTrack ' .. TrkID, 27, 220, r.ImGui_WindowFlags_NoScrollbar()) then - L, T = r.ImGui_GetItemRectMin(ctx) - local DL = r.ImGui_GetWindowDrawList(ctx) - local title = (FX[FxGUID].ContainerTitle or 'FX Layering'):gsub("(.)", "%1\n") - - WindowBtnVertical = reaper.ImGui_Button(ctx, title .. '##Vertical', 25, 220) -- create window name button - if WindowBtnVertical and Mods == 0 then - elseif WindowBtnVertical == true and Mods == Shift then - ToggleBypassFX() - elseif r.ImGui_IsItemClicked(ctx) and Mods == Alt then - FX[FxGUID].DeleteFXLayer = true - elseif r.ImGui_IsItemClicked(ctx, 1) and Mods == 0 then - FX[FxGUID].Collapse = nil - elseif r.ImGui_IsItemClicked(ctx, 1) and Mods == Alt then - BlinkFX = ToggleCollapseAll() - end - - if r.ImGui_BeginDragDropSource(ctx, r.ImGui_DragDropFlags_None()) then - DragFX_ID = FX_Idx - r.ImGui_SetDragDropPayload(ctx, 'FX Layer Repositioning', FX_Idx) - r.ImGui_EndDragDropSource(ctx) - DragDroppingFX = true - if IsAnyMouseDown == false then DragDroppingFX = false end - end - - r.ImGui_DrawList_AddRectFilled(WDL, L, T + 2, L + 25, T, 0x999999aa) - r.ImGui_DrawList_AddRectFilled(WDL, L, T + 4, L + 25, T + 6, 0x999999aa) - r.ImGui_DrawList_AddRect(WDL, L, T + 2, L + 25, T + 218, 0x99999977) - - - r.ImGui_EndChildFrame(ctx) - end - end - - FX[FxGUID].DontShowTilNextFullLoop = true - - if not FX[FxGUID].Collapse then --Create FX windows inside rack - local Sel_LyrID - drawlist = r.ImGui_GetBackgroundDrawList(ctx) - - - Lyr.FrstFXPos[FXGUID_RackMixer] = nil - local HowManyFXinLyr = 0 - for FX_Idx_InLayer = 0, Sel_Track_FX_Count - 1, 1 do - local FXisInLyr - - for LayerNum, LyrID in pairs(FX[FxGUID].LyrID) do - FXGUID_To_Check_If_InLayer = r.TrackFX_GetFXGUID(LT_Track, FX_Idx_InLayer) - - if FX.InLyr[FXGUID_To_Check_If_InLayer] == FXGUID[FX_Idx] then --if fx is in rack mixer - if FindStringInTable(BlackListFXs, FX.Win_Name[FX_Idx_InLayer]) then end - - if Lyr.Selected[FXGUID_RackMixer] == nil then Lyr.Selected[FXGUID_RackMixer] = 1 end - local FXGUID_LayerCheck = r.TrackFX_GetFXGUID(LT_Track, FX_Idx_InLayer) - if FX[FXGUID[FX_Idx_InLayer]].inWhichLyr == FX[FXGUID_RackMixer].LyrID[LyrID] and LyrID == Lyr.Selected[FXGUID_RackMixer] and not FindStringInTable(BlackListFXs, FX.Win_Name[FX_Idx_InLayer]) then - r.ImGui_SameLine(ctx, nil, 0) - - AddSpaceBtwnFXs(FX_Idx_InLayer, false, nil, LyrID) - Xpos_Left, Ypos_Top = reaper.ImGui_GetItemRectMin(ctx) - r.ImGui_SameLine(ctx, nil, 0) - if not FindStringInTable(BlackListFXs, FX.Win_Name[FX_Idx_InLayer]) then - createFXWindow(FX_Idx_InLayer) - else - end - Sel_LyrID = LyrID - - Xpos_Right, Ypos_Btm = r.ImGui_GetItemRectMax(ctx) - - r.ImGui_DrawList_AddLine(ViewPort_DL, Xpos_Left, Ypos_Top, Xpos_Right, - Ypos_Top, Clr.Dvdr.outline) - r.ImGui_DrawList_AddLine(ViewPort_DL, Xpos_Left, Ypos_Btm, Xpos_Right, - Ypos_Btm, Clr.Dvdr.outline) - end - FXisInLyr = true - end - end - if FXisInLyr == true then HowManyFXinLyr = HowManyFXinLyr + 1 end - - if FX.InLyr[FXGUID_To_Check_If_InLayer] == FXGUID[FX_Idx] then - if Lyr.FrstFXPos[FXGUID_RackMixer] == nil then - Lyr.FrstFXPos[FXGUID_RackMixer] = FX_Idx_InLayer - else - Lyr.FrstFXPos[FXGUID_RackMixer] = math.min(Lyr.FrstFXPos[FXGUID_RackMixer], - FX_Idx_InLayer) - end - Lyr.LastFXPos[FXGUID_RackMixer] = FX_Idx_InLayer - end - - r.ImGui_SameLine(ctx, nil, 0) - end - - - Lyr[FXGUID_RackMixer] = Lyr[FXGUID_RackMixer] or {} - Lyr[FXGUID_RackMixer].HowManyFX = HowManyFXinLyr - - - - if HowManyFXinLyr > 0 and FX[FxGUID].TheresFXinLyr then -- == Add and theres fx in selected layer - --if there's fx in the rack - - AddLastSPCinRack = true - - AddSpaceBtwnFXs(FX_Idx, nil, nil, Sel_LyrID) - AddLastSPCinRack = false - Xpos_Right, Ypos_Btm = reaper.ImGui_GetItemRectMax(ctx) - Xpos_Left, Ypos_Top = reaper.ImGui_GetItemRectMin(ctx) - - - local TheresFXinLyr - for FX_Idx = 1, Sel_Track_FX_Count - 1, 1 do - if FX[FXGUID[FX_Idx]] then - if FX[FXGUID[FX_Idx]].inWhichLyr == FX[FXGUID_RackMixer].LyrID[Lyr.Selected[FXGUID_RackMixer]] and FX.InLyr[FXGUID[FX_Idx]] == FXGUID_RackMixer then - TheresFXinLyr = true - end - end - end - - - if TheresFXinLyr then --== lines to enclose fx layering - r.ImGui_DrawList_AddLine(ViewPort_DL, Xpos_Left, Ypos_Top, Xpos_Right, Ypos_Top, - Clr.Dvdr.outline) - r.ImGui_DrawList_AddLine(ViewPort_DL, Xpos_Left, Ypos_Btm, Xpos_Right, Ypos_Btm, - Clr.Dvdr.outline) - r.ImGui_DrawList_AddLine(ViewPort_DL, Xpos_Right, Ypos_Top, Xpos_Right, Ypos_Btm, - Clr.Dvdr.outline, 14) - end - end - end - - - - - - - - if FX[FxGUID].DeleteFXLayer then - local FXinRack = 0 - --count number of fxs in layer - for FX_Idx_InLayer = 0, Sel_Track_FX_Count - 1, 1 do - for LayerNum, LyrID in pairs(FX[FxGUID].LyrID) do - local GUID = r.TrackFX_GetFXGUID(LT_Track, FX_Idx_InLayer) - if FX.InLyr[GUID] == FXGUID[FX_Idx] then - FXinRack = FXinRack + 1 - end - end - end - - if FXinRack == 0 then -- if no fx just delete - r.TrackFX_Delete(LT_Track, FX_Idx - 1) - r.TrackFX_Delete(LT_Track, FX_Idx - 1) - FX[FxGUID].DeleteFXLayer = nil - else -- else prompt user - local Modalw, Modalh = 270, 55 - r.ImGui_SetNextWindowPos(ctx, VP.x + VP.w / 2 - Modalw / 2, VP.y + VP.h / 2 - Modalh / 2) - r.ImGui_SetNextWindowSize(ctx, Modalw, Modalh) - r.ImGui_OpenPopup(ctx, 'Delete FX Layer? ##' .. FxGUID) - end - end - - if r.ImGui_BeginPopupModal(ctx, 'Delete FX Layer? ##' .. FxGUID, nil, r.ImGui_WindowFlags_NoTitleBar()|r.ImGui_WindowFlags_NoResize()) then - r.ImGui_Text(ctx, 'Delete the FXs in layers altogether?') - if r.ImGui_Button(ctx, '(n) No') or r.ImGui_IsKeyPressed(ctx, 78) then - for i = 0, Sel_Track_FX_Count, 1 do - if FX.InLyr[FXGUID[i]] == FXGUID[FX_Idx] then - --sets input channel - r.TrackFX_SetPinMappings(LT_Track, i, 0, 0, 1, 0) - r.TrackFX_SetPinMappings(LT_Track, i, 0, 1, 2, 0) - --sets Output - r.TrackFX_SetPinMappings(LT_Track, i, 1, 0, 1, 0) - r.TrackFX_SetPinMappings(LT_Track, i, 1, 1, 2, 0) - FX.InLyr[FXGUID[i]] = nil - r.SetProjExtState(0, 'FX Devices', - 'FXLayer - ' .. 'is FX' .. FXGUID[i] .. 'in layer', "") - end - end - - for i = 0, Sel_Track_FX_Count, 1 do - if FXGUID[FX_Idx] == Lyr.SplitrAttachTo[FXGUID[i]] then - r.TrackFX_Delete(LT_Track, FX_Idx) - r.TrackFX_Delete(LT_Track, i) - end - end - - FX[FxGUID].DeleteFXLayer = nil - end - r.ImGui_SameLine(ctx) - - if r.ImGui_Button(ctx, '(y) Yes') or r.ImGui_IsKeyPressed(ctx, 89) then - local Spltr, FX_Inst - for i = 0, Sel_Track_FX_Count, 1 do - if FXGUID[FX_Idx] == Lyr.SplitrAttachTo[FXGUID[i]] then - Spltr = i - end - end - r.Undo_BeginBlock() - - for i = 0, Sel_Track_FX_Count, 1 do - if FX.InLyr[FXGUID[i]] == FXGUID[FX_Idx] then - FX_Inst = (FX_Inst or 0) + 1 - r.SetProjExtState(0, 'FX Devices', - 'FXLayer - ' .. 'is FX' .. FXGUID[i] .. 'in layer', "") - end - end - - for i = 0, FX_Inst, 1 do - r.TrackFX_Delete(LT_Track, Spltr) - end - - - - FX[FxGUID].DeleteFXLayer = nil - r.Undo_EndBlock('Delete Layer Container', 0) - end - r.ImGui_SameLine(ctx) - - if r.ImGui_Button(ctx, '(c) Cancel (or Esc)') or r.ImGui_IsKeyPressed(ctx, 67) or r.ImGui_IsKeyPressed(ctx, 27) then - FX[FxGUID].DeleteFXLayer = nil - r.ImGui_CloseCurrentPopup(ctx) - end - r.ImGui_SameLine(ctx) - - r.ImGui_EndPopup(ctx) - end - - r.ImGui_SameLine(ctx, nil, 0) - FX[FXGUID[FX_Idx]].DontShowTilNextFullLoop = true - elseif FX_Name:find('FXD ReSpectrum') then - local _, FX_Name_After = r.TrackFX_GetFXName(LT_Track, FX_Idx + 1) - --if FX below is not Pro-Q 3 - if string.find(FX_Name_After, 'Pro%-Q 3') == nil then - ProQ3.SpectrumDeleteWait = (ProQ3.SpectrumDeleteWait or 0) + 1 - if ProQ3.SpectrumDeleteWait > FX_Add_Del_WaitTime then - if FX_Idx == Sel_Track_FX_Count then - r.TrackFX_Delete(LT_Track, FX_Idx) - else - r.TrackFX_Delete(LT_Track, FX_Idx) - end - ProQ3.SpectrumDeleteWait = 0 - end - else - if FX.InLyr[FXGUID[FX_Idx + 1]] then -- if in layering - SyncAnalyzerPinWithFX(FX_Idx, FX_Idx + 1, FX.Win_Name[math.max(FX_Idx - 1, 0)]) - FX.InLyr[FxGUID] = FX.InLyr[FXGUID[FX_Idx + 1]] - else - FX.InLyr[FxGUID] = nil - end - end - elseif FX_Name:find('FXD Split to 4 channels') then - local _, FX_Name_After = r.TrackFX_GetFXName(LT_Track, FX_Idx + 1) - --if FX below is not Pro-C 2 - if FX_Name_After then - if string.find(FX_Name_After, 'Pro%-C 2') then - if FX.InLyr[FXGUID[FX_Idx + 1]] then -- if in layering - SyncAnalyzerPinWithFX(FX_Idx, FX_Idx + 1, FX_Name) - end - end - end - elseif FX_Name:find('FXD Gain Reduction Scope') then - r.gmem_attach('CompReductionScope') - if FX[FXGUID[FX_Idx - 1]] then - r.gmem_write(FX[FXGUID[FX_Idx - 1]].ProC_ID or 0, FX_Idx - 1) - end - local _, FX_Name_Before = r.TrackFX_GetFXName(LT_Track, FX_Idx - 1) - - - --if FX above is not Pro-C 2 - FX[FxGUID].ProC_Scope_Del_Wait = (FX[FxGUID].ProC_Scope_Del_Wait or 0) + 1 - - if FX[FxGUID].ProC_Scope_Del_Wait > FX_Add_Del_WaitTime + 10 then - if string.find(FX_Name_Before, 'Pro%-C 2') then - if FX.InLyr[FXGUID[FX_Idx - 1]] then -- if in layering - SyncAnalyzerPinWithFX(FX_Idx, FX_Idx - 1, FX_Name) - end - end - FX[FxGUID].ProC_Scope_Del_Wait = 0 - end - - if FX.InLyr[FXGUID[FX_Idx - 1]] then - FX.InLyr[FxGUID] = FX.InLyr[FXGUID[FX_Idx - 1]] - else - FX.InLyr[FxGUID] = nil - end - elseif string.find(FX_Name, 'FXD Split to 32 Channels') ~= nil then - r.TrackFX_Show(LT_Track, FX_Idx, 2) - AddSpaceBtwnFXs(FX_Idx, true) - Spltr[FxGUID] = Spltr[FxGUID] or {} - Lyr[Lyr.SplitrAttachTo[FxGUID]] = Lyr[Lyr.SplitrAttachTo[FxGUID]] or {} - if Lyr[Lyr.SplitrAttachTo[FxGUID]].HowManyFX == 0 then - if FXGUID[FX_Idx + 1] ~= Lyr.SplitrAttachTo[FxGUID] then - for i = 0, Sel_Track_FX_Count - 1, 1 do - if FXGUID[i] == Lyr.SplitrAttachTo[FxGUID] then - r.TrackFX_CopyToTrack(LT_Track, FX_Idx, LT_Track, i - 1, true) - end - end - end - end - - if Spltr[FxGUID].New == true then - for i = 0, 16, 2 do - r.TrackFX_SetPinMappings(LT_Track, FX_Idx, 0, i, 1, 0) - end - - for i = 1, 16, 2 do - r.TrackFX_SetPinMappings(LT_Track, FX_Idx, 0, i, 2, 0) - end - - local FxGUID_Rack = Lyr.SplitrAttachTo[FxGUID] - for i = 1, 8, 1 do - local P_Num = 1 + (5 * (i - 1)) - local Fx_P = i * 2 - 1 - local P_Name = 'Chan ' .. i .. ' Vol' - StoreNewParam(FxGUID_Rack, P_Name, P_Num, FX_Idx, IsDeletable, 'AddingFromExtState', Fx_P, - FX_Idx) -- Vol - local P_Num = 1 + (5 * (i - 1) + 1) - local Fx_P_Pan = i * 2 - local P_Name = 'Chan ' .. i .. ' Pan' - StoreNewParam(FxGUID_Rack, P_Name, P_Num, FX_Idx, IsDeletable, 'AddingFromExtState', - Fx_P_Pan, FX_Idx) -- Pan - end - Spltr[FxGUID].New = false - end - - if FX.InLyr[FXGUID[FX_Idx + 1] or ''] then - FX.InLyr[FxGUID] = FX.InLyr[FXGUID[FX_Idx + 1]] - else - FX.InLyr[FxGUID] = nil - end - - pin = r.TrackFX_GetPinMappings(LT_Track, FX_Idx, 0, 0) - elseif FX_Name:find('FXD Saike BandSplitter') then - local Width, BtnWidth = 65, 25 - local WinL, WinT, H, WinR - local WDL = WDL or r.ImGui_GetWindowDrawList(ctx) - - if BandSplitID and not FX[FxGUID].BandSplitID then - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: BandSplitterID' .. FxGUID, BandSplitID, true) - FX[FxGUID].BandSplitID = BandSplitID - BandSplitID = nil - end - FX[FxGUID].FXsInBS = FX[FxGUID].FXsInBS or {} - local JoinerID - for i, v in ipairs(FXGUID) do - if FX[FxGUID].AttachToJoiner == v then JoinerID = i end - end - local BsID = FX[FxGUID].BandSplitID - if FX[FxGUID].Collapse then Width = 35 end - - - if r.ImGui_BeginChild(ctx, 'FXD Saike BandSplitter' .. FxGUID, Width, 220) then - local SpcW = AddSpaceBtwnFXs(FX_Idx, 'SpaceBeforeBS', nil, nil, 1, FxGUID) - SL(nil, 0) - - local btnTitle = string.gsub('Band Split', "(.)", "%1\n") - local btn = r.ImGui_Button(ctx, btnTitle .. '##Vertical', BtnWidth, 220) -- create window name button Band Split button - - - if btn and Mods == 0 then - openFXwindow(LT_Track, FX_Idx) - elseif btn and Mods == Shift then - ToggleBypassFX(LT_Track, FX_Idx) - elseif btn and Mods == Alt then - FX[FxGUID].DeleteBandSplitter = true - elseif r.ImGui_IsItemClicked(ctx, 1) and Mods == 0 then - FX[FxGUID].Collapse = toggle(FX[FxGUID].Collapse) - elseif r.ImGui_IsItemClicked(ctx, 1) and Mods == Alt then -- check if all are collapsed - local All_Collapsed - for i = 0, Sel_Track_FX_Count - 1, 1 do - if not FX[FXGUID[i]].Collapse then All_Collapsed = false end - end - if All_Collapsed == false then - for i = 0, Sel_Track_FX_Count - 1, 1 do - FX[FXGUID[i]].Collapse = true - end - else -- if all is collapsed - for i = 0, Sel_Track_FX_Count - 1, 1 do - FX[FXGUID[i]].Collapse = false - FX.WidthCollapse[FXGUID[i]] = nil - end - BlinkFX = FX_Idx - end - elseif r.ImGui_IsItemActive(ctx) then - DraggingFX_L_Pos = r.ImGui_GetCursorScreenPos(ctx) + 10 - if r.ImGui_BeginDragDropSource(ctx, r.ImGui_DragDropFlags_AcceptNoDrawDefaultRect()) then - --DragFX_ID = FX_Idx - r.ImGui_SetDragDropPayload(ctx, 'BS_Drag', FX_Idx) - r.ImGui_EndDragDropSource(ctx) - - DragDroppingFX = true - if IsAnyMouseDown == false then DragDroppingFX = false end - end - - --HighlightSelectedItem(0xffffff22, 0xffffffff, -1, L,T,R,B,h,w, H_OutlineSc, V_OutlineSc,'GetItemRect',WDL ) - end - SL(nil, 0) - r.gmem_attach('FXD_BandSplit') - - - - - --r.gmem_write(1,0) --[[1 is MouseR Click Position]] - --r.gmem_write(2,0)--[[tells if user R-Click BETWEEN a band]] - --r.gmem_write(3,0)--[[tells if user R-Click ON a band]] - - - local function f_trafo(freq) - return math.exp((1 - freq) * math.log(20 / 22050)) - end - FX[FxGUID].Cross = FX[FxGUID].Cross or {} - local Cuts = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, 0) - FX[FxGUID].Cross.Cuts = Cuts - WinL, WinT = r.ImGui_GetCursorScreenPos(ctx) - H, WinR = 220, WinL + Width - BtnWidth - SpcW - - - if FX[FxGUID].Collapse then - local L, T = WinL - BtnWidth, WinT - r.ImGui_DrawList_AddRectFilled(WDL, L, T + 2, L + 25, T, 0x999999aa) - r.ImGui_DrawList_AddRectFilled(WDL, L, T + 4, L + 25, T + 6, 0x999999aa) - r.ImGui_DrawList_AddRect(WDL, L, T + 2, L + 25, T + 218, 0x99999977) - else - for i = 1, Cuts * 4, 1 do ----------[Repeat for Bands]---------- - local TxtClr = getClr(r.ImGui_Col_Text()) - FX[FxGUID].Cross[i] = FX[FxGUID].Cross[i] or {} - local X = FX[FxGUID].Cross[i] - -- r.gmem_attach('FXD_BandSplit') - local WDL = r.ImGui_GetWindowDrawList(ctx) - local BsID = BsID or 0 - - X.Val = r.gmem_read(BsID + i) - X.NxtVal = r.gmem_read(BsID + i + 1) - X.Pos = SetMinMax(WinT + H - H * X.Val, WinT, WinT + H) - - - --FX[FxGUID].Cross[i].Val = r.TrackFX_GetParamNormalized(LT_Track,FX_Idx, i) - - local Cross_Pos = SetMinMax(WinT + H - H * X.Val, WinT, WinT + H) - local NxtCrossPos = SetMinMax(WinT + H - H * X.NxtVal, WinT, WinT + H) - - - if --[[Hovering over a band]] r.ImGui_IsMouseHoveringRect(ctx, WinL, Cross_Pos - 3, WinR, Cross_Pos + 3) then - FX[FxGUID].Cross.HoveringBand = i - FX[FxGUID].Cross.HoveringBandPos = Cross_Pos - - if IsLBtnClicked then - table.insert(Sel_Cross, i) - Sel_Cross.FxID = FxGUID - elseif IsRBtnClicked then - --[[ if Cuts * 4 == i then -- if deleting the top band - r.TrackFX_SetParamNormalized(LT_Track,FX_Idx, 0, math.max(Cuts-0.25,0)) --simply delete top band only, leave others untouched. - else ]] - --delete band - local Rpt = Cuts * 4 - i - local Bd = i + 1 - if FX[FxGUID].Sel_Band == i then FX[FxGUID].Sel_Band = nil end - - local NxtBd_V = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, Bd) - local _, Name = r.TrackFX_GetParamName(LT_Track, FX_Idx, Bd) - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, 0, math.max(Cuts - 0.25, 0)) -- Delete Band - for T = 1, Rpt, 1 do - local NxtBd_V = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, i + T) - - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, i - 1 + T, NxtBd_V) --adjust band Freq - end - for I, v in ipairs(FX[FxGUID].FXsInBS) do - if FX[v].InWhichBand >= i then - FX[v].InWhichBand = FX[v].InWhichBand - 1 - - local Fx = tablefind(FXGUID, v) - --sets input channel - r.TrackFX_SetPinMappings(LT_Track, Fx, 0, 0, - 2 ^ ((FX[v].InWhichBand + 1) * 2 - 2), 0) - r.TrackFX_SetPinMappings(LT_Track, Fx, 0, 1, - 2 ^ ((FX[v].InWhichBand + 1) * 2 - 1), 0) - --sets Output +1 - r.TrackFX_SetPinMappings(LT_Track, Fx, 1, 0, - 2 ^ ((FX[v].InWhichBand + 1) * 2 - 2), 0) - r.TrackFX_SetPinMappings(LT_Track, Fx, 1, 1, - 2 ^ ((FX[v].InWhichBand + 1) * 2 - 1), 0) - r.GetSetMediaTrackInfo_String(LT_Track, - 'P_EXT: FX is in which Band' .. v, FX[v].InWhichBand, true) - end - end - end - --[[ if not IsLBtnHeld then - r.ImGui_SetNextWindowPos(ctx,WinR, FX[FxGUID].Cross[i].Pos -14) - r.ImGui_BeginTooltip(ctx) - r.ImGui_Text(ctx, roundUp(r.gmem_read(BsID+4+i),1)..' Hz') - r.ImGui_EndTooltip(ctx) - end ]] - end - - BD1 = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, 1) - BD2 = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, 2) - BD3 = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, 3) - BD4 = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, 4) - --ttp('BD1='..BD1..'\nBD2='..BD2..'\nBD3='..BD3..'\nBD4='..BD4) - if --[[Mouse is between bands]] r.ImGui_IsMouseHoveringRect(ctx, WinL, X.Pos, WinR, NxtCrossPos) then - if Payload_Type == 'FX_Drag' then - - end - end - - - - if r.ImGui_IsMouseHoveringRect(ctx, WinL, WinT, WinR, WinT + H) and IsRBtnClicked then - - end - - if Sel_Cross[1] == i and Sel_Cross.FxID == FxGUID then - if IsLBtnHeld then - FX[FxGUID].Cross.DraggingBand = i - local PrmV = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, i) - DragDeltaX, DragDeltaY = r.ImGui_GetMouseDragDelta(ctx) - if DragDeltaY > 0 or DragDeltaY < 0 then - local B = Sel_Cross.TweakingBand - if #Sel_Cross > 1 then - if DragDeltaY > 0 then -- if drag upward - B = math.min(Sel_Cross[1], Sel_Cross[2]) - table.remove(Sel_Cross, - tablefind(Sel_Cross, math.max(Sel_Cross[1], Sel_Cross[2]))) - else - B = math.max(Sel_Cross[1], Sel_Cross[2]) - table.remove(Sel_Cross, - tablefind(Sel_Cross, math.min(Sel_Cross[1], Sel_Cross[2]))) - end - else - B = Sel_Cross[1] - end - local LowestV = 0.02 - --r.gmem_write(100, B) - --r.gmem_write(101, -DragDeltaY*10) - --if B==1 and B==i then -- if B ==1 - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, B, - PrmV - DragDeltaY / 250 --[[Val of moving Freq]]) - - for i = 1, 4 - B, 1 do - if PrmV - DragDeltaY / 250 > r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, B + i) then - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, B + i, - PrmV - DragDeltaY / 250 --[[Val of moving Freq]]) - end - end - - --local PrmV_New= r.TrackFX_GetParamNormalized(LT_Track,FX_Idx, i) - --[[ local NextF = r.gmem_read(111+B) - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, B+1, SetMinMax( (NextF - PrmV_New) /(1-PrmV_New) ,LowestV,1) ) ]] - - --elseif B <4 and B >1 and B==i then --if B == 2~4 - - --end - - --[[ if B <4 and B >0 and B==i then - local PrmV_New= r.TrackFX_GetParamNormalized(LT_Track,FX_Idx, i) - --local PrmV_NextB= r.TrackFX_GetParamNormalized(LT_Track,FX_Idx, i+1) - local ThisF = r.gmem_read(110+B) - - - - - local NextF = r.gmem_read(111+B) - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, B+1, SetMinMax( (NextF - PrmV_New) /(1-PrmV_New) ,LowestV,1) ) - end ]] - --r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, MovingBand+2, r.gmem_read(112)--[[Val of moving Freq + 1]] ) - - - --r.TrackFX_SetParamNormalized(LT_Track,FX_Idx, i, math.max(PrmV-DragDeltaY/250,0.02)) - r.ImGui_ResetMouseDragDelta(ctx) - --r.gmem_write(101,0) - end - if Sel_Cross[1] == i then - r.ImGui_SetNextWindowPos(ctx, WinR, FX[FxGUID].Cross[i].Pos - 14) - r.ImGui_BeginTooltip(ctx) - r.ImGui_Text(ctx, roundUp(r.gmem_read(BsID + 4 + i), 1) .. ' Hz') - r.ImGui_EndTooltip(ctx) - --r.ImGui_DrawList_AddText(Glob.FDL, WinL, Cross_Pos, getClr(r.ImGui_Col_Text()) , roundUp(r.gmem_read(10+i),1)..' Hz') - end - else - Sel_Cross = {} --r.gmem_write(100, 0) - end - else - end - - - --[[ -- Draw Bands - r.ImGui_DrawList_AddLine(WDL, WinL, X.Pos , WinR, X.Pos, TxtClr ) - r.ImGui_DrawList_AddText(WDL, WinL, X.Pos, TxtClr , roundUp(r.gmem_read(BsID+4+i),1)) ]] - end - - - function DropFXintoBS(FxID, FxGUID_BS, Band, Pl, DropDest, DontMove) --Pl is payload --!!!! Correct drop dest!!!! - FX[FxID] = FX[FxID] or {} - - if FX.InLyr[FxID] then --- move fx out of Layer - FX.InLyr[FXGUID[DragFX_ID]] = nil - r.SetProjExtState(0, 'FX Devices', - 'FXLayer - ' .. 'is FX' .. FXGUID[DragFX_ID] .. 'in layer', '') - end - - - - if FX[FxID].InWhichBand then - table.remove(FX[FxGUID_BS].FXsInBS, tablefind(FX[FxGUID_BS].FXsInBS, FxID)) - end - - - - if TABinsertPos then - table.insert(FX[FxGUID_BS].FXsInBS, TABinsertPos, FxID) - else - table.insert(FX[FxGUID_BS].FXsInBS, FxID) - end - - FX[FxID].InWhichBand = Band - - if not DontMove then - local DropDest = DropDest - table.insert(MovFX.FromPos, Pl) - if Pl > FX_Idx and not DropDest then DropDest = FX_Idx + 1 end - - - if Pl < DropDest then - DropDest = DropDest - 1 - end - - - - table.insert(MovFX.ToPos, DropDest or FX_Idx) - - table.insert(MovFX.Lbl, 'Move FX into Band ' .. Band) - end - - - - local function Set_In_Out(FX, Band, ChanL, ChanR) - r.TrackFX_SetPinMappings(LT_Track, FX, 0, ChanL or 0, 2 ^ ((Band + 1) * 2 - 2), 0) -- inputs - r.TrackFX_SetPinMappings(LT_Track, FX, 0, ChanR or 1, 2 ^ ((Band + 1) * 2 - 1), 0) - - r.TrackFX_SetPinMappings(LT_Track, FX, 1, ChanL or 0, 2 ^ ((Band + 1) * 2 - 2), 0) --outputs - r.TrackFX_SetPinMappings(LT_Track, FX, 1, ChanR or 1, 2 ^ ((Band + 1) * 2 - 1), 0) - end - - Set_In_Out(Pl, Band) - - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: FX is in which BS' .. FxID, FxGUID_BS, - true) - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: FX is in which Band' .. FxID, Band, - true) - - - - --- account for fxs with analyzers - local _, FX_Name = r.TrackFX_GetFXName(LT_Track, Pl) - if FX_Name:find('Pro%-C 2') then - --Set_In_Out(Pl+1, Band+1, 2,3) - --r.TrackFX_SetPinMappings(LT_Track, Pl+1, 0, 2, 2^((Band+1)*2-2)*2, 0) -- inputs 3 - --[[ r.TrackFX_SetPinMappings(LT_Track, Pl+1, 0, 3, 2^((Band+1)*2-2)*2, 0) -- inputs 4 ]] - end - - local IDinPost = tablefind(Trk[TrkID].PostFX, FXGUID[DragFX_ID]) - if IDinPost then MoveFX_Out_Of_Post(IDinPost) end - - local IDinPre = tablefind(Trk[TrkID].PreFX, FXGUID[DragFX_ID]) - if IDinPre then MoveFX_Out_Of_Pre(IDinPre) end - end - - -- Count numbeer of FXs in bands - local FXCountForBand = {} - FX[FxGUID].FXCheckWait = (FX[FxGUID].FXCheckWait or 0) + 1 - if FX[FxGUID].FXCheckWait > 10 then - for i, v in ipairs(FX[FxGUID].FXsInBS) do - if not tablefind(FXGUID, v) then - table.remove(FX[FxGUID].FXsInBS, tablefind(FX[FxGUID].FXsInBS, v)) - end - end - FX[FxGUID].FXCheckWait = 0 - end - - for i, v in ipairs(FX[FxGUID].FXsInBS) do - if FX[v].InWhichBand == 0 then - FXCountForBand[0] = (FXCountForBand[0] or 0) + 1 - elseif FX[v].InWhichBand == 1 then - FXCountForBand[1] = (FXCountForBand[1] or 0) + 1 - elseif FX[v].InWhichBand == 2 then - FXCountForBand[2] = (FXCountForBand[2] or 0) + 1 - elseif FX[v].InWhichBand == 3 then - FXCountForBand[3] = (FXCountForBand[3] or 0) + 1 - elseif FX[v].InWhichBand == 4 then - FXCountForBand[4] = (FXCountForBand[4] or 0) + 1 - end - end - - for i = 0, 5, 1 do FX[FxGUID].Cross[i] = FX[FxGUID].Cross[i] or {} end - for i = 0, Cuts * 4, 1 do ------- Rpt for Spaces between band splits - local CrossPos, Nxt_CrossPos - local Pl = tonumber(Payload) - - if i == 0 then - CrossPos = WinT + H - else - CrossPos = FX[FxGUID].Cross[math.min(i, 4)] - .Pos - end - if i == Cuts * 4 then - Nxt_CrossPos = WinT - else - Nxt_CrossPos = FX[FxGUID].Cross[i + 1] - .Pos - end - local HvrOnBand = r.ImGui_IsMouseHoveringRect(ctx, WinL, CrossPos - 3, WinR, - CrossPos + 3) - local HvrOnNxtBand = r.ImGui_IsMouseHoveringRect(ctx, WinL, Nxt_CrossPos - 3, WinR, - Nxt_CrossPos + 3) - - if --[[Hovering over a band]] r.ImGui_IsMouseHoveringRect(ctx, WinL, Nxt_CrossPos, WinR, CrossPos) and not (HvrOnBand or HvrOnNxtBand) then - local function Find_InsPos() - local InsPos - for I, v in ipairs(FX[FxGUID].FXsInBS) do - if FX[v].InWhichBand == i then InsPos = tablefind(FXGUID, v) end - end - Pl = Pl or InsPos - if not InsPos then - InsPos = FX_Idx - elseif Pl > FX_Idx then - InsPos = InsPos or (FX_Idx) - elseif Pl < FX_Idx then - InsPos = (InsPos or (FX_Idx - 1)) - 1 - end - return InsPos - end - - if Payload_Type == 'FX_Drag' then --Drop fx into a band - if FX[FXGUID[Pl]].InWhichBand ~= i then - r.ImGui_DrawList_AddRectFilled(WDL, WinL, CrossPos, WinR, Nxt_CrossPos, - 0xffffff66) - if r.ImGui_IsMouseReleased(ctx, 0) then - local DropDest = FX_Idx - local InsPos = Find_InsPos() - DropFXintoBS(FXGUID[Pl], FxGUID, i, Pl, InsPos + 1) - end - end - elseif Payload_Type == 'AddFX_Sexan' then - r.ImGui_DrawList_AddRectFilled(WDL, WinL, CrossPos, WinR, Nxt_CrossPos, - 0xffffff66) - - if r.ImGui_IsMouseReleased(ctx, 0) then - local InsPos = Find_InsPos() - local rv, type, payload, is_preview, is_delivery = r - .ImGui_GetDragDropPayload(ctx) - r.TrackFX_AddByName(LT_Track, payload, false, -1000 - InsPos - 1) - local FXid = r.TrackFX_GetFXGUID(LT_Track, InsPos + 1) - DropFXintoBS(FXid, FxGUID, i, InsPos, FX_Idx, 'DontMove') - end - end - AnySplitBandHvred = true - FX[FxGUID].PreviouslyMutedBand = FX[FxGUID].PreviouslyMutedBand or {} - FX[FxGUID].PreviouslySolodBand = FX[FxGUID].PreviouslySolodBand or {} - - --Mute Band - if r.ImGui_IsKeyPressed(ctx, r.ImGui_Key_M()) and Mods == 0 then - local Solo = r.TrackFX_GetParamNormalized(LT_Track, JoinerID, 4 + 5 * i) - if Solo == 0 then - local OnOff = r.TrackFX_GetParamNormalized(LT_Track, JoinerID, 5 * i) - local V - if OnOff == 1 then V = 0 else V = 1 end - r.TrackFX_SetParamNormalized(LT_Track, JoinerID, 5 * i, V) - FX[FxGUID].PreviouslyMutedBand = {} - end - --Solo Band - elseif r.ImGui_IsKeyPressed(ctx, r.ImGui_Key_S()) and Mods == 0 then - local Mute = r.TrackFX_GetParamNormalized(LT_Track, JoinerID, 5 * i) - if Mute == 1 then - local OnOff = r.TrackFX_GetParamNormalized(LT_Track, JoinerID, 4 + 5 * i) - local V - if OnOff == 1 then V = 0 else V = 1 end - r.TrackFX_SetParamNormalized(LT_Track, JoinerID, 4 + 5 * i, V) - FX[FxGUID].PreviouslySolodBand = {} - end - elseif r.ImGui_IsKeyPressed(ctx, r.ImGui_Key_M()) and Mods == Shift then - local AnyMutedBand - - for i = 0, Cuts * 4, 1 do - local OnOff = r.TrackFX_GetParamNormalized(LT_Track, JoinerID, 5 * i) - - if OnOff == 0 then AnyMutedBand = true end - if OnOff == 0 then table.insert(FX[FxGUID].PreviouslyMutedBand, i) end - if tablefind(FX[FxGUID].PreviouslyMutedBand, i) and OnOff == 1 then - r.TrackFX_SetParamNormalized(LT_Track, JoinerID, 5 * i, 0) - else - r.TrackFX_SetParamNormalized(LT_Track, JoinerID, 5 * i, 1) - end - end - - if not AnyMutedBand then FX[FxGUID].PreviouslyMutedBand = {} end - elseif r.ImGui_IsKeyPressed(ctx, r.ImGui_Key_S()) and Mods == Shift then - local AnySolodBand - - for i = 0, Cuts * 4, 1 do - local OnOff = r.TrackFX_GetParamNormalized(LT_Track, JoinerID, 4 + 5 * i) - - if OnOff == 1 then AnySolodBand = true end - if OnOff == 1 then table.insert(FX[FxGUID].PreviouslySolodBand, i) end - if tablefind(FX[FxGUID].PreviouslySolodBand, i) and OnOff == 0 then - r.TrackFX_SetParamNormalized(LT_Track, JoinerID, 4 + 5 * i, 1) - else - r.TrackFX_SetParamNormalized(LT_Track, JoinerID, 4 + 5 * i, 0) - end - end - - if not AnySolodBand then FX[FxGUID].PreviouslySolodBand = {} end - end - FX[FxGUID].PreviouslyMutedBand = FX[FxGUID].PreviouslyMutedBand or {} - - - - if IsLBtnClicked and (Mods == 0 or Mods == Apl) then - FX[FxGUID].Sel_Band = i - FX[FxGUID].StartCount = true - elseif IsRBtnClicked and Cuts ~= 1 then - local _, ClickPos = r.ImGui_GetMousePos(ctx, 1) - local H = 213 - local Norm_V = (WinT - ClickPos + 3) / H + 1 - - - local X = FX[FxGUID].Cross - - local Seg -- determine which band it's clicked - - X[1].Val = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, 1); - X[2].Val = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, 2); - X[3].Val = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, 3); - X[4].Val = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, 4); - - if Norm_V < X[1].Val then - Seg = 1 - elseif Norm_V > X[4].Val and Cuts == 0.75 then - Seg = 5 - elseif Norm_V > X[1].Val and Norm_V < X[2].Val then - Seg = 2 - elseif Norm_V > X[2].Val and Norm_V < X[3].Val then - Seg = 3 - elseif Norm_V > X[3].Val and Norm_V < X[4].Val then - Seg = 4 - end - - - if Cuts == 0.75 then - if Norm_V > X[3].Val then Seg = 5 end - elseif Cuts == 0.5 then - if Norm_V > X[2].Val then Seg = 5 end - elseif Cuts == 0.25 then - if Norm_V > X[1].Val then Seg = 5 end - end - - - - - - if Seg == 5 then - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, i + 1, Norm_V) - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, 0, Cuts + 0.25) - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, i + 1, Norm_V) - elseif Seg < 5 then - local BandFreq = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, i + 1) - local BandFreq2 - if Seg == 1 then - BandFreq2 = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, i + 2) - end - - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, 0, Cuts + 0.25) - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, i + 1, Norm_V) - - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, i + 2, BandFreq) - - if Seg == 1 then - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, i + 3, BandFreq2) - end - - - --[[ for T=1, Cuts*4-Seg+1, 1 do - end ]] - end - elseif IsLBtnClicked and Mods == Alt then - if FXCountForBand[i] or 0 > 0 then - FX[FxGUID].PromptDeleteBand = i - local Modalw, Modalh = 270, 55 - r.ImGui_SetNextWindowPos(ctx, VP.x + VP.w / 2 - Modalw / 2, - VP.y + VP.h / 2 - Modalh / 2) - r.ImGui_SetNextWindowSize(ctx, Modalw, Modalh) - r.ImGui_OpenPopup(ctx, 'Delete Band' .. i .. '? ##' .. FxGUID) - end - elseif LBtn_MousdDownDuration > 0.06 and (Mods == 0 or Mods == Apl) and not DraggingFXs.SrcBand and FX[FxGUID].StartCount then - --Drag FXs to different bands - for I, v in ipairs(FX[FxGUID].FXsInBS) do - if FX[v].InWhichBand == i then - table.insert(DraggingFXs, v) - table.insert(DraggingFXs_Idx, tablefind(FXGUID, v)) - end - end - DraggingFXs.SrcBand = i - DraggingFXs.SrcFxID = FxGUID - elseif DraggingFXs.SrcBand and DraggingFXs[1] and IsLBtnHeld or Payload_Type == 'FX_Drag' then - FX[FxGUID].Sel_Band = i - end - - - - if DraggingFXs[1] and DraggingFXs.SrcBand ~= i then - HighlightSelectedItem(0xffffff25, 0xffffff66, 0, WinL, CrossPos - 1, WinR - 1, - Nxt_CrossPos + 1, Nxt_CrossPos - CrossPos, WinR - WinL, 1, 1, - NoGetItemRect, NoForeground, NOrounding) - if not IsLBtnHeld and Mods == 0 then -- if Dropped FXs - for I, v in ipairs(DraggingFXs) do - FX[v].InWhichBand = i - local Fx = tablefind(FXGUID, v) - r.GetSetMediaTrackInfo_String(LT_Track, - 'P_EXT: FX is in which Band' .. v, i, true) - --sets input channel - r.TrackFX_SetPinMappings(LT_Track, Fx, 0, 0, 2 ^ ((i + 1) * 2 - 2), 0) - r.TrackFX_SetPinMappings(LT_Track, Fx, 0, 1, 2 ^ ((i + 1) * 2 - 1), 0) - --sets Output +1 - r.TrackFX_SetPinMappings(LT_Track, Fx, 1, 0, 2 ^ ((i + 1) * 2 - 2), 0) - r.TrackFX_SetPinMappings(LT_Track, Fx, 1, 1, 2 ^ ((i + 1) * 2 - 1), 0) - end - elseif not IsLBtnHeld and Mods == Apl then - local Ofs = 0 - for I, v in ipairs(DraggingFXs) do - local offset - local srcFX = DraggingFXs_Idx[I] + Ofs - local TrgFX = srcFX + #DraggingFXs - if not FXCountForBand[i] then -- if theres no fx in the band - elseif FXCountForBand[i] > 0 then - for FxInB, v in ipairs(FX[FxGUID].FXsInBS) do - if FX[v].InWhichBand == i and tablefind(FXGUID, v) then - offset = - tablefind(FXGUID, v) - end - end - TrgFX = offset + I - end - - - if srcFX >= TrgFX then Ofs = I end - - - r.TrackFX_CopyToTrack(LT_Track, srcFX, LT_Track, TrgFX, false) - local ID = r.TrackFX_GetFXGUID(LT_Track, TrgFX) - - if not tablefind(FX[FxGUID].FXsInBS, ID) then - table.insert( - FX[FxGUID].FXsInBS, ID) - end - FX[ID] = FX[ID] or {} - FX[ID].InWhichBand = i - r.GetSetMediaTrackInfo_String(LT_Track, - 'P_EXT: FX is in which Band' .. ID, i, true) - r.GetSetMediaTrackInfo_String(LT_Track, - 'P_EXT: FX is in which BS' .. ID, FxGUID, true) - - - --sets input channel - r.TrackFX_SetPinMappings(LT_Track, TrgFX, 0, 0, 2 ^ ((i + 1) * 2 - 2), - 0) - r.TrackFX_SetPinMappings(LT_Track, TrgFX, 0, 1, 2 ^ ((i + 1) * 2 - 1), - 0) - --sets Output +1 - r.TrackFX_SetPinMappings(LT_Track, TrgFX, 1, 0, 2 ^ ((i + 1) * 2 - 2), - 0) - r.TrackFX_SetPinMappings(LT_Track, TrgFX, 1, 1, 2 ^ ((i + 1) * 2 - 1), - 0) - end - - - --[[ for I, v in ipairs(DraggingFXs) do - local srcFX = tablefind(FXGUID, v) - r.TrackFX_CopyToTrack(LT_Track, srcFX, LT_Track, ) - end ]] - end - end - - - - WDL = WDL or r.ImGui_GetWindowDrawList(ctx) - -- Highligh Hovered Band - if not IsLBtnHeld then - r.ImGui_DrawList_AddRectFilled(WDL, WinL, Nxt_CrossPos, WinR, CrossPos, - 0xffffff19) - end - end - if FX[FxGUID].Sel_Band == i then - HighlightSelectedItem(0xffffff25, 0xffffff66, 0, WinL, CrossPos - 1, WinR - 1, - Nxt_CrossPos + 1, Nxt_CrossPos - CrossPos, WinR - WinL, 1, 1, NoGetItemRect, - NoForeground, NOrounding) - end - - - local Solo, Pwr - if JoinerID then - Pwr = r.TrackFX_GetParamNormalized(LT_Track, JoinerID, 5 * i) - - local Clr = Layer_Mute or CustomColorsDefault.Layer_Mute - if Pwr == 0 then - r.ImGui_DrawList_AddRectFilled(WDL, WinL, Nxt_CrossPos, WinR, - CrossPos, Clr) - end - - Solo = r.TrackFX_GetParamNormalized(LT_Track, JoinerID, 4 + 5 * i) - local Clr = Layer_Solo or CustomColorsDefault.Layer_Solo - if Solo == 1 then - r.ImGui_DrawList_AddRectFilled(WDL, WinL, Nxt_CrossPos, WinR, - CrossPos, Clr) - end - end - end - - if r.ImGui_BeginPopupModal(ctx, 'Delete Band' .. (FX[FxGUID].PromptDeleteBand or '') .. '? ##' .. FxGUID, nil, r.ImGui_WindowFlags_NoTitleBar()|r.ImGui_WindowFlags_NoResize()) then - r.ImGui_Text(ctx, 'Delete the FXs in band ' .. FX[FxGUID].PromptDeleteBand .. '?') - if r.ImGui_Button(ctx, '(y) Yes') or r.ImGui_IsKeyPressed(ctx, 89) then - r.Undo_BeginBlock() - for i = 0, Sel_Track_FX_Count, 1 do - if tablefind(FX[FxGUID].FXsInBS, FXGUID[i]) then - end - end - local DelFX = {} - for i, v in ipairs(FX[FxGUID].FXsInBS) do - if FX[v].InWhichBand == FX[FxGUID].PromptDeleteBand then - table.insert(DelFX, v) - --delete FXs - end - end - for i, v in ipairs(DelFX) do - r.TrackFX_Delete(LT_Track, tablefind(FXGUID, v) - i + 1) - end - - - r.Undo_EndBlock('Delete all FXs in Band ' .. FX[FxGUID].PromptDeleteBand, 0) - FX[FxGUID].PromptDeleteBand = nil - r.ImGui_CloseCurrentPopup(ctx) - end - SL() - if r.ImGui_Button(ctx, '(n) No') or r.ImGui_IsKeyPressed(ctx, 78) then - r.ImGui_CloseCurrentPopup(ctx) - end - r.ImGui_EndPopup(ctx) - end - - - - - - - -- draw bands - - for i = 1, Cuts * 4, 1 do - local X = FX[FxGUID].Cross[i] - if IsRBtnHeld then - X.Val = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, i); - - X.Pos = SetMinMax(WinT + H - H * X.Val, WinT, WinT + H) - end - local BsID = FX[FxGUID].BandSplitID - local TxtClr = getClr(r.ImGui_Col_Text()) - - r.ImGui_DrawList_AddLine(WDL, WinL, X.Pos, WinR, X.Pos, TxtClr) - if FX[FxGUID].Cross.DraggingBand ~= i then - r.ImGui_DrawList_AddText(WDL, WinL, X.Pos, TxtClr, - roundUp(r.gmem_read(BsID + 4 + i), 1)) - end - if FX[FxGUID].Cross.HoveringBand == i or FX[FxGUID].Cross.DraggingBand == i then - if not FX[FxGUID].Cross.DraggingBand == i then - r.ImGui_DrawList_AddText(WDL, WinL, X.Pos, TxtClr, - roundUp(r.gmem_read(BsID + 4 + i), 1)) - end - r.ImGui_DrawList_AddLine(WDL, WinL, X.Pos + 1, WinR, X.Pos, TxtClr) - - if not r.ImGui_IsMouseHoveringRect(ctx, WinL, FX[FxGUID].Cross.HoveringBandPos - 3, WinR, FX[FxGUID].Cross.HoveringBandPos + 3) - or (FX[FxGUID].Cross.DraggingBand == i and not IsLBtnHeld) then - FX[FxGUID].Cross.HoveringBandPos = 0 - FX[FxGUID].Cross.HoveringBand = nil - FX[FxGUID].Cross.DraggingBand = nil - end - end - end - - -- Display Number of FXs in Band - for i = 0, Cuts * 4, 1 do - if FXCountForBand[i] or 0 > 0 then - local This_B_Pos, nxt_X_Pos - if i == 4 or (i == 3 and Cuts == 0.75) or (i == 2 and Cuts == 0.5) or (i == 1 and Cuts == 0.25) then - nxt_X_Pos = WinT - This_B_Pos = FX[FxGUID].Cross[i].Pos - elseif i == 0 then - This_B_Pos = WinT + H - nxt_X_Pos = FX[FxGUID].Cross[1].Pos - else - nxt_X_Pos = FX[FxGUID].Cross[i + 1].Pos or 0 - This_B_Pos = FX[FxGUID].Cross[i].Pos - end - - - if This_B_Pos - nxt_X_Pos > 28 and not DraggingFXs[1] then - r.ImGui_DrawList_AddTextEx(WDL, Font_Andale_Mono_20_B, 14, WinL + 10, - nxt_X_Pos + (This_B_Pos - nxt_X_Pos - 10) / 2, 0xffffff66, - FXCountForBand[i] or '') - elseif DraggingFXs[1] then - if DraggingFXs.SrcBand == i then - MsX, MsY = r.ImGui_GetMousePos(ctx) - r.ImGui_DrawList_AddLine(Glob.FDL, MsX, MsY, WinL + 15, - nxt_X_Pos + (This_B_Pos - nxt_X_Pos - 10) / 2, 0xffffff99) - else - r.ImGui_DrawList_AddTextEx(WDL, Font_Andale_Mono_20_B, 14, WinL + 10, - nxt_X_Pos + (This_B_Pos - nxt_X_Pos - 10) / 2, 0xffffff66, - FXCountForBand[i] or '') - end - end - end - end - - -- Draw Background - r.ImGui_DrawList_AddRectFilled(WDL, WinL, Glob.WinT, WinR, Glob.WinB, 0xffffff33) - - local Copy - - if DraggingFXs[1] and FXCountForBand[DraggingFXs.SrcBand] then - local MsX, MsY = r.ImGui_GetMousePos(ctx) - if Mods == Apl then Copy = 'Copy' end - r.ImGui_DrawList_AddTextEx(Glob.FDL, Font_Andale_Mono_20_B, 14, MsX + 20, MsY, - 0xffffffaa, (Copy or '') .. ' ' .. FXCountForBand[DraggingFXs.SrcBand] .. ' FXs') - end - end - - - if not IsLBtnHeld then FX[FxGUID].StartCount = nil end - - - r.ImGui_EndChild(ctx) - end - - if not FX[FxGUID].Collapse then - local LastFX_XPos - local FrstFX - local ofs = 0 - - - - for FX_ID = 0, Sel_Track_FX_Count, 1 do - for i, v in ipairs(FX[FxGUID].FXsInBS) do - local _, FxName = r.TrackFX_GetFXName(LT_Track, FX_ID) - - if FXGUID[FX_ID] == v and FX[FxGUID].Sel_Band == FX[v].InWhichBand then - if FxName:find('FXD ReSpectrum') then ofs = ofs + 1 end - - if not FrstFX then - SL(nil, 0) - AddSpaceBtwnFXs(FX_ID - 1, 'SpcInBS', nil, nil, nil, FxGUID) - FrstFX = true - end - --if i == 1 then SL(nil,0) AddSpaceBtwnFXs(FX_Idx,'SpcInBS',nil,nil,1, FxGUID) end - SL(nil, 0) - - I = tablefind(FXGUID, v) - if I then - createFXWindow(I) - SL(nil, 0) - AddSpaceBtwnFXs(I - ofs, 'SpcInBS', nil, nil, nil, FxGUID) - SL(nil, 0) - --[[ if i == #FX[FxGUID].FXsInBS then ]] - LastFX_XPos = r.ImGui_GetCursorScreenPos(ctx) - end - end - end - end - - - if LastFX_XPos then - local Sel_B_Pos, NxtB_Pos, AddTopLine - local Cuts = FX[FxGUID].Cross.Cuts - FX[FxGUID].Sel_Band = FX[FxGUID].Sel_Band or 0 - if FX[FxGUID].Sel_Band == 0 then - Sel_B_Pos = WinT + H - else - Sel_B_Pos = FX[FxGUID].Cross[FX[FxGUID].Sel_Band].Pos - end - - - if FX[FxGUID].Sel_Band == 4 - or (FX[FxGUID].Sel_Band == 3 and Cuts == 0.75) - or (FX[FxGUID].Sel_Band == 2 and Cuts == 0.5) - or (FX[FxGUID].Sel_Band == 1 and Cuts == 0.25) - then - NxtB_Pos = WinT - AddTopLine = true - else - NxtB_Pos = FX[FxGUID].Cross[FX[FxGUID].Sel_Band + 1].Pos or 0 - end - - local Clr = getClr(r.ImGui_Col_Text()) - WinT = Glob.WinT - H = Glob.Height or 0 - WinR = WinR or 0 - NxtB_Pos = NxtB_Pos or 0 - WinL = WinL or 0 - r.ImGui_DrawList_AddLine(WDL, WinR, WinT + H, LastFX_XPos, WinT + H, Clr) - r.ImGui_DrawList_AddLine(WDL, WinR, Sel_B_Pos, WinR, WinT + H, Clr) - - r.ImGui_DrawList_AddLine(WDL, WinR, NxtB_Pos, WinR, WinT, Clr) - r.ImGui_DrawList_AddLine(WDL, WinR, WinT, LastFX_XPos, WinT, Clr) - r.ImGui_DrawList_AddLine(WDL, LastFX_XPos - 1, WinT, LastFX_XPos - 1, WinT + H, Clr) - if AddTopLine then r.ImGui_DrawList_AddLine(WDL, WinL, WinT, WinR, WinT, Clr) end - if FX[FxGUID].Sel_Band == 0 then - r.ImGui_DrawList_AddLine(WDL, WinL, WinT + H, WinR, - WinT + H, Clr) - end - - if DraggingFX_L_Pos then - local W = LastFX_XPos - DraggingFX_L_Pos - HighlightSelectedItem(0xffffff22, 0xffffffff, -1, DraggingFX_L_Pos, WinT, LastFX_XPos, - WinT + H, H, W, H_OutlineSc, V_OutlineSc, NoGetItemRect, WDL) - if not IsLBtnHeld then DraggingFX_L_Pos = nil end - end - else - if DraggingFX_L_Pos then - local W = Width - 10 - HighlightSelectedItem(0xffffff22, 0xffffffff, -1, DraggingFX_L_Pos, WinT, - DraggingFX_L_Pos + W, WinT + H, H, W, H_OutlineSc, V_OutlineSc, NoGetItemRect, - WDL) - if not IsLBtnHeld then DraggingFX_L_Pos = nil end - end - end - end - if FX[FxGUID].DeleteBandSplitter then - if #FX[FxGUID].FXsInBS == 0 then - r.TrackFX_Delete(LT_Track, FX_Idx + 1) - r.TrackFX_Delete(LT_Track, FX_Idx) - FX[FxGUID].DeleteBandSplitter = nil - else - local Modalw, Modalh = 320, 55 - r.ImGui_SetNextWindowPos(ctx, VP.x + VP.w / 2 - Modalw / 2, VP.y + VP.h / 2 - Modalh / 2) - r.ImGui_SetNextWindowSize(ctx, Modalw, Modalh) - r.ImGui_OpenPopup(ctx, 'Delete Band Splitter? ##' .. FxGUID) - end - end - - if r.ImGui_BeginPopupModal(ctx, 'Delete Band Splitter? ##' .. FxGUID, nil, r.ImGui_WindowFlags_NoTitleBar()|r.ImGui_WindowFlags_NoResize()) then - r.ImGui_Text(ctx, 'Delete the FXs in band splitter altogether?') - if r.ImGui_Button(ctx, '(n) No') or r.ImGui_IsKeyPressed(ctx, 78) then - r.Undo_BeginBlock() - r.TrackFX_Delete(LT_Track, FX_Idx) - r.TrackFX_Delete(LT_Track, FX_Idx + #FX[FxGUID].FXsInBS) - for i = 0, Sel_Track_FX_Count, 1 do - if tablefind(FX[FxGUID].FXsInBS, FXGUID[i]) then - --sets input channel - r.TrackFX_SetPinMappings(LT_Track, i, 0, 0, 1, 0) - r.TrackFX_SetPinMappings(LT_Track, i, 0, 1, 2, 0) - --sets Output - r.TrackFX_SetPinMappings(LT_Track, i, 1, 0, 1, 0) - r.TrackFX_SetPinMappings(LT_Track, i, 1, 1, 2, 0) - - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: FX is in which BS' .. FXGUID[i], - '', true) - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: FX is in which Band' .. FXGUID - [i], '', true) - FX[FXGUID[i]].InWhichBand = nil - end - end - FX[FxGUID].FXsInBS = nil - r.ImGui_CloseCurrentPopup(ctx) - FX[FxGUID].DeleteBandSplitter = nil - r.Undo_EndBlock('Delete Band Split and put enclosed FXs back into channel one', 0) - end - SL() - - if r.ImGui_Button(ctx, '(y) Yes') or r.ImGui_IsKeyPressed(ctx, 89) then - r.Undo_BeginBlock() - r.TrackFX_Delete(LT_Track, FX_Idx) - r.TrackFX_Delete(LT_Track, FX_Idx + #FX[FxGUID].FXsInBS) - local DelFX = {} - for i = 0, Sel_Track_FX_Count, 1 do - if tablefind(FX[FxGUID].FXsInBS, FXGUID[i]) then - table.insert(DelFX, FXGUID[i]) - end - end - - for i, v in ipairs(DelFX) do - FX[v].InWhichBand = nil - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: FX is in which Band' .. v, '', true) - r.TrackFX_Delete(LT_Track, tablefind(FXGUID, v) - i) - end - - - r.Undo_EndBlock('Delete Band Split and all enclosed FXs', 0) - end - SL() - if r.ImGui_Button(ctx, '(esc) Cancel') or r.ImGui_IsKeyPressed(ctx, r.ImGui_Key_Escape()) then - FX[FxGUID].DeleteBandSplitter = nil - r.ImGui_CloseCurrentPopup(ctx) - end - r.ImGui_EndPopup(ctx) - end - end -- for if FX_Name ~='JS: FXD (Mix)RackMixer' - r.ImGui_SameLine(ctx, nil, 0) - - - - - - - ------- Pre FX Chain -------------- - local FXisInPreChain, offset = nil, 0 - if MacroPos == 0 then offset = 1 end --else offset = 0 - if Trk[TrkID].PreFX[1] then - if Trk[TrkID].PreFX[FX_Idx + 1 - offset] == FXGUID[FX_Idx] then - FXisInPreChain = true - end - end - - if Trk[TrkID].PreFX[1] and not Trk[TrkID].PreFX_Hide and FX_Idx == #Trk[TrkID].PreFX - 1 + offset then - AddSpaceBtwnFXs(FX_Idx, 'End of PreFX', nil) - end - - if FXisInPreChain then - if FX_Idx + 1 - offset == #Trk[TrkID].PreFX and not Trk[TrkID].PreFX_Hide then - local R, B = r.ImGui_GetItemRectMax(ctx) - r.ImGui_DrawList_AddRect(FX_Dvs_BgDL, Cx_LeftEdge, Cy_BeforeFXdevices, R, B, - r.ImGui_GetColor(ctx, r.ImGui_Col_Button())) - r.ImGui_DrawList_AddRectFilled(FX_Dvs_BgDL, Cx_LeftEdge, Cy_BeforeFXdevices, R, B, 0xcccccc10) - end - end - ------------------------------------------ - if FX_Idx + 1 == RepeatTimeForWindows and not Trk[TrkID].PostFX[1] then -- add last space - AddSpaceBtwnFXs(FX_Idx + 1, nil, 'LastSpc') - elseif FX_Idx + 1 == RepeatTimeForWindows and Trk[TrkID].PostFX[1] then - AddSpaceBtwnFXs(Sel_Track_FX_Count - #Trk[TrkID].PostFX, nil, 'LastSpc', nil, nil, nil, 20) - end - end --for repeat as many times as FX instances - - - for i = 0, #FXGUID do - local FXid = r.TrackFX_GetFXGUID(LT_Track, i) - - if FXid ~= FXGUID[i] then - end - --Detects if any FX is deleted - if FXid == nil then - --Deleted_FXGUID = FXGUID[i] - - --DeleteAllParamOfFX(Deleted_FXGUID, TrkID) - FXGUID[i] = nil - else - end - end - - if Sel_Track_FX_Count == 0 and DeletePrms == nil then --if it's the only fx - DeleteAllParamOfFX(FXGUID[0], TrkID, 0) - FXGUID[0] = nil - DeletePrms = true - elseif Sel_Track_FX_Count ~= 0 then - DeletePrms = nil - end - - - if Sel_Track_FX_Count == 0 then AddSpaceBtwnFXs(0, false, true) end - - - - --when user switch selected track... - if TrkID ~= TrkID_End and TrkID_End ~= nil and Sel_Track_FX_Count > 0 then - Sendgmems = nil - waitForGmem = 0 - - if Sendgmems == nil then - r.gmem_attach('ParamValues') - for P = 1, 100, 1 do - r.gmem_write(1000 + P, 0) - end - --[[ if Trk[TrkID].ModPrmInst then - for P=1, Trk[TrkID].ModPrmInst , 1 do - for m =1 , 8, 1 do - - local ParamMacroMod_Label= 'Param:'..P..'Macro:'..m - - - if Prm.McroModAmt[ParamMacroMod_Label] ~= nil then - r.gmem_write( 1000*m+P ,Prm.McroModAmt[ParamMacroMod_Label]) - end - - end - end - end ]] - - for FX_Idx = 0, Sel_Track_FX_Count, 1 do - local FxGUID = r.TrackFX_GetFXGUID(LT_Track, FX_Idx) - if FxGUID then - for P, v in ipairs(FX[FxGUID]) do - local FP = FX[FxGUID][P] - FP.ModAMT = FP.ModAMT or {} - if FP.WhichCC then - for m = 1, 8, 1 do - if FP.ModAMT[m] then r.gmem_write(1000 * m + P, FP.ModAMT[m]) end - end - end - end - end - end - - - - - r.gmem_write(2, PM.DIY_TrkID[TrkID] or 0) - - Sendgmems = true - end - end - - - - r.ImGui_EndChild(ctx) - if HoverOnScrollItem then DisableScroll = true end - - if AnySplitBandHvred then - HintMessage = - 'Mouse: Alt=Delete All FXs in Layer | Shift=Bypass FXs Keys: M=mute band Shift+M=Toggle all muted band | S=solo band Shift+S=Toggle all solo\'d band' - end - - end - Pos_Devices_R, Pos_Devices_B = r.ImGui_GetItemRectMax(ctx) - - function MoveFX_Out_Of_Post(IDinPost) - table.remove(Trk[TrkID].PostFX, IDinPost or tablefind(Trk[TrkID].PostFX, FXGUID[DragFX_ID])) - for i = 1, #Trk[TrkID].PostFX + 1, 1 do - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: PostFX ' .. i, Trk[TrkID].PostFX[i] or '', true) - end - end - - function MoveFX_Out_Of_Pre(IDinPre) - table.remove(Trk[TrkID].PreFX, IDinPre or tablefind(Trk[TrkID].PreFX, FXGUID[DragFX_ID])) - for i = 1, #Trk[TrkID].PreFX + 1, 1 do - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: PreFX ' .. i, Trk[TrkID].PreFX[i] or '', true) - end - end - - function RemoveFXfromBS() - for FX_Idx = 0, Sel_Track_FX_Count - 1, 1 do -- check all fxs and see if it's a band splitter - if FX[FXGUID[FX_Idx]].FXsInBS then - local FxID = tablefind(FX[FXGUID[FX_Idx]].FXsInBS, FXGUID[DragFX_ID]) - if FxID then - table.remove(FX[FXGUID[FX_Idx]].FXsInBS, FxID) - FX[FXGUID[DragFX_ID]].InWhichBand = nil - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: FX is in which BS' .. FXGUID[DragFX_ID], '', - true) - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: FX is in which Band' .. FXGUID[DragFX_ID], '', - true) - end - end - end - end - - _, Payload_Type, Payload, is_preview, is_delivery = r.ImGui_GetDragDropPayload(ctx) - Payload = tonumber(Payload) - MouseAtRightEdge = r.ImGui_IsMouseHoveringRect(ctx, VP.X + VP.w - 25, VP.y, VP.X + VP.w, VP.y + VP.h) - - if (Payload_Type == 'FX_Drag' and MouseAtRightEdge) and not Trk[TrkID].PostFX[1] then - r.ImGui_SameLine(ctx, nil, -5) - dropped, payload = r.ImGui_AcceptDragDropPayload(ctx, 'FX_Drag') - rv = r.ImGui_Button(ctx, 'P\no\ns\nt\n \nF\nX\n \nC\nh\na\ni\nn', 20, 220) - HighlightSelectedItem(0xffffff22, 0xffffffff, -1, L, T, R, B, h, w, H_OutlineSc, V_OutlineSc, - 'GetItemRect', WDL) - if r.ImGui_BeginDragDropTarget(ctx) then -- if drop to post fx chain - Drop, payload = r.ImGui_AcceptDragDropPayload(ctx, 'FX_Drag') - HighlightSelectedItem(0xffffff22, 0xffffffff, -1, L, T, R, B, h, w, H_OutlineSc, V_OutlineSc, - 'GetItemRect', WDL) - - if Drop and not tablefind(Trk[TrkID].PostFX, FXGUID[DragFX_ID]) then - table.insert(Trk[TrkID].PostFX, FXGUID[DragFX_ID]) - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: PostFX ' .. #Trk[TrkID].PostFX, FXGUID - [DragFX_ID], true) - r.TrackFX_CopyToTrack(LT_Track, DragFX_ID, LT_Track, 999, true) - - local IDinPre = tablefind(Trk[TrkID].PreFX, FXGUID[DragFX_ID]) - if IDinPre then MoveFX_Out_Of_Pre(IDinPre) end - end - - if --[[Move FX out of layer]] Drop and FX.InLyr[FXGUID[DragFX_ID]] then - FX.InLyr[FXGUID[DragFX_ID]] = nil - r.SetProjExtState(0, 'FX Devices', 'FXLayer - ' .. 'is FX' .. FXGUID[DragFX_ID] .. 'in layer', '') - end - - if Drop then - RemoveFXfromBS() - --Remove FX from BS if it's in BS - end - - - - r.ImGui_EndDragDropTarget(ctx) - else - begindrop = false - end - end - - - PostFX_Width = math.min( - (MakeSpaceForPostFX or 0) + ((Trk[TrkID].MakeSpcForPostFXchain or 0) + (PostFX_LastSpc or 0)) + 30, - VP.w / 2) - - --ttp('PostFX_Width = '..PostFX_Width..'\n MakeSpaceForPostFX = '.. (MakeSpaceForPostFX or 0 )..'\n MakeSpcForPostFXchain = '.. (Trk[TrkID].MakeSpcForPostFXchain or 0 ).. '\n PostFX_LastSpc = '.. (PostFX_LastSpc or 0)) - - - if not Trk[TrkID].PostFX[1] then - Trk[TrkID].MakeSpcForPostFXchain = 0 - end - - if Trk[TrkID].PostFX[1] then - r.ImGui_SameLine(ctx, nil, 0) - Line_L, Line_T = r.ImGui_GetCursorScreenPos(ctx) - rv = r.ImGui_Button(ctx, - (#Trk[TrkID].PostFX or '') .. '\n\n' .. 'P\no\ns\nt\n \nF\nX\n \nC\nh\na\ni\nn', 20, 220) - if r.ImGui_IsItemClicked(ctx, 1) then - if Trk[TrkID].PostFX_Hide then Trk[TrkID].PostFX_Hide = false else Trk[TrkID].PostFX_Hide = true end - end - if r.ImGui_BeginDragDropTarget(ctx) then -- if drop to post fx chain Btn - if Payload_Type == 'FX_Drag' then - Drop, payload = r.ImGui_AcceptDragDropPayload(ctx, 'FX_Drag') - HighlightSelectedItem(0xffffff22, 0xffffffff, -1, L, T, R, B, h, w, H_OutlineSc, V_OutlineSc, - 'GetItemRect', WDL) - - if Drop and not tablefind(Trk[TrkID].PostFX, FXGUID[DragFX_ID]) then - --r.TrackFX_CopyToTrack(LT_Track, DragFX_ID, LT_Track, 999, true) - table.insert(Trk[TrkID].PostFX, FXGUID[DragFX_ID]) - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: PostFX ' .. #Trk[TrkID].PostFX, - FXGUID[DragFX_ID], true) - - - local IDinPre = tablefind(Trk[TrkID].PreFX, FXGUID[DragFX_ID]) - if IDinPre then MoveFX_Out_Of_Pre(IDinPre) end - end - elseif Payload_Type == 'AddFX_Sexan' then - dropped, payload = r.ImGui_AcceptDragDropPayload(ctx, 'AddFX_Sexan') - HighlightSelectedItem(0xffffff22, 0xffffffff, -1, L, T, R, B, h, w, H_OutlineSc, V_OutlineSc, - 'GetItemRect', WDL) - if dropped then - r.TrackFX_AddByName(LT_Track, payload, false, -1000 - Sel_Track_FX_Count) - local FXid = r.TrackFX_GetFXGUID(LT_Track, Sel_Track_FX_Count) - local _, Name = r.TrackFX_GetFXName(LT_Track, Sel_Track_FX_Count) - table.insert(Trk[TrkID].PostFX, FXid) - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: PostFX ' .. #Trk[TrkID].PostFX, FXid, true) - end - end - - r.ImGui_EndDragDropTarget(ctx) - end - - r.ImGui_SameLine(ctx, nil, 0) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_ChildBg(), 0xffffff11) - local PostFX_Extend_W = 0 - if PostFX_Width == VP.w / 2 then PostFX_Extend_W = 20 end - if not Trk[TrkID].PostFX_Hide then - if r.ImGui_BeginChild(ctx, 'Post FX chain', PostFX_Width - PostFX_Extend_W, 220) then - local clr = r.ImGui_GetStyleColor(ctx, r.ImGui_Col_Button()) - r.ImGui_DrawList_AddLine(Glob.FDL, Line_L, Line_T - 1, Line_L + VP.w, Line_T - 1, clr) - r.ImGui_DrawList_AddLine(Glob.FDL, Line_L, Line_T + 220, Line_L + VP.w, Line_T + 220, clr) - - - - Trk[TrkID].MakeSpcForPostFXchain = 0 - - if r.TrackFX_AddByName(LT_Track, 'FXD Macros', 0, 0) == -1 then offset = 0 else offset = 1 end - - for FX_Idx, V in pairs(Trk[TrkID].PostFX) do - local I = --[[ tablefind(FXGUID, Trk[TrkID].PostFX[#Trk[TrkID].PostFX+1-FX_Idx]) ]] - tablefind(FXGUID, V) - - local Spc - if FX_Idx == 1 and I then AddSpaceBtwnFXs(I - 1, 'SpcInPost', nil, nil, 1) end - if I then - createFXWindow(I) - r.ImGui_SameLine(ctx, nil, 0) - - FX[FXGUID[I]].PostWin_SzX, _ = r.ImGui_GetItemRectSize(ctx) - Trk[TrkID].MakeSpcForPostFXchain = (Trk[TrkID].MakeSpcForPostFXchain or 0) + - (FX.WidthCollapse[FXGUID[I]] or FX.Width[FXGUID[I]] or (DefaultWidth)) + - 10 -- 10 is space btwn fxs - - if FX_Idx == #Trk[TrkID].PostFX then - AddSpaceBtwnFXs(I, 'SpcInPost', nil, nil, #Trk[TrkID].PostFX + 1) - else - AddSpaceBtwnFXs(I, 'SpcInPost', nil, nil, FX_Idx + 1) - end - if FX_Idx == #Trk[TrkID].PostFX and r.ImGui_IsItemHovered(ctx, r.ImGui_HoveredFlags_RectOnly()) then - MouseAtRightEdge = true --[[ else MouseAtRightEdge = nil ]] - end - end - end - - - - - offset = nil - - - if InsertToPost_Src then - table.insert(Trk[TrkID].PostFX, InsertToPost_Dest, FXGUID[InsertToPost_Src]) - for i = 1, #Trk[TrkID].PostFX + 1, 1 do - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: PostFX ' .. i, Trk[TrkID].PostFX[i] or '', - true) - end - InsertToPost_Src = nil - InsertToPost_Dest = nil - end - r.ImGui_EndChild(ctx) - end - else - Trk[TrkID].MakeSpcForPostFXchain = 0 - end - - - for FX_Idx, V in pairs(Trk[TrkID].PostFX) do - local I = tablefind(FXGUID, V) - local P = Sel_Track_FX_Count - #Trk[TrkID].PostFX + (FX_Idx - 1) - - - if I ~= P then - r.Undo_BeginBlock() - if not MovFX.FromPos[1] then - table.insert(MovFX.FromPos, I) - table.insert(MovFX.ToPos, P) - table.insert(MovFX.Lbl, 'Move FX into Post-FX Chain') - end - --r.TrackFX_CopyToTrack(LT_Track, I, LT_Track, P, true) - r.Undo_EndBlock('Move FX out of Post-FX Chain', 0) - end - end - r.ImGui_PopStyleColor(ctx) - end - - - -- When Add or Delete Fx.....if add fx or delete fx - if Sel_Track_FX_Count ~= CompareFXCount then - for i in ipairs(FX.Win_Name) do - - end - if FX.Win_Name then - local rv, tab = FindStringInTable(FX.Win_Name, 'FX Devices Gain Reduction') - if tab then - for i, v in ipairs(tab) do - r.gmem_attach('CompReductionScope') - r.gmem_write(2001, v - 1) - end - end - end - - CompareFXCount = Sel_Track_FX_Count - end - - - r.ImGui_PopStyleColor(ctx) - --[[ r.ImGui_PopStyleColor(ctx) -- For Menu Bar Color - r.ImGui_PopStyleColor(ctx) -- For WindowBg ]] - - r.ImGui_PopStyleVar(ctx) --(Border Size for all fx devices) - r.ImGui_PopStyleVar(ctx) --StyleVar#1 (Child Frame for all FX Devices) - - r.ImGui_PopFont(ctx) - --r.ImGui_PopStyleColor(ctx,Clr.poptimes) - Track_Fetch_At_End = reaper.GetLastTouchedTrack() - TrkID_End = r.GetTrackGUID(Track_Fetch_At_End) - - FirstLoop = false - ProQ3.SpecWait = ProQ3.SpecWait + 1 - - - demo.PopStyle() - - --[[ HintPos = HintPost or r.ImGui_GetCursorPosY(ctx) - r.ImGui_SetCursorPosY(ctx, HintPos) ]] - if HintMessage then - r.ImGui_Text(ctx, ' !') - SL() - MyText(HintMessage, Font_Andale_Mono_13, 0xffffff88) - end - if not IsLBtnHeld then - DraggingFXs = {} - DraggingFXs_Idx = {} - end - end -- end for if LT_Track ~= nil - - - - - - r.ImGui_SetNextWindowSize(ctx, 500, 440, r.ImGui_Cond_FirstUseEver()) - if LT_Track then FXCountEndLoop = r.TrackFX_GetCount(LT_Track) end - r.ImGui_End(ctx) - end --end for Visible - - - if open then - reaper.defer(loop) - else --on script close - NumOfTotalTracks = r.GetNumTracks() - for T = 0, NumOfTotalTracks - 1, 1 do - local track = r.GetTrack(0, T) - local TrkID = r.GetTrackGUID(track) - for i, v in ipairs(MacroNums) do - if Trk[TrkID].Mod[i].Val ~= nil then - r.SetProjExtState(0, 'FX Devices', 'Macro' .. i .. 'Value of Track' .. TrkID, Trk[TrkID].Mod[i].Val) - end - end - end - end - Track_Fetch_At_End = reaper.GetLastTouchedTrack() - waitForGmem = waitForGmem + 1 -end --end for loop - -reaper.defer(loop) diff --git a/FX/BryanChi_FX Devices/FX Layout Plugin Scripts/Pro C 2.lua b/FX/BryanChi_FX Devices/FX Layout Plugin Scripts/Pro C 2.lua deleted file mode 100644 index f7cc6f6cd..000000000 --- a/FX/BryanChi_FX Devices/FX Layout Plugin Scripts/Pro C 2.lua +++ /dev/null @@ -1,543 +0,0 @@ --- @noindex - - - -local FX_Idx = PluginScript.FX_Idx -local FxGUID = PluginScript.Guid - ---------------------------------------------- ----------TITLE BAR AREA------------------ ---------------------------------------------- - -Rounding = 3 -r.ImGui_PushStyleVar(ctx, r.ImGui_StyleVar_FrameRounding(), Rounding) -if not FX[FXGUID[FX_Idx]].Collapse then - if not OverSampleValue then - _, OverSampleValue = r - .TrackFX_GetFormattedParamValue(LT_Track, FX_Idx, 40) - end - r.ImGui_SetNextItemWidth(ctx, 10) - r.ImGui_PushFont(ctx, Font_Andale_Mono_10) - MyText('Over:', nil, 0x818181ff) - - - r.ImGui_SameLine(ctx, 96, nil) - r.ImGui_SetNextItemWidth(ctx, 27) - local Oversampling_Options = { 'Off', '2x', '4x' } - local OS_V = { 0, 0.5, 1 } - AddCombo(ctx, LT_Track, FX_Idx, 'OverSample##', 40, Oversampling_Options, 18, - 'Pro C 2', FxGUID, Fx_P or 1, OS_V) - --r.ImGui_SameLine(ctx) - --AddDrag(ctx,'##'..12, Trk.Prm.V[F_Tp(12,FXGUID[FX_Idx])..TrkID] or '', Trk.Prm.V[F_Tp(12,FXGUID[FX_Idx])..TrkID] or 0, 0, 1, 12,FX_Idx, 34, 'style', 10) - - reaper.ImGui_PopFont(ctx) - r.ImGui_SameLine(ctx, ProC.Width - 25) - - SyncWetValues() - Wet.ActiveAny, Wet.Active, Wet.Val[FX_Idx] = Add_WetDryKnob(ctx, 'a', '', - Wet.Val[FX_Idx] or 0, 0, 1, FX_Idx) -end -r.ImGui_PopStyleVar(ctx) - - - - - ---------------------------------------------- ----------Body-------------------------------- ---------------------------------------------- - - - - - - - - - - - - - - - - - -if not FX[FXGUID[FX_Idx]].Collapse then - - - if Prm.InstAdded[PluginScript.Guid] ~= true and FX.Win_Name[FX_Idx]:find('Pro%-C 2') then - --- number in green represents FX Prm Index - StoreNewParam(FXGUID[FX_Idx], 'Knee', 3, FX_Idx, false, 'AddingFromExtState', - 1, FX_Idx) --1. Knee - StoreNewParam(FXGUID[FX_Idx], 'Range', 4, FX_Idx, false, 'AddingFromExtState', - 2, FX_Idx) --2. Range - StoreNewParam(FXGUID[FX_Idx], 'Lookahead', 8, FX_Idx, false, - 'AddingFromExtState', 3, FX_Idx) --3. Lookahead - StoreNewParam(FXGUID[FX_Idx], 'Hold', 9, FX_Idx, false, 'AddingFromExtState', - 4, FX_Idx) --4. Hold - - StoreNewParam(FXGUID[FX_Idx], 'Ratio', 2, FX_Idx, false, 'AddingFromExtState', - 5, FX_Idx) --5. Ratio - StoreNewParam(FXGUID[FX_Idx], 'Attack', 5, FX_Idx, false, - 'AddingFromExtState', 6, FX_Idx) --6. Attack - StoreNewParam(FXGUID[FX_Idx], 'Release', 6, FX_Idx, false, - 'AddingFromExtState', 7, FX_Idx) --7. release - - StoreNewParam(FXGUID[FX_Idx], 'Gain', 10, FX_Idx, false, 'AddingFromExtState', - 8, FX_Idx) --8. Gain - StoreNewParam(FXGUID[FX_Idx], 'Dry', 12, FX_Idx, false, 'AddingFromExtState', - 9, FX_Idx) --9. Dry Gain - StoreNewParam(FXGUID[FX_Idx], 'Thresh', 1, FX_Idx, false, - 'AddingFromExtState', 10, FX_Idx) -- 10. Thresh - - StoreNewParam(FXGUID[FX_Idx], 'Mix', 34, FX_Idx, false, 'AddingFromExtState', - 11, FX_Idx) -- 11. Mix - StoreNewParam(FXGUID[FX_Idx], 'Input Gain', 35, FX_Idx, false, - 'AddingFromExtState', 12, FX_Idx) -- 12. Input Gain - StoreNewParam(FXGUID[FX_Idx], 'Output Gain', 37, FX_Idx, false, - 'AddingFromExtState', 13, FX_Idx) -- 13. Output Gain - - - - Prm.InstAdded[FXGUID[FX_Idx]] = true - r.SetProjExtState(0, 'FX Devices', 'FX' .. FXGUID[FX_Idx] .. 'Params Added', - 'true') - end - function F_Tp(FX_P) - return FX.Prm.ToTrkPrm[FxGUID .. FX_P] - end - - if FX[PluginScript.Guid][1].Num and FX[PluginScript.Guid][8] then - r.ImGui_Indent(ctx, 20) - - Rounding = 3 - r.ImGui_PushStyleVar(ctx, r.ImGui_StyleVar_FrameRounding(), Rounding) - r.ImGui_PushStyleVar(ctx, r.ImGui_StyleVar_GrabMinSize(), 0) - r.ImGui_PushFont(ctx, Font_Andale_Mono_10) - IIS = 2 - reaper.gmem_attach('CompReductionScope') - local SpX, SpY = r.ImGui_GetCursorScreenPos(ctx) - local SpY = SpY - 9; local C = SpY + 50; local B = SpY + 100 - - local Drawlist = r.ImGui_GetWindowDrawList(ctx) - DspScale = { 2, 4, 6 }; --2=3dB, 4=6dB, 6=9dB, 8=12dB - -- - if Sel_Scale == 1 then - ScaleLbl = '± 3dB' - elseif Sel_Scale == 2 then - ScaleLbl = '± 6dB' - elseif Sel_Scale == 3 then - ScaleLbl = '± 9dB' - end - - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_FrameBg(), 0x444444ff) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_Text(), 0xffffffff) - r.ImGui_SetNextItemWidth(ctx, 30) - if r.ImGui_BeginCombo(ctx, '##' .. tostring(Label), ScaleLbl, r.ImGui_ComboFlags_NoArrowButton()) then - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_Header(), 0x44444433) - local AccentClr = reaper.ImGui_GetColor(ctx, - reaper.ImGui_Col_SliderGrabActive()) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_HeaderHovered(), AccentClr) - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_Text(), 0xbbbbbbff) - - - if r.ImGui_Selectable(ctx, '± 3dB', i) then - Sel_Scale = 1 - end - if r.ImGui_Selectable(ctx, '± 6dB', i) then - Sel_Scale = 2 - end - if r.ImGui_Selectable(ctx, '± 9dB', i) then - Sel_Scale = 3 - end - - - - r.ImGui_PopStyleColor(ctx, 3) - - ScaleActive = true - r.ImGui_EndCombo(ctx) - local L, T = r.ImGui_GetItemRectMin(ctx); local R, B = r - .ImGui_GetItemRectMax(ctx) - local lineheight = reaper.ImGui_GetTextLineHeight(ctx) - local drawlist = r.ImGui_GetForegroundDrawList(ctx) - - r.ImGui_DrawList_AddRectFilled(drawlist, L, T + lineheight / 8, R, - B - lineheight / 8, 0x88888844, Rounding) - r.ImGui_DrawList_AddRect(drawlist, L, T + lineheight / 8, R, - B - lineheight / 8, 0x88888877, Rounding) - else - ScaleActive = nil - end - r.ImGui_PopStyleColor(ctx, 2) - local HvrOnScale = r.ImGui_IsItemHovered(ctx) - - if not Sel_Scale then Sel_Scale = 3 end - - if LT_ParamNum == 41 then - Lookahead = r.TrackFX_GetParamNormalized(LT_Track, - FX_Idx, 41) - end - - - - MousePosX, MousePosY = r.ImGui_GetMousePos(ctx) - - - - - - r.ImGui_SameLine(ctx) - - ---Gain Reduction Spectrum------ - for i = 1, 180, 1 do -- do once for each pixel - local Clr = 0xFF8181cc - ProC.Pt.L.m[i] = r.gmem_read(i) - ProC.Pt.L.M[i] = r.gmem_read(i + 200 + 10000 * FX_Idx) - - ProC.Pt.L.M[i + 1] = r.gmem_read(i + 201 + 10000 * FX_Idx) - local Min = ProC.Pt.L.m[i] - local Max = (ProC.Pt.L.M[i] - 347) / DspScale[Sel_Scale] + 50 - local MaxNext = (ProC.Pt.L.M[i + 1] - 347) / DspScale[Sel_Scale] + 50 - - - - - --r.ImGui_DrawList_AddLine(Drawlist, SpX+i, math.min(math.max(B-Max,SpY),B)+1 , SpX+i-1, math.min(math.max(B-Max,SpY),B), Clr,2) - r.ImGui_DrawList_AddLine(Drawlist, SpX + i, - math.min(math.max(B - Max, SpY), B), SpX + i + 1, - math.min(math.max(B - MaxNext, SpY), B), 0xFF8181cc, 2) - if B - Max <= SpY or B - Max >= B then - r.ImGui_DrawList_AddLine(Drawlist, SpX + i, - math.min(math.max(B - Max, SpY), B), SpX + i + 1, - math.min(math.max(B - MaxNext, SpY), B), 0xff4517cc, 2) - end - end - - - - -- Change Display scale if mouseclick on spectrum - - MouseX, MouseY = r.ImGui_GetMousePos(ctx) - - if MouseX > SpX and MouseX < SpX + 180 and MouseY > SpY and MouseY < SpY + 100 and not HvrOnScale and not ScaleActive then - r.ImGui_DrawList_AddRectFilled(Drawlist, SpX, SpY, SpX + 180, SpY + 100, - 0x88888810, nil) - local AnyActive = reaper.ImGui_IsAnyItemActive(ctx) - - if IsLBtnClicked and AnyActive == false and not ProC.ChoosingStyle then - r.ImGui_DrawList_AddRectFilled(Drawlist, SpX, SpY, SpX + 180, SpY + - 100, 0x88888866, nil) - ShowDpRange = true - TimeNow = r.time_precise() - Sel_Scale = math.max(Sel_Scale - 1, 1) - end - if IsRBtnClicked then - r.ImGui_DrawList_AddRectFilled(Drawlist, SpX, SpY, SpX + 180, SpY + - 100, 0x88888866, nil) - ShowDpRange = true - TimeNow = r.time_precise() - Sel_Scale = math.min(Sel_Scale + 1, 3) - end - - - if Wheel_V ~= 0 then - HoverOnScrollItem = true - r.ImGui_SetScrollX(ctx, 0) - local OV = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx + 1, 0) - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx + 1, 0, OV + Wheel_V / - 50) - TimeNow = r.time_precise() - FX[FxGUID].ShowMsecRange = true - FX[FxGUID].MsecRange = tonumber(select(2, - r.TrackFX_GetFormattedParamValue(LT_Track, FX_Idx + 1, 0))) - if FX[FxGUID].MsecRange then - if FX[FxGUID].MsecRange > 999 then - FX[FxGUID].MsecRange = round((FX[FxGUID].MsecRange / 1000), 2) .. - 's' - else - FX[FxGUID].MsecRange = math.floor(FX[FxGUID].MsecRange) .. - 'ms' - end - end - end - end - if ShowDpRange then - TimeAfter = r.time_precise() - if TimeAfter < TimeNow + 0.5 then - r.ImGui_DrawList_AddTextEx(Drawlist, Font_Andale_Mono_20_B, 20, - SpX + 90, SpY + 40, 0xffffffff, '±' .. Sel_Scale * 3) - else - ShowDpRange = false - end - elseif FX[FxGUID].ShowMsecRange then - TimeAfter = r.time_precise() - if TimeAfter < TimeNow + 0.5 then - r.ImGui_DrawList_AddTextEx(Drawlist, Font_Andale_Mono_20_B, 20, - SpX + 70, SpY + 40, 0xffffffff, FX[FxGUID].MsecRange) - else - FX[FxGUID].ShowMsecRange = false - end - end - - - -- Draw Grid - r.ImGui_DrawList_AddLine(Drawlist, SpX, SpY + 95, SpX + 180, SpY + 95, - 0x99999955, 1) --- -3dB - r.ImGui_DrawList_AddText(Drawlist, SpX + 185, SpY + 90, 0x999999bb, - '-' .. 3 * Sel_Scale) - r.ImGui_DrawList_AddLine(Drawlist, SpX, SpY + 72, SpX + 180, SpY + 72, - 0x99999933, 1) --- -1.5dB - r.ImGui_DrawList_AddText(Drawlist, SpX + 185, SpY + 70, 0x999999aa, - '-' .. 1.5 * Sel_Scale) - - r.ImGui_DrawList_AddLine(Drawlist, SpX, SpY + 50, SpX + 180, SpY + 50, - 0x99999955, 1) --- 0dB - r.ImGui_DrawList_AddText(Drawlist, SpX + 185, SpY + 45, 0x999999bb, ' 0') - - r.ImGui_DrawList_AddLine(Drawlist, SpX, SpY + 27, SpX + 180, SpY + 27, - 0x99999933, 1) --- -1.5dB - r.ImGui_DrawList_AddText(Drawlist, SpX + 185, SpY + 20, 0x999999aa, - '+' .. 1.5 * Sel_Scale) - - r.ImGui_DrawList_AddLine(Drawlist, SpX, SpY + 4, SpX + 180, SpY + 4, - 0x99999955, 1) --- +3dB - r.ImGui_DrawList_AddText(Drawlist, SpX + 185, SpY - 5, 0x999999bb, - '+' .. 3 * Sel_Scale) - - -- r.ImGui_DrawList_PathStroke(Drawlist,0xFF8181cc) - - - r.ImGui_SameLine(ctx) - - - - local Fx_P = 1 - --for i=1, 13, 1 do FX[FxGUID][i]=FX[FxGUID][i] or {} end - - - reaper.ImGui_Indent(ctx, 210) - AddKnob(ctx, '##Gain', 'Gain', FX[FxGUID][8].V or 0, 0, 1, 8, FX_Idx, 10, - 'Pro C', 15, IIS, Disabled, LblTextSize, 'Bottom') - AddKnob(ctx, '##Dry', 'Dry', FX[FxGUID][9].V or 0, 0, 1, 9, FX_Idx, 12, - 'Pro C', 15, IIS, Disabled, LblTextSize, 'Bottom') - local OrigPosX, OrigPosY = r.ImGui_GetCursorPos(ctx) - r.ImGui_SetCursorScreenPos(ctx, SpX - 20, SpY + 20) - AddSlider(ctx, '##Threshold', ' ', FX[FxGUID][10].V or 0, 0, 1, 10, FX_Idx, 1, - 'Pro C Thresh', 18, IIS, nil, 'Vert', 4, nil, nil, 180) - r.ImGui_SetCursorPos(ctx, OrigPosX, OrigPosY) - - ---Meter on the right----- - r.gmem_attach('CompReductionScope') - - local MtrPreL = r.gmem_read(1002); if not MtrPreL then MtrPreL = 0 end - local MtrPreR = r.gmem_read(1003); if not MtrPreR then MtrPreR = 0 end - local MtrPoL = r.gmem_read(1001); if not MtrPoL then MtrPoL = 0 end - local MtrPoR = r.gmem_read(1000); if not MtrPoR then MtrPoR = 0 end - local MtrB = SpY + 190; local MtrT = SpY + 20 - local SegL = 0 * ((MtrB - MtrT) / 30) - local MtrW = 5; - - --r.ImGui_DrawList_AddRectFilled(Drawlist, SpX+249, MtrT, SpX+267, MtrB , 0x55555544) - - local HowManySeg = 63 - for i = 0, HowManySeg, 1 do --do once for every pixel so you can get different color - local SegL = i * ((MtrB - MtrT) / HowManySeg); local Clr - - local RR, GG, BB = r.ImGui_ColorConvertHSVtoRGB(0.4 - (0.3 / HowManySeg) * i, 0.6, 0.5) - local MtrClr = r.ImGui_ColorConvertDouble4ToU32(RR, GG, BB, 1) - local MtrClrDim = r.ImGui_ColorConvertDouble4ToU32(RR, GG, BB, 0.4) - - if MtrT - (20 * MtrPreL) < MtrB - SegL then - r.ImGui_DrawList_AddLine( - Drawlist, SpX - 15, MtrB - SegL, SpX - 15, MtrB - SegL - 1, - MtrClr, - MtrW) - end - if MtrT - (20 * MtrPreR) < MtrB - SegL then - r.ImGui_DrawList_AddLine( - Drawlist, SpX - 15 + MtrW + 2, MtrB - SegL, SpX - 15 + MtrW + 2, - MtrB - SegL - 1, MtrClr, MtrW) - end - if MtrT - (20 * MtrPoL) < MtrB - SegL then - r.ImGui_DrawList_AddLine( - Drawlist, SpX + 250, MtrB - SegL, SpX + 250, MtrB - SegL - 1, - MtrClr, - MtrW) - end - if MtrT - (20 * MtrPoR) < MtrB - SegL then - r.ImGui_DrawList_AddLine( - Drawlist, SpX + 250 + MtrW + 2, MtrB - SegL, SpX + 250 + MtrW + 2, - MtrB - SegL - 1, MtrClr, MtrW) - end - - r.ImGui_DrawList_AddLine(Drawlist, SpX - 15, MtrB - SegL, SpX - 15, - MtrB - SegL - 1, MtrClrDim, MtrW) - r.ImGui_DrawList_AddLine(Drawlist, SpX - 15 + MtrW + 2, MtrB - SegL, - SpX - 15 + MtrW + 2, MtrB - SegL - 1, MtrClrDim, MtrW) - r.ImGui_DrawList_AddLine(Drawlist, SpX + 250, MtrB - SegL, SpX + 250, - MtrB - SegL - 1, MtrClrDim, MtrW) - r.ImGui_DrawList_AddLine(Drawlist, SpX + 250 + MtrW + 2, MtrB - SegL, - SpX + 250 + MtrW + 2, MtrB - SegL - 1, MtrClrDim, MtrW) - end - - if MtrPreL > 0 then - PreLPeak = true; PlayStateWhenPeak = r.GetPlayState() - end - if MtrPreR > 0 then - PreRPeak = true; PlayStateWhenPeak = r.GetPlayState() - end - if MtrPoL > 0 then - PoLPeak = true; PlayStateWhenPeak = r.GetPlayState() - end - if MtrPoR > 0 then - PoRPeak = true; PlayStateWhenPeak = r.GetPlayState() - end - - if PreLPeak then - r.ImGui_DrawList_AddRectFilled(Drawlist, SpX - 16, MtrT - 2, - SpX - 13, MtrT + 3, 0xf20000ff) - end - if PreRPeak then - r.ImGui_DrawList_AddRectFilled(Drawlist, SpX + 250 + MtrW + - 2, MtrT - 2, SpX + 250 + MtrW + 5, MtrT + 3, 0xf20000ff) - end - if PoLPeak then - r.ImGui_DrawList_AddRectFilled(Drawlist, SpX + 250 + MtrW * 3 + - 12, MtrT - 2, SpX + 250 + MtrW * 3 + 15, MtrT + 3, 0xf20000ff) - end - if PoRPeak then - r.ImGui_DrawList_AddRectFilled(Drawlist, SpX + 250 + MtrW * 4 + - 14, MtrT - 2, SpX + 250 + MtrW * 4 + 17, MtrT + 3, 0xf20000ff) - end - - - - if PreLPeak or PreRPeak or PoLPeak or PoRPeak then - if r.GetPlayState() == 0 then StoppedPlyaing = true end - if StoppedPlyaing and r.GetPlayState() ~= 0 then - PreLPeak = nil; PreRPeak = nil; PoLPeak = nil; PoRPeak = nil; StoppedPlyaing = nil; - end - end - -------- End of Meter - - - - - - r.ImGui_Unindent(ctx, 210) - reaper.ImGui_Indent(ctx, 5) - - - AddKnob(ctx, '##Ratio', 'RATIO', FX[FxGUID][5].V or 0, 0, 1, 5, FX_Idx, 2, - 'Pro C', 20, IIS, 'Pro C Ratio Disabled', LblTextSize, 'Bottom') - local KneePosX, KneePosY = r.ImGui_GetCursorPos(ctx) - - r.ImGui_SameLine(ctx) - local X, Y = r.ImGui_GetCursorPos(ctx) - - StyleOptions = { 'Clean', 'Classic', 'Opto', 'Vocal', 'Master', 'Bus', - 'Punch', 'Pump' } - r.ImGui_SetCursorPos(ctx, X + 25, Y + 15) - - AddCombo(ctx, LT_Track, FX_Idx, 'CompStyle##', 0, StyleOptions, 40, 'Pro C 2', - FxGUID, Fx_P) - r.ImGui_SetCursorPos(ctx, X + 25, Y + 35) - - MyText('STYLE', nil, 0xbbbbbbff) - - - r.ImGui_SetCursorPos(ctx, X + 90, Y) - - - AddKnob(ctx, 'Attack##Attack', 'Attack', FX[FxGUID][6].V or 0, 0, 1, 6, - FX_Idx, 5, 'Pro C', 20, IIS, Disabled, LblTextSize, 'Bottom') - - - r.ImGui_SetCursorPos(ctx, X + 145, Y) - AddKnob(ctx, '##Release', 'Release', FX[FxGUID][7].V or 0, 0, 1, 7, FX_Idx, 6, - 'Pro C', 20, IIS, Disabled, 2, 'Bottom') - - - - r.ImGui_SetCursorPos(ctx, KneePosX - 3, KneePosY + 4) - for Fx_p = 1, 4, 1 do - r.ImGui_SetCursorPosY(ctx, KneePosY + 4) - local F_Tp = FX.Prm.ToTrkPrm[FxGUID .. Fx_p] - local P_Num = FX[FxGUID][Fx_p].Num - SliderStyle = 'Pro C' - if FX[FxGUID][Fx_P].V == nil then - FX[FxGUID][Fx_P].V = r - .TrackFX_GetParamNormalized(LT_Track, FX_Idx, P_Num) - end - - if P_Num == 8 then - if Lookahead == 0 then - AddDrag(ctx, '##' .. Fx_p, FX[FxGUID][3].Name, - FX[FxGUID][Fx_p].V or 0, 0, 1, Fx_p, FX_Idx, P_Num, - 'Pro C Lookahead', (ProC.Width - 60) / 4, IIS, 'Disabled', - 'Lbl_Clickable') - else - AddDrag(ctx, '##' .. Fx_p, FX[FxGUID][3].Name, - FX[FxGUID][Fx_p].V or 0, 0, 1, Fx_p, FX_Idx, P_Num, - 'Pro C Lookahead', (ProC.Width - 60) / 4, IIS, nil, - 'Lbl_Clickable') - end - else - AddDrag(ctx, '##' .. Fx_p, FX[FxGUID][Fx_p].Name, - FX[FxGUID][Fx_p].V or 0, 0, 1, Fx_p, FX_Idx, P_Num, 'Pro C', - (ProC.Width - 60) / 4, IIS, nil) - --r.ImGui_SameLine(ctx) - end - r.ImGui_SameLine(ctx) - end - r.ImGui_PopFont(ctx) - r.ImGui_PopStyleVar(ctx, 2) - - - if not FX.Win_Name[math.max(FX_Idx - 1, 0)]:find('JS: FXD Split to 4 channels') and not tablefind(Trk[TrkID].PreFX, FxGUID) and not tablefind(Trk[TrkID].PostFX, FxGUID) then - table.insert(AddFX.Pos, FX_Idx) - table.insert(AddFX.Name, 'FXD Split to 4 channels') - if r.GetMediaTrackInfo_Value(LT_Track, 'I_NCHAN') < 4 then - rv = r.SetMediaTrackInfo_Value(LT_Track, 'I_NCHAN', 4) - end - else - r.TrackFX_Show(LT_Track, FX_Idx - 1, 2) - end - -- r.TrackFX_Show( LT_Track, FX_Idx-1, 2 ) --hide fx window - - local _, NextFX = r.TrackFX_GetFXName(LT_Track, FX_Idx + 1) - - if not NextFX:find('JS: FXD Gain Reduction Scope') and not tablefind(Trk[TrkID].PreFX, FxGUID) and not tablefind(Trk[TrkID].PostFX, FxGUID) then - table.insert(AddFX.Pos, FX_Idx + 1) - table.insert(AddFX.Name, 'FXD Gain Reduction Scope') - ProC.GainSc_FXGUID = FxGUID - - function WriteGmemToGainReductionScope(FxGUID) - - end - - if not GainReductionWait then GainReductionWait = 0 end - GainReductionWait = GainReductionWait + 1 - --[[ if GainReductionWait> FX_Add_Del_WaitTime then - FX[FxGUID] = FX[FxGUID] or {} - FX[FxGUID].ProC_ID = math.random(1000000, 9999999 ) - r.gmem_attach('CompReductionScope') - r.gmem_write(2002, FX[FxGUID].ProC_ID) - r.gmem_write(FX[FxGUID].ProC_ID, FX_Idx) - r.gmem_write(2000, PM.DIY_TrkID[TrkID]) - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: ProC_ID '..FxGUID, FX[FxGUID].ProC_ID, true) - AddFX_HideWindow(LT_Track,'FXD Gain Reduction Scope.jsfx',-1000-FX_Idx-1) - - GainReductionWait = nil - end ]] - else - r.TrackFX_Show(LT_Track, FX_Idx + 1, 2) - SyncAnalyzerPinWithFX(FX_Idx + 1, FX_Idx) - end - end - r.gmem_attach('CompReductionScope'); r.gmem_write(2000, PM.DIY_TrkID[TrkID]) - - -end diff --git a/FX/BryanChi_FX Devices/FX Layout Plugin Scripts/Pro Q 3.lua b/FX/BryanChi_FX Devices/FX Layout Plugin Scripts/Pro Q 3.lua deleted file mode 100644 index 0bae28939..000000000 --- a/FX/BryanChi_FX Devices/FX Layout Plugin Scripts/Pro Q 3.lua +++ /dev/null @@ -1,1285 +0,0 @@ --- @noindex - -local FX_Idx = PluginScript.FX_Idx -local FxGUID = PluginScript.Guid - - - ---------------------------------------------- ----------TITLE BAR AREA------------------ ---------------------------------------------- - - - if BandColor == nil then BandColor = 0x69B45D55 end - _, _, color = determineBandColor(ProQ3.LT_EQBand[FXGUID[FX_Idx]]) - if color == nil then color = 0xffffffff end - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_Text(), color) - - if ProQ3.LT_EQBand[FXGUID[FX_Idx]] ~= nil then - Freq_LTBandNorm = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, - 13 * (ProQ3.LT_EQBand[FXGUID[FX_Idx]] - 1) + 2) - Freq_LTBand = math.floor(x_to_freq(Freq_LTBandNorm * 340)) -- width - ProQ3['Freq_LTBand - ' .. FXGUID[FX_Idx]] = Freq_LTBand - local Gain = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, - 13 * (ProQ3.LT_EQBand[FXGUID[FX_Idx]] - 1) + 3) - --Gain = tonumber(Gain) - Gain = -30 + Gain * 60 - FreqValueDrag[FX_Idx] = Freq_LTBandNorm - if Gain ~= nil then - ProQ3['Gain_LTBand - ' .. FXGUID[FX_Idx]] = round(Gain, 1) - end - end - - - - r.ImGui_SetNextItemWidth(ctx, 60) - if ProQ3['Freq_LTBand - ' .. FXGUID[FX_Idx]] ~= nil and ProQ3['Freq_LTBand - ' .. FXGUID[FX_Idx]] < 1000 then - FreqLbl = ProQ3['Freq_LTBand - ' .. FXGUID[FX_Idx]] .. ' Hz' - elseif ProQ3['Freq_LTBand - ' .. FXGUID[FX_Idx]] ~= nil and ProQ3['Freq_LTBand - ' .. FXGUID[FX_Idx]] > 1000 then - FreqLbl = round(ProQ3['Freq_LTBand - ' .. FXGUID[FX_Idx]] / 1000, 2) .. - ' kHz' - end - if ProQ3['Freq_LTBand - ' .. FXGUID[FX_Idx]] ~= nil then - if Mods == Shift then - DragSpeed = 0.003 - else - DragSpeed = 0.008 - end - FreqDragging, FreqValueDrag[FX_Idx] = r.ImGui_DragDouble(ctx, '##FreqDrag', - FreqValueDrag[FX_Idx], DragSpeed, -1, 1, FreqLbl) - ProQ3.FreqDragging = r.ImGui_IsItemActive(ctx) - if FreqDragging then - -- r.TrackFX_SetParamNormalized(LT_Track,FX_Idx,13*(ProQ3.LT_EQBand[FXGUID[FX_Idx]]-1) +2,FreqValueDrag[FX_Idx] ) - end - end - - r.ImGui_SameLine(ctx) - r.ImGui_SetNextItemWidth(ctx, 60) - if ProQ3['Gain_LTBand - ' .. FXGUID[FX_Idx]] ~= nil then - _, ProQ3.GainDrag[FX_Idx] = r.ImGui_DragDouble(ctx, '##GainDrag', - ProQ3.GainDrag[FX_Idx] or 0, 0.01, 0, 1, - ProQ3['Gain_LTBand - ' .. FXGUID[FX_Idx]] .. 'dB') - ProQ3.GainDragging = r.ImGui_IsItemActive(ctx) - end - - r.ImGui_SameLine(ctx, 340 - 130) - r.ImGui_SetNextItemWidth(ctx, 50) - if ProQ3['scaleLabel' .. ' ID' .. FXGUID[FX_Idx]] ~= nil then - DispRangeBtnClicked = r.ImGui_Button(ctx, - '±' .. ProQ3['scaleLabel' .. ' ID' .. FXGUID[FX_Idx]] .. 'dB##' .. - FX_Idx, 50, 20) - end - if DispRangeBtnClicked then - r.ImGui_OpenPopup(ctx, 'ProQ Display Range ##' .. FX_Idx) - local L, T = r.ImGui_GetItemRectMin(ctx) - local W, H = r.ImGui_GetItemRectSize(ctx) - r.ImGui_SetNextWindowPos(ctx, L, T + H) - r.ImGui_SetNextWindowSize(ctx, W, H) - end - - if focusedFXState == 1 and FX_Index_FocusFX == FX_Idx and LT_ParamNum == 331 then - _, ProQ3.DspRange[FX_Idx] = r.TrackFX_GetFormattedParamValue(LT_Track, FX_Idx, - 331) - ProQ3.DspRange[FX_Idx] = ProQ3.DspRange[FX_Idx]:gsub('dB', '') - ProQ3.DspRange[FX_Idx] = tonumber(ProQ3.DspRange[FX_Idx]) - ProQ3['scaleLabel' .. ' ID' .. FXGUID[FX_Idx]] = ProQ3.DspRange[FX_Idx] - ProQ3['scale' .. ' ID' .. FXGUID[FX_Idx]] = syncProQ_DispRange(ProQ3 - .DspRange[FX_Idx]) - end - - - - if r.ImGui_BeginPopup(ctx, 'ProQ Display Range ##' .. FX_Idx) then - if r.ImGui_Selectable(ctx, '±30dB') then - ProQ3['scale' .. ' ID' .. FXGUID[FX_Idx]] = 1 - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, 331, 1) - r.ImGui_CloseCurrentPopup(ctx) - end - if r.ImGui_Selectable(ctx, '±12dB') then - ProQ3['scale' .. ' ID' .. FXGUID[FX_Idx]] = 2.5 - r.TrackFX_SetParam(LT_Track, FX_Idx, 331, 0.7) - r.ImGui_CloseCurrentPopup(ctx) - end - if r.ImGui_Selectable(ctx, '±6 dB') then - ProQ3['scale' .. ' ID' .. FXGUID[FX_Idx]] = 5 - r.TrackFX_SetParam(LT_Track, FX_Idx, 331, 0.3) - r.ImGui_CloseCurrentPopup(ctx) - end - if r.ImGui_Selectable(ctx, '±3 dB') then - ProQ3['scale' .. ' ID' .. FXGUID[FX_Idx]] = 10 - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, 331, 0) - r.ImGui_CloseCurrentPopup(ctx) - end - - reaper.ImGui_EndPopup(ctx) - end - if ProQ3['scale' .. ' ID' .. FXGUID[FX_Idx]] == 1 then - ProQ3['scaleLabel' .. ' ID' .. FXGUID[FX_Idx]] = 30 - elseif ProQ3['scale' .. ' ID' .. FXGUID[FX_Idx]] == 2.5 then - ProQ3['scaleLabel' .. ' ID' .. FXGUID[FX_Idx]] = 12 - elseif ProQ3['scale' .. ' ID' .. FXGUID[FX_Idx]] == 5 then - ProQ3['scaleLabel' .. ' ID' .. FXGUID[FX_Idx]] = 6 - elseif ProQ3['scale' .. ' ID' .. FXGUID[FX_Idx]] == 10 then - ProQ3['scaleLabel' .. ' ID' .. FXGUID[FX_Idx]] = 3 - else - ProQ3['scaleLabel' .. ' ID' .. FXGUID[FX_Idx]] = 12 - end - - SL(340-60) - -- Wet.ActiveAny, Wet.Active, Wet.Val[FX_Idx] = Add_WetDryKnob(ctx, 'a', '',Wet.Val[FX_Idx] or 0, 0, 1, FX_Idx, 314) - local GainScale = r.TrackFX_GetParamNormalized(LT_Track,FX_Idx, 314) - FX.Round[FxGUID] = 100 - - - Rounding = 10 - r.ImGui_PushStyleVar(ctx, r.ImGui_StyleVar_FrameRounding(), Rounding) - AddDrag(ctx, '##GainScale'..FxGUID, '', GainScale, 0, 1, 0--[[FX_P]] , FX_Idx, 314, 'Pro C', 60, - item_inner_spacing, Disable, Lbl_Clickable, Lbl_Pos, V_Pos, DragDir, AllowInput) - - if r.ImGui_IsItemActivated(ctx) and r.ImGui_IsMouseDoubleClicked(ctx,0) then - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx,314, 0.5) - end - r.ImGui_PopStyleVar(ctx) - - r.ImGui_PopStyleColor(ctx) - - - - - - - - - - - - - - - - ---------------------------------------------- ----------Body-------------------------------- ---------------------------------------------- - - - - - - - - - - - - - - - -if not FX[FxGUID].Collapse then - - - - - - - - - - r.gmem_attach('gmemReEQ_Spectrum') - - - - - if FirstLoop == true then - _, ProQ3.DspRange[FX_Idx] = r.TrackFX_GetFormattedParamValue(LT_Track, FX_Idx, - 331) - ProQ3['scaleLabel' .. ' ID' .. FXGUID[FX_Idx]] = ProQ3.DspRange[FX_Idx] - ProQ3['scale' .. ' ID' .. FXGUID[FX_Idx]] = syncProQ_DispRange(ProQ3 - .DspRange[FX_Idx]) - end - - _, ProQ3.Format = r.TrackFX_GetNamedConfigParm(LT_Track, FX_Idx, 'fx_type') - - r.ImGui_PushStyleColor(ctx, r.ImGui_Col_FrameBg(), 0x090909ff) - - ProQ3.H = 200 - - r.ImGui_SetNextWindowPos(ctx, ProQ_TitlePosX_L, ProQ_TitlePosY_B) - - - if r.ImGui_BeginChildFrame(ctx, '##EQ Spectrum' .. FX_Idx, ProQ3.Width, ProQ3.H, nil) then - if ProQ3['scale' .. ' ID' .. FXGUID[FX_Idx]] == nil then ProQ3['scale' .. ' ID' .. FXGUID[FX_Idx]] = 2.5 end - if ProQ3['scale' .. ' ID' .. FXGUID[FX_Idx]] == 10 then - ProQ3['DragGainScale' .. ' ID' .. FXGUID[FX_Idx]] = 100 - elseif ProQ3['scale' .. ' ID' .. FXGUID[FX_Idx]] == 5 then - ProQ3['DragGainScale' .. ' ID' .. FXGUID[FX_Idx]] = 20 - elseif ProQ3['scale' .. ' ID' .. FXGUID[FX_Idx]] == 2.5 then - ProQ3['DragGainScale' .. ' ID' .. FXGUID[FX_Idx]] = 5 - elseif ProQ3['scale' .. ' ID' .. FXGUID[FX_Idx]] == 1 then - ProQ3['DragGainScale' .. ' ID' .. FXGUID[FX_Idx]] = 1 - end - -- 10 = 3dB | 5 = 6dB | 2.5 = 12 dB | 1 = 30 dB - - --DragGain - ---THIS SETS THE SCALE - --- Need to also scale nodes dragging - local ShelfGain_Node = 0 - local Q_Node = {} - local E = 2.71828182845904523 - ProQ_Xpos_L, ProQ_Ypos_T = reaper.ImGui_GetItemRectMin(ctx) - ProQ_Xpos_R, ProQ_Ypos_B = reaper.ImGui_GetItemRectMax(ctx) - --ProQ_Ypos_B= ProQ_Ypos_T+340 - local B = ProQ_Ypos_B + 340 - floor = -80; ly = 0; lx = -1; - - sc = (ProQ3.Width - 20) * 20 / - (floor * math.log(10)) -- 200 = width of window - Foreground = r.ImGui_GetWindowDrawList(ctx) - SpectrumX = 0 - SpectrumY = 0 - r.gmem_attach('gmemReEQ_Spectrum') - if FX[FxGUID].ProQ_ID then - r.gmem_write(FX[FxGUID].ProQ_ID, FX_Idx) - end - - ----Get spectrum info - -- attach a DIYFXGUID to each PRO Q and use that for spectrums - if TrkID ~= TrkID_End then - for i = 2, 249, 1 do - r.gmem_write(i + ((FX_Idx + 1) * 1000), 0) - r.gmem_write(i + 300 + ((FX_Idx + 1) * 1000), 0) - end - end - - - for i = 2, 249, 1 do - BinY = r.gmem_read(i + ((FX_Idx + 1) * 1000)) - tx = r.gmem_read(i + 300 + ((FX_Idx + 1) * 1000)) - - - - - tx = freq_to_x_MyOwn(tx) - - ty = spectrum1_to_y(BinY) - ty = ProQ_Ypos_T + ty - - tx = tx + ProQ_Xpos_L - if lx == nil then lx = tx end - - tx = round(tx, 0) - - - if lx ~= tx and i ~= 2 then - r.ImGui_DrawList_AddQuadFilled(Foreground, lx, B, lx, ly, tx, ty, tx, - B, 0x003535ff) - elseif i == 2 then - r.ImGui_DrawList_AddQuadFilled(Foreground, lx, B, lx, ty, tx, ty, tx, - B, 0x003535ff) - end - - lx = tx; ly = ty; - end - - - - Freq = {} - Gain = {} - Q = {} - Slope = {} - Band_Used = {} - pts = {} - - local Band_Enabled = {} - local Y_Mid = ProQ_Ypos_B + ProQ3.H / 2 - local y = Y_Mid - - - FXGUID_ProQ = r.TrackFX_GetFXGUID(LT_Track, FX_Idx) - - for Band = 1, 24, 1 do - paramOfUsed = 13 * (Band - 1) - paramOfEnabled = 13 * (Band - 1) + 1 - if FXGUID_ProQ == nil then FXGUID_ProQ = 0 end - ProQ3.Band_UseState[Band] = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, - paramOfUsed) - Band_Enabled[Band .. FXGUID_ProQ] = r.TrackFX_GetParamNormalized( - LT_Track, FX_Idx, paramOfEnabled) - local x = ProQ_Xpos_L - local y = Y_Mid - if ProQ3.Band_UseState[Band] == 1 then - Freq[Band] = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, - paramOfUsed + 2) - Slope[Band] = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, - 9 + 13 * (Band - 1)) - Gain[Band] = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, - paramOfUsed + 3) - _, ProQ3['Shape of Band' .. Band .. 'ID' .. FXGUID_ProQ] = r - .TrackFX_GetFormattedParamValue(LT_Track, FX_Idx, paramOfUsed + 8) - NodeFreq['B-' .. Band .. 'GUID-' .. FXGUID_ProQ] = x_to_freq(Freq - [Band] * ProQ3.Width) - if ProQ3['Shape of Band' .. Band .. 'ID' .. FXGUID_ProQ] == 'Low Shelf' or ProQ3['Shape of Band' .. Band .. 'ID' .. FXGUID_ProQ] == 'High Shelf' then - Gain[Band] = -30 + Gain[Band] * 60 - ShelfGain_Node = Gain[Band] * 1.3 - - - Gain[Band] = db_to_gain(Gain[Band]) - else - Gain[Band] = -30 + Gain[Band] * 60 - end - FreqToActualFreq = x_to_freq((Freq[Band] * ProQ3.Width)) - - - - if ProQ3.Format == 'AU' then - Q[Band] = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, - paramOfUsed + 7) - else - if ProQ3['Shape of Band' .. Band .. 'ID' .. FXGUID_ProQ] == 'Low Cut' or ProQ3['Shape of Band' .. Band .. 'ID' .. FXGUID_ProQ] == 'High Cut' then - _, Q[Band] = r.TrackFX_GetFormattedParamValue(LT_Track, - FX_Idx, paramOfUsed + 7) - else - Q[Band] = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, - paramOfUsed + 7) - end - end - - Q_Node[Band] = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, - paramOfUsed + 7) - Q_Node[Band] = (-1 + Q_Node[Band] * 2) * 50 - - if Q_Node[Band] > 37 then - Q_Node[Band] = 37 - elseif Q_Node[Band] < -37 then - Q_Node[Band] = -37 - end - end - - function FillClr_LT_Band(iteration, y1) - if ProQ3.LT_EQBand[FXGUID_ProQ] == Band then - X2 = x + 2 - BandColor = determineBandColor(ProQ3.LT_EQBand[FXGUID_ProQ]) - i = iteration - if i ~= 1 then - r.ImGui_DrawList_AddLine(Foreground, x, y1, X2, - Y_Mid - pts[i .. 'B-' .. Band .. FXGUID_ProQ], BandColor, - 1.7) - end - x = X2 - end - end - - function TiltShelf(Minimum_Q, Maximum_Q, Q_range, Q_Value) - Min_Q = Minimum_Q - Max_Q = Maximum_Q - Q[Band] = per_to_q(Q[Band] * Q_range, 100) - --local Gain = db_to_gain(Gain[Band] ) - local gain = Gain[Band] - if Q_Value ~= nil then Q[Band] = Q_Value end - - svf_st(FreqToActualFreq, Q[Band], gain) - - local x = ProQ_Xpos_L - local y = Y_Mid - if Band_Enabled[Band .. FXGUID_ProQ] == 1 then - for i = 1, ProQ3.Width, 1 do -- do 340 times - iToFreq = x_to_freq(i) - mag = zdf_magnitude(iToFreq) - mag = 20 * math.log(mag, 10) - mag = db_to_y(mag) - pts[i .. 'B-' .. Band .. FXGUID_ProQ] = mag - end - end - - --[[ local Gain2 = 10^(-(gain) / 21); - local Gain2 = 1 ]] - - local x = ProQ_Xpos_L - local y = Y_Mid - if Band_Enabled[Band .. FXGUID_ProQ] == 1 then - for i = 1, ProQ3.Width, 2 do -- do 340 times - iToFreq = x_to_freq(i) - mag = zdf_magnitude(iToFreq) - mag = 20 * math.log(mag, 10) - mag = db_to_y(mag) - pts[i .. 'B-' .. Band .. FXGUID_ProQ] = ((pts[i .. 'B-' .. Band .. FXGUID_ProQ] + mag) / 2) * - ProQ3['scale' .. ' ID' .. FXGUID[FX_Idx]] - FillClr_LT_Band(i, y) - if ProQ3.LT_EQBand[FXGUID_ProQ] == Band then - X2 = x + 2 - BandColor = determineBandColor(ProQ3.LT_EQBand - [FXGUID_ProQ]) - if i ~= 1 then - r.ImGui_DrawList_AddLine(Foreground, x, - Y_Mid, X2, Y_Mid - - pts[i .. 'B-' .. Band .. FXGUID_ProQ], BandColor, - 1.7) - end - x = X2 - end - end - end - end - - --------------------- - -- BELL - --------------------- - if ProQ3.Band_UseState[Band] == 1.0 and ProQ3['Shape of Band' .. Band .. 'ID' .. FXGUID_ProQ] == 'Bell' then - Freq_Math = Freq[Band] * ProQ3.Width - Gain_Math = (Gain[Band] * (ProQ3.H / 2)) / 30 - - if Band_Enabled[Band .. FXGUID_ProQ] == 1 then - for i = 1, ProQ3.Width, 2 do - local xscale = 800 / - (ProQ3.Width - 4); - Q_Math = ((Q[Band] ^ 3.2) * 0.55) / - 2 + 0.005 - pts[i .. 'B-' .. Band .. FXGUID_ProQ] = (Gain_Math * Euler ^ -(Q_Math * (i - Freq_Math)) ^ 2) * - ProQ3['scale' .. ' ID' .. FXGUID[FX_Idx]] - - FillClr_LT_Band(i, Y_Mid) - - end - - reaper.ImGui_DrawList_PathFillConvex(Foreground, 0xffffffff) - end - elseif ProQ3.Band_UseState[Band] == 1.0 and ProQ3['Shape of Band' .. Band .. 'ID' .. FXGUID_ProQ] == 'High Cut' then - if Slope[Band] < 0.2 then - MIN_Q = 0.1; MAX_Q = 200 - elseif Slope[Band] > 0.2 and Slope[Band] < 0.3 then - MIN_Q = 0.1; MAX_Q = 120 - elseif Slope[Band] > 0.3 and Slope[Band] < 0.4 then - MIN_Q = 0.1; MAX_Q = 40 - elseif Slope[Band] > 0.4 and Slope[Band] < 0.5 then - MIN_Q = 0.1; MAX_Q = 21 - elseif Slope[Band] > 0.5 and Slope[Band] < 0.6 then - MIN_Q = 0.26; MAX_Q = 7 - elseif Slope[Band] > 0.6 and Slope[Band] < 0.7 then - MIN_Q = 0.3; MAX_Q = 5 - elseif Slope[Band] > 0.7 and Slope[Band] < 0.8 then - MIN_Q = 0.5; MAX_Q = 2.6 - elseif Slope[Band] > 0.8 and Slope[Band] < 0.9 then - MIN_Q = 0.4; MAX_Q = 2.7 - elseif Slope[Band] == 1 then - MIN_Q = 0.7; MAX_Q = 0.7 - end - Slope_HighCut = Slope[Band] * 20 - - Q[Band] = Q[Band] * 100 - Q_HC = per_to_q(Q[Band], 100) - - if ProQ3.Format == 'VST' or ProQ3.Format == 'VST3' then - Q_HC = Q[Band] / 100 / 1.4 - else - end - - local x = ProQ_Xpos_L - local y = Y_Mid - - - zdf_lp(FreqToActualFreq, Q_HC, Slope_HighCut) - - for i = 1, ProQ3.Width, 2 do -- do 340 times - iToFreq = x_to_freq(i) - local mag = zdf_magnitude(iToFreq) - - mag = 20 * math.log(mag, 10) - mag = db_to_y(mag) - - if Band_Enabled[Band .. FXGUID_ProQ] == 1 then - if Slope[Band] ~= 1 then - pts[i .. 'B-' .. Band .. FXGUID_ProQ] = mag * - ProQ3['scale' .. ' ID' .. FXGUID[FX_Idx]] - elseif Slope[Band] == 1 then --if Slope = brickwall - if iToFreq > FreqToActualFreq then - magForBrickwall = db_to_y(-100) - elseif iToFreq < FreqToActualFreq then - magForBrickwall = db_to_y(0) - end - pts[i .. 'B-' .. Band .. FXGUID_ProQ] = magForBrickwall - end - - if ProQ3.LT_EQBand[FXGUID_ProQ] == Band then - BandColor = determineBandColor(ProQ3.LT_EQBand - [FXGUID_ProQ]) - local X2 = x + 2 - if i ~= 1 then - r.ImGui_DrawList_AddLine(Foreground, x, - Y_Mid + 100, X2, - Y_Mid - pts[i .. 'B-' .. Band .. FXGUID_ProQ], - BandColor, 2) - end - x = X2 - end - end - end - elseif ProQ3.Band_UseState[Band] == 1.0 and ProQ3['Shape of Band' .. Band .. 'ID' .. FXGUID_ProQ] == 'Low Cut' then - if Slope[Band] < 0.2 then - MIN_Q = 0.1; MAX_Q = 200 - elseif Slope[Band] > 0.2 and Slope[Band] < 0.3 then - MIN_Q = 0.1; MAX_Q = 120 - elseif Slope[Band] > 0.3 and Slope[Band] < 0.4 then - MIN_Q = 0.1; MAX_Q = 40 - elseif Slope[Band] > 0.4 and Slope[Band] < 0.5 then - MIN_Q = 0.1; MAX_Q = 21 - elseif Slope[Band] > 0.5 and Slope[Band] < 0.6 then - MIN_Q = 0.26; MAX_Q = 7 - elseif Slope[Band] > 0.6 and Slope[Band] < 0.7 then - MIN_Q = 0.3; MAX_Q = 6 - elseif Slope[Band] > 0.7 and Slope[Band] < 0.8 then - MIN_Q = 0.5; MAX_Q = 2.6 - elseif Slope[Band] > 0.8 and Slope[Band] < 0.9 then - MIN_Q = 0.4; MAX_Q = 2.7 - elseif Slope[Band] == 1 then - MIN_Q = 0.7; MAX_Q = 0.7 - end - - - - Q[Band] = Q[Band] * 100 - if ProQ3.Format == 'VST' or ProQ3.Format == 'VST3' then - Q_LC = Q[Band] / 100 / 1.4 - elseif ProQ3.Format == 'AU' then - Q_LC = per_to_q(Q[Band], 100) - end - - - ProQ3['Slope' .. ' FXID-' .. FXGUID[FX_Idx]] = Slope[Band] * 20 - svf_hp(FreqToActualFreq, Q_LC, - ProQ3['Slope' .. ' FXID-' .. FXGUID[FX_Idx]]) - - local x = ProQ_Xpos_L - local y = Y_Mid - if Band_Enabled[Band .. FXGUID_ProQ] == 1 then - for i = 1, ProQ3.Width, 1 do -- do 340 times - iToFreq = x_to_freq(i) - local mag = zdf_magnitude(iToFreq) - mag = 20 * math.log(mag, 10) - mag = db_to_y(mag) - - if Slope[Band] ~= 1 then - pts[i .. 'B-' .. Band .. FXGUID_ProQ] = mag * - ProQ3['scale' .. ' ID' .. FXGUID[FX_Idx]] - elseif Slope[Band] == 1 then --if Slope = brickwall - local magForBrickwall; - if iToFreq > FreqToActualFreq then - magForBrickwall = db_to_y(0) - elseif iToFreq < FreqToActualFreq then - magForBrickwall = db_to_y(-100) - end - pts[i .. 'B-' .. Band .. FXGUID_ProQ] = magForBrickwall - end - - if ProQ3.LT_EQBand[FXGUID_ProQ] == Band then - BandColor = determineBandColor(ProQ3.LT_EQBand - [FXGUID_ProQ]) - local X2 = x + 1 - if i ~= 1 then - r.ImGui_DrawList_AddLine(Foreground, x, - Y_Mid + 100, X2, - Y_Mid - pts[i .. 'B-' .. Band .. FXGUID_ProQ], - BandColor, 2) - end - x = X2 - end - end - end - elseif ProQ3.Band_UseState[Band] == 1.0 and ProQ3['Shape of Band' .. Band .. 'ID' .. FXGUID_ProQ] == 'Low Shelf' then --@todo Pro Q -- No support for different slopes - MIN_Q = 0.1; MAX_Q = 100 - Q[Band] = per_to_q(Q[Band] * 100, 100) - - - - svf_ls(FreqToActualFreq, Q[Band], Gain[Band]) - local x = ProQ_Xpos_L - local y = Y_Mid - if Band_Enabled[Band .. FXGUID_ProQ] == 1 then - for i = 1, ProQ3.Width, 1 do -- do 340 times - iToFreq = x_to_freq(i) - mag = zdf_magnitude(iToFreq) - mag = 20 * math.log(mag, 10) - mag = db_to_y(mag) - pts[i .. 'B-' .. Band .. FXGUID_ProQ] = mag * - ProQ3['scale' .. ' ID' .. FXGUID[FX_Idx]] - - if ProQ3.LT_EQBand[FXGUID_ProQ] == Band then - local X2 = x + 1 - BandColor = determineBandColor(ProQ3.LT_EQBand - [FXGUID_ProQ]) - if i ~= 1 then - r.ImGui_DrawList_AddLine(Foreground, x, y, - X2, Y_Mid - pts - [i .. 'B-' .. Band .. FXGUID_ProQ], - BandColor) - end - x = X2 - end - end - end - elseif ProQ3.Band_UseState[Band] == 1.0 and ProQ3['Shape of Band' .. Band .. 'ID' .. FXGUID_ProQ] == 'High Shelf' then - MIN_Q = 0.1; MAX_Q = 100 - Q[Band] = per_to_q(Q[Band] * 100, 100) - - svf_hs(FreqToActualFreq, Q[Band], Gain[Band]) - local x = ProQ_Xpos_L - local y = Y_Mid - if Band_Enabled[Band .. FXGUID_ProQ] == 1 then - for i = 1, ProQ3.Width, 1 do -- do 340 times - iToFreq = x_to_freq(i) - mag = zdf_magnitude(iToFreq) - mag = 20 * math.log(mag, 10) - mag = db_to_y(mag) - pts[i .. 'B-' .. Band .. FXGUID_ProQ] = mag * - ProQ3['scale' .. ' ID' .. FXGUID[FX_Idx]] - if ProQ3.LT_EQBand[FXGUID_ProQ] == Band then - local X2 = x + 1 - BandColor = determineBandColor(ProQ3.LT_EQBand - [FXGUID_ProQ]) - if i ~= 1 then - r.ImGui_DrawList_AddLine(Foreground, x, y, - X2, Y_Mid - pts - [i .. 'B-' .. Band .. FXGUID_ProQ], - BandColor) - end - x = X2 - end - end - end - elseif ProQ3.Band_UseState[Band] == 1.0 and ProQ3['Shape of Band' .. Band .. 'ID' .. FXGUID_ProQ] == 'Band Pass' then - MIN_Q = 0.04; MAX_Q = 3000 - Q[Band] = per_to_q(Q[Band] * 100, 100) - svf_bp(FreqToActualFreq, Q[Band]) - local x = ProQ_Xpos_L - local y = Y_Mid - if Band_Enabled[Band .. FXGUID_ProQ] == 1 then - for i = 1, ProQ3.Width, 1 do -- do 340 times - iToFreq = x_to_freq(i) - mag = zdf_magnitude(iToFreq) - mag = 20 * math.log(mag, 10) - mag = db_to_y(mag) - pts[i .. 'B-' .. Band .. FXGUID_ProQ] = mag * - ProQ3['scale' .. ' ID' .. FXGUID[FX_Idx]] - if ProQ3.LT_EQBand[FXGUID_ProQ] == Band then - local X2 = x + 1 - BandColor = determineBandColor(ProQ3.LT_EQBand - [FXGUID_ProQ]) - if i ~= 1 then - r.ImGui_DrawList_AddLine(Foreground, x, - Y_Mid + 100, X2, - Y_Mid - pts[i .. 'B-' .. Band .. FXGUID_ProQ], - BandColor) - end - x = X2 - end - end - end - elseif ProQ3.Band_UseState[Band] == 1.0 and ProQ3['Shape of Band' .. Band .. 'ID' .. FXGUID_ProQ] == 'Notch' then - MIN_Q = 0.005; MAX_Q = 400 - Q[Band] = per_to_q(Q[Band] * 100, 100) - svf_bs(FreqToActualFreq, Q[Band]) - local x = ProQ_Xpos_L - local y = Y_Mid - if Band_Enabled[Band .. FXGUID_ProQ] == 1 then - for i = 1, ProQ3.Width, 2 do -- do 340 times - iToFreq = x_to_freq(i) - mag = zdf_magnitude(iToFreq) - mag = 20 * math.log(mag, 10) - mag = db_to_y(mag) - pts[i .. 'B-' .. Band .. FXGUID_ProQ] = mag * - ProQ3['scale' .. ' ID' .. FXGUID[FX_Idx]] - if ProQ3.LT_EQBand[FXGUID_ProQ] == Band then - local X2 = x + 2 - BandColor = determineBandColor(ProQ3.LT_EQBand - [FXGUID_ProQ]) - if i ~= 1 then - r.ImGui_DrawList_AddLine(Foreground, x, y, - X2, Y_Mid - pts - [i .. 'B-' .. Band .. FXGUID_ProQ], - BandColor) - end - x = X2 - end - end - end - elseif ProQ3.Band_UseState[Band] == 1.0 and ProQ3['Shape of Band' .. Band .. 'ID' .. FXGUID_ProQ] == 'Tilt Shelf' then - TiltShelf(0.1, 100, 77) - elseif ProQ3.Band_UseState[Band] == 1.0 and ProQ3['Shape of Band' .. Band .. 'ID' .. FXGUID_ProQ] == 'Flat Tilt' then - TiltShelf(0.000001, 0.0001, 100, 0.08) - end - end - - - - ---------------------- - --==Draw Sum of all EQ - ---------------------- - local x = ProQ_Xpos_L - for i = 1, ProQ3.Width, 2 do - pts[i .. FXGUID_ProQ] = 0 - for Band = 1, 24, 1 do --Add up the sum of all eq - if ProQ3.Band_UseState[Band] == 1 then - if pts[i .. 'B-' .. Band .. FXGUID_ProQ] ~= nil and Band_Enabled[Band .. FXGUID_ProQ] == 1 then - pts[i .. FXGUID_ProQ] = pts[i .. FXGUID_ProQ] + - pts[i .. 'B-' .. Band .. FXGUID_ProQ] - end - end - end - pts[i .. FXGUID_ProQ] = pts[i .. FXGUID_ProQ] - local X2 = x + 2 - if i ~= 1 then - - local y1 = Y_Mid - pts [(math.max( i-2 , 3)) .. FXGUID_ProQ] * (GainScale *2) - local y2 = Y_Mid - pts[i .. FXGUID_ProQ] * (GainScale *2) - - r.ImGui_DrawList_AddLine(Foreground, x, y1 , X2, y2 , 0xFFC43488, 2.5) - end - - - local Y_Mid = (ProQ_Ypos_T + ProQ3.H / 2) - y = Y_Mid - pts[i .. FXGUID_ProQ] - x = X2 - end - - - - r.ImGui_DrawList_AddTextEx(Foreground, Font_Andale_Mono, 9.5, - ProQ_Xpos_L + iPos50 - 3, Y_Mid + 86, 0x78787899, '50') - r.ImGui_DrawList_AddTextEx(Foreground, Font_Andale_Mono, 9.5, - ProQ_Xpos_L + iPos100 - 5, Y_Mid + 86, 0x78787899, '100') - r.ImGui_DrawList_AddTextEx(Foreground, Font_Andale_Mono, 9.5, - ProQ_Xpos_L + iPos200 - 5, Y_Mid + 86, 0x78787899, '200') - r.ImGui_DrawList_AddTextEx(Foreground, Font_Andale_Mono, 9.5, - ProQ_Xpos_L + iPos500 - 5, Y_Mid + 86, 0x78787899, '500') - r.ImGui_DrawList_AddTextEx(Foreground, Font_Andale_Mono, 9.5, - ProQ_Xpos_L + iPos1k - 5, Y_Mid + 86, 0x78787899, '1k') - r.ImGui_DrawList_AddTextEx(Foreground, Font_Andale_Mono, 9.5, - ProQ_Xpos_L + iPos2k - 5, Y_Mid + 86, 0x78787899, '2k') - r.ImGui_DrawList_AddTextEx(Foreground, Font_Andale_Mono, 9.5, - ProQ_Xpos_L + iPos5k - 5, Y_Mid + 86, 0x78787899, '5k') - r.ImGui_DrawList_AddTextEx(Foreground, Font_Andale_Mono, 9.5, - ProQ_Xpos_L + iPos10k - 5, Y_Mid + 86, 0x78787899, '10k') - - r.ImGui_DrawList_AddLine(Foreground, ProQ_Xpos_L + iPos50, ProQ_Ypos_B, - ProQ_Xpos_L + iPos50, ProQ_Ypos_T + 300, 0x78787822) - r.ImGui_DrawList_AddLine(Foreground, ProQ_Xpos_L + iPos100, ProQ_Ypos_B, - ProQ_Xpos_L + iPos100, ProQ_Ypos_T + 300, 0x78787844) - r.ImGui_DrawList_AddLine(Foreground, ProQ_Xpos_L + iPos200, ProQ_Ypos_B, - ProQ_Xpos_L + iPos200, ProQ_Ypos_T + 300, 0x78787822) - r.ImGui_DrawList_AddLine(Foreground, ProQ_Xpos_L + iPos500, ProQ_Ypos_B, - ProQ_Xpos_L + iPos500, ProQ_Ypos_T + 300, 0x78787822) - r.ImGui_DrawList_AddLine(Foreground, ProQ_Xpos_L + iPos1k, ProQ_Ypos_B, - ProQ_Xpos_L + iPos1k, ProQ_Ypos_T + 300, 0x78787844) - r.ImGui_DrawList_AddLine(Foreground, ProQ_Xpos_L + iPos2k, ProQ_Ypos_B, - ProQ_Xpos_L + iPos2k, ProQ_Ypos_T + 300, 0x78787822) - r.ImGui_DrawList_AddLine(Foreground, ProQ_Xpos_L + iPos5k, ProQ_Ypos_B, - ProQ_Xpos_L + iPos5k, ProQ_Ypos_T + 300, 0x78787822) - r.ImGui_DrawList_AddLine(Foreground, ProQ_Xpos_L + iPos10k, ProQ_Ypos_B, - ProQ_Xpos_L + iPos10k, ProQ_Ypos_T + 300, 0x78787844) - - r.ImGui_DrawList_AddLine(Foreground, ProQ_Xpos_L, Y_Mid, ProQ_Xpos_R, Y_Mid, - 0x78787844) - - if ProQ3['scaleLabel' .. ' ID' .. FXGUID[FX_Idx]] == 30 or ProQ3['scaleLabel' .. ' ID' .. FXGUID[FX_Idx]] == 3 then - local Gain10 = Y_Mid + (ProQ_Ypos_T - Y_Mid) / 3 - local Gain20 = Y_Mid + ((ProQ_Ypos_T - Y_Mid) / 3) * 2 - local GainMinus10 = Y_Mid - (ProQ_Ypos_T - Y_Mid) / 3 - local GainMinus20 = Y_Mid - ((ProQ_Ypos_T - Y_Mid) / 3) * 2 - - r.ImGui_DrawList_AddLine(Foreground, ProQ_Xpos_L, Gain10, ProQ_Xpos_R, - Gain10, 0x78787822) - r.ImGui_DrawList_AddLine(Foreground, ProQ_Xpos_L, Gain20, ProQ_Xpos_R, - Gain20, 0x78787822) - r.ImGui_DrawList_AddLine(Foreground, ProQ_Xpos_L, GainMinus10, - ProQ_Xpos_R, GainMinus10, 0x78787822) - r.ImGui_DrawList_AddLine(Foreground, ProQ_Xpos_L, GainMinus20, - ProQ_Xpos_R, GainMinus20, 0x78787822) - elseif ProQ3['scaleLabel' .. ' ID' .. FXGUID[FX_Idx]] == 12 then - local Gain3 = (ProQ_Ypos_T - Y_Mid) / 4 - local Gain6 = ((ProQ_Ypos_T - Y_Mid) / 4) * 2 - local Gain9 = ((ProQ_Ypos_T - Y_Mid) / 4) * 3 - - r.ImGui_DrawList_AddLine(Foreground, ProQ_Xpos_L, Y_Mid + Gain3, - ProQ_Xpos_R, Y_Mid + Gain3, 0x78787822) - r.ImGui_DrawList_AddLine(Foreground, ProQ_Xpos_L, Y_Mid + Gain6, - ProQ_Xpos_R, Y_Mid + Gain6, 0x78787822) - r.ImGui_DrawList_AddLine(Foreground, ProQ_Xpos_L, Y_Mid + Gain9, - ProQ_Xpos_R, Y_Mid + Gain9, 0x78787822) - r.ImGui_DrawList_AddLine(Foreground, ProQ_Xpos_L, Y_Mid - Gain3, - ProQ_Xpos_R, Y_Mid - Gain3, 0x78787822) - r.ImGui_DrawList_AddLine(Foreground, ProQ_Xpos_L, Y_Mid - Gain6, - ProQ_Xpos_R, Y_Mid - Gain6, 0x78787822) - r.ImGui_DrawList_AddLine(Foreground, ProQ_Xpos_L, Y_Mid - Gain9, - ProQ_Xpos_R, Y_Mid - Gain9, 0x78787822) - elseif ProQ3['scaleLabel' .. ' ID' .. FXGUID[FX_Idx]] == 6 then - local Gain1 = (ProQ_Ypos_T - Y_Mid) / 6 - local Gain2 = Gain1 * 2 - local Gain3 = Gain1 * 3 - local Gain4 = Gain1 * 4 - local Gain5 = Gain1 * 5 - - r.ImGui_DrawList_AddLine(Foreground, ProQ_Xpos_L, Y_Mid + Gain1, - ProQ_Xpos_R, Y_Mid + Gain1, 0x78787822) - r.ImGui_DrawList_AddLine(Foreground, ProQ_Xpos_L, Y_Mid + Gain2, - ProQ_Xpos_R, Y_Mid + Gain2, 0x78787822) - r.ImGui_DrawList_AddLine(Foreground, ProQ_Xpos_L, Y_Mid + Gain3, - ProQ_Xpos_R, Y_Mid + Gain3, 0x78787822) - r.ImGui_DrawList_AddLine(Foreground, ProQ_Xpos_L, Y_Mid + Gain4, - ProQ_Xpos_R, Y_Mid + Gain4, 0x78787822) - r.ImGui_DrawList_AddLine(Foreground, ProQ_Xpos_L, Y_Mid + Gain5, - ProQ_Xpos_R, Y_Mid + Gain5, 0x78787822) - - - r.ImGui_DrawList_AddLine(Foreground, ProQ_Xpos_L, Y_Mid - Gain1, - ProQ_Xpos_R, Y_Mid - Gain1, 0x78787822) - r.ImGui_DrawList_AddLine(Foreground, ProQ_Xpos_L, Y_Mid - Gain2, - ProQ_Xpos_R, Y_Mid - Gain2, 0x78787822) - r.ImGui_DrawList_AddLine(Foreground, ProQ_Xpos_L, Y_Mid - Gain3, - ProQ_Xpos_R, Y_Mid - Gain3, 0x78787822) - r.ImGui_DrawList_AddLine(Foreground, ProQ_Xpos_L, Y_Mid - Gain4, - ProQ_Xpos_R, Y_Mid - Gain4, 0x78787822) - r.ImGui_DrawList_AddLine(Foreground, ProQ_Xpos_L, Y_Mid - Gain5, - ProQ_Xpos_R, Y_Mid - Gain5, 0x78787822) - end - - - ---------------------- - --Draw Nodes - ---------------------- - NodeY_Pos = {} - NodeHvr = {} - NodeHasbeenHovered = nil - MousePosX, MousePosY = r.ImGui_GetMousePos(ctx) - - for Band = 1, 24, 1 do - if ProQ3.Band_UseState[Band] == 1 then - NodeFreq['B-' .. Band .. 'GUID-' .. FXGUID_ProQ] = x_to_freq(Freq - [Band] * ProQ3.Width) - XposNode[Band] = freq_to_scx(NodeFreq - ['B-' .. Band .. 'GUID-' .. FXGUID_ProQ]) - _, ProQ3['Shape of Band' .. Band .. 'ID' .. FXGUID_ProQ] = r - .TrackFX_GetFormattedParamValue(LT_Track, FX_Idx, - 8 + 13 * (Band - 1)) - - determineBandColor(Band) - if ProQ3['Shape of Band' .. Band .. 'ID' .. FXGUID_ProQ] == 'Bell' then - NodeY_Pos[Band] = Y_Mid - - (Gain[Band] * 3.2) * - ProQ3['scale' .. ' ID' .. FXGUID[FX_Idx]]; - elseif ProQ3['Shape of Band' .. Band .. 'ID' .. FXGUID_ProQ] == 'Low Cut' then - NodeY_Pos[Band] = Y_Mid - - (Q_Node[Band]) * ProQ3['scale' .. ' ID' .. FXGUID[FX_Idx]] - elseif ProQ3['Shape of Band' .. Band .. 'ID' .. FXGUID_ProQ] == 'High Cut' then - NodeY_Pos[Band] = Y_Mid - - (Q_Node[Band]) * ProQ3['scale' .. ' ID' .. FXGUID[FX_Idx]] - elseif ProQ3['Shape of Band' .. Band .. 'ID' .. FXGUID_ProQ] == 'Low Shelf' then - NodeY_Pos[Band] = Y_Mid - - (ShelfGain_Node) * ProQ3['scale' .. ' ID' .. FXGUID[FX_Idx]] - elseif ProQ3['Shape of Band' .. Band .. 'ID' .. FXGUID_ProQ] == 'High Shelf' then - NodeY_Pos[Band] = Y_Mid - - (ShelfGain_Node) * ProQ3['scale' .. ' ID' .. FXGUID[FX_Idx]] - elseif ProQ3['Shape of Band' .. Band .. 'ID' .. FXGUID_ProQ] == 'Band Pass' then - NodeY_Pos[Band] = Y_Mid - elseif ProQ3['Shape of Band' .. Band .. 'ID' .. FXGUID_ProQ] == 'Notch' then - NodeY_Pos[Band] = Y_Mid - elseif ProQ3['Shape of Band' .. Band .. 'ID' .. FXGUID_ProQ] == 'Tilt Shelf' then - NodeY_Pos[Band] = Y_Mid - - (Gain[Band] * 1.4) * - ProQ3['scale' .. ' ID' .. FXGUID[FX_Idx]] - elseif ProQ3['Shape of Band' .. Band .. 'ID' .. FXGUID_ProQ] == 'Flat Tilt' then - NodeY_Pos[Band] = Y_Mid - - (0.08 * 1.4) * ProQ3['scale' .. ' ID' .. FXGUID[FX_Idx]] - end - - - if Band_Enabled[Band .. FXGUID_ProQ] == 1 then - r.ImGui_DrawList_AddCircleFilled(Foreground, - ProQ_Xpos_L + XposNode[Band], NodeY_Pos[Band], 6, - Clr_FullAlpha) - else - r.ImGui_DrawList_AddCircleFilled(Foreground, - ProQ_Xpos_L + (XposNode[Band] or 0), NodeY_Pos[Band] or 0, 6, - Clr_HalfAlpha) - end - if ProQ_Xpos_L and XposNode[Band] and NodeY_Pos[Band] then - if Band <= 9 then - r.ImGui_DrawList_AddTextEx(Foreground, - Font_Andale_Mono, 12, ProQ_Xpos_L + XposNode[Band] - 2.5, - NodeY_Pos[Band] - 4.5, 0x000000ff, Band) - end - if Band > 9 then - r.ImGui_DrawList_AddTextEx(Foreground, - Font_Andale_Mono, 10, ProQ_Xpos_L + XposNode[Band] - 5, - NodeY_Pos[Band] - 4, 0x000000ff, Band) - end - end - - local NodeHoverArea = 10 - if MousePosX > ProQ_Xpos_L + XposNode[Band] - NodeHoverArea and MousePosX < ProQ_Xpos_L + XposNode[Band] + NodeHoverArea and MousePosY > NodeY_Pos[Band] - NodeHoverArea and MousePosY < NodeY_Pos[Band] + NodeHoverArea then - ProQ3['NodeHvr' .. Band .. 'FXID-' .. FXGUID[FX_Idx]] = true - HvringNode = Band - else - ProQ3['NodeHvr' .. Band .. 'FXID-' .. FXGUID[FX_Idx]] = false - end - - if ProQ3['NodeHvr' .. Band .. 'FXID-' .. FXGUID[FX_Idx]] == true then - NodeHasbeenHovered = true - FX_DeviceWindow_NoScroll = r.ImGui_WindowFlags_NoScrollWithMouse() - r.ImGui_DrawList_AddCircle(Foreground, ProQ_Xpos_L + - XposNode[Band], NodeY_Pos[Band], 7.7, 0xf0f0f0ff) - if IsLBtnHeld then - r.ImGui_DrawList_AddCircleFilled(Foreground, - ProQ_Xpos_L + XposNode[Band], NodeY_Pos[Band], 7.7, - Clr_HalfAlpha) - if IsLBtnClicked then ProQ3['NodeDrag' .. Band .. ' ID-' .. FXGUID[FX_Idx]] = true end - end - - local QQ = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, - ((Band - 1) * 13) + 7) - if Wheel_V ~= 0 then --if wheel is moved - HoverOnScrollItem = true - MousePosX_AdjustingQ, Y = reaper.GetMousePosition() - ProQ3['AdjustingQ' .. FXGUID[FX_Idx]] = true - BandforQadjusting = Band - end - if IsLBtnClicked and Mods == Alt then -- delete node - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, - ((Band - 1) * 13), - 0) - ProQ3['NodeHvr' .. Band .. 'FXID-' .. FXGUID[FX_Idx]] = false - HvringNode = nil - end - - if LBtnClickCount == 2 then - local OnOff = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, - ((Band - 1) * 13) + 1) - - if OnOff == 1 then - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, - ((Band - 1) * 13) + 1, 0) - else - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, - ((Band - 1) * 13) + 1, 1) - end - end - if IsRBtnClicked == true then - r.ImGui_OpenPopup(ctx, 'Pro-Q R Click') - end - else - FX_DeviceWindow_NoScroll = 0 - end - - - - - if ProQ3['AdjustingQ' .. FXGUID[FX_Idx]] then - local MousePosX_AdjustingQ_CheckXpos, Y = reaper - .GetMousePosition() - if Mods == Shift then - WheelQFineAdj = 20 - else - WheelQFineAdj = 1 - end - if MousePosX_AdjustingQ_CheckXpos < MousePosX_AdjustingQ + 7 and MousePosX_AdjustingQ_CheckXpos > MousePosX_AdjustingQ - 7 then - local QQ = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, - ((BandforQadjusting - 1) * 13) + 7) - - Q_Output = SetMinMax(QQ - ((Wheel_V / 50) / WheelQFineAdj), 0, - 1) - - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, - ((BandforQadjusting - 1) * 13) + 7, Q_Output) - else - ProQ3['AdjustingQ' .. FXGUID[FX_Idx]] = false - end - end - - - if ProQ3['NodeDrag' .. Band .. ' ID-' .. FXGUID[FX_Idx]] == true then - MouseDeltaX, MouseDeltaY = r.ImGui_GetMouseDelta(ctx) - local Freq = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, - ((Band - 1) * 13) + 2) - local Gain = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, - ((Band - 1) * 13) + 3) - local Q = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, - ((Band - 1) * 13) + 7) - - if IsLBtnHeld == false then - ProQ3['NodeDrag' .. Band .. ' ID-' .. FXGUID[FX_Idx]] = false - end - -- finetune if shift is held - if Mods == Shift then - HorizDragScale = 1000 - else - HorizDragScale = 400 - end - if Mods == Shift then - QDragScale = 400 - else - QDragScale = 120 - end - - if ProQ3['Shape of Band' .. Band .. 'ID' .. FXGUID_ProQ] == 'Low Cut' or ProQ3['Shape of Band' .. Band .. 'ID' .. FXGUID_ProQ] == 'High Cut' then - Q_Output = Q + - (-MouseDeltaY / QDragScale) * - (ProQ3['scale' .. ' ID' .. FXGUID[FX_Idx]] / ProQ3['DragGainScale' .. ' ID' .. FXGUID[FX_Idx]]) - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, - ((Band - 1) * 13) + 7, Q_Output) - - if Freq > 1 and MouseDeltaX > 0 then - FreqOutput = 1 - elseif Freq < 0 and MouseDeltaX < 0 then - FreqOutput = 0 - else - FreqOutput = Freq + MouseDeltaX / HorizDragScale - end - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, - ((Band - 1) * 13) + 2, FreqOutput) - else - if Gain > 1 and MouseDeltaY < 0 then - GainOutput = 1 - elseif Gain < 0 and MouseDeltaY > 0 then - GainOutput = 0 - else - GainOutput = Gain + - (-MouseDeltaY / 270) * - (ProQ3['scale' .. ' ID' .. FXGUID[FX_Idx]] / ProQ3['DragGainScale' .. ' ID' .. FXGUID[FX_Idx]]) - end - - if Freq > 1 and MouseDeltaX > 0 then - FreqOutput = 1 - elseif Freq < 0 and MouseDeltaX < 0 then - FreqOutput = 0 - else - FreqOutput = Freq + MouseDeltaX / HorizDragScale - end - - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, - ((Band - 1) * 13) + 2, FreqOutput) - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, - ((Band - 1) * 13) + 3, GainOutput) - end - end - - - - - - - - -- if i == iPos10k then r.ImGui_DrawList_AddTextEx(Foreground, Font_Andale_Mono, 12, ProQ_Xpos_L+XposNode[Band], Y_Mid- (Gain[B]*3.2) , 0x78787899, '10K') end - if LT_ParamNum ~= nil then - local m = m; - _, tracknumber, fxnumber, paramnumber = reaper.GetLastTouchedFX() - proQ_LT_GUID = reaper.TrackFX_GetFXGUID(LT_Track, fxnumber) - - for i = 1, RepeatTimeForWindows, 1 do - GUIDtoCompare = reaper.TrackFX_GetFXGUID(LT_Track, fxnumber) - if proQ_LT_GUID == GUIDtoCompare and proQ_LT_GUID ~= nil then - for i = 1, 24, 1 do - if LT_ParamNum > 13 * (i - 1) and LT_ParamNum < 13 * i then - ProQ3.LT_EQBand[proQ_LT_GUID] = i - end - end - end - end - if ProQ3.GainDragging == true then - MouseDeltaX, MouseDeltaY = r.ImGui_GetMouseDelta(ctx) - - local Gain = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, - ((ProQ3.LT_EQBand[proQ_LT_GUID] - 1) * 13) + 3) - - if Gain > 1 and MouseDeltaY < 0 then - GainOutput = 1 - elseif Gain < 0 and MouseDeltaY > 0 then - GainOutput = 0 - else - GainOutput = Gain + - (-MouseDeltaY / 270) * - (ProQ3['scale' .. ' ID' .. FXGUID[FX_Idx]] / ProQ3['DragGainScale' .. ' ID' .. FXGUID[FX_Idx]]) - end - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, - ((ProQ3.LT_EQBand[proQ_LT_GUID] - 1) * 13) + 3, - GainOutput) - end - if ProQ3.FreqDragging == true then - MouseDeltaX, MouseDeltaY = r.ImGui_GetMouseDelta(ctx) - if Mods == Shift then - HorizDragScale = 1300 - else - HorizDragScale = 400 - end - local Freq = r.TrackFX_GetParamNormalized(LT_Track, FX_Idx, - ((ProQ3.LT_EQBand[proQ_LT_GUID] - 1) * 13) + 2) - - if Freq > 1 and MouseDeltaX > 0 then - FreqOutput = 1 - elseif Freq < 0 and MouseDeltaX < 0 then - FreqOutput = 0 - else - FreqOutput = Freq + MouseDeltaX / HorizDragScale - end - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, - ((ProQ3.LT_EQBand[proQ_LT_GUID] - 1) * 13) + 2, - FreqOutput) - end - end - end --end for repeat every active band - end --end for repeat every band - if NodeHasbeenHovered then HoverOnScrollItem = true end - - - - if r.ImGui_BeginPopup(ctx, 'Pro-Q R Click') then - local LTBand = ProQ3.LT_EQBand[FXGUID[FX_Idx]] - if r.ImGui_Button(ctx, 'Bell') then - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, 13 * (LTBand - 1) + 8, - 0) - r.ImGui_CloseCurrentPopup(ctx) - end - if r.ImGui_Button(ctx, 'Low Shelf') then - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, 13 * (LTBand - 1) + 8, - 0.11) - r.ImGui_CloseCurrentPopup(ctx) - end - if r.ImGui_Button(ctx, 'Low Cut') then - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, 13 * (LTBand - 1) + 8, - 0.22) - r.ImGui_CloseCurrentPopup(ctx) - end - if r.ImGui_Button(ctx, 'High Shelf') then - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, 13 * (LTBand - 1) + 8, - 0.33) - r.ImGui_CloseCurrentPopup(ctx) - end - if r.ImGui_Button(ctx, 'High Cut') then - r.TrackFX_SetParamNormalized(LT_Track, FX_Idx, 13 * (LTBand - 1) + 8, - 0.44) - r.ImGui_CloseCurrentPopup(ctx) - end - if r.ImGui_Button(ctx, 'Notch') then - r.TrackFX_SetParam(LT_Track, FX_Idx, 13 * (LTBand - 1) + 8, 0.60) - r.ImGui_CloseCurrentPopup(ctx) - end - if r.ImGui_Button(ctx, 'Band Pass') then - r.TrackFX_SetParam(LT_Track, FX_Idx, 13 * (LTBand - 1) + 8, 0.72) - r.ImGui_CloseCurrentPopup(ctx) - end - if r.ImGui_Button(ctx, 'Tilt Shelf') then - r.TrackFX_SetParam(LT_Track, FX_Idx, 13 * (LTBand - 1) + 8, 0.86) - r.ImGui_CloseCurrentPopup(ctx) - end - if r.ImGui_Button(ctx, 'Flat Tilt') then - r.TrackFX_SetParam(LT_Track, FX_Idx, 13 * (LTBand - 1) + 8, 1) - r.ImGui_CloseCurrentPopup(ctx) - end - reaper.ImGui_EndPopup(ctx) - end - - - ------------------------------------------ - --Add new node by double click - ------------------------------------------ - - if ProQ3['HvrGUI' .. FXGUID[FX_Idx]] and LBtnClickCount == 2 then - if HvringNode == nil or ProQ3['NodeHvr' .. HvringNode .. 'FXID-' .. FXGUID[FX_Idx]] ~= true then - UnusedBandFound = false - local Band = 1 - while (UnusedBandFound == false) do - if ProQ3.Band_UseState[Band] ~= 1 then - UnusedBandFound = true - BandNotInUse = Band - end - Band = Band + 1 - end - reaper.TrackFX_SetParamNormalized(LT_Track, FX_Idx, - 13 * (BandNotInUse - 1), 1) - MouseX_AddNode, MouseY_AddNode = reaper.ImGui_GetMousePos(ctx) - - local FreqToAddNode = (MouseX_AddNode - ProQ_Xpos_L) / ProQ3.Width - reaper.TrackFX_SetParamNormalized(LT_Track, FX_Idx, - 13 * (BandNotInUse - 1) + 2, FreqToAddNode) - local GainToAddNode = ((((Y_Mid - MouseY_AddNode) - 100) / 100 + 1) / ProQ3['scale' .. ' ID' .. FXGUID[FX_Idx]] + 1) / - 2 - reaper.TrackFX_SetParamNormalized(LT_Track, FX_Idx, - 13 * (BandNotInUse - 1) + 3, GainToAddNode) - if FreqToAddNode > 0.9 then - reaper.TrackFX_SetParamNormalized(LT_Track, FX_Idx, - 13 * (BandNotInUse - 1) + 8, 0.5) - elseif FreqToAddNode < 0.1 then - reaper.TrackFX_SetParamNormalized(LT_Track, FX_Idx, - 13 * (BandNotInUse - 1) + 8, 0.25) - else - reaper.TrackFX_SetParamNormalized(LT_Track, FX_Idx, - 13 * (BandNotInUse - 1) + 8, 0.02) - end - end - end - - stopp = true - - step = ProQ3.Width / 200 - - r.ImGui_DrawList_PathStroke(Foreground, 0x99999988, nil, 3) - - - - r.ImGui_EndChildFrame(ctx) - end ---- End of if begin pro-Q frame then - - ProQ3['HvrGUI' .. FXGUID[FX_Idx]] = reaper.ImGui_IsItemHovered(ctx) - --if ProQ3['HvrGUI'..FXGUID[FX_Idx]] then FX_DeviceWindow_NoScroll= 0--[[ r.ImGui_WindowFlags_NoScrollWithMouse() ]] end - - r.ImGui_PopStyleColor(ctx, 1) - - if FX.Enable[FX_Idx] == false then - local drawlist = reaper.ImGui_GetForegroundDrawList(ctx) - r.ImGui_DrawList_AddRectFilled(drawlist, ProQ_Xpos_L, ProQ_Ypos_T - 20, - ProQ_Xpos_L + ProQ3.Width, ProQ_Ypos_T + ProQ3.H, 0x00000077) - end - - - if FX.Win_Name[math.max(FX_Idx - 1, 0)]:find('FXD ReSpectrum') then - r.TrackFX_Show(LT_Track, FX_Idx - 1, 2) - if tablefind(Trk[TrkID].PreFX, FxGUID) then - r.TrackFX_Delete(LT_Track, - FX_Idx - 1) - end - SyncAnalyzerPinWithFX(FX_Idx - 1, FX_Idx, - FX.Win_Name[math.max(FX_Idx - 1, 0)]) - else -- if no spectrum is before pro-Q 3 - FX[FxGUID].AddEQSpectrumWait = (FX[FxGUID].AddEQSpectrumWait or 0) + 1 - if FX[FxGUID].AddEQSpectrumWait > FX_Add_Del_WaitTime then - r.gmem_attach('gmemReEQ_Spectrum') - r.gmem_write(1, PM.DIY_TrkID[TrkID]) - FX[FxGUID].ProQ_ID = FX[FxGUID].ProQ_ID or math.random(1000000, 9999999) - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: ProQ_ID ' .. FxGUID, - FX[FxGUID].ProQ_ID, true) - r.gmem_write(2, FX[FxGUID].ProQ_ID) - local AnyPopupOpen - if r.ImGui_IsPopupOpen(ctx, 'Delete FX Layer ', r.ImGui_PopupFlags_AnyPopupId() + r.ImGui_PopupFlags_AnyPopupLevel()) then AnyPopupOpen = true end - - if not tablefind(Trk[TrkID].PostFX, FxGUID) and not tablefind(Trk[TrkID].PreFX, FxGUID) and not AnyPopupOpen then - r.gmem_attach('gmemReEQ_Spectrum') - r.gmem_write(1, PM.DIY_TrkID[TrkID]) - FX[FxGUID].ProQ_ID = FX[FxGUID].ProQ_ID or - math.random(1000000, 9999999) - r.GetSetMediaTrackInfo_String(LT_Track, 'P_EXT: ProQ_ID ' .. FxGUID, - FX[FxGUID].ProQ_ID, true) - r.gmem_write(2, FX[FxGUID].ProQ_ID) - rv = r.TrackFX_AddByName(LT_Track, 'FXD ReSpectrum', 0, -1000 - - FX_Idx) - end - FX[FxGUID].AddEQSpectrumWait = 0 - r.TrackFX_Show(LT_Track, FX_Idx - 1, 2) - for i = 0, 16, 1 do - --r.TrackFX_SetPinMappings(LT_Track, FX_Idx, 0, i,0,0) - r.TrackFX_SetPinMappings(LT_Track, FX_Idx, 1, i, 0, 0) - end - end - end - - r.gmem_attach('gmemReEQ_Spectrum') - r.gmem_write(1, PM.DIY_TrkID[TrkID]) - -- r.gmem_write(0, FX_Idx) -end diff --git a/FX/BryanChi_FX Devices/FX Layouts/ValhallaDelay (Valhalla DSP, LLC).ini b/FX/BryanChi_FX Devices/FX Layouts/ValhallaDelay (Valhalla DSP, LLC).ini deleted file mode 100644 index d7e0996e5..000000000 --- a/FX/BryanChi_FX Devices/FX Layouts/ValhallaDelay (Valhalla DSP, LLC).ini +++ /dev/null @@ -1,1307 +0,0 @@ -FX global settings - -Edge Rounding = 3.49 -Grb Rounding = 0 -BgClr = 235802158 -Window Width = 335 -Title Width = 195 -Title Clr = 423980751 -Custom Title = -Param Instance = 35 - -Parameter Specific Settings - - ------------------Prm 1----------------- -1. Name = DelayL_Ms -1. Num = 4 -1. Width = 26.5 -1. Type = Knob -1. Pos X = 50 -1. Pos Y = 40 -1. Style = Pro C -1. Value Font Size = -1. Custom Label = -1. Font Size = -1. Slider Height = -1. BgClr = 170 -1. GrbClr = -1. Label Pos = Top -1. Value Pos = Bottom -1. Lbl Clr = -1. V Clr = -1. Drag Direction = -1. Condition Param = 2|1=Msec| -1. Condition Param Norm = |1=0.37999999523163|2=0.5| -1. Condition Param2 = - -1. Condition Param3 = - -1. Condition Param4 = - -1. Condition Param5 = - -1. Decimal Rounding = -1. Value to Note Length = nil -1. Switch type = -1. Switch Base Value = -1. Switch Target Value = - ------------------Prm 2----------------- -2. Name = DelayLSync -2. Num = 2 -2. Width = 66 -2. Type = Selection -2. Pos X = 45 -2. Pos Y = 104 -2. Style = up-down arrow -2. Value Font Size = -2. Custom Label = -2. Font Size = -2. Slider Height = -2. BgClr = 1145324544 -2. GrbClr = -2. Label Pos = -2. Value Pos = -2. Lbl Clr = -2. V Clr = -2. Drag Direction = -2. Condition Param = - -2. Condition Param2 = - -2. Condition Param3 = - -2. Condition Param4 = - -2. Condition Param5 = - -2. Decimal Rounding = -2. Value to Note Length = nil -2. Switch type = -2. Switch Base Value = -2. Switch Target Value = - ------------------Prm 3----------------- -3. Name = DelayLNote -3. Num = 3 -3. Width = 26.5 -3. Type = Knob -3. Pos X = 48 -3. Pos Y = 40 -3. Style = Pro C -3. Value Font Size = -3. Custom Label = Delay L -3. Font Size = -3. Slider Height = -3. BgClr = 170 -3. GrbClr = -3. Label Pos = Top -3. Value Pos = Bottom -3. Lbl Clr = -3. V Clr = -3. Drag Direction = -3. Condition Param = 2|1=Note|2=Dotted|3=Triplet| -3. Condition Param Norm = |1=0.20833332836628| -3. Condition Param2 = - -3. Condition Param3 = - -3. Condition Param4 = - -3. Condition Param5 = - -3. Decimal Rounding = -3. Value to Note Length = nil -3. Switch type = -3. Switch Base Value = -3. Switch Target Value = - ------------------Prm 4----------------- -4. Name = DelayStyle -4. Num = 1 -4. Width = 20 -4. Type = Knob -4. Pos X = 0 -4. Pos Y = 125 -4. Style = Pro C -4. Value Font Size = -4. Custom Label = Style -4. Font Size = -4. Slider Height = -4. BgClr = 170 -4. GrbClr = -4. Label Pos = Top -4. Value Pos = Bottom -4. Lbl Clr = -4. V Clr = -4. Drag Direction = -4. Condition Param = - -4. Condition Param2 = - -4. Condition Param3 = - -4. Condition Param4 = - -4. Condition Param5 = - -4. Decimal Rounding = -4. Value to Note Length = nil -4. Switch type = -4. Switch Base Value = -4. Switch Target Value = - ------------------Prm 5----------------- -5. Name = Mix -5. Num = 0 -5. Width = 19.5 -5. Type = Knob -5. Pos X = 0 -5. Pos Y = 30 -5. Style = Pro C -5. Value Font Size = -5. Custom Label = -5. Font Size = -5. Slider Height = -5. BgClr = 170 -5. GrbClr = -5. Label Pos = Top -5. Value Pos = Bottom -5. Lbl Clr = -5. V Clr = -5. Drag Direction = -5. Condition Param = - -5. Condition Param2 = - -5. Condition Param3 = - -5. Condition Param4 = - -5. Condition Param5 = - -5. Decimal Rounding = -5. Value to Note Length = nil -5. Switch type = -5. Switch Base Value = -5. Switch Target Value = - ------------------Prm 6----------------- -6. Name = DelaySpread -6. Num = 8 -6. Width = 26.5 -6. Type = Knob -6. Pos X = 110 -6. Pos Y = 41 -6. Style = Pro C -6. Value Font Size = -6. Custom Label = -6. Font Size = -6. Slider Height = -6. BgClr = 170 -6. GrbClr = -6. Label Pos = Top -6. Value Pos = Bottom -6. Lbl Clr = -6. V Clr = -6. Drag Direction = -6. Condition Param = 1|1=Single| - -6. Condition Param2 = - -6. Condition Param3 = - -6. Condition Param4 = - -6. Condition Param5 = - -6. Decimal Rounding = -6. Value to Note Length = nil -6. Switch type = -6. Switch Base Value = -6. Switch Target Value = -6. Manual V:1=0.04166666790843|2=0.08333333581686|3=0.125|4=0.16666667163372|5=0.20833332836628|6=0.25|7=0.29166665673256|8=0.33333334326744|9=0.375|10=0.41666665673256|11=0.45833334326744|12=0.5| -6. Manual Val format:1=Tape|2=HiFi|3=BBD|4=Digital|5=Ghost|6=Pitch|7=RevPitch|8=BBDuck|9=Clarity|10=DuckTape|11=PitchDuck|12=Lofi| - ------------------Prm 7----------------- -7. Name = Feedback -7. Num = 16 -7. Width = 18 -7. Type = Knob -7. Pos X = 183 -7. Pos Y = 48 -7. Style = Pro C -7. Value Font Size = -7. Custom Label = -7. Font Size = 8 -7. Slider Height = -7. BgClr = 170 -7. GrbClr = -7. Label Pos = Top -7. Value Pos = Bottom -7. Lbl Clr = -7. V Clr = -7. Drag Direction = -7. Condition Param = - -7. Condition Param2 = - -7. Condition Param3 = - -7. Condition Param4 = - -7. Condition Param5 = - -7. Decimal Rounding = -7. Value to Note Length = nil -7. Switch type = -7. Switch Base Value = -7. Switch Target Value = - ------------------Prm 8----------------- -8. Name = Width -8. Num = 17 -8. Width = 18 -8. Type = Knob -8. Pos X = 183 -8. Pos Y = 110 -8. Style = Pro C -8. Value Font Size = 9 -8. Custom Label = -8. Font Size = -8. Slider Height = -8. BgClr = 170 -8. GrbClr = -8. Label Pos = Top -8. Value Pos = Bottom -8. Lbl Clr = -8. V Clr = -8. Drag Direction = -8. Condition Param = 32|1=Tape|2=BBD|3=Digital|4=Ghost|5=HiFi|6=Pitch|7=RevPitch| -8. Condition Param Norm = |1=0.04166666790843|2=0.125|3=0.16666667163372|4=0.20833332836628|5=0.08333333581686|6=0.25|7=0.29166665673256| -8. Condition Param2 = |1=PingPong|2=Dual| -8. Condition Param Norm2 = |1=0.60000002384186|2=0.20000000298023| -8. Condition Param3 = - -8. Condition Param4 = - -8. Condition Param5 = - -8. Decimal Rounding = -8. Value to Note Length = nil -8. Switch type = -8. Switch Base Value = -8. Switch Target Value = -8. Manual V:1=0.04166666790843|2=0.08333333581686|3=0.125|4=0.16666667163372|5=0.20833332836628|6=0.25|7=0.29166665673256|8=0.33333334326744|9=0.375|10=0.41666665673256|11=0.45833334326744|12=0.5| -8. Manual Val format:1=Tape|2=HiFi|3=BBD|4=Digital|5=Ghost|6=Pitch|7=RevPitch|8=BBDuck|9=Clarity|10=DuckTape|11=PitchDuck|12=Lofi| - ------------------Prm 9----------------- -9. Name = DriveIn -9. Num = 18 -9. Width = 18 -9. Type = Knob -9. Pos X = 232.75 -9. Pos Y = 9 -9. Style = Pro C -9. Value Font Size = -9. Custom Label = Drive -9. Font Size = -9. Slider Height = -9. BgClr = 170 -9. GrbClr = -9. Label Pos = Top -9. Value Pos = None -9. Lbl Clr = -9. V Clr = -9. Drag Direction = -9. Condition Param = - -9. Condition Param2 = |1=Dual|2=PingPong| -9. Condition Param Norm2 = |1=0.20000000298023|2=0.60000002384186| -9. Condition Param3 = - -9. Condition Param4 = - -9. Condition Param5 = - -9. Decimal Rounding = -9. Value to Note Length = nil -9. Switch type = -9. Switch Base Value = -9. Switch Target Value = - ------------------Prm 10----------------- -10. Name = Age -10. Num = 19 -10. Width = 18 -10. Type = Knob -10. Pos X = 232.75 -10. Pos Y = 64 -10. Style = Pro C -10. Value Font Size = -10. Custom Label = -10. Font Size = -10. Slider Height = -10. BgClr = 170 -10. GrbClr = -10. Label Pos = Top -10. Value Pos = None -10. Lbl Clr = -10. V Clr = -10. Drag Direction = -10. Condition Param = - -10. Condition Param2 = - -10. Condition Param3 = - -10. Condition Param4 = - -10. Condition Param5 = - -10. Decimal Rounding = 0 -10. Value to Note Length = nil -10. Switch type = -10. Switch Base Value = -10. Switch Target Value = - ------------------Prm 11----------------- -11. Name = Diffusion -11. Num = 20 -11. Width = 18 -11. Type = Knob -11. Pos X = 232.75 -11. Pos Y = 119 -11. Style = Pro C -11. Value Font Size = -11. Custom Label = Diff -11. Font Size = -11. Slider Height = -11. BgClr = 170 -11. GrbClr = -11. Label Pos = Top -11. Value Pos = None -11. Lbl Clr = -11. V Clr = -11. Drag Direction = -11. Condition Param = - -11. Condition Param2 = - -11. Condition Param3 = - -11. Condition Param4 = - -11. Condition Param5 = - -11. Decimal Rounding = -11. Value to Note Length = nil -11. Switch type = -11. Switch Base Value = -11. Switch Target Value = - ------------------Prm 12----------------- -12. Name = DiffSize -12. Num = 21 -12. Width = 18 -12. Type = Knob -12. Pos X = 232.75 -12. Pos Y = 174 -12. Style = Pro C -12. Value Font Size = -12. Custom Label = Size -12. Font Size = -12. Slider Height = -12. BgClr = 170 -12. GrbClr = -12. Label Pos = Top -12. Value Pos = None -12. Lbl Clr = -12. V Clr = -12. Drag Direction = -12. Condition Param = - -12. Condition Param2 = - -12. Condition Param3 = - -12. Condition Param4 = - -12. Condition Param5 = - -12. Decimal Rounding = -12. Value to Note Length = nil -12. Switch type = -12. Switch Base Value = -12. Switch Target Value = - ------------------Prm 13----------------- -13. Name = HighCut -13. Num = 23 -13. Width = 18 -13. Type = Knob -13. Pos X = 284 -13. Pos Y = 119 -13. Style = Pro C -13. Value Font Size = -13. Custom Label = -13. Font Size = -13. Slider Height = -13. BgClr = 170 -13. GrbClr = -13. Label Pos = Top -13. Value Pos = None -13. Lbl Clr = -13. V Clr = -13. Drag Direction = -13. Condition Param = - -13. Condition Param2 = - -13. Condition Param3 = - -13. Condition Param4 = - -13. Condition Param5 = - -13. Decimal Rounding = -13. Value to Note Length = nil -13. Switch type = -13. Switch Base Value = -13. Switch Target Value = - ------------------Prm 14----------------- -14. Name = LowCut -14. Num = 22 -14. Width = 18 -14. Type = Knob -14. Pos X = 285 -14. Pos Y = 174 -14. Style = Pro C -14. Value Font Size = -14. Custom Label = -14. Font Size = -14. Slider Height = -14. BgClr = 170 -14. GrbClr = -14. Label Pos = Top -14. Value Pos = None -14. Lbl Clr = -14. V Clr = -14. Drag Direction = -14. Condition Param = - -14. Condition Param2 = - -14. Condition Param3 = - -14. Condition Param4 = - -14. Condition Param5 = - -14. Decimal Rounding = -14. Value to Note Length = nil -14. Switch type = -14. Switch Base Value = -14. Switch Target Value = - ------------------Prm 15----------------- -15. Name = Ducking -15. Num = 34 -15. Width = 18 -15. Type = Knob -15. Pos X = 183 -15. Pos Y = 120 -15. Style = Pro C -15. Value Font Size = -15. Custom Label = -15. Font Size = -15. Slider Height = -15. BgClr = 170 -15. GrbClr = -15. Label Pos = Top -15. Value Pos = Bottom -15. Lbl Clr = -15. V Clr = -15. Drag Direction = -15. Condition Param = 32|1=Clarity|2=DuckTape|3=PitchDuck|4=Lofi|5=BBDuck| -15. Condition Param Norm = |1=0.375|2=0.41666665673256|3=0.45833334326744|4=0.5|5=0.33333334326744|6=0.33333334326744| -15. Condition Param2 = - -15. Condition Param3 = - -15. Condition Param4 = - -15. Condition Param5 = - -15. Decimal Rounding = -15. Value to Note Length = nil -15. Switch type = -15. Switch Base Value = -15. Switch Target Value = - ------------------Prm 16----------------- -16. Name = Mode -16. Num = 32 -16. Width = 70 -16. Type = Selection -16. Pos X = 0 -16. Pos Y = 190 -16. Style = -16. Value Font Size = -16. Custom Label = Mode: -16. Font Size = -16. Slider Height = -16. BgClr = 1145324544 -16. GrbClr = -16. Label Pos = Left -16. Value Pos = -16. Lbl Clr = -16. V Clr = -16. Drag Direction = -16. Condition Param = - -16. Condition Param2 = - -16. Condition Param3 = - -16. Condition Param4 = - -16. Condition Param5 = - -16. Decimal Rounding = -16. Value to Note Length = nil -16. Switch type = -16. Switch Base Value = -16. Switch Target Value = -16. Manual V:1=0.04166666790843|2=0.08333333581686|3=0.125|4=0.16666667163372|5=0.20833332836628|6=0.25|7=0.29166665673256|8=0.33333334326744|9=0.375|10=0.41666665673256|11=0.45833334326744|12=0.5| -16. Manual Val format:1=Tape|2=HiFi|3=BBD|4=Digital|5=Ghost|6=Pitch|7=RevPitch|8=BBDuck|9=Clarity|10=DuckTape|11=PitchDuck|12=Lofi| - ------------------Prm 17----------------- -17. Name = Era -17. Num = 33 -17. Width = 66 -17. Type = Selection -17. Pos X = 122 -17. Pos Y = 190 -17. Style = -17. Value Font Size = -17. Custom Label = ERA: -17. Font Size = -17. Slider Height = -17. BgClr = 1145324544 -17. GrbClr = -17. Label Pos = Left -17. Value Pos = -17. Lbl Clr = -17. V Clr = -17. Drag Direction = -17. Condition Param = - -17. Condition Param2 = - -17. Condition Param3 = - -17. Condition Param4 = - -17. Condition Param5 = - -17. Decimal Rounding = -17. Value to Note Length = nil -17. Switch type = -17. Switch Base Value = -17. Switch Target Value = - ------------------Prm 18----------------- -18. Name = DelayR_Ms -18. Num = 7 -18. Width = 26.5 -18. Type = Knob -18. Pos X = 111 -18. Pos Y = 40 -18. Style = Pro C -18. Value Font Size = -18. Custom Label = Delay R -18. Font Size = -18. Slider Height = -18. BgClr = 170 -18. GrbClr = -18. Label Pos = Top -18. Value Pos = Bottom -18. Lbl Clr = -18. V Clr = -18. Drag Direction = -18. Condition Param = 5|1=Msec| - -18. Condition Param2 = 1|1=PingPong|2=Dual| -18. Condition Param Norm2 = |1=0.60000002384186|2=0.20000000298023| -18. Condition Param3 = - -18. Condition Param4 = - -18. Condition Param5 = - -18. Decimal Rounding = -18. Value to Note Length = nil -18. Switch type = -18. Switch Base Value = -18. Switch Target Value = - ------------------Prm 19----------------- -19. Name = DelayRNote -19. Num = 6 -19. Width = 26.5 -19. Type = Knob -19. Pos X = 110 -19. Pos Y = 40 -19. Style = Pro C -19. Value Font Size = -19. Custom Label = -19. Font Size = -19. Slider Height = -19. BgClr = 170 -19. GrbClr = -19. Label Pos = Top -19. Value Pos = Bottom -19. Lbl Clr = -19. V Clr = -19. Drag Direction = -19. Condition Param = 5|1=Note|2=Dotted|3=Triplet| - -19. Condition Param2 = 1|1=Dual|2=PingPong| -19. Condition Param Norm2 = |1=0.20000000298023|2=0.60000002384186| -19. Condition Param3 = - -19. Condition Param4 = - -19. Condition Param5 = - -19. Decimal Rounding = -19. Value to Note Length = nil -19. Switch type = -19. Switch Base Value = -19. Switch Target Value = - ------------------Prm 20----------------- -20. Name = DelayRSync -20. Num = 5 -20. Width = 64 -20. Type = Selection -20. Pos X = 110 -20. Pos Y = 105 -20. Style = up-down arrow -20. Value Font Size = -20. Custom Label = -20. Font Size = -20. Slider Height = -20. BgClr = 1145324544 -20. GrbClr = -20. Label Pos = -20. Value Pos = -20. Lbl Clr = -20. V Clr = -20. Drag Direction = -20. Condition Param = 1|1=Dual|2=PingPong| - -20. Condition Param2 = - -20. Condition Param3 = - -20. Condition Param4 = - -20. Condition Param5 = - -20. Decimal Rounding = -20. Value to Note Length = nil -20. Switch type = -20. Switch Base Value = -20. Switch Target Value = - ------------------Prm 21----------------- -21. Name = TapA -21. Num = 12 -21. Width = 22.5 -21. Type = Switch -21. Pos X = 50 -21. Pos Y = 140 -21. Style = -21. Value Font Size = -21. Custom Label = A -21. Font Size = -21. Slider Height = -21. BgClr = -21. GrbClr = -21. Label Pos = -21. Value Pos = -21. Lbl Clr = -21. V Clr = -21. Drag Direction = -21. Condition Param = 1|1=Quad| - -21. Condition Param2 = - -21. Condition Param3 = - -21. Condition Param4 = - -21. Condition Param5 = - -21. Decimal Rounding = -21. Value to Note Length = nil -21. Switch type = -21. Switch Base Value = -21. Switch Target Value = - ------------------Prm 22----------------- -22. Name = TapB -22. Num = 13 -22. Width = 22.5 -22. Type = Switch -22. Pos X = 80 -22. Pos Y = 140 -22. Style = -22. Value Font Size = -22. Custom Label = B -22. Font Size = -22. Slider Height = -22. BgClr = -22. GrbClr = -22. Label Pos = -22. Value Pos = -22. Lbl Clr = -22. V Clr = -22. Drag Direction = -22. Condition Param = 1|1=Quad| - -22. Condition Param2 = - -22. Condition Param3 = - -22. Condition Param4 = - -22. Condition Param5 = - -22. Decimal Rounding = -22. Value to Note Length = nil -22. Switch type = -22. Switch Base Value = -22. Switch Target Value = - ------------------Prm 23----------------- -23. Name = TapC -23. Num = 14 -23. Width = 22.5 -23. Type = Switch -23. Pos X = 110 -23. Pos Y = 140 -23. Style = -23. Value Font Size = -23. Custom Label = C -23. Font Size = -23. Slider Height = -23. BgClr = -23. GrbClr = -23. Label Pos = -23. Value Pos = -23. Lbl Clr = -23. V Clr = -23. Drag Direction = -23. Condition Param = 1|1=Quad| - -23. Condition Param2 = - -23. Condition Param3 = - -23. Condition Param4 = - -23. Condition Param5 = - -23. Decimal Rounding = -23. Value to Note Length = nil -23. Switch type = -23. Switch Base Value = -23. Switch Target Value = - ------------------Prm 24----------------- -24. Name = TapD -24. Num = 15 -24. Width = 22.5 -24. Type = Switch -24. Pos X = 140 -24. Pos Y = 140 -24. Style = -24. Value Font Size = -24. Custom Label = D -24. Font Size = -24. Slider Height = -24. BgClr = -24. GrbClr = -24. Label Pos = -24. Value Pos = -24. Lbl Clr = -24. V Clr = -24. Drag Direction = -24. Condition Param = 1|1=Quad| - -24. Condition Param2 = - -24. Condition Param3 = - -24. Condition Param4 = - -24. Condition Param5 = - -24. Decimal Rounding = -24. Value to Note Length = nil -24. Switch type = -24. Switch Base Value = -24. Switch Target Value = - ------------------Prm 25----------------- -25. Name = DelaySpacing -25. Num = 9 -25. Width = 26.5 -25. Type = Knob -25. Pos X = 110 -25. Pos Y = 40 -25. Style = Pro C -25. Value Font Size = -25. Custom Label = -25. Font Size = -25. Slider Height = -25. BgClr = 170 -25. GrbClr = -25. Label Pos = Top -25. Value Pos = Bottom -25. Lbl Clr = -25. V Clr = -25. Drag Direction = -25. Condition Param = 1|1=Quad| - -25. Condition Param2 = - -25. Condition Param3 = - -25. Condition Param4 = - -25. Condition Param5 = - -25. Decimal Rounding = -25. Value to Note Length = nil -25. Switch type = -25. Switch Base Value = -25. Switch Target Value = - ------------------Prm 26----------------- -26. Name = DelayRatio -26. Num = 10 -26. Width = 26.5 -26. Type = Knob -26. Pos X = 110 -26. Pos Y = 40 -26. Style = Pro C -26. Value Font Size = -26. Custom Label = Ratio -26. Font Size = -26. Slider Height = -26. BgClr = 170 -26. GrbClr = -26. Label Pos = Top -26. Value Pos = Bottom -26. Lbl Clr = -26. V Clr = -26. Drag Direction = -26. Condition Param = 1|1=Ratio| - -26. Condition Param2 = - -26. Condition Param3 = - -26. Condition Param4 = - -26. Condition Param5 = - -26. Decimal Rounding = -26. Value to Note Length = nil -26. Switch type = -26. Switch Base Value = -26. Switch Target Value = - ------------------Prm 27----------------- -27. Name = RepeatSwell -27. Num = 11 -27. Width = 42.5 -27. Type = Switch -27. Pos X = 116 -27. Pos Y = 106 -27. Style = -27. Value Font Size = -27. Custom Label = -27. Font Size = -27. Slider Height = -27. BgClr = 490962943 -27. GrbClr = -27. Label Pos = -27. Value Pos = Within -27. Lbl Clr = -27. V Clr = -27. Drag Direction = -27. Condition Param = 1|1=Quad| - -27. Condition Param2 = - -27. Condition Param3 = - -27. Condition Param4 = - -27. Condition Param5 = - -27. Decimal Rounding = -27. Value to Note Length = nil -27. Switch type = -27. Switch Base Value = -27. Switch Target Value = - ------------------Prm 28----------------- -28. Name = Wow -28. Num = 26 -28. Width = -28. Type = Knob -28. Pos X = 284.5 -28. Pos Y = 64 -28. Style = Pro C -28. Value Font Size = -28. Custom Label = -28. Font Size = -28. Slider Height = -28. BgClr = 255 -28. GrbClr = -28. Label Pos = Top -28. Value Pos = None -28. Lbl Clr = -28. V Clr = -28. Drag Direction = -28. Condition Param = 32|1=Tape|2=DuckTape| -28. Condition Param Norm = |1=0.04166666790843|2=0.41666665673256| -28. Condition Param2 = - -28. Condition Param3 = - -28. Condition Param4 = - -28. Condition Param5 = - -28. Decimal Rounding = -28. Value to Note Length = nil -28. Switch type = -28. Switch Base Value = -28. Switch Target Value = - ------------------Prm 29----------------- -29. Name = Flutter -29. Num = 27 -29. Width = -29. Type = Knob -29. Pos X = 284.5 -29. Pos Y = 9 -29. Style = Pro C -29. Value Font Size = -29. Custom Label = -29. Font Size = -29. Slider Height = -29. BgClr = 255 -29. GrbClr = -29. Label Pos = Top -29. Value Pos = None -29. Lbl Clr = -29. V Clr = -29. Drag Direction = -29. Condition Param = 32|1=DuckTape|2=Tape| -29. Condition Param Norm = |1=0.41666665673256|2=0.04166666790843| -29. Condition Param2 = - -29. Condition Param3 = - -29. Condition Param4 = - -29. Condition Param5 = - -29. Decimal Rounding = -29. Value to Note Length = nil -29. Switch type = -29. Switch Base Value = -29. Switch Target Value = - ------------------Prm 30----------------- -30. Name = ModRate -30. Num = 24 -30. Width = -30. Type = Knob -30. Pos X = 284 -30. Pos Y = 64 -30. Style = Pro C -30. Value Font Size = -30. Custom Label = Rate -30. Font Size = -30. Slider Height = -30. BgClr = 235802282 -30. GrbClr = -30. Label Pos = Top -30. Value Pos = None -30. Lbl Clr = -30. V Clr = -30. Drag Direction = -30. Condition Param = 32|1=BBDuck|2=HiFi|3=BBD|4=Digital|5=Clarity|6=Lofi| -30. Condition Param Norm = |1=0.33333334326744|2=0.08333333581686|3=0.125|4=0.16666667163372|5=0.375|6=0.5| -30. Condition Param2 = - -30. Condition Param3 = - -30. Condition Param4 = - -30. Condition Param5 = - -30. Decimal Rounding = -30. Value to Note Length = nil -30. Switch type = -30. Switch Base Value = -30. Switch Target Value = - ------------------Prm 31----------------- -31. Name = ModDepth -31. Num = 25 -31. Width = -31. Type = Knob -31. Pos X = 284 -31. Pos Y = 9 -31. Style = Pro C -31. Value Font Size = -31. Custom Label = Depth -31. Font Size = -31. Slider Height = -31. BgClr = 235802282 -31. GrbClr = -31. Label Pos = Top -31. Value Pos = None -31. Lbl Clr = -31. V Clr = -31. Drag Direction = -31. Condition Param = 32|1=BBDuck|2=HiFi|3=BBD|4=Digital|5=Clarity|6=Lofi| -31. Condition Param Norm = |1=0.33333334326744|2=0.08333333581686|3=0.125|4=0.16666667163372|5=0.375|6=0.5| -31. Condition Param2 = - -31. Condition Param3 = - -31. Condition Param4 = - -31. Condition Param5 = - -31. Decimal Rounding = -31. Value to Note Length = nil -31. Switch type = -31. Switch Base Value = -31. Switch Target Value = - ------------------Prm 32----------------- -32. Name = FreqDetune -32. Num = 29 -32. Width = -32. Type = Knob -32. Pos X = 284 -32. Pos Y = 64 -32. Style = Pro C -32. Value Font Size = -32. Custom Label = Detune -32. Font Size = -32. Slider Height = -32. BgClr = 170 -32. GrbClr = -32. Label Pos = Top -32. Value Pos = None -32. Lbl Clr = -32. V Clr = -32. Drag Direction = -32. Condition Param = 32|1=Ghost| -32. Condition Param Norm = |1=0.20833332836628| -32. Condition Param2 = - -32. Condition Param3 = - -32. Condition Param4 = - -32. Condition Param5 = - -32. Decimal Rounding = -32. Value to Note Length = nil -32. Switch type = -32. Switch Base Value = -32. Switch Target Value = - ------------------Prm 33----------------- -33. Name = FreqShift -33. Num = 28 -33. Width = -33. Type = Knob -33. Pos X = 284 -33. Pos Y = 9 -33. Style = Pro C -33. Value Font Size = -33. Custom Label = -33. Font Size = -33. Slider Height = -33. BgClr = 255 -33. GrbClr = -33. Label Pos = Top -33. Value Pos = None -33. Lbl Clr = -33. V Clr = -33. Drag Direction = -33. Condition Param = 32|1=Ghost| -33. Condition Param Norm = |1=0.20833332836628| -33. Condition Param2 = - -33. Condition Param3 = - -33. Condition Param4 = - -33. Condition Param5 = - -33. Decimal Rounding = -33. Value to Note Length = nil -33. Switch type = -33. Switch Base Value = -33. Switch Target Value = - ------------------Prm 34----------------- -34. Name = PitchShift -34. Num = 30 -34. Width = -34. Type = Knob -34. Pos X = 284 -34. Pos Y = 64 -34. Style = Pro C -34. Value Font Size = -34. Custom Label = -34. Font Size = -34. Slider Height = -34. BgClr = 255 -34. GrbClr = -34. Label Pos = Top -34. Value Pos = None -34. Lbl Clr = -34. V Clr = -34. Drag Direction = -34. Condition Param = 32|1=PitchDuck|2=Pitch|3=RevPitch| -34. Condition Param Norm = |1=0.45833334326744|2=0.25|3=0.29166665673256| -34. Condition Param2 = - -34. Condition Param3 = - -34. Condition Param4 = - -34. Condition Param5 = - -34. Decimal Rounding = -34. Value to Note Length = nil -34. Switch type = -34. Switch Base Value = -34. Switch Target Value = - ------------------Prm 35----------------- -35. Name = PitchDetune -35. Num = 31 -35. Width = -35. Type = Knob -35. Pos X = 284 -35. Pos Y = 9 -35. Style = Pro C -35. Value Font Size = -35. Custom Label = -35. Font Size = -35. Slider Height = -35. BgClr = 255 -35. GrbClr = -35. Label Pos = Top -35. Value Pos = None -35. Lbl Clr = -35. V Clr = -35. Drag Direction = -35. Condition Param = 32|1=PitchDuck|2=Pitch|3=RevPitch| -35. Condition Param Norm = |1=0.45833334326744|2=0.25|3=0.29166665673256| -35. Condition Param2 = - -35. Condition Param3 = - -35. Condition Param4 = - -35. Condition Param5 = - -35. Decimal Rounding = -35. Value to Note Length = nil -35. Switch type = -35. Switch Base Value = -35. Switch Target Value = - -========== Drawings ========== -Default Drawing Edge Rounding = 3.8 - -Total Number of Drawings = 7 -D1. Type = rect fill -D1. Left = -3 -D1. Right = 42 -D1. Top = 21 -D1. Bottom = 181 -D1. Color = 406808575 -D1. Text = - -D2. Type = rect fill -D2. Left = 46 -D2. Right = 167 -D2. Top = 22 -D2. Bottom = 180 -D2. Color = 406808575 -D2. Text = - -D3. Type = rect fill -D3. Left = 176 -D3. Right = 225 -D3. Top = 22 -D3. Bottom = 179 -D3. Color = 406808575 -D3. Text = - -D4. Type = rect fill -D4. Left = 229 -D4. Right = 275 -D4. Top = 0 -D4. Bottom = 100 -D4. Color = 406808575 -D4. Text = - -D5. Type = rect fill -D5. Left = 229 -D5. Right = 275 -D5. Top = 102 -D5. Bottom = 218 -D5. Color = 406808575 -D5. Text = - -D6. Type = rect fill -D6. Left = 280 -D6. Right = 327 -D6. Top = 102 -D6. Bottom = 218 -D6. Color = 221534719 -D6. Text = - -D7. Type = rect fill -D7. Left = 280 -D7. Right = 327 -D7. Top = 0 -D7. Bottom = 100 -D7. Color = 221534719 -D7. Text = - - - diff --git a/FX/BryanChi_FX Devices/FX Layouts/ValhallaFreqEcho (Valhalla DSP, LLC).ini b/FX/BryanChi_FX Devices/FX Layouts/ValhallaFreqEcho (Valhalla DSP, LLC).ini deleted file mode 100644 index 231fcba05..000000000 --- a/FX/BryanChi_FX Devices/FX Layouts/ValhallaFreqEcho (Valhalla DSP, LLC).ini +++ /dev/null @@ -1,295 +0,0 @@ -FX global settings - -Edge Rounding = 0 -Grb Rounding = 0 -BgClr = 727429872 -Window Width = 170 -Title Width = 120 -Title Clr = 572662323 -Custom Title = ValhallaFreqEcho -Param Instance = 8 - -Parameter Specific Settings - - ------------------Prm 1----------------- -1. Name = wetDry -1. Num = 0 -1. Width = 25 -1. Type = Knob -1. Pos X = 2 -1. Pos Y = 29 -1. Style = Pro C -1. Value Font Size = -1. Custom Label = Mix -1. Font Size = -1. Slider Height = -1. BgClr = 454761458 -1. GrbClr = -1. Label Pos = Top -1. Value Pos = Bottom -1. Lbl Clr = -1. V Clr = -1. Drag Direction = -1. Condition Param = - -1. Condition Param2 = - -1. Condition Param3 = - -1. Condition Param4 = - -1. Condition Param5 = - -1. Decimal Rounding = -1. Value to Note Length = nil -1. Switch type = -1. Switch Base Value = -1. Switch Target Value = - ------------------Prm 2----------------- -2. Name = shift -2. Num = 1 -2. Width = 34.5 -2. Type = Knob -2. Pos X = 19 -2. Pos Y = 102 -2. Style = Pro C -2. Value Font Size = 14 -2. Custom Label = -2. Font Size = 12.5 -2. Slider Height = -2. BgClr = -14 -2. GrbClr = 255 -2. Label Pos = Top -2. Value Pos = Bottom -2. Lbl Clr = -2. V Clr = -2. Drag Direction = -2. Condition Param = - -2. Condition Param2 = - -2. Condition Param3 = - -2. Condition Param4 = - -2. Condition Param5 = - -2. Decimal Rounding = -2. Value to Note Length = nil -2. Switch type = -2. Switch Base Value = -2. Switch Target Value = - ------------------Prm 3----------------- -3. Name = delay -3. Num = 2 -3. Width = 25 -3. Type = Knob -3. Pos X = 55 -3. Pos Y = 29 -3. Style = Pro C -3. Value Font Size = -3. Custom Label = -3. Font Size = -3. Slider Height = -3. BgClr = 454761458 -3. GrbClr = -3. Label Pos = Top -3. Value Pos = Bottom -3. Lbl Clr = -3. V Clr = -3. Drag Direction = -3. Condition Param = - -3. Condition Param2 = - -3. Condition Param3 = - -3. Condition Param4 = - -3. Condition Param5 = - -3. Decimal Rounding = -3. Value to Note Length = nil -3. Switch type = -3. Switch Base Value = -3. Switch Target Value = - ------------------Prm 4----------------- -4. Name = sync -4. Num = 3 -4. Width = 40 -4. Type = Selection -4. Pos X = 7 -4. Pos Y = 182 -4. Style = -4. Value Font Size = -4. Custom Label = Delay Sync: -4. Font Size = -4. Slider Height = -4. BgClr = -2139062272 -4. GrbClr = -4. Label Pos = Left -4. Value Pos = -4. Lbl Clr = -4. V Clr = -1 -4. Drag Direction = -4. Condition Param = - -4. Condition Param2 = - -4. Condition Param3 = - -4. Condition Param4 = - -4. Condition Param5 = - -4. Decimal Rounding = -4. Value to Note Length = nil -4. Switch type = -4. Switch Base Value = -4. Switch Target Value = -4. Manual V:1=0.043478261679411|2=0.086956523358822|3=0.13043478131294|4=0.17391304671764|5=0.21739129722118|6=0.26086956262589|7=0.30434781312943|8=0.34782609343529|9=0.43478259444237|10=0.47826087474823|11=0.52173912525177|12=0.56521737575531|13=0.60869562625885|14=0.65217393636703|15=0.69565218687057|16=0.73913043737411|17=0.78260868787766|18=0.8260869383812|19=0.86956518888474|20=0.91304349899292|21=0.95652174949646|22=1| -4. Manual Val format:1=Free|2=1/64|3=1/32|4=1/16|5=1/8|6=1/4|7=2/4|8=4/4|9=1/64.|10=1/32.|11=1/16.|12=1/8.|13=1/4.|14=2/4.|15=4/4.|16=1/64T|17=1/32T|18=1/16T|19=1/8T|20=1/4T|21=2/4T|22=4/4T| - ------------------Prm 5----------------- -5. Name = feedback -5. Num = 4 -5. Width = 19 -5. Type = Knob -5. Pos X = 121 -5. Pos Y = 30 -5. Style = Pro C -5. Value Font Size = -5. Custom Label = Feed -5. Font Size = -5. Slider Height = -5. BgClr = 454761458 -5. GrbClr = -5. Label Pos = Top -5. Value Pos = None -5. Lbl Clr = -5. V Clr = -5. Drag Direction = -5. Condition Param = - -5. Condition Param2 = - -5. Condition Param3 = - -5. Condition Param4 = - -5. Condition Param5 = - -5. Decimal Rounding = -5. Value to Note Length = nil -5. Switch type = -5. Switch Base Value = -5. Switch Target Value = - ------------------Prm 6----------------- -6. Name = lowCut -6. Num = 5 -6. Width = 19 -6. Type = Knob -6. Pos X = 121 -6. Pos Y = 84.5 -6. Style = Pro C -6. Value Font Size = -6. Custom Label = LoCut -6. Font Size = -6. Slider Height = -6. BgClr = 454761458 -6. GrbClr = -6. Label Pos = Top -6. Value Pos = None -6. Lbl Clr = -6. V Clr = -6. Drag Direction = -6. Condition Param = - -6. Condition Param2 = - -6. Condition Param3 = - -6. Condition Param4 = - -6. Condition Param5 = - -6. Decimal Rounding = -6. Value to Note Length = nil -6. Switch type = -6. Switch Base Value = -6. Switch Target Value = - ------------------Prm 7----------------- -7. Name = highCut -7. Num = 6 -7. Width = 19 -7. Type = Knob -7. Pos X = 120 -7. Pos Y = 139 -7. Style = Pro C -7. Value Font Size = -7. Custom Label = HiCut -7. Font Size = -7. Slider Height = -7. BgClr = 454761458 -7. GrbClr = -7. Label Pos = Top -7. Value Pos = None -7. Lbl Clr = -7. V Clr = -7. Drag Direction = -7. Condition Param = - -7. Condition Param2 = - -7. Condition Param3 = - -7. Condition Param4 = - -7. Condition Param5 = - -7. Decimal Rounding = -7. Value to Note Length = nil -7. Switch type = -7. Switch Base Value = -7. Switch Target Value = - ------------------Prm 8----------------- -8. Name = stereo -8. Num = 7 -8. Width = -8. Type = Switch -8. Pos X = -7 -8. Pos Y = 203 -8. Style = -8. Value Font Size = -8. Custom Label = Output Mode: -8. Font Size = -8. Slider Height = -8. BgClr = -8. GrbClr = -8. Label Pos = Left -8. Value Pos = Within -8. Lbl Clr = -8. V Clr = -8. Drag Direction = -8. Condition Param = - -8. Condition Param2 = - -8. Condition Param3 = - -8. Condition Param4 = - -8. Condition Param5 = - -8. Decimal Rounding = -8. Value to Note Length = nil -8. Switch type = -8. Switch Base Value = -8. Switch Target Value = diff --git a/FX/BryanChi_FX Devices/FX Layouts/ValhallaShimmer (Valhalla DSP, LLC).ini b/FX/BryanChi_FX Devices/FX Layouts/ValhallaShimmer (Valhalla DSP, LLC).ini deleted file mode 100644 index ed6795202..000000000 --- a/FX/BryanChi_FX Devices/FX Layouts/ValhallaShimmer (Valhalla DSP, LLC).ini +++ /dev/null @@ -1,443 +0,0 @@ -FX global settings - -Edge Rounding = 0 -Grb Rounding = 0 -BgClr = -909522448 -Window Width = 224 -Title Width = 190 -Title Clr = -Custom Title = -Param Instance = 12 - -Parameter Specific Settings - - ------------------Prm 1----------------- -1. Name = wetDry -1. Num = 0 -1. Width = 21 -1. Type = Knob -1. Pos X = 3 -1. Pos Y = 31 -1. Style = Pro C -1. Value Font Size = -1. Custom Label = Mix -1. Font Size = -1. Slider Height = -1. BgClr = 255 -1. GrbClr = -1 -1. Label Pos = Top -1. Value Pos = Bottom -1. Lbl Clr = 255 -1. V Clr = 255 -1. Drag Direction = -1. Condition Param = - -1. Condition Param2 = - -1. Condition Param3 = - -1. Condition Param4 = - -1. Condition Param5 = - -1. Decimal Rounding = -1. Value to Note Length = nil -1. Switch type = -1. Switch Base Value = -1. Switch Target Value = -1. Manual V:1=0.20000000298023|2=0.40000000596046|3=0.60000002384186|4=0.80000001192093|5=1| -1. Manual Val format:1=single|2=dual|3=singleReverse|4=dualReverse|5=bypass| - ------------------Prm 2----------------- -2. Name = shift -2. Num = 1 -2. Width = 21 -2. Type = Knob -2. Pos X = 3 -2. Pos Y = 96 -2. Style = Pro C -2. Value Font Size = -2. Custom Label = -2. Font Size = -2. Slider Height = -2. BgClr = 255 -2. GrbClr = -1 -2. Label Pos = Top -2. Value Pos = Bottom -2. Lbl Clr = 255 -2. V Clr = 255 -2. Drag Direction = -2. Condition Param = - -2. Condition Param2 = - -2. Condition Param3 = - -2. Condition Param4 = - -2. Condition Param5 = - -2. Decimal Rounding = -2. Value to Note Length = nil -2. Switch type = -2. Switch Base Value = -2. Switch Target Value = -2. Manual V:1=0|2=1| -2. Manual Val format:1=bright|2=dark| - ------------------Prm 3----------------- -3. Name = feedback -3. Num = 2 -3. Width = 21 -3. Type = Knob -3. Pos X = 3 -3. Pos Y = 161 -3. Style = Pro C -3. Value Font Size = -3. Custom Label = -3. Font Size = 8 -3. Slider Height = -3. BgClr = 255 -3. GrbClr = -1 -3. Label Pos = Top -3. Value Pos = Bottom -3. Lbl Clr = 255 -3. V Clr = 255 -3. Drag Direction = -3. Condition Param = - -3. Condition Param2 = - -3. Condition Param3 = - -3. Condition Param4 = - -3. Condition Param5 = - -3. Decimal Rounding = -3. Value to Note Length = nil -3. Switch type = -3. Switch Base Value = -3. Switch Target Value = - ------------------Prm 4----------------- -4. Name = diffusion -4. Num = 3 -4. Width = -4. Type = Knob -4. Pos X = 58.333251953125 -4. Pos Y = 31 -4. Style = Pro C -4. Value Font Size = -4. Custom Label = diff -4. Font Size = 10 -4. Slider Height = -4. BgClr = 1145324799 -4. GrbClr = -1 -4. Label Pos = Top -4. Value Pos = Bottom -4. Lbl Clr = 255 -4. V Clr = 255 -4. Drag Direction = -4. Condition Param = - -4. Condition Param2 = - -4. Condition Param3 = - -4. Condition Param4 = - -4. Condition Param5 = - -4. Decimal Rounding = -4. Value to Note Length = nil -4. Switch type = -4. Switch Base Value = -4. Switch Target Value = - ------------------Prm 5----------------- -5. Name = size -5. Num = 4 -5. Width = -5. Type = Knob -5. Pos X = 58.333251953125 -5. Pos Y = 101 -5. Style = Pro C -5. Value Font Size = -5. Custom Label = -5. Font Size = -5. Slider Height = -5. BgClr = 1145324799 -5. GrbClr = -1 -5. Label Pos = Top -5. Value Pos = Bottom -5. Lbl Clr = 255 -5. V Clr = 255 -5. Drag Direction = -5. Condition Param = - -5. Condition Param2 = - -5. Condition Param3 = - -5. Condition Param4 = - -5. Condition Param5 = - -5. Decimal Rounding = -5. Value to Note Length = nil -5. Switch type = -5. Switch Base Value = -5. Switch Target Value = - ------------------Prm 6----------------- -6. Name = lowCut -6. Num = 5 -6. Width = -6. Type = Knob -6. Pos X = 116.66674804688 -6. Pos Y = 31 -6. Style = Pro C -6. Value Font Size = -6. Custom Label = -6. Font Size = -6. Slider Height = -6. BgClr = 1566399999 -6. GrbClr = -1 -6. Label Pos = Top -6. Value Pos = Bottom -6. Lbl Clr = 255 -6. V Clr = 255 -6. Drag Direction = -6. Condition Param = - -6. Condition Param2 = - -6. Condition Param3 = - -6. Condition Param4 = - -6. Condition Param5 = - -6. Decimal Rounding = -6. Value to Note Length = nil -6. Switch type = -6. Switch Base Value = -6. Switch Target Value = - ------------------Prm 7----------------- -7. Name = highCut -7. Num = 6 -7. Width = -7. Type = Knob -7. Pos X = 116.66674804688 -7. Pos Y = 101 -7. Style = Pro C -7. Value Font Size = -7. Custom Label = Hi cut -7. Font Size = -7. Slider Height = -7. BgClr = 1566399999 -7. GrbClr = -1 -7. Label Pos = Top -7. Value Pos = Bottom -7. Lbl Clr = 255 -7. V Clr = 255 -7. Drag Direction = -7. Condition Param = - -7. Condition Param2 = - -7. Condition Param3 = - -7. Condition Param4 = - -7. Condition Param5 = - -7. Decimal Rounding = -7. Value to Note Length = nil -7. Switch type = -7. Switch Base Value = -7. Switch Target Value = - ------------------Prm 8----------------- -8. Name = modRate -8. Num = 7 -8. Width = -8. Type = Knob -8. Pos X = 175 -8. Pos Y = 31 -8. Style = Pro C -8. Value Font Size = -8. Custom Label = Rate -8. Font Size = -8. Slider Height = -8. BgClr = -1987474945 -8. GrbClr = -1 -8. Label Pos = Top -8. Value Pos = Bottom -8. Lbl Clr = 255 -8. V Clr = 255 -8. Drag Direction = -8. Condition Param = - -8. Condition Param2 = - -8. Condition Param3 = - -8. Condition Param4 = - -8. Condition Param5 = - -8. Decimal Rounding = -8. Value to Note Length = nil -8. Switch type = -8. Switch Base Value = -8. Switch Target Value = - ------------------Prm 9----------------- -9. Name = modDepth -9. Num = 8 -9. Width = -9. Type = Knob -9. Pos X = 175 -9. Pos Y = 101 -9. Style = Pro C -9. Value Font Size = -9. Custom Label = Depth -9. Font Size = -9. Slider Height = -9. BgClr = -1987474945 -9. GrbClr = -1 -9. Label Pos = Top -9. Value Pos = Bottom -9. Lbl Clr = 255 -9. V Clr = 255 -9. Drag Direction = -9. Condition Param = - -9. Condition Param2 = - -9. Condition Param3 = - -9. Condition Param4 = - -9. Condition Param5 = - -9. Decimal Rounding = -9. Value to Note Length = nil -9. Switch type = -9. Switch Base Value = -9. Switch Target Value = - ------------------Prm 10----------------- -10. Name = reverbMode -10. Num = 9 -10. Width = 90 -10. Type = Selection -10. Pos X = 68 -10. Pos Y = 199 -10. Style = -10. Value Font Size = -10. Custom Label = Rev Mode -10. Font Size = -10. Slider Height = -10. BgClr = -623191552 -10. GrbClr = -10. Label Pos = Left -10. Value Pos = -10. Lbl Clr = 255 -10. V Clr = 255 -10. Drag Direction = -10. Condition Param = - -10. Condition Param2 = - -10. Condition Param3 = - -10. Condition Param4 = - -10. Condition Param5 = - -10. Decimal Rounding = -10. Value to Note Length = nil -10. Switch type = -10. Switch Base Value = -10. Switch Target Value = -10. Manual V:1=0.25|2=0.5|3=0.75|4=1| -10. Manual Val format:1=mono|2=bigStereo|3=mediumStereo|4=smallStereo| - ------------------Prm 11----------------- -11. Name = shiftMode -11. Num = 10 -11. Width = 90 -11. Type = Selection -11. Pos X = 55 -11. Pos Y = 178 -11. Style = -11. Value Font Size = -11. Custom Label = pitch Mode -11. Font Size = -11. Slider Height = -11. BgClr = -623191552 -11. GrbClr = -11. Label Pos = Left -11. Value Pos = -11. Lbl Clr = 255 -11. V Clr = 255 -11. Drag Direction = -11. Condition Param = - -11. Condition Param2 = - -11. Condition Param3 = - -11. Condition Param4 = - -11. Condition Param5 = - -11. Decimal Rounding = -11. Value to Note Length = nil -11. Switch type = -11. Switch Base Value = -11. Switch Target Value = -11. Manual V:1=0.20000000298023|2=0.40000000596046|3=0.60000002384186|4=0.80000001192093|5=1| -11. Manual Val format:1=single|2=dual|3=singleReverse|4=dualReverse|5=bypass| - ------------------Prm 12----------------- -12. Name = colorMode -12. Num = 11 -12. Width = 89 -12. Type = Selection -12. Pos X = 55 -12. Pos Y = 157 -12. Style = -12. Value Font Size = -12. Custom Label = color Mode -12. Font Size = -12. Slider Height = -12. BgClr = -623191552 -12. GrbClr = -12. Label Pos = Left -12. Value Pos = -12. Lbl Clr = 255 -12. V Clr = 255 -12. Drag Direction = -12. Condition Param = - -12. Condition Param2 = - -12. Condition Param3 = - -12. Condition Param4 = - -12. Condition Param5 = - -12. Decimal Rounding = -12. Value to Note Length = nil -12. Switch type = -12. Switch Base Value = -12. Switch Target Value = -12. Manual V:1=0|2=1| -12. Manual Val format:1=bright|2=dark| diff --git a/FX/BryanChi_FX Devices/FX Layouts/ValhallaSupermassive (Valhalla DSP, LLC).ini b/FX/BryanChi_FX Devices/FX Layouts/ValhallaSupermassive (Valhalla DSP, LLC).ini deleted file mode 100644 index 6c54755b2..000000000 --- a/FX/BryanChi_FX Devices/FX Layouts/ValhallaSupermassive (Valhalla DSP, LLC).ini +++ /dev/null @@ -1,532 +0,0 @@ -FX global settings - -Edge Rounding = 2.49 -Grb Rounding = 0 -BgClr = 252645360 -Window Width = 332 -Title Width = 285 -Title Clr = 354845951 -Custom Title = Valhalla Supermassive -Param Instance = 13 - - - -Parameter Specific Settings - - ------------------Prm 1----------------- -1. Name = Mix -1. Num = 0 -1. Width = -1. Type = Knob -1. Pos X = 10 -1. Pos Y = 60 -1. Style = Pro C -1. Value Font Size = -1. Custom Label = -1. Font Size = -1. Slider Height = -1. BgClr = 170 -1. GrbClr = -1. Label Pos = Top -1. Value Pos = Bottom -1. Lbl Clr = -1. V Clr = -1. Drag Direction = -1. Condition Param = - -1. Condition Param2 = - -1. Condition Param3 = - -1. Condition Param4 = - -1. Condition Param5 = - -1. Decimal Rounding = -1. Value to Note Length = nil -1. Switch type = -1. Switch Base Value = -1. Switch Target Value = - ------------------Prm 2----------------- -2. Name = Width -2. Num = 8 -2. Width = -2. Type = Knob -2. Pos X = 10 -2. Pos Y = 130 -2. Style = Pro C -2. Value Font Size = -2. Custom Label = -2. Font Size = -2. Slider Height = -2. BgClr = 170 -2. GrbClr = -2. Label Pos = Top -2. Value Pos = Bottom -2. Lbl Clr = -2. V Clr = -2. Drag Direction = -2. Condition Param = - -2. Condition Param2 = - -2. Condition Param3 = - -2. Condition Param4 = - -2. Condition Param5 = - -2. Decimal Rounding = -2. Value to Note Length = nil -2. Switch type = -2. Switch Base Value = -2. Switch Target Value = - ------------------Prm 3----------------- -3. Name = DelayWarp -3. Num = 4 -3. Width = 25 -3. Type = Knob -3. Pos X = 70 -3. Pos Y = 120 -3. Style = Pro C -3. Value Font Size = -3. Custom Label = -3. Font Size = -3. Slider Height = -3. BgClr = 170 -3. GrbClr = -3. Label Pos = Top -3. Value Pos = Bottom -3. Lbl Clr = -3. V Clr = -3. Drag Direction = -3. Condition Param = - -3. Condition Param2 = - -3. Condition Param3 = - -3. Condition Param4 = - -3. Condition Param5 = - -3. Decimal Rounding = -3. Value to Note Length = nil -3. Switch type = -3. Switch Base Value = -3. Switch Target Value = - ------------------Prm 4----------------- -4. Name = Feedback -4. Num = 6 -4. Width = 20 -4. Type = Knob -4. Pos X = 150 -4. Pos Y = 50 -4. Style = Pro C -4. Value Font Size = -4. Custom Label = -4. Font Size = 9.5 -4. Slider Height = -4. BgClr = 170 -4. GrbClr = -4. Label Pos = Top -4. Value Pos = Bottom -4. Lbl Clr = -4. V Clr = -4. Drag Direction = -4. Condition Param = - -4. Condition Param2 = - -4. Condition Param3 = - -4. Condition Param4 = - -4. Condition Param5 = - -4. Decimal Rounding = -4. Value to Note Length = nil -4. Switch type = -4. Switch Base Value = -4. Switch Target Value = - ------------------Prm 5----------------- -5. Name = Density -5. Num = 7 -5. Width = 20 -5. Type = Knob -5. Pos X = 150 -5. Pos Y = 130 -5. Style = Pro C -5. Value Font Size = -5. Custom Label = -5. Font Size = -5. Slider Height = -5. BgClr = 170 -5. GrbClr = -5. Label Pos = Top -5. Value Pos = Bottom -5. Lbl Clr = -5. V Clr = -5. Drag Direction = -5. Condition Param = - -5. Condition Param2 = - -5. Condition Param3 = - -5. Condition Param4 = - -5. Condition Param5 = - -5. Decimal Rounding = -5. Value to Note Length = nil -5. Switch type = -5. Switch Base Value = -5. Switch Target Value = - ------------------Prm 6----------------- -6. Name = ModRate -6. Num = 11 -6. Width = -6. Type = Knob -6. Pos X = 210 -6. Pos Y = 60 -6. Style = Pro C -6. Value Font Size = -6. Custom Label = -6. Font Size = -6. Slider Height = -6. BgClr = 170 -6. GrbClr = -6. Label Pos = Top -6. Value Pos = Bottom -6. Lbl Clr = -6. V Clr = -6. Drag Direction = -6. Condition Param = - -6. Condition Param2 = - -6. Condition Param3 = - -6. Condition Param4 = - -6. Condition Param5 = - -6. Decimal Rounding = -6. Value to Note Length = nil -6. Switch type = -6. Switch Base Value = -6. Switch Target Value = - ------------------Prm 7----------------- -7. Name = ModDepth -7. Num = 12 -7. Width = -7. Type = Knob -7. Pos X = 210 -7. Pos Y = 130 -7. Style = Pro C -7. Value Font Size = -7. Custom Label = -7. Font Size = -7. Slider Height = -7. BgClr = 170 -7. GrbClr = -7. Label Pos = Top -7. Value Pos = Bottom -7. Lbl Clr = -7. V Clr = -7. Drag Direction = -7. Condition Param = - -7. Condition Param2 = - -7. Condition Param3 = - -7. Condition Param4 = - -7. Condition Param5 = - -7. Decimal Rounding = -7. Value to Note Length = nil -7. Switch type = -7. Switch Base Value = -7. Switch Target Value = - ------------------Prm 8----------------- -8. Name = HighCut -8. Num = 10 -8. Width = -8. Type = Knob -8. Pos X = 270 -8. Pos Y = 60 -8. Style = Pro C -8. Value Font Size = -8. Custom Label = -8. Font Size = -8. Slider Height = -8. BgClr = 170 -8. GrbClr = -8. Label Pos = Top -8. Value Pos = Bottom -8. Lbl Clr = -8. V Clr = -8. Drag Direction = -8. Condition Param = - -8. Condition Param2 = - -8. Condition Param3 = - -8. Condition Param4 = - -8. Condition Param5 = - -8. Decimal Rounding = -8. Value to Note Length = nil -8. Switch type = -8. Switch Base Value = -8. Switch Target Value = - ------------------Prm 9----------------- -9. Name = LowCut -9. Num = 9 -9. Width = -9. Type = Knob -9. Pos X = 270 -9. Pos Y = 130 -9. Style = Pro C -9. Value Font Size = -9. Custom Label = -9. Font Size = -9. Slider Height = -9. BgClr = 170 -9. GrbClr = -9. Label Pos = Top -9. Value Pos = Bottom -9. Lbl Clr = -9. V Clr = -9. Drag Direction = -9. Condition Param = - -9. Condition Param2 = - -9. Condition Param3 = - -9. Condition Param4 = - -9. Condition Param5 = - -9. Decimal Rounding = -9. Value to Note Length = nil -9. Switch type = -9. Switch Base Value = -9. Switch Target Value = - ------------------Prm 10----------------- -10. Name = DelaySync -10. Num = 1 -10. Width = 30 -10. Type = Selection -10. Pos X = 10 -10. Pos Y = 200 -10. Style = -10. Value Font Size = -10. Custom Label = -10. Font Size = -10. Slider Height = -10. BgClr = 977246463 -10. GrbClr = -10. Label Pos = -10. Value Pos = -10. Lbl Clr = -10. V Clr = -10. Drag Direction = -10. Condition Param = - -10. Condition Param2 = - -10. Condition Param3 = - -10. Condition Param4 = - -10. Condition Param5 = - -10. Decimal Rounding = -10. Value to Note Length = nil -10. Switch type = -10. Switch Base Value = -10. Switch Target Value = - ------------------Prm 11----------------- -11. Name = Clear -11. Num = 5 -11. Width = -11. Type = Switch -11. Pos X = 80 -11. Pos Y = 200 -11. Style = -11. Value Font Size = -11. Custom Label = -11. Font Size = -11. Slider Height = -11. BgClr = -50529110 -11. GrbClr = -11. Label Pos = -11. Value Pos = -11. Lbl Clr = 255 -11. V Clr = -11. Drag Direction = -11. Condition Param = - -11. Condition Param2 = - -11. Condition Param3 = - -11. Condition Param4 = - -11. Condition Param5 = - -11. Decimal Rounding = -11. Value to Note Length = nil -11. Switch type = -11. Switch Base Value = -11. Switch Target Value = - ------------------Prm 12----------------- -12. Name = Delay_Ms -12. Num = 3 -12. Width = 25 -12. Type = Knob -12. Pos X = 70 -12. Pos Y = 40 -12. Style = Pro C -12. Value Font Size = -12. Custom Label = -12. Font Size = -12. Slider Height = -12. BgClr = 170 -12. GrbClr = -12. Label Pos = Top -12. Value Pos = Bottom -12. Lbl Clr = -12. V Clr = -12. Drag Direction = -12. Condition Param = - -12. Condition Param2 = - -12. Condition Param3 = - -12. Condition Param4 = - -12. Condition Param5 = - -12. Decimal Rounding = -12. Value to Note Length = nil -12. Switch type = -12. Switch Base Value = -12. Switch Target Value = - ------------------Prm 13----------------- -13. Name = Mode -13. Num = 13 -13. Width = 160 -13. Type = Selection -13. Pos X = 120 -13. Pos Y = 200 -13. Style = -13. Value Font Size = -13. Custom Label = -13. Font Size = -13. Slider Height = -13. BgClr = 0 -13. GrbClr = -13. Label Pos = Left -13. Value Pos = -13. Lbl Clr = -13. V Clr = 977523711 -13. Drag Direction = -13. Condition Param = - -13. Condition Param2 = - -13. Condition Param3 = - -13. Condition Param4 = - -13. Condition Param5 = - -13. Decimal Rounding = -13. Value to Note Length = nil -13. Switch type = -13. Switch Base Value = -13. Switch Target Value = - -========== Drawings ========== -Default Drawing Edge Rounding = 7.15 - -Total Number of Drawings = 8 -D1. Type = rect fill -D1. Left = 61 -D1. Right = 129 -D1. Top = 23 -D1. Bottom = 196 -D1. Color = 977246463 -D1. Text = -D2. Type = rect fill -D2. Left = 7 -D2. Right = 48 -D2. Top = 47 -D2. Bottom = 196 -D2. Color = 977246463 -D2. Text = EQ -D3. Type = rect fill -D3. Left = 141 -D3. Right = 196 -D3. Top = 30 -D3. Bottom = 194 -D3. Color = 977246463 -D3. Text = -D4. Type = rect fill -D4. Left = 203 -D4. Right = 257 -D4. Top = 30 -D4. Bottom = 194 -D4. Color = 808747007 -D4. Text = -D5. Type = rect fill -D5. Left = 264 -D5. Right = 313 -D5. Top = 30 -D5. Bottom = 194 -D5. Color = 657157119 -D5. Text = -D6. Type = Text -D6. Left = 280 -D6. Right = 280 -D6. Top = 34 -D6. Bottom = 31 -D6. Color = -1 -D6. Text = EQ -D7. Type = Text -D7. Left = 217 -D7. Right = 217 -D7. Top = 34 -D7. Bottom = 31 -D7. Color = -1 -D7. Text = MOD -D8. Type = Text -D8. Left = 257 -D8. Right = 222 -D8. Top = 62 -D8. Bottom = 59 -D8. Color = 977246463 -D8. Text = -. Text = diff --git a/FX/BryanChi_FX Devices/FX Layouts/ValhallaVintageVerb (Valhalla DSP, LLC).ini b/FX/BryanChi_FX Devices/FX Layouts/ValhallaVintageVerb (Valhalla DSP, LLC).ini deleted file mode 100644 index eb288339a..000000000 --- a/FX/BryanChi_FX Devices/FX Layouts/ValhallaVintageVerb (Valhalla DSP, LLC).ini +++ /dev/null @@ -1,725 +0,0 @@ -FX global settings - -Edge Rounding = 0 -Grb Rounding = 0 -BgClr = 823268095 -Window Width = 408 -Title Width = 365 -Title Clr = 823268095 -Custom Title = ValhallaVintageVerb -Param Instance = 17 - -Parameter Specific Settings - - ------------------Prm 1----------------- -1. Name = ReverbMode -1. Num = 16 -1. Width = 105 -1. Type = Selection -1. Pos X = 10 -1. Pos Y = 190 -1. Style = Pro C -1. Value Font Size = -1. Custom Label = Mode: -1. Font Size = -1. Slider Height = -1. BgClr = -1116046848 -1. GrbClr = -1. Label Pos = Left -1. Value Pos = -1. Lbl Clr = -1. V Clr = -6815489 -1. Drag Direction = -1. Condition Param = - -1. Condition Param2 = - -1. Condition Param3 = - -1. Condition Param4 = - -1. Condition Param5 = - -1. Decimal Rounding = -1. Value to Note Length = nil -1. Switch type = -1. Switch Base Value = -1. Switch Target Value = - ------------------Prm 2----------------- -2. Name = Mix -2. Num = 0 -2. Width = -2. Type = Knob -2. Pos X = 0 -2. Pos Y = 35 -2. Style = Pro C -2. Value Font Size = -2. Custom Label = -2. Font Size = -2. Slider Height = -2. BgClr = -9568038 -2. GrbClr = -2. Label Pos = Top -2. Value Pos = Bottom -2. Lbl Clr = -2. V Clr = -2. Drag Direction = -2. Condition Param = - -2. Condition Param2 = - -2. Condition Param3 = - -2. Condition Param4 = - -2. Condition Param5 = - -2. Decimal Rounding = 0 -2. Value to Note Length = nil -2. Switch type = -2. Switch Base Value = -2. Switch Target Value = - ------------------Prm 3----------------- -3. Name = PreDelay -3. Num = 1 -3. Width = -3. Type = Knob -3. Pos X = 0 -3. Pos Y = 116 -3. Style = Pro C -3. Value Font Size = -3. Custom Label = -3. Font Size = -3. Slider Height = -3. BgClr = -9568038 -3. GrbClr = -3. Label Pos = Top -3. Value Pos = Bottom -3. Lbl Clr = -3. V Clr = -3. Drag Direction = -3. Condition Param = - -3. Condition Param2 = - -3. Condition Param3 = - -3. Condition Param4 = - -3. Condition Param5 = - -3. Decimal Rounding = -3. Value to Note Length = nil -3. Switch type = -3. Switch Base Value = -3. Switch Target Value = - ------------------Prm 4----------------- -4. Name = Decay -4. Num = 2 -4. Width = 23.5 -4. Type = Knob -4. Pos X = 51 -4. Pos Y = 65 -4. Style = Pro C -4. Value Font Size = 10.75 -4. Custom Label = -4. Font Size = -4. Slider Height = -4. BgClr = 170 -4. GrbClr = -4. Label Pos = Top -4. Value Pos = Bottom -4. Lbl Clr = -4. V Clr = -4. Drag Direction = -4. Condition Param = - -4. Condition Param2 = - -4. Condition Param3 = - -4. Condition Param4 = - -4. Condition Param5 = - -4. Decimal Rounding = -4. Value to Note Length = nil -4. Switch type = -4. Switch Base Value = -4. Switch Target Value = - ------------------Prm 5----------------- -5. Name = HighFreq -5. Num = 8 -5. Width = 15.5 -5. Type = Knob -5. Pos X = 126 -5. Pos Y = 53.2 -5. Style = Pro C -5. Value Font Size = -5. Custom Label = HiFreq -5. Font Size = 9 -5. Slider Height = -5. BgClr = -188923954 -5. GrbClr = -5. Label Pos = Top -5. Value Pos = Bottom -5. Lbl Clr = -5. V Clr = -5. Drag Direction = -5. Condition Param = - -5. Condition Param2 = - -5. Condition Param3 = - -5. Condition Param4 = - -5. Condition Param5 = - -5. Decimal Rounding = -5. Value to Note Length = nil -5. Switch type = -5. Switch Base Value = -5. Switch Target Value = - ------------------Prm 6----------------- -6. Name = BassXover -6. Num = 6 -6. Width = 15.5 -6. Type = Knob -6. Pos X = 126 -6. Pos Y = 130 -6. Style = Pro C -6. Value Font Size = -6. Custom Label = Freq -6. Font Size = -6. Slider Height = -6. BgClr = -188923954 -6. GrbClr = -6. Label Pos = Top -6. Value Pos = Bottom -6. Lbl Clr = -6. V Clr = -6. Drag Direction = -6. Condition Param = - -6. Condition Param2 = - -6. Condition Param3 = - -6. Condition Param4 = - -6. Condition Param5 = - -6. Decimal Rounding = -6. Value to Note Length = nil -6. Switch type = -6. Switch Base Value = -6. Switch Target Value = - ------------------Prm 7----------------- -7. Name = HighShelf -7. Num = 7 -7. Width = 15.5 -7. Type = Knob -7. Pos X = 167 -7. Pos Y = 53.2 -7. Style = Pro C -7. Value Font Size = -7. Custom Label = Shelf -7. Font Size = -7. Slider Height = -7. BgClr = -188923954 -7. GrbClr = -7. Label Pos = Top -7. Value Pos = Bottom -7. Lbl Clr = -7. V Clr = -7. Drag Direction = -7. Condition Param = - -7. Condition Param2 = - -7. Condition Param3 = - -7. Condition Param4 = - -7. Condition Param5 = - -7. Decimal Rounding = -7. Value to Note Length = nil -7. Switch type = -7. Switch Base Value = -7. Switch Target Value = - ------------------Prm 8----------------- -8. Name = BassMult -8. Num = 5 -8. Width = 15.5 -8. Type = Knob -8. Pos X = 167 -8. Pos Y = 130 -8. Style = Pro C -8. Value Font Size = -8. Custom Label = Mult -8. Font Size = -8. Slider Height = -8. BgClr = -188923954 -8. GrbClr = -8. Label Pos = Top -8. Value Pos = Bottom -8. Lbl Clr = -8. V Clr = -8. Drag Direction = -8. Condition Param = - -8. Condition Param2 = - -8. Condition Param3 = - -8. Condition Param4 = - -8. Condition Param5 = - -8. Decimal Rounding = -8. Value to Note Length = nil -8. Switch type = -8. Switch Base Value = -8. Switch Target Value = - ------------------Prm 9----------------- -9. Name = Size -9. Num = 3 -9. Width = 15.5 -9. Type = Knob -9. Pos X = 214 -9. Pos Y = 58 -9. Style = Pro C -9. Value Font Size = -9. Custom Label = -9. Font Size = -9. Slider Height = -9. BgClr = -6678358 -9. GrbClr = -9. Label Pos = Top -9. Value Pos = Bottom -9. Lbl Clr = -9. V Clr = -9. Drag Direction = -9. Condition Param = - -9. Condition Param2 = - -9. Condition Param3 = - -9. Condition Param4 = - -9. Condition Param5 = - -9. Decimal Rounding = 0 -9. Value to Note Length = nil -9. Switch type = -9. Switch Base Value = -9. Switch Target Value = - ------------------Prm 10----------------- -10. Name = Attack -10. Num = 4 -10. Width = 15.5 -10. Type = Knob -10. Pos X = 214 -10. Pos Y = 120 -10. Style = Pro C -10. Value Font Size = -10. Custom Label = -10. Font Size = -10. Slider Height = -10. BgClr = -6678358 -10. GrbClr = -10. Label Pos = Top -10. Value Pos = Bottom -10. Lbl Clr = -10. V Clr = -10. Drag Direction = -10. Condition Param = - -10. Condition Param2 = - -10. Condition Param3 = - -10. Condition Param4 = - -10. Condition Param5 = - -10. Decimal Rounding = 0 -10. Value to Note Length = nil -10. Switch type = -10. Switch Base Value = -10. Switch Target Value = - ------------------Prm 11----------------- -11. Name = EarlyDiffusion -11. Num = 9 -11. Width = 15.5 -11. Type = Knob -11. Pos X = 262.66662597656 -11. Pos Y = 58 -11. Style = Pro C -11. Value Font Size = -11. Custom Label = Early -11. Font Size = -11. Slider Height = -11. BgClr = -9568038 -11. GrbClr = -11. Label Pos = Top -11. Value Pos = Bottom -11. Lbl Clr = -11. V Clr = -11. Drag Direction = -11. Condition Param = - -11. Condition Param2 = - -11. Condition Param3 = - -11. Condition Param4 = - -11. Condition Param5 = - -11. Decimal Rounding = 0 -11. Value to Note Length = nil -11. Switch type = -11. Switch Base Value = -11. Switch Target Value = - ------------------Prm 12----------------- -12. Name = LateDiffusion -12. Num = 10 -12. Width = 15.5 -12. Type = Knob -12. Pos X = 262.66662597656 -12. Pos Y = 120 -12. Style = Pro C -12. Value Font Size = -12. Custom Label = Late -12. Font Size = -12. Slider Height = -12. BgClr = -9568038 -12. GrbClr = -12. Label Pos = Top -12. Value Pos = Bottom -12. Lbl Clr = -12. V Clr = -12. Drag Direction = -12. Condition Param = - -12. Condition Param2 = - -12. Condition Param3 = - -12. Condition Param4 = - -12. Condition Param5 = - -12. Decimal Rounding = 0 -12. Value to Note Length = nil -12. Switch type = -12. Switch Base Value = -12. Switch Target Value = - ------------------Prm 13----------------- -13. Name = ModRate -13. Num = 11 -13. Width = 15.5 -13. Type = Knob -13. Pos X = 311.33337402344 -13. Pos Y = 58 -13. Style = Pro C -13. Value Font Size = -13. Custom Label = Rate -13. Font Size = -13. Slider Height = -13. BgClr = -194694486 -13. GrbClr = -13. Label Pos = Top -13. Value Pos = Bottom -13. Lbl Clr = -13. V Clr = -13. Drag Direction = -13. Condition Param = - -13. Condition Param2 = - -13. Condition Param3 = - -13. Condition Param4 = - -13. Condition Param5 = - -13. Decimal Rounding = -13. Value to Note Length = nil -13. Switch type = -13. Switch Base Value = -13. Switch Target Value = - ------------------Prm 14----------------- -14. Name = ModDepth -14. Num = 12 -14. Width = 15.5 -14. Type = Knob -14. Pos X = 311.33337402344 -14. Pos Y = 120 -14. Style = Pro C -14. Value Font Size = -14. Custom Label = Depth -14. Font Size = -14. Slider Height = -14. BgClr = -194694486 -14. GrbClr = -14. Label Pos = Top -14. Value Pos = Bottom -14. Lbl Clr = -14. V Clr = -14. Drag Direction = -14. Condition Param = - -14. Condition Param2 = - -14. Condition Param3 = - -14. Condition Param4 = - -14. Condition Param5 = - -14. Decimal Rounding = 0 -14. Value to Note Length = nil -14. Switch type = -14. Switch Base Value = -14. Switch Target Value = - ------------------Prm 15----------------- -15. Name = HighCut -15. Num = 13 -15. Width = 15.5 -15. Type = Knob -15. Pos X = 360 -15. Pos Y = 58 -15. Style = Pro C -15. Value Font Size = -15. Custom Label = HiCut -15. Font Size = -15. Slider Height = -15. BgClr = -520093526 -15. GrbClr = -15. Label Pos = Top -15. Value Pos = Bottom -15. Lbl Clr = -15. V Clr = -15. Drag Direction = -15. Condition Param = - -15. Condition Param2 = - -15. Condition Param3 = - -15. Condition Param4 = - -15. Condition Param5 = - -15. Decimal Rounding = -15. Value to Note Length = nil -15. Switch type = -15. Switch Base Value = -15. Switch Target Value = - ------------------Prm 16----------------- -16. Name = LowCut -16. Num = 14 -16. Width = 15.5 -16. Type = Knob -16. Pos X = 360 -16. Pos Y = 120 -16. Style = Pro C -16. Value Font Size = -16. Custom Label = LowCut -16. Font Size = -16. Slider Height = -16. BgClr = -520093526 -16. GrbClr = -16. Label Pos = Top -16. Value Pos = Bottom -16. Lbl Clr = -16. V Clr = -16. Drag Direction = -16. Condition Param = - -16. Condition Param2 = - -16. Condition Param3 = - -16. Condition Param4 = - -16. Condition Param5 = - -16. Decimal Rounding = -16. Value to Note Length = nil -16. Switch type = -16. Switch Base Value = -16. Switch Target Value = - ------------------Prm 17----------------- -17. Name = ColorMode -17. Num = 15 -17. Width = 120 -17. Type = Selection -17. Pos X = 210 -17. Pos Y = 190 -17. Style = -17. Value Font Size = -17. Custom Label = Color: -17. Font Size = -17. Slider Height = -17. BgClr = 1145324544 -17. GrbClr = -17. Label Pos = Left -17. Value Pos = -17. Lbl Clr = -17. V Clr = -6815489 -17. Drag Direction = -17. Condition Param = - -17. Condition Param2 = - -17. Condition Param3 = - -17. Condition Param4 = - -17. Condition Param5 = - -17. Decimal Rounding = -17. Value to Note Length = nil -17. Switch type = -17. Switch Base Value = -17. Switch Target Value = - -========== Drawings ========== -Default Drawing Edge Rounding = 5.85 - -Total Number of Drawings = 14 -D1. Type = rectangle -D1. Left = 118 -D1. Right = 204 -D1. Top = 25 -D1. Bottom = 187 -D1. Color = -647169 -D1. Text = DAMPING - -D2. Type = rectangle -D2. Left = 207 -D2. Right = 251 -D2. Top = 25 -D2. Bottom = 187 -D2. Color = -5496833 -D2. Text = MOD - -D3. Type = rectangle -D3. Left = 254 -D3. Right = 301 -D3. Top = 25 -D3. Bottom = 187 -D3. Color = -6815489 -D3. Text = - -D4. Type = rectangle -D4. Left = 305 -D4. Right = 348 -D4. Top = 25 -D4. Bottom = 187 -D4. Color = -12442113 -D4. Text = - -D5. Type = rectangle -D5. Left = 354 -D5. Right = 397 -D5. Top = 25 -D5. Bottom = 187 -D5. Color = -788199937 -D5. Text = - -D6. Type = Text -D6. Left = 141 -D6. Right = 138 -D6. Top = 25 -D6. Bottom = 22 -D6. Color = -1 -D6. Text = DAMPING - -D7. Type = Text -D7. Left = 214 -D7. Right = 214 -D7. Top = 26 -D7. Bottom = 23 -D7. Color = -1 -D7. Text = SHAPE - -D8. Type = Text -D8. Left = 267 -D8. Right = 267 -D8. Top = 26 -D8. Bottom = 23 -D8. Color = -1 -D8. Text = DIFF - -D9. Type = Text -D9. Left = 316 -D9. Right = 316 -D9. Top = 26 -D9. Bottom = 23 -D9. Color = -1 -D9. Text = MOD - -D10. Type = Text -D10. Left = 369 -D10. Right = 300 -D10. Top = 26 -D10. Bottom = 23 -D10. Color = -1 -D10. Text = EQ - -D11. Type = Text -D11. Left = 341 -D11. Right = 310 -D11. Top = 115 -D11. Bottom = 112 -D11. Color = -788199937 -D11. Text = - -D12. Type = circle fill -D12. Left = 74.5 -D12. Right = 27 -D12. Top = 88.5 -D12. Bottom = 117 -D12. Color = -50653896 -D12. Text = - -D13. Type = circle fill -D13. Left = 74 -D13. Right = 33 -D13. Top = 88 -D13. Bottom = 87 -D13. Color = -54717126 -D13. Text = - -D14. Type = circle fill -D14. Left = 74 -D14. Right = 37 -D14. Top = 88 -D14. Bottom = 85 -D14. Color = -58714817 -D14. Text = - diff --git a/FX/BryanChi_FX Devices/FXD (Mix)RackMixer.jsfx b/FX/BryanChi_FX Devices/FXD (Mix)RackMixer.jsfx deleted file mode 100644 index b5d5870d9..000000000 --- a/FX/BryanChi_FX Devices/FXD (Mix)RackMixer.jsfx +++ /dev/null @@ -1,534 +0,0 @@ -noindex: true - -desc: FXD (Mix)RackMixer - -/* -Short Description: -CP is channel pair, aka chain(1/2,3/4 etc) -Power = 0, 1 (Off,On) -Vol = -60 .. 30 (dB) -Pan = -100 ... 100 (L<>R) -Phase = 0, 1 (Normal, Inverted) -Solo = 0, 1 (Not soloed, Soloed) -SumMode = Sum - станд. сложение, SumMode = Average - сумма делится на кол-во активных каналов. -In functions names - CP = chan pair, 1 = 1/2; 2 = 3/4 etc -*/ - -//============================================================================== -//-- CP 1 - 4 ---------------- -slider1:Out1.Power=1<0,1,1{Off,On}>-Power 1 -slider2:Out1.Vol=0<-60,12,0.1>-Vol 1 -slider3:Out1.Pan=0<-100,100,0.1>-Pan 1 -slider4:Out1.Phase=0<0,1,1{Normal,Inverted}>-Phase 1 -slider5:Out1.Solo=0<0,1,1{Not soloed,Soloed}>-Solo 1 - -slider6:Out2.Power=1<0,1,1{Off,On}>-Power 2 -slider7:Out2.Vol=0<-60,12,0.1>-Vol 2 -slider8:Out2.Pan=0<-100,100,0.1>-Pan 2 -slider9:Out2.Phase=0<0,1,1{Normal,Inverted}>-Phase 2 -slider10:Out2.Solo=0<0,1,1{Not soloed,Soloed}>-Solo 2 - -slider11:Out3.Power=0<0,1,1{Off,On}>-Power 3 -slider12:Out3.Vol=0<-60,12,0.1>-Vol 3 -slider13:Out3.Pan=0<-100,100,0.1>-Pan 3 -slider14:Out3.Phase=0<0,1,1{Normal,Inverted}>-Phase 3 -slider15:Out3.Solo=0<0,1,1{Not soloed,Soloed}>-Solo 3 - -slider16:Out4.Power=0<0,1,1{Off,On}>-Power 4 -slider17:Out4.Vol=0<-60,12,0.1>-Vol 4 -slider18:Out4.Pan=0<-100,100,0.1>-Pan 4 -slider19:Out4.Phase=0<0,1,1{Normal,Inverted}>-Phase 4 -slider20:Out4.Solo=0<0,1,1{Not soloed,Soloed}>-Solo 4 - -//-- CP 5 - 8 ---------------- -slider21:Out5.Power=0<0,1,1{Off,On}>-Power 5 -slider22:Out5.Vol=0<-60,12,0.1>-Vol 5 -slider23:Out5.Pan=0<-100,100,0.1>-Pan 5 -slider24:Out5.Phase=0<0,1,1{Normal,Inverted}>-Phase 5 -slider25:Out5.Solo=0<0,1,1{Not soloed,Soloed}>-Solo 5 - -slider26:Out6.Power=0<0,1,1{Off,On}>-Power 6 -slider27:Out6.Vol=0<-60,12,0.1>-Vol 6 -slider28:Out6.Pan=0<-100,100,0.1>-Pan 6 -slider29:Out6.Phase=0<0,1,1{Normal,Inverted}>-Phase 6 -slider30:Out6.Solo=0<0,1,1{Not soloed,Soloed}>-Solo 6 - -slider31:Out7.Power=0<0,1,1{Off,On}>-Power 7 -slider32:Out7.Vol=0<-60,12,0.1>-Vol 7 -slider33:Out7.Pan=0<-100,100,0.1>-Pan 7 -slider34:Out7.Phase=0<0,1,1{Normal,Inverted}>-Phase 7 -slider35:Out7.Solo=0<0,1,1{Not soloed,Soloed}>-Solo 7 - -slider36:Out8.Power=0<0,1,1{Off,On}>-Power 8 -slider37:Out8.Vol=0<-60,12,0.1>-Vol 8 -slider38:Out8.Pan=0<-100,100,0.1>-Pan 8 -slider39:Out8.Phase=0<0,1,1{Normal,Inverted}>-Phase 8 -slider40:Out8.Solo=0<0,1,1{Not soloed,Soloed}>-Solo 8 - -//-- SumMode ------- -slider41:SumMode=0<0,1,1{Average,Summing>-SumMode - -//-- Cur Preset ---- -slider42:RWMode=0<0,2,1{Read from JS memory, Write to JS memory, ClearMemory}>-Memory RWMode -slider43:mempos=0<0,255,1>-Memory Position -slider44:memval=0<0,255,1>-Memory Value - - -//-- Inputs -------- -in_pin:in 1 L -in_pin:in 1 R -in_pin:in 2 L -in_pin:in 2 R -in_pin:in 3 L -in_pin:in 3 R -in_pin:in 4 L -in_pin:in 4 R - -in_pin:in 5 L -in_pin:in 5 R -in_pin:in 6 L -in_pin:in 6 R -in_pin:in 7 L -in_pin:in 7 R -in_pin:in 8 L -in_pin:in 8 R - -//-- Outputs ------- -out_pin:output L -out_pin:output R - - -@init -gfx_clear = 0x180E01; // bg color -col1 = 0xB9C1D4; // controls color - -membuf = 0; // memory(for preset name) -membuf_sz = 255; // memory max size - - -//-- Mouse ----------------------------- -//-- if point(p_x, p_y) in rect(x,y,w,h) area ---- -function pointINrect(p_x,p_y, x,y,w,h) ( p_x>=x && p_x<=x+w && p_y>=y && p_y<=y+h; ); -//-- if mouse cursor in rect(x,y,w,h) area ------- -function mouseINrect(x,y,w,h) ( pointINrect(mouse_x, mouse_y, x,y,w,h); ); -//-- Left Mouse Button --------------------------- -function mouseDown(x,y,w,h) ( mouse_down && mouseINrect(x,y,w,h); ); - -//-- Set RRGGBB color ------------------ -function SetRGB(RGB) -( - gfx_r = (RGB & 0xFF0000) / 16711680; // 256*256*255 - gfx_g = (RGB & 0x00FF00) / 65280; // 256*255 - gfx_b = (RGB & 0x0000FF) / 255; // 255 - gfx_a = 1 -); - -//-------------------------------------- -function minmax(x, minv, maxv) -( - min(max(x, minv), maxv); -); - -//-------------------------------------- -function DB2VAL(x) -( - exp((x)*0.11512925464970228420089957273422); -); - -//-------------------------------------- -//-- String from/to memory functions --- -//-------------------------------------- -function ClearMemory() -( - memset(membuf, 0, membuf_sz); -); -//-------- -function ReadFromMemory() -( - memval = membuf[mempos]; -); -//-------- -function WriteToMemory() -( - membuf[mempos] = memval; -); -//-------- -function SerializeMemory() -( - file_mem(0, membuf, membuf_sz); -); -//-------- -function DrawStringFromMemory() // For tests - local(i, char) -( - SetRGB(col1); - i = 1; // Read from 1 - gfx_x = 20; gfx_y = 2; - gfx_drawstr("FXRack Preset: "); - while( (char = membuf[i]) && i <= membuf_sz) - ( - gfx_drawchar(char); - i+=1; - ); -); - -//-------------------------------------- -//-- Mixer functions ------------------- -//-------------------------------------- -function CPOut_Init() - instance(Vol, Pan, src_vol, src_pan, tgt_vol, tgt_pan) -( - src_vol = tgt_vol = DB2VAL(Vol); - src_pan = tgt_pan = Pan*0.01; -); -//-------- -function CPOut_Slider() - instance(Vol, Pan, Phase, Power, Solo, tgt_vol, tgt_pan) -( - tgt_vol = tgt_pan = 0; - Power && (Solo || AllSolo) ? ( - tgt_vol = DB2VAL(Vol); - Phase ? tgt_vol *= -1; - tgt_pan = Pan*0.01; - ); -); -//-------- -function CPOut_Block() - instance(d_vol,d_pan, tvol,tpan, src_vol,src_pan, tgt_vol,tgt_pan) -( - d_vol = (tgt_vol-src_vol)/samplesblock; - d_pan = (tgt_pan-src_pan)/samplesblock; - tvol = src_vol; - tpan = src_pan; - src_vol = tgt_vol; - src_pan = tgt_pan; -); -//-------- -function CPOut_Sample() - instance(d_vol, d_pan, tvol, tpan, L, R) -( - tvol += d_vol; - tpan += d_pan; - - L = R = tvol; - tpan > 0.0 ? L *= 1.0-tpan; - tpan < 0.0 ? R *= 1.0+tpan; -); - -//-------------------------------------- -function Mixer_Init() -( - Out1.CPOut_Init(); - Out2.CPOut_Init(); - Out3.CPOut_Init(); - Out4.CPOut_Init(); - Out5.CPOut_Init(); - Out6.CPOut_Init(); - Out7.CPOut_Init(); - Out8.CPOut_Init(); -); - -//-------------------------------------- -function MixVolAverage() -( - // сумма активных каналов - Power && (Solo || AllSolo) - ActSum = 0; - Out1.Power && (Out1.Solo || AllSolo) ? ActSum+=1; - Out2.Power && (Out2.Solo || AllSolo) ? ActSum+=1; - Out3.Power && (Out3.Solo || AllSolo) ? ActSum+=1; - Out4.Power && (Out4.Solo || AllSolo) ? ActSum+=1; - Out5.Power && (Out5.Solo || AllSolo) ? ActSum+=1; - Out6.Power && (Out6.Solo || AllSolo) ? ActSum+=1; - Out7.Power && (Out7.Solo || AllSolo) ? ActSum+=1; - Out8.Power && (Out8.Solo || AllSolo) ? ActSum+=1; - ActSum > 0 ? MixVol = 1/ActSum : MixVol = 0; // ret average -); - -//-------------------------------------- -function Mixer_Slider() -( - // All Soloed = No Soloed - AllSolo = !(Out1.Solo + Out2.Solo + Out3.Solo + Out4.Solo + - Out5.Solo + Out6.Solo + Out7.Solo + Out8.Solo); - - Out1.CPOut_Slider(); - Out2.CPOut_Slider(); - Out3.CPOut_Slider(); - Out4.CPOut_Slider(); - Out5.CPOut_Slider(); - Out6.CPOut_Slider(); - Out7.CPOut_Slider(); - Out8.CPOut_Slider(); - - SumMode == 1 ? MixVol = 1 : MixVol = MixVolAverage(); - -); - -//-------------------------------------- -function Mixer_Block() -( - Out1.CPOut_Block(); - Out2.CPOut_Block(); - Out3.CPOut_Block(); - Out4.CPOut_Block(); - Out5.CPOut_Block(); - Out6.CPOut_Block(); - Out7.CPOut_Block(); - Out8.CPOut_Block(); -); - -//-------------------------------------- -function Mixer_Sample() -( - Out1.CPOut_Sample(); - Out2.CPOut_Sample(); - Out3.CPOut_Sample(); - Out4.CPOut_Sample(); - Out5.CPOut_Sample(); - Out6.CPOut_Sample(); - Out7.CPOut_Sample(); - Out8.CPOut_Sample(); -); - - -//-------------------------------------- -//-------------------------------------- -Mixer_Init(); - - -@slider -Mixer_Slider(); // Update if sliders changed - -// For Read/Write Preset Name from/to Script -RWMode == 0 ? ReadFromMemory() : -RWMode == 1 ? WriteToMemory() : -RWMode == 2 ? ClearMemory(); - -@serialize -SerializeMemory(); // serialize membuf - -@block -Mixer_Block(); - -@sample -Mixer_Sample(); - -spl0 = ( (spl0 * Out1.L) + (spl2 * Out2.L) + (spl4 * Out3.L) + (spl6 * Out4.L) + - (spl8 * Out5.L) + (spl10 * Out6.L) + (spl12 * Out7.L) + (spl14 * Out8.L) ) * MixVol; - -spl1 = ( (spl1 * Out1.R) + (spl3 * Out2.R) + (spl5 * Out3.R) + (spl7 * Out4.R) + - (spl9 * Out5.R) + (spl11 * Out6.R) + (spl13 * Out7.R) + (spl15 * Out8.R) ) * MixVol; - - - -//================================================================================================== - -@gfx 650 320 -//========================================================== -//** Simple label ****************************************** -//========================================================== -function SL_Label(x,y,w,h, flag, RGB, lbl) -( - SetRGB(RGB); - gfx_x = x + 4; gfx_y = y; - gfx_drawstr(lbl, flag, x+w-4, y+h); - //---------------- - gfx_r *= 0.3; gfx_g *= 0.3; gfx_b *= 0.3;// bg col - gfx_roundrect(x-1,y-1,w,h,2,0); // frame -); - -//========================================================== -//** Simple slider-linked button *************************** -//========================================================== -function SL_BtnDraw(x,y,w,h, RGB, lbl) -( - this.isChanged = 0; - mouseDown(x,y,w,h) ? ( - this = !this; - slider_automate(this); - this.isChanged = 1; - ); - - this ? ( - SetRGB(RGB); gfx_a = 0.2; - gfx_rect(x,y,w,h, 1); - ); - - SL_Label(x,y,w,h, 5, RGB, lbl); -); - -//========================================================== -//** Simple slider-linked cycle button ********************* -//========================================================== -/* -function SL_CBtnDraw(x,y,w,h, RGB, lbl, maxval) -( - this.isChanged = 0; - mouseDown(x,y,w,h) ? ( - this += 1; this > maxval ? this = 0; - slider_automate(this); - this.isChanged = 1; - ); - - this ? ( - SetRGB(RGB); gfx_a = 0.2; - gfx_rect(x,y,w,h, 1); - ); - - SL_Label(x,y,w,h, 5, RGB, lbl); -); -*/ -//========================================================== -//** Simple slider-linked knob ***************************** -//========================================================== -function SL_KnobImage(x,y,w,h, RGB, normval) - local(cx, cy, rds, offs, angmax, ang1, ang2, i) -( - cx = x + w/2; cy = y + h/2; rds = w/2; - angmax = 2.75*$pi; // max val ang - offs = 1.25 * $pi; //$pi + $pi*0.25; - ang1 = offs - 0.01; // 0.01 mini offset - ang2 = offs + (1.5 * $pi) * normval; // cur val ang - //------------------------- - SetRGB(RGB); - gfx_r *= 0.3; gfx_g *= 0.3; gfx_b *= 0.3;// bg col - gfx_circle(cx, cy, rds-7, 1); - //gfx_rect(x,y,w,h,0); // test rect - //------------------------- - i=0; - loop(5, - gfx_arc(cx, cy, rds-i, ang1, angmax, 1); - i+=0.5; - ); - //------------------------- - SetRGB(RGB); // val arc col - i=0; - loop(5, - gfx_arc(cx, cy, rds-i, ang1, ang2, 1); - i+=0.5; - ); -); - -//-------------------------------------- -function SL_KnobDraw(x,y,w,h, RGB, lbl, minval, maxval, valstep) - local(normval, K) -( - this.isChanged = 0; - mouse_cap&1 && pointINrect(mouse_down_x, mouse_down_y, x,y,w,h) ? ( - mouse_last_y - mouse_y ? ( - mouse_cap&4 ? K = valstep : K = valstep*4; // drag coeff - this = minmax(this + (mouse_last_y - mouse_y)*K, minval, maxval); - slider_automate(this); - this.isChanged = 1; - ); - ); - - //-- knob image ------------ - normval = (this - minval) / (maxval - minval); - SL_KnobImage(x,y,w,h, RGB, normval); - - //-- knob label ------------ - lbl = sprintf(#, "%s: %.1f", lbl, this); - SL_Label(x+w+5, y, 85, h, 4, RGB, lbl); - -); - -//********************************************************** -//** Draw one mixer channel(CP = chan pair) **************** -//********************************************************** - -function CPOut_Draw(x, y, h, lbl) - instance(Vol,Pan,Phase,Power,Solo, L, R) - local(w, RGB) -( - RGB = col1; - //-- CP label -------------- - w = 45; - SL_Label(x,y,w,h, 5, RGB, lbl); - - //-- CP Power -------------- - w = 50; - Power.SL_BtnDraw(x + 60, y, w, h, RGB, "Power"); - - //-- CP knobs -------------- - w = 22; - Vol.SL_KnobDraw(x + 140, y, w, h, RGB, "Vol", -60, 30, 0.1); - Pan.SL_KnobDraw(x + 270, y, w, h, RGB, "Pan", -100, 100, 0.1); - - //-- CP Phase, Solo -------- - w = 30; - Phase.SL_BtnDraw(x + 400, y, w, h, RGB, "ø"); - Solo.SL_BtnDraw(x + 440, y, w, h, RGB, "S"); - - //-- Update mixer if changed --------- - Power.isChanged || Vol.isChanged || Pan.isChanged || - Phase.isChanged || Solo.isChanged ? ( - Mixer_Slider(); - ); -); - -//********************************************************** -//** Draw mixer ******************************************** -//********************************************************** -function Draw() - local(x, y, h, offs, xx, yy, mx, my, lbl, RGB) -( - x = 20; y = 20; // Start drawing position - h = 22; // CP heigth - offs = h + 8; // CP vertical offset - gfx_setfont(1, "Tahoma", 14); // main font - RGB = col1; - - //-- Label --------------------------- - xx = x; yy = y; - SL_Label(xx, yy, 252, h, 5, RGB, "FXRack Mixer"); - - //-- Sum Mode Button ----------------- - xx = x + 270; yy = y; - lbl = sprintf(#, "Sum Mode: %s", strcpy_fromslider(#, SumMode)); - SumMode.SL_BtnDraw(xx, yy, 200, h, RGB, lbl); - SumMode.isChanged ? Mixer_Slider(); - - //-- CP Outs ------------------------- - xx = x; yy = y; - //-- 1 - 4 ------- - Out1.CPOut_Draw(xx, yy+=offs, h, "1/2"); - Out2.CPOut_Draw(xx, yy+=offs, h, "3/4"); - Out3.CPOut_Draw(xx, yy+=offs, h, "5/6"); - Out4.CPOut_Draw(xx, yy+=offs, h, "7/8"); - //-- 5 - 8 ------- - Out5.CPOut_Draw(xx, yy+=offs, h, "9/10"); - Out6.CPOut_Draw(xx, yy+=offs, h, "11/12"); - Out7.CPOut_Draw(xx, yy+=offs, h, "13/14"); - Out8.CPOut_Draw(xx, yy+=offs, h, "15/16"); - - //-- Wires --------------------------- - SetRGB(RGB); - xx = x + 490; yy = y + offs + h/2; - my = y + offs * 4.5 - 4; - mx = xx + 60; - loop(8, - gfx_x = xx; gfx_y = yy; - gfx_lineto(xx + 10, yy, 1); - gfx_lineto(mx, my, 1); - gfx_circle(xx, yy, 2, 1); - yy+=offs; - ); - //-- Out label ------------- - gfx_circle(mx, my, 2, 1); - xx = mx + 15; yy = y + offs * 4; - SL_Label(xx, yy, 45, h, 5, RGB, "1/2"); - -); - - -//********************************************************** -mouse_down = mouse_cap&1 && !mouse_last_cap&1; -mouse_down ? (mouse_down_x = mouse_x; mouse_down_y = mouse_y); - -Draw(); // Main Draw function -DrawStringFromMemory(); // Test - -mouse_last_cap = mouse_cap; -mouse_last_x = mouse_x; -mouse_last_y = mouse_y; diff --git a/FX/BryanChi_FX Devices/FXD - Record Last Touch.lua b/FX/BryanChi_FX Devices/FXD - Record Last Touch.lua deleted file mode 100644 index a158a0049..000000000 --- a/FX/BryanChi_FX Devices/FXD - Record Last Touch.lua +++ /dev/null @@ -1,5 +0,0 @@ --- @noindex - - - - reaper.SetExtState('FXD','Record last touch' , 'yes', false ) diff --git a/FX/BryanChi_FX Devices/FXD Band Joiner.jsfx b/FX/BryanChi_FX Devices/FXD Band Joiner.jsfx deleted file mode 100644 index a264913e4..000000000 --- a/FX/BryanChi_FX Devices/FXD Band Joiner.jsfx +++ /dev/null @@ -1,534 +0,0 @@ -noindex: true - -desc:FXD Band Joiner - -/* -Short Description: -CP is channel pair, aka chain(1/2,3/4 etc) -Power = 0, 1 (Off,On) -Vol = -60 .. 30 (dB) -Pan = -100 ... 100 (L<>R) -Phase = 0, 1 (Normal, Inverted) -Solo = 0, 1 (Not soloed, Soloed) -SumMode = Sum - станд. сложение, SumMode = Average - сумма делится на кол-во активных каналов. -In functions names - CP = chan pair, 1 = 1/2; 2 = 3/4 etc -*/ - -//============================================================================== -//-- CP 1 - 4 ---------------- -slider1:Out1.Power=1<0,1,1{Off,On}>-Power 1 -slider2:Out1.Vol=0<-60,12,0.1>-Vol 1 -slider3:Out1.Pan=0<-100,100,0.1>-Pan 1 -slider4:Out1.Phase=0<0,1,1{Normal,Inverted}>-Phase 1 -slider5:Out1.Solo=0<0,1,1{Not soloed,Soloed}>-Solo 1 - -slider6:Out2.Power=1<0,1,1{Off,On}>-Power 2 -slider7:Out2.Vol=0<-60,12,0.1>-Vol 2 -slider8:Out2.Pan=0<-100,100,0.1>-Pan 2 -slider9:Out2.Phase=0<0,1,1{Normal,Inverted}>-Phase 2 -slider10:Out2.Solo=0<0,1,1{Not soloed,Soloed}>-Solo 2 - -slider11:Out3.Power=1<0,1,1{Off,On}>-Power 3 -slider12:Out3.Vol=0<-60,12,0.1>-Vol 3 -slider13:Out3.Pan=0<-100,100,0.1>-Pan 3 -slider14:Out3.Phase=0<0,1,1{Normal,Inverted}>-Phase 3 -slider15:Out3.Solo=0<0,1,1{Not soloed,Soloed}>-Solo 3 - -slider16:Out4.Power=1<0,1,1{Off,On}>-Power 4 -slider17:Out4.Vol=0<-60,12,0.1>-Vol 4 -slider18:Out4.Pan=0<-100,100,0.1>-Pan 4 -slider19:Out4.Phase=0<0,1,1{Normal,Inverted}>-Phase 4 -slider20:Out4.Solo=0<0,1,1{Not soloed,Soloed}>-Solo 4 - -//-- CP 5 - 8 ---------------- -slider21:Out5.Power=1<0,1,1{Off,On}>-Power 5 -slider22:Out5.Vol=0<-60,12,0.1>-Vol 5 -slider23:Out5.Pan=0<-100,100,0.1>-Pan 5 -slider24:Out5.Phase=0<0,1,1{Normal,Inverted}>-Phase 5 -slider25:Out5.Solo=0<0,1,1{Not soloed,Soloed}>-Solo 5 - -slider26:Out6.Power=0<0,1,1{Off,On}>-Power 6 -slider27:Out6.Vol=0<-60,12,0.1>-Vol 6 -slider28:Out6.Pan=0<-100,100,0.1>-Pan 6 -slider29:Out6.Phase=0<0,1,1{Normal,Inverted}>-Phase 6 -slider30:Out6.Solo=0<0,1,1{Not soloed,Soloed}>-Solo 6 - -slider31:Out7.Power=0<0,1,1{Off,On}>-Power 7 -slider32:Out7.Vol=0<-60,12,0.1>-Vol 7 -slider33:Out7.Pan=0<-100,100,0.1>-Pan 7 -slider34:Out7.Phase=0<0,1,1{Normal,Inverted}>-Phase 7 -slider35:Out7.Solo=0<0,1,1{Not soloed,Soloed}>-Solo 7 - -slider36:Out8.Power=0<0,1,1{Off,On}>-Power 8 -slider37:Out8.Vol=0<-60,12,0.1>-Vol 8 -slider38:Out8.Pan=0<-100,100,0.1>-Pan 8 -slider39:Out8.Phase=0<0,1,1{Normal,Inverted}>-Phase 8 -slider40:Out8.Solo=0<0,1,1{Not soloed,Soloed}>-Solo 8 - -//-- SumMode ------- -slider41:SumMode=1<0,1,1{Average,Summing>-SumMode - -//-- Cur Preset ---- -slider42:RWMode=0<0,2,1{Read from JS memory, Write to JS memory, ClearMemory}>-Memory RWMode -slider43:mempos=0<0,255,1>-Memory Position -slider44:memval=0<0,255,1>-Memory Value - - -//-- Inputs -------- -in_pin:in 1 L -in_pin:in 1 R -in_pin:in 2 L -in_pin:in 2 R -in_pin:in 3 L -in_pin:in 3 R -in_pin:in 4 L -in_pin:in 4 R - -in_pin:in 5 L -in_pin:in 5 R -in_pin:in 6 L -in_pin:in 6 R -in_pin:in 7 L -in_pin:in 7 R -in_pin:in 8 L -in_pin:in 8 R - -//-- Outputs ------- -out_pin:output L -out_pin:output R - - -@init -gfx_clear = 0x180E01; // bg color -col1 = 0xB9C1D4; // controls color - -membuf = 0; // memory(for preset name) -membuf_sz = 255; // memory max size - - -//-- Mouse ----------------------------- -//-- if point(p_x, p_y) in rect(x,y,w,h) area ---- -function pointINrect(p_x,p_y, x,y,w,h) ( p_x>=x && p_x<=x+w && p_y>=y && p_y<=y+h; ); -//-- if mouse cursor in rect(x,y,w,h) area ------- -function mouseINrect(x,y,w,h) ( pointINrect(mouse_x, mouse_y, x,y,w,h); ); -//-- Left Mouse Button --------------------------- -function mouseDown(x,y,w,h) ( mouse_down && mouseINrect(x,y,w,h); ); - -//-- Set RRGGBB color ------------------ -function SetRGB(RGB) -( - gfx_r = (RGB & 0xFF0000) / 16711680; // 256*256*255 - gfx_g = (RGB & 0x00FF00) / 65280; // 256*255 - gfx_b = (RGB & 0x0000FF) / 255; // 255 - gfx_a = 1 -); - -//-------------------------------------- -function minmax(x, minv, maxv) -( - min(max(x, minv), maxv); -); - -//-------------------------------------- -function DB2VAL(x) -( - exp((x)*0.11512925464970228420089957273422); -); - -//-------------------------------------- -//-- String from/to memory functions --- -//-------------------------------------- -function ClearMemory() -( - memset(membuf, 0, membuf_sz); -); -//-------- -function ReadFromMemory() -( - memval = membuf[mempos]; -); -//-------- -function WriteToMemory() -( - membuf[mempos] = memval; -); -//-------- -function SerializeMemory() -( - file_mem(0, membuf, membuf_sz); -); -//-------- -function DrawStringFromMemory() // For tests - local(i, char) -( - SetRGB(col1); - i = 1; // Read from 1 - gfx_x = 20; gfx_y = 2; - gfx_drawstr("FXRack Preset: "); - while( (char = membuf[i]) && i <= membuf_sz) - ( - gfx_drawchar(char); - i+=1; - ); -); - -//-------------------------------------- -//-- Mixer functions ------------------- -//-------------------------------------- -function CPOut_Init() - instance(Vol, Pan, src_vol, src_pan, tgt_vol, tgt_pan) -( - src_vol = tgt_vol = DB2VAL(Vol); - src_pan = tgt_pan = Pan*0.01; -); -//-------- -function CPOut_Slider() - instance(Vol, Pan, Phase, Power, Solo, tgt_vol, tgt_pan) -( - tgt_vol = tgt_pan = 0; - Power && (Solo || AllSolo) ? ( - tgt_vol = DB2VAL(Vol); - Phase ? tgt_vol *= -1; - tgt_pan = Pan*0.01; - ); -); -//-------- -function CPOut_Block() - instance(d_vol,d_pan, tvol,tpan, src_vol,src_pan, tgt_vol,tgt_pan) -( - d_vol = (tgt_vol-src_vol)/samplesblock; - d_pan = (tgt_pan-src_pan)/samplesblock; - tvol = src_vol; - tpan = src_pan; - src_vol = tgt_vol; - src_pan = tgt_pan; -); -//-------- -function CPOut_Sample() - instance(d_vol, d_pan, tvol, tpan, L, R) -( - tvol += d_vol; - tpan += d_pan; - - L = R = tvol; - tpan > 0.0 ? L *= 1.0-tpan; - tpan < 0.0 ? R *= 1.0+tpan; -); - -//-------------------------------------- -function Mixer_Init() -( - Out1.CPOut_Init(); - Out2.CPOut_Init(); - Out3.CPOut_Init(); - Out4.CPOut_Init(); - Out5.CPOut_Init(); - Out6.CPOut_Init(); - Out7.CPOut_Init(); - Out8.CPOut_Init(); -); - -//-------------------------------------- -function MixVolAverage() -( - // сумма активных каналов - Power && (Solo || AllSolo) - ActSum = 0; - Out1.Power && (Out1.Solo || AllSolo) ? ActSum+=1; - Out2.Power && (Out2.Solo || AllSolo) ? ActSum+=1; - Out3.Power && (Out3.Solo || AllSolo) ? ActSum+=1; - Out4.Power && (Out4.Solo || AllSolo) ? ActSum+=1; - Out5.Power && (Out5.Solo || AllSolo) ? ActSum+=1; - Out6.Power && (Out6.Solo || AllSolo) ? ActSum+=1; - Out7.Power && (Out7.Solo || AllSolo) ? ActSum+=1; - Out8.Power && (Out8.Solo || AllSolo) ? ActSum+=1; - ActSum > 0 ? MixVol = 1/ActSum : MixVol = 0; // ret average -); - -//-------------------------------------- -function Mixer_Slider() -( - // All Soloed = No Soloed - AllSolo = !(Out1.Solo + Out2.Solo + Out3.Solo + Out4.Solo + - Out5.Solo + Out6.Solo + Out7.Solo + Out8.Solo); - - Out1.CPOut_Slider(); - Out2.CPOut_Slider(); - Out3.CPOut_Slider(); - Out4.CPOut_Slider(); - Out5.CPOut_Slider(); - Out6.CPOut_Slider(); - Out7.CPOut_Slider(); - Out8.CPOut_Slider(); - - SumMode == 1 ? MixVol = 1 : MixVol = MixVolAverage(); - -); - -//-------------------------------------- -function Mixer_Block() -( - Out1.CPOut_Block(); - Out2.CPOut_Block(); - Out3.CPOut_Block(); - Out4.CPOut_Block(); - Out5.CPOut_Block(); - Out6.CPOut_Block(); - Out7.CPOut_Block(); - Out8.CPOut_Block(); -); - -//-------------------------------------- -function Mixer_Sample() -( - Out1.CPOut_Sample(); - Out2.CPOut_Sample(); - Out3.CPOut_Sample(); - Out4.CPOut_Sample(); - Out5.CPOut_Sample(); - Out6.CPOut_Sample(); - Out7.CPOut_Sample(); - Out8.CPOut_Sample(); -); - - -//-------------------------------------- -//-------------------------------------- -Mixer_Init(); - - -@slider -Mixer_Slider(); // Update if sliders changed - -// For Read/Write Preset Name from/to Script -RWMode == 0 ? ReadFromMemory() : -RWMode == 1 ? WriteToMemory() : -RWMode == 2 ? ClearMemory(); - -@serialize -SerializeMemory(); // serialize membuf - -@block -Mixer_Block(); - -@sample -Mixer_Sample(); - -spl0 = ( (spl0 * Out1.L) + (spl2 * Out2.L) + (spl4 * Out3.L) + (spl6 * Out4.L) + - (spl8 * Out5.L) + (spl10 * Out6.L) + (spl12 * Out7.L) + (spl14 * Out8.L) ) * MixVol; - -spl1 = ( (spl1 * Out1.R) + (spl3 * Out2.R) + (spl5 * Out3.R) + (spl7 * Out4.R) + - (spl9 * Out5.R) + (spl11 * Out6.R) + (spl13 * Out7.R) + (spl15 * Out8.R) ) * MixVol; - - - -//================================================================================================== - -@gfx 650 320 -//========================================================== -//** Simple label ****************************************** -//========================================================== -function SL_Label(x,y,w,h, flag, RGB, lbl) -( - SetRGB(RGB); - gfx_x = x + 4; gfx_y = y; - gfx_drawstr(lbl, flag, x+w-4, y+h); - //---------------- - gfx_r *= 0.3; gfx_g *= 0.3; gfx_b *= 0.3;// bg col - gfx_roundrect(x-1,y-1,w,h,2,0); // frame -); - -//========================================================== -//** Simple slider-linked button *************************** -//========================================================== -function SL_BtnDraw(x,y,w,h, RGB, lbl) -( - this.isChanged = 0; - mouseDown(x,y,w,h) ? ( - this = !this; - slider_automate(this); - this.isChanged = 1; - ); - - this ? ( - SetRGB(RGB); gfx_a = 0.2; - gfx_rect(x,y,w,h, 1); - ); - - SL_Label(x,y,w,h, 5, RGB, lbl); -); - -//========================================================== -//** Simple slider-linked cycle button ********************* -//========================================================== -/* -function SL_CBtnDraw(x,y,w,h, RGB, lbl, maxval) -( - this.isChanged = 0; - mouseDown(x,y,w,h) ? ( - this += 1; this > maxval ? this = 0; - slider_automate(this); - this.isChanged = 1; - ); - - this ? ( - SetRGB(RGB); gfx_a = 0.2; - gfx_rect(x,y,w,h, 1); - ); - - SL_Label(x,y,w,h, 5, RGB, lbl); -); -*/ -//========================================================== -//** Simple slider-linked knob ***************************** -//========================================================== -function SL_KnobImage(x,y,w,h, RGB, normval) - local(cx, cy, rds, offs, angmax, ang1, ang2, i) -( - cx = x + w/2; cy = y + h/2; rds = w/2; - angmax = 2.75*$pi; // max val ang - offs = 1.25 * $pi; //$pi + $pi*0.25; - ang1 = offs - 0.01; // 0.01 mini offset - ang2 = offs + (1.5 * $pi) * normval; // cur val ang - //------------------------- - SetRGB(RGB); - gfx_r *= 0.3; gfx_g *= 0.3; gfx_b *= 0.3;// bg col - gfx_circle(cx, cy, rds-7, 1); - //gfx_rect(x,y,w,h,0); // test rect - //------------------------- - i=0; - loop(5, - gfx_arc(cx, cy, rds-i, ang1, angmax, 1); - i+=0.5; - ); - //------------------------- - SetRGB(RGB); // val arc col - i=0; - loop(5, - gfx_arc(cx, cy, rds-i, ang1, ang2, 1); - i+=0.5; - ); -); - -//-------------------------------------- -function SL_KnobDraw(x,y,w,h, RGB, lbl, minval, maxval, valstep) - local(normval, K) -( - this.isChanged = 0; - mouse_cap&1 && pointINrect(mouse_down_x, mouse_down_y, x,y,w,h) ? ( - mouse_last_y - mouse_y ? ( - mouse_cap&4 ? K = valstep : K = valstep*4; // drag coeff - this = minmax(this + (mouse_last_y - mouse_y)*K, minval, maxval); - slider_automate(this); - this.isChanged = 1; - ); - ); - - //-- knob image ------------ - normval = (this - minval) / (maxval - minval); - SL_KnobImage(x,y,w,h, RGB, normval); - - //-- knob label ------------ - lbl = sprintf(#, "%s: %.1f", lbl, this); - SL_Label(x+w+5, y, 85, h, 4, RGB, lbl); - -); - -//********************************************************** -//** Draw one mixer channel(CP = chan pair) **************** -//********************************************************** - -function CPOut_Draw(x, y, h, lbl) - instance(Vol,Pan,Phase,Power,Solo, L, R) - local(w, RGB) -( - RGB = col1; - //-- CP label -------------- - w = 45; - SL_Label(x,y,w,h, 5, RGB, lbl); - - //-- CP Power -------------- - w = 50; - Power.SL_BtnDraw(x + 60, y, w, h, RGB, "Power"); - - //-- CP knobs -------------- - w = 22; - Vol.SL_KnobDraw(x + 140, y, w, h, RGB, "Vol", -60, 30, 0.1); - Pan.SL_KnobDraw(x + 270, y, w, h, RGB, "Pan", -100, 100, 0.1); - - //-- CP Phase, Solo -------- - w = 30; - Phase.SL_BtnDraw(x + 400, y, w, h, RGB, "ø"); - Solo.SL_BtnDraw(x + 440, y, w, h, RGB, "S"); - - //-- Update mixer if changed --------- - Power.isChanged || Vol.isChanged || Pan.isChanged || - Phase.isChanged || Solo.isChanged ? ( - Mixer_Slider(); - ); -); - -//********************************************************** -//** Draw mixer ******************************************** -//********************************************************** -function Draw() - local(x, y, h, offs, xx, yy, mx, my, lbl, RGB) -( - x = 20; y = 20; // Start drawing position - h = 22; // CP heigth - offs = h + 8; // CP vertical offset - gfx_setfont(1, "Tahoma", 14); // main font - RGB = col1; - - //-- Label --------------------------- - xx = x; yy = y; - SL_Label(xx, yy, 252, h, 5, RGB, "FXRack Mixer"); - - //-- Sum Mode Button ----------------- - xx = x + 270; yy = y; - lbl = sprintf(#, "Sum Mode: %s", strcpy_fromslider(#, SumMode)); - SumMode.SL_BtnDraw(xx, yy, 200, h, RGB, lbl); - SumMode.isChanged ? Mixer_Slider(); - - //-- CP Outs ------------------------- - xx = x; yy = y; - //-- 1 - 4 ------- - Out1.CPOut_Draw(xx, yy+=offs, h, "1/2"); - Out2.CPOut_Draw(xx, yy+=offs, h, "3/4"); - Out3.CPOut_Draw(xx, yy+=offs, h, "5/6"); - Out4.CPOut_Draw(xx, yy+=offs, h, "7/8"); - //-- 5 - 8 ------- - Out5.CPOut_Draw(xx, yy+=offs, h, "9/10"); - Out6.CPOut_Draw(xx, yy+=offs, h, "11/12"); - Out7.CPOut_Draw(xx, yy+=offs, h, "13/14"); - Out8.CPOut_Draw(xx, yy+=offs, h, "15/16"); - - //-- Wires --------------------------- - SetRGB(RGB); - xx = x + 490; yy = y + offs + h/2; - my = y + offs * 4.5 - 4; - mx = xx + 60; - loop(8, - gfx_x = xx; gfx_y = yy; - gfx_lineto(xx + 10, yy, 1); - gfx_lineto(mx, my, 1); - gfx_circle(xx, yy, 2, 1); - yy+=offs; - ); - //-- Out label ------------- - gfx_circle(mx, my, 2, 1); - xx = mx + 15; yy = y + offs * 4; - SL_Label(xx, yy, 45, h, 5, RGB, "1/2"); - -); - - -//********************************************************** -mouse_down = mouse_cap&1 && !mouse_last_cap&1; -mouse_down ? (mouse_down_x = mouse_x; mouse_down_y = mouse_y); - -Draw(); // Main Draw function -DrawStringFromMemory(); // Test - -mouse_last_cap = mouse_cap; -mouse_last_x = mouse_x; -mouse_last_y = mouse_y; diff --git a/FX/BryanChi_FX Devices/FXD Gain Reduction Scope.jsfx b/FX/BryanChi_FX Devices/FXD Gain Reduction Scope.jsfx deleted file mode 100644 index afa3c7ff3..000000000 --- a/FX/BryanChi_FX Devices/FXD Gain Reduction Scope.jsfx +++ /dev/null @@ -1,619 +0,0 @@ -noindex: true - -desc:FXD Gain Reduction Scope -//tags: analysis scope meter -//author: Cockos -/* -Copyright (C) 2007-2016 Cockos Incorporated -License: LGPL - http://www.gnu.org/licenses/lgpl.html -*/ - -slider1:view_msec=2000<400,3000,1>-view size (ms) -slider2:view_maxdb=-20<-100,-6.02,.01>-vzoom -slider3:view_rms=10<0.01,500.0,.01>-RMS size -slider4:view_meter_range=-50<-150,0,1>-meter range -slider5:gain_db=0<-30,12,1>gain (dB) - -in_pin:left input 1 -in_pin:right input 1 -in_pin:left input 2 -in_pin:right input 2 -out_pin: left output 1 -out_pin: right output 1 -options:no_meter -options:gmem=CompReductionScope -options:gfx_idle -options: ext_noinit=1.0 - -@init -ext_noinit=1.0; -last_gain=10^(gain_db/20); -gfx_ext_retina=1; -ext_nodenorm=1; -recpos=0; -gfx_clear=-1; -g_maxlen_ms=3000; -histsize=((srate*2.0*g_maxlen_ms/1000)|0)*2; -g_hold=-1; -need_view_update=1; - -Diy_ID = gmem[2000]; -ThisFX_ID = gmem[2002]; -FXIDXX = gmem[ThisFX_ID]; - - -function rms.init(buf, maxsz) global() ( - this.buf = buf; - this.maxsz=maxsz|0; - this.size=this.suml=this.sumr=this.cnt=this.ptr=0; -); - -function rms.getmax(splsquarel, splsquarer) - instance(buf suml sumr cnt ptr size maxsz) - local(i) - global() -( - while (cnt >= size) ( - i = (ptr= maxsz ? ptr=0; - (suml += splsquarel) < 0 ? suml=0; - (sumr += splsquarer) < 0 ? sumr=0; -); - -function rms.set_size(sz) global() ( - (this.size=max(0,min(sz|0,this.maxsz))) < 1 ? ( - this.cnt=this.suml=this.sumr=0; - ); -); - -function rms.get_l() instance(suml cnt) global() local(f) -( - suml>cnt*exp(-21) ? max(log(suml/cnt)*.5,-22):-22; -); -function rms.get_r() instance(sumr cnt) global() local(f) -( - sumr>cnt*exp(-21) ? max(log(sumr/cnt)*.5,-22):-22; -); - -rmsa.rms.init(histsize, srate); -rmsb.rms.init(histsize + rmsa.rms.maxsz*2, srate); - -@slider -next_gain=10^(gain_db/20); - - -@block -g_hold<0?need_view_update=1; -rmsa.rms.set_size(view_rms*.001*srate); -rmsb.rms.set_size(view_rms*.001*srate); -peak_atten = exp(-1/(srate*0.25)); -d_gain = (next_gain - last_gain)/samplesblock; - -@sample -NewSpl0 = spl0; -NewSpl1 = spl1; -spl0 *= last_gain; -spl1 *= last_gain; -last_gain += d_gain; - -g_hold<0 ? ( - rmsa.rms.getmax(sqr(NewSpl0),sqr(NewSpl1)); - rmsb.rms.getmax(sqr(spl2),sqr(spl3)); - - peak_spl0 = max(peak_spl0*peak_atten,abs(NewSpl0)); - peak_spl1 = max(peak_spl1*peak_atten,abs(NewSpl1)); - peak_spl2 = max(peak_spl2*peak_atten,abs(spl2)); - peak_spl3 = max(peak_spl3*peak_atten,abs(spl3)); - - recpos[0]=rmsb.rms.get_l() - rmsa.rms.get_l(); - recpos[1]=rmsb.rms.get_r() - rmsa.rms.get_r(); - recpos = (recpos+2) >= histsize ? 0 : (recpos+2); - - -); - -@gfx 680 900 - - - - FXIDXX = gmem[ThisFX_ID]; - gfx_w = 680; gfx_h = 900; - gfx_ext_retina=2; - gfx_ext_retina>1 ? gfx_setfont(1,"Arial",16*gfx_ext_retina,'b') : gfx_setfont(0); - - gfx_getchar(); // request mouse_cap to be set even when mouse button not down - - function color1() ( gfx_r=0.5; gfx_g=1.0; gfx_b=0.5; ); - function color2() ( gfx_r=1.0; gfx_g=0.5; gfx_b=1.0; ); - - function draw_button(xp, yp, str) - instance(w,h,x,y) - globals(gfx_r,gfx_g,gfx_b,gfx_x,gfx_y) - ( - gfx_measurestr(str, w, h); - xp -= w+3; - x=xp; - y=yp; - gfx_set(0,0,.75); - w+=3; - h+=3; - gfx_rect(x,y,w,h); - gfx_set(0,.5,1); - gfx_line(x,y,x+w,y); - gfx_line(x+w,y,x+w,y+h); - gfx_line(x,y+h,x+w,y+h); - gfx_line(x,y,x,y+h); - h+=1; - w+=1; - gfx_x=xp+2; gfx_y=yp+2; - gfx_drawstr(str); - gfx_x = xp; - ); - function hit_button(xp,yp,cm) - instance(w,h,x,y) - globals(cap_mode, cap_last_x, cap_last_y) - ( - xp>=x&&yp>=y&&xp z ? ( dx=y; y=z; z=dx; ); - x > z ? y : x < y ? z : x; - ); - - - (mouse_cap & 1) ? ( - !(last_mouse_cap & 1) ? ( - (cap_mode == 1||cap_mode==4 || cap_mode==5) && !cap_drag && cap_timer < 12 ? ( - cap_mode==1 ? view_maxdb = -20 : cap_mode==5 ? view_meter_range=-50.0 : view_rms = 10.0; - cap_mode=0; - need_view_update=1; - slider_automate(cap_mode==1 ? view_maxdb : cap_mode==5 ? view_meter_range : view_rms); - ) : ( - cap_mode = cap_drag = cap_timer = 0; - length_button.hit_button(mouse_x,mouse_y,2)|| - vzoom_button.hit_button(mouse_x,mouse_y,1)|| - hold_button.hit_button(mouse_x,mouse_y,3)|| - rms_button.hit_button(mouse_x,mouse_y,4)|| - meter_range_button.hit_button(mouse_x,mouse_y,5); - - - cap_mode == 3 ? g_hold_needadj=1; - - cap_mode == 0 && mouse_y >= 40 ? ( - cap_mode = 100; - cap_last_y=mouse_y; - cap_last_x=mouse_x; - - (mouse_cap&8) ? ( - g_hold < 0 ? ( - g_hold_needadj=1; - g_hold=0; - ) : g_hold=-1; - ); - ); - ); - ); - - cap_last_y != mouse_y ? ( - (cap_mode == 1 || cap_mode==100) ? ( - cap_mode == 100 && (mouse_cap&16) ? ( - g_hold >= 0 ? ovhold = g_hold + (gfx_w-mouse_x)*view_msec*0.001/gfx_w*srate; - view_msec = min(g_maxlen_ms,max(0.125,exp(drag_slider_precise(log(view_msec), log(0.125), log(g_maxlen_ms),-0.02)))); - slider_automate(view_msec); - g_hold >= 0 ? ( - // zoom at mouse cursor - g_hold = ovhold - (gfx_w-mouse_x)*view_msec*0.001/gfx_w*srate; - g_hold > histsize*.5-viewsize_spls ? g_hold = histsize*.5-viewsize_spls : g_hold < 0 ? g_hold=0; - ); - ) : ( - view_maxdb = drag_slider_precise(view_maxdb, -100, -6.02, -0.2); - need_view_update=1; - slider_automate(view_maxdb); - ); - ); - cap_mode == 5 ? ( - view_meter_range = drag_slider_precise(view_meter_range, -150, 0, -0.2); - need_view_update=1; - slider_automate(view_meter_range); - ); - cap_mode == 2 ? ( - view_msec = min(g_maxlen_ms,max(0.125,exp(drag_slider_precise(log(view_msec), log(0.125), log(g_maxlen_ms),-0.02)))); - slider_automate(view_msec); - need_view_update=1; - ); - cap_mode == 4 ? ( - view_rms = min(500,max(0.01,exp(drag_slider_precise(log(view_rms),log(0.01),log(500.0), 0.01)))); - slider_automate(view_rms); - need_view_update=1; - ); - ); - cap_mode == 3 || (cap_mode == 100&&g_hold>=0) ? ( - dx = mouse_x-cap_last_x + (cap_mode == 3 ? (mouse_y-cap_last_y)*0.2); - dx ? ( - cap_drag=1; - g_hold += dx * viewsize_spls/gfx_w; - g_hold > histsize*.5-viewsize_spls ? g_hold = histsize*.5-viewsize_spls; - cap_last_x = mouse_x; - cap_last_y = mouse_y; - need_view_update=1; - ); - g_hold < 0 ? g_hold=0; - ); - ) : ( - g_hold_needadj=0; - cap_mode == 3 && !cap_drag ? ( - g_hold=-1; - cap_mode=0; - ); - ); - - cap_mode && cap_timer < 12 ? cap_timer += 1; - last_mouse_cap = mouse_cap; - - function format_time_msec(a) ( - abs(a) < 1000 ? - sprintf(#,"%.02fms",a + 0.005) : - sprintf(#,"%.02fs",a*0.001 + 0.005); - ); - - /* mouse_wheel ? ( - (mouse_cap&8) ? ( - view_maxdb = min(-6.02,max(-100,view_maxdb*exp(-mouse_wheel*0.0003))); - slider_automate(view_maxdb); - ) : (mouse_cap&16) ? ( - g_hold += mouse_wheel*(1/(120.0*8.0)) * viewsize_spls; - g_hold > histsize*.5-viewsize_spls ? g_hold = histsize*.5-viewsize_spls : g_hold < 0 ? g_hold=0; - ) : ( - g_hold >= 0 ? ovhold = g_hold + (gfx_w-mouse_x)*view_msec*0.001/gfx_w*srate; - view_msec = min(2000,max(1,view_msec*exp(-mouse_wheel*0.0003))); - slider_automate(view_msec); - g_hold >= 0 ? ( - // zoom at mouse cursor - g_hold = ovhold - (gfx_w-mouse_x)*view_msec*0.001/gfx_w*srate; - g_hold > histsize*.5-viewsize_spls ? g_hold = histsize*.5-viewsize_spls : g_hold < 0 ? g_hold=0; - ); - ); - mouse_wheel=0; - need_view_update=1; - ); */ - - function draw_meter(v,c,xp,w) ( c ? color2():color1(); v < gfx_h ? gfx_rect(xp,v,w,gfx_h-v); ); - - Diy_ID == gmem[2000]?( - // only update if new fft data is there or if the size changed - need_view_update || view_meter_range != view_meter_range_last || view_maxdb != view_maxdb_last || old_w != gfx_w || old_h!=gfx_h? ( - view_maxdb_last = view_maxdb; - view_meter_range_last = view_meter_range; - need_view_update=0; - old_w=gfx_w; old_h=gfx_h; - - gfx_r=gfx_g=gfx_b=0; gfx_a=1; - gfx_x=gfx_y=0; - gfx_rectto(gfx_w,gfx_h); - - scope_h = ((gfx_h-gfx_texth*2-6-4)*0.5)|0; - scope_ycent = gfx_h - scope_h*1.5 - gfx_texth - 4 +100; - - // draw meter scale - - // draw meters - view_meter_range<-1 ? ( - metersz=16*gfx_ext_retina; - metersz2=4*gfx_ext_retina; - lx=metersz*8+metersz2; - x=lx+3; - sc = gfx_h /(-view_meter_range); - gfx_a=1.0; - gfx_r=gfx_g=gfx_b=0.6; - gfx_line(x,0,x,gfX_h); - - sc < gfx_texth*1.5 + 3 ? ( - dv = log10(2)*5; - while (dv*sc < gfx_texth*2+4 && dv < 300) (dv*=2); - ) : dv = 1; - v=dv; - while ( - a = v * sc; - a < gfx_h ? ( - gfx_a=.25; - gfx_line(0,a,lx,a); - gfx_a=.5; - gfx_x=0; gfx_y=a+2; - gfx_printf("-%.2fdB",v); - v += dv; - 1; - ); - ); - - sc *= -(20.0/log(10)); - gfx_a=0.5; - draw_meter(sc * rmsa.rms.get_l(), 0, 0, metersz-1); - draw_meter(sc * log(peak_spl0), 0, metersz, metersz-1); - - draw_meter(sc * log(peak_spl1), 1, metersz*2, metersz-1); - gmem[1000] = log(peak_spl0); - AAAALogSpl0=log(peak_spl0); - gmem[1001] = log(peak_spl1); - gmem[1002] = log(peak_spl2); - gmem[1003] = log(peak_spl3); - - - draw_meter(sc * rmsa.rms.get_r(), 1, metersz*3, metersz-1); - - draw_meter(sc * rmsb.rms.get_l(), 0, metersz*4+metersz2, metersz-1); - draw_meter(sc * log(peak_spl2), 0, metersz*4+metersz2+metersz, metersz-1); - draw_meter(sc * log(peak_spl3), 1, metersz*4+metersz2+metersz*2, metersz-1); - draw_meter(sc * rmsb.rms.get_r(), 1, metersz*4+metersz2+metersz*3, metersz-1); - - lx=(x+=3*gfx_ext_retina); - ) : x=lx=0; - - // draw horz grid - sc= -scope_h * 1.5 / (view_maxdb); - gfx_r=gfx_g=gfx_b=0.6; - gfx_a=1.0; - gfx_line(lx,scope_ycent,gfx_w,scope_ycent); - - sc < gfx_texth*1.5 + 3 ? ( - dv = log10(2)*5; - while (dv*sc < gfx_texth*2+4 && dv < 300) (dv*=2); - ) : dv = 1; - v=dv; - while ( - a = v * sc; - scope_ycent + a < gfx_h ? ( - gfx_a=.25; - scope_ycent - a > gfx_texth+10 ? gfx_line(lx,scope_ycent-a,gfx_w,scope_ycent-a); - gfx_line(lx,scope_ycent+a,gfx_w,scope_ycent+a); - gfx_a=.5; - gfx_x=lx; gfx_y=scope_ycent+a+2; - gfx_printf("-%.2fdB",v); - gfx_x=lx; gfx_y=scope_ycent-a-2-gfx_texth; - gfx_y > gfx_texth*2 ? gfx_printf("%+.2fdB",v); - v += dv; - 1; - ); - ); - sc *= (20.0/log(10)); - - // draw vert grid - v=gfx_w - 96*gfx_ext_retina; - while( - gfx_a=0.25; - gfx_line(v,gfx_texth+8,v,gfx_h); - a = view_msec - view_msec * v / (gfx_w-x); - - gfx_a=0.5; - gfx_x = v + 2; gfx_y = gfx_texth+12; - gfx_drawstr(sprintf(#,"%d",a*srate*0.001+0.5)); - - g_hold > 0 ? ( - gfx_x=v+2; - gfx_y += gfx_texth+2; - gfx_drawstr(sprintf(#,"-%d",a*srate*0.001 + g_hold + 0.5)); - ); - - g_hold > 0 ? ( - gfx_x=v+2; - gfx_y = gfx_h - gfx_texth*3 - 4; - gfx_drawstr(format_time_msec(-a-(g_hold*1000/srate))); - ); - - gfx_x = v + 2; gfx_y = gfx_h - gfx_texth; - gfx_drawstr(format_time_msec(a)); - - v -= 96*gfx_ext_retina; - v > 56*gfx_ext_retina + lx; - ); - - viewsize_spls = (view_msec*srate*0.001)|0; - viewadv = (gfx_w-x)/viewsize_spls; - - rdptr = recpos - viewsize_spls*2 - 2; - rdptr < 0 ? rdptr += histsize; - (g_hold_needadj ? (g_hold>0) : (g_hold>=0)) && g_hold < histsize*0.5 ? ( - rdptr -= (g_hold|0)*2; - rdptr < 0 ? rdptr += histsize; - ); - - g_hold_needadj=0; - - rdptr >= histsize ? rdptr -= histsize; - viewadv < 1 ? ( - // multiple samples per pixel - i=0; - minl=maxl=rdptr[0]; minr=maxr=rdptr[1]; - (rdptr+=2) >= histsize ? rdptr=0; - loop(viewsize_spls , // lx starts at 500 because the meter on left, every pixel needs 2 lx - tx=(x|0); - tx>lx?( - minl = min(max(-1,(scope_ycent+0.5-minl*sc)|0),gfx_h+2); - maxl = min(max(-1,(scope_ycent+0.5-maxl*sc)|0),gfx_h+2); - minr = min(max(-1,(scope_ycent+0.5- minr*sc)|0),gfx_h+2); - maxr = min(max(-1,(scope_ycent+0.5-maxr*sc)|0),gfx_h+2); - - gfx_a=0.25; - color1(); - maxl-1 > scope_ycent ? gfx_line(lx,maxl-1,lx,scope_ycent) : - minl+1 < scope_ycent ? gfx_line(lx,minl+1,lx,scope_ycent); - - color2(); - maxr-1 > scope_ycent ? gfx_line(lx,maxr-1,lx,scope_ycent) : - minr+1 < scope_ycent ? gfx_line(lx,minr+1,lx,scope_ycent); - - color1(); - gfx_a=.6; - gfx_line(lx,minl,lx,maxl); - - - //gmem[lx-273]= minl; - gmem[lx-497+200+ 10000*FXIDXX ]=maxl; //497 is very important! if change gfx UI size, then 497 needs to change - - color2(); - gfx_line(lx,minr,lx,maxr); - - minl=maxl=rdptr[0]; minr=maxr=rdptr[1]; - lx=tx; - ) : ( - minl=min(minl,v = rdptr[0]); maxl=max(maxl,v); - minr=min(minr,v2 = rdptr[1]); maxr=max(maxr,v2); - ); - (rdptr+=2) >= histsize ? rdptr=0; - x+=viewadv; - ); - - - i=0; - minl=maxl=rdptr[0]; minr=maxr=rdptr[1]; - (rdptr+=2) >= histsize ? rdptr=0; - /* loop(viewsize_spls, //H = 100, W = 200 - tx = (x|0); - - tx>lx?( - minl = min(max(-1,(scope_ycent+0.5-minl*sc)|0),200+2); - maxl = min(max(-1,(scope_ycent+0.5-maxl*sc)|0),200+2); - minr = min(max(-1,(scope_ycent+0.5- minr*sc)|0),200+2); - maxr = min(max(-1,(scope_ycent+0.5-maxr*sc)|0),200+2); - maxl-1 > scope_ycent ? gfx_line(lx,maxl-1,lx,scope_ycent) : - minl+1 < scope_ycent ? gfx_line(lx,minl+1,lx,scope_ycent); - - maxr-1 > scope_ycent ? gfx_line(lx,maxr-1,lx,scope_ycent) : - minr+1 < scope_ycent ? gfx_line(lx,minr+1,lx,scope_ycent); - gmem[lx]=minl; - gmem[lx+200]=maxl; - gmem[lx+600]=minr; - gmem[lx+800]=maxr; - - - - minl=maxl=rdptr[0]; minr=maxr=rdptr[1]; - ) : ( - minl=min(minl,v = rdptr[0]); maxl=max(maxl,v); - minr=min(minr,v2 = rdptr[1]); maxr=max(maxr,v2); - ); - (rdptr+=2) >= histsize ? rdptr=0; - x+=1; - - - - ); - */ -/* - // last pixel - minl = min(max(-1,(scope_ycent+0.5-minl*sc)|0),gfx_h+2); - maxl = min(max(-1,(scope_ycent+0.5-maxl*sc)|0),gfx_h+2); - minr = min(max(-1,(scope_ycent+0.5-minr*sc)|0),gfx_h+2); - maxr = min(max(-1,(scope_ycent+0.5-maxr*sc)|0),gfx_h+2); - color1(); - gfx_a=0.35; - maxl-1 > scope_ycent ? gfx_line(lx,maxl-1,lx,scope_ycent) : - minl+1 < scope_ycent ? gfx_line(lx,minl+1,lx,scope_ycent); - - color2(); - maxr-1 > scope_ycent ? gfx_line(lx,maxr-1,lx,scope_ycent) : - minr+1 < scope_ycent ? gfx_line(lx,minr+1,lx,scope_ycent); - - gfx_a=.6; - color1(); - gfx_line(lx,minl,lx,maxl); - color2(); - gfx_line(lx,minr,lx,maxr); - */ - - ) : ( - maxval=gfx_h+64+300; - // multiple pixels per sample - i=viewsize_spls&1; - loop(viewsize_spls, - x1 = x|0; - x2 = (x+=viewadv)|0; - - viewadv<3 ? ( - color1(); - - loop(2, - v = (rdptr[0] * sc)|0; - - gfx_a=.25; - v < 0 ? ( - v < -maxval ? v=-maxval; - gfx_rect(x1,scope_ycent,x2-x1,-v) - ) : ( - v > maxval ? v=maxval; - gfx_rect(x1,scope_ycent-v,x2-x1,v); - ); - gfx_a=.6; - gfx_rect(x1,scope_ycent-v,x2-x1,1); - - rdptr+=1; - color2(); - ); - - ) : ( - color1(); - - loop(2, - gfx_a=(i&1) ? 0.25:0.125; - v = (rdptr[0] * sc)|0; - v < 0 ? ( - v < -maxval ? v=-maxval; - gfx_rect(x1,scope_ycent,x2-x1,-v) - ) : ( - v > maxval ? v=maxval; - gfx_rect(x1,scope_ycent-v,x2-x1,v); - ); - gfx_a=0.6; - gfx_rect(x1,scope_ycent-v,x2-x1,1); - rdptr+=1; - color2(); - i+=1; - ); - i+=1; - ); - rdptr >= histsize ? rdptr=0; - ); - ); - - hold_button.draw_button(gfx_w,0, g_hold>=0 ? sprintf(#,"hold: -%d samples",g_hold+0.5) : "hold"); - - length_button.draw_button(gfx_x-8, 0, sprintf(#,"length: %s", format_time_msec(view_msec)) ); - - vzoom_button.draw_button(gfx_x-8, 0, sprintf(#,"range: %+.1fdB",view_maxdb)); - - rms_button.draw_button(gfx_x-8, 0, sprintf(#,"rms: %s", format_time_msec(view_rms))); - - meter_range_button.draw_button(gfx_x-8, 0, view_meter_range>-1?"meter off":sprintf(#,"meter range: %+.1fdB",view_meter_range)); - - ); -); diff --git a/FX/BryanChi_FX Devices/FXD Macros.jsfx b/FX/BryanChi_FX Devices/FXD Macros.jsfx deleted file mode 100644 index b9a150042..000000000 --- a/FX/BryanChi_FX Devices/FXD Macros.jsfx +++ /dev/null @@ -1,546 +0,0 @@ -noindex: true - -desc:FXD Macros -import cookdsp.jsfx-inc - -slider1:0<0,1>Macro 1 -slider2:0<0,1>Macro 2 -slider3:0<0,1>Macro 3 -slider4:0<0,1>Macro 4 -slider5:0<0,1>Macro 5 -slider6:0<0,1>Macro 6 -slider7:0<0,1>Macro 7 -slider8:0<0,1>Macro 8 -slider9:0<0,127>Morph 1 -slider10:0<0,127>Morph 2 -slider11:0<0,127>Morph 3 -slider12:0<0,127>Morph 4 -slider13:0<0,127>Morph 5 -slider14:0<0,127>Morph 6 -slider15:0<0,127>Morph 7 -slider16:0<0,127>Morph 8 - - -in_pin:none -out_pin:none - -options:gmem=ParamValues -@init -ext_noinit=1; -ext_midi_bus = 1; - -midiamp = midinote = 0; - - -totalTrackCount = gmem[0]; -trkGUID_Num = gmem[1]; - - -Mc1.Fol_Gain= 0.7 ; -Mc2.Fol_Gain= 0.7 ; -Mc3.Fol_Gain= 0.7 ; -Mc4.Fol_Gain= 0.7 ; -Mc5.Fol_Gain= 0.7 ; -Mc6.Fol_Gain= 0.7 ; -Mc7.Fol_Gain= 0.7 ; -Mc8.Fol_Gain= 0.7 ; - - - -Mc1.SEQ_DNom = 1; -Mc1.SEQ_Leng = 8; -Mc2.SEQ_DNom = 1; -Mc2.SEQ_Leng = 8; -Mc3.SEQ_DNom = 1; -Mc3.SEQ_Leng = 8; -Mc4.SEQ_DNom = 1; -Mc4.SEQ_Leng = 8; -Mc5.SEQ_DNom = 1; -Mc5.SEQ_Leng = 8; -Mc6.SEQ_DNom = 1; -Mc6.SEQ_Leng = 8; -Mc7.SEQ_DNom = 1; -Mc7.SEQ_Leng = 8; -Mc8.SEQ_DNom = 1; -Mc8.SEQ_Leng = 8; - -//gmem offsets ------------------------------ -//gmem 1 = this track's DIY GUID -//gmem 2 = Selected track's Diy GUID -//gmem 3 = Prm Inst -//gmem 4 = if 1 then user is R-Dragging on prm - //if 2 then user is adjusting env atk - //if 3 then user is adjusting env rel - //if 4.1 then Mod 1 is Env, 4.2 then Mod 2 is Env - - -//gmem 5 = Which Macro is user assigning -//gmem 6 = Which Param's mod range is user tweaking -//gmem 7 = determine Param's value before modulaiton -//gmem 8 = ? -//gmem 9 = env1 atk | Follower Smoothness -//gmem 10 = env1 rel -//gmem 11 = env2 atk -//gmem 12 = env2 rel -//etc..24 -//gmem 31~38 = Modulation type (Macro or Env) -//gmem 101~108 = send Modulation info back to imgui -//gmem 110 = SEQ Length or Denominator when user is tweaking -//gmem 111 = SEQ Denominator when user is tweaking -//gmem 112 = step value of currently tweaking step -//gmem 121 ~128 = SEQ 1 ~ 8 Current Pos - - - -ModAmt = 1000; -ModAmt2 = 2000; -ModAmt3 = 3000; -ModAmt4 = 4000; -ModAmt5 = 5000; -ModAmt6 = 6000; -ModAmt7 = 7000; -ModAmt8 = 8000; -PsUsed = 100; -P_OrigV = 11000 ; -SEQ = 20000; // 20001~20048 = Macro1 Seq 1~64 - -//------------------------------------------------------------ -// TABLE INDEX ------------------------------ -// 1,3,5,7,9,11,13,15 = envelope 1~8 's atk -// 2,4,6,8,10,12,14,16 = envelope 1~8 's rel - - - -function fmod (n, k) ( - n - k * floor(n/k); - ); - - -midi_bus=15; - -Mc1.follow(10); -Mc2.follow(10); -Mc3.follow(10); -Mc4.follow(10); -Mc5.follow(10); -Mc6.follow(10); -Mc7.follow(10); -Mc8.follow(10); - -Mc1.Macro = 1; -Mc2.Macro = 2; -Mc3.Macro = 3; -Mc4.Macro = 4; -Mc5.Macro = 5; -Mc6.Macro = 6; -Mc7.Macro = 7; -Mc8.Macro = 8; - -Mc1.EnvToImGui = 101; -Mc2.EnvToImGui = 102; -Mc3.EnvToImGui = 103; -Mc4.EnvToImGui = 104; -Mc5.EnvToImGui = 105; -Mc6.EnvToImGui = 106; -Mc7.EnvToImGui = 107; -Mc8.EnvToImGui = 108; - - -function SendInfoBackToImGui() -( - this.type =='step'?( - (gmem[this.EnvToImGui] = SEQ[this.CurrentPos+1+64*(this.Macro-1)]*127); - ):this.type =='env'?( - gmem[this.EnvToImGui] = this.masr_do(midiamp) - ):this.type =='Fol' ? ( - gmem[this.EnvToImGui] = this.FOL_out*this.FOL_Gain*127;); -); - - -function SetMacroAttribute( x , y ) -( - //gmem[5] == this.Macro ? ( AAA = 'suc'; this.x = y ) ; - Macro==1?(Mc1.FOL_Gain = y); - Macro==2?(Mc2.FOL_Gain = y); - Macro==3?(Mc3.FOL_Gain = y); - Macro==4?(Mc4.FOL_Gain = y); - Macro==5?(Mc5.FOL_Gain = y); - Macro==6?(Mc6.FOL_Gain = y); - Macro==7?(Mc7.FOL_Gain = y); - Macro==8?(Mc8.FOL_Gain = y); -); - -function CalculatMacroAmt(ModRange) -( - ModRange!==0?( - this.type =='step'?( - this.CurrentPos = (beat_position * this.SEQ_DNom) % this.SEQ_Leng ; - this.out = SEQ[this.CurrentPos+1+64*(this.Macro-1)]*127*ModRange ; - - - ):this.type =='env'?( - - this.masr_set_risetime(this.atk); - this.masr_set_falltime(this.rel); - this.out = this.masr_do(midiamp)*ModRange; - //trkGUID_Num === gmem[2]? (gmem[this.EnvToImGui] = this.masr_do(midiamp)); - - - - ):this.type =='Fol' ? ( // if macro is Follower - - this.out = this.FOL_out*this.FOL_Gain *127*ModRange ; - ):( //if type is macro - this.Out = this.Slider * ModRange*127); - - - ):(this.Out = 0 ); - -); - - -function SetTypeTo (T) -( - Macro = gmem[5]; - Macro==1?(Mc1.type=T); - Macro==2?(Mc2.type=T); - Macro==3?(Mc3.Type=T); - Macro==4?(Mc4.Type=T); - Macro==5?(Mc5.Type=T); - Macro==6?(Mc6.Type=T); - Macro==7?(Mc7.Type=T); - Macro==8?(Mc8.Type=T); -); - - - - - -@slider -Mc1.Slider = slider1; -Mc2.Slider = slider2; -Mc3.Slider = slider3; -Mc4.Slider = slider4; -Mc5.Slider = slider5; -Mc6.Slider = slider6; -Mc7.Slider = slider7; -Mc8.Slider = slider8; - -@sample - - -Mc1.FOL_out = Mc1.follow_do((spl0+spl1)); -Mc2.FOL_out = Mc2.follow_do((spl0+spl1)); -Mc3.FOL_out = Mc3.follow_do((spl0+spl1)); -Mc4.FOL_out = Mc4.follow_do((spl0+spl1)); -Mc5.FOL_out = Mc5.follow_do((spl0+spl1)); -Mc6.FOL_out = Mc6.follow_do((spl0+spl1)); -Mc7.FOL_out = Mc7.follow_do((spl0+spl1)); -Mc8.FOL_out = Mc8.follow_do((spl0+spl1)); - - -@block -Sel_Trk_GUID_num = gmem[2]; -// This will only execute once when playback starts -play_state === 0 ? ( -sendMidi = 0; -); -play_state != 0 && sendMidi === 0 ? ( -midi_bus=15; -midisend(0, $x81, 30, 127); //Channel is the numb after $x9 -sendMidi= 1; -); -// ---------------------------------------- - -//▼Send Midi Msg only when slider is moved or automated -Sldr9!=Slider9?( midisend(0, $xAF/*AfterTouch, 16th Chan*/, 1/*Which Note*/ , Slider9)); -Sldr9=Slider9; - -Sldr10!=Slider10?( midisend(0, $xAF/*AfterTouch, 16th Chan*/, 2/*Which Note*/ , Slider10)); -Sldr10=Slider10; - -Sldr11!=Slider11?( midisend(0, $xAF/*AfterTouch, 16th Chan*/, 3/*Which Note*/ , Slider11)); -Sldr11=Slider11; - -Sldr12!=Slider12?( midisend(0, $xAF/*AfterTouch, 16th Chan*/, 4/*Which Note*/ , Slider12)); -Sldr12=Slider12; - -Sldr13!=Slider13?( midisend(0, $xAF/*AfterTouch, 16th Chan*/, 5/*Which Note*/ , Slider13)); -Sldr13=Slider13; - -Sldr14!=Slider14?( midisend(0, $xAF/*AfterTouch, 16th Chan*/, 6/*Which Note*/ , Slider14)); -Sldr14=Slider14; - -Sldr15!=Slider15?( midisend(0, $xAF/*AfterTouch, 16th Chan*/, 7/*Which Note*/ , Slider15)); -Sldr15=Slider15; - -Sldr16!=Slider16?( midisend(0, $xAF/*AfterTouch, 16th Chan*/, 8/*Which Note*/ , Slider16)); -Sldr16=Slider16; - - -mode= gmem[4]; -midi_bus=15; - - -//if user tweaking track that matches trkGUID -trkGUID_Num === gmem[2]? ( - Macro = gmem[5]; - mode ==1?( // if User is right-dragging on param in ImGui... - P.Inst = gmem[3]; - Param = gmem[6]; - Macro = gmem[5]; - a[Param+ Macro*1000] = gmem[Param+ Macro*1000]; - - ); - mode ==2?( // if User is adjusting atk... - gmem[9] !=0?(Mc1.atk = gmem[9]); - gmem[11]!=0?(Mc2.atk = gmem[11]); - gmem[13]!=0?(Mc3.atk = gmem[13]); - gmem[15]!=0?(Mc4.atk = gmem[15]); - gmem[17]!=0?(Mc5.atk = gmem[17]); - gmem[19]!=0?(Mc6.atk = gmem[19]); - gmem[21]!=0?(Mc7.atk = gmem[21]); - gmem[23]!=0?(Mc8.atk = gmem[23]); - SetTypeTo ('env'); - ); - mode ==3?( // if User is adjusting Release... - gmem[10]!=0?(Mc1.Rel=gmem[10]); - gmem[12]!=0?(Mc2.Rel=gmem[12]); - gmem[14]!=0?(Mc3.Rel=gmem[14]); - gmem[16]!=0?(Mc4.Rel=gmem[16]); - gmem[18]!=0?(Mc5.Rel=gmem[18]); - gmem[20]!=0?(Mc6.Rel=gmem[20]); - gmem[22]!=0?(Mc7.Rel=gmem[22]); - gmem[24]!=0?(Mc8.Rel=gmem[22]); - SetTypeTo ('env'); - ); - mode ==4?( //if user ctrl-r-click and change type to Env... - SetTypeTo ('env'); - ); - mode ==5? ( - SetTypeTo ('Mc'); - ); - mode == 6? ( - SetTypeTo ('step'); - ); - mode == 7 ? ( // if user is tweaking a step's Value - SetTypeTo ('step'); - WhichStep= gmem[113]; - Macro==1?( - SEQ[WhichStep]= gmem[112]; //writes seq value from table slot 20001~20048 - ):Macro==2?( // //writes seq value from table slot 20065~20129 - SEQ[WhichStep+64]= gmem[112]; - ):Macro==3?( // //writes seq value from table slot 20065~20129 - SEQ[WhichStep+64*2]= gmem[112]; - ):Macro==4?( // //writes seq value from table slot 20065~20129 - SEQ[WhichStep+64*3]= gmem[112]; - ):Macro==5?( // //writes seq value from table slot 20065~20129 - SEQ[WhichStep+64*4]= gmem[112]; - ):Macro==6?( // //writes seq value from table slot 20065~20129 - SEQ[WhichStep+64*5]= gmem[112]; - ):Macro==7?( // //writes seq value from table slot 20065~20129 - SEQ[WhichStep+64*6]= gmem[112]; - ):Macro==8?( // //writes seq value from table slot 20065~20129 - SEQ[WhichStep+64*7]= gmem[112]; - ); - - ); - - mode == 8 ? (// if user is changing Sequencer Lenth or note length... - Macro = gmem[5]; - Macro==1?( //if user is tweaking macro 1 - gmem[110] != 0 ? (Mc1.SEQ_Leng = gmem[110]; gmem[110] = 0) ; - gmem[111] != 0 ? (Mc1.SEQ_DNom = gmem[111]; gmem[111] = 0); - ):Macro==2?( - gmem[110] != 0 ? (Mc2.SEQ_Leng = gmem[110]; gmem[110] = 0); - gmem[111] != 0 ? (Mc2.SEQ_DNom = gmem[111]; gmem[111] = 0); - ):Macro==3?( - gmem[110] != 0 ? (Mc3.SEQ_Leng = gmem[110]; gmem[110] = 0); - gmem[111] != 0 ? (Mc3.SEQ_DNom = gmem[111]; gmem[111] = 0); - ):Macro==4?( - gmem[110] != 0 ? (Mc4.SEQ_Leng = gmem[110]; gmem[110] = 0); - gmem[111] != 0 ? (Mc4.SEQ_DNom = gmem[111]; gmem[111] = 0); - ):Macro==5?( - gmem[110] != 0 ? (Mc5.SEQ_Leng = gmem[110]; gmem[110] = 0); - gmem[111] != 0 ? (Mc5.SEQ_DNom = gmem[111]; gmem[111] = 0); - ):Macro==6?( - gmem[110] != 0 ? (Mc6.SEQ_Leng = gmem[110]; gmem[110] = 0); - gmem[111] != 0 ? (Mc6.SEQ_DNom = gmem[111]; gmem[111] = 0); - ):Macro==7?( - gmem[110] != 0 ? (Mc7.SEQ_Leng = gmem[110]; gmem[110] = 0); - gmem[111] != 0 ? (Mc7.SEQ_DNom = gmem[111]; gmem[111] = 0); - ):Macro==8?( - gmem[110] != 0 ? (Mc8.SEQ_Leng = gmem[110]; gmem[110] = 0); - gmem[111] != 0 ? (Mc8.SEQ_DNom = gmem[111]; gmem[111] = 0); - ); - ); - - mode == 9? ( - SetTypeTo('Fol') - - ); - - mode == 10 ? ( - // sets smoothness - Macro = gmem[5]; - Macro==1?(Mc1.follow_set_freq(gmem[9])); - Macro==2?(Mc2.follow_set_freq(gmem[9])); - Macro==3?(Mc3.follow_set_freq(gmem[9])); - Macro==4?(Mc4.follow_set_freq(gmem[9])); - Macro==5?(Mc5.follow_set_freq(gmem[9])); - Macro==6?(Mc6.follow_set_freq(gmem[9])); - Macro==7?(Mc7.follow_set_freq(gmem[9])); - Macro==8?(Mc8.follow_set_freq(gmem[9])); - - ); - mode == 11 ? ( - - - - - Macro==1?(Mc1.FOL_Gain = gmem[9];); - Macro==2?(Mc2.FOL_Gain = gmem[9];); - Macro==3?(Mc3.FOL_Gain = gmem[9];); - Macro==4?(Mc4.FOL_Gain = gmem[9];); - Macro==5?(Mc5.FOL_Gain = gmem[9];); - Macro==6?(Mc6.FOL_Gain = gmem[9];); - Macro==7?(Mc7.FOL_Gain = gmem[9];); - Macro==8?(Mc8.FOL_Gain = gmem[9];); - ); - - gmem[7] != 0?( // if user uses Imgui to tweak param... - P_Id = gmem[7]; - P_OrigV[P_Id]= gmem[11000+P_Id]; - what=gmem[8]; - gmem[8] != 0?( // if paramV + Mod is over 1... - a[Param+ Macro*1000] = gmem[Param+ Macro*1000] - ); - - ); - - - - - MeasureNum= floor(beat_position/ts_denom); - - - - beat_pos = play_position * tempo ; - - - - BeatPos= beat_position - ts_denom* (MeasureNum); - - - - beat_per_block = beat_per_spl * samplesblock; - beat_per_block *= speed; - next_block_pos = fmod(bp + beat_per_block, sequence_length); - -); // --------------------- End of if track is selected ----------------------- - - - - -while (midirecv(offset, msg1, msg2, msg3)) ( - // get noteons and noteoffs from all channels - (msg1 & $xF0) == $x90 || (msg1 & $xF0) == $x80 ? ( - msg3 != 0 ? ( - // noteon - midinote = msg2; - - // msg3 == Velocity - midiamp = 128; // /msg33 // if you want Velocity involved use msg 3 - midisend(offset,msg1,msg2,msg3); - ) : ( - // noteoff - msg2 == midinote ? midiamp = 0; - midisend(offset,msg1,msg2,msg3); - ); - ) : ( - // passthrough other events - midisend(offset,msg1,msg2,msg3); - ); -); - -i=1; -while ( i <= P.Inst)( - - - - - Mc1.CalculatMacroAmt(ModAmt[i]); - Mc2.CalculatMacroAmt(ModAmt2[i]); - Mc3.CalculatMacroAmt(ModAmt3[i]); - Mc4.CalculatMacroAmt(ModAmt4[i]); - Mc5.CalculatMacroAmt(ModAmt5[i]); - Mc6.CalculatMacroAmt(ModAmt6[i]); - Mc7.CalculatMacroAmt(ModAmt7[i]); - Mc8.CalculatMacroAmt(ModAmt8[i]); - - ModAmtTotal = Mc1.Out+Mc2.Out+Mc3.Out+Mc4.Out+Mc5.Out+Mc6.Out+Mc7.Out+Mc8.Out; - - SendAmt = P_OrigV[i]*127 + ModAmtTotal; - - SendAmt > 127 ? (SendAmt = 127) ; - - midisend(0, $xBf, i, SendAmt); - - i+=1; -); - - -/// ---------------- Send info back to ImGui ------------------ -trkGUID_Num === gmem[2]? ( - loop(8, - m+=1; - Mc1.SendInfoBackToImGui(); - Mc2.SendInfoBackToImGui(); - Mc3.SendInfoBackToImGui(); - Mc4.SendInfoBackToImGui(); - Mc5.SendInfoBackToImGui(); - Mc6.SendInfoBackToImGui(); - Mc7.SendInfoBackToImGui(); - Mc8.SendInfoBackToImGui(); - - ); -); - - - - - - - - - - - - -//------------------------------------------------------------------------------------------------ - - -while (midirecv(offset, msg1, msg2, msg3)) ( - // get noteons and noteoffs from all channels - (msg1 & $xF0) == $x90 || (msg1 & $xF0) == $x80 ? ( - msg3 != 0 ? ( - // noteon - midinote = msg2; - // Normalizes amplitude value - midiamp = msg3 / 94; - time = time_precise(); - Aa_TestEnv = 1; - - - ) : ( - // noteoff - msg2 == midinote ? midiamp = 0; - ); - ) : ( - // passthrough other events - midisend(offset,msg1,msg2,msg3); - ); -); - - - diff --git a/FX/BryanChi_FX Devices/FXD ReSpectrum.jsfx b/FX/BryanChi_FX Devices/FXD ReSpectrum.jsfx deleted file mode 100644 index 38e15d905..000000000 --- a/FX/BryanChi_FX Devices/FXD ReSpectrum.jsfx +++ /dev/null @@ -1,541 +0,0 @@ -noindex: true - -desc: FXD ReSpectrum - -slider1:Spectrum_Mode=3<0,5,1{Full,Mid,Side,Mid / Side,Left,Right,Left / Right}>-Spectrum -slider2:Display_Mode=0<0,2,1{Fill,Line,None}>-Display -slider3:Ceiling_Value=0<0,2,1{0dB,20dB,40dB}>-Ceiling -slider4:Floor_Value=0<0,2,1{-60dB,-140dB,-200dB}>-Floor -slider5:Tilt_Value=3<0,5,1{0dB/oct,1.5dB/oct,3dB/oct,4.5dB/oct,6dB/oct}>-Tilt -slider6:Type_Value=1<0,3,1{Hamming,Blackman-Harris,Blackman,Rectangular}>-Type -slider7:Block_Value=2<0,3,1{2048,4096,8192,16384}>-Block Size -slider8:Show_Piano=0<0,1,1{Off,On}>-Show Piano -slider8:Show_Peaks=0<0,1,1{Off,On}>-Show Peaks - -import Dependencies/spectrum.jsfx-inc -import Dependencies/svf_filter.jsfx-inc - -options:no_meter -options:gmem=gmemReEQ_Spectrum -options:gfx_idle -options:gfx_hz=60 -@init - -#VERSION = "1.1.4"; - -gfx_ext_retina = 1; -ext_nodenorm = 1; -ext_noinit = 1; -last_gfx_ext_retina = -1; -DIY_ID = gmem[1]; -ThisFXID = gmem[2]; -/* - * Round number up or down - */ -function round(in) ( - floor(in + 0.5 * sign(in)); -); - -/* - * Standard log2 - */ -function log2(x) ( - log(x) / log(2); -); - -/* - * Return string of integer - */ -function int2str(intIn) local (outStr) ( - strcpy(outStr=#,""); - sprintf(outStr,"%d",intIn); - outStr; -); - -/* - * Update the state of any changes - */ -function update_state() local (blocks) ( - spectrum.ceiling = Ceiling_Value == 0 ? 0 : Ceiling_Value == 1 ? 20 : Ceiling_Value == 2 ? 40; - spectrum.noise_floor = Floor_Value == 0 ? -90 : Floor_Value == 1 ? -140 : Floor_Value == 2 ? -200; - spectrum.noise_floor = Floor_Value == 0 ? -90 : Floor_Value == 1 ? -140 : Floor_Value == 2 ? -200; - spectrum.tilt = Tilt_Value == 0 ? 0 : Tilt_Value == 1 ? 1.5 : Tilt_Value == 2 ? 3 : Tilt_Value == 3 ? 4.5 : - Tilt_Value == 4 ? 6; - - spectrum.windowtype != Type_Value+1 ? spectrum.set_type(Type_Value+1); - - blocks = (2 ^ (Block_Value+1)) * 1024; - - spectrum.windowsize != blocks ? spectrum.set_block_size(blocks); - - Display_Mode == 0 ? ( - fill_r = 46 / 255; - fill_g = 71 / 255; - fill_b = 83 / 255; - fill_a = 1.0; - spectrum.set_fill(0, 1); - spectrum.set_color(0, fill_r, fill_g, fill_b, fill_a); - fill_r = 96 / 255; - fill_g = 223 / 255; - fill_b = 255 / 255; - fill_a = 0.5; - spectrum.set_fill(1, 1); - spectrum.set_color(1, fill_r, fill_g, fill_b, fill_a); - ) : Display_Mode == 1 ? ( - line_a=1.0; - line_r = 114 / 255; line_g = 215 / 255; line_b = 253 / 255;; - spectrum.set_fill(0, 0); - spectrum.set_color(0, line_r, line_g, line_b, line_a); - line_r = 253 / 255; line_g = 185 / 255; line_b = 21 / 255;; - spectrum.set_fill(1, 0); - spectrum.set_color(1, line_r, line_g, line_b, line_a); - ); -); - - - -/* - * Draw the listener boundaries and set the Q for the bandpass filter - */ - -/* - * Initialise the peaks show button - */ -function init_peak_button(xpos, ypos, buttonwidth) instance (x, y, width, label) ( - x = xpos; - y = ypos; - width = buttonwidth; - label = "Peaks"; -); - -/* - * Draw the peaks toggle button - */ -function draw_peak_button() instance (x, y, width, menutext, label, pressed, height, label) local(w, h, a) ( - mouse_x >= 0 && mouse_x < gfx_w && mouse_y >=0 && mouse_y < gfx_h ? ( - gfx_a = 1; - - gfx_measurestr(label, w, h); - - height = h + 8; - - mouse_x >= x && mouse_x <= x+width && mouse_y >= y && mouse_y <= y + height ? ( - gfx_r = (114 / 255) * 0.6; - gfx_g = (215 / 255) * 0.6; - gfx_b = (253 / 255) * 0.6; - ) : ( - Show_Peaks ? a = 0.6 : a = 0.4; - gfx_r = (114 / 255) * a; - gfx_g = (215 / 255) * a; - gfx_b = (253 / 255) * a; - ); - - gfx_rect(x, y, width, h+9); - - gfx_circle(x, y + ((h+8)*0.5), ((h+8)*0.5), 1); - gfx_circle(x + width, y + ((h+8)*0.5), ((h+8)*0.5), 1); - - Show_Peaks ? ( - gfx_r = (114 / 255); - gfx_g = (215 / 255); - gfx_b = (253 / 255); - ) : ( - gfx_r = (114 / 300); - gfx_g = (215 / 300); - gfx_b = (253 / 300); - ); - gfx_a = 1; - gfx_x = x + (width / 2) - (w / 2); - gfx_y = y + 4; - gfx_drawstr(label); - ); -); - -/* - * Handle clicking the peaks button - */ -function handle_peak_button() instance (x, y, width, label, pressed, height, label) - local (last_clicked_item) -( - last_clicked_item = 0; - mouse_cap & 1 && !pressed ? ( - mouse_x >= x && mouse_x <= x+width && mouse_y >= y && mouse_y <= y + height ? ( - pressed = 1; - - Show_Peaks = Show_Peaks ? Show_Peaks = 0 : 1; - - spectrum.set_show_peaks(Show_Peaks); - - ) : pressed = 0; - ) : ( - !(mouse_cap & 1) ? pressed = 0; - ); -); - -/* - * Initialise the piano keys toggle button - */ -function init_piano_button(xpos, ypos, buttonwidth) instance (x, y, width, label) ( - x = xpos; - y = ypos; - width = buttonwidth; - label = "Keys"; -); - -/* - * Draw the piano keys button - */ -function draw_piano_button() instance (x, y, width, menutext, label, pressed, height, label) local(w, h, a) ( - mouse_x >= 0 && mouse_x < gfx_w && mouse_y >=0 && mouse_y < gfx_h ? ( - gfx_a = 1; - - gfx_measurestr(label, w, h); - - height = h + 8; - - mouse_x >= x && mouse_x <= x+width && mouse_y >= y && mouse_y <= y + height ? ( - gfx_r = (114 / 255) * 0.6; - gfx_g = (215 / 255) * 0.6; - gfx_b = (253 / 255) * 0.6; - ) : ( - Show_Piano ? a = 0.6 : a = 0.4; - gfx_r = (114 / 255) * a; - gfx_g = (215 / 255) * a; - gfx_b = (253 / 255) * a; - ); - - gfx_rect(x, y, width, h+9); - - gfx_circle(x, y + ((h+8)*0.5), ((h+8)*0.5), 1); - gfx_circle(x + width, y + ((h+8)*0.5), ((h+8)*0.5), 1); - - Show_Piano ? ( - gfx_r = (114 / 255); - gfx_g = (215 / 255); - gfx_b = (253 / 255); - ) : ( - gfx_r = (114 / 300); - gfx_g = (215 / 300); - gfx_b = (253 / 300); - ); - gfx_a = 1; - gfx_x = x + (width / 2) - (w / 2); - gfx_y = y + 4; - gfx_drawstr(label); - ); -); - -/* - * Handle the piano keys button - */ -function handle_piano_button() instance (x, y, width, label, pressed, height, label) - local (last_clicked_item) -( - last_clicked_item = 0; - mouse_cap & 1 && !pressed ? ( - mouse_x >= x && mouse_x <= x+width && mouse_y >= y && mouse_y <= y + height ? ( - pressed = 1; - - Show_Piano = Show_Piano ? Show_Piano = 0 : 1; - - ) : pressed = 0; - ) : ( - !(mouse_cap & 1) ? pressed = 0; - ); -); - -/* - * Initialise the analyzer options button - */ -function init_menu_button(xpos, ypos, buttonwidth, buttonlabel, menutext) instance (x, y, width, menutext, label) ( - x = xpos; - y = ypos; - width = buttonwidth; - this.menutext = menutext; - label = buttonlabel; -); - -/* - * Draw the analyzer options button - */ -function draw_menu_button() instance (x, y, width, menutext, label, pressed, height, label) ( - mouse_x >= 0 && mouse_x < gfx_w && mouse_y >=0 && mouse_y < gfx_h ? ( - gfx_a = 1; - - gfx_measurestr(label, w, h); - - height = h + 8; - - mouse_x >= x && mouse_x <= x+width && mouse_y >= y && mouse_y <= y + height ? ( - gfx_r = (114 / 255) * 0.6; - gfx_g = (215 / 255) * 0.6; - gfx_b = (253 / 255) * 0.6; - ) : ( - gfx_r = (114 / 255) * 0.4; - gfx_g = (215 / 255) * 0.4; - gfx_b = (253 / 255) * 0.4; - ); - - gfx_rect(x, y, width, h+9); - - gfx_circle(x, y + ((h+8)*0.5), ((h+8)*0.5), 1); - gfx_circle(x + width, y + ((h+8)*0.5), ((h+8)*0.5), 1); - - gfx_r = (114 / 255); - gfx_g = (215 / 255); - gfx_b = (253 / 255); - gfx_a = 1; - gfx_x = x + (width / 2) - (w / 2); - gfx_y = y + 4; - gfx_drawstr(label); - ); -); - -/* - * Handle the analyzer options button - */ -function handle_menu_button() instance (x, y, width, menutext, label, pressed, height, label) - local (last_clicked_item) -( - last_clicked_item = 0; - mouse_cap & 1 && !pressed ? ( - mouse_x >= x && mouse_x <= x+width && mouse_y >= y && mouse_y <= y + height ? ( - pressed = 1; - - #menu = "#Version: "; - #menu += #VERSION; - #menu += " ||"; - - #menu += ">Spectrum|"; - Spectrum_Mode == 0 ? #menu += "!"; #menu += "Full|"; - Spectrum_Mode == 1 ? #menu += "!"; #menu += "Mid|"; - Spectrum_Mode == 2 ? #menu += "!"; #menu += "Side|"; - Spectrum_Mode == 3 ? #menu += "!"; #menu += "Mid + Side|"; - Spectrum_Mode == 4 ? #menu += "!"; #menu += "Left|"; - Spectrum_Mode == 5 ? #menu += "!"; #menu += "Right|"; - Spectrum_Mode == 6 ? #menu += "!"; #menu += "= 1 && last_clicked_item <= 7 ? ( - // Force reset of peak buffers - spectrum.set_show_peaks(Show_Peaks); - - Spectrum_Mode = last_clicked_item - 1; - ); - - last_clicked_item >= 8 && last_clicked_item <= 10 ? ( - Display_Mode = last_clicked_item - 8; - ); - - last_clicked_item >= 11 && last_clicked_item <= 13 ? ( - Ceiling_Value = last_clicked_item - 11; - ); - - last_clicked_item >= 14 && last_clicked_item <= 16 ? ( - Floor_Value = last_clicked_item - 14; - ); - - last_clicked_item >= 17 && last_clicked_item <= 21 ? ( - Tilt_Value = last_clicked_item - 17; - ); - - last_clicked_item >= 22 && last_clicked_item <= 25 ? ( - Type_Value = last_clicked_item - 22; - ); - - last_clicked_item >= 26 && last_clicked_item <= 29 ? ( - Block_Value = last_clicked_item - 26; - ); - - last_clicked_item >= 1 ? update_state(); - ) : pressed = 0; - ) : ( - !(mouse_cap & 1) ? pressed = 0; - ); - - last_clicked_item; -); - -/* - * Set global state vars - */ - -do_listen = 0; -listen_width = 0.10; - -filter.svf_set_sample_rate(srate); - -gfx_ext_retina == 2 ? ( - menu.init_menu_button(gfx_w - 140, 10, 120, "Settings", ""); - piano.init_piano_button(gfx_w - 300, 10, 100); - peaks.init_peak_button(gfx_w - 420, 10, 100); -) : ( - menu.init_menu_button(gfx_w - 140, 10, 80, "Settings", ""); - piano.init_piano_button(gfx_w - 300, 10, 60); - peaks.init_peak_button(gfx_w - 420, 10, 60); -); - -spectrum.set_show_peaks(Show_Peaks); - -spectrum.init(); - -@slider - -update_state(); - -@sample - -// Mid/Side encode -mid = (spl0 + spl1) * 0.5; -side = (spl0 - spl1) * 0.5; - -// Feed the correct buffers depending on spectrum modes -Spectrum_Mode == 0 ? spectrum.sample0(spl0 + spl1) : -Spectrum_Mode == 1 ? spectrum.sample0(mid) : -Spectrum_Mode == 2 ? spectrum.sample0(side) : -Spectrum_Mode == 3 ? (spectrum.sample0(mid); spectrum.sample1(side)) : -Spectrum_Mode == 4 ? spectrum.sample0(spl0); -Spectrum_Mode == 5 ? spectrum.sample0(spl1) : -Spectrum_Mode == 6 ? (spectrum.sample0(spl0); spectrum.sample1(spl1)); - -// Filter if we're in listen mode -do_listen ? ( - mono = 0.5 * (spl0 + spl1); - filter.svf_bp2(listen_freq, listen_q); - spl0 = spl1 = filter.svf_svf0(mono); -); - -@gfx 640 400 -Fx_Idx = gmem[ThisFXID]; -Diy_ID == gmem[1]?( - gfx_ext_flags = 2; - - gfx_ext_retina != last_gfx_ext_retina ? ( - last_gfx_ext_retina = gfx_ext_retina; - - gfx_ext_retina > 1 ? ( - gfx_setfont(1,"Arial",20,'b'); - gfx_setfont(2,"Arial",18,'b'); - ) : ( - gfx_setfont(1,"Arial",12,'b'); - gfx_setfont(2,"Arial",10,'b'); - ); - gfx_setfont(1); - ); - - actual_width = gfx_w / gfx_ext_retina; - actual_height = gfx_h / gfx_ext_retina; - - // Calculage compact view flags - // These are used to disable certain elements for graceful visual shrinking - compact_width = actual_width < 600; - compact_height = actual_height < 320; - - gfx_ext_retina != 2 ? ( - very_compact_width = (actual_width < 450); - very_compact_height = (actual_height < 240); - ) : ( - very_compact_width = (actual_width < 300); - very_compact_height = (actual_height < 160); - ); - - very_compact_width | very_compact_height ? ( - spectrum.bottom_margin = -18 * gfx_ext_retina; - ) : ( - spectrum.bottom_margin = 0; - ); - - - - Display_Mode < 2 ? ( - spectrum.draw(0); - - Spectrum_Mode == 3 || Spectrum_Mode == 6 ? spectrum.draw(1); - ); //draw two spectrums if mode = Mid+ Side or L + R - - ht = (gfx_h - spectrum.bottom_margin - gfx_texth) + 2; - - dst_a = 0.55 / ht; - gfx_gradrect(0, ht/2, gfx_w, ht/2, 0,0,0,0, 0, 0, 0, 0, 0, 0, 0, dst_a*2); - - !((very_compact_width) | (very_compact_height)) ? ( - spectrum.draw_grid(0); - ); - - chr = gfx_getchar(); - - mouse_cap & 8 ? ( - do_listen = 1; - //draw_listen_helper(); - - mw = mouse_wheel; - md = -(mw - last_wheel) / 120; - last_wheel = mw;;; - - listen_width += md / 200; - listen_width = min(0.30, listen_width); - listen_width = max(0.01, listen_width); - - ) : do_listen = 0; - - !((compact_width) | (compact_height)) ? ( - mouse_x >= 0 && mouse_x < gfx_w && mouse_y >=0 && mouse_y < gfx_h ? ( - note_select = Show_Piano ? spectrum.draw_piano() : 0; - ) : note_select = 0; - ); - - - !((very_compact_width) | (very_compact_height)) ? ( - gfx_ext_retina == 2 ? (menu.x = gfx_w - 140; menu.width = 120;) : (menu.x = gfx_w - 100; menu.width = 80;); - menu.draw_menu_button(); - menu.handle_menu_button(); - - gfx_ext_retina == 2 ? (piano.x = gfx_w - 280; piano.width = 100;) : (piano.x = gfx_w - 190; piano.width = 60;); - piano.draw_piano_button(); - piano.handle_piano_button(); - - gfx_ext_retina == 2 ? (peaks.x = gfx_w - 420; peaks.width = 100;) : (peaks.x = gfx_w - 280; peaks.width = 60;); - peaks.draw_peak_button(); - peaks.handle_peak_button(); - ); - - -); diff --git a/FX/BryanChi_FX Devices/FXD Saike BandSplitter.jsfx b/FX/BryanChi_FX Devices/FXD Saike BandSplitter.jsfx deleted file mode 100644 index 31524b982..000000000 --- a/FX/BryanChi_FX Devices/FXD Saike BandSplitter.jsfx +++ /dev/null @@ -1,2430 +0,0 @@ -noindex: true - -desc:FXD Saike BandSplitter -license: MIT -tags: bandsplitter -version: 0.17 -author: Joep Vanlier - -in_pin:left input -in_pin:right input -out_pin:left output 1 -out_pin:right output 1 -out_pin:left output 2 -out_pin:right output 2 -out_pin:left output 3 -out_pin:right output 3 -out_pin:left output 4 -out_pin:right output 4 -out_pin:left output 5 -out_pin:right output 5 - -slider1:Cuts=2<0,4,1>-Cuts -slider2:Freq1=0.2<0,1,.0001>-Frequency 1 -slider3:Freq2=0.5<0,1,.0001>-Frequency 2 -slider4:Freq3=1<0,1,.0001>-Frequency 3 -slider5:Freq4=0.5<0,1,.0001>-Frequency 4 - -slider6:Drive1=0<-40,60,.1>-Drive 1 (dB) -slider7:Drive2=0<-40,60,.1>-Drive 2 (dB) -slider8:Drive3=0<-40,60,.1>-Drive 3 (dB) -slider9:Drive4=0<-40,60,.1>-Drive 4 (dB) -slider10:Drive5=0<-40,60,.1>-Drive 5 (dB) - -slider59:abs_placement=1<0,1,1>-Absolute placement -slider60:FIR_quality=0<0,2,{Normal,High,Ultra}>-FIR Quality -slider61:FIR=0<0,1,1>-FIR mode - -slider62:masterGainSlider=0<-26,26,.1>-Master Gain -slider63:band_mode=0<0,1,1{4p,2p}>-Band mode - -options:gmem=FXD_BandSplit -options:gfx_idle -options:gfx_hz=60 - -@init - -FxID = gmem[-1]; -/*function fft_real(x, x) -( - 1 -);*/ - -// gmem 1 = Right Click Pos - -/*-----------*/ -/* HINTS */ -/*-----------*/ -function updateHintTime(hint) - global(gfx_x, gfx_y) - local() - instance(hintTime, currentHint, delta_time) - ( - (hint != 0) ? ( - currentHint = hint; - hintTime = hintTime + delta_time; - hintTime = min(1, hintTime); - ) : ( - 0 - ); - ); - -function drawHint_draw() - global(scaling, gfx_x, gfx_y, gfx_w, gfx_h, mouse_x, mouse_y, fontface, HINT_FONT) - local(w, h, globalTime) - instance(hintTime, currentHint, lastGlobalTime, delta_time, lx, ly) - ( - globalTime = time_precise(); - delta_time = globalTime - lastGlobalTime; - lastGlobalTime = globalTime; - - ( ( abs( lx - mouse_x ) + abs( ly - mouse_y ) ) > 0 ) ? ( - hintTime = 0; - ); - - ( hintTime > .99 ) ? ( - gfx_setfont(HINT_FONT); - gfx_measurestr(currentHint,w,h); - - gfx_x = mouse_x+15; - gfx_y = mouse_y+15; - ( gfx_x > 0.5*gfx_w ) ? gfx_x = mouse_x - w - 8; - ( gfx_y > 0.5*gfx_h ) ? gfx_y = mouse_y - h - 8; - - gfx_set( 0.05, 0.05, 0.1, .8 ); - gfx_rect(gfx_x-2, gfx_y-2, w+4, h+4); - gfx_set( .7, .7, .7, 1 ); - gfx_printf(currentHint); - ); - - lx = mouse_x; - ly = mouse_y; - ); - -/*-----------*/ -/* CIRCLE */ -/*-----------*/ -function fancyCircle(x1, y1, rin, mute, solo, bypass) - local(dx) - global(globalTime, lineR, lineG, lineB, lineA, lineHighlightR, lineHighlightG, lineHighlightB) - instance(hl, x, y, r, over, gfx_mode) - ( - x = x1; - y = y1; - rin == 0 ? r = 10 : r = rin; - - over ? ( - hl = abs(sin(2*globalTime)); - gfx_set(lineHighlightR, lineHighlightG, lineHighlightB, .1*hl); - gfx_circle(x, y, 1.2*r, 1, 1); - gfx_set(lineHighlightR, lineHighlightG, lineHighlightB, .1*hl); - gfx_circle(x, y, 1.5*r, 1, 1); - gfx_set(lineHighlightR, lineHighlightG, lineHighlightB, .05*hl); - gfx_circle(x, y, 1.9*r, 1, 1); - gfx_set(lineHighlightR, lineHighlightG, lineHighlightB, .03*hl); - gfx_circle(x, y, 4*r, 1, 1); - ); - - gfx_set(.2*lineR, .2*lineG, .2*lineB, 1); - gfx_circle(x, y, r, 1, 1); - - gfx_set(lineR, lineG, lineB, lineA); - gfx_circle(x, y, .92*r, 1, 1); - - gfx_set(.8*lineR, .8*lineG, .8*lineB, lineA); - gfx_circle(x, y, .8*r, 1, 1); - - gfx_set(.6*lineR, .6*lineG, .6*lineB, lineA); - gfx_circle(x, y, .75*r, 1, 1); - - gfx_set(.4*lineR, .4*lineG, .4*lineB, lineA); - gfx_circle(x, y, .7*r, 1, 1); - - ( solo == 1 ) ? ( - gfx_set(.2, 1, .2, .5); - gfx_circle(x, y, .8*r, 1, 1); - gfx_set(.2, 1, .2, .5); - gfx_circle(x, y, .9*r, 1, 1); - gfx_set(.2, 1, .2, .5); - gfx_circle(x, y, r, 1, 1); - gfx_set(.2, 1, .2, .2); - gfx_circle(x, y, 1.2*r, 1, 1); - - gfx_set(.7, 1, .7, .3); - gfx_circle(x, y, .7*r, 1, 1); - - gfx_set(.2, 1, .5, .08); - gfx_circle(x, y, 1.1*r, 1, 0); - gfx_set(.2, 1, .5, .08); - gfx_circle(x, y, 1.2*r, 1, 0); - gfx_set(.2, 1, .5, .08); - gfx_circle(x, y, 1.4*r, 1, 0); - ) : ( mute == 1 ) ? ( - gfx_set(1, .2, .2, .5); - gfx_circle(x, y, .8*r, 1, 1); - gfx_set(1, .2, .2, .5); - gfx_circle(x, y, .9*r, 1, 1); - gfx_set(1, .2, .2, .5); - gfx_circle(x, y, r, 1, 1); - gfx_set(1, .2, .2, .2); - gfx_circle(x, y, 1.2*r, 1, 1); - - gfx_set(1, .55, .55, 1); - gfx_circle(x, y, 1*r, 0, 1); - - gfx_set(1, .7, .7, .1); - gfx_circle(x, y, .7*r, 1, 1); - - gfx_set(1, .5, .5, .1); - gfx_circle(x, y, 1.1*r, 1, 0); - gfx_set(1, .5, .5, .1); - gfx_circle(x, y, 1.2*r, 1, 0); - gfx_set(1, .5, .5, .1); - gfx_circle(x, y, 1.4*r, 1, 0); - ); - - ( bypass == 1 ) ? ( - gfx_set(1-mute, .2, .2, 1); - dx = .5*r; - gfx_line(x-dx, y-dx-1, x+dx, y+dx-1); - gfx_line(x-dx, y-dx+1, x+dx, y+dx+1); - gfx_line(x+dx, y-dx-1, x-dx, y+dx-1); - gfx_line(x+dx, y-dx+1, x-dx, y+dx+1); - gfx_line(x+dx, y-dx, x-dx, y+dx); - gfx_line(x-dx, y-dx, x+dx, y+dx); - ); - - over ? ( - gfx_set(1,1,1,.4*hl); - gfx_circle(x, y, .6*r, 1, 1); - gfx_circle(x, y, 1.4*r, 0, 1); - gfx_circle(x, y, 1.5*r, 0, 1); - ); - - over = 0; - ); - -/*-----------*/ -/* TOGGLE */ -/*-----------*/ -function processMouseToggle(mx, my, mousecap) - instance(x, y, w, h, on, lastleft, str) - local(left, slack, over) - global(hinter.updateHintTime, comboboxOpen) - ( - !comboboxOpen ? ( - slack = 5; - left = mousecap & 1; - - over = ( (mx >= (x-slack)) && ( mx <= (x+w+slack) ) && ( my >= (y-slack) ) && ( my <= (y+h+slack) ) ); - - over ? ( - ( (left == 1) && (lastleft == 0) ) ? ( - on = 1 - on; - ); - hinter.updateHintTime(str); - ); - - lastleft = left; - ); - - on - ); - -function drawToggle(_x, _y, _w, _h, _on, wr, wg, wb, wa, r, g, b, a, _str) - local(ww, hh) - instance(x, y, w, h, str, on, invert, label) - global(gfx_x, gfx_y, gfx_a, gfx_mode, - TOGGLE_FONT, knob_font_color_r, knob_font_color_g, knob_font_color_b, knob_font_color_a) - ( - x = _x; - y = _y; - w = _w; - h = _h; - on = _on; - str = _str; - - gfx_set(0, 0, 0, 0); - gfx_rect(x, y, w, h); - - gfx_set(r, g, b, a*.2); - gfx_rect(x, y, w, h); - - gfx_set(wr, wg, wb, wa); - gfx_line(x, y, x+w, y); - gfx_line(x, y, x, y+h); - gfx_line(x+w, y, x+w, y+h); - gfx_line(x, y+h, x+w, y+h); - - ( label ) ? ( - gfx_set(knob_font_color_r, knob_font_color_g, knob_font_color_b, knob_font_color_a); - gfx_setfont(TOGGLE_FONT); - gfx_measurestr(label, ww, hh); - gfx_x = floor(x+1.5*w); - gfx_y = floor(y-.5*hh+.5*h); - gfx_printf(label); - ); - - ( (on && !invert) || (!on && invert) ) ? ( - gfx_set(r, g, b, a); - gfx_rect(x, y, w, h); - gfx_a *= .6; - gfx_rect(x-1, y-1, w+2, h+2); - gfx_a *= .6; - gfx_rect(x-2, y-2, w+4, h+4); - gfx_a *= .6; - gfx_rect(x-3, y-3, w+6, h+6); - gfx_a *= .4; - gfx_circle(x+.5*w-1, y+.5*h-1, 2*max(w,h), 2*max(w,h)); - gfx_a *= .4; - gfx_circle(x+.5*w-1, y+.5*h-1, 3*max(w,h), 3*max(w,h)); - gfx_a *= .4; - gfx_circle(x+.5*w-1, y+.5*h-1, 4*max(w,h), 4*max(w,h)); - gfx_a *= .4; - gfx_circle(x+.5*w-1, y+.5*h-1, 5*max(w,h), 5*max(w,h)); - ); - ); - - - GRID_FONT = 15; - HINT_FONT = 14; - TOGGLE_FONT = 15; - gfx_ext_retina = 1; - - function f_trafo(freq) - local() - global(srate, freq_max, norm_freq_min) - instance() - ( - freq_max * exp( (1-freq) * log(norm_freq_min) ) - ); - - function initBands() - local() - global() - instance(lg1, lg2, lg3, lg4, lg5, b1, b2, b3, b4, b5) - ( - lg1 = lg2 = lg3 = lg4 = lg5 = -1000000; - b1.ldrive = b2.ldrive = b3.ldrive = b4.ldrive = b5.ldrive = -1000000; - b1.initialized = b2.initialized = b3.initialized = b4.initialized = b5.initialized = 0; - ); - -maxCuts = 4; -driveMax = 60; -driveMin = -40; -driveRange = driveMax - driveMin; - -filterBank.initBands(); - -// Precompute some things -gainRange = ( gainMax - gainMin ); -iGainRange = 1.0 / gainRange; -iDriveRange = 1.0 / driveRange; - -/////////////////// -/* SLIDER LAYOUT */ -/////////////////// -/* Keep these updated with the slider locations */ -frequencyLocation = 2; -driveLocation = 6; - -/* Shift slider data right (for different bands) */ -function shiftRight(loc, fromIdx, numElements) - local(midx) - global() - ( - midx = loc + numElements; - loop(numElements-fromIdx, - slider(midx) = slider(midx-1); - midx = midx - 1; - ); - ); - -/* Shift slider data left (for different bands) */ -function shiftLeft(loc, fromIdx, numElements) - local(midx) - global() - ( - midx = loc+fromIdx; - loop(numElements-fromIdx, - slider(midx) = slider(midx+1); - midx = midx + 1; - ); - ); - -/* Shift slider data right (for different bands) */ -function shiftRightMem(loc, fromIdx, numElements) - local(midx) - global() - ( - midx = loc + numElements; - loop(numElements-fromIdx, - midx[] = midx[-1]; - midx -= 1; - ); - ); - -/* Shift slider data left (for different bands) */ -function shiftLeftMem(loc, fromIdx, numElements) - local(midx) - global() - ( - midx = loc+fromIdx; - loop(numElements-fromIdx, - midx[] = midx[1]; - midx += 1; - ); - ); - -/* Make room for a new band in the slider data */ -function addBand(idx) - local(midx) - instance() - ( - shiftRight( driveLocation, idx, maxCuts ); - shiftRight( frequencyLocation, idx, maxCuts-1 ); - - cuts = cuts + 1; - ); - -/* Remove a band and move other slider data accordingly */ -function remBand(idx) - - local(midx) - instance() - ( - shiftLeft( driveLocation, idx, maxCuts ); - shiftLeft( frequencyLocation, idx, maxCuts-1 ); - - cuts = cuts - 1; - - ); - -/* Feed sample to FFT */ -function feedSample(sample) - global(fftSize) - instance(recPtr, window, rStart, rEnd, fftLoc) - local() - ( - recPtr[] = sample; - recPtr = (recPtr+1) >= rEnd ? rStart : recPtr + 1; - ); - -/* Initialize FFT windowing function */ -function initWindow(windowtype) - global(fftSize) - instance(recPtr, window, rStart, rEnd, fftLoc) - local(i, pwr, dwindowpos, windowpos) - ( - windowpos = 0; - dwindowpos = $pi*2/fftSize; - i = 0; pwr = 0; - loop(fftSize*.5+1, - pwr += (window[i] = ( - windowtype==1 ? ( 0.53836 - cos(windowpos)*0.46164 ) : - windowtype==2 ? ( 0.35875 - 0.48829 * cos(windowpos) + 0.14128 * cos(2*windowpos) - 0.01168 * cos(3*windowpos) ) : - windowtype==3 ? ( 0.42 - 0.50 * cos(windowpos) + 0.08 * cos(2.0*windowpos) ) : - windowtype==4 ? ( 1.0 ) : - ( .21557895 - 0.41663158 * cos(windowpos) + 0.277263158 * cos(2*windowpos) - 0.083578947 * cos(3*windowpos) + 0.006947368 * cos(4*windowpos) ) - ) ); - i+=1; - windowpos+=dwindowpos; - ); - pwr=.5/(pwr*2-window[i-1]); - loop(fftsize*.5+1,window[i-=1]*=pwr); - ); - -function setToFFTLoc() - global(fftSize) - instance(recPtr, rStart) - local() - ( - recPtr = rStart + fftSize; - ); - -/* Calculate current spectrum */ -function calcFFT() - global(fftSize) - instance(recPtr, window, rStart, rEnd, fftLoc, slope, yshift) - local(buf1, buf2, buf3, yOut, i, prec, ty) - ( - buf1=recPtr-fftSize; - buf1= rEnd ? buf1 -= (rEnd-rStart); - ); - buf2-=1; - loop(fftSize*.5 - 1, - buf3[] = buf1[]*(buf2-=1)[]; - buf3+=1; - (buf1+=1) >= rEnd ? buf1 -= (rEnd-rStart); - ); - - fft_real(fftLoc,fftSize); - fft_permute(fftLoc,fftSize/2); - - buf3 = fftLoc; - yOut = fftLoc; - i = 0; - slope = .5*log(2)*slope; - yshift = slope*log(1.0+.5*fftSize); - prec = (10^(-500/20*2)); - loop(fftSize*0.5, - ty = sqr(buf3[0])+sqr(buf3[1]); - ty = log(max(ty,prec)); - - ty = ty + slope*log(1.0+i) - yshift; - yOut[] = ty; - yOut += 1; - buf3 += 2; - - i += 1; - ); - ); - -/* Set location of a window */ -function setWindowLocation(_x, _y, _w, _h) - global() - instance(x, y, w, h, cap) - local() - ( - x = _x; - y = _y; - w = _w; - h = _h; - ); - -// Draws the basic box for the FFT -function drawBackface() - instance(x, y, w, h) - global(backface_color_r, backface_color_g, backface_color_b, backface_color_a, - grid_color_r, grid_color_g, grid_color_b, grid_color_a ) - local() - ( - gfx_set( backface_color_r, backface_color_g, backface_color_b, backface_color_a ); - gfx_rect(x, y, w, h); - - gfx_set( grid_color_r, grid_color_g, grid_color_b, grid_color_a ); - gfx_line(x, y, x+w, y); - gfx_line(x, y+h, x+w, y+h); - gfx_line(x, y, x, y+h); - gfx_line(x+w, y, x+w, y+h); - ); - -// Draws the FFT Grid, frequency axis and dB axis -function drawGrid() - global(fftSize, srate, gfx_x, gfx_y, grid_alpha, scaling, GRID_FONT, norm_freq_max) - instance(x, y, w, h, recPtr, window, rStart, rEnd, fftLoc, floorLevel, hzoffset, - grid_color_r, grid_color_g, grid_color_b, grid_color_a ) - local(xx, i, wsc, N, xl) - ( - this.drawBackface(); - - i = 0; - wsc = w/log(1+fftSize*0.5-hzoffset); - xl = x; - gfx_y = y+h+2; - - gfx_setfont(GRID_FONT); - loop(16, - xx = x + log(i*fftSize/(2 * srate * norm_freq_max)-hzoffset)*wsc; - gfx_set( grid_color_r, grid_color_g, grid_color_b, grid_color_a ); - gfx_line(xx, y, xx, y+h); - - ( (xx - xl) > 30 * (1 + scaling) ) ? ( - gfx_set( 1, 1, 1, 1 ); - gfx_x = xx+2; - gfx_line(xx, y+h, xx, y+h+7); - (i>999) ? ( - gfx_printf("%dk", .001*i); - ) : ( - gfx_printf("%d", i); - ); - xl = xx; - ); - - gfx_set( .2, .2, .2, grid_alpha ); - gfx_line(xx, y, xx, y+h); - - ( i < 100 ) ? (i += 20) : - ( i < 1000 ) ? (i += 200) : - ( i < 10000 ) ? (i += 2000) : - ( i < 100000 ) ? (i += 20000); - ); - - gfx_set( grid_color_r, grid_color_g, grid_color_b, grid_color_a ); - N = 8; - xx = y; - i = 0; - gfx_measurestr("8", wsc, xl); - loop(N, - gfx_set( 1, 1, 1, 1 ); - gfx_x = x+w-20; - gfx_y = xx-.5*xl; - i > 0 ? gfx_printf("-%d", 4.41*i*floorLevel/N); - - gfx_set( .2, .2, .2, grid_alpha ); - gfx_line(x, xx+1, x+w, xx+1); - - xx += h/N; - gfx_set( grid_color_r, grid_color_g, grid_color_b, grid_color_a ); - gfx_line(x, xx, x+w, xx); - i += 1; - ); - ); - -function drawLine(x1, y1, x2, y2) - local(dx, dy, x, smooth) - global(gfx_x, gfx_y) - instance() - ( - smooth = 1; - x1 = floor(x1); - x2 = floor(x2); - gfx_x=x1; - gfx_y=y1; - x2 = floor(x2); - y2 = floor(y2); - - smooth ? ( - (x2 - x1) > 4 ? ( - dx = 1.0/(x2-x1); - dy = (y2 - y1)*6*dx; - x = 0; - loop(x2-x1, - x2 = x1 + 1; - y2 = y1 + dy * ( x - x*x ); - - gfx_line(x1-1, y1-1, x2-1, y2-1, 1); - gfx_line(x1, y1-1, x2, y2-1, 1); - gfx_lineto(x2,y2,1); - x1 = x2; - y1 = y2; - x = x + dx; - ); - ) : ( - gfx_line(x1, y1-1, x2, y2-1, 1); - gfx_lineto(x2,y2,1); - ); - ) : ( - gfx_line(x1, y1-1, x2, y2-1, 1); - gfx_lineto(x2,y2,1); - ); - ); - -bandClickRange = 10; -overRange = 10; - -function isOver(mx, my) - instance(x, y, w, h) - global(overRange) - local() - ( - ( ( mx >= (x-overRange) ) && ( mx <= (x+w+overRange) ) && ( my >= (y-overRange) ) && ( my <= (y+h+overRange) ) ) ? 1 : 0; - ); - -function clamp(value, mini, maxi) - local() - global() - ( - max(min(value,maxi),mini) - ); - -function overRect(x, y, w, h, mx, my) - local() - global() - ( - ( (mx > x) && (mx < (x+w) ) && (my > y) && (my < (y+h) ) ) - ); - -function pixelToWindowRatio(x_loc) - instance(x, y, ,w h, hzoffset) - global(fftSize, norm_freq_min, gmem ) - local(lmin, wsc, hfft) - ( - - hfft = 0.5*fftSize; - lmin = log(norm_freq_min); - wsc = w/log(1+fftSize*0.5-hzoffset); - - 1-log( (exp((x_loc)/wsc) + hzoffset)/hfft )/lmin; - - ); -function PixelToWindowRatio_ImGui(x_loc) - instance(x, y, ,w h, hzoffset) - global(fftSize, norm_freq_min, gmem ) - local(lmin, wsc, hfft) - ( - - hfft = 0.5*fftSize; - lmin = log(norm_freq_min); - wsc = 1/log(1+fftSize*0.5); - - 1-log( (exp((x_loc)/wsc)+ hzoffset )/hfft )/lmin; - - ); - - - -function fftWindow_processMouse(mouse_x, mouse_y, mouse_cap) - instance(x, y, w, h, lx, ly, lcap, cap, thisUI, htime, hint, AA_TEST, - x_over, dragging, lastLeftClick - x1, x2, x3, x4, x5, - v1, v2, v3, v4, v5, - h1, h2, h3, h4, h5, - c1, c2, c3, c4, c5, - F1hz, F2hz, F3hz, F4hz ) - global(dnoisefloor_freq, dsteps_fft, mouse_wheel, lastUI, fftSize, gmem, FXID, aatest - bandClickRange, cuts, - Freq1, Freq2, Freq3, Freq4, - bypassBand1, bypassBand2, bypassBand3, bypassBand4, bypassBand5, - Drive1, Drive2, Drive3, Drive4, Drive5, - mute1, mute2, mute3, mute4, mute5, - solo1, solo2, solo3, solo4, solo5, - driveMin, driveMax, maxCuts, - hinter.updateHintTime, - selectedBand, gfx_x, gfx_y, srate, abs_placement ) - local(dx, dy, over, dys, - F1, F2, F3, F4, - leftClick, rightClick, doubleClick, - cTime, mpos, shift, ctrl, lb) - ( - over = mouse_x > x && mouse_y > y && mouse_x < (x+w) && mouse_y < (y+h); - leftClick = ( mouse_cap & 1 == 1 && lcap & 1 == 0 ); - rightClick = ( mouse_cap & 2 == 2 && lcap & 2 == 0 ); - doubleClick = 0; - shift = ( mouse_cap & 8 ); - ctrl = ( mouse_cap & 4 ); - - leftClick ? ( - time_precise(cTime); - ( ( cTime - lastLeftClick ) < .25 ) ? ( - leftClick = 0; - doubleClick = 1; - ); - lastLeftClick = cTime; - ); - - x_over = -1; - - abs_placement ? ( - F1 = clamp(Freq1, 0, 1); - F2 = clamp(Freq2, F1, cuts > 2 ? F3 : 1); - F3 = clamp(Freq3, F2, cuts > 3 ? F4 : 1); - F4 = clamp(Freq4, F3, 1.0); - ) : ( - F1 = Freq1; - F2 = Freq1 + Freq2 * (1 - Freq1); - F3 = F2 + Freq3 * (1 - F2); - F4 = F3 + Freq4 * (1 - F3); - ); - - F1hz = f_trafo(F1); - F2hz = f_trafo(F2); - F3hz = f_trafo(F3); - F4hz = f_trafo(F4); - gmem[FXID+5]=F1hz; - gmem[FXID+6]=F2hz; - gmem[FXID+7]=F3hz; - gmem[FXID+8]=F4hz; - gmem[FXID+1]= F1; - gmem[FXID+2]= F2; - gmem[FXID+3]= F3; - gmem[FXID+4]= F4; - - - ( cap == 3 && mouse_cap & 1 == 1 ) ? ( - dy = mouse_y - ly; - - dys = 100*dy/h; - dragging == 1 ? ( Drive1 -= dys; Drive1 = clamp(Drive1, driveMin, driveMax); ); - dragging == 2 ? ( Drive2 -= dys; Drive2 = clamp(Drive2, driveMin, driveMax); ); - dragging == 3 ? ( Drive3 -= dys; Drive3 = clamp(Drive3, driveMin, driveMax); ); - dragging == 4 ? ( Drive4 -= dys; Drive4 = clamp(Drive4, driveMin, driveMax); ); - dragging == 5 ? ( Drive5 -= dys; Drive5 = clamp(Drive5, driveMin, driveMax); ); - - ) : ( cap == 2 && mouse_cap & 1 == 1 )? ( - // Dragging a band frequency - dx = mouse_x - lx; - - shift ? dx *= .5; - ctrl ? dx *= .01; - - lb = .02; - dragging == 1 ?( - F1 = this.pixelToWindowRatio(x1 - x + dx); - abs_placement ? ( - slider_automate( Freq1 = clamp( F1, lb, 1 ) ); - ) : ( - slider_automate( Freq1 = clamp( F1, lb, 1 ) ); - slider_automate( Freq2 = clamp( (F2 - Freq1) / (1-F1), 0, 1 ) ); - ); - ); - dragging == 2 ? ( - F2 = this.pixelToWindowRatio(x2 - x + dx); - abs_placement ? ( - slider_automate( Freq2 = clamp(F2, F1, cuts > 2 ? F3 : 1)); - ) : ( - slider_automate( Freq2 = clamp( (F2 - Freq1) / (1-Freq1), 0, 1 ) ); - F2 = Freq1 + Freq2 * (1 - Freq1); - slider_automate( Freq3 = clamp( (F3 - F2) / (1-F2), 0, 1) ); - ); - ); - dragging == 3 ? ( - F3 = this.pixelToWindowRatio(x3 - x + dx); - abs_placement ? ( - slider_automate( Freq3 = clamp( F3, F2, cuts > 3 ? F4 : 1 ) ); - ) : ( - slider_automate( Freq3 = clamp( (F3 - F2) / (1-F2), 0, 1 ) ); - F3 = F2 + Freq3 * (1 - F2); - slider_automate( Freq4 = clamp( (F4 - F3) / (1-F3), 0, 1 ) ); - ); - ); - dragging == 4 ? ( - F4 = this.pixelToWindowRatio(x4 - x + dx); - abs_placement ? ( - slider_automate( Freq4 = clamp( F4, F3, 1.0 ) ); - ) : ( - slider_automate( Freq4 = clamp( (F4 - F3) / (1-F3), 0, 1 ) ); - ); - ); - ) : ( cap == 1 && mouse_cap & 1 == 1 ) ? ( - dnoisefloor_freq -= .5*(mouse_y-ly); - dnoisefloor_freq > 35 ? dnoisefloor_freq = 35; - dnoisefloor_freq < -15 ? dnoisefloor_freq = -15; - ) : ( - // Not already capped - cap = 0; - - /* Toggle mute/solo */ - ( c1.isOver(mouse_x, mouse_y) == 1 ) ? ( - c1.over = 1; - hinter.updateHintTime("LMB - Toggle mute\nRMB - Toggle solo\nShift + RMB - Select multiple solo bands\nCTRL + LMB - Toggle bypass waveshaper"); - leftClick ? ( ctrl ? ( bypassBand1 = 1 - bypassBand1) : ( - mute1 = 1-mute1; solo1 ? (mute1 = 1; solo1 = 0; selectedBand = 0; ); ); ); - rightClick ? ( solo1 = 1-solo1; selectedBand = 0; - ((solo1 == 1) && (shift==0)) ? (solo2=solo3=solo4=solo5=0;); ); - ) : ( c2.isOver(mouse_x, mouse_y) == 1 ) && ( cuts > 0 ) ? ( - hinter.updateHintTime("LMB - Toggle mute\nRMB - Toggle solo\nShift + RMB - Select multiple solo bands\nCTRL + LMB - Toggle bypass waveshaper"); - c2.over = 1; - leftClick ? ( ctrl ? ( bypassBand2 = 1 - bypassBand2) : ( - mute2 = 1-mute2; solo2 ? (mute2 = 1; solo2 = 0; selectedBand = 1;); ); ); - rightClick ? ( solo2 = 1-solo2; selectedBand = 1; - ((solo2 == 1) && (shift==0)) ? (solo1=solo3=solo4=solo5=0;); ); - ) : ( c3.isOver(mouse_x, mouse_y) == 1 ) && ( cuts > 1 ) ? ( - hinter.updateHintTime("LMB - Toggle mute\nRMB - Toggle solo\nShift + RMB - Select multiple solo bands\nCTRL + LMB - Toggle bypass waveshaper"); - c3.over = 1; - leftClick ? ( ctrl ? ( bypassBand3 = 1 - bypassBand3) : ( - mute3 = 1-mute3; solo3 ? (mute3 = 1; solo3 = 0; selectedBand = 2; ); ); ); - rightClick ? ( solo3 = 1-solo3; selectedBand = 2; - ((solo3 == 1) && (shift==0)) ? (solo1=solo2=solo4=solo5=0;); ); - ) : ( c4.isOver(mouse_x, mouse_y) == 1 ) && ( cuts > 2 ) ? ( - hinter.updateHintTime("LMB - Toggle mute\nRMB - Toggle solo\nShift + RMB - Select multiple solo bands\nCTRL + LMB - Toggle bypass waveshaper"); - c4.over = 1; - leftClick ? ( ctrl ? ( bypassBand4 = 1 - bypassBand4) : ( - mute4 = 1-mute4; solo4 ? (mute4 = 1; solo4 = 0; selectedBand = 3; ); ); ); - rightClick ? ( solo4 = 1-solo4; selectedBand = 3; - ((solo4 == 1) && (shift==0)) ? (solo1=solo2=solo3=solo5=0;); ); - ) : ( c5.isOver(mouse_x, mouse_y) == 1 ) && ( cuts > 3 ) ? ( - hinter.updateHintTime("LMB - Toggle mute\nRMB - Toggle solo\nShift + RMB - Select multiple solo bands\nCTRL + LMB - Toggle bypass waveshaper"); - c5.over = 1; - leftClick ? ( ctrl ? ( bypassBand5 = 1 - bypassBand5) : ( - mute5 = 1-mute5; solo5 ? (mute5 = 1; solo5 = 0; selectedBand = 4; ); ); ); - rightClick ? ( solo5 = 1-solo5; selectedBand = 4; - ((solo5 == 1) && (shift==0)) ? (solo1=solo2=solo3=solo4=0;); ); - - /* Drag frequency */ - ) : ( v1.isOver(mouse_x, mouse_y) == 1 ) && ( cuts > 0 ) ? ( - hinter.updateHintTime("LMB + Drag - Modify crossover frequency\nRMB - Remove frequency cut\nRMB anywhere else - Add frequency cut"); - v1.over = 1; - leftClick ? ( cap = 2; dragging = 1; ); - rightClick ? ( - !abs_placement ? ( Freq2 = ( Freq2 * ( 1 - Freq1 ) + ( Freq1 - 0 ) ) / ( 1 - 0 ); ); - remBand(0); - - ); - ) : ( v2.isOver(mouse_x, mouse_y) ) && ( cuts > 1 ) ? ( - hinter.updateHintTime("LMB + Drag - Modify crossover frequency\nRMB - Remove frequency cut\nRMB anywhere else - Add frequency cut"); - v2.over = 1; - leftClick ? ( cap = 2; dragging = 2; ); - rightClick ? ( - !abs_placement ? ( Freq3 = ( Freq3 * ( 1 - Freq2 ) + ( Freq2 - 0 ) ) / ( 1 - 0 ) ); - remBand(1); - - ); - ) : ( v3.isOver(mouse_x, mouse_y) ) && ( cuts > 2 ) ? ( - hinter.updateHintTime("LMB + Drag - Modify crossover frequency\nRMB - Remove frequency cut\nRMB anywhere else - Add frequency cut"); - v3.over = 1; - leftClick ? ( cap = 2; dragging = 3; ); - rightClick ? ( - !abs_placement ? ( Freq4 = ( Freq4 * ( 1 - Freq3 ) + ( Freq3 - 0 ) ) / ( 1 - 0 ) ); - remBand(2); - - ); - ) : ( v4.isOver(mouse_x, mouse_y) ) && ( cuts > 3 )? ( - hinter.updateHintTime("LMB + Drag - Modify crossover frequency\nRMB - Remove frequency cut\nRMB anywhere else - Add frequency cut"); - v4.over = 1; - leftClick ? ( cap = 2; dragging = 4; ); - rightClick ? ( remBand(3); ); - - ) : ( v5.isOver(mouse_x, mouse_y) ) && ( cuts > 4 ) ? ( - hinter.updateHintTime("LMB + Drag - Modify crossover frequency\nRMB - Remove frequency cut\nRMB anywhere else - Add frequency cut"); - v5.over = 1; - leftClick ? ( cap = 2; dragging = 5; ); - rightClick ? ( remBand(4); ); - - - /* Drag drive */ - ) : ( h1.isOver(mouse_x, mouse_y) ) ? ( - hinter.updateHintTime("LMB + Drag - Modify drive\nDouble LMB - Reset drive to zero\nShift + LMB + Drag - Modify drive while reducing gain"); - h1.over = 1; - leftClick ? ( cap = 3; dragging = 1; selectedBand = 0; ); - doubleClick ? ( Drive1 = 0; selectedBand = 0; ); - ) : ( h2.isOver(mouse_x, mouse_y) ) && ( cuts > 0 ) ? ( - hinter.updateHintTime("LMB + Drag - Modify drive\nDouble LMB - Reset drive to zero\nShift + LMB + Drag - Modify drive while reducing gain"); - h2.over = 1; - leftClick ? ( cap = 3; dragging = 2; selectedBand = 1; ); - doubleClick ? ( Drive2 = 0; selectedBand = 1; ); - ) : ( h3.isOver(mouse_x, mouse_y) ) && ( cuts > 1 ) ? ( - hinter.updateHintTime("LMB + Drag - Modify drive\nDouble LMB - Reset drive to zero\nShift + LMB + Drag - Modify drive while reducing gain"); - h3.over = 1; - leftClick ? ( cap = 3; dragging = 3; selectedBand = 2; ); - doubleClick ? ( Drive3 = 0; selectedBand = 2; ); - ) : ( h4.isOver(mouse_x, mouse_y) ) && ( cuts > 2 ) ? ( - hinter.updateHintTime("LMB + Drag - Modify drive\nDouble LMB - Reset drive to zero\nShift + LMB + Drag - Modify drive while reducing gain"); - h4.over = 1; - leftClick ? ( cap = 3; dragging = 4; selectedBand = 3; ); - doubleClick ? ( Drive4 = 0; selectedBand = 3; ); - ) : ( h5.isOver(mouse_x, mouse_y) ) && ( cuts > 3 ) ? ( - hinter.updateHintTime("LMB + Drag - Modify drive\nDouble LMB - Reset drive to zero\nShift + LMB + Drag - Modify drive while reducing gain"); - h5.over = 1; - leftClick ? ( cap = 3; dragging = 5; selectedBand = 4; ); - doubleClick ? ( Drive5 = 0; selectedBand = 4; ); - - /* Handle clicks within the bands (creating a new band or selecting a band) */ - ) : ( overRect( h1.x, y, h1.w, h, mouse_x, mouse_y ) ) ? ( - leftClick ? selectedBand = 0; - rightClick && (cuts < maxCuts) ? ( - addBand(0); - mpos = this.pixelToWindowRatio(mouse_x); - !abs_placement ? ( Freq2 = ( Freq2 * (1-0) + 0 - mpos ) / ( 1 - mpos ); ); - Freq1 = mpos; - ); - ) : ( overRect( h2.x, y, h2.w, h, mouse_x, mouse_y ) && ( cuts > 0 ) ) ? ( - leftClick ? selectedBand = 1; - rightClick && (cuts < maxCuts) ? ( - addBand(1); - mpos = this.pixelToWindowRatio(mouse_x); - - !abs_placement ? ( - Freq3 = ( Freq3 * (1-Freq1) + Freq1 - mpos ) / ( 1 - mpos ); - Freq2 = ( mpos - Freq1 ) / ( 1 - Freq1 ); - ) : ( - Freq2 = mpos; - ); - ); - ) : ( overRect( h3.x, y, h3.w, h, mouse_x, mouse_y ) && ( cuts > 1 ) ) ? ( - leftClick ? selectedBand = 2; - rightClick && (cuts < maxCuts) ? ( - addBand(2); - mpos = this.pixelToWindowRatio(mouse_x); - - !abs_placement ? ( - F2 = Freq1 + Freq2 * (1 - Freq1); - Freq4 = ( Freq4 * (1-F2) + F2 - mpos ) / ( 1 - mpos ); - Freq3 = ( mpos - F2 ) / ( 1 - F2 ); - ) : ( - Freq3 = mpos; - ); - ); - ) : ( overRect( h4.x, y, h4.w, h, mouse_x, mouse_y ) && ( cuts > 2 ) ) ? ( - leftClick ? selectedBand = 3; - rightClick && (cuts < maxCuts)? ( - addBand(3); - mpos = this.pixelToWindowRatio(mouse_x); - - !abs_placement ? ( - F2 = Freq1 + Freq2 * (1 - Freq1); - F3 = F2 + Freq3 * (1 - F2); - Freq4 = ( mpos - F3 ) / ( 1 - F3 ); - ) : ( - Freq4 = mpos; - ); - ); - ) : ( overRect( h5.x, y, h5.w, h, mouse_x, mouse_y ) && ( cuts > 3 ) ) ? ( - leftClick ? selectedBand = 4; - ) : ( - cap = 0; - ( mouse_cap & 1 == 1 && lcap & 1 == 0 && over ) ? ( - cap = 1; - ); - ); - ); - - mouse_wheel > 0 && over ? lastUI = thisUI; - - abs(floor(mouse_wheel/240)) > 0 && over ? - ( - dsteps_fft += floor(mouse_wheel/240); - dsteps_fft > 8 ? dsteps_fft = 8; - dsteps_fft < -4 ? dsteps_fft = -4; - mouse_wheel = 0; - ); - - lx = mouse_x; - ly = mouse_y; - lcap = mouse_cap; - - over - ); - -function drawFFT(fill, r, g, b, a) - global(scaling, fftSize, gfx_x, gfx_y, gfx_r, gfx_g, gfx_b, gfx_a, srate, gfx_mode, dsteps_fft, FIR1, norm_freq_max) - instance(hstep, x, y, w, h, recPtr, window, rStart, rEnd, fftLoc, floorLevel, hzoffset) - local(step, copyval, stepsize, buf, i, ixsc, txl, tx, ty, wsc, fill, tx0, lx0, lx, ly, ty2, ly2, fill_slast, fill_slmin, cum, cumelem) - ( - this.calcFFT(); - - cum = -10000000; - cumelem = 0; - i = 0; - ixsc = 0; - wsc = w/log(fftsize*0.5-hzoffset); - fill_slmin = y; - - buf = fftLoc + fftsize*0.5; - stepsize = floor((4+dsteps_fft)*(1+scaling)); - copyval = buf[]; - loop( stepsize*200, - (buf+=1)[] = copyval; - ); - - gfx_r = r; - gfx_g = g; - gfx_b = b; - gfx_a = a; - - hstep = 0.5 * stepsize; - buf = fftLoc; - txl = x; - lx = x; - ly = y - max(buf[2], -floorLevel)*h / floorLevel; - step = 1.0 / (2*norm_freq_max); - - loop(fftsize*0.5+stepsize*200, - tx = floor(x + log(ixsc - hzoffset)*wsc); - cum = max(cum, tx > 0 ? buf[] : -10000); - cumelem += 1; - - ( (tx != txl) && (tx-txl > stepsize) && tx > x && i && ( tx < (x+w+stepsize) ) ) ? - ( - ty = y - max(cum, -floorLevel)*h / floorLevel; - txl = floor(tx); - - tx = min(tx, x+w); - (fill) ? - ( - tx0=tx|0; - lx0=lx|0; - tx0>lx0 ? - ( - gfx_triangle(lx0-hstep,max(y+h,ly),lx0-hstep,ly,tx0-1-hstep,ty,tx0-1-hstep,max(y+h,ty)); - ) : ( - tx0 > fill_slast ? - ( - fill_slast < h ? gfx_line(fill_slast,h,fill_slast,fill_slmin); - fill_slmin=h; - ) : ( - fill_slmin=min(fill_slmin,ty); - ); - ); - - fill_slast=tx0; - ); - - (fill==0) ? ( - drawLine(lx-hstep, ly, tx-hstep, ty); - ); - - lx=tx; ly=ty; ly2=ty2; cum = -1000000; cumelem = 0; - ); - - buf+=1; i+=1; ixsc+=step; - ); - ); - -function drawLineFFT(peakLocation) - global(fftSize, gfx_x, gfx_y, gfx_r, gfx_g, gfx_b, gfx_a, srate) - instance(x, y, w, h, hzoffset) - local(wsc, tx, base, i) - ( - wsc = w/log(1+fftSize*0.5-hzoffset); - base = fftSize*peakLocation; - tx = floor(x + log(1.0+base-hzoffset)*wsc); - drawLine(tx, y, tx, y+h); - ); - -function updateBands() - global(Freq1, Freq2, Freq3, Freq4, - Ceil1, Ceil2, Ceil3, Ceil4, - Drive1, Drive2, Drive3, Drive4, Drive5, - fftSize, driveRange, driveMax, abs_placement, cuts, - norm_freq_min) - instance(x, y, w, h, hzoffset, - x1, x2, x3, x4, x5, /* Frequencies */ - y1, y2, y3, y4, y5, /* Drives */ - ) - local(F1, F2, F3, F4, F5, wsc, hfft, lmin, irange, dmax) - ( - abs_placement ? ( - F1 = clamp(Freq1, 0, 1); - F2 = clamp(Freq2, F1, cuts > 2 ? F3 : 1); - F3 = clamp(Freq3, F2, cuts > 3 ? F4 : 1); - F4 = clamp(Freq4, F3, 1.0); - ) : ( - F1 = Freq1; - F2 = Freq1 + Freq2 * (1 - Freq1); - F3 = F2 + Freq3 * (1 - F2); - F4 = F3 + Freq4 * (1 - F3); - ); - - hfft = 0.5*fftSize; - lmin = log(norm_freq_min); - - wsc = w/log(1+fftSize*0.5-hzoffset); - x1 = ( x + log( hfft * exp( (1-F1) * lmin ) - hzoffset ) * wsc ); - x2 = ( x + log( hfft * exp( (1-F2) * lmin ) - hzoffset ) * wsc ); - x3 = ( x + log( hfft * exp( (1-F3) * lmin ) - hzoffset ) * wsc ); - x4 = ( x + log( hfft * exp( (1-F4) * lmin ) - hzoffset ) * wsc ); - x5 = ( x + log( hfft * exp( lmin ) - hzoffset ) * wsc ); - - iRange = 1/driveRange; - dmax = iRange * driveMax; - - y1 = y+h*(dmax-iRange*Drive1); - y2 = y+h*(dmax-iRange*Drive2); - y3 = y+h*(dmax-iRange*Drive3); - y4 = y+h*(dmax-iRange*Drive4); - y5 = y+h*(dmax-iRange*Drive5); - ); - -lineR = 1; -lineG = .9; -lineB = 1.0; -lineA = .95; -lineHighlightR = 0; -lineHighlightG = .7; -lineHighlightB = .5; - -function drawGroupRect(x, y, w, h, r, g, b, a) - local() - instance() - global() - ( - gfx_set(r, g, b, a); - gfx_line(x, y, x+w, y); - gfx_line(x, y, x, y+h); - gfx_line(x+w, y, x+w, y+h); - gfx_line(x, y+h, x+w, y+h); - - gfx_set(r, g, b, a*.5); - gfx_line(x, y+h+1, x+w, y+h+1); - gfx_line(x+w+1, y, x+w+1, y+h); - ); - -function initBuffer(scopebuffer_in, scopebuffermax_in) - local() - global() - instance(scopeptr, scopebuffermax, scopebuffer) - ( - scopebuffer = scopebuffer_in; - scopebuffermax = scopebuffermax_in; - - scopeptr < scopebuffer ? ( - scopeptr = scopebuffer - ) : ( scopeptr > scopebuffermax ) ? scopeptr = scopebuffer - ); - -function setOffset(offset) - local() - global() - instance(scopeptr, readptr, scopebuffermax, scopebuffer, frac) - ( - readptr = scopeptr; - frac = offset - floor(offset); - readptr -= floor(offset); - readptr < scopebuffer ? readptr += (scopebuffermax-scopebuffer+1); - ); - -function readBuffer() - local(c1, c2) - global() - instance(readptr, scopebuffermax, scopebuffer, frac) - ( - c1 = readptr[]; - readptr += 1; - readptr > scopebuffermax ? readptr = scopebuffer; - - c2 = readptr[]; - c2 * (1.0-frac) + c1 * frac - ); - -function updateBuffer(M) - local() - global() - instance(scopeptr, scopebuffermax, scopebuffer) - ( - scopeptr[] = M; - scopeptr += 1; - scopeptr > scopebuffermax ? scopeptr = scopebuffer; - - M - ); - -function clearBuffer() - local() - global(MAXBUFFERSIZE) - instance(scopeptr, scopebuffermax, scopebuffer) - ( - memset( scopebuffer, 0, MAXBUFFERSIZE ); - scopeptr = scopebuffer; - ); - -function fancyLineV(x1, y1, x2, y2) - local(dx) - global(globalTime, lineR, lineG, lineB, lineA, lineHighlightR, lineHighlightG, lineHighlightB) - instance(x, y, w, h, over) - ( - dx = 5; - - x = x1 - .5*dx; - y = y1; - w = dx; - h = y2-y1; - - over ? ( - gfx_set(lineHighlightR,lineHighlightG,lineHighlightB,.1); - gfx_rect(x-2, y, w+5, h); - gfx_set(lineHighlightR,lineHighlightG,lineHighlightB,.1); - gfx_rect(x-4, y, w+9, h); - gfx_set(lineHighlightR,lineHighlightG,lineHighlightB,.05); - gfx_rect(x-7, y, w+15, h); - gfx_set(lineHighlightR,lineHighlightG,lineHighlightB,.03); - gfx_rect(x-10, y, w+20, h); - ); - - gfx_set(.2*lineR, .2*lineG, .2*lineB, lineA); - gfx_rect(x, y, w, h); - gfx_set(.5*lineR, .5*lineG, .5*lineB, lineA); - dx = 3; gfx_rect(x1 - .5*dx, y1, dx, y2-y1); - gfx_set(.7*lineR, .7*lineG, .7*lineB, lineA); - dx = 2; gfx_rect(x1 - .5*dx, y1, dx, y2-y1); - gfx_set(lineR, lineG, lineB, lineA); - dx = 1; gfx_rect(x1 - .5*dx, y1, dx, y2-y1); - - over ? ( - gfx_set(1,1,1,.4*abs(sin(2*globalTime))); - gfx_rect(x, y, w, h); - ); - - over = 0; - ); - -function fancyLineH(x1, y1, x2, y2) - local(dy) - global(globalTime, lineR, lineG, lineB, lineA, lineHighlightR, lineHighlightG, lineHighlightB) - instance(x, y, w, h, over) - ( - dy = 5; - - x = x1; - y = y1 - .5*dy; - w = x2-x1; - h = dy; - - over ? ( - gfx_set(lineHighlightR,lineHighlightG,lineHighlightB,.1); - gfx_rect(x, y-2, w, h+5); - gfx_set(lineHighlightR,lineHighlightG,lineHighlightB,.1); - gfx_rect(x, y-4, w, h+9); - gfx_set(lineHighlightR,lineHighlightG,lineHighlightB,.05); - gfx_rect(x, y-7, w, h+15); - gfx_set(lineHighlightR,lineHighlightG,lineHighlightB,.03); - gfx_rect(x, y-10, w, h+20); - ); - - gfx_set(.2*lineR, .2*lineG, .2*lineB, lineA); - gfx_rect(x, y, w, h); - gfx_set(.5*lineR, .5*lineG, .5*lineB, lineA); - dy = 3; gfx_rect(x1, y1 - .5*dy, x2-x1, dy ); - gfx_set(.7*lineR, .7*lineG, .7*lineB, lineA); - dy = 2; gfx_rect(x1, y1 - .5*dy, x2-x1, dy ); - gfx_set(lineR, lineG, lineB, lineA); - dy = 1; gfx_rect(x1, y1 - .5*dy, x2-x1, dy ); - - over ? ( - gfx_set(1,1,1,.7*abs(sin(2*globalTime))); - gfx_rect(x, y, w, h); - ); - - over = 0; - ); - -function hzLabel(dy, label) - local(lww, lhh, cy, dy2) - global(gfx_x, gfx_y, hzLabelW, hzLabelH, lineR, lineG, lineB, lineA) - instance(x, y, w, h, over) - ( - cy = y + dy*h; - - gfx_measurestr("888888", hzLabelW, hzLabelH); - - gfx_set(.5*lineR, .5*lineG, .5*lineB, lineA); - dy2 = 3; gfx_rect(x-.5*hzLabelW-.5*dy2, cy-.5*dy2, hzLabelW+dy2, hzLabelH+dy2); - gfx_set(.7*lineR, .7*lineG, .7*lineB, lineA); - dy2 = 2; gfx_rect(x-.5*hzLabelW-.5*dy2, cy-.5*dy2, hzLabelW+dy2, hzLabelH+dy2); - gfx_set(lineR, lineG, lineB, lineA); - dy2 = 1; gfx_rect(x-.5*hzLabelW-.5*dy2, cy-.5*dy2, hzLabelW+dy2, hzLabelH+dy2); - - gfx_set( 1, 1, 1, .8 ); - gfx_rect(x-.5*hzLabelW-1, cy-1, hzLabelW+2, hzLabelH+2); - - gfx_set( 0, 0, 0, 1 ); - gfx_rect(x-.5*hzLabelW, cy, hzLabelW, hzLabelH); - - sprintf(19, "%d", label); - gfx_measurestr(19, lww, lhh); - gfx_set( 1, 1, 1, 1 ); - gfx_x = x - .5 *lww; - gfx_y = y + dy*h; - gfx_printf(19, label); - ); - -function drawBands() - global(Cuts, stest, - mute1, mute2, mute3, mute4, mute5, - solo1, solo2, solo3, solo4, solo5, - bypassBand1, bypassBand2, bypassBand3, bypassBand4, bypassBand5, - selectedBand ) - instance(xc, dx, x, y, w, h, - x1, x2, x3, x4, x5, // Band frequency screen positions - y1, y2, y3, y4, y5, // Band drive positions - v1, v2, v3, v4, v5, // Frequency handles - h1, h2, h3, h4, h5, // Drive handles - c1, c2, c3, c4, c5, // Circle handles - F1hz, F2hz, F3hz, F4hz, F5hz, // Frequencies - x_over) - local() - ( - xc = x; - dx = 5; - while(xc 0) ? ( - gfx_set(1,1,1,1); v1.fancyLineV(x1, y, x1, y+h); - v1.hzLabel(.8, F1hz); - ); - (Cuts > 1) ? ( - gfx_set(1,1,1,1); v2.fancyLineV(x2, y, x2, y+h); - v2.hzLabel(.8, F2hz); - ); - (Cuts > 2) ? ( - gfx_set(1,1,1,1); v3.fancyLineV(x3, y, x3, y+h); - v3.hzLabel(.8, F3hz); - ); - (Cuts > 3) ? ( - gfx_set(1,1,1,1); v4.fancyLineV(x4, y, x4, y+h); - v4.hzLabel(.8, F4hz); - ); - (Cuts > 4) ? ( - gfx_set(1,1,1,1); v5.fancyLineV(x5, y, x5, y+h); - v5.hzLabel(.8, F5hz); - ); - - gfx_rect(x_over-3, y, 5, h); - ( Cuts == 0 ) ? ( - h1.fancyLineH(x, y1, x+w-2, y1); - c1.fancyCircle(x + .5*w, y1, 0, mute1, solo1, bypassBand1); - ) : ( Cuts == 1 ) ? ( - h1.fancyLineH(x, y1, x1-2, y1); - c1.fancyCircle(.5*x + .5*x1, y1, 0, mute1, solo1, bypassBand1); - h2.fancyLineH(x1, y2, x+w-2, y2); - c2.fancyCircle(x1 + .5*(w-x1), y2, 0, mute2, solo2, bypassBand2); - ) : ( Cuts == 2 ) ? ( - h1.fancyLineH(x, y1, x1-2, y1); - c1.fancyCircle(.5*x + .5*x1, y1, 0, mute1, solo1, bypassBand1); - h2.fancyLineH(x1, y2, x2-2, y2); - c2.fancyCircle(x1 + .5*(x2-x1), y2, 0, mute2, solo2, bypassBand2); - h3.fancyLineH(x2, y3, x+w-2, y3); - c3.fancyCircle(x2 + .5*(w-x2), y3, 0, mute3, solo3, bypassBand3); - ) : ( Cuts == 3 ) ? ( - h1.fancyLineH(x, y1, x1-2, y1); - c1.fancyCircle(.5*x + .5*x1, y1, 0, mute1, solo1, bypassBand1); - h2.fancyLineH(x1, y2, x2-2, y2); - c2.fancyCircle(x1 + .5*(x2-x1), y2, 0, mute2, solo2, bypassBand2); - h3.fancyLineH(x2, y3, x3-2, y3); - c3.fancyCircle(x2 + .5*(x3-x2), y3, 0, mute3, solo3, bypassBand3); - h4.fancyLineH(x3, y4, x+w-2, y4); - c4.fancyCircle(x3 + .5*(w-x3), y4, 0, mute4, solo4, bypassBand4); - ) : ( Cuts == 4 ) ? ( - h1.fancyLineH(x, y1, x1-2, y1); - c1.fancyCircle(.5*x + .5*x1, y1, 0, mute1, solo1, bypassBand1); - h2.fancyLineH(x1, y2, x2-2, y2); - c2.fancyCircle(x1 + .5*(x2-x1), y2, 0, mute2, solo2, bypassBand2); - h3.fancyLineH(x2, y3, x3-2, y3); - c3.fancyCircle(x2 + .5*(x3-x2), y3, 0, mute3, solo3, bypassBand3); - h4.fancyLineH(x3, y4, x4-2, y4); - c4.fancyCircle(x3 + .5*(x4-x3), y4, 0, mute4, solo4, bypassBand4); - h5.fancyLineH(x4, y5, x+w-2, y5); - c5.fancyCircle(x4 + .5*(w-x4), y5, 0, mute5, solo5, bypassBand5); - ); - - selectedBand == 0 ? gfx_muladdrect( h1.x, y, h1.w, h, 1, 1, 1, .6, .05, .05, .105 ); - selectedBand == 1 ? gfx_muladdrect( h2.x, y, h2.w, h, 1, 1, 1, .6, .05, .05, .105 ); - selectedBand == 2 ? gfx_muladdrect( h3.x, y, h3.w, h, 1, 1, 1, .6, .05, .05, .105 ); - selectedBand == 3 ? gfx_muladdrect( h4.x, y, h4.w, h, 1, 1, 1, .6, .05, .05, .105 ); - selectedBand == 4 ? gfx_muladdrect( h5.x, y, h5.w, h, 1, 1, 1, .6, .05, .05, .105 ); - - ); - -function initSpectrum(memoryOffset, fftSize, srate) - global(newUI) - instance(recPtr, window, rStart, rEnd, fftLoc, hzoffset, thisUI, slope) - local() - ( - slope = 3; - - hzoffset = 10*fftSize/srate; - window = memoryOffset + fftSize + (fftSize*0.5 - 1); - - // Start and end of the buffer - rStart = memoryOffset; // rpos - rEnd = window; // hsize - - fftLoc = window + (fftSize*0.5 + 1); // fftw - - recPtr = rStart; - thisUI = newUI+=1; - - this.initWindow(3) - ); - - function resetBandMeter() - local() - global() - instance(in, pre, post) - ( - in = pre = post = 0; - ); - - function processBands() - local(BW2) - global( Drive1, Drive2, Drive3, Drive4, Drive5 - play1, play2, play3, play4, play5 ) - instance(b1, b2, b3, b4, b5, F1, F2, F3, F4, F5, - g1, g2, g3, g4, g5, - lg1, lg2, lg3, lg4, lg5 ) - ( - ( lg1 != Drive1 ) ? ( g1 = (10^(0.05*Drive1)); lg1 = Drive1; ); - ( lg2 != Drive2 ) ? ( g2 = (10^(0.05*Drive2)); lg2 = Drive2; ); - ( lg3 != Drive3 ) ? ( g3 = (10^(0.05*Drive3)); lg3 = Drive3; ); - ( lg4 != Drive4 ) ? ( g4 = (10^(0.05*Drive4)); lg4 = Drive4; ); - ( lg5 != Drive5 ) ? ( g5 = (10^(0.05*Drive5)); lg5 = Drive5; ); - - b1.l = b2.l = b3.l = b4.l = b5.l = 0; - b1.r = b2.r = b3.r = b4.r = b5.r = 0; - play1 ? ( - b1.l = g1*b1.inL; - b1.r = g1*b1.inR; - ); - play2 ? ( - b2.l = g2*b2.inL; - b2.r = g2*b2.inR; - ); - play3 ? ( - b3.l = g3*b3.inL; - b3.r = g3*b3.inR; - ); - play4 ? ( - b4.l = g4*b4.inL; - b4.r = g4*b4.inR; - ); - play5 ? ( - b5.l = g5*b5.inL; - b5.r = g5*b5.inR; - ); - ); - -// MEMORY LAYOUT -fftSize = 2*8192; -bufferDist = 65536; -audioBufIn = 0; -audioBufOut = bufferDist; - -FIR1 = 2*bufferDist; -FIR2 = 3*bufferDist; -FIR3 = 4*bufferDist; -FIR4 = 5*bufferDist; -FIR5 = 6*bufferDist; - -F1Block1 = 7*bufferDist; -F1Block2 = 8*bufferDist; -F2Block1 = 9*bufferDist; -F2Block2 = 10*bufferDist; -F3Block1 = 11*bufferDist; -F3Block2 = 12*bufferDist; -F4Block1 = 13*bufferDist; -F4Block2 = 14*bufferDist; -F5Block1 = 15*bufferDist; -F5Block2 = 16*bufferDist; - -specBufferLoc = 17*bufferDist; - -specBuffer.initBuffer(specBufferLoc, specBufferLoc+bufferDist-4); - -// INITIALIZATION -spectrumIn.initSpectrum(audioBufIn, fftSize, srate); -spectrumOut.initSpectrum(audioBufOut, fftSize, srate); - -@serialize -file_var(0, mute1); -file_var(0, mute2); -file_var(0, mute3); -file_var(0, mute4); -file_var(0, mute5); - -file_var(0, solo1); -file_var(0, solo2); -file_var(0, solo3); -file_var(0, solo4); -file_var(0, solo5); - -file_var(0, FIR); - -@slider - -@block - -absolute_frequencies ? ( - freq_max = 24000; - norm_freq_min = 20.0 / freq_max; - norm_freq_max = freq_max / srate; -) : ( - freq_max = 0.5 * srate; - norm_freq_min = 20.0 / 22050; - norm_freq_max = 0.5; -); - -!mute1 ? play1 = 1 : play1 = 0; -!mute2 ? play2 = 1 : play2 = 0; -!mute3 ? play3 = 1 : play3 = 0; -!mute4 ? play4 = 1 : play4 = 0; -!mute5 ? play5 = 1 : play5 = 0; - -( solo1 || solo2 || solo3 || solo4 || solo5 ) ? ( play1 = play2 = play3 = play4 = play5 = 0; ); -solo1 ? play1 = 1; -solo2 ? play2 = 1; -solo3 ? play3 = 1; -solo4 ? play4 = 1; -solo5 ? play5 = 1; - -(FIR) ? ( - chunkSize = (fftCalcSize - firSize - 1); - newPDC = chunkSize + 0.5*firSize; -) : ( - newPDC = 0; -); - -(pdc_delay != newPDC) ? ( - pdc_top_ch = 10; - pdc_bot_ch = 0; - pdc_delay = newPDC; -); - -@sample - function init_LR2(freq) - global(srate, norm_freq_max, norm_freq_min, band_mode) - local(f0, ct, st, div) - instance(k, a1, a2, a3) - ( - f0 = norm_freq_max * $pi * exp( (1.0 - freq) * log(norm_freq_min) ); - k = band_mode == 0 ? sqrt(2) : 2; /* Note the different peak resonance because we're combining 2 SVFs into the Linkwitz-Riley structure */ - - ct = cos(f0); - st = sin(f0); - div = 1.0 / (1.0 + k * st * ct); - a1 = ct * ct * div; - a2 = st * ct * div; - a3 = st * st * div; - ); - - function reset_LR() - global() - local() - instance(ic1eq, ic2eq, ic3eq, ic4eq, ic5eq, ic6eq, k, a1, a2, a3) - ( - ic1eq = ic2eq = 0; - ); - - function eval_LRLP(v0) - global() - local(v1, v2, v3) - instance(ic3eq, ic4eq, a1, a2, a3) - ( - v3 = v0 - ic4eq; - v1 = a1 * ic3eq + a2 * v3; - v2 = ic4eq + a2 * ic3eq + a3 * v3; - ic3eq = 2*v1 - ic3eq; - ic4eq = 2*v2 - ic4eq; - - v2 - ); - - function eval_LRAP(v0) - global() - local(v1, v2, v3) - instance(ic5eq, ic6eq, k, a1, a2, a3) - ( - v3 = v0 - ic6eq; - v1 = a1 * ic5eq + a2 * v3; - v2 = ic6eq + a2 * ic5eq + a3 * v3; - ic5eq = 2*v1 - ic5eq; - ic6eq = 2*v2 - ic6eq; - - v0 - 2*k*v1 - ); - - function eval_LR2(v0) - global() - local(v1, v2, v3, all) - instance(ic1eq, ic2eq, k, a1, a2, a3, hp, lp) - ( - v3 = v0 - ic2eq; - v1 = a1 * ic1eq + a2 * v3; - v2 = ic2eq + a2 * ic1eq + a3 * v3; - ic1eq = 2*v1 - ic1eq; - ic2eq = 2*v2 - ic2eq; - - all = v0 - 2 * k * v1; - - lp = this.eval_LRLP(v2); - hp = all - lp; - ); - - function eval_LR1(v0) - global() - local(v1, v2, v3) - instance(ic1eq, ic2eq, k, a1, a2, a3, hp, lp) - ( - v3 = v0 - ic2eq; - v1 = a1 * ic1eq + a2 * v3; - v2 = ic2eq + a2 * ic1eq + a3 * v3; - ic1eq = 2*v1 - ic1eq; - ic2eq = 2*v2 - ic2eq; - - lp = v2; - hp = v0 - k * v1 - lp; - ); - - function init_AP1(freq) - global(srate, norm_freq_min, norm_freq_max) - instance(k) - local(f0, st) - ( - f0 = norm_freq_max * $pi * exp((1 - freq) * log(norm_freq_min)); - st = sin(f0); - k = st / (st + cos(f0)); - ); - - function eval_AP1(v0) - global() - instance(k, state) - local(v, y) - ( - v = (v0 - state) * k; - y = v + state; - state = y + v; - y - (v0 - y) - ); - - function resetBands() - local() - global() - instance( b1, b2, b3, b4, b5 ) - ( - b1.r = b1.l = b2.r = b2.l = b3.r = b3.l = b4.r = b4.l = b5.l = 0; - ); - - function resetFilters() - global() - local() - instance( - LF1, LF2, LF3, LF4 /* Lowpass left */ - LA_F2, /* Allpass frequency 2 left */ - LA_F3, LA_F3_2, /* Allpass frequency 3 left */ - LA_F4, LA_F4_2, LA_F4_3, /* Allpass frequency 4 left */ - RF1, RF2, RF3, RF4 /* Lowpass right */ - RA_F2, /* Allpass frequency 2 right */ - RA_F3, RA_F3_2, /* Allpass frequency 3 right */ - RA_F4, RA_F4_2, RA_F4_3, /* Allpass frequency 4 right */ - ) - ( - // LR2 => ic1eq, ic2eq, ic3eq, ic4eq - // LPLP => ic3eq, ic4eq - // LRAP => ic5eq, ic6eq - - LF1.ic1eq = LF1.ic2eq = LF1.ic3eq = LF1.ic4eq = 0; - LF2.ic1eq = LF2.ic2eq = LF2.ic3eq = LF2.ic4eq = 0; - LF3.ic1eq = LF3.ic2eq = LF3.ic3eq = LF3.ic4eq = 0; - LF4.ic1eq = LF4.ic2eq = LF4.ic3eq = LF4.ic4eq = 0; - - RF1.ic1eq = RF1.ic2eq = RF1.ic3eq = RF1.ic4eq = 0; - RF2.ic1eq = RF2.ic2eq = RF2.ic3eq = RF2.ic4eq = 0; - RF3.ic1eq = RF3.ic2eq = RF3.ic3eq = RF3.ic4eq = 0; - RF4.ic1eq = RF4.ic2eq = RF4.ic3eq = RF4.ic4eq = 0; - - LA_F4.ic5eq = LA_F4.ic6eq = LA_F3.ic5eq = LA_F3.ic6eq = LA_F2.ic5eq = LA_F2.ic6eq = 0; - RA_F4.ic5eq = RA_F4.ic6eq = RA_F3.ic5eq = RA_F3.ic6eq = RA_F2.ic5eq = RA_F2.ic6eq = 0; - - LA_F4_2.ic5eq = LA_F4_2.ic6eq = LA_F3_2.ic5eq = LA_F3_2.ic6eq = LA_F4_3.ic5eq = LA_F4_3.ic6eq = 0; - RA_F4_2.ic5eq = RA_F4_2.ic6eq = RA_F3_2.ic5eq = RA_F3_2.ic6eq = RA_F4_3.ic5eq = RA_F4_3.ic6eq = 0; - ); - - // Make sure the delay is the same on all bands (identical number of filters) - function splitBands(sl, sr) - local() - global(Cuts, FIR, band_mode, lband_mode) - instance( LF1, LF2, LF3, LF4 /* Lowpass left */ - LA_F2, /* Allpass frequency 2 left */ - LA_F3, LA_F3_2, /* Allpass frequency 3 left */ - LA_F4, LA_F4_2, LA_F4_3, /* Allpass frequency 4 left */ - RF1, RF2, RF3, RF4 /* Lowpass right */ - RA_F2, /* Allpass frequency 2 right */ - RA_F3, RA_F3_2, /* Allpass frequency 3 right */ - RA_F4, RA_F4_2, RA_F4_3, /* Allpass frequency 4 right */ - b1, b2, b3, b4, b5, lcuts ) - ( - ( lcuts != cuts ) ? ( - lcuts = cuts; - this.resetBands(); - ); - - band_mode == 0 ? ( - // 4p filters - (cuts==0) ? ( - b1.inL = sl; - b1.inR = sr; - ) : (cuts==1) ? ( - LF1.eval_LR2(sl); - b1.inL = LF1.lp; - b2.inL = LF1.hp; - - RF1.eval_LR2(sr); - b1.inR = RF1.lp; - b2.inR = RF1.hp; - ) : (cuts==2) ? ( - LF1.eval_LR2(sl); - b1.inL = LA_F2.eval_LRAP(LF1.lp); - - LF2.eval_LR2(LF1.hp); - b2.inL = LF2.lp; - b3.inL = LF2.hp; - - RF1.eval_LR2(sr); - b1.inR = RA_F2.eval_LRAP(RF1.lp); - - RF2.eval_LR2(RF1.hp); - b2.inR = RF2.lp; - b3.inR = RF2.hp; - ) : (cuts == 3) ? ( - LF1.eval_LR2(sl); - b1.inL = LA_F3.eval_LRAP(LA_F2.eval_LRAP(LF1.lp)); - - LF2.eval_LR2(LF1.hp); - b2.inL = LA_F3_2.eval_LRAP(LF2.lp); - - LF3.eval_LR2(LF2.hp); - b3.inL = LF3.lp; - b4.inL = LF3.hp; - - RF1.eval_LR2(sr); - b1.inR = RA_F3.eval_LRAP(RA_F2.eval_LRAP(RF1.lp)); - - RF2.eval_LR2(RF1.hp); - b2.inR = RA_F3_2.eval_LRAP(RF2.lp); - - RF3.eval_LR2(RF2.hp); - b3.inR = RF3.lp; - b4.inR = RF3.hp; - ) : (cuts == 4) ? ( - LF1.eval_LR2(sl); - b1.inL = LA_F4.eval_LRAP(LA_F3.eval_LRAP(LA_F2.eval_LRAP(LF1.lp))); - - LF2.eval_LR2(LF1.hp); - b2.inL = LA_F4_2.eval_LRAP(LA_F3_2.eval_LRAP(LF2.lp)); - - LF3.eval_LR2(LF2.hp); - b3.inL = LA_F4_3.eval_LRAP(LF3.lp); - - LF4.eval_LR2(LF3.hp); - b4.inL = LF4.lp; - b5.inL = LF4.hp; - - RF1.eval_LR2(sr); - b1.inR = RA_F4.eval_LRAP(RA_F3.eval_LRAP(RA_F2.eval_LRAP(RF1.lp))); - - RF2.eval_LR2(RF1.hp); - b2.inR = RA_F4_2.eval_LRAP(RA_F3_2.eval_LRAP(RF2.lp)); - - RF3.eval_LR2(RF2.hp); - b3.inR = RA_F4_3.eval_LRAP(RF3.lp); - - RF4.eval_LR2(RF3.hp); - b4.inR = RF4.lp; - b5.inR = RF4.hp; - ); - ) : ( - // 2p filters - (cuts==0) ? ( - b1.inL = sl; - b1.inR = sr; - ) : (cuts==1) ? ( - LF1.eval_LR1(sl); - b1.inL = LF1.lp; - b2.inL = - LF1.hp; - - RF1.eval_LR1(sr); - b1.inR = RF1.lp; - b2.inR = - RF1.hp; - ) : (cuts==2) ? ( - LF1.eval_LR1(sl); - b1.inL = LA_F2.eval_AP1(LF1.lp); - - LF2.eval_LR1(LF1.hp); - b2.inL = -LF2.lp; - b3.inL = LF2.hp; - - RF1.eval_LR1(sr); - b1.inR = RA_F2.eval_AP1(RF1.lp); - - RF2.eval_LR1(RF1.hp); - b2.inR = -RF2.lp; - b3.inR = RF2.hp; - ) : (cuts == 3) ? ( - LF1.eval_LR1(sl); - b1.inL = LA_F3.eval_AP1(LA_F2.eval_AP1(LF1.lp)); - - LF2.eval_LR1(LF1.hp); - b2.inL = - LA_F3_2.eval_AP1(LF2.lp); - - LF3.eval_LR1(LF2.hp); - b3.inL = LF3.lp; - b4.inL = - LF3.hp; - - RF1.eval_LR1(sr); - b1.inR = RA_F3.eval_AP1(RA_F2.eval_AP1(RF1.lp)); - - RF2.eval_LR1(RF1.hp); - b2.inR = - RA_F3_2.eval_AP1(RF2.lp); - - RF3.eval_LR1(RF2.hp); - b3.inR = RF3.lp; - b4.inR = - RF3.hp; - ) : (cuts == 4) ? ( - LF1.eval_LR1(sl); - b1.inL = LA_F4.eval_AP1(LA_F3.eval_AP1(LA_F2.eval_AP1(LF1.lp))); - - LF2.eval_LR1(LF1.hp); - b2.inL = - LA_F4_2.eval_AP1(LA_F3_2.eval_AP1(LF2.lp)); - - LF3.eval_LR1(LF2.hp); - b3.inL = LA_F4_3.eval_AP1(LF3.lp); - - LF4.eval_LR1(- LF3.hp); - b4.inL = LF4.lp; - b5.inL = - LF4.hp; - - RF1.eval_LR1(sr); - b1.inR = RA_F4.eval_AP1(RA_F3.eval_AP1(RA_F2.eval_AP1(RF1.lp))); - - RF2.eval_LR1(RF1.hp); - b2.inR = - RA_F4_2.eval_AP1(RA_F3_2.eval_AP1(RF2.lp)); - - RF3.eval_LR1(RF2.hp); - b3.inR = RA_F4_3.eval_AP1(RF3.lp); - - RF4.eval_LR1(- RF3.hp); - b4.inR = RF4.lp; - b5.inR = - RF4.hp; - ); - ); - ); - - // Convert to linear phase - function linearPhase(fft_mem, fftCalcSize) - local(fwd, r1, i1, mag1, flip, i, w) - global() - instance() - ( - fwd = fft_mem; - - /* Making the filter linear phase involves both removing - the phase; but then also shifting the impulse response - to overlap with our chunk. If we just remove the phase, - we'd get an impulse response like this: - \____/ - The goal is to shift it to the middle of the FIR section. - Considering that the FIR section is at .25 of the spectrum, - we have to shift it further than we normally would (a step of - 1.5 * pi rather than pi. */ - - flip = 1; - i = 0; - loop(fftCalcSize, - r1 = fwd[]; - i1 = fwd[1]; - - mag1 = sqrt(sqr(r1) + sqr(i1)); - - fwd[] = mag1 * cos($pi*i); - fwd[1] = mag1 * sin($pi*i); - - i += 1.5; - fwd += 2; - ); - - /*i = 0; - loop(1, - fft_mem[2*i] = 0; - fft_mem[2*fftCalcSize-2*i] = 0; - i = i + 1; - );*/ - - ); - - function updateCoeffs() - local(fptr1, fptr2, fptr3, fptr4, fptr5, middle, i, M) - global(Cuts, Freq1, Freq2, Freq3, Freq4, FIR, FIR_quality, - FIR1, FIR2, FIR3, FIR4, FIR5, bufferDist, - firSize, fftCalcSize, band_mode, lband_mode, abs_placement) - instance( F1, F2, F3, F4 - LF1, LF2, LF3, LF4 /* Lowpass left */ - LA_F2, /* Allpass frequency 2 left */ - LA_F3, LA_F3_2, /* Allpass frequency 3 left */ - LA_F4, LA_F4_2, LA_F4_3, /* Allpass frequency 4 left */ - RF1, RF2, RF3, RF4 /* Lowpass right */ - RA_F2, /* Allpass frequency 2 right */ - RA_F3, RA_F3_2, /* Allpass frequency 3 right */ - RA_F4, RA_F4_2, RA_F4_3, /* Allpass frequency 4 right */ - lcuts, lFIR, lFIR_quality, - lF1, lF2, lF3, lF4, - labs_placement, - updateRequired - ) - ( - updateRequired = 0; - updateRequired = ( - ( labs_placement != abs_placement ) || - ( lF1 != Freq1 ) || - ( lF2 != Freq2 ) || - ( lF3 != Freq3 ) || - ( lF4 != Freq4 ) || - ( cuts != lcuts ) || - ( FIR != lFIR ) || - ( FIR_quality != lFIR_quality ) || - ( band_mode != lband_mode )); - - updateRequired ? ( - M = 4; - (FIR_quality > 0) ? M *= 2; - (FIR_quality > 1) ? M *= 2; - firSize = 512*M; - fftCalcSize = 1024*M; - lband_mode = band_mode; - labs_placement = abs_placement; - - lF1 = Freq1; - lF2 = Freq2; - lF3 = Freq3; - lF4 = Freq4; - lFIR = FIR; - lFIR_quality = FIR_quality; - lcuts = cuts; - - abs_placement ? ( - F1 = clamp(Freq1, 0, 1); - F2 = clamp(Freq2, F1, cuts > 2 ? F3 : 1); - F3 = clamp(Freq3, F2, cuts > 3 ? F4 : 1); - F4 = clamp(Freq4, F3, 1.0); - ) : ( - F1 = Freq1; - F2 = Freq1 + Freq2 * (1 - Freq1); - F3 = F2 + Freq3 * (1 - F2); - F4 = F3 + Freq4 * (1 - F3); - ); - - (cuts==1) ? ( - LF1.init_LR2(Freq1); - RF1.k = LF1.k; - RF1.a1 = LF1.a1; - RF1.a2 = LF1.a2; - RF1.a3 = LF1.a3; - ) : (cuts==2) ? ( - LF1.init_LR2(Freq1); - RF1.k = LF1.k; - RF1.a1 = LF1.a1; - RF1.a2 = LF1.a2; - RF1.a3 = LF1.a3; - LF2.init_LR2(F2); - RF2.k = LF2.k; - RF2.a1 = LF2.a1; - RF2.a2 = LF2.a2; - RF2.a3 = LF2.a3; - - (band_mode == 0) ? ( - LA_F2.init_LR2(F2); - ) : ( - LA_F2.init_AP1(F2); - ); - RA_F2.k = LA_F2.k; - RA_F2.a1 = LA_F2.a1; - RA_F2.a2 = LA_F2.a2; - RA_F2.a3 = LA_F2.a3; - ) : (cuts == 3) ? ( - LF1.init_LR2(Freq1); - RF1.k = LF1.k; - RF1.a1 = LF1.a1; - RF1.a2 = LF1.a2; - RF1.a3 = LF1.a3; - LF2.init_LR2(F2); - RF2.k = LF2.k; - RF2.a1 = LF2.a1; - RF2.a2 = LF2.a2; - RF2.a3 = LF2.a3; - LF3.init_LR2(F3); - RF3.k = LF3.k; - RF3.a1 = LF3.a1; - RF3.a2 = LF3.a2; - RF3.a3 = LF3.a3; - - // All-passes for maintaining the phase relation between the bands - (band_mode == 0) ? ( - LA_F2.init_LR2(F2); - LA_F3.init_LR2(F3); - ) : ( - LA_F2.init_AP1(F2); - LA_F3.init_AP1(F3); - ); - - RA_F3.k = RA_F3_2.k = LA_F3_2.k = LA_F3.k; - RA_F3.a1 = RA_F3_2.a1 = LA_F3_2.a1 = LA_F3.a1; - RA_F3.a2 = RA_F3_2.a2 = LA_F3_2.a2 = LA_F3.a2; - RA_F3.a3 = RA_F3_2.a3 = LA_F3_2.a3 = LA_F3.a3; - - RA_F2.k = LA_F2.k; - RA_F2.a1 = LA_F2.a1; - RA_F2.a2 = LA_F2.a2; - RA_F2.a3 = LA_F2.a3; - ) : (cuts == 4) ? ( - LF1.init_LR2(Freq1); - RF1.k = LF1.k; - RF1.a1 = LF1.a1; - RF1.a2 = LF1.a2; - RF1.a3 = LF1.a3; - LF2.init_LR2(F2); - RF2.k = LF2.k; - RF2.a1 = LF2.a1; - RF2.a2 = LF2.a2; - RF2.a3 = LF2.a3; - LF3.init_LR2(F3); - RF3.k = LF3.k; - RF3.a1 = LF3.a1; - RF3.a2 = LF3.a2; - RF3.a3 = LF3.a3; - LF4.init_LR2(F4); - RF4.k = LF4.k; - RF4.a1 = LF4.a1; - RF4.a2 = LF4.a2; - RF4.a3 = LF4.a3; - - // All-passes for maintaining the phase relation between the bands - (band_mode == 0) ? ( - LA_F2.init_LR2(F2); - LA_F3.init_LR2(F3); - LA_F4.init_LR2(F4); - ) : ( - LA_F2.init_AP1(F2); - LA_F3.init_AP1(F3); - LA_F4.init_AP1(F4); - ); - - RA_F4.k = RA_F4_2.k = RA_F4_3.k = LA_F4_2.k = LA_F4_3.k = LA_F4.k; - RA_F4.a1 = RA_F4_2.a1 = RA_F4_3.a1 = LA_F4_2.a1 = LA_F4_3.a1 = LA_F4.a1; - RA_F4.a2 = RA_F4_2.a2 = RA_F4_3.a2 = LA_F4_2.a2 = LA_F4_3.a2 = LA_F4.a2; - RA_F4.a3 = RA_F4_2.a3 = RA_F4_3.a3 = LA_F4_2.a3 = LA_F4_3.a3 = LA_F4.a3; - - RA_F3.k = RA_F3_2.k = LA_F3_2.k = LA_F3.k; - RA_F3.a1 = RA_F3_2.a1 = LA_F3_2.a1 = LA_F3.a1; - RA_F3.a2 = RA_F3_2.a2 = LA_F3_2.a2 = LA_F3.a2; - RA_F3.a3 = RA_F3_2.a3 = LA_F3_2.a3 = LA_F3.a3; - - RA_F2.k = LA_F2.k; - RA_F2.a1 = LA_F2.a1; - RA_F2.a2 = LA_F2.a2; - RA_F2.a3 = LA_F2.a3; - ); - - /* Are we dealing with a FIR filter? */ - FIR ? ( - // CalcFIR - memset(FIR1, 0, bufferDist); - memset(FIR2, 0, bufferDist); - memset(FIR3, 0, bufferDist); - memset(FIR4, 0, bufferDist); - memset(FIR5, 0, bufferDist); - - this.resetFilters(); - - /* Fetch impulse response */ - fptr1 = FIR1; - fptr2 = FIR2; - fptr3 = FIR3; - fptr4 = FIR4; - fptr5 = FIR5; - - this.splitBands(1.0/fftCalcSize, 1.0/fftCalcSize); - - loop(firSize, - fptr1[] = this.b1.inL; fptr1 += 2; - fptr2[] = this.b2.inL; fptr2 += 2; - fptr3[] = this.b3.inL; fptr3 += 2; - fptr4[] = this.b4.inL; fptr4 += 2; - fptr5[] = this.b5.inL; fptr5 += 2; - - this.splitBands(0, 0); - ); - - //FIR1[0]=1/fftCalcSize; - - /* Transform impulse responses */ - fft(FIR1, fftCalcSize); - fft(FIR2, fftCalcSize); - fft(FIR3, fftCalcSize); - fft(FIR4, fftCalcSize); - fft(FIR5, fftCalcSize); - - fft_permute(FIR1, fftCalcSize); - fft_permute(FIR2, fftCalcSize); - fft_permute(FIR3, fftCalcSize); - fft_permute(FIR4, fftCalcSize); - fft_permute(FIR5, fftCalcSize); - - /* Remove phase information (converts to linear phase) */ - linearPhase(FIR1, fftCalcSize); - linearPhase(FIR2, fftCalcSize); - linearPhase(FIR3, fftCalcSize); - linearPhase(FIR4, fftCalcSize); - linearPhase(FIR5, fftCalcSize); - - fft_ipermute(FIR1, fftCalcSize); - fft_ipermute(FIR2, fftCalcSize); - fft_ipermute(FIR3, fftCalcSize); - fft_ipermute(FIR4, fftCalcSize); - fft_ipermute(FIR5, fftCalcSize); - ); - ); - - updateRequired - ); - - function doFIR(l, r, block1, block2, fftCalcSize, filterSize, filterLoc, cPos) - instance(curBlock, lastBlock, initialized, chunkSize, chunksizeT2) - local(tmp, cPosT2) - global(bufferdist) - ( - !initialized ? ( - curBlock = block1; - lastBlock = block2; - - memset(curBlock, 0, bufferdist); - memset(lastBlock, 0, bufferdist); - initialized = 1; - - chunkSize = (fftCalcSize - filterSize - 1); - chunkSizeT2 = chunkSize * 2; - ); - - cPos >= chunkSize ? - ( - tmp = lastBlock; - lastBlock = curBlock; - curBlock = tmp; - - /* Empty out the data beyond chunkSize of the block that has - just been filled. This used to be the carried over overlap-add - tail of the previous one */ - memset( curBlock + chunkSizeT2, 0, (fftCalcSize-chunkSize)*2 ); - - /* Calculate FFT of current chunk */ - fft(curBlock, fftCalcSize); - //fft_permute(curBlock, fftCalcSize); - - /* Convolve with the FIR filter (already FFT'd) */ - convolve_c(curBlock, filterLoc, fftCalcSize); - //fft_ipermute(curBlock, fftCalcSize); - ifft(curBlock, fftCalcSize); - - cPos = 0; - ); - - /* Save sample */ - cPosT2 = cPos * 2; - lastBlock[cPosT2] = l; - lastBlock[cPosT2+1] = r; - - this.inL = curBlock[cPosT2]; - this.inR = curBlock[cPosT2+1]; - - /* Overlap add the previous tail */ - ( cPos < (fftCalcSize-chunkSize) ) ? - ( - this.inL += lastBlock[chunkSizeT2+cPosT2]; - this.inR += lastBlock[chunkSizeT2+cPosT2+1]; - 1 - ); - - cPos + 1 - ); - - function processSample() - ( - FIR ? ( - filterBank.resetBands(); - cPosNew = filterBank.b1.doFIR(inL, inR, F1Block1, F1Block2, fftCalcSize, firSize, FIR1, cPos); - ( cuts > 0 ) ? ( filterBank.b2.doFIR(inL, inR, F2Block1, F2Block2, fftCalcSize, firSize, FIR2, cPos); ); - ( cuts > 1 ) ? ( filterBank.b3.doFIR(inL, inR, F3Block1, F3Block2, fftCalcSize, firSize, FIR3, cPos); ); - ( cuts > 2 ) ? ( filterBank.b4.doFIR(inL, inR, F4Block1, F4Block2, fftCalcSize, firSize, FIR4, cPos); ); - ( cuts > 3 ) ? ( filterBank.b5.doFIR(inL, inR, F5Block1, F5Block2, fftCalcSize, firSize, FIR5, cPos); ); - cPos = cPosNew; - ) : ( - filterBank.splitBands(inL, inR); - ); - - filterBank.processBands(); - ); - - FIR ? ( - specBuffer.updateBuffer(.5*(spl0+spl1)); - specBuffer.setOffset(newPDC+2); - cSpec = specBuffer.readBuffer(); - spectrumIn.feedSample(cSpec); - ) : ( - spectrumIn.feedSample(.5*(spl0+spl1)); - ); - - // Split signal into bands - filterBank.updateCoeffs(); - - inL = spl0; - inR = spl1; - - processSample(); - - spl0 = filterBank.b1.l; - spl1 = filterBank.b1.r; - out = spl0 + spl1; - ( cuts > 0 ) ? ( - spl2 = filterBank.b2.l; - spl3 = filterBank.b2.r; - out += spl2 + spl3; - ( cuts > 1 ) ? ( - spl4 = filterBank.b3.l; - spl5 = filterBank.b3.r; - out += spl4 + spl5; - ( cuts > 2 ) ? ( - spl6 = filterBank.b4.l; - spl7 = filterBank.b4.r; - out += spl6 + spl7; - ( cuts > 3 ) ? ( - spl8 = filterBank.b5.l; - spl9 = filterBank.b5.r; - out += spl8 + spl9; - ); - ); - ); - ); - - spectrumOut.feedSample(.5*out); - - /* Uncomment for testing flatness - spl0 += spl2 + spl4 + spl6 + spl8; - spl1 += spl3 + spl5 + spl7 + spl9;*/ - - curSample += 1; - -@gfx 1080 400 - function createGUI(stripStart) - ( - scaling = gfx_ext_retina-1; - spectrumX = 0; - spectrumY = 0; - spectrumW = gfx_w - 200*0; - spectrumH = gfx_h - 25 * ( 1 + modVisible ) * (1+scaling); - - fontface = "Arial"; - gfx_setfont(GRID_FONT, fontface, 14*(1+scaling)); - gfx_setfont(HINT_FONT, fontface, 14*(1+scaling)); - - spectrumIn.setWindowLocation(spectrumX, spectrumY, spectrumW, spectrumH); - spectrumOut.setWindowLocation(spectrumX, spectrumY, spectrumW, spectrumH); - ); - - /* Gradients are buffered to save rendering perf */ - function drawGradients(w, h, spectrumH, gradient_bg) - instance(lw, lh, lSpectrumH) - global(gfx_mode, gfx_dest, bg_color_r, bg_color_g, bg_color_b, bg_color_a, - gfx_x, gfx_y, gfx_r, gfx_g, gfx_b, gfx_a ) - local( oldDest, oldMode) - ( - oldMode = gfx_mode; - gfx_mode = 0; - gfx_set(1,1,1,1); - ( ( lw != w ) || ( lh != h ) || (spectrumH != lSpectrumH) ) ? ( - /* Only draw gradients when size changes */ - gfx_x = gfx_y = 0; - lw = w; - lh = h; - lSpectrumH = spectrumH; - oldDest = gfx_dest; - gfx_setimgdim(gradient_bg, w, h); - gfx_dest = gradient_bg; - gfx_set(bg_color_r, bg_color_g, bg_color_b, bg_color_a); - gfx_rectto(w,spectrumH); - gfx_gradrect(0, 0, w, spectrumH, gfx_r, gfx_g, gfx_b, gfx_a, .0001, .001, .0001, .0001, -.0001, -.0001, .0001, .0001); - gfx_gradrect(0, 0, w, spectrumH, gfx_r, gfx_g, gfx_b, .3, .0001, .001, .0006, .0001, -.0001, -.0001, .0001, .0001); - gfx_gradrect(0, 0, w, spectrumH, 0, 0, 0, 0, 0, -.001, -.0006, .0001, -.0001, -.0001, .01, -.00008); - gfx_gradrect(0, spectrumH, w, h-spectrumH, 0, 0, .0, 1.0, .0001, .0001, .0002, 0, 0, 0, .0005, 0); - gfx_dest = oldDest; - ); - - gfx_x = gfx_y = 0; - gfx_blit(gradient_bg, 1, 0); - gfx_mode = oldMode; - ); - - bg_color_r = 47/255; - bg_color_g = 65/255; - bg_color_b = 75/255; - bg_color_a = 1; - fft_out_r = .8; - fft_out_g = .8; - fft_out_b = .8; - fft_out_a = 1.0; - fft_in_r = .13; - fft_in_g = .13; - fft_in_b = .23; - fft_in_a = .6; - grid_color_r = .73; - grid_color_g = .73; - grid_color_b = .76; - grid_color_a = .2; - grid_alpha = .1 * (1+.5*abs(sin(2*time_precise()))); - backface_color_r = .2; - backface_color_g = .2; - backface_color_b = .3; - backface_color_a = .1; - font_color_r = .8; - font_color_g = .8; - font_color_b = .8; - font_color_a = .8; - knob_font_color_r = .5; - knob_font_color_g = .7; - knob_font_color_b = 1; - knob_font_color_a = 1; - highlight_color_r = .5; - highlight_color_g = .7+.2*abs(sin(2*time_precise())); - highlight_color_b = .9; - highlight_color_a = .6+.4*abs(sin(2*time_precise())); - disabled_color_r = .4; - disabled_color_g = .4; - disabled_color_b = .4; - disabled_color_a = .8; - - stripStart = 35; - createGUI(stripStart); - gradient.drawGradients(gfx_w, gfx_h, spectrumH, 2); - - globalTime = time_precise(); - delta_time = globalTime - lastGlobalTime; - lastGlobalTime = globalTime; - - gfx_r = 1; - spectrumIn.drawGrid(); - spectrumIn.floorLevel = 25 + dnoisefloor_freq; - spectrumOut.floorLevel = 25 + dnoisefloor_freq; - spectrumIn.drawFFT(1, fft_in_r, fft_in_g, fft_in_b, fft_in_a); - spectrumOut.drawFFT(0, fft_out_r, fft_out_g, fft_out_b, fft_out_a); - spectrumIn.updateBands(); - spectrumIn.drawBands(); - spectrumIn.fftWindow_processMouse(mouse_x, mouse_y, mouse_cap); - - tFIR.label = "FIR"; - tFIR.drawToggle(20, 20, 10, 10, FIR, 1, 0.2, 0.2, 0.8, 1.0, 0.2, 0.2, 0.8, "Linear phase FIR mode.\n\nLinear phase filters preserve the phase relations between this\nand other tracks but introduce a higher CPU cost and latency.\nEnable only when needed for its linear phase properties.\n\nNote: Modulation of the frequency when in FIR mode can cause crackles."); - FIR = tFIR.processMouseToggle(mouse_x, mouse_y, mouse_cap); - - FIR ? ( - FIR_NQ.drawToggle(60, 20, 10, 10, FIR_quality == 0, 1, 0.2, 0.2, 0.8, 1.0, 0.2, 0.2, 0.8, "Normal quality mode.\n\nHigher quality modes can be useful when using splits\nat very low frequencies. Note that high quality modes\ninduce more latency and require restarting transport\n(press stop and play)."); - FIR_NQ.processMouseToggle(mouse_x, mouse_y, mouse_cap) ? FIR_quality = 0; - FIR_HQ.drawToggle(75, 20, 10, 10, FIR_quality == 1, 1, 0.2, 0.2, 0.8, 1.0, 0.2, 0.2, 0.8, "High quality mode.\n\nHigher quality modes can be useful when using splits\nat very low frequencies. Note that high quality modes\ninduce more latency and require restarting transport\n(press stop and play)."); - FIR_HQ.processMouseToggle(mouse_x, mouse_y, mouse_cap) ? FIR_quality = 1; - FIR_UQ.label = - FIR_quality == 0 ? "Normal" - : FIR_quality == 1 ? "High" - : FIR_quality == 2 ? "Ultra"; - FIR_UQ.drawToggle(90, 20, 10, 10, FIR_quality == 2, 1, 0.2, 0.2, 0.8, 1.0, 0.2, 0.2, 0.8, "Ultra quality mode.\n\nHigher quality modes can be useful when using splits\nat very low frequencies. Note that high quality modes\ninduce more latency and require restarting transport\n(press stop and play)."); - FIR_UQ.processMouseToggle(mouse_x, mouse_y, mouse_cap) ? FIR_quality = 2; - ); - - fourpole.drawToggle(20, 40, 10, 10, band_mode == 0, 1, 0.2, 0.2, 0.8, 1.0, 0.2, 0.2, 0.8, "Use 4 pole 24 dB/oct filters"); - fourpole.processMouseToggle(mouse_x, mouse_y, mouse_cap) ? band_mode = 0; - fourpole.label = "4p"; - twopole.drawToggle(60, 40, 10, 10, band_mode == 1, 1, 0.2, 0.2, 0.8, 1.0, 0.2, 0.2, 0.8, "Use 2 pole 12 dB/oct filters"); - twopole.processMouseToggle(mouse_x, mouse_y, mouse_cap) ? band_mode = 1; - twopole.label = "2p"; - - absChoice.label = "Abs position"; - absChoice.drawToggle(20, 60, 10, 10, abs_placement, 1, 0.2, 0.2, 0.8, 1.0, 0.2, 0.2, 0.8, "Absolute positioning.\n\nIn this mode the slider mapping is absolute."); - abs_placement = absChoice.processMouseToggle(mouse_x, mouse_y, mouse_cap); - - gfx_x = gfx_y = 30; - gfx_setfont(1,"ARIAL",30); - gfx_set(1,0,0,1); - gfx_x = 30; - gfx_y = 60; - - gfx_x = gfx_w-130*(1+scaling); - gfx_y = bottomRow + 30*(1+scaling); - gfx_mode = 4; - - hinter.drawHint_draw(); - - diff --git a/FX/BryanChi_FX Devices/FXD Split To 4 Channels.jsfx b/FX/BryanChi_FX Devices/FXD Split To 4 Channels.jsfx deleted file mode 100644 index 67bb469a0..000000000 --- a/FX/BryanChi_FX Devices/FXD Split To 4 Channels.jsfx +++ /dev/null @@ -1,35 +0,0 @@ -noindex: true - -desc:FXD Split to 4 channels - - -slider1:gain_db=0<-150,12,1>gain (dB) -in_pin:left input -in_pin:right input -in_pin:left input compare -in_pin:right input compare -out_pin:left output -out_pin:right output -out_pin:left Compare -out_pin:right compare - -@init -last_gain=10^(gain_db/20); - -@slider -next_gain=10^(gain_db/20); - - -@block -d_gain = (next_gain - last_gain)/samplesblock; - -@sample -spl0 = spl0; -spl1 = spl1 ; -spl2 = spl0; spl3 = spl1; -spl2 *= last_gain; -spl3 *= last_gain; -last_gain += d_gain; -spl(3) = spl(3); -spl(2) = spl(2); -spl(4) = spl(4) diff --git a/FX/BryanChi_FX Devices/FXD Split to 32 Channels.jsfx b/FX/BryanChi_FX Devices/FXD Split to 32 Channels.jsfx deleted file mode 100644 index 5720815a3..000000000 --- a/FX/BryanChi_FX Devices/FXD Split to 32 Channels.jsfx +++ /dev/null @@ -1,70 +0,0 @@ -noindex: true - -desc:FXD Split to 32 Channels - - - - -slider1:0<-120,12,1>ch 1 Volume (dB) -slider2:0<-120,12,1>ch 2 Volume (dB) -slider3:0<-120,12,1>ch 3 Volume (dB) -slider4:0<-120,12,1>ch 4 Volume (dB) -slider5:0<-120,12,1>ch 5 Volume (dB) -slider6:0<-120,12,1>ch 6 Volume (dB) -slider7:0<-120,12,1>ch 7 Volume (dB) -slider8:0<-120,12,1>ch 8 Volume (dB) -slider9:0<-120,12,1>ch 9 Volume (dB) -slider10:0<-120,12,1>ch 10 Volume (dB) -slider11:0<-120,12,1>ch 11 Volume (dB) -slider12:0<-120,12,1>ch 12 Volume (dB) -slider13:0<-120,12,1>ch 13 Volume (dB) -slider14:0<-120,12,1>ch 14 Volume (dB) -slider15:0<-120,12,1>ch 15 Volume (dB) -slider16:0<-120,12,1>ch 16 Volume (dB) - - - - -//////////////////////////////////////////////////////////////////////////////// - - -@slider - -adj1 = (2^(slider1/6)); -adj2 = (2^(slider2/6)); -adj3 = (2^(slider3/6)); -adj4 = (2^(slider4/6)); -adj5 = (2^(slider5/6)); -adj6 = (2^(slider6/6)); -adj7 = (2^(slider7/6)); -adj8 = (2^(slider8/6)); -adj9 = (2^(slider9/6)); -adj10 = (2^(slider10/6)); -adj11 = (2^(slider11/6)); -adj12 = (2^(slider12/6)); -adj13 = (2^(slider13/6)); -adj14 = (2^(slider14/6)); -adj15 = (2^(slider15/6)); -adj16 = (2^(slider16/6)); - - -//////////////////////////////////////////////////////////////////////////////// - -@sample -spl(0) = spl(0)*adj1; -spl(1) = spl(1)*adj2; -spl(2) = spl(2)*adj3; -spl(3) = spl(3)*adj4; -spl(4) = spl(4)*adj5; -spl(5) = spl(5)*adj6; -spl(6) = spl(6)*adj7; -spl(7) = spl(7)*adj8; -spl(8) = spl(8)*adj9; -spl(9) = spl(9)*adj10; -spl(10) = spl(10)*adj11; -spl(11) = spl(11)*adj12; -spl(12) = spl(12)*adj13; -spl(13) = spl(13)*adj14; -spl(14) = spl(14)*adj15; -spl(15) = spl(15)*adj16; -spl(16) = spl(16)*adj17; diff --git a/FX/BryanChi_FX Devices/IconFont1.ttf b/FX/BryanChi_FX Devices/IconFont1.ttf deleted file mode 100644 index e96542030..000000000 Binary files a/FX/BryanChi_FX Devices/IconFont1.ttf and /dev/null differ diff --git a/FX/BryanChi_FX Devices/Images/Attached Drawings/LED light.png b/FX/BryanChi_FX Devices/Images/Attached Drawings/LED light.png deleted file mode 100644 index ddd321072..000000000 Binary files a/FX/BryanChi_FX Devices/Images/Attached Drawings/LED light.png and /dev/null differ diff --git a/FX/BryanChi_FX Devices/Images/Knobs/Bitwig.png b/FX/BryanChi_FX Devices/Images/Knobs/Bitwig.png deleted file mode 100644 index d8a970662..000000000 Binary files a/FX/BryanChi_FX Devices/Images/Knobs/Bitwig.png and /dev/null differ diff --git a/FX/BryanChi_FX Devices/Images/trash.png b/FX/BryanChi_FX Devices/Images/trash.png deleted file mode 100644 index 2089b7879..000000000 Binary files a/FX/BryanChi_FX Devices/Images/trash.png and /dev/null differ diff --git a/FX/BryanChi_FX Devices/cookdsp.jsfx-inc b/FX/BryanChi_FX Devices/cookdsp.jsfx-inc deleted file mode 100644 index 737668ba9..000000000 --- a/FX/BryanChi_FX Devices/cookdsp.jsfx-inc +++ /dev/null @@ -1,57 +0,0 @@ -///////////////////////////////////////////////////////////////// -// Copyright (c) - 2014 - Olivier Belanger // -// Permission to use, copy, modify, and/or distribute this // -// software for any purpose with or without fee is hereby // -// granted, provided that the above copyright notice and this // -// permission notice appear in all copies. CookDSP IS PROVIDED // -// "AS IS", WITHOUT WARRANTY OF ANY KIND FROM THE AUTHOR. // -///////////////////////////////////////////////////////////////// - -/* Missing math functions */ -import cookdsp/mmath.jsfx-inc - -/* Utility functions */ -import cookdsp/memalloc.jsfx-inc -import cookdsp/scaling.jsfx-inc - -/* List management functions */ -import cookdsp/list.jsfx-inc - -/* Memory management objects */ -import cookdsp/buffer.jsfx-inc -import cookdsp/delay.jsfx-inc - -/* Filtering objects */ -import cookdsp/filters.jsfx-inc - -/* Audio signal analysis objects */ -import cookdsp/analysis.jsfx-inc - -/* Oscillators objects */ -import cookdsp/oscil.jsfx-inc - -/* Pseudo-random generator object */ -import cookdsp/random.jsfx-inc - -/* Midi-related objects */ -import cookdsp/midi.jsfx-inc - -/* Dynamics objects */ -import cookdsp/dynamics.jsfx-inc - -/* Special Effects objects */ -import cookdsp/effects.jsfx-inc - -/* Granulation objects */ -import cookdsp/granulator.jsfx-inc - -/* Fast Fourier Transform objects */ -import cookdsp/fftobjects.jsfx-inc - -/* Phase Vocoder objects */ -import cookdsp/pvocobjects.jsfx-inc - -@init - -COOKDSP_VERSION = 0.5; - diff --git a/FX/BryanChi_FX Devices/cookdsp/analysis.jsfx-inc b/FX/BryanChi_FX Devices/cookdsp/analysis.jsfx-inc deleted file mode 100644 index 623bce301..000000000 --- a/FX/BryanChi_FX Devices/cookdsp/analysis.jsfx-inc +++ /dev/null @@ -1,609 +0,0 @@ -///////////////////////////////////////////////////////////////// -// Copyright (c) - 2014 - Olivier Belanger // -// Permission to use, copy, modify, and/or distribute this // -// software for any purpose with or without fee is hereby // -// granted, provided that the above copyright notice and this // -// permission notice appear in all copies. CookDSP IS PROVIDED // -// "AS IS", WITHOUT WARRANTY OF ANY KIND FROM THE AUTHOR. // -///////////////////////////////////////////////////////////////// - -@init - -/******************************************************* -FOLLOW -====== - -Initialize an envelope follower. - -Description ------------ - -An envelope follower tracks and outputs the changes in -the amplitude of its input signal. Its only argument -is the frequency of the internal lowpass filter. Higher -frequency results in a more responsive tracking while -lower frequency results in a smoother tracking. - -It must be used with a variable name as prefix (object oriented). - -Initializer ------------ - -#### follow(freq) #### - -Initializes an envelope follower with `freq` as the cutoff -frequency of the internal lowpass filter. The lowpass filter -defines the responsiveness of the follower. - -Methods -------- - -#### follow_set_freq(freq) #### - -Sets a new cutoff frequency `freq`, in Hz, to the internal -lowpass filter. - -#### follow_do(signal) #### - -Processes one samples of an input signal `signal` and outputs -the amplitude tracking between 0 and 1. - -Example -------- - - desc:Accompanying Noise - - import cookdsp.jsfx-inc - - slider1:10<1,100>Follower Responsiveness In Hz - - @init - // Initializes the follower - fol.follow(slider1); - - @slider - // Sets follower's responsiveness - fol.follow_set_freq(slider1); - - @sample - // Follow the mixed input signal gain - amp = fol.follow_do((spl0+spl1)*0.7); - // Modulated noise generator - n = (rand(2) - 1) * 0.5 * amp; - // Add modulated noise to the input signal - spl0 += n; - spl1 += n; - -********************************************************/ -function follow(freq) -( - this.lp.lop(freq); - this.freq = this.lp.freq; -); - -function follow_set_freq(freq) -( - this.lp.lop_set_freq(freq); - this.freq = this.lp.freq; -); - -function follow_do(signal) -( - this.lp.lop_do(abs(signal)); -); - -/******************************************************* -ZCROSS -====== - -Counts the number of zero-crossing inside a given time window. - -Description ------------ - -The object `zcross` tracks the number of zero-crossing in the -input signal for a given time window. Its only argument is the -size, in seconds, of the window. The output value is normalized -internally between 0 and 1. - -It must be used with a variable name as prefix (object oriented). - -Initializer ------------ - -#### zcross(size) #### - -Initializes a zero-crossing follower with a time window given by -the `size` argument, in seconds. - -Methods -------- - -#### zcross_set_size(size) #### - -Sets a new time window of length `size`. - -#### zcross_do(signal) #### - -Processes one samples of an input signal `signal` and outputs -the number of zero-crossing, normalized between 0 and 1. - -Example -------- - - desc:Accompanying Noise - - import cookdsp.jsfx-inc - - slider1:0.005<0.001,0.1>Size In Seconds - - @init - // Initializes the zero-crossing follower - zc.zcross(slider1); - - @slider - // Sets zero-crossing size - zc.zcross_set_size(slider1); - - @sample - // Analyse the mixed channels - ncross = zc.zcross_do((spl0+spl1)*0.7); - // Modulated noise generator - n = (rand(2) - 1) * 0.5 * ncross; - // Add modulated noise to the input signal - spl0 += n; spl1 += n; - -********************************************************/ -function _zcross_init(size) ( - size != this.size ? ( - size < 0.001 ? size = 0.001; - this.size = size; - this.maxcount = floor(this.size * srate); - this.count = this.howmany = this.output = 0; - this.last = 0.0; - ); -); - -function zcross(size) -( - this.size = -1; - this._zcross_init(size); -); - -function zcross_set_size(size) -( - this._zcross_init(size); -); - -function zcross_do(signal) -( - this.count += 1; - this.count == this.maxcount ? ( - this.output = this.howmany; - this.howmany = this.count = 0; - ); - this.last >= 0.0 ? ( - signal < 0 && (this.last - signal) > 0.0001 ? ( - this.howmany += 1; - ); - ) : ( - signal >= 0 && (signal - this.last) > 0.0001 ? ( - this.howmany += 1; - ); - ); - this.last = signal; - this.output / this.maxcount; -); - -/******************************************************* -YIN -=== - -Pitch tracker using the Yin algorithm. - -Description ------------ - -Pitch tracker using the Yin algorithm based on the implementation in C of -the Aubio library. This algorithm was developped by A. de Cheveigne and -H. Kawahara and published in: - -> de Cheveigne, A., Kawahara, H. (2002), -> *YIN, a fundamental frequency estimator for speech and music*, -> J. Acoust. Soc. Am. 111, 1917-1930. - -The audio output of the object is the estimated frequency, in Hz, of the -input sound. - -It must be used with a variable name as prefix (object oriented). - -Initializer ------------ - -#### yin(tolerance, minfreq, maxfreq, cutoff, size) #### - -Initializes a yin pitch follower with a time window given by -the `size` argument, in samples. The size must be higher that two -periods of the lowest desired frequency. The `tolerance` argument is -the parameter for the minima selection, between 0 and 1. The -`minfreq` and `maxfreq` arguments are the limits of the estimated -frequency, in Hz. The `cutoff` argument is the cutoff frequency -of a pre-analysis lowpass filter, used to remove small variation -in the input signal. - -Here is a good set of parameters to start with: - - tolerance=0.2, minfreq=40, maxfreq=1000, cutoff=1000, size=1024 - -Methods -------- - -#### yin_set_tolerance(tolerance) #### - -Sets a new tolerance value `tolerance`, between 0 and 1. - -#### yin_set_minfreq(minfreq) #### - -Sets a new minimum frequency `minfreq`, in Hz. - -#### yin_set_maxfreq(maxfreq) #### - -Sets a new maximum frequency `maxfreq`, in Hz. - -#### yin_set_cutoff(cutoff) #### - -Sets a new lowpass cutoff frequency `cutoff`, in Hz. - -#### yin_set_size(size) #### - -Sets a new time window of length `size`. - -#### yin_do(signal) #### - -Processes one samples of an input signal `signal` and outputs -the estimated frequency, in Hz. - -Example -------- - - desc:Pitch Follower - - import cookdsp.jsfx-inc - - slider1:0.2<0,1>Tolerance - slider2:40<20, 500>Minimum Estimated Frequency - slider3:1000<500, 5000>Maximum Estimated Frequency - slider4:1000<20, 5000>Pre-Analysis Lowpass Cutoff - slider5:1<0,4,1{512,1024,2048,4096,8192}>Window Size - - @init - // Compute the size as a power of two - size = pow(2, slider5+9); - // Initializes the pitch follower - pit.yin(slider1, slider2, slider3, slider4, size); - // Initializes a simple sawtooth wave - saw.phasor(0, 0); - - @slider - pit.yin_set_tolerance(slider1); - pit.yin_set_minfreq(slider2); - pit.yin_set_maxfreq(slider3); - pit.yin_set_cutoff(slider4); - size = pow(2, slider5+9); - pit.yin_set_size(size); - - @sample - // Analyse mixed channels - freq = pit.yin_do((spl0+spl1)*0.707); - // Adjust the sawtooth frequency - saw.phasor_set_freq(freq); - // Add the sawtooth to the original signal - play_state == 1 ? ( - sig = saw.phasor_do() * 0.5; - ) : ( - sig = 0.0; - ); - spl0 += sig; spl1 += sig; - -********************************************************/ -function _min_elem_pos(buf size) -( - k_ = 0; - pos_ = 0; - loop(size, - buf[k_] < buk[pos_] ? pos_ = k_; - k_ += 1; - ); - pos_; -); - -function _quadraticInterpolation(buf, period, size) -( - period < 1 ? x0_ = period : x0_ = period - 1; - period + 1 < size ? x2_ = period + 1 : x2_ = period; - x0_ == period ? ( - buf[period] <= buf[x2_] ? pitch_ = period : pitch_ = x2_; - ) : x2_ == period ? ( - buf[period] <= buf[x0_] ? pitch_ = period : pitch_ = x0_; - ) : ( - s0_ = buf[x0_]; - s1_ = buf[period]; - s2_ = buf[x2_]; - pitch_ = period + 0.5 * (s2_ - s0_) / (s2_ - 2.0 * s1_ + s0_); - ); - pitch_; -); - -function _yin_init_memories(size) -( - size != this.size ? ( - this.size = size; - this.hsize = this.size / 2; - this.count = 0; - this.inbuf = memalloc(this.size); - this.yinbuf = memalloc(this.hsize); - ); -); - -function yin(tolerance minfreq maxfreq cutoff size) -( - this.ny = srate / 2; - tolerance < 0 ? tolerance = 0 : tolerance > 1 ? tolerance = 1; - this.tolerance = tolerance; - minfreq < 1 ? minfreq = 1 : minfreq > this.ny ? minfreq = this.ny; - this.minfreq = minfreq; - maxfreq < 1 ? maxfreq = 1 : maxfreq > this.ny ? maxfreq = this.ny; - this.maxfreq = maxfreq; - cutoff < 1 ? cutoff = 1 : cutoff > this.ny ? cutoff = this.ny; - this.cutoff = cutoff; - this.c2 = exp(-2 * $pi * this.cutoff / srate); - this.y1 = 0.0; - this.pitch = this.minfreq; - this.size = -1; - this._yin_init_memories(size); -); - -function yin_set_tolerance(tolerance) -( - tolerance < 0 ? tolerance = 0 : tolerance > 1 ? tolerance = 1; - this.tolerance = tolerance; -); - -function yin_set_minfreq(minfreq) -( - minfreq < 1 ? minfreq = 1 : minfreq > this.ny ? minfreq = this.ny; - this.minfreq = minfreq; -); - -function yin_set_maxfreq(maxfreq) -( - maxfreq < 1 ? maxfreq = 1 : maxfreq > this.ny ? maxfreq = this.ny; - this.maxfreq = maxfreq; -); - -function yin_set_cutoff(cutoff) -( - cutoff < 1 ? cutoff = 1 : cutoff > this.ny ? cutoff = this.ny; - this.cutoff = cutoff; - this.c2 = exp(-2 * $pi * this.cutoff / srate); - this.y1 = 0.0; -); - -function yin_set_size(size) -( - this._yin_init_memories(size); -); - -function yin_do(signal) -( - this.y1 = signal + (this.y1 - signal) * this.c2; - this.inbuf[this.count] = this.y1; - this.count += 1; - this.count == this.size ? ( - this.count = 0; - this.yinbuf[0] = 1.0; - tmp2_ = 0.0; - candidate_ = -1; - tau_ = 1; - while (tau_ < this.hsize) ( - this.yinbuf[tau_] = 0.0; - j_ = 0; - loop(this.hsize, - tmp_ = this.inbuf[j_] - this.inbuf[j_ + tau_]; - this.yinbuf[tau_] += tmp_ * tmp_; - j_ += 1; - ); - tmp2_ += this.yinbuf[tau_]; - this.yinbuf[tau_] *= tau_ / tmp2_; - period_ = tau_ - 3; - tau_ > 4 && this.yinbuf[period_] < this.tolerance && this.yinbuf[period_] < this.yinbuf[period_ + 1] ? ( - candidate_ = _quadraticInterpolation(this.yinbuf, period_, this.hsize); - tau_ = this.hsize; - ); - tau_ += 1; - ); - candidate_ == -1 ? ( - candidate_ = _quadraticInterpolation(this.yinbuf, _min_elem_pos(this.yinbuf, this.hsize), this.hsize); - ); - candidate_ = srate / candidate_; - candidate_ >= this.minfreq && candidate_ <= this.maxfreq ? this.pitch = candidate_; - ); - this.pitch; -); - - -/******************************************************* -ONSET -===== - -Audio signal onset detection. - -Description ------------ - -The `onset` object analyses an audio signal in input and output -a trigger each time an onset is detected. An onset is a sharp -amplitude rising while the signal had previously fall below a -minimum threshold. Parameters must be carefully tuned depending -on the nature of the analysed signal and the level of the background -noise. - -It must be used with a variable name as prefix (object oriented). - -Initializer ------------ - -#### onset(deltime, cutoff, upthresh, downthresh, reltime) #### - -Initializes a onset detector. The `deltime` argument is the delay, -in seconds, bewteen two adjacent amplitude analysis. The current -amplitude value must be greater than the previous one added to a -given threshold (the argument `upthresh`) to trigger an onset detection. -Before a new onset can be detected, the signal must first fall below -the `downthresh` value (given in dB). No new onset can be triggered -before `reltime` seconds after a detection. The `cutoff` argument -is the cutoff frequency of the internal lowpass filter used to follow -the amplitude envelope of the input signal. - -Here is a good set of parameters to start with: - - deltime=0.005, cutoff=10, upthresh=3, downthresh=-30, reltime=0.1 - -Methods -------- - -#### onset_set_deltime(deltime) #### - -Sets a new deltime value `deltime`, between 0.001 and 0.05 seconds. - -#### onset_set_cutoff(cutoff) #### - -Sets a new cutoff frequency `cutoff`, in Hz. The allowed range is 1 -to 1000 Hz. - -#### onset_set_upthresh(upthresh) #### - -Sets a new upper threshold `upthresh`, in dB. The allowed range is 0 -to 18 dB. - -#### onset_set_downthresh(downthresh) #### - -Sets a new minimum threshold `downthresh`, in dB. The allowed range is -90 -to 0 dB. - -#### onset_set_reltime(reltime) #### - -Sets a new release time `reltime`, between 0.001 and 0.5 seconds. - -#### onset_do(signal) #### - -Processes one samples of an input signal `signal` and outputs 1 when -an onset is detected. Otherwise, this method returns 0. - -Example -------- - - desc:Attack Detection - - import cookdsp.jsfx-inc - - slider1:5<1,50>Delay Time (ms) - slider2:10<1,500>Follower Filter Frequency (Hz) - slider3:3<0,18>Upper Threshold (dB) - slider4:-30<-90,0>Minimum Threshold (db) - slider5:100<1,500>Release Time (ms) - - @init - // Initializes the attack detector - deltime = slider1 * 0.001; - reltime = slider5 * 0.001; - od.onset(deltime, slider2, slider3, slider4, reltime); - - @slider - od.onset_set_deltime(slider1 * 0.001); - od.onset_set_cutoff(slider2); - od.onset_set_upthresh(slider3); - od.onset_set_downthresh(slider4); - od.onset_set_reltime(slider5 * 0.001); - - @sample - // Analyses mixed channels - trig = od.onset_do((spl0+spl1)*0.707); - // If "trig" is 1, a onset has been detected - // Here, we set the amplitude of a noise to 1 - // Otherwise, amp fall down gradually... - trig == 1 ? amp = 1 : amp *= 0.999; - noise = (rand(1) - 0.5) * amp; - // Add the noise to the input signal - spl0 += noise; spl1 += noise; - -********************************************************/ - -function onset(deltime cutoff upthresh downthresh reltime) -( - deltime < 0.001 ? deltime = 0.001 : deltime > 0.05 ? deltime = 0.05; - this.deltime = deltime; - cutoff < 1 ? cutoff = 1 : cutoff > 1000 ? cutoff = 1000; - this.cutoff = cutoff; - upthresh < 0 ? upthresh = 0 : upthresh > 18 ? upthresh = 18; - this.upthresh = upthresh; - downthresh < -90 ? downthresh = -90 : downthresh > 0 ? downthresh = 0; - this.downthresh = downthresh; - reltime < 0.001 ? reltime = 0.001 : reltime > 0.5 ? reltime = 0.5; - this.reltime = reltime; - this.maxrel = floor(srate * this.reltime + 0.5); - this.timer = this.overminok = this.belowminok = 0; - this.fol.follow(this.cutoff); - this.fdel.delay(srate * 0.055); -); - -function onset_set_deltime(deltime) -( - deltime < 0.001 ? deltime = 0.001 : deltime > 0.05 ? deltime = 0.05; - this.deltime = deltime; -); - -function onset_set_cutoff(cutoff) -( - cutoff < 1 ? cutoff = 1 : cutoff > 1000 ? cutoff = 1000; - this.cutoff = cutoff; - this.fol.follow_set_freq(this.cutoff); -); - -function onset_set_upthresh(upthresh) -( - upthresh < 0 ? upthresh = 0 : upthresh > 18 ? upthresh = 18; - this.upthresh = upthresh; -); - -function onset_set_downthresh(downthresh) -( - downthresh < -90 ? downthresh = -90 : downthresh > 0 ? downthresh = 0; - this.downthresh = downthresh; -); - -function onset_set_reltime(reltime) -( - reltime < 0.001 ? reltime = 0.001 : reltime > 0.5 ? reltime = 0.5; - this.reltime = reltime; - this.maxrel = floor(srate * this.reltime + 0.5); -); - -function onset_do(signal) -( - out_ = 0; - fol_ = this.fol.follow_do(signal); - fol_ <= 0.000001 ? fdb_ = -120 : fdb_ = atodb(fol_); - prev_ = this.fdel.delay_sread2(this.deltime); - this.fdel.delay_write(fdb_); - this.timer >= this.maxrel && this.overminok == 1 ? ( - fdb_ > (prev_ + this.upthresh) ? ( - out_ = 1; - this.timer = this.overminok = this.belowminok = 0; - ); - ); - this.belowminok == 0 && fdb_ < this.downthresh ? this.belowminok = 1; - this.belowminok == 1 && fdb_ > this.downthresh ? this.overminok = 1; - this.timer += 1; - out_; -); diff --git a/FX/BryanChi_FX Devices/cookdsp/buffer.jsfx-inc b/FX/BryanChi_FX Devices/cookdsp/buffer.jsfx-inc deleted file mode 100644 index af9a22207..000000000 --- a/FX/BryanChi_FX Devices/cookdsp/buffer.jsfx-inc +++ /dev/null @@ -1,1506 +0,0 @@ -///////////////////////////////////////////////////////////////// -// Copyright (c) - 2014 - Olivier Belanger // -// Permission to use, copy, modify, and/or distribute this // -// software for any purpose with or without fee is hereby // -// granted, provided that the above copyright notice and this // -// permission notice appear in all copies. CookDSP IS PROVIDED // -// "AS IS", WITHOUT WARRANTY OF ANY KIND FROM THE AUTHOR. // -///////////////////////////////////////////////////////////////// - -@init - -/******************************************************** -BUFFER -====== - -Create a bloc of memory to store and manipulate audio samples. - -Description ------------ - -A buffer object reserves a region of the local memory buffer -where samples can be stored and manipulated. Several algorithms -can be used to generate waveforms and window functions. - -It must be used with a variable name as prefix (object oriented). - -Initializer ------------ - -#### buffer(size) #### - -Initializes a buffer of length `size`, in samples. This function -returns the location of the buffer in the global memory, allowing -a fast and unchecked access. - -Methods -------- - -#### buffer_init(h1, [h2, h3, ..., h40]) #### - -Initializes the first positions (up to 40) in the buffer to the values -given as arguments to the function. - -#### buffer_write(pos, signal) #### - -Writes a sample value `signal` at the position `pos` (in samples) -in the buffer. This function does boundary checking. The values in -the first two locations are copied just after the last location of -the buffer and the value in the last location is copied at the location -just before the buffer first index. This is done to create extra samples -needed by linear and cubic interpolation. - -#### buffer_read(pos) #### - -Returns the value located at the position given in argument `pos` (in -samples). This function uses no interpolation, ie. the position is -truncated to the biggest integer not greater than the asked real position. - -This function checks for position's validity. - -#### buffer_fread(pos) #### - -Returns the value located at the position given in argument `pos` (in -samples). This function uses no interpolation, ie. the position is -truncated to the biggest integer not greater than the asked real position. - -This function is faster than `buffer_read` because there is no check for -position's validity. Use it only if `pos` is known to be valid. - -#### buffer_read2(pos) #### - -Returns the value located at the position given in argument `pos` (in -samples). This function uses a linear interpolation to read the "true" -value for a floating-point sample position. - -This function checks for position's validity. - -#### buffer_fread2(pos) #### - -Returns the value located at the position given in argument `pos` (in -samples). This function uses a linear interpolation to read the "true" -value for a floating-point sample position. - -This function is faster than `buffer_read2` because there is no check for -position's validity. Use it only if `pos` is known to be valid. - -#### buffer_read3(pos) #### - -Returns the value located at the position given in argument `pos` (in -samples). This function uses a cubic interpolation to read the "true" -value for a floating-point sample position. - -This function checks for position's validity. - -#### buffer_fread3(pos) #### - -Returns the value located at the position given in argument `pos` (in -samples). This function uses a cubic interpolation to read the "true" -value for a floating-point sample position. - -This function is faster than `buffer_read3` because there is no check for -position's validity. Use it only if `pos` is known to be valid. - -#### buffer_nread(pos) #### - -Returns the value located at the position given in argument `pos` (`pos` -is a normalized position between 0 and 1). This function uses no -interpolation, ie. the position is truncated to the biggest integer -not greater than the asked real position. - -This function checks for position's validity. - -#### buffer_fnread(pos) #### - -Returns the value located at the position given in argument `pos` (`pos` -is a normalized position between 0 and 1). This function uses no -interpolation, ie. the position is truncated to the biggest integer -not greater than the asked real position. - -This function is faster than `buffer_nread` because there is no check for -position's validity. Use it only if `pos` is known to be valid. - -#### buffer_nread2(pos) #### - -Returns the value located at the position given in argument `pos` (`pos` -is a normalized position between 0 and 1). This function uses a linear -interpolation to read the "true" value for a floating-point sample position. - -This function checks for position's validity. - -#### buffer_fnread2(pos) #### - -Returns the value located at the position given in argument `pos` (`pos` -is a normalized position between 0 and 1). This function uses a linear -interpolation to read the "true" value for a floating-point sample position. - -This function is faster than `buffer_nread2` because there is no check for -position's validity. Use it only if `pos` is known to be valid. - -#### buffer_nread3(pos) #### - -Returns the value located at the position given in argument `pos` (`pos` -is a normalized position between 0 and 1). This function uses a cubic -interpolation to read the "true" value for a floating-point sample position. - -This function checks for position's validity. - -#### buffer_fnread3(pos) #### - -Returns the value located at the position given in argument `pos` (`pos` -is a normalized position between 0 and 1). This function uses a cubic -interpolation to read the "true" value for a floating-point sample position. - -This function is faster than `buffer_nread3` because there is no check for -position's validity. Use it only if `pos` is known to be valid. - -#### buffer_lookup(pos) #### - -This function performs a table lookup of the buffer with `pos` as the -input signal. The input signal must be in the range [-1, 1]. This -function uses no interpolation, ie. the position is truncated to the -biggest integer not greater than the asked real position. - -#### buffer_lookup2(pos) #### - -This function performs a table lookup of the buffer with `pos` as the -input signal. The input signal must be in the range [-1, 1]. This -function uses a linear interpolation to read the "true" value for a -floating-point sample position. - -#### buffer_lookup3(pos) #### - -This function performs a table lookup of the buffer with `pos` as the -input signal. The input signal must be in the range [-1, 1]. This -function uses a cubic interpolation to read the "true" value for a -floating-point sample position. - -#### buffer_gen10(h1, [h2, h3, ..., h40]) #### - -Generates composite waveforms made up of weighted sums of simple -sinusoids. Up to 40 harmonic relative amplitudes (`h1` to `h40`) -can be specified. - -#### buffer_saw(order) #### - -Generates a sawtooth waveform made up of `order` number of harmonics. - -#### buffer_square(order) #### - -Generates a square waveform made up of `order` number of harmonics. -Only odd harmonics are present in the waveform. - -#### buffer_triangle(order) #### - -Generates a triangle waveform made up of `order` number of harmonics. -Only odd harmonics are present in the waveform. - -#### buffer_window(which) #### - -Chooses and generates a window function. `which` parameter can be: - -- 0: Hamming -- 1: Hanning -- 2: Bartlett -- 3: Blackman -- 4: Blackman-Harris 4 terms -- 5: Blackman-Harris 7 terms -- 6: Tuckey (50%) -- 7: Half sine -- 8: parabolic - -#### buffer_atan(slope) #### - -Generates an arctangent transfert function with varying slope. When `slope` -is 0, the transfert function is a straight line, while at 1, the transfert -function is a perfect square. This function is useful, in conjunction with -the buffer_lookup functions, to design distortion models. - -#### buffer_normalize(amp) #### - -Normalizes buffer samples between `-amp` and `amp`. - -#### buffer_reset() #### - -Resets buffer samples to 0. - -#### buffer_reverse() #### - -Reverses the buffer samples in time. - -#### buffer_clip(mini, maxi) #### - -Clips the content of the buffer between `mini` and `maxi` values. - -#### buffer_mul(x) #### - -Multiply each value in the buffer by `x` factor and replace the -value with the result. - -#### buffer_div(x) #### - -Divide each value in the buffer by `x` factor and replace the -value with the result. - -#### buffer_rdiv(x) #### - -Divide `x` by each value in the buffer and replace the value -with the result. - -#### buffer_add(x) #### - -Add `x` factor to each value in the buffer and replace the value -with the result. - -#### buffer_sub(x) #### - -Substract `x` factor to each value in the buffer and replace the -value with the result. - -#### buffer_rsub(x) #### - -Substract each value in the buffer to `x` and replace the value -with the result. - -Example -------- - - desc:Various Waveforms Amplitude Modulator - - slider1:8<0.1,20>Modulation Frequency (Hz) - slider2:0<0,4,1{Sine,Saw Down,Saw Up,Square,Triangle}>Waveform type - - import cookdsp.jsfx-inc - - @init - // uses buffer methods to generate various waveforms with normalization - function generate_waveform(buf curwave) - ( - curwave == 0 ? buf.buffer_gen10(1) : - curwave == 1 ? buf.buffer_saw(64) : - curwave == 2 ? (buf.buffer_saw(64); buf.buffer_reverse();) : - curwave == 3 ? buf.buffer_square(64) : - curwave == 4 ? buf.buffer_triangle(64); - buf.buffer_normalize(1); - ); - // buffer size and initialization - size = 1024; - buf.buffer(size); - // generate intial waveform - curwave = -1; - curwave != slider2 ? ( - curwave = slider2; - generate_waveform(buf, curwave); - ); - // initial phase of the reading pointer - phase = 0; - - @slider - // increment of the pointer - inc = slider1 / srate; - // generate selected waveform - curwave != slider2 ? ( - curwave = slider2; - generate_waveform(buf, curwave); - ); - - @sample - // read waveform with cubic interpolation and make it unipolar - val = buf.buffer_read3(phase * size) * 0.5 + 0.5; - // increment and wrap reading pointer - phase += inc; phase >= 1 ? phase -= 1; - // modulate input signal - spl0 *= val; spl1 *= val; - -********************************************************/ -function buffer(size) -( - this.buf = memalloc(size); - this.size = size; - this.hsize = this.size * 0.5; - this.curval = 0.0; - this.buf; -); - -function buffer_init(h1) -( - this.buf[0] = h1; -); -function buffer_init(h1 h2) -( - this.buf[0] = h1; this.buf[1] = h2; -); -function buffer_init(h1 h2 h3) -( - this.buf[0] = h1; this.buf[1] = h2; this.buf[2] = h3; -); -function buffer_init(h1 h2 h3 h4) -( - this.buf[0] = h1; this.buf[1] = h2; this.buf[2] = h3; this.buf[3] = h4; -); -function buffer_init(h1 h2 h3 h4 h5) -( - this.buf[0] = h1; this.buf[1] = h2; this.buf[2] = h3; this.buf[3] = h4; - this.buf[4] = h5; -); -function buffer_init(h1 h2 h3 h4 h5 h6) -( - this.buf[0] = h1; this.buf[1] = h2; this.buf[2] = h3; this.buf[3] = h4; - this.buf[4] = h5; this.buf[5] = h6; -); -function buffer_init(h1 h2 h3 h4 h5 h6 h7) -( - this.buf[0] = h1; this.buf[1] = h2; this.buf[2] = h3; this.buf[3] = h4; - this.buf[4] = h5; this.buf[5] = h6; this.buf[6] = h7; -); -function buffer_init(h1 h2 h3 h4 h5 h6 h7 h8) -( - this.buf[0] = h1; this.buf[1] = h2; this.buf[2] = h3; this.buf[3] = h4; - this.buf[4] = h5; this.buf[5] = h6; this.buf[6] = h7; this.buf[7] = h8; -); -function buffer_init(h1 h2 h3 h4 h5 h6 h7 h8 h9) -( - this.buf[0] = h1; this.buf[1] = h2; this.buf[2] = h3; this.buf[3] = h4; - this.buf[4] = h5; this.buf[5] = h6; this.buf[6] = h7; this.buf[7] = h8; - this.buf[8] = h9; -); -function buffer_init(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10) -( - this.buf[0] = h1; this.buf[1] = h2; this.buf[2] = h3; this.buf[3] = h4; - this.buf[4] = h5; this.buf[5] = h6; this.buf[6] = h7; this.buf[7] = h8; - this.buf[8] = h9; this.buf[9] = h10; -); -function buffer_init(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11) -( - this.buf[0] = h1; this.buf[1] = h2; this.buf[2] = h3; this.buf[3] = h4; - this.buf[4] = h5; this.buf[5] = h6; this.buf[6] = h7; this.buf[7] = h8; - this.buf[8] = h9; this.buf[9] = h10; this.buf[10] = h11; -); -function buffer_init(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12) -( - this.buf[0] = h1; this.buf[1] = h2; this.buf[2] = h3; this.buf[3] = h4; - this.buf[4] = h5; this.buf[5] = h6; this.buf[6] = h7; this.buf[7] = h8; - this.buf[8] = h9; this.buf[9] = h10; this.buf[10] = h11; this.buf[11] = h12; -); -function buffer_init(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13) -( - this.buf[0] = h1; this.buf[1] = h2; this.buf[2] = h3; this.buf[3] = h4; - this.buf[4] = h5; this.buf[5] = h6; this.buf[6] = h7; this.buf[7] = h8; - this.buf[8] = h9; this.buf[9] = h10; this.buf[10] = h11; this.buf[11] = h12; - this.buf[12] = h13; -); -function buffer_init(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14) -( - this.buf[0] = h1; this.buf[1] = h2; this.buf[2] = h3; this.buf[3] = h4; - this.buf[4] = h5; this.buf[5] = h6; this.buf[6] = h7; this.buf[7] = h8; - this.buf[8] = h9; this.buf[9] = h10; this.buf[10] = h11; this.buf[11] = h12; - this.buf[12] = h13; this.buf[13] = h14; -); -function buffer_init(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15) -( - this.buf[0] = h1; this.buf[1] = h2; this.buf[2] = h3; this.buf[3] = h4; - this.buf[4] = h5; this.buf[5] = h6; this.buf[6] = h7; this.buf[7] = h8; - this.buf[8] = h9; this.buf[9] = h10; this.buf[10] = h11; this.buf[11] = h12; - this.buf[12] = h13; this.buf[13] = h14; this.buf[14] = h15; -); -function buffer_init(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16) -( - this.buf[0] = h1; this.buf[1] = h2; this.buf[2] = h3; this.buf[3] = h4; - this.buf[4] = h5; this.buf[5] = h6; this.buf[6] = h7; this.buf[7] = h8; - this.buf[8] = h9; this.buf[9] = h10; this.buf[10] = h11; this.buf[11] = h12; - this.buf[12] = h13; this.buf[13] = h14; this.buf[14] = h15; this.buf[15] = h16; -); -function buffer_init(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17) -( - this.buf[0] = h1; this.buf[1] = h2; this.buf[2] = h3; this.buf[3] = h4; - this.buf[4] = h5; this.buf[5] = h6; this.buf[6] = h7; this.buf[7] = h8; - this.buf[8] = h9; this.buf[9] = h10; this.buf[10] = h11; this.buf[11] = h12; - this.buf[12] = h13; this.buf[13] = h14; this.buf[14] = h15; this.buf[15] = h16; - this.buf[16] = h17; -); -function buffer_init(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18) -( - this.buf[0] = h1; this.buf[1] = h2; this.buf[2] = h3; this.buf[3] = h4; - this.buf[4] = h5; this.buf[5] = h6; this.buf[6] = h7; this.buf[7] = h8; - this.buf[8] = h9; this.buf[9] = h10; this.buf[10] = h11; this.buf[11] = h12; - this.buf[12] = h13; this.buf[13] = h14; this.buf[14] = h15; this.buf[15] = h16; - this.buf[16] = h17; this.buf[17] = h18; -); -function buffer_init(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19) -( - this.buf[0] = h1; this.buf[1] = h2; this.buf[2] = h3; this.buf[3] = h4; - this.buf[4] = h5; this.buf[5] = h6; this.buf[6] = h7; this.buf[7] = h8; - this.buf[8] = h9; this.buf[9] = h10; this.buf[10] = h11; this.buf[11] = h12; - this.buf[12] = h13; this.buf[13] = h14; this.buf[14] = h15; this.buf[15] = h16; - this.buf[16] = h17; this.buf[17] = h18; this.buf[18] = h19; -); -function buffer_init(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20) -( - this.buf[0] = h1; this.buf[1] = h2; this.buf[2] = h3; this.buf[3] = h4; - this.buf[4] = h5; this.buf[5] = h6; this.buf[6] = h7; this.buf[7] = h8; - this.buf[8] = h9; this.buf[9] = h10; this.buf[10] = h11; this.buf[11] = h12; - this.buf[12] = h13; this.buf[13] = h14; this.buf[14] = h15; this.buf[15] = h16; - this.buf[16] = h17; this.buf[17] = h18; this.buf[18] = h19; this.buf[19] = h20; -); -function buffer_init(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21) -( - this.buf[0] = h1; this.buf[1] = h2; this.buf[2] = h3; this.buf[3] = h4; - this.buf[4] = h5; this.buf[5] = h6; this.buf[6] = h7; this.buf[7] = h8; - this.buf[8] = h9; this.buf[9] = h10; this.buf[10] = h11; this.buf[11] = h12; - this.buf[12] = h13; this.buf[13] = h14; this.buf[14] = h15; this.buf[15] = h16; - this.buf[16] = h17; this.buf[17] = h18; this.buf[18] = h19; this.buf[19] = h20; - this.buf[20] = h21; -); -function buffer_init(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22) -( - this.buf[0] = h1; this.buf[1] = h2; this.buf[2] = h3; this.buf[3] = h4; - this.buf[4] = h5; this.buf[5] = h6; this.buf[6] = h7; this.buf[7] = h8; - this.buf[8] = h9; this.buf[9] = h10; this.buf[10] = h11; this.buf[11] = h12; - this.buf[12] = h13; this.buf[13] = h14; this.buf[14] = h15; this.buf[15] = h16; - this.buf[16] = h17; this.buf[17] = h18; this.buf[18] = h19; this.buf[19] = h20; - this.buf[20] = h21; this.buf[21] = h22; -); -function buffer_init(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23) -( - this.buf[0] = h1; this.buf[1] = h2; this.buf[2] = h3; this.buf[3] = h4; - this.buf[4] = h5; this.buf[5] = h6; this.buf[6] = h7; this.buf[7] = h8; - this.buf[8] = h9; this.buf[9] = h10; this.buf[10] = h11; this.buf[11] = h12; - this.buf[12] = h13; this.buf[13] = h14; this.buf[14] = h15; this.buf[15] = h16; - this.buf[16] = h17; this.buf[17] = h18; this.buf[18] = h19; this.buf[19] = h20; - this.buf[20] = h21; this.buf[21] = h22; this.buf[22] = h23; -); -function buffer_init(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24) -( - this.buf[0] = h1; this.buf[1] = h2; this.buf[2] = h3; this.buf[3] = h4; - this.buf[4] = h5; this.buf[5] = h6; this.buf[6] = h7; this.buf[7] = h8; - this.buf[8] = h9; this.buf[9] = h10; this.buf[10] = h11; this.buf[11] = h12; - this.buf[12] = h13; this.buf[13] = h14; this.buf[14] = h15; this.buf[15] = h16; - this.buf[16] = h17; this.buf[17] = h18; this.buf[18] = h19; this.buf[19] = h20; - this.buf[20] = h21; this.buf[21] = h22; this.buf[22] = h23; this.buf[23] = h24; -); -function buffer_init(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25) -( - this.buf[0] = h1; this.buf[1] = h2; this.buf[2] = h3; this.buf[3] = h4; - this.buf[4] = h5; this.buf[5] = h6; this.buf[6] = h7; this.buf[7] = h8; - this.buf[8] = h9; this.buf[9] = h10; this.buf[10] = h11; this.buf[11] = h12; - this.buf[12] = h13; this.buf[13] = h14; this.buf[14] = h15; this.buf[15] = h16; - this.buf[16] = h17; this.buf[17] = h18; this.buf[18] = h19; this.buf[19] = h20; - this.buf[20] = h21; this.buf[21] = h22; this.buf[22] = h23; this.buf[23] = h24; - this.buf[24] = h25; -); -function buffer_init(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26) -( - this.buf[0] = h1; this.buf[1] = h2; this.buf[2] = h3; this.buf[3] = h4; - this.buf[4] = h5; this.buf[5] = h6; this.buf[6] = h7; this.buf[7] = h8; - this.buf[8] = h9; this.buf[9] = h10; this.buf[10] = h11; this.buf[11] = h12; - this.buf[12] = h13; this.buf[13] = h14; this.buf[14] = h15; this.buf[15] = h16; - this.buf[16] = h17; this.buf[17] = h18; this.buf[18] = h19; this.buf[19] = h20; - this.buf[20] = h21; this.buf[21] = h22; this.buf[22] = h23; this.buf[23] = h24; - this.buf[24] = h25; this.buf[25] = h26; -); -function buffer_init(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27) -( - this.buf[0] = h1; this.buf[1] = h2; this.buf[2] = h3; this.buf[3] = h4; - this.buf[4] = h5; this.buf[5] = h6; this.buf[6] = h7; this.buf[7] = h8; - this.buf[8] = h9; this.buf[9] = h10; this.buf[10] = h11; this.buf[11] = h12; - this.buf[12] = h13; this.buf[13] = h14; this.buf[14] = h15; this.buf[15] = h16; - this.buf[16] = h17; this.buf[17] = h18; this.buf[18] = h19; this.buf[19] = h20; - this.buf[20] = h21; this.buf[21] = h22; this.buf[22] = h23; this.buf[23] = h24; - this.buf[24] = h25; this.buf[25] = h26; this.buf[26] = h27; -); -function buffer_init(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28) -( - this.buf[0] = h1; this.buf[1] = h2; this.buf[2] = h3; this.buf[3] = h4; - this.buf[4] = h5; this.buf[5] = h6; this.buf[6] = h7; this.buf[7] = h8; - this.buf[8] = h9; this.buf[9] = h10; this.buf[10] = h11; this.buf[11] = h12; - this.buf[12] = h13; this.buf[13] = h14; this.buf[14] = h15; this.buf[15] = h16; - this.buf[16] = h17; this.buf[17] = h18; this.buf[18] = h19; this.buf[19] = h20; - this.buf[20] = h21; this.buf[21] = h22; this.buf[22] = h23; this.buf[23] = h24; - this.buf[24] = h25; this.buf[25] = h26; this.buf[26] = h27; this.buf[27] = h28; -); -function buffer_init(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29) -( - this.buf[0] = h1; this.buf[1] = h2; this.buf[2] = h3; this.buf[3] = h4; - this.buf[4] = h5; this.buf[5] = h6; this.buf[6] = h7; this.buf[7] = h8; - this.buf[8] = h9; this.buf[9] = h10; this.buf[10] = h11; this.buf[11] = h12; - this.buf[12] = h13; this.buf[13] = h14; this.buf[14] = h15; this.buf[15] = h16; - this.buf[16] = h17; this.buf[17] = h18; this.buf[18] = h19; this.buf[19] = h20; - this.buf[20] = h21; this.buf[21] = h22; this.buf[22] = h23; this.buf[23] = h24; - this.buf[24] = h25; this.buf[25] = h26; this.buf[26] = h27; this.buf[27] = h28; - this.buf[28] = h29; -); -function buffer_init(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30) -( - this.buf[0] = h1; this.buf[1] = h2; this.buf[2] = h3; this.buf[3] = h4; - this.buf[4] = h5; this.buf[5] = h6; this.buf[6] = h7; this.buf[7] = h8; - this.buf[8] = h9; this.buf[9] = h10; this.buf[10] = h11; this.buf[11] = h12; - this.buf[12] = h13; this.buf[13] = h14; this.buf[14] = h15; this.buf[15] = h16; - this.buf[16] = h17; this.buf[17] = h18; this.buf[18] = h19; this.buf[19] = h20; - this.buf[20] = h21; this.buf[21] = h22; this.buf[22] = h23; this.buf[23] = h24; - this.buf[24] = h25; this.buf[25] = h26; this.buf[26] = h27; this.buf[27] = h28; - this.buf[28] = h29; this.buf[29] = h30; -); -function buffer_init(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30 h31) -( - this.buf[0] = h1; this.buf[1] = h2; this.buf[2] = h3; this.buf[3] = h4; - this.buf[4] = h5; this.buf[5] = h6; this.buf[6] = h7; this.buf[7] = h8; - this.buf[8] = h9; this.buf[9] = h10; this.buf[10] = h11; this.buf[11] = h12; - this.buf[12] = h13; this.buf[13] = h14; this.buf[14] = h15; this.buf[15] = h16; - this.buf[16] = h17; this.buf[17] = h18; this.buf[18] = h19; this.buf[19] = h20; - this.buf[20] = h21; this.buf[21] = h22; this.buf[22] = h23; this.buf[23] = h24; - this.buf[24] = h25; this.buf[25] = h26; this.buf[26] = h27; this.buf[27] = h28; - this.buf[28] = h29; this.buf[29] = h30; this.buf[30] = h31; -); -function buffer_init(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30 h31 h32) -( - this.buf[0] = h1; this.buf[1] = h2; this.buf[2] = h3; this.buf[3] = h4; - this.buf[4] = h5; this.buf[5] = h6; this.buf[6] = h7; this.buf[7] = h8; - this.buf[8] = h9; this.buf[9] = h10; this.buf[10] = h11; this.buf[11] = h12; - this.buf[12] = h13; this.buf[13] = h14; this.buf[14] = h15; this.buf[15] = h16; - this.buf[16] = h17; this.buf[17] = h18; this.buf[18] = h19; this.buf[19] = h20; - this.buf[20] = h21; this.buf[21] = h22; this.buf[22] = h23; this.buf[23] = h24; - this.buf[24] = h25; this.buf[25] = h26; this.buf[26] = h27; this.buf[27] = h28; - this.buf[28] = h29; this.buf[29] = h30; this.buf[30] = h31; this.buf[31] = h32; -); -function buffer_init(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30 h31 h32 h33) -( - this.buf[0] = h1; this.buf[1] = h2; this.buf[2] = h3; this.buf[3] = h4; - this.buf[4] = h5; this.buf[5] = h6; this.buf[6] = h7; this.buf[7] = h8; - this.buf[8] = h9; this.buf[9] = h10; this.buf[10] = h11; this.buf[11] = h12; - this.buf[12] = h13; this.buf[13] = h14; this.buf[14] = h15; this.buf[15] = h16; - this.buf[16] = h17; this.buf[17] = h18; this.buf[18] = h19; this.buf[19] = h20; - this.buf[20] = h21; this.buf[21] = h22; this.buf[22] = h23; this.buf[23] = h24; - this.buf[24] = h25; this.buf[25] = h26; this.buf[26] = h27; this.buf[27] = h28; - this.buf[28] = h29; this.buf[29] = h30; this.buf[30] = h31; this.buf[31] = h32; - this.buf[32] = h33; -); -function buffer_init(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30 h31 h32 h33 h34) -( - this.buf[0] = h1; this.buf[1] = h2; this.buf[2] = h3; this.buf[3] = h4; - this.buf[4] = h5; this.buf[5] = h6; this.buf[6] = h7; this.buf[7] = h8; - this.buf[8] = h9; this.buf[9] = h10; this.buf[10] = h11; this.buf[11] = h12; - this.buf[12] = h13; this.buf[13] = h14; this.buf[14] = h15; this.buf[15] = h16; - this.buf[16] = h17; this.buf[17] = h18; this.buf[18] = h19; this.buf[19] = h20; - this.buf[20] = h21; this.buf[21] = h22; this.buf[22] = h23; this.buf[23] = h24; - this.buf[24] = h25; this.buf[25] = h26; this.buf[26] = h27; this.buf[27] = h28; - this.buf[28] = h29; this.buf[29] = h30; this.buf[30] = h31; this.buf[31] = h32; - this.buf[32] = h33; this.buf[33] = h34; -); -function buffer_init(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30 h31 h32 h33 h34 h35) -( - this.buf[0] = h1; this.buf[1] = h2; this.buf[2] = h3; this.buf[3] = h4; - this.buf[4] = h5; this.buf[5] = h6; this.buf[6] = h7; this.buf[7] = h8; - this.buf[8] = h9; this.buf[9] = h10; this.buf[10] = h11; this.buf[11] = h12; - this.buf[12] = h13; this.buf[13] = h14; this.buf[14] = h15; this.buf[15] = h16; - this.buf[16] = h17; this.buf[17] = h18; this.buf[18] = h19; this.buf[19] = h20; - this.buf[20] = h21; this.buf[21] = h22; this.buf[22] = h23; this.buf[23] = h24; - this.buf[24] = h25; this.buf[25] = h26; this.buf[26] = h27; this.buf[27] = h28; - this.buf[28] = h29; this.buf[29] = h30; this.buf[30] = h31; this.buf[31] = h32; - this.buf[32] = h33; this.buf[33] = h34; this.buf[34] = h35; -); -function buffer_init(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30 h31 h32 h33 h34 h35 h36) -( - this.buf[0] = h1; this.buf[1] = h2; this.buf[2] = h3; this.buf[3] = h4; - this.buf[4] = h5; this.buf[5] = h6; this.buf[6] = h7; this.buf[7] = h8; - this.buf[8] = h9; this.buf[9] = h10; this.buf[10] = h11; this.buf[11] = h12; - this.buf[12] = h13; this.buf[13] = h14; this.buf[14] = h15; this.buf[15] = h16; - this.buf[16] = h17; this.buf[17] = h18; this.buf[18] = h19; this.buf[19] = h20; - this.buf[20] = h21; this.buf[21] = h22; this.buf[22] = h23; this.buf[23] = h24; - this.buf[24] = h25; this.buf[25] = h26; this.buf[26] = h27; this.buf[27] = h28; - this.buf[28] = h29; this.buf[29] = h30; this.buf[30] = h31; this.buf[31] = h32; - this.buf[32] = h33; this.buf[33] = h34; this.buf[34] = h35; this.buf[35] = h36; -); -function buffer_init(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30 h31 h32 h33 h34 h35 h36 h37) -( - this.buf[0] = h1; this.buf[1] = h2; this.buf[2] = h3; this.buf[3] = h4; - this.buf[4] = h5; this.buf[5] = h6; this.buf[6] = h7; this.buf[7] = h8; - this.buf[8] = h9; this.buf[9] = h10; this.buf[10] = h11; this.buf[11] = h12; - this.buf[12] = h13; this.buf[13] = h14; this.buf[14] = h15; this.buf[15] = h16; - this.buf[16] = h17; this.buf[17] = h18; this.buf[18] = h19; this.buf[19] = h20; - this.buf[20] = h21; this.buf[21] = h22; this.buf[22] = h23; this.buf[23] = h24; - this.buf[24] = h25; this.buf[25] = h26; this.buf[26] = h27; this.buf[27] = h28; - this.buf[28] = h29; this.buf[29] = h30; this.buf[30] = h31; this.buf[31] = h32; - this.buf[32] = h33; this.buf[33] = h34; this.buf[34] = h35; this.buf[35] = h36; - this.buf[36] = h37; -); -function buffer_init(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30 h31 h32 h33 h34 h35 h36 h37 h38) -( - this.buf[0] = h1; this.buf[1] = h2; this.buf[2] = h3; this.buf[3] = h4; - this.buf[4] = h5; this.buf[5] = h6; this.buf[6] = h7; this.buf[7] = h8; - this.buf[8] = h9; this.buf[9] = h10; this.buf[10] = h11; this.buf[11] = h12; - this.buf[12] = h13; this.buf[13] = h14; this.buf[14] = h15; this.buf[15] = h16; - this.buf[16] = h17; this.buf[17] = h18; this.buf[18] = h19; this.buf[19] = h20; - this.buf[20] = h21; this.buf[21] = h22; this.buf[22] = h23; this.buf[23] = h24; - this.buf[24] = h25; this.buf[25] = h26; this.buf[26] = h27; this.buf[27] = h28; - this.buf[28] = h29; this.buf[29] = h30; this.buf[30] = h31; this.buf[31] = h32; - this.buf[32] = h33; this.buf[33] = h34; this.buf[34] = h35; this.buf[35] = h36; - this.buf[36] = h37; this.buf[37] = h38; -); -function buffer_init(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30 h31 h32 h33 h34 h35 h36 h37 h38 h39) -( - this.buf[0] = h1; this.buf[1] = h2; this.buf[2] = h3; this.buf[3] = h4; - this.buf[4] = h5; this.buf[5] = h6; this.buf[6] = h7; this.buf[7] = h8; - this.buf[8] = h9; this.buf[9] = h10; this.buf[10] = h11; this.buf[11] = h12; - this.buf[12] = h13; this.buf[13] = h14; this.buf[14] = h15; this.buf[15] = h16; - this.buf[16] = h17; this.buf[17] = h18; this.buf[18] = h19; this.buf[19] = h20; - this.buf[20] = h21; this.buf[21] = h22; this.buf[22] = h23; this.buf[23] = h24; - this.buf[24] = h25; this.buf[25] = h26; this.buf[26] = h27; this.buf[27] = h28; - this.buf[28] = h29; this.buf[29] = h30; this.buf[30] = h31; this.buf[31] = h32; - this.buf[32] = h33; this.buf[33] = h34; this.buf[34] = h35; this.buf[35] = h36; - this.buf[36] = h37; this.buf[37] = h38; this.buf[38] = h39; -); -function buffer_init(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30 h31 h32 h33 h34 h35 h36 h37 h38 h39 h40) -( - this.buf[0] = h1; this.buf[1] = h2; this.buf[2] = h3; this.buf[3] = h4; - this.buf[4] = h5; this.buf[5] = h6; this.buf[6] = h7; this.buf[7] = h8; - this.buf[8] = h9; this.buf[9] = h10; this.buf[10] = h11; this.buf[11] = h12; - this.buf[12] = h13; this.buf[13] = h14; this.buf[14] = h15; this.buf[15] = h16; - this.buf[16] = h17; this.buf[17] = h18; this.buf[18] = h19; this.buf[19] = h20; - this.buf[20] = h21; this.buf[21] = h22; this.buf[22] = h23; this.buf[23] = h24; - this.buf[24] = h25; this.buf[25] = h26; this.buf[26] = h27; this.buf[27] = h28; - this.buf[28] = h29; this.buf[29] = h30; this.buf[30] = h31; this.buf[31] = h32; - this.buf[32] = h33; this.buf[33] = h34; this.buf[34] = h35; this.buf[35] = h36; - this.buf[36] = h37; this.buf[37] = h38; this.buf[38] = h39; this.buf[39] = h40; -); - -function buffer_write(pos, signal) -( - pos >= 0 && pos < this.size ? ( - this.buf[pos] = signal; - this.buf[this.size] = this.buf[0]; - this.buf[this.size+1] = this.buf[1]; - this.buf[-1] = this.buf[this.size-1]; - ); -); - -function buffer_read(pos) -( - pos >= 0 && pos < this.size ? ( - this.curval = this.buf[pos]; - ); - this.curval; -); - -function buffer_fread(pos) -( - this.curval = this.buf[pos]; - this.curval; -); - -function buffer_nread(pos) -( - this.buffer_read(pos * this.size); -); - -function buffer_fnread(pos) -( - this.buffer_fread(pos * this.size); -); - -function buffer_read2(pos) -( - pos >= 0 && pos < this.size ? ( - i_ = floor(pos); - this.curval = this.buf[i_] + (this.buf[i_+1] - this.buf[i_]) * (pos - i_); - ); - this.curval; -); - -function buffer_fread2(pos) -( - i_ = floor(pos); - this.curval = this.buf[i_] + (this.buf[i_+1] - this.buf[i_]) * (pos - i_); - this.curval; -); - -function buffer_nread2(pos) -( - this.buffer_read2(pos * this.size); -); - -function buffer_fnread2(pos) -( - this.buffer_fread2(pos * this.size); -); - -function buffer_read3(pos) -( - pos >= 0 && pos < this.size ? ( - i_ = floor(pos); - f_ = pos - i_; - x0_ = this.buf[i_-1]; x1_ = this.buf[i_]; - x2_ = this.buf[i_+1]; x3_ = this.buf[i_+2]; - a3_ = f_ * f_; a3_ -= 1.0; a3_ *= (1.0 / 6.0); - a2_ = (f_ + 1.0) * 0.5; a0_ = a2_ - 1.0; - a1_ = a3_ * 3.0; a2_ -= a1_; a0_ -= a3_; a1_ -= f_; - a0_ *= f_; a1_ *= f_; a2_ *= f_; a3_ *= f_; a1_ += 1.0; - this.curval = a0_*x0_ + a1_*x1_ + a2_*x2_ + a3_*x3_; - ); - this.curval; -); - -function buffer_fread3(pos) -( - i_ = floor(pos); - f_ = pos - i_; - x0_ = this.buf[i_-1]; x1_ = this.buf[i_]; - x2_ = this.buf[i_+1]; x3_ = this.buf[i_+2]; - a3_ = f_ * f_; a3_ -= 1.0; a3_ *= (1.0 / 6.0); - a2_ = (f_ + 1.0) * 0.5; a0_ = a2_ - 1.0; - a1_ = a3_ * 3.0; a2_ -= a1_; a0_ -= a3_; a1_ -= f_; - a0_ *= f_; a1_ *= f_; a2_ *= f_; a3_ *= f_; a1_ += 1.0; - this.curval = a0_*x0_ + a1_*x1_ + a2_*x2_ + a3_*x3_; - this.curval; -); - -function buffer_nread3(pos) -( - this.buffer_read3(pos * this.size); -); - -function buffer_fnread3(pos) -( - this.buffer_fread3(pos * this.size); -); - -function buffer_lookup(pos) -( - pos *= (this.hsize - 1); - pos += this.hsize; - this.buffer_fread(pos); -); - -function buffer_lookup2(pos) -( - pos *= (this.hsize - 1); - pos += this.hsize; - this.buffer_fread2(pos); -); - -function buffer_lookup3(pos) -( - pos *= (this.hsize - 2); - pos += this.hsize; - this.buffer_fread3(pos); -); - -// private function for writing harmonic waveforms -function _buffer_gen10(buf size amps n) -( - fac_ = 1 / (size * 0.5) * $pi; - i_ = 0; - loop(size, - val_ = 0.0; - j_ = 0; - loop(n, - amp_ = amps[j_]; - amp_ != 0 ? ( - val_ += sin((j_+1) * i_ * fac_) * amp_; - ); - j_ += 1; - ); - buf[i_] = val_; - i_ += 1; - ); - buf[size] = buf[0]; - buf[size+1] = buf[1]; - buf[-1] = buf[size-1]; -); - -function buffer_gen10(h1) -( - __amps__ = memalloc(1); - __amps__[0] = h1; - _buffer_gen10(this.buf, this.size, __amps__, 1); -); -function buffer_gen10(h1 h2) -( - __amps__ = memalloc(2); - __amps__[0] = h1; __amps__[1] = h2; - _buffer_gen10(this.buf, this.size, __amps__, 2); -); -function buffer_gen10(h1 h2 h3) -( - __amps__ = memalloc(3); - __amps__[0] = h1; __amps__[1] = h2; __amps__[2] = h3; - _buffer_gen10(this.buf, this.size, __amps__, 3); -); -function buffer_gen10(h1 h2 h3 h4) -( - __amps__ = memalloc(4); - __amps__[0] = h1; __amps__[1] = h2; __amps__[2] = h3; __amps__[3] = h4; - _buffer_gen10(this.buf, this.size, __amps__, 4); -); -function buffer_gen10(h1 h2 h3 h4 h5) -( - __amps__ = memalloc(5); - __amps__[0] = h1; __amps__[1] = h2; __amps__[2] = h3; __amps__[3] = h4; - __amps__[4] = h5; - _buffer_gen10(this.buf, this.size, __amps__, 5); -); -function buffer_gen10(h1 h2 h3 h4 h5 h6) -( - __amps__ = memalloc(6); - __amps__[0] = h1; __amps__[1] = h2; __amps__[2] = h3; __amps__[3] = h4; - __amps__[4] = h5; __amps__[5] = h6; - _buffer_gen10(this.buf, this.size, __amps__, 6); -); -function buffer_gen10(h1 h2 h3 h4 h5 h6 h7) -( - __amps__ = memalloc(6); - __amps__[0] = h1; __amps__[1] = h2; __amps__[2] = h3; __amps__[3] = h4; - __amps__[4] = h5; __amps__[5] = h6; __amps__[6] = h7; - _buffer_gen10(this.buf, this.size, __amps__, 7); -); -function buffer_gen10(h1 h2 h3 h4 h5 h6 h7 h8) -( - __amps__ = memalloc(8); - __amps__[0] = h1; __amps__[1] = h2; __amps__[2] = h3; __amps__[3] = h4; - __amps__[4] = h5; __amps__[5] = h6; __amps__[6] = h7; __amps__[7] = h8; - _buffer_gen10(this.buf, this.size, __amps__, 8); -); -function buffer_gen10(h1 h2 h3 h4 h5 h6 h7 h8 h9) -( - __amps__ = memalloc(9); - __amps__[0] = h1; __amps__[1] = h2; __amps__[2] = h3; __amps__[3] = h4; - __amps__[4] = h5; __amps__[5] = h6; __amps__[6] = h7; __amps__[7] = h8; - __amps__[8] = h9; - _buffer_gen10(this.buf, this.size, __amps__, 9); -); -function buffer_gen10(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10) -( - __amps__ = memalloc(10); - __amps__[0] = h1; __amps__[1] = h2; __amps__[2] = h3; __amps__[3] = h4; - __amps__[4] = h5; __amps__[5] = h6; __amps__[6] = h7; __amps__[7] = h8; - __amps__[8] = h9; __amps__[9] = h10; - _buffer_gen10(this.buf, this.size, __amps__, 10); -); -function buffer_gen10(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11) -( - __amps__ = memalloc(11); - __amps__[0] = h1; __amps__[1] = h2; __amps__[2] = h3; __amps__[3] = h4; - __amps__[4] = h5; __amps__[5] = h6; __amps__[6] = h7; __amps__[7] = h8; - __amps__[8] = h9; __amps__[9] = h10; __amps__[10] = h11; - _buffer_gen10(this.buf, this.size, __amps__, 11); -); -function buffer_gen10(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12) -( - __amps__ = memalloc(12); - __amps__[0] = h1; __amps__[1] = h2; __amps__[2] = h3; __amps__[3] = h4; - __amps__[4] = h5; __amps__[5] = h6; __amps__[6] = h7; __amps__[7] = h8; - __amps__[8] = h9; __amps__[9] = h10; __amps__[10] = h11; __amps__[11] = h12; - _buffer_gen10(this.buf, this.size, __amps__, 12); -); -function buffer_gen10(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13) -( - __amps__ = memalloc(13); - __amps__[0] = h1; __amps__[1] = h2; __amps__[2] = h3; __amps__[3] = h4; - __amps__[4] = h5; __amps__[5] = h6; __amps__[6] = h7; __amps__[7] = h8; - __amps__[8] = h9; __amps__[9] = h10; __amps__[10] = h11; __amps__[11] = h12; - __amps__[12] = h13; - _buffer_gen10(this.buf, this.size, __amps__, 13); -); -function buffer_gen10(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14) -( - __amps__ = memalloc(14); - __amps__[0] = h1; __amps__[1] = h2; __amps__[2] = h3; __amps__[3] = h4; - __amps__[4] = h5; __amps__[5] = h6; __amps__[6] = h7; __amps__[7] = h8; - __amps__[8] = h9; __amps__[9] = h10; __amps__[10] = h11; __amps__[11] = h12; - __amps__[12] = h13; __amps__[13] = h14; - _buffer_gen10(this.buf, this.size, __amps__, 14); -); -function buffer_gen10(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15) -( - __amps__ = memalloc(15); - __amps__[0] = h1; __amps__[1] = h2; __amps__[2] = h3; __amps__[3] = h4; - __amps__[4] = h5; __amps__[5] = h6; __amps__[6] = h7; __amps__[7] = h8; - __amps__[8] = h9; __amps__[9] = h10; __amps__[10] = h11; __amps__[11] = h12; - __amps__[12] = h13; __amps__[13] = h14; __amps__[14] = h15; - _buffer_gen10(this.buf, this.size, __amps__, 15); -); -function buffer_gen10(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16) -( - __amps__ = memalloc(16); - __amps__[0] = h1; __amps__[1] = h2; __amps__[2] = h3; __amps__[3] = h4; - __amps__[4] = h5; __amps__[5] = h6; __amps__[6] = h7; __amps__[7] = h8; - __amps__[8] = h9; __amps__[9] = h10; __amps__[10] = h11; __amps__[11] = h12; - __amps__[12] = h13; __amps__[13] = h14; __amps__[14] = h15; __amps__[15] = h16; - _buffer_gen10(this.buf, this.size, __amps__, 16); -); -function buffer_gen10(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17) -( - __amps__ = memalloc(17); - __amps__[0] = h1; __amps__[1] = h2; __amps__[2] = h3; __amps__[3] = h4; - __amps__[4] = h5; __amps__[5] = h6; __amps__[6] = h7; __amps__[7] = h8; - __amps__[8] = h9; __amps__[9] = h10; __amps__[10] = h11; __amps__[11] = h12; - __amps__[12] = h13; __amps__[13] = h14; __amps__[14] = h15; __amps__[15] = h16; - __amps__[16] = h17; - _buffer_gen10(this.buf, this.size, __amps__, 17); -); -function buffer_gen10(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18) -( - __amps__ = memalloc(18); - __amps__[0] = h1; __amps__[1] = h2; __amps__[2] = h3; __amps__[3] = h4; - __amps__[4] = h5; __amps__[5] = h6; __amps__[6] = h7; __amps__[7] = h8; - __amps__[8] = h9; __amps__[9] = h10; __amps__[10] = h11; __amps__[11] = h12; - __amps__[12] = h13; __amps__[13] = h14; __amps__[14] = h15; __amps__[15] = h16; - __amps__[16] = h17; __amps__[17] = h18; - _buffer_gen10(this.buf, this.size, __amps__, 18); -); -function buffer_gen10(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19) -( - __amps__ = memalloc(19); - __amps__[0] = h1; __amps__[1] = h2; __amps__[2] = h3; __amps__[3] = h4; - __amps__[4] = h5; __amps__[5] = h6; __amps__[6] = h7; __amps__[7] = h8; - __amps__[8] = h9; __amps__[9] = h10; __amps__[10] = h11; __amps__[11] = h12; - __amps__[12] = h13; __amps__[13] = h14; __amps__[14] = h15; __amps__[15] = h16; - __amps__[16] = h17; __amps__[17] = h18; __amps__[18] = h19; - _buffer_gen10(this.buf, this.size, __amps__, 19); -); -function buffer_gen10(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20) -( - __amps__ = memalloc(20); - __amps__[0] = h1; __amps__[1] = h2; __amps__[2] = h3; __amps__[3] = h4; - __amps__[4] = h5; __amps__[5] = h6; __amps__[6] = h7; __amps__[7] = h8; - __amps__[8] = h9; __amps__[9] = h10; __amps__[10] = h11; __amps__[11] = h12; - __amps__[12] = h13; __amps__[13] = h14; __amps__[14] = h15; __amps__[15] = h16; - __amps__[16] = h17; __amps__[17] = h18; __amps__[18] = h19; __amps__[19] = h20; - _buffer_gen10(this.buf, this.size, __amps__, 20); -); -function buffer_gen10(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21) -( - __amps__ = memalloc(21); - __amps__[0] = h1; __amps__[1] = h2; __amps__[2] = h3; __amps__[3] = h4; - __amps__[4] = h5; __amps__[5] = h6; __amps__[6] = h7; __amps__[7] = h8; - __amps__[8] = h9; __amps__[9] = h10; __amps__[10] = h11; __amps__[11] = h12; - __amps__[12] = h13; __amps__[13] = h14; __amps__[14] = h15; __amps__[15] = h16; - __amps__[16] = h17; __amps__[17] = h18; __amps__[18] = h19; __amps__[19] = h20; - __amps__[20] = h21; - _buffer_gen10(this.buf, this.size, __amps__, 21); -); -function buffer_gen10(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22) -( - __amps__ = memalloc(22); - __amps__[0] = h1; __amps__[1] = h2; __amps__[2] = h3; __amps__[3] = h4; - __amps__[4] = h5; __amps__[5] = h6; __amps__[6] = h7; __amps__[7] = h8; - __amps__[8] = h9; __amps__[9] = h10; __amps__[10] = h11; __amps__[11] = h12; - __amps__[12] = h13; __amps__[13] = h14; __amps__[14] = h15; __amps__[15] = h16; - __amps__[16] = h17; __amps__[17] = h18; __amps__[18] = h19; __amps__[19] = h20; - __amps__[20] = h21; __amps__[21] = h22; - _buffer_gen10(this.buf, this.size, __amps__, 22); -); -function buffer_gen10(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23) -( - __amps__ = memalloc(23); - __amps__[0] = h1; __amps__[1] = h2; __amps__[2] = h3; __amps__[3] = h4; - __amps__[4] = h5; __amps__[5] = h6; __amps__[6] = h7; __amps__[7] = h8; - __amps__[8] = h9; __amps__[9] = h10; __amps__[10] = h11; __amps__[11] = h12; - __amps__[12] = h13; __amps__[13] = h14; __amps__[14] = h15; __amps__[15] = h16; - __amps__[16] = h17; __amps__[17] = h18; __amps__[18] = h19; __amps__[19] = h20; - __amps__[20] = h21; __amps__[21] = h22; __amps__[22] = h23; - _buffer_gen10(this.buf, this.size, __amps__, 23); -); -function buffer_gen10(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24) -( - __amps__ = memalloc(24); - __amps__[0] = h1; __amps__[1] = h2; __amps__[2] = h3; __amps__[3] = h4; - __amps__[4] = h5; __amps__[5] = h6; __amps__[6] = h7; __amps__[7] = h8; - __amps__[8] = h9; __amps__[9] = h10; __amps__[10] = h11; __amps__[11] = h12; - __amps__[12] = h13; __amps__[13] = h14; __amps__[14] = h15; __amps__[15] = h16; - __amps__[16] = h17; __amps__[17] = h18; __amps__[18] = h19; __amps__[19] = h20; - __amps__[20] = h21; __amps__[21] = h22; __amps__[22] = h23; __amps__[23] = h24; - _buffer_gen10(this.buf, this.size, __amps__, 24); -); - -function buffer_gen10(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25) -( - __amps__ = memalloc(25); - __amps__[0] = h1; __amps__[1] = h2; __amps__[2] = h3; __amps__[3] = h4; - __amps__[4] = h5; __amps__[5] = h6; __amps__[6] = h7; __amps__[7] = h8; - __amps__[8] = h9; __amps__[9] = h10; __amps__[10] = h11; __amps__[11] = h12; - __amps__[12] = h13; __amps__[13] = h14; __amps__[14] = h15; __amps__[15] = h16; - __amps__[16] = h17; __amps__[17] = h18; __amps__[18] = h19; __amps__[19] = h20; - __amps__[20] = h21; __amps__[21] = h22; __amps__[22] = h23; __amps__[23] = h24; - __amps__[24] = h25; - _buffer_gen10(this.buf, this.size, __amps__, 25); -); -function buffer_gen10(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26) -( - __amps__ = memalloc(26); - __amps__[0] = h1; __amps__[1] = h2; __amps__[2] = h3; __amps__[3] = h4; - __amps__[4] = h5; __amps__[5] = h6; __amps__[6] = h7; __amps__[7] = h8; - __amps__[8] = h9; __amps__[9] = h10; __amps__[10] = h11; __amps__[11] = h12; - __amps__[12] = h13; __amps__[13] = h14; __amps__[14] = h15; __amps__[15] = h16; - __amps__[16] = h17; __amps__[17] = h18; __amps__[18] = h19; __amps__[19] = h20; - __amps__[20] = h21; __amps__[21] = h22; __amps__[22] = h23; __amps__[23] = h24; - __amps__[24] = h25; __amps__[25] = h26; - _buffer_gen10(this.buf, this.size, __amps__, 26); -); -function buffer_gen10(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27) -( - __amps__ = memalloc(27); - __amps__[0] = h1; __amps__[1] = h2; __amps__[2] = h3; __amps__[3] = h4; - __amps__[4] = h5; __amps__[5] = h6; __amps__[6] = h7; __amps__[7] = h8; - __amps__[8] = h9; __amps__[9] = h10; __amps__[10] = h11; __amps__[11] = h12; - __amps__[12] = h13; __amps__[13] = h14; __amps__[14] = h15; __amps__[15] = h16; - __amps__[16] = h17; __amps__[17] = h18; __amps__[18] = h19; __amps__[19] = h20; - __amps__[20] = h21; __amps__[21] = h22; __amps__[22] = h23; __amps__[23] = h24; - __amps__[24] = h25; __amps__[25] = h26; __amps__[26] = h27; - _buffer_gen10(this.buf, this.size, __amps__, 27); -); -function buffer_gen10(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28) -( - __amps__ = memalloc(28); - __amps__[0] = h1; __amps__[1] = h2; __amps__[2] = h3; __amps__[3] = h4; - __amps__[4] = h5; __amps__[5] = h6; __amps__[6] = h7; __amps__[7] = h8; - __amps__[8] = h9; __amps__[9] = h10; __amps__[10] = h11; __amps__[11] = h12; - __amps__[12] = h13; __amps__[13] = h14; __amps__[14] = h15; __amps__[15] = h16; - __amps__[16] = h17; __amps__[17] = h18; __amps__[18] = h19; __amps__[19] = h20; - __amps__[20] = h21; __amps__[21] = h22; __amps__[22] = h23; __amps__[23] = h24; - __amps__[24] = h25; __amps__[25] = h26; __amps__[26] = h27; __amps__[27] = h28; - _buffer_gen10(this.buf, this.size, __amps__, 28); -); -function buffer_gen10(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29) -( - __amps__ = memalloc(29); - __amps__[0] = h1; __amps__[1] = h2; __amps__[2] = h3; __amps__[3] = h4; - __amps__[4] = h5; __amps__[5] = h6; __amps__[6] = h7; __amps__[7] = h8; - __amps__[8] = h9; __amps__[9] = h10; __amps__[10] = h11; __amps__[11] = h12; - __amps__[12] = h13; __amps__[13] = h14; __amps__[14] = h15; __amps__[15] = h16; - __amps__[16] = h17; __amps__[17] = h18; __amps__[18] = h19; __amps__[19] = h20; - __amps__[20] = h21; __amps__[21] = h22; __amps__[22] = h23; __amps__[23] = h24; - __amps__[24] = h25; __amps__[25] = h26; __amps__[26] = h27; __amps__[27] = h28; - __amps__[28] = h29; - _buffer_gen10(this.buf, this.size, __amps__, 29); -); -function buffer_gen10(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30) -( - __amps__ = memalloc(30); - __amps__[0] = h1; __amps__[1] = h2; __amps__[2] = h3; __amps__[3] = h4; - __amps__[4] = h5; __amps__[5] = h6; __amps__[6] = h7; __amps__[7] = h8; - __amps__[8] = h9; __amps__[9] = h10; __amps__[10] = h11; __amps__[11] = h12; - __amps__[12] = h13; __amps__[13] = h14; __amps__[14] = h15; __amps__[15] = h16; - __amps__[16] = h17; __amps__[17] = h18; __amps__[18] = h19; __amps__[19] = h20; - __amps__[20] = h21; __amps__[21] = h22; __amps__[22] = h23; __amps__[23] = h24; - __amps__[24] = h25; __amps__[25] = h26; __amps__[26] = h27; __amps__[27] = h28; - __amps__[28] = h29; __amps__[29] = h30; - _buffer_gen10(this.buf, this.size, __amps__, 30); -); -function buffer_gen10(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30 h31) -( - __amps__ = memalloc(31); - __amps__[0] = h1; __amps__[1] = h2; __amps__[2] = h3; __amps__[3] = h4; - __amps__[4] = h5; __amps__[5] = h6; __amps__[6] = h7; __amps__[7] = h8; - __amps__[8] = h9; __amps__[9] = h10; __amps__[10] = h11; __amps__[11] = h12; - __amps__[12] = h13; __amps__[13] = h14; __amps__[14] = h15; __amps__[15] = h16; - __amps__[16] = h17; __amps__[17] = h18; __amps__[18] = h19; __amps__[19] = h20; - __amps__[20] = h21; __amps__[21] = h22; __amps__[22] = h23; __amps__[23] = h24; - __amps__[24] = h25; __amps__[25] = h26; __amps__[26] = h27; __amps__[27] = h28; - __amps__[28] = h29; __amps__[29] = h30; __amps__[30] = h31; - _buffer_gen10(this.buf, this.size, __amps__, 31); -); -function buffer_gen10(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30 h31 h32) -( - __amps__ = memalloc(32); - __amps__[0] = h1; __amps__[1] = h2; __amps__[2] = h3; __amps__[3] = h4; - __amps__[4] = h5; __amps__[5] = h6; __amps__[6] = h7; __amps__[7] = h8; - __amps__[8] = h9; __amps__[9] = h10; __amps__[10] = h11; __amps__[11] = h12; - __amps__[12] = h13; __amps__[13] = h14; __amps__[14] = h15; __amps__[15] = h16; - __amps__[16] = h17; __amps__[17] = h18; __amps__[18] = h19; __amps__[19] = h20; - __amps__[20] = h21; __amps__[21] = h22; __amps__[22] = h23; __amps__[23] = h24; - __amps__[24] = h25; __amps__[25] = h26; __amps__[26] = h27; __amps__[27] = h28; - __amps__[28] = h29; __amps__[29] = h30; __amps__[30] = h31; __amps__[31] = h32; - _buffer_gen10(this.buf, this.size, __amps__, 32); -); -function buffer_gen10(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30 h31 h32 h33) -( - __amps__ = memalloc(33); - __amps__[0] = h1; __amps__[1] = h2; __amps__[2] = h3; __amps__[3] = h4; - __amps__[4] = h5; __amps__[5] = h6; __amps__[6] = h7; __amps__[7] = h8; - __amps__[8] = h9; __amps__[9] = h10; __amps__[10] = h11; __amps__[11] = h12; - __amps__[12] = h13; __amps__[13] = h14; __amps__[14] = h15; __amps__[15] = h16; - __amps__[16] = h17; __amps__[17] = h18; __amps__[18] = h19; __amps__[19] = h20; - __amps__[20] = h21; __amps__[21] = h22; __amps__[22] = h23; __amps__[23] = h24; - __amps__[24] = h25; __amps__[25] = h26; __amps__[26] = h27; __amps__[27] = h28; - __amps__[28] = h29; __amps__[29] = h30; __amps__[30] = h31; __amps__[31] = h32; - __amps__[32] = h33; - _buffer_gen10(this.buf, this.size, __amps__, 33); -); -function buffer_gen10(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30 h31 h32 h33 h34) -( - __amps__ = memalloc(34); - __amps__[0] = h1; __amps__[1] = h2; __amps__[2] = h3; __amps__[3] = h4; - __amps__[4] = h5; __amps__[5] = h6; __amps__[6] = h7; __amps__[7] = h8; - __amps__[8] = h9; __amps__[9] = h10; __amps__[10] = h11; __amps__[11] = h12; - __amps__[12] = h13; __amps__[13] = h14; __amps__[14] = h15; __amps__[15] = h16; - __amps__[16] = h17; __amps__[17] = h18; __amps__[18] = h19; __amps__[19] = h20; - __amps__[20] = h21; __amps__[21] = h22; __amps__[22] = h23; __amps__[23] = h24; - __amps__[24] = h25; __amps__[25] = h26; __amps__[26] = h27; __amps__[27] = h28; - __amps__[28] = h29; __amps__[29] = h30; __amps__[30] = h31; __amps__[31] = h32; - __amps__[32] = h33; __amps__[33] = h34; - _buffer_gen10(this.buf, this.size, __amps__, 34); -); -function buffer_gen10(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30 h31 h32 h33 h34 h35) -( - __amps__ = memalloc(35); - __amps__[0] = h1; __amps__[1] = h2; __amps__[2] = h3; __amps__[3] = h4; - __amps__[4] = h5; __amps__[5] = h6; __amps__[6] = h7; __amps__[7] = h8; - __amps__[8] = h9; __amps__[9] = h10; __amps__[10] = h11; __amps__[11] = h12; - __amps__[12] = h13; __amps__[13] = h14; __amps__[14] = h15; __amps__[15] = h16; - __amps__[16] = h17; __amps__[17] = h18; __amps__[18] = h19; __amps__[19] = h20; - __amps__[20] = h21; __amps__[21] = h22; __amps__[22] = h23; __amps__[23] = h24; - __amps__[24] = h25; __amps__[25] = h26; __amps__[26] = h27; __amps__[27] = h28; - __amps__[28] = h29; __amps__[29] = h30; __amps__[30] = h31; __amps__[31] = h32; - __amps__[32] = h33; __amps__[33] = h34; __amps__[34] = h35; - _buffer_gen10(this.buf, this.size, __amps__, 35); -); -function buffer_gen10(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30 h31 h32 h33 h34 h35 h36) -( - __amps__ = memalloc(36); - __amps__[0] = h1; __amps__[1] = h2; __amps__[2] = h3; __amps__[3] = h4; - __amps__[4] = h5; __amps__[5] = h6; __amps__[6] = h7; __amps__[7] = h8; - __amps__[8] = h9; __amps__[9] = h10; __amps__[10] = h11; __amps__[11] = h12; - __amps__[12] = h13; __amps__[13] = h14; __amps__[14] = h15; __amps__[15] = h16; - __amps__[16] = h17; __amps__[17] = h18; __amps__[18] = h19; __amps__[19] = h20; - __amps__[20] = h21; __amps__[21] = h22; __amps__[22] = h23; __amps__[23] = h24; - __amps__[24] = h25; __amps__[25] = h26; __amps__[26] = h27; __amps__[27] = h28; - __amps__[28] = h29; __amps__[29] = h30; __amps__[30] = h31; __amps__[31] = h32; - __amps__[32] = h33; __amps__[33] = h34; __amps__[34] = h35; __amps__[35] = h36; - _buffer_gen10(this.buf, this.size, __amps__, 36); -); -function buffer_gen10(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30 h31 h32 h33 h34 h35 h36 h37) -( - __amps__ = memalloc(37); - __amps__[0] = h1; __amps__[1] = h2; __amps__[2] = h3; __amps__[3] = h4; - __amps__[4] = h5; __amps__[5] = h6; __amps__[6] = h7; __amps__[7] = h8; - __amps__[8] = h9; __amps__[9] = h10; __amps__[10] = h11; __amps__[11] = h12; - __amps__[12] = h13; __amps__[13] = h14; __amps__[14] = h15; __amps__[15] = h16; - __amps__[16] = h17; __amps__[17] = h18; __amps__[18] = h19; __amps__[19] = h20; - __amps__[20] = h21; __amps__[21] = h22; __amps__[22] = h23; __amps__[23] = h24; - __amps__[24] = h25; __amps__[25] = h26; __amps__[26] = h27; __amps__[27] = h28; - __amps__[28] = h29; __amps__[29] = h30; __amps__[30] = h31; __amps__[31] = h32; - __amps__[32] = h33; __amps__[33] = h34; __amps__[34] = h35; __amps__[35] = h36; - __amps__[36] = h37; - _buffer_gen10(this.buf, this.size, __amps__, 37); -); -function buffer_gen10(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30 h31 h32 h33 h34 h35 h36 h37 h38) -( - __amps__ = memalloc(38); - __amps__[0] = h1; __amps__[1] = h2; __amps__[2] = h3; __amps__[3] = h4; - __amps__[4] = h5; __amps__[5] = h6; __amps__[6] = h7; __amps__[7] = h8; - __amps__[8] = h9; __amps__[9] = h10; __amps__[10] = h11; __amps__[11] = h12; - __amps__[12] = h13; __amps__[13] = h14; __amps__[14] = h15; __amps__[15] = h16; - __amps__[16] = h17; __amps__[17] = h18; __amps__[18] = h19; __amps__[19] = h20; - __amps__[20] = h21; __amps__[21] = h22; __amps__[22] = h23; __amps__[23] = h24; - __amps__[24] = h25; __amps__[25] = h26; __amps__[26] = h27; __amps__[27] = h28; - __amps__[28] = h29; __amps__[29] = h30; __amps__[30] = h31; __amps__[31] = h32; - __amps__[32] = h33; __amps__[33] = h34; __amps__[34] = h35; __amps__[35] = h36; - __amps__[36] = h37; __amps__[37] = h38; - _buffer_gen10(this.buf, this.size, __amps__, 38); -); -function buffer_gen10(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30 h31 h32 h33 h34 h35 h36 h37 h38 h39) -( - __amps__ = memalloc(39); - __amps__[0] = h1; __amps__[1] = h2; __amps__[2] = h3; __amps__[3] = h4; - __amps__[4] = h5; __amps__[5] = h6; __amps__[6] = h7; __amps__[7] = h8; - __amps__[8] = h9; __amps__[9] = h10; __amps__[10] = h11; __amps__[11] = h12; - __amps__[12] = h13; __amps__[13] = h14; __amps__[14] = h15; __amps__[15] = h16; - __amps__[16] = h17; __amps__[17] = h18; __amps__[18] = h19; __amps__[19] = h20; - __amps__[20] = h21; __amps__[21] = h22; __amps__[22] = h23; __amps__[23] = h24; - __amps__[24] = h25; __amps__[25] = h26; __amps__[26] = h27; __amps__[27] = h28; - __amps__[28] = h29; __amps__[29] = h30; __amps__[30] = h31; __amps__[31] = h32; - __amps__[32] = h33; __amps__[33] = h34; __amps__[34] = h35; __amps__[35] = h36; - __amps__[36] = h37; __amps__[37] = h38; __amps__[38] = h39; - _buffer_gen10(this.buf, this.size, __amps__, 39); -); -function buffer_gen10(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30 h31 h32 h33 h34 h35 h36 h37 h38 h39 h40) -( - __amps__ = memalloc(40); - __amps__[0] = h1; __amps__[1] = h2; __amps__[2] = h3; __amps__[3] = h4; - __amps__[4] = h5; __amps__[5] = h6; __amps__[6] = h7; __amps__[7] = h8; - __amps__[8] = h9; __amps__[9] = h10; __amps__[10] = h11; __amps__[11] = h12; - __amps__[12] = h13; __amps__[13] = h14; __amps__[14] = h15; __amps__[15] = h16; - __amps__[16] = h17; __amps__[17] = h18; __amps__[18] = h19; __amps__[19] = h20; - __amps__[20] = h21; __amps__[21] = h22; __amps__[22] = h23; __amps__[23] = h24; - __amps__[24] = h25; __amps__[25] = h26; __amps__[26] = h27; __amps__[27] = h28; - __amps__[28] = h29; __amps__[29] = h30; __amps__[30] = h31; __amps__[31] = h32; - __amps__[32] = h33; __amps__[33] = h34; __amps__[34] = h35; __amps__[35] = h36; - __amps__[36] = h37; __amps__[37] = h38; __amps__[38] = h39; __amps__[39] = h40; - _buffer_gen10(this.buf, this.size, __amps__, 40); -); - -function buffer_saw(order) -( - __amps__ = memalloc(order); - i_ = 0; - loop(order, - __amps__[i_] = 1 / (i_ + 1); - i_ += 1; - ); - _buffer_gen10(this.buf, this.size, __amps__, order); -); - -function buffer_square(order) -( - __amps__ = memalloc(order); - i_ = 0; - loop(order, - i_ & 1 ? __amps__[i_] = 0 : __amps__[i_] = 1 / (i_ + 1); - i_ += 1; - ); - _buffer_gen10(this.buf, this.size, __amps__, order); -); - -function buffer_triangle(order) -( - __amps__ = memalloc(order); - i_ = 0; - ph_ = 1; - loop(order, - i_ & 1 ? ( - __amps__[i_] = 0; - ) : ( - __amps__[i_] = ph_ * 1 / pow(i_ + 1, 2); - ph_ *= -1; - ); - i_ += 1; - ); - _buffer_gen10(this.buf, this.size, __amps__, order); -); - -function buffer_normalize(amp) -( - mi_ = ma_ = 0; - i_ = 0; - loop(this.size, - mi_ > this.buf[i_] ? mi_ = this.buf[i_]; - ma_ < this.buf[i_] ? ma_ = this.buf[i_]; - i_ += 1; - ); - (mi_*mi_ > ma_*ma_) ? max_ = abs(mi_) : max_ = abs(ma_); - max_ > 0 ? ( - ratio_ = amp / max_; - i_ = 0; - loop(this.size, - this.buf[i_] *= ratio_; - i_ += 1; - ); - ); - this.buf[this.size] *= ratio_; - this.buf[this.size+1] *= ratio_; - this.buf[-1] *= ratio_; -); - -function buffer_reset() -( - i_ = 0; - loop(this.size, - this.buf[i_] = 0; - i_ += 1; - ); - this.buf[this.size] = 0; - this.buf[this.size+1] = 0; - this.buf[-1] = 0; -); - -function buffer_reverse() -( - hsize_ = floor(this.size / 2); - size1_ = this.size - 1; - i_ = 0; - loop(hsize_, - tmp_ = this.buf[i_]; - this.buf[i_] = this.buf[size1_ - i_]; - this.buf[size1_ - i_] = tmp_; - i_ += 1; - ); - this.buf[this.size] = this.buf[0]; - this.buf[this.size+1] = this.buf[1]; - this.buf[-1] = this.buf[this.size-1]; -); - -function buffer_window(which) -( - // defaults to hanning - which < 0 || which > 8 ? which = 1; - which == 0 ? ( // hamming - arg_ = 2.0 * $pi / (this.size-1); - i_ = 0; - loop(this.size, - this.buf[i_] = 0.54 - 0.46 * cos(arg_ * i_); - i_ += 1; - ); - ) : - which == 1 ? ( // hanning - arg_ = 2.0 * $pi / (this.size-1); - i_ = 0; - loop(this.size, - this.buf[i_] = 0.5 - 0.5 * cos(arg_ * i_); - i_ += 1; - ); - ) : - which == 2 ? ( // bartlett - arg_ = 2.0 / (this.size-1); - hsize_ = floor((this.size-1)/2); - i_ = 0; - loop(hsize_, - this.buf[i_] = i_ * arg_; - i_ += 1; - ); - loop(this.size - hsize_, - this.buf[i_] = 2.0 - i_ * arg_; - i_ += 1; - ); - ) : - which == 3 ? ( // blackman - arg_ = 2.0 * $pi / (this.size-1); - i_ = 0; - loop(this.size, - this.buf[i_] = 0.42323 - 0.49755 * cos(arg_*i_) + 0.07922 * cos(2*arg_*i_); - i_ += 1; - ); - ) : - which == 4 ? ( // blackman_harris_4 - arg_ = 2.0 * $pi / (this.size-1); - i_ = 0; - loop(this.size, - this.buf[i_] = 0.35875 - 0.48829 * cos(arg_*i_) + 0.14128 * cos(2*arg_*i_) - 0.01168 * cos(3*arg_*i_); - i_ += 1; - ); - ) : - which == 5 ? ( // blackman_harris_7 - arg_ = 2.0 * $pi / (this.size-1); - i_ = 0; - loop(this.size, - this.buf[i_] = 0.2712203606 - 0.4334446123 * cos(arg_*i_) + 0.21800412 * cos(2*arg_*i_) - 0.0657853433 * cos(3*arg_*i_) + 0.0107618673 * cos(4*arg_*i_) - 0.0007700127 * cos(5*arg_*i_) + 0.00001368088 * cos(6*arg_*i_); - i_ += 1; - ); - ) : - which == 6 ? ( // tuckey 50% - i_ = 0; - step_ = floor(0.5 * this.size / 2); - loop(step_, - this.buf[i_] = 0.5 * (1 + cos($pi * (2 * i_ / (0.5 * this.size) - 1))); - i_ += 1; - ); - step_ = this.size * (1 - 0.5 / 2) - step_; - loop(step_, - this.buf[i_] = 1.0; - i_ += 1; - ); - step_ = this.size - step_; - loop(step_, - this.buf[i_] = 0.5 * (1 + cos($pi * (2 * i_ / (0.5 * this.size) - 2 / 0.5 + 1))); - i_ += 1; - ); - ) : - which == 7 ? ( // halfsine - arg_ = $pi / (this.size-1); - i_ = 0; - loop(this.size, - this.buf[i_] = sin(arg_ * i_); - i_ += 1; - ); - ) : - which == 8 ? ( // parabolic - size1_ = this.size - 1; - rdur_ = 1 / size1_; - rdur2_ = rdur_ * rdur_; - level_ = 0; - slope_ = 4 * (rdur_ - rdur2_); - curve_ = -8 * rdur2_; - - i_ = 0; - loop(size1_, - this.buf[i_] = level_; - level_ += slope_; - slope_ += curve_; - i_ += 1; - ); - this.buf[size1_] = this.buf[0]; - ); - this.buf[this.size] = this.buf[0]; - this.buf[this.size+1] = this.buf[1]; - this.buf[-1] = this.buf[this.size-1]; -); - -function buffer_atan(slope) -( - invh_ = 1.0 / this.hsize; - invpi_ = 1.0 / $pi; - drv_ = 1.0 - slope; - drv_ = drv_ * drv_ * drv_ * $pi; - i_ = 0; - loop(this.hsize + 1, - t_ = i_ * invh_ - 1; - val_ = atan2(t_, drv_) * invpi_; - i_ == 0 ? fac_ = 1.0 / -val_; - val_ *= fac_; - this.buf[i_] = val_; - this.buf[this.size - i_] = -val_; - i_ += 1; - ); -); - -function buffer_clip(mini maxi) -( - k_ = -1; - loop(this.size+3, - this.buf[k_] = max(min(this.buf[k_], maxi), mini); - k_ += 1; - ); -); - -function buffer_mul(x) -( - k_ = -1; - loop(this.size+3, - this.buf[k_] = this.buf[k_] * x; - k_ += 1; - ); -); - -function buffer_div(x) -( - k_ = -1; - loop(this.size+3, - this.buf[k_] = this.buf[k_] / x; - k_ += 1; - ); -); - -function buffer_rdiv(x) -( - k_ = -1; - loop(this.size+3, - this.buf[k_] = x / this.buf[k_]; - k_ += 1; - ); -); - -function buffer_add(x) -( - k_ = -1; - loop(this.size+3, - this.buf[k_] = this.buf[k_] + x; - k_ += 1; - ); -); - -function buffer_sub(x) -( - k_ = -1; - loop(this.size+3, - this.buf[k_] = this.buf[k_] - x; - k_ += 1; - ); -); - -function buffer_rsub(x) -( - k_ = -1; - loop(this.size+3, - this.buf[k_] = x - this.buf[k_]; - k_ += 1; - ); -); diff --git a/FX/BryanChi_FX Devices/cookdsp/delay.jsfx-inc b/FX/BryanChi_FX Devices/cookdsp/delay.jsfx-inc deleted file mode 100644 index 2db30b72d..000000000 --- a/FX/BryanChi_FX Devices/cookdsp/delay.jsfx-inc +++ /dev/null @@ -1,614 +0,0 @@ -///////////////////////////////////////////////////////////////// -// Copyright (c) - 2014 - Olivier Belanger // -// Permission to use, copy, modify, and/or distribute this // -// software for any purpose with or without fee is hereby // -// granted, provided that the above copyright notice and this // -// permission notice appear in all copies. CookDSP IS PROVIDED // -// "AS IS", WITHOUT WARRANTY OF ANY KIND FROM THE AUTHOR. // -///////////////////////////////////////////////////////////////// - -@init - -/******************************************************* -DELAY -===== - -Initialize a delay line for writing and reading audio samples. - -Description ------------ - -A delay object reserves a region of the local memory buffer -and initializes a delay line using this buffer. Several -interpolation algorithms can be used to read the samples -stored in the delay line. - -It must be used with a variable name as prefix (object oriented). - -Initializer ------------ - -#### delay(size) #### - -Initializes the delay line with a buffer of length `size`, in samples. - -Methods -------- - -#### delay_write(signal) #### - -Writes a sample value, `signal`, at the current position in the -delay's buffer. This function also increments the current position. - -#### delay_read(delay) #### - -Returns the value at the delayed position given in argument `delay` -(in samples). This function uses no interpolation, ie. the position -is truncated to the biggest integer not greater than the real delayed -position. - -This function checks for delay's validity. - -#### delay_fread(delay) #### - -Returns the value at the delayed position given in argument `delay` -(in samples). This function uses no interpolation, ie. the position -is truncated to the biggest integer not greater than the real delayed -position. - -This function is faster than `delay_read` because there is no check -for delay's validity. Use it only if `delay` is known to be valid. - -#### delay_read2(delay) #### - -Returns the value at the delayed position given in argument `delay` -(in samples). This function uses a linear interpolation to read the -"true" value for a floating-point sample position. - -This function checks for delay's validity. - -#### delay_fread2(delay) #### - -Returns the value at the delayed position given in argument `delay` -(in samples). This function uses a linear interpolation to read the -"true" value for a floating-point sample position. - -This function is faster than `delay_read2` because there is no check -for delay's validity. Use it only if `delay` is known to be valid. - -#### delay_read3(delay) #### - -Returns the value at the delayed position given in argument `delay` -(in samples). This function uses a cubic interpolation to read the -"true" value for a floating-point sample position. - -This function checks for delay's validity. - -#### delay_fread3(delay) #### - -Returns the value at the delayed position given in argument `delay` -(in samples). This function uses a cubic interpolation to read the -"true" value for a floating-point sample position. - -This function is faster than `delay_read3` because there is no check -for delay's validity. Use it only if `delay` is known to be valid. - -#### delay_sread(delay) #### - -Returns the value at the delayed position given in argument `delay` -(in seconds). This function uses no interpolation, ie. the position -is truncated to the biggest integer not greater than the real delayed -position. - -This function checks for delay's validity. - -#### delay_fsread(delay) #### - -Returns the value at the delayed position given in argument `delay` -(in seconds). This function uses no interpolation, ie. the position -is truncated to the biggest integer not greater than the real delayed -position. - -This function is faster than `delay_sread` because there is no check -for delay's validity. Use it only if `delay` is known to be valid. - -#### delay_sread2(delay) #### - -Returns the value at the delayed position given in argument `delay` -(in seconds). This function uses a linear interpolation to read the -"true" value for a floating-point sample position. - -This function checks for delay's validity. - -#### delay_fsread2(delay) #### - -Returns the value at the delayed position given in argument `delay` -(in seconds). This function uses a linear interpolation to read the -"true" value for a floating-point sample position. - -This function is faster than `delay_sread2` because there is no check -for delay's validity. Use it only if `delay` is known to be valid. - -#### delay_sread3(delay) #### - -Returns the value at the delayed position given in argument `delay` -(in seconds). This function uses a cubic interpolation to read the -"true" value for a floating-point sample position. - -This function checks for delay's validity. - -#### delay_fsread3(delay) #### - -Returns the value at the delayed position given in argument `delay` -(in seconds). This function uses a cubic interpolation to read the -"true" value for a floating-point sample position. - -This function is faster than `delay_sread3` because there is no check -for delay's validity. Use it only if `delay` is known to be valid. - -Example -------- - - desc:Stereo Delay + Feedback - - slider1:250<1,1000>Delay Time (ms) - slider2:0<-1,1>Feedback - - import cookdsp.jsfx-inc - - @init - // one second stereo delay line - d0.delay(srate); - d1.delay(srate); - - @slider - // delay time in samples - samps = slider1 * 0.001 * srate; - - @sample - // read with cubic interpolation - val0 = d0.delay_read3(samps); - val1 = d1.delay_read3(samps); - // write values in delay lines - d0.delay_write(spl0 + val0 * slider2); - d1.delay_write(spl1 + val1 * slider2); - // sum and output - spl0 = (spl0 + val0) * 0.5; - spl1 = (spl1 + val1) * 0.5; - -********************************************************/ -function delay(size) -( - this.buf = memalloc(size); - this.size = size; - this.curpos = 0; - this.curval = 0; -); - -function delay_write(signal) -( - this.buf[this.curpos] = signal; - this.buf[this.size] = this.buf[0]; - this.buf[this.size+1] = this.buf[1]; - this.buf[-1] = this.buf[this.size-1]; - this.curpos += 1; - this.curpos == this.size ? this.curpos = 0; -); - -function delay_read(delay) -( - delay >= 0 && delay < this.size ? ( - pos_ = this.curpos - delay; - pos_ < 0 ? pos_ += this.size; - this.curval = this.buf[floor(pos_)]; - ); - this.curval; -); - -function delay_fread(delay) -( - pos_ = this.curpos - delay; - pos_ < 0 ? pos_ += this.size; - this.curval = this.buf[floor(pos_)]; - this.curval; -); - -function delay_sread(delay) -( - this.delay_read(delay * srate); -); - -function delay_fsread(delay) -( - this.delay_fread(delay * srate); -); - -function delay_read2(delay) -( - delay >= 0 && delay < this.size ? ( - pos_ = this.curpos - delay; - pos_ < 0 ? pos_ += this.size; - ip_ = floor(pos_); - this.curval = this.buf[ip_] + (this.buf[ip_+1] - this.buf[ip_]) * (pos_ - ip_); - ); - this.curval; -); - -function delay_fread2(delay) -( - pos_ = this.curpos - delay; - pos_ < 0 ? pos_ += this.size; - ip_ = floor(pos_); - this.curval = this.buf[ip_] + (this.buf[ip_+1] - this.buf[ip_]) * (pos_ - ip_); - this.curval; -); - -function delay_sread2(delay) -( - this.delay_read2(delay * srate); -); - -function delay_fsread2(delay) -( - this.delay_fread2(delay * srate); -); - -function delay_read3(delay) -( - delay >= 0 && delay < this.size ? ( - pos_ = this.curpos - delay; - pos_ < 0 ? pos_ += this.size; - i_ = floor(pos_); - f_ = pos_ - i_; - x0_ = this.buf[i_-1]; x1_ = this.buf[i_]; - x2_ = this.buf[i_+1]; x3_ = this.buf[i_+2]; - a3_ = f_ * f_; a3_ -= 1.0; a3_ *= (1.0 / 6.0); - a2_ = (f_ + 1.0) * 0.5; a0_ = a2_ - 1.0; - a1_ = a3_ * 3.0; a2_ -= a1_; a0_ -= a3_; a1_ -= f_; - a0_ *= f_; a1_ *= f_; a2_ *= f_; a3_ *= f_; a1_ += 1.0; - this.curval = a0_*x0_ + a1_*x1_ + a2_*x2_ + a3_*x3_; - ); - this.curval; -); - -function delay_fread3(delay) -( - pos_ = this.curpos - delay; - pos_ < 0 ? pos_ += this.size; - i_ = floor(pos_); - f_ = pos_ - i_; - x0_ = this.buf[i_-1]; x1_ = this.buf[i_]; - x2_ = this.buf[i_+1]; x3_ = this.buf[i_+2]; - a3_ = f_ * f_; a3_ -= 1.0; a3_ *= (1.0 / 6.0); - a2_ = (f_ + 1.0) * 0.5; a0_ = a2_ - 1.0; - a1_ = a3_ * 3.0; a2_ -= a1_; a0_ -= a3_; a1_ -= f_; - a0_ *= f_; a1_ *= f_; a2_ *= f_; a3_ *= f_; a1_ += 1.0; - this.curval = a0_*x0_ + a1_*x1_ + a2_*x2_ + a3_*x3_; - this.curval; -); - -function delay_sread3(delay) -( - this.delay_read3(delay * srate); -); - -function delay_fsread3(delay) -( - this.delay_fread3(delay * srate); -); - -/******************************************************* -SDELAY -====== - -Initialize an artifact-free delay line for writing and reading audio samples. - -Description ------------ - -A sdelay object reserves a region of the local memory buffer -and initializes an artifact-free delay line using this buffer. -Several interpolation algorithms can be used to read the samples -stored in the delay line. - -The sdelay object implements a delay line that does not produce -clicks or pitch shifting when the delay time is changing. - -It must be used with a variable name as prefix (object oriented). - -Initializer ------------ - -#### sdelay(size, xfade) #### - -Initializes the delay line with a buffer of length `size`, and a -crossfade duration of length `xfade`, both in samples. - -Methods -------- - -#### sdelay_set_xfade(xfade) #### - -Sets a new crossfade time, `xfade`, in samples. - -#### sdelay_write(signal) #### - -Writes a sample value, `signal`, at the current position in the -delay's buffer. This function also increments the current position. - -#### sdelay_read(delay) #### - -Returns the value at the delayed position given in argument `delay` -(in samples). This function uses no interpolation, ie. the position -is truncated to the biggest integer not greater than the real delayed -position. - -This function checks for delay's validity. - -#### sdelay_fread(delay) #### - -Returns the value at the delayed position given in argument `delay` -(in samples). This function uses no interpolation, ie. the position -is truncated to the biggest integer not greater than the real delayed -position. - -This function is faster than `sdelay_read` because there is no check -for delay's validity. Use it only if `delay` is known to be valid. - -#### sdelay_read2(delay) #### - -Returns the value at the delayed position given in argument `delay` -(in samples). This function uses a linear interpolation to read the -"true" value for a floating-point sample position. - -This function checks for delay's validity. - -#### sdelay_fread2(delay) #### - -Returns the value at the delayed position given in argument `delay` -(in samples). This function uses a linear interpolation to read the -"true" value for a floating-point sample position. - -This function is faster than `sdelay_read2` because there is no check -for delay's validity. Use it only if `delay` is known to be valid. - -#### sdelay_read3(delay) #### - -Returns the value at the delayed position given in argument `delay` -(in samples). This function uses a cubic interpolation to read the -"true" value for a floating-point sample position. - -This function checks for delay's validity. - -#### sdelay_fread3(delay) #### - -Returns the value at the delayed position given in argument `delay` -(in samples). This function uses a cubic interpolation to read the -"true" value for a floating-point sample position. - -This function is faster than `sdelay_read3` because there is no check -for delay's validity. Use it only if `delay` is known to be valid. - -#### sdelay_sread(delay) #### - -Returns the value at the delayed position given in argument `delay` -(in seconds). This function uses no interpolation, ie. the position -is truncated to the biggest integer not greater than the real delayed -position. - -This function checks for delay's validity. - -#### sdelay_fsread(delay) #### - -Returns the value at the delayed position given in argument `delay` -(in seconds). This function uses no interpolation, ie. the position -is truncated to the biggest integer not greater than the real delayed -position. - -This function is faster than `sdelay_sread` because there is no check -for delay's validity. Use it only if `delay` is known to be valid. - -#### sdelay_sread2(delay) #### - -Returns the value at the delayed position given in argument `delay` -(in seconds). This function uses a linear interpolation to read the -"true" value for a floating-point sample position. - -This function checks for delay's validity. - -#### sdelay_fsread2(delay) #### - -Returns the value at the delayed position given in argument `delay` -(in seconds). This function uses a linear interpolation to read the -"true" value for a floating-point sample position. - -This function is faster than `sdelay_sread2` because there is no check -for delay's validity. Use it only if `delay` is known to be valid. - -#### sdelay_sread3(delay) #### - -Returns the value at the delayed position given in argument `delay` -(in seconds). This function uses a cubic interpolation to read the -"true" value for a floating-point sample position. - -This function checks for delay's validity. - -#### sdelay_fsread3(delay) #### - -Returns the value at the delayed position given in argument `delay` -(in seconds). This function uses a cubic interpolation to read the -"true" value for a floating-point sample position. - -This function is faster than `sdelay_sread3` because there is no check -for delay's validity. Use it only if `delay` is known to be valid. - -Example -------- - - desc:Smooth Stereo Delay + Feedback - - slider1:250<1,1000>Delay Time (ms) - slider2:0<-1,1>Feedback - slider3:100<1,250>Crossfade Time (ms) - - import cookdsp.jsfx-inc - - @init - // one second stereo delay line - xfade = slider3 * 0.001 * srate; - d0.sdelay(srate, xfade); - d1.sdelay(srate, xfade); - - @slider - // delay time in samples - samps = slider1 * 0.001 * srate; - xfade = slider3 * 0.001 * srate; - d0.sdelay_set_xfade(xfade); - d1.sdelay_set_xfade(xfade); - - @sample - // read with cubic interpolation - val0 = d0.sdelay_read2(samps); - val1 = d1.sdelay_read2(samps); - // write values in delay lines - d0.sdelay_write(spl0 + val0 * slider2); - d1.sdelay_write(spl1 + val1 * slider2); - // sum and output - spl0 = (spl0 + val0) * 0.5; - spl1 = (spl1 + val1) * 0.5; - -********************************************************/ -function _sdelay_compute_time(delay) -( - this.timer == 0 ? ( - this.current = (this.current + 1) % 2; - this.sampdel = floor(delay + 0.5); - this.xfade = floor(this.xfade + 0.5); - this.xfade > this.sampdel ? this.xfade = this.sampdel; - this.xfade <= 0 ? this.xfade = 1; - this.current == 0 ? ( - this.sampdel1 = delay; - this.inc1 = 1.0 / this.xfade; - this.inc2 = -this.inc1; - ) : ( - this.sampdel2 = delay; - this.inc2 = 1.0 / this.xfade; - this.inc1 = -this.inc2; - ); - ); - this.timer += 1; - this.timer == this.sampdel ? this.timer = 0; -); - -function _sdelay_update_amps() -( - this.amp1 += this.inc1; - this.amp1 < 0 ? this.amp1 = 0.0 : this.amp1 > 1 ? this.amp1 = 1.0; - this.amp2 += this.inc2; - this.amp2 < 0 ? this.amp2 = 0.0 : this.amp2 > 1 ? this.amp2 = 1.0; -); - -function sdelay(size xfade) -( - this.delay.delay(size); - this.xfade = xfade; - this.current = 1; - this.timer = 0; - this.amp1 = 0.0; - this.amp2 = 1.0; - this.inc1 = this.inc2 = 0.0; -); - -function sdelay_write(signal) -( - this.delay.delay_write(signal); -); - -function sdelay_set_xfade(xfade) -( - this.xfade = xfade; -); - -function sdelay_read(delay) -( - this._sdelay_compute_time(delay); - val_ = this.delay.delay_read(this.sampdel1) * this.amp1; - val_ += this.delay.delay_read(this.sampdel2) * this.amp2; - this._sdelay_update_amps(); - val_; -); - -function sdelay_fread(delay) -( - this._sdelay_compute_time(delay); - val_ = this.delay.delay_fread(this.sampdel1) * this.amp1; - val_ += this.delay.delay_fread(this.sampdel2) * this.amp2; - this._sdelay_update_amps(); - val_; -); - -function sdelay_sread(delay) -( - this.sdelay_read(delay * srate); -); - -function sdelay_fsread(delay) -( - this.sdelay_fread(delay * srate); -); - -function sdelay_read2(delay) -( - this._sdelay_compute_time(delay); - val_ = this.delay.delay_read2(this.sampdel1) * this.amp1; - val_ += this.delay.delay_read2(this.sampdel2) * this.amp2; - this._sdelay_update_amps(); - val_; -); - -function sdelay_fread2(delay) -( - this._sdelay_compute_time(delay); - val_ = this.delay.delay_fread2(this.sampdel1) * this.amp1; - val_ += this.delay.delay_fread2(this.sampdel2) * this.amp2; - this._sdelay_update_amps(); - val_; -); - -function sdelay_sread2(delay) -( - this.sdelay_read2(delay * srate); -); - -function sdelay_fsread2(delay) -( - this.sdelay_fread2(delay * srate); -); - -function sdelay_read3(delay) -( - this._sdelay_compute_time(delay); - val_ = this.delay.delay_read3(this.sampdel1) * this.amp1; - val_ += this.delay.delay_read3(this.sampdel2) * this.amp2; - this._sdelay_update_amps(); - val_; -); - -function sdelay_fread3(delay) -( - this._sdelay_compute_time(delay); - val_ = this.delay.delay_fread3(this.sampdel1) * this.amp1; - val_ += this.delay.delay_fread3(this.sampdel2) * this.amp2; - this._sdelay_update_amps(); - val_; -); - -function sdelay_sread3(delay) -( - this.sdelay_read3(delay * srate); -); - -function sdelay_fsread3(delay) -( - this.sdelay_fread3(delay * srate); -); diff --git a/FX/BryanChi_FX Devices/cookdsp/dynamics.jsfx-inc b/FX/BryanChi_FX Devices/cookdsp/dynamics.jsfx-inc deleted file mode 100644 index 65881d849..000000000 --- a/FX/BryanChi_FX Devices/cookdsp/dynamics.jsfx-inc +++ /dev/null @@ -1,800 +0,0 @@ -@init - -/******************************************************* -COMPRESS -======== - -Compress an audio signal that rises above a given threshold. - -Description ------------ - -The compress object reduces the volume of loud sounds or amplifies -quiet sounds by narrowing or "compressing" an audio signal's dynamic -range. - -It must be used with a variable name as prefix (object oriented). - -Initializer ------------ - -#### compress(thresh, ratio, attack, release, lookahead) #### - -Initializes a compress object. The `thresh` argument is the -threshold, in dB, where the compression begins. The `ratio` -argument is the amount of compression (with a ratio of 4, if -there is a rise of 8 dB above the threshold in input, the -output signal rises by only 2 dB). The `attack` argument, -in ms, is the upward slope of the internal envelope follower. -The `release` argument, in ms, is the downward slope of the -internal envelope follower. The `lookahead` argument is a -little delay, specified in ms, applied to the signal to -compress in order to synchronize the compressor with the -internal envelope follower. - -Methods -------- - -#### compress_set_thresh(thresh) #### - -Sets a new threshold, in dB, to the compressor. - -#### compress_set_ratio(ratio) #### - -Sets a new compression ratio to the compressor. - -#### compress_set_attack(attack) #### - -Sets a new attack time, in ms, to the internal envelope follower. - -#### compress_set_release(release) #### - -Sets a new release time, in ms, to the internal envelope follower. - -#### compress_set_lookahead(lookahead) #### - -Sets a new delay time, in ms, applied on the signal to compress. - -#### compress_do(signal) #### - -Compress the signal given as argument with the current compressor -state. - -Example -------- - - desc:Two Independant Channels Compression - - import cookdsp.jsfx-inc - - slider1:-30<-70,0>Threshold (dB) - slider2:4<1,20>Ratio - slider3:10<1,150>Attack Time (ms) - slider4:100<1,250>Release Time (ms) - slider5:5<0.5,10>Look Ahead (ms) - slider6:0<-6,18>Post Gain - - @init - cL.compress(slider1, slider2, slider3, slider4, slider5); - cR.compress(slider1, slider2, slider3, slider4, slider5); - - @slider - cL.compress_set_thresh(slider1); - cR.compress_set_thresh(slider1); - cL.compress_set_ratio(slider2); - cR.compress_set_ratio(slider2); - cL.compress_set_attack(slider3); - cR.compress_set_attack(slider3); - cL.compress_set_release(slider4); - cR.compress_set_release(slider4); - cL.compress_set_lookahead(slider5); - cR.compress_set_lookahead(slider5); - gain = pow(10, slider6 * 0.05); - - @sample - spl0 = cL.compress_do(spl0) * gain; - spl1 = cR.compress_do(spl1) * gain; - -********************************************************/ -function compress(thresh ratio attack release lookahead) -( - this.thresh = thresh; this.ratio = ratio; - this.attack = attack; this.release = release; - this.lookahead = lookahead; - this.look.delay(srate/8); - this.y0 = 0.0; - freq_ = 1 / (attack * 0.001); - this.acoeff = exp(-2 * $pi * freq_ / srate); - freq_ = 1 / (release * 0.001); - this.rcoeff = exp(-2 * $pi * freq_ / srate); -); - -function compress_set_thresh(thresh) -( - this.thresh = thresh; -); - -function compress_set_ratio(ratio) -( - this.ratio = ratio; -); - -function compress_set_attack(attack) -( - this.attack = attack; - freq_ = 1 / (attack * 0.001); - this.acoeff = exp(-2 * $pi * freq_ / srate); -); - -function compress_set_release(release) -( - this.release = release; - freq_ = 1 / (release * 0.001); - this.rcoeff = exp(-2 * $pi * freq_ / srate); -); - -function compress_set_lookahead(lookahead) -( - this.lookahead = lookahead; -); - -function compress_do(signal) -( - tmp_ = this.look.delay_fsread2(this.lookahead * 0.001); - this.look.delay_write(signal); - absin_ = abs(signal); - absin_ > this.y0 ? ( - this.y0 = absin_ + (this.y0 - absin_) * this.acoeff; - ) : ( - this.y0 = absin_ + (this.y0 - absin_) * this.rcoeff; - ); - dbin_ = 20 * log10(this.y0 + 0.0000001); - dbin_ > this.thresh ? ( - diff_ = dbin_ - this.thresh; - att_ = pow(10, (diff_ - diff_ / this.ratio) * 0.05); - tmp_ /= att_; - ); - tmp_; -); - -/******************************************************* -STCOMP -====== - -Compress a stereo signal that rises above a given threshold. - -Description ------------ - -The stcomp object reduces the volume of loud sounds or amplifies -quiet sounds by narrowing or "compressing" an audio signal's dynamic -range. It compresses equally the two channels of a stereo signal, -according to an analysis performed on a mix of the two channels. -This preserves the weighting level between the two channels. - -It must be used with a variable name as prefix (object oriented). - -Initializer ------------ - -#### stcomp(thresh, ratio, attack, release, lookahead) #### - -Initializes a stcomp object. The `thresh` argument is the -threshold, in dB, where the compression begins. The `ratio` -argument is the amount of compression (with a ratio of 4, if -there is a rise of 8 dB above the threshold in input, the -output signal rises by only 2 dB). The `attack` argument, -in ms, is the upward slope of the internal envelope follower. -The `release` argument, in ms, is the downward slope of the -internal envelope follower. The `lookahead` argument is a -little delay, specified in ms, applied to the signal to -compress in order to synchronize the compressor with the -internal envelope follower. - -Methods -------- - -#### stcomp_set_thresh(thresh) #### - -Sets a new threshold, in dB, to the compressor. - -#### stcomp_set_ratio(ratio) #### - -Sets a new compression ratio to the compressor. - -#### stcomp_set_attack(attack) #### - -Sets a new attack time, in ms, to the internal envelope follower. - -#### stcomp_set_release(release) #### - -Sets a new release time, in ms, to the internal envelope follower. - -#### stcomp_set_lookahead(lookahead) #### - -Sets a new delay time, in ms, applied on the signals to compress. - -#### stcomp_do(sig0, sig1) #### - -Compress the signals given as argument with the current compressor -state. Compressed signals are saved in `out0` and `out1` attributes. - -Attributes ----------- - -#### stcomp.out0 #### - -Floating-point value that holds the left part of the compressed -stereo signal. - -#### stcomp.out1 #### - -Floating-point value that holds the right part of the compressed -stereo signal. - -Example -------- - - desc:Two Linked Channels Compression - - import cookdsp.jsfx-inc - - slider1:-30<-70,0>Threshold (dB) - slider2:4<1,20>Ratio - slider3:10<1,150>Attack Time (ms) - slider4:100<1,250>Release Time (ms) - slider5:5<0.5,10>Look Ahead (ms) - slider6:0<-6,18>Post Gain - - @init - comp.stcomp(slider1, slider2, slider3, slider4, slider5); - - @slider - comp.stcomp_set_thresh(slider1); - comp.stcomp_set_ratio(slider2); - comp.stcomp_set_attack(slider3); - comp.stcomp_set_release(slider4); - comp.stcomp_set_lookahead(slider5); - gain = pow(10, slider6 * 0.05); - - @sample - comp.stcomp_do(spl0, spl1); - spl0 = comp.out0 * gain; - spl1 = comp.out1 * gain; - -********************************************************/ -function stcomp(thresh ratio attack release lookahead) -( - this.thresh = thresh; this.ratio = ratio; - this.attack = attack; this.release = release; - this.out0 = this.out1 = 0.0; - this.lookahead = lookahead; - this.look0.delay(srate/8); - this.look1.delay(srate/8); - this.y0 = 0.0; - freq_ = 1 / (attack * 0.001); - this.acoeff = exp(-2 * $pi * freq_ / srate); - freq_ = 1 / (release * 0.001); - this.rcoeff = exp(-2 * $pi * freq_ / srate); -); - -function stcomp_set_thresh(thresh) -( - this.thresh = thresh; -); - -function stcomp_set_ratio(ratio) -( - this.ratio = ratio; -); - -function stcomp_set_attack(attack) -( - this.attack = attack; - freq_ = 1 / (attack * 0.001); - this.acoeff = exp(-2 * $pi * freq_ / srate); -); - -function stcomp_set_release(release) -( - this.release = release; - freq_ = 1 / (release * 0.001); - this.rcoeff = exp(-2 * $pi * freq_ / srate); -); - -function stcomp_set_lookahead(lookahead) -( - this.lookahead = lookahead; -); - -function stcomp_do(sig0 sig1) -( - in_ = (sig0 + sig1) * 0.7071; - delInSec_ = this.lookahead * 0.001; - tmp0_ = this.look0.delay_fsread2(delInSec_); - tmp1_ = this.look1.delay_fsread2(delInSec_); - this.look0.delay_write(sig0); - this.look1.delay_write(sig1); - absin_ = abs(in_); - absin_ > this.y0 ? ( - this.y0 = absin_ + (this.y0 - absin_) * this.acoeff; - ) : ( - this.y0 = absin_ + (this.y0 - absin_) * this.rcoeff; - ); - dbin_ = 20 * log10(this.y0 + 0.0000001); - dbin_ > this.thresh ? ( - diff_ = dbin_ - this.thresh; - att_ = pow(10, (diff_ - diff_ / this.ratio) * 0.05); - tmp0_ /= att_; - tmp1_ /= att_; - ); - this.out0 = tmp0_; - this.out1 = tmp1_; -); - -/******************************************************* -GATE -==== - -Allows a signal to pass only when its amplitude is above a threshold. - -Description ------------ - -A noise gate is used when the level of the signal is below the level -of the noise floor. The threshold is set above the level of the noise -and so when there is no signal the gate is closed. A noise gate does -not remove noise from the signal. When the gate is open both the signal -and the noise will pass through. - -It must be used with a variable name as prefix (object oriented). - -Initializer ------------ - -#### gate(thresh, attack, release, lookahead) #### - -Initializes a gate object. The `thresh` argument is the -threshold, in dB, below which the signal is cut. The `attack` -argument, in ms, is the speed of the opening part of the gate. -The `release` argument, in ms, is the speed of the closing -par of the gate. The `lookahead` argument is a little delay, -specified in ms, applied to the signal to gate in order to -synchronize the gate with the internal envelope follower. - -Methods -------- - -#### gate_set_thresh(thresh) #### - -Sets a new threshold, in dB, to the gate. - -#### gate_set_attack(attack) #### - -Sets a new opening time, in ms, to the gate gain curve. - -#### gate_set_release(release) #### - -Sets a new closing time, in ms, to the gate gain curve. - -#### gate_set_lookahead(lookahead) #### - -Sets a new delay time, in ms, applied on the signal to gate. - -#### gate_do(signal) #### - -Cut or let pass the signal given as argument with the current -gate state. - -Example -------- - - desc:Two Independant Channels Gate - - import cookdsp.jsfx-inc - - slider1:-50<-90,-12>Threshold (dB) - slider2:10<1,150>Attack Time (ms) - slider3:50<1,250>Release Time (ms) - slider4:5<0.5,10>Look Ahead (ms) - - @init - gL.gate(slider1, slider2, slider3, slider4); - gR.gate(slider1, slider2, slider3, slider4); - - @slider - gL.gate_set_thresh(slider1); - gR.gate_set_thresh(slider1); - gL.gate_set_attack(slider2); - gR.gate_set_attack(slider2); - gL.gate_set_release(slider3); - gR.gate_set_release(slider3); - gL.gate_set_lookahead(slider4); - gR.gate_set_lookahead(slider4); - - @sample - spl0 = gL.gate_do(spl0); - spl1 = gR.gate_do(spl1); - -********************************************************/ -function gate(thresh attack release lookahead) -( - this.thresh = thresh; this.lookahead = lookahead; - this.attack = attack; this.release = release; - this.fol.follow(20); - this.look.delay(srate/8); - this.amp = this.port = 0; - this.linth = pow(10, this.thresh * 0.05); - freq_ = 1 / (attack * 0.001); - this.acoeff = exp(-2 * $pi * freq_ / srate); - freq_ = 1 / (release * 0.001); - this.rcoeff = exp(-2 * $pi * freq_ / srate); -); - -function gate_set_thresh(thresh) -( - this.thresh = thresh; - this.linth = pow(10, this.thresh * 0.05); -); - -function gate_set_attack(attack) -( - this.attack = attack; - freq_ = 1 / (attack * 0.001); - this.acoeff = exp(-2 * $pi * freq_ / srate); -); - -function gate_set_release(release) -( - this.release = release; - freq_ = 1 / (release * 0.001); - this.rcoeff = exp(-2 * $pi * freq_ / srate); -); - -function gate_set_lookahead(lookahead) -( - this.lookahead = lookahead; -); - -function gate_do(signal) -( - tmp_ = this.look.delay_fsread2(this.lookahead * 0.001); - this.look.delay_write(signal); - this.fol.follow_do(signal) > this.linth ? ( - this.amp = 1.0 + (this.amp - 1.0) * this.acoeff; - ) : ( - this.amp = this.amp * this.acoeff; - ); - tmp_ * this.amp; -); - -/******************************************************* -STGATE -====== - -Allows a stereo signal to pass only when its amplitude is above a threshold. - -Description ------------ - -A noise gate is used when the level of the signal is below the level -of the noise floor. The threshold is set above the level of the noise -and so when there is no signal the gate is closed. A noise gate does -not remove noise from the signal. When the gate is open both the signal -and the noise will pass through. - -It must be used with a variable name as prefix (object oriented). - -Initializer ------------ - -#### stgate(thresh, attack, release, lookahead) #### - -Initializes a gate object for a stereo input. The `thresh` argument -is the threshold, in dB, below which the signal is cut. The `attack` -argument, in ms, is the speed of the opening part of the gate. The -`release` argument, in ms, is the speed of the closing par of the -gate. The `lookahead` argument is a little delay, specified in ms, -applied to the signal to gate in order to synchronize the gate with -the internal envelope follower. - -Methods -------- - -#### stgate_set_thresh(thresh) #### - -Sets a new threshold, in dB, to the gate. - -#### stgate_set_attack(attack) #### - -Sets a new opening time, in ms, to the gate gain curve. - -#### stgate_set_release(release) #### - -Sets a new closing time, in ms, to the gate gain curve. - -#### stgate_set_lookahead(lookahead) #### - -Sets a new delay time, in ms, applied on the signal to gate. - -#### stgate_do(sig0, sig1) #### - -Cut or let pass the signals given as argumenta with the current -gate state. Gated signals are saved in `out0` and `out1` attributes. - -Attributes ----------- - -#### stgate.out0 #### - -Floating-point value that holds the left part of the gated stereo signal. - -#### stgate.out1 #### - -Floating-point value that holds the right part of the gated stereo signal. - -Example -------- - - desc:Two Linked Channels Gate - - import cookdsp.jsfx-inc - - slider1:-50<-90,-12>Threshold (dB) - slider2:10<1,150>Attack Time (ms) - slider3:50<1,250>Release Time (ms) - slider4:5<0.5,10>Look Ahead (ms) - - @init - gt.stgate(slider1, slider2, slider3, slider4); - - @slider - gt.stgate_set_thresh(slider1); - gt.stgate_set_attack(slider2); - gt.stgate_set_release(slider3); - gt.stgate_set_lookahead(slider4); - - @sample - gt.stgate_do(spl0, spl1); - spl0 = gt.out0; - spl1 = gt.out1; - -********************************************************/ -function stgate(thresh attack release lookahead) -( - this.thresh = thresh; this.lookahead = lookahead; - this.attack = attack; this.release = release; - this.fol.follow(20); - this.look0.delay(srate/8); - this.look1.delay(srate/8); - this.amp = this.port = 0; - this.out0 = this.out1 = 0.0; - this.linth = pow(10, this.thresh * 0.05); - freq_ = 1 / (attack * 0.001); - this.acoeff = exp(-2 * $pi * freq_ / srate); - freq_ = 1 / (release * 0.001); - this.rcoeff = exp(-2 * $pi * freq_ / srate); -); - -function stgate_set_thresh(thresh) -( - this.thresh = thresh; - this.linth = pow(10, this.thresh * 0.05); -); - -function stgate_set_attack(attack) -( - this.attack = attack; - freq_ = 1 / (attack * 0.001); - this.acoeff = exp(-2 * $pi * freq_ / srate); -); - -function stgate_set_release(release) -( - this.release = release; - freq_ = 1 / (release * 0.001); - this.rcoeff = exp(-2 * $pi * freq_ / srate); -); - -function stgate_set_lookahead(lookahead) -( - this.lookahead = lookahead; -); - -function stgate_do(sig0 sig1) -( - in_ = (sig0 + sig1) * 0.7071; - delInSec_ = this.lookahead * 0.001; - tmp0_ = this.look0.delay_fsread2(delInSec_); - tmp1_ = this.look1.delay_fsread2(delInSec_); - this.look0.delay_write(sig0); - this.look1.delay_write(sig1); - this.fol.follow_do(in_) > this.linth ? ( - this.amp = 1.0 + (this.amp - 1.0) * this.acoeff; - ) : ( - this.amp = this.amp * this.acoeff; - ); - this.out0 = tmp0_ * this.amp; - this.out1 = tmp1_ * this.amp; -); - -/******************************************************* -EXPAND -====== - -Expand an audio signal that rises above or falls below given thresholds. - -Description ------------ - -The expand object will boost the volume of the input sound if it rises -above the upper threshold. It will also reduce the volume of the input -sound if it falls below the lower threshold. This process will "expand" -the audio signal's dynamic range. - -It must be used with a variable name as prefix (object oriented). - -Initializer ------------ - -#### expand(upthresh, downthresh, ratio, attack, release, lookahead) #### - -Initializes an expand object. The `upthresh` argument is the -threshold, in dB, above which the signal is getting louder, -according to the `ratio`. The `downthresh` argument is the -threshold, in dB, below which the signal is getting softer, -according to the same `ratio` as the upper threshold. The `ratio` -argument is the amount of expansion (with a ratio of 4, if -there is a rise of 2 dB above the upper threshold, the -output signal will rises by 8 dB), and contrary for the lower -threshold. The `attack` argument, in ms, is the upward slope -of the internal envelope follower. The `release` argument, -in ms, is the downward slope of the internal envelope follower. -The `lookahead` argument is a little delay, specified in ms, -applied to the signal to expand in order to synchronize the -expansion with the internal envelope follower. - -Methods -------- - -#### expand_set_upthresh(upthresh) #### - -Sets a new upper threshold, in dB, to the expander. - -#### expand_set_downthresh(downthresh) #### - -Sets a new lower threshold, in dB, to the expander. - -#### expand_set_ratio(ratio) #### - -Sets a new expansion ratio to the expander. - -#### expand_set_attack(attack) #### - -Sets a new attack time, in ms, to the internal envelope follower. - -#### expand_set_release(release) #### - -Sets a new release time, in ms, to the internal envelope follower. - -#### expand_set_lookahead(lookahead) #### - -Sets a new delay time, in ms, applied on the signal to expand. - -#### expand_do(signal) #### - -Expand the signal given as argument with the current expander -state. - -Example -------- - - desc:Two Independant Channels Expansion - - import cookdsp.jsfx-inc - - slider1:-20<-70,0>Upper Threshold (dB) - slider2:-40<-70,0>Lower Threshold (dB) - slider3:2<1,8>Ratio - slider4:25<1,150>Attack Time (ms) - slider5:50<1,250>Release Time (ms) - slider6:-6<-18,6>Post Gain - - @init - cL.expand(slider1, slider2, slider3, slider4, slider5, 5); - cR.expand(slider1, slider2, slider3, slider4, slider5, 5); - - @slider - cL.expand_set_upthresh(slider1); - cR.expand_set_upthresh(slider1); - cL.expand_set_downthresh(slider2); - cR.expand_set_downthresh(slider2); - cL.expand_set_ratio(slider3); - cR.expand_set_ratio(slider3); - cL.expand_set_attack(slider4); - cR.expand_set_attack(slider4); - cL.expand_set_release(slider5); - cR.expand_set_release(slider5); - gain = pow(10, slider6 * 0.05); - - @sample - spl0 = cL.expand_do(spl0) * gain; - spl1 = cR.expand_do(spl1) * gain; - -********************************************************/ -function expand(upthresh downthresh ratio attack release lookahead) -( - this.upthresh = upthresh; this.downthresh = downthresh; - this.attack = attack; this.release = release; - this.lookahead = lookahead; this.ratio = ratio; - this.look.delay(srate/8); - this.yu = this.yd = 0.0; - freq_ = 1 / (attack * 0.001); - this.acoeff = exp(-2 * $pi * freq_ / srate); - freq_ = 1 / (release * 0.001); - this.rcoeff = exp(-2 * $pi * freq_ / srate); -); - -function expand_set_upthresh(upthresh) -( - this.upthresh = upthresh; -); - -function expand_set_downthresh(downthresh) -( - this.downthresh = downthresh; -); - -function expand_set_ratio(ratio) -( - this.ratio = ratio; -); - -function expand_set_attack(attack) -( - this.attack = attack; - freq_ = 1 / (attack * 0.001); - this.acoeff = exp(-2 * $pi * freq_ / srate); -); - -function expand_set_release(release) -( - this.release = release; - freq_ = 1 / (release * 0.001); - this.rcoeff = exp(-2 * $pi * freq_ / srate); -); - -function expand_set_lookahead(lookahead) -( - this.lookahead = lookahead; -); - -function expand_do(signal) -( - tmp_ = this.look.delay_fsread2(this.lookahead * 0.001); - this.look.delay_write(signal); - absin_ = abs(signal); - absin_ > this.yu ? ( // upward expand - this.yu = absin_ + (this.yu - absin_) * this.acoeff; - ) : ( - this.yu = absin_ + (this.yu - absin_) * this.rcoeff; - ); - dbin_ = 20 * log10(this.yu + 0.0000001); - dbin_ > this.upthresh ? ( - diff_ = dbin_ - this.upthresh; - boo_ = pow(10, (diff_ * this.ratio - diff_) * 0.05); - tmp_ *= boo_; - ); - absin_ > this.yd ? ( // downward expand - this.yd = absin_ + (this.yd - absin_) * this.acoeff; - ) : ( - this.yd = absin_ + (this.yd - absin_) * this.rcoeff; - ); - dbin_ = 20 * log10(this.yd + 0.0000001); - dbin_ < this.downthresh ? ( - diff_ = this.downthresh - dbin_; - cut_ = pow(10, (diff_ - diff_ * this.ratio) * 0.05); - tmp_ *= cut_; - ); - tmp_; -); diff --git a/FX/BryanChi_FX Devices/cookdsp/effects.jsfx-inc b/FX/BryanChi_FX Devices/cookdsp/effects.jsfx-inc deleted file mode 100644 index e52ab756e..000000000 --- a/FX/BryanChi_FX Devices/cookdsp/effects.jsfx-inc +++ /dev/null @@ -1,1081 +0,0 @@ -///////////////////////////////////////////////////////////////// -// Copyright (c) - 2014 - Olivier Belanger // -// Permission to use, copy, modify, and/or distribute this // -// software for any purpose with or without fee is hereby // -// granted, provided that the above copyright notice and this // -// permission notice appear in all copies. CookDSP IS PROVIDED // -// "AS IS", WITHOUT WARRANTY OF ANY KIND FROM THE AUTHOR. // -///////////////////////////////////////////////////////////////// - -@init - -/******************************************************* -DISTO -====== - -Arc tangent distortion. - - -Description ------------ - -The disto object applies an arc tangent distortion with controllable -drive to the input signal. - -It must be used with a variable name as prefix (object oriented). - -Initializer ------------ - -#### disto(drive, cutoff) #### - -Initialises a distortion object. `drive` is the amount of distortion -applied to the signal, between 0 and 1 and `cutoff` is the cutoff -frequency (Hz) of a second order lowpass filter applied post process. - -Methods -------- - -#### disto_set_drive(drive) #### - -Sets a new drive, between 0 and 1, to the distortion. - -#### disto_set_cutoff(cutoff) #### - -Sets a new cutoff, in Hz, to the post lowpass filter. - -#### disto_do(signal) #### - -Processes one samples of an input signal `signal` and outputs -the distorted sample. - -Example -------- - - desc:Simple Distortion - - import cookdsp.jsfx-inc - - slider1:0.7<0,1>Drive - slider2:5000<500,10000>Lowpass Cutoff - - @init - disL.disto(slider1, slider2); - disR.disto(slider1, slider2); - - @slider - disL.disto_set_drive(slider1); - disR.disto_set_drive(slider1); - disL.disto_set_cutoff(slider2); - disR.disto_set_cutoff(slider2); - - @sample - amp = scale(slider1, 0, 1, 0.7, 0.4, 2); - spl0 = disL.disto_do(spl0) * amp; - spl1 = disR.disto_do(spl1) * amp; - -********************************************************/ -function disto(drive cutoff) -( - this.ny = srate * 0.49; - drive < 0 ? drive = 0 : drive > 0.998 ? drive = 0.998; - this.drive = drive; - this.d = (2.0 * this.drive) / (1.0 - this.drive); - cutoff < 20 ? cutoff = 20 : cutoff > this.ny ? cutoff = this.ny; - this.cutoff = cutoff; - this.c = exp(-2 * $pi * this.cutoff / srate); - this.y1 = this.y2 = 0.0; -); - -function disto_set_drive(drive) -( - drive < 0 ? drive = 0 : drive > 0.998 ? drive = 0.998; - this.drive = drive; - this.d = (2.0 * this.drive) / (1.0 - this.drive); -); - -function disto_set_cutoff(cutoff) -( - cutoff < 20 ? cutoff = 20 : cutoff > this.ny ? cutoff = this.ny; - this.cutoff = cutoff; - this.c = exp(-2 * $pi * this.cutoff / srate); -); - -function disto_do(signal) -( - tmp_ = (1 + this.d) * signal / (1 + this.d * abs(signal)); - this.y1 = tmp_ + (this.y1 - tmp_) * this.c; - this.y2 = this.y1 + (this.y2 - this.y1) * this.c; - this.y2; -); - -/******************************************************* -HARMON -====== - -Generates harmonizing voices in synchrony with its audio input. - -Description ------------ - -A harmonizer is a pitch shifter that does not stretch the original -sound in time. I works directly on a live input, by overlapping -two time-varying delay lines. - -It must be used with a variable name as prefix (object oriented). - -Initializer ------------ - -#### harmon(transpo, feedback, winsize) #### - -Initializes the harmonizer object with a transposition -factor `transpo`, defined in semitones (-48 to 48). The -`feedback` argument is the amount of output signal sent -back into the delay lines (in the range -1 to 1). The -`winsize` argument is the length of the delay lines (aka -window size) in seconds (must be in the range 0.001 to 1). - -Methods -------- - -#### harmon_set_transpo(transpo) #### - -Sets a new transposition `transpo`, in semitones. - -#### harmon_set_feedback(feedback) #### - -Sets a new feedback `feedback`, between -1 and 1. - -#### harmon_set_winsize(winsize) #### - -Sets a new window size `winsize`, between 0.001 and 1 second. - -#### harmon_do(signal) #### - -Processes one sample of the input signal and returns the -pitch shifted sample. - -Example -------- - - desc:Two Voices Harmonizer - - import cookdsp.jsfx-inc - - slider1:-7<-24,24,1>Transposition Left - slider2:4<-24,24,1>Transposition Right - slider3:0<-1,1>Feedback Level - slider4:0.1<0.001,1>Window Size In Seconds - - @init - h1.harmon(slider1, slider3, slider4); - h2.harmon(slider2, slider3, slider4); - - @slider - h1.harmon_set_transpo(slider1); - h2.harmon_set_transpo(slider2); - h1.harmon_set_feedback(slider3); - h2.harmon_set_feedback(slider3); - h1.harmon_set_winsize(slider4); - h2.harmon_set_winsize(slider4); - - @sample - spl0 += h1.harmon_do(spl0); - spl1 += h2.harmon_do(spl1); - spl0 *= 0.5; spl1 *= 0.5; - -********************************************************/ -function harmon(transpo feedback winsize) -( - transpo < -48 ? transpo = -48 : transpo > 48 ? transpo = 48; - this.transpo = transpo; - feedback < -1 ? feedback = -1 : feedback > 1 ? feedback = 1; - this.feedback = feedback; - winsize < 0.001 ? winsize = 0.001 : winsize > 1 ? winsize = 1; - this.winsize = winsize; - this.env.buffer(2048); - this.env.buffer_window(6); - this.env.buffer_normalize(0.7); - this.ratio = pow(2., this.transpo / 12.); - this.rate = -(this.ratio-1) / this.winsize; - this.ph.phasor(this.rate, 0); - this.del.delay(srate); -); - -function harmon_set_transpo(transpo) -( - transpo < -48 ? transpo = -48 : transpo > 48 ? transpo = 48; - this.transpo = transpo; - this.ratio = pow(2., this.transpo / 12.); - this.rate = -(this.ratio-1) / this.winsize; - this.ph.phasor_set_freq(this.rate); -); - -function harmon_set_feedback(feedback) -( - feedback < -1 ? feedback = -1 : feedback > 1 ? feedback = 1; - this.feedback = feedback; -); - -function harmon_set_winsize(winsize) -( - winsize < 0.001 ? winsize = 0.001 : winsize > 1 ? winsize = 1; - this.winsize = winsize; - this.rate = -(this.ratio-1) / this.winsize; - this.ph.phasor_set_freq(this.rate); -); - -function harmon_do(signal) -( - ph1_ = this.ph.phasor_do(); - val1_ = this.del.delay_fsread3(ph1_ * this.winsize) * this.env.buffer_fnread2(ph1_); - ph2_ = wrap(ph1_ + 0.5, 0, 1); - val2_ = this.del.delay_fsread3(ph2_ * this.winsize) * this.env.buffer_fnread2(ph2_); - val_ = val1_ + val2_; - this.del.delay_write(signal + val_ * this.feedback); - val_; -); - -/******************************************************* -VOCODER -======= - -Applies the spectral envelope of a first sound to the spectrum of a second sound. - -Description ------------ - -The vocoder is an analysis/synthesis system, historically used to reproduce -human speech. In the encoder, the first input (spectral envelope) is passed -through a multiband filter, each band is passed through an envelope follower, -and the control signals from the envelope followers are communicated to the -decoder. The decoder applies these (amplitude) control signals to corresponding -filters modifying the second source (exciter). - -It must be used with a variable name as prefix (object oriented). - -Initializer ------------ - -#### vocoder(basefreq, freqspread, q, slope, stages) #### - -Initializes the vocoder object. The `basefreq` argument is the center -frequency of the first band. This frequency is used to compute the upper -band frequencies. The `freqspread` argument is the spreading factor used -to compute the upper band frequencies (in relation to `basefreq`). Each -band has a frequency according to the relation `basefreq * pow(order, freqspread)`, -where order is the harmonic rank of the band. The `q` argument is the Q of the -filters (the inverse of the bandwidth). Higher values imply more resonance -around the center frequency of the filters. The `slope` argument is the time -response of the envelope follower. Lower values mean smoother changes, -while higher values mean a better time accuracy. The `stages` argument is the -number of bands in the filter bank. Defines the number of notches in the spectrum. -The number of bands is only available at initialization time. - -Methods -------- - -#### vocoder_set_basefreq(basefreq) #### - -Sets a new base frequency `basefreq`, in hz, and re-compute the filters -coefficients. - -#### vocoder_set_freqspread(freqspread) #### - -Sets a new frequency spread `freqspread` and re-compute the filters -coefficients. - -#### vocoder_set_q(q) #### - -Sets a new filter Q `q` and re-compute the filters coefficients. - -#### vocoder_do(signal, excite) #### - -Apply the spectrum envelope of the signal `signal` onto the spectrum of -the signal `excite` and returns the resulting signal. - -Example -------- - - desc:Stereo Vocoder - - import cookdsp.jsfx-inc - - slider1:80<40,300>Base Frequency (Hz) - slider2:1.2<0.5,2>Frequency Spread - slider3:50<1,200>Filters Q - slider4:0.5<0,1>Follower Slope - slider5:24<4,64,1>Number of Bands (init only) - - @init - voc0.vocoder(slider1, slider2, slider3, slider4, slider5); - voc1.vocoder(slider1, slider2, slider3, slider4, slider5); - - @slider - voc0.vocoder_set_basefreq(slider1); - voc1.vocoder_set_basefreq(slider1); - voc0.vocoder_set_freqspread(slider2); - voc1.vocoder_set_freqspread(slider2); - voc0.vocoder_set_q(slider3); - voc1.vocoder_set_q(slider3); - voc0.vocoder_set_slope(slider4); - voc1.vocoder_set_slope(slider4); - - @sample - // Use white noise as exciter - noise = rand(2) - 1; - spl0 = voc0.vocoder_do(spl0, noise); - spl1 = voc1.vocoder_do(spl1, noise); - -********************************************************/ -function _vocoder_compute_coeffs() -( - c_ = 0; - loop(this.stages, - f_ = this.basefreq * pow(c_+1, this.freqspread); - f_ < 10 ? f_ = 10 : f_ > this.ny ? f_ = this.ny; - bw_ = f_ / this.q; - this.cB2[c_] = exp(-2 * $pi / srate * bw_); - this.cB1[c_] = (-4.0 * this.cB2[c_]) / (1.0 + this.cB2[c_]) * cos(2 * $pi * f_ / srate); - this.cA1[c_] = 1.0 - sqrt(this.cB2[c_]); - c_ += 1; - ); -); - -function vocoder(basefreq freqspread q slope stages) -( - this.ny = srate * 0.49; - this.stages = stages; - this.slope = slope; - this.q = q; - this.freqspread = freqspread; - this.basefreq = basefreq; - this.aX1 = memalloc(this.stages); - this.aX2 = memalloc(this.stages); - this.aY1 = memalloc(this.stages); - this.aY2 = memalloc(this.stages); - this.sX1 = memalloc(this.stages); - this.sX2 = memalloc(this.stages); - this.sY1 = memalloc(this.stages); - this.sY2 = memalloc(this.stages); - this.cA1 = memalloc(this.stages); - this.cB1 = memalloc(this.stages); - this.cB2 = memalloc(this.stages); - this.fY1 = memalloc(this.stages); - this.follF = pow(this.slope, 3) * 99.5 + 0.5; - this.fC = exp(-2 * $pi * this.follF / srate); - this._vocoder_compute_coeffs(); -); - -function vocoder_set_basefreq(basefreq) -( - basefreq != this.basefreq ? ( - this.basefreq = basefreq; - this._vocoder_compute_coeffs(); - ); -); - -function vocoder_set_freqspread(freqspread) -( - freqspread != this.freqspread ? ( - this.freqspread = freqspread; - this._vocoder_compute_coeffs(); - ); -); - -function vocoder_set_q(q) -( - q != this.q ? ( - this.q = q; - this._vocoder_compute_coeffs(); - ); -); - -function vocoder_set_slope(slope) -( - slope != this.slope ? ( - this.slope = slope; - this.follF = pow(this.slope, 3) * 99.5 + 0.5; - this.fC = exp(-2 * $pi * this.follF / srate); - ); -); - -function vocoder_do(signal excite) -( - c_ = 0; - output_ = 0; - loop(this.stages, - // Analysis - anal_ = (this.cA1[c_] * signal) - (this.cA1[c_] * this.aX2[c_]) - (this.cB1[c_] * this.aY1[c_]) - (this.cB2[c_] * this.aY2[c_]); - this.aX2[c_] = this.aX1[c_]; this.aX1[c_] = signal; this.aY2[c_] = this.aY1[c_]; this.aY1[c_] = anal_; - // Synthesis - synt_ = (this.cA1[c_] * excite) - (this.cA1[c_] * this.sX2[c_]) - (this.cB1[c_] * this.sY1[c_]) - (this.cB2[c_] * this.sY2[c_]); - this.sX2[c_] = this.sX1[c_]; this.sX1[c_] = excite; this.sY2[c_] = this.sY1[c_]; this.sY1[c_] = synt_; - // Envelope follower - anal_ < 0 ? anal_ = -anal_; - this.fY1[c_] = anal_ + (this.fY1[c_] - anal_) * this.fC; - // Output accumulator - output_ += synt_ * this.fY1[c_]; - c_ += 1; - ); - output_ * this.q; -); - -/******************************************************* -WGVERB -====== - -8 delay lines mono FDN reverb. - -Description ------------ - -8 delay lines FDN (Feedback Delay Network) reverb, with feedback matrix -based upon physical modeling scattering junction of 8 lossless waveguides -of equal characteristic impedance. - -It must be used with a variable name as prefix (object oriented). - -Initializer ------------ - -#### wgverb(feed, cutoff, bal) #### - -Initializes the `wgverb` object with a feedback factor `feed`, -defined between 0 and 1. The `cutoff` argument is the cutoff -frequency of the internal lowpass filters. The `bal` argument -allows to control the balance between the dry signal (bal=0) -and the reverberated one (bal=1). - -Methods -------- - -#### wgverb_set_feed(feed) #### - -Sets a new feedbakc factor `feed`, between 0 and 1. - -#### wgverb_set_cutoff(cutoff) #### - -Sets a new lowpass cutoff frequency `cutoff`, in Hz. - -#### wgverb_set_bal(bal) #### - -Sets a new balance factor `bal`, between 0 and 1. - -#### wgverb_do(signal) #### - -Processes one sample of the input signal and returns the -reverberated sample. - -Example -------- - - desc:Simple Reverberation - - import cookdsp.jsfx-inc - - slider1:0.75<0,1>Feedback - slider2:5000<200,10000>Cutoff - slider3:0.25<0,1>Balance - slider4:0.3<0,1>Post-Gain - - @init - revL.wgverb(slider1, slider2, slider3); - revR.wgverb(slider1, slider2, slider3); - - @slider - revL.wgverb_set_feed(slider1); - revR.wgverb_set_feed(slider1); - revL.wgverb_set_cutoff(slider2); - revR.wgverb_set_cutoff(slider2); - revL.wgverb_set_bal(slider3); - revR.wgverb_set_bal(slider3); - - @sample - spl0 = revL.wgverb_do(spl0) * slider4; - spl1 = revR.wgverb_do(spl1) * slider4; - -********************************************************/ -function _wgverb_init() -( - r1_ = 0.001 * srate / 4; - r2_ = 0.0011 * srate / 4; - r3_ = 0.0017 * srate / 4; - r4_ = 0.0006 * srate / 4; - r5_ = 0.0013 * srate / 4; - r6_ = 0.0009 * srate / 4; - r7_ = 0.0016 * srate / 4; - r8_ = 0.0005 * srate / 4; - this.r1.random(-r1_, r1_, 1.51, 0); - this.r2.random(-r2_, r2_, 2.5, 0); - this.r3.random(-r3_, r3_, 0.911, 0); - this.r4.random(-r4_, r4_, 2.473, 0); - this.r5.random(-r5_, r5_, 1.141, 0); - this.r6.random(-r6_, r6_, 0.497, 0); - this.r7.random(-r7_, r7_, 0.391, 0); - this.r8.random(-r8_, r8_, 1.621, 0); - this.t1 = 2473 * (srate / 44100.); - this.t2 = 2767 * (srate / 44100.); - this.t3 = 3217 * (srate / 44100.); - this.t4 = 3557 * (srate / 44100.); - this.t5 = 3907 * (srate / 44100.); - this.t6 = 4127 * (srate / 44100.); - this.t7 = 2143 * (srate / 44100.); - this.t8 = 1933 * (srate / 44100.); - this.d1.delay(ceil(this.t1 + 0.002 * srate)); - this.d2.delay(ceil(this.t2 + 0.002 * srate)); - this.d3.delay(ceil(this.t3 + 0.002 * srate)); - this.d4.delay(ceil(this.t4 + 0.002 * srate)); - this.d5.delay(ceil(this.t5 + 0.002 * srate)); - this.d6.delay(ceil(this.t6 + 0.002 * srate)); - this.d7.delay(ceil(this.t7 + 0.002 * srate)); - this.d8.delay(ceil(this.t8 + 0.002 * srate)); -); - -function wgverb(feed cutoff bal) -( - this.ny = srate / 2; - feed < 0 ? feed = 0 : feed > 1 ? feed = 1; - this.feed = feed; - cutoff < 20 ? cutoff = 20 : cutoff > this.ny ? cutoff = this.ny; - this.cutoff = cutoff; - bal < 0 ? bal = 0 : bal > 1 ? bal = 1; - this.bal = bal; - - this.c2 = exp(-2 * $pi * this.cutoff / srate); - this.ys = memalloc(8); - this._wgverb_init(); - this.total = 0.0; -); - -function wgverb_set_feed(feed) -( - feed < 0 ? feed = 0 : feed > 1 ? feed = 1; - this.feed = feed; -); - -function wgverb_set_cutoff(cutoff) -( - cutoff < 20 ? cutoff = 20 : cutoff > this.ny ? cutoff = this.ny; - this.cutoff = cutoff; - this.c2 = exp(-2 * $pi * this.cutoff / srate); -); - -function wgverb_set_bal(bal) -( - bal < 0 ? bal = 0 : bal > 1 ? bal = 1; - this.bal = bal; -); - -function wgverb_do(signal) -( - junc_ = this.total * 0.25; - this.total = 0.0; - - v_ = this.d1.delay_fread2(this.t1 + this.r1.random_do()); - v_ *= this.feed; - v_ += (this.ys[0] - v_) * this.c2; - this.total += v_; - this.d1.delay_write(signal + junc_ - this.ys[0]); - this.ys[0] = v_; - - v1_ = this.d2.delay_fread2(this.t2 + this.r2.random_do()); - v_ *= this.feed; - v_ += (this.ys[1] - v_) * this.c2; - this.total += v_; - this.d2.delay_write(signal + junc_ - this.ys[1]); - this.ys[1] = v_; - - v_ = this.d3.delay_fread2(this.t3 + this.r3.random_do()); - v_ *= this.feed; - v_ += (this.ys[2] - v_) * this.c2; - this.total += v_; - this.d3.delay_write(signal + junc_ - this.ys[2]); - this.ys[2] = v_; - - v_ = this.d4.delay_fread2(this.t4 + this.r4.random_do()); - v_ *= this.feed; - v_ += (this.ys[3] - v_) * this.c2; - this.total += v_; - this.d4.delay_write(signal + junc_ - this.ys[3]); - this.ys[3] = v_; - - v_ = this.d5.delay_fread2(this.t5 + this.r5.random_do()); - v_ *= this.feed; - v_ += (this.ys[4] - v_) * this.c2; - this.total += v_; - this.d5.delay_write(signal + junc_ - this.ys[4]); - this.ys[4] = v_; - - v_ = this.d6.delay_fread2(this.t6 + this.r6.random_do()); - v_ *= this.feed; - v_ += (this.ys[5] - v_) * this.c2; - this.total += v_; - this.d6.delay_write(signal + junc_ - this.ys[5]); - this.ys[5] = v_; - - v_ = this.d7.delay_fread2(this.t7 + this.r7.random_do()); - v_ *= this.feed; - v_ += (this.ys[6] - v_) * this.c2; - this.total += v_; - this.d7.delay_write(signal + junc_ - this.ys[6]); - this.ys[6] = v_; - - v_ = this.d8.delay_fread2(this.t8 + this.r8.random_do()); - v_ *= this.feed; - v_ += (this.ys[7] - v_) * this.c2; - this.total += v_; - this.d8.delay_write(signal + junc_ - this.ys[7]); - this.ys[7] = v_; - - rev_ = this.total * 0.25; - signal + (rev_ - signal) * this.bal; -); - -/******************************************************* -CHORUS -====== - -8 modulated delay lines chorus processor. - -Description ------------ - -A chorus effect occurs when individual sounds with roughly -the same timbre and nearly (but never exactly) the same pitch -converge and are perceived as one. - -It must be used with a variable name as prefix (object oriented). - -Initializer ------------ - -#### chorus(depth feed bal) #### - -Initializes the chorus object with a depth factor `depth`, -between 0 and 2, which is how deep are the delay line modulation. -The `feed` argument is the amount of a delay line output signal -from a delay sent back into its input (in the range -1 to 1). -The `bal` argument is the balance between the dry signal (0) -and the wet signal (1). - -Methods -------- - -#### chorus_set_depth(depth) #### - -Sets a new depth factor `depth`, between 0 and 2. - -#### chorus_set_feed(feed) #### - -Sets a new feedback factor `feed`, between -1 and 1. - -#### chorus_set_bal(bal) #### - -Sets a new balance `bal`, between 0 and 1. - -#### chorus_do(signal) #### - -Processes one sample of the input signal and returns the -chorused sample. - -Example -------- - - desc:Stereo Chorus - - import cookdsp.jsfx-inc - - slider1:0.75<0,2,0.01>Depth - slider2:0.25<-1,1,0.01>Feedback - slider3:0.6<0,1,0.01>Balance - - @init - c1.chorus(slider1, slider3, slider4); - c2.chorus(slider2, slider3, slider4); - - @slider - c1.chorus_set_depth(slider1); - c2.chorus_set_depth(slider1); - c1.chorus_set_feed(slider2); - c2.chorus_set_feed(slider2); - c1.chorus_set_bal(slider3); - c2.chorus_set_bal(slider3); - - @sample - spl0 = c1.chorus_do(spl0); - spl1 = c2.chorus_do(spl1); - -********************************************************/ -function chorus(depth feed bal) -( - depth < 0 ? depth = 0 : depth > 2 ? depth = 2; - this.depth = depth; - feed < -1 ? feed = -1 : feed > 1 ? feed = 1; - this.feed = feed; - bal < 0 ? bal = 0 : bal > 1 ? bal = 1; - this.bal = bal; - - maxSize_ = srate / 4; - this.d1.delay(maxSize_); - this.d2.delay(maxSize_); - this.d3.delay(maxSize_); - this.d4.delay(maxSize_); - this.d5.delay(maxSize_); - this.d6.delay(maxSize_); - this.d7.delay(maxSize_); - this.d8.delay(maxSize_); - - this.lfo1.sine(.254 * (rand(.1) + 0.95), 0); - this.lfo2.sine(.465 * (rand(.1) + 0.95), 0); - this.lfo3.sine(.657 * (rand(.1) + 0.95), 0); - this.lfo4.sine(.879 * (rand(.1) + 0.95), 0); - this.lfo5.sine(1.23 * (rand(.1) + 0.95), 0); - this.lfo6.sine(1.342 * (rand(.1) + 0.95), 0); - this.lfo7.sine(1.654 * (rand(.1) + 0.95), 0); - this.lfo8.sine(1.879 * (rand(.1) + 0.95), 0); - - this.center1 = 0.0087 * (rand(.1) + 0.95); - this.center2 = 0.0102 * (rand(.1) + 0.95); - this.center3 = 0.0111 * (rand(.1) + 0.95); - this.center4 = 0.0125 * (rand(.1) + 0.95); - this.center5 = 0.0134 * (rand(.1) + 0.95); - this.center6 = 0.0151 * (rand(.1) + 0.95); - this.center7 = 0.0171 * (rand(.1) + 0.95); - this.center8 = 0.0179 * (rand(.1) + 0.95); - - this.depth1 = 0.001 * this.depth; - this.depth2 = 0.0012 * this.depth; - this.depth3 = 0.0013 * this.depth; - this.depth4 = 0.0014 * this.depth; - this.depth5 = 0.0015 * this.depth; - this.depth6 = 0.0016 * this.depth; - this.depth7 = 0.002 * this.depth; - this.depth8 = 0.0023 * this.depth; -); - -function chorus_set_depth(depth) -( - depth < 0 ? depth = 0 : depth > 2 ? depth = 2; - this.depth = depth; - this.depth1 = 0.001 * this.depth; - this.depth2 = 0.0012 * this.depth; - this.depth3 = 0.0013 * this.depth; - this.depth4 = 0.0014 * this.depth; - this.depth5 = 0.0015 * this.depth; - this.depth6 = 0.0016 * this.depth; - this.depth7 = 0.002 * this.depth; - this.depth8 = 0.0023 * this.depth; -); - -function chorus_set_feed(feed) -( - feed < -1 ? feed = -1 : feed > 1 ? feed = 1; - this.feed = feed; -); - -function chorus_set_bal(bal) -( - bal < 0 ? bal = 0 : bal > 1 ? bal = 1; - this.bal = bal; -); - -function chorus_do(signal) -( - read1_ = this.d1.delay_fsread2(this.lfo1.sine_do() * this.depth1 + this.center1); - read2_ = this.d2.delay_fsread2(this.lfo2.sine_do() * this.depth2 + this.center2); - read3_ = this.d3.delay_fsread2(this.lfo3.sine_do() * this.depth3 + this.center3); - read4_ = this.d4.delay_fsread2(this.lfo4.sine_do() * this.depth4 + this.center4); - read5_ = this.d5.delay_fsread2(this.lfo5.sine_do() * this.depth5 + this.center5); - read6_ = this.d6.delay_fsread2(this.lfo6.sine_do() * this.depth6 + this.center6); - read7_ = this.d7.delay_fsread2(this.lfo7.sine_do() * this.depth7 + this.center7); - read8_ = this.d8.delay_fsread2(this.lfo8.sine_do() * this.depth8 + this.center8); - - this.d1.delay_write(signal + read1_ * this.feed); - this.d2.delay_write(signal + read2_ * this.feed); - this.d3.delay_write(signal + read3_ * this.feed); - this.d4.delay_write(signal + read4_ * this.feed); - this.d5.delay_write(signal + read5_ * this.feed); - this.d6.delay_write(signal + read6_ * this.feed); - this.d7.delay_write(signal + read7_ * this.feed); - this.d8.delay_write(signal + read8_ * this.feed); - - sum_ = (read1_+read2_+read3_+read4_+read5_+read6_+read7_+read8_) * 0.125; - - signal + (sum_ - signal) * this.bal; -); - -/******************************************************* -FLANGER -======= - -Periodically swept delay line comb filter. - -Description ------------ - -A flanger is an audio effect produced by mixing two identical signals -together, one signal delayed by a small and gradually changing period. -This produces a swept comb filter effect: peaks and notches are produced -in the resulting frequency spectrum, related to each other in a linear -harmonic series. - -It must be used with a variable name as prefix (object oriented). - -Initializer ------------ - -#### flanger(freq cdelay depth feed) #### - -Initializes the flanger object with a center delay line (mid-point) -of length `cdelay`, in milliseconds (between 0 and 20). The depth -factor `depth`, between 0 and 1, is how deep are the delay line -modulation. The `feed` argument is the amount of the output signal -sent back into the delay line (in the range -1 to 1). A sine -oscillator of frequency `freq` modulates the delay time to -produce the swept comb filter effect. - -Methods -------- - -#### flanger_set_freq(freq) #### - -Sets a new frequency `freq` in Hz. - -#### flanger_set_cdelay(cdelay) #### - -Sets a new central delay `cdelay`, in ms, between 0 and 20. - -#### flanger_set_depth(depth) #### - -Sets a new depth factor `depth`, between 0 and 1. - -#### flanger_set_feed(feed) #### - -Sets a new feedback factor `feed`, between -1 and 1. - -#### flanger_do(signal) #### - -Processes one sample of the input signal and returns the -flanged sample. - -Example -------- - - desc:Stereo Flanger - - import cookdsp.jsfx-inc - - slider1:0.1<0.001,2>Frequency (Hz) - slider2:5<0,10,0.01>Central delay (ms) - slider3:0.99<0,1,0.001>Depth - slider4:0.25<-1,1,0.01>Feedback - - @init - c1.flanger(slider1, slider2, slider3, slider4); - c2.flanger(slider2, slider2, slider3, slider4); - - @slider - c1.flanger_set_freq(slider1); - c2.flanger_set_freq(slider1); - c1.flanger_set_cdelay(slider2); - c2.flanger_set_cdelay(slider2); - c1.flanger_set_depth(slider3); - c2.flanger_set_depth(slider3); - c1.flanger_set_feed(slider4); - c2.flanger_set_feed(slider4); - - @sample - spl0 = c1.flanger_do(spl0); - spl1 = c2.flanger_do(spl1); - -********************************************************/ -function flanger(freq cdelay depth feed) -( - this.freq = freq; - cdelay < 0 ? cdelay = 0 : cdelay > 20 ? cdelay = 20; - this.cdelay = cdelay; - depth < 0 ? depth = 0 : depth > 1 ? depth = 1; - this.depth = depth; - feed < -1 ? feed = -1 : feed > 1 ? feed = 1; - this.feed = feed; - - this.line.delay(srate / 10); - this.lfo.sine(this.freq, 0); -); - -function flanger_set_freq(freq) -( - this.freq = freq; - this.lfo.sine_set_freq(this.freq); -); - -function flanger_set_cdelay(cdelay) -( - cdelay < 0 ? cdelay = 0 : cdelay > 20 ? cdelay = 20; - this.cdelay = cdelay; -); - -function flanger_set_depth(depth) -( - depth < 0 ? depth = 0 : depth > 1 ? depth = 1; - this.depth = depth; -); - -function flanger_set_feed(feed) -( - feed < -1 ? feed = -1 : feed > 1 ? feed = 1; - this.feed = feed; -); - -function flanger_do(signal) -( - sec_ = this.cdelay * 0.001; - read_ = this.line.delay_fsread2(sec_ + this.lfo.sine_do() * this.depth * sec_); - this.line.delay_write(signal + read_ * this.feed); - (signal + read_) * 0.5; -); - -/******************************************************* -WAVEGUIDE -========= - -Basic waveguide model. - -Description ------------ - -This waveguide model consisting of one delay-line with a simple -lowpass filtering and lagrange interpolation. - -It must be used with a variable name as prefix (object oriented). - -Initializer ------------ - -#### waveguide(freq dur) #### - -Initializes the waveguide object with a fundamental frequency, -in cycle per second (i.e. the inverse of delay time), of `freq`. -The duration `dur`, in seconds, indicates the time it takes to -the waveguide to drop 40 dB below it's maxima. - -Methods -------- - -#### waveguide_set_freq(freq) #### - -Sets a new frequency `freq` in Hz. - -#### waveguide_set_dur(dur) #### - -Sets a new duration `dur`, in seconds, for the waveguide to -drop 40 dB below it's maxima. - -#### waveguide_do(signal) #### - -Processes one sample of the input signal and returns the -resonating sample. - -Example -------- - - desc:Resonator Bank - - import cookdsp.jsfx-inc - - slider1:80<20,600>Frequency 1 (Hz) - slider2:160<20,600>Frequency 2 (Hz) - slider3:200<20,600>Frequency 3 (Hz) - slider4:240<20,600>Frequency 4 (Hz) - slider5:20<1,30,0.01>Tail Duration (sec) - - @init - c1.waveguide(slider1, slider5); - c2.waveguide(slider2, slider5); - c3.waveguide(slider3, slider5); - c4.waveguide(slider4, slider5); - - @slider - c1.waveguide_set_freq(slider1); - c2.waveguide_set_freq(slider2); - c3.waveguide_set_freq(slider3); - c4.waveguide_set_freq(slider4); - c1.waveguide_set_dur(slider5); - c2.waveguide_set_dur(slider5); - c3.waveguide_set_dur(slider5); - c4.waveguide_set_dur(slider5); - - @sample - spl0 *= 0.05; - spl1 *= 0.05; - spl0 = c1.waveguide_do(spl0) + c3.waveguide_do(spl0); - spl1 = c2.waveguide_do(spl1) + c4.waveguide_do(spl1); - -********************************************************/ -function _waveguide_set_coeffs() -( - this.sampdel = srate / this.freq - 0.5; - this.isampdel = floor(this.sampdel); - frac_ = this.sampdel - this.isampdel; - this.coeff0 = (frac_-1)*(frac_-2)*(frac_-3)*(frac_-4)/24.0; - this.coeff1 = -frac_*(frac_-2)*(frac_-3)*(frac_-4)/6.0; - this.coeff2 = frac_*(frac_-1)*(frac_-3)*(frac_-4)/4.0; - this.coeff3 = -frac_*(frac_-1)*(frac_-2)*(frac_-4)/6.0; - this.coeff4 = frac_*(frac_-1)*(frac_-2)*(frac_-3)/24.0; -); - -function waveguide(freq dur) -( - freq < 20 ? freq = 20 : freq > srate/4 ? freq = srate/4; - this.freq = freq; - dur < 0.1 ? dur = 0.1; - this.dur = dur; - - this.lpsamp = this.dcx = this.dcy = 0; - this.lagrange0 = this.lagrange1 = this.lagrange2 = this.lagrange3 = 0; - this.feed = pow(100, -1.0 / (this.freq * this.dur)); - this.line.delay(srate / 20 + 8); - this._waveguide_set_coeffs(); -); - -function waveguide_set_freq(freq) -( - freq < 20 ? freq = 20 : freq > srate/4 ? freq = srate/4; - freq != this.freq ? ( - this.freq = freq; - this.feed = pow(100, -1.0 / (this.freq * this.dur)); - this._waveguide_set_coeffs(); - ); -); - -function waveguide_set_dur(dur) -( - dur < 0.1 ? dur = 0.1; - this.dur = dur; - this.feed = pow(100, -1.0 / (this.freq * this.dur)); -); - -function waveguide_do(signal) -( - read_ = this.line.delay_fread(this.isampdel); - - val_ = (read_ + this.lpsamp) * 0.5; - this.lpsamp = read_; - - x_ = val_ * this.coeff0 + this.lagrange0 * this.coeff1 + - this.lagrange1 * this.coeff2 + this.lagrange2 * this.coeff3 + - this.lagrange3 * this.coeff4; - this.lagrange3 = this.lagrange2; - this.lagrange2 = this.lagrange1; - this.lagrange1 = this.lagrange0; - this.lagrange0 = val_; - - y_ = x_ - this.dcx + 0.995 * this.dcy; - this.dcx = x_; - this.dcy = y_; - - this.line.delay_write(signal + x_ * this.feed); - y_; -); diff --git a/FX/BryanChi_FX Devices/cookdsp/fft-mono-template b/FX/BryanChi_FX Devices/cookdsp/fft-mono-template deleted file mode 100644 index 57a9f1873..000000000 --- a/FX/BryanChi_FX Devices/cookdsp/fft-mono-template +++ /dev/null @@ -1,43 +0,0 @@ -desc:FFT Mono Template - -import cookdsp.jsfx-inc - -slider1:5<0,8,1{32,64,128,256,512,1024,2048,4096,8192}>FFT Size -slider2:1<0,2,1{2,4,8}>Overlaps -slider3:1<0,3,1{hamming,hanning,bartlett,blackman}>Window Shape -// Effect's specific sliders here... - -@init -size = pow(2, slider1+5); -olaps = pow(2, slider2+1); -fin.fftin(size, olaps, slider3); -fout.fftout(size, olaps, slider3); - -@slider -size = pow(2, slider1+5); -olaps = pow(2, slider2+1); -// If fftsize or overlaps changed, re-initialize FFTs. -size != fin.size || olaps != fin.olaps ? ( - fin.fftin_resize(size, olaps); - fout.fftout_resize(size, olaps); - // Initialize effect's specific memories here... - -); -// Generate a new window if slider3 has changed. -slider3 != fin.window ? ( - fin.fftin_set_window(slider3); - fout.fftout_set_window(slider3); -); -// Process effect's specific sliders here... - -@sample -// Input / Output -fin.fftin_do(spl0); -spl0 = fout.fftout_get_output(fin.count); - -fin.ready ? ( - // New buffers ready for processing. - // ... A simple thru... - // compute the inverse FFT. - fout.fftout_do(fin.real, fin.imag); -); diff --git a/FX/BryanChi_FX Devices/cookdsp/fft-stereo-template b/FX/BryanChi_FX Devices/cookdsp/fft-stereo-template deleted file mode 100644 index fce3c30ca..000000000 --- a/FX/BryanChi_FX Devices/cookdsp/fft-stereo-template +++ /dev/null @@ -1,53 +0,0 @@ -desc: FFT Stereo Template - -import cookdsp.jsfx-inc - -slider1:5<0,8,1{32,64,128,256,512,1024,2048,4096,8192}>FFT Size -slider2:1<0,2,1{2,4,8}>Overlaps -slider3:1<0,3,1{hamming,hanning,bartlett,blackman}>Window Shape -// Effect's specific sliders here... - -@init -size = pow(2, slider1+5); -olaps = pow(2, slider2+1); -fin.fftin(size, olaps, slider3); -fin2.fftin(size, olaps, slider3); -fout.fftout(size, olaps, slider3); -fout2.fftout(size, olaps, slider3); - -@slider -size = pow(2, slider1+5); -olaps = pow(2, slider2+1); -// If fftsize or overlaps changed, re-initialize FFTs. -size != fin.size || olaps != fin.olaps ? ( - fin.fftin_resize(size, olaps); - fin2.fftin_resize(size, olaps); - fout.fftout_resize(size, olaps); - fout2.fftout_resize(size, olaps); - // Initialize effect's specific memories here... - -); -// Generate a new window if slider3 has changed. -slider3 != fin.window ? ( - fin.fftin_set_window(slider3); - fin2.fftin_set_window(slider3); - fout.fftout_set_window(slider3); - fout2.fftout_set_window(slider3); -); -// Process effect's specific sliders here... - -@sample -// Input / Output -fin.fftin_do(spl0); -fin2.fftin_do(spl1); -spl0 = fout.fftout_get_output(fin.count); -spl1 = fout2.fftout_get_output(fin2.count); - -fin.ready ? ( - // New buffers ready for processing. - // ... A simple thru... - // compute the inverse FFT. - fout.fftout_do(fin.real, fin.imag); - fout2.fftout_do(fin2.real, fin2.imag); -); - diff --git a/FX/BryanChi_FX Devices/cookdsp/fftobjects.jsfx-inc b/FX/BryanChi_FX Devices/cookdsp/fftobjects.jsfx-inc deleted file mode 100644 index ac3b5b259..000000000 --- a/FX/BryanChi_FX Devices/cookdsp/fftobjects.jsfx-inc +++ /dev/null @@ -1,1440 +0,0 @@ -@init - -// Sorensen in-place split-radix FFT for real values. -// -// data before process {array of doubles}: -// *re(0), re(1), re(2), ..., re(size-1)* -// -// data after process {array of doubles}: -// *re(0), re(1), re(2), ..., re(size/2), im(size/2-1), ..., im(1)* -// -// Output data is normalized by array length. -// -// Source: -// Sorensen et al: *Real-Valued Fast Fourier Transform Algorithms*, -// IEEE Trans. ASSP, ASSP-35, No. 6, June 1987 -// -// Implementation in C by Toth Laszlo, 97.05.29 -// -// Transposed to jsfx language by Olivier Belanger 2014.06.11 -// -// Original file can be found on musicdsp.org : -// http://www.musicdsp.org/archive.php?classid=2#79 -/////////////////////////////////////////////////////////////////// -function realfft(data n twiddle) -( - isqrt2 = 1.0 / 1.4142135623730951; // 1/sqrt(2.0) - n4 = n - 1; - nn8 = n >> 3; - - // data shuffling - i = j = 0; - n2 = n/2; - while (i < n4) ( - i < j ? ( - t1 = data[j]; - data[j] = data[i]; - data[i] = t1; - ); - k = n2; - while (k <= j) ( - j -= k; - k = k >> 1; - ); - j += k; - i += 1; - ); - - // length two butterflies - i0 = 0; - id = 4; - while ( - while (i0 < n4) ( - i1 = i0 + 1; - t1 = data[i0]; - data[i0] = t1 + data[i1]; - data[i1] = t1 - data[i1]; - i0 += id; - ); - id = id << 1; - i0 = id - 2; - id = id << 1; - i0 < n4; - ); - - // L shaped butterflies - n2 = 2; - k = n; - while (k > 2) ( - n2 = n2 << 1; // power of two from 4 to n - n4 = n2 >> 2; - n8 = n2 >> 3; - pas = n / n2; - i1 = 0; - id = n2 << 1; - while ( - while (i1 < n) ( - i2 = i1 + n4; - i3 = i2 + n4; - i4 = i3 + n4; - t1 = data[i4] + data[i3]; - data[i4] -= data[i3]; - data[i3] = data[i1] - t1; - data[i1] += t1; - n4 != 1 ? ( - i0 = i1 + n8; - i2 += n8; - i3 += n8; - i4 += n8; - t1 = (data[i3] + data[i4]) * isqrt2; - t2 = (data[i3] - data[i4]) * isqrt2; - data[i4] = data[i2] - t1; - data[i3] = -data[i2] - t1; - data[i2] = data[i0] - t2; - data[i0] += t2; - ); - i1 += id; - ); - id = id << 1; - i1 = id - n2; - id = id << 1; - i1 < n; - ); - j = 2; - while (j <= n8) ( - pos = (j-1) * pas; - cc1 = twiddle[pos]; - ss1 = twiddle[nn8+pos]; - cc3 = twiddle[nn8*2+pos]; - ss3 = twiddle[nn8*3+pos]; - i = 0; - id = n2 << 1; - while ( - while (i < n) ( - i1 = i + j - 1; - i2 = i1 + n4; - i3 = i2 + n4; - i4 = i3 + n4; - i5 = i + n4 - j + 1; - i6 = i5 + n4; - i7 = i6 + n4; - i8 = i7 + n4; - t1 = data[i3] * cc1 + data[i7] * ss1; - t2 = data[i7] * cc1 - data[i3] * ss1; - t3 = data[i4] * cc3 + data[i8] * ss3; - t4 = data[i8] * cc3 - data[i4] * ss3; - t5 = t1 + t3; - t6 = t2 + t4; - t3 = t1 - t3; - t4 = t2 - t4; - t2 = data[i6] + t6; - data[i3] = t6 - data[i6]; - data[i8] = t2; - t2 = data[i2] - t3; - data[i7] = -data[i2] - t3; - data[i4] = t2; - t1 = data[i1] + t5; - data[i6] = data[i1] - t5; - data[i1] = t1; - t1 = data[i5] + t4; - data[i5] -= t4; - data[i2] = t1; - i += id; - ); - id = id << 1; - i = id - n2; - id = id << 1; - i < n; - ); - j += 1; - ); - k = k >> 1; - ); - - // division with array length - norm = 1 / n; - i = 0; - loop(n, - data[i] *= norm; - i += 1; - ); -); - -// Sorensen in-place inverse split-radix FFT for real values. -// -// data before process {array of doubles}: -// *re(0), re(1), re(2), ..., re(size/2), im(size/2-1), ..., im(1)* -// -// data after process {array of doubles}: -// *re(0), re(1), re(2), ..., re(size-1)* -// -// Processed data is NOT normalized by array length. -// -// Source: -// Sorensen et al: *Real-Valued Fast Fourier Transform Algorithms*, -// IEEE Trans. ASSP, ASSP-35, No. 6, June 1987 -// -// Implementation in C by Toth Laszlo, 97.05.29 -// -// Transposed to jsfx language by Olivier Belanger 2014.06.11 -// -// Original file can be found on musicdsp.org : -// http://www.musicdsp.org/archive.php?classid=2#79 -/////////////////////////////////////////////////////////////////// -function irealfft(data size twiddle) -( - isqrt2 = 1.0 / 1.4142135623730951; // 1/sqrt(2.0) - n = size; - nn8 = n >> 3; - n1 = n - 1; - n2 = n << 1; - k = n; - while (k > 2) ( - id = n2; - n2 = n2 >> 1; - n4 = n2 >> 2; - n8 = n2 >> 3; - pas = n / n2; - i1 = 0; - while ( - while (i1 < n) ( - i2 = i1 + n4; - i3 = i2 + n4; - i4 = i3 + n4; - t1 = data[i1] - data[i3]; - data[i1] += data[i3]; - data[i2] *= 2; - data[i3] = t1 - 2 * data[i4]; - data[i4] = t1 + 2 * data[i4]; - n4 != 1 ? ( - i0 = i1 + n8; - i2 += n8; - i3 += n8; - i4 += n8; - t1 = (data[i2] - data[i0]) * isqrt2; - t2 = (data[i4] + data[i3]) * isqrt2; - data[i0] += data[i2]; - data[i2] = data[i4] - data[i3]; - data[i3] = 2 * (-t2 - t1); - data[i4] = 2 * (-t2 + t1); - ); - i1 += id; - ); - id = id << 1; - i1 = id - n2; - id = id << 1; - i1 < n1 - ); - j = 2; - while (j <= n8) ( - pos = (j-1) * pas; - cc1 = twiddle[pos]; - ss1 = twiddle[nn8+pos]; - cc3 = twiddle[nn8*2+pos]; - ss3 = twiddle[nn8*3+pos]; - i = 0; - id = n2 << 1; - while ( - while (i < n) ( - i1 = i + j - 1; - i2 = i1 + n4; - i3 = i2 + n4; - i4 = i3 + n4; - i5 = i + n4 - j + 1; - i6 = i5 + n4; - i7 = i6 + n4; - i8 = i7 + n4; - t1 = data[i1] - data[i6]; - data[i1] += data[i6]; - t2 = data[i5] - data[i2]; - data[i5] += data[i2]; - t3 = data[i8] + data[i3]; - data[i6] = data[i8] - data[i3]; - t4 = data[i4] + data[i7]; - data[i2] = data[i4] - data[i7]; - t5 = t1 - t4; - t1 += t4; - t4 = t2 - t3; - t2 += t3; - data[i3] = t5 * cc1 + t4 * ss1; - data[i7] = -t4 * cc1 + t5 * ss1; - data[i4] = t1 * cc3 - t2 * ss3; - data[i8] = t2 * cc3 + t1 * ss3; - i += id; - ); - id = id << 1; - i = id - n2; - id = id << 1; - i < n1; - ); - j += 1; - ); - k = k >> 1; - ); - - i0 = 0; - id = 4; - while ( - while (i0 < n1) ( - i1 = i0 + 1; - t1 = data[i0]; - data[i0] = t1 + data[i1]; - data[i1] = t1 - data[i1]; - i0 += id; - ); - id = id << 1; - i0 = id - 2; - id = id << 1; - i0 < n1; - ); - - // data shuffling - i = j = 0; - n2 = n / 2; - while (i < n1) ( - i < j ? ( - t1 = data[j]; - data[j] = data[i]; - data[i] = t1; - ); - k = n2; - while (k <= j) ( - j -= k; - k = k >> 1; - ); - j += k; - i += 1; - ); -); - -/******************************************************* -FFTIN -===== - -Apply a Fast Fourier Transform analysis on an input signal. - -Description ------------ - -The `fftin` object transforms an audio signal into its spectral -representation. The real and imaginary part from the analysis -are stored in the `real` and `imag` internal arrays. - -Initializer ------------ - -#### fftin(size, olaps, [window]) #### - -Initializes a Fast Fourier Transform algorithm. The FFT size, in -samples, given by the `size` argument, must be a power of two. -The `olaps` argument specifies the number of overlapping analysis. -There will be an output analysis every `size / olaps` samples. The -`window` argument, as an integer, gives the shape of the analysis -envelope (see `buffer` object for the available windows). The default -is a hanning window. - -Methods -------- - -#### fftin_resize(size, olaps) #### - -Resizes internal memories of the FFT agorithm with the new `size` -and `olaps` factors. The corresponding `fftout` object (and every -processes in between) should always use the same size and number -of overlaps. - -#### fftin_set_window(window) #### - -Sets a new analysis window. See `buffer` object for the available -windows. - -#### fftin_do(signal) #### - -Processes one sample of the input `signal` and updates the `count` -and `ready` attributes of the object. The `count` attribute should -be used to retrieve the current resynthesized sample from a `fftout` -object. The `ready` attribute indicates when `real` and `imag` buffers -are ready to be processed. - -Attributes ----------- - -#### fftin.ready #### - -This attribute will have a value of 1 when a new frame (`real` -and `imag` buffers) is ready to be processed. This will happen -every `size / olaps` samples. Otherwise, the `ready` attribute -holds a value of 0. - -#### fftin.count #### - -This attribute holds the current analysis sample count. It can -used to retrieve the current output sample from a `fftout` object. - -#### fftin.real #### - -Buffer that holds the real part of the analysis. Indexes run from -0 to half the FFT size. - -#### fftin.imag #### - -Buffer that holds the imaginary part of the analysis. Indexes run -from 0 to half the FFT size. - -Example -------- - - desc:FFT Randomizer - - import cookdsp.jsfx-inc - - // FFT parameters (only FFT Size for the example). - slider1:5<0,8,1{32,64,128,256,512,1024,2048,4096,8192}>FFT Size - // Effect's specific slider - slider2:10<1,100,1>How Many Bins - - @init - size = pow(2, slider1+5); - // Initialize FFT with 4 overlaps and hanning window - fin.fftin(size, 4); - fout.fftout(size, 4); - real = memalloc(size/2); - imag = memalloc(size/2); - - @slider - size = pow(2, slider1+5); - // If fftsize or overlaps changed, re-initialize FFTs. - size != fin.size ? ( - fin.fftin_resize(size, 4); - fout.fftout_resize(size, 4); - // Initialize effect's specific memories - real = memalloc(size/2); - imag = memalloc(size/2); - ); - - @sample - // Compute FFT on both channels at the same time to save space - fin.fftin_do((spl0 + spl1) * 0.707); - spl0 = spl1 = fout.fftout_get_output(fin.count); - - fin.ready ? ( // New buffers ready for processing. - // Resets output buffers to zeros - memset(real, 0, size/2); - memset(imag, 0, size/2); - // Choose randomly "slider2" bins to output - loop(slider2, - bin = rand(size/2); - real[bin] = fin.real[bin]; - imag[bin] = fin.imag[bin]; - ); - // compute the inverse FFT. - fout.fftout_do(real, imag); - ); - -********************************************************/ -// private fft window generator -function _fft_generate_window(window) -( - this.wind.buffer(this.size); - this.wind.buffer_window(window); - this.window = window; -); - -// private twiddle generator function -function _fft_generate_twiddle() -( - n8 = this.size >> 3; - e = 2.0 * $pi / this.size; - a = e; - j = 2; - while (j <= n8) ( - a3 = 3 * a; - this.twiddle[j-1] = cos(a); - this.twiddle[n8+j-1] = sin(a); - this.twiddle[n8*2+j-1] = cos(a3); - this.twiddle[n8*3+j-1] = sin(a3); - a = j * e; - j += 1; - ); -); - -// private fftin initialization function -function _fftin_init(size, olaps, window) -( - // init variables - this.ready = 0; - this.size = size; - this.olaps = olaps; - this.hsize = this.size / 2; - this.hopsize = this.size / this.olaps; - this.inputLatency = this.size - this.hopsize; - this.incount = this.inputLatency; - this.count = 0; - this.overcount = 0; - // init memories - this.inbuf = memalloc(this.size); - this.frame = memalloc(this.size); - this.real = memalloc(this.hsize); - this.imag = memalloc(this.hsize); - this.twiddle = memalloc(4 * (this.size >> 3)); - this._fft_generate_window(window); - this._fft_generate_twiddle(); -); - -function fftin(size olaps window) -( - this._fftin_init(size, olaps, window); -); - -function fftin(size olaps) -( - this._fftin_init(size, olaps, 1); -); - -function fftin_resize(size olaps) -( - this._fftin_init(size, olaps, this.window); -); - -function fftin_set_window(window) -( - this._fft_generate_window(window); -); - -function fftin_do(signal) -( - this.ready = 0; - this.count = this.incount - this.inputLatency; - this.inbuf[this.incount] = signal; - this.incount += 1; - this.incount >= this.size ? ( - this.ready = 1; - this.incount = this.inputLatency; - mod_ = this.hopsize * this.overcount; - k_ = 0; - loop(this.size, - this.frame[(k_+mod_)%this.size] = this.inbuf[k_] * this.wind.buffer_fread(k_); - k_ += 1; - ); - realfft(this.frame, this.size, this.twiddle); - this.real[0] = this.frame[0]; this.imag[0] = 0.0; - k_ = 1; - while (k_ < this.hsize) ( - this.real[k_] = this.frame[k_]; this.imag[k_] = this.frame[this.size - k_]; - k_ += 1; - ); - k_ = 0; - while (k_ < this.inputLatency) ( - this.inbuf[k_] = this.inbuf[k_ + this.hopsize]; - k_ += 1; - ); - this.overcount += 1; - this.overcount >= this.olaps ? this.overcount = 0; - ); -); - -/******************************************************* -FFTOUT -====== - -Apply an Inverse Fast Fourier Transform on an analysis signal. - -Description ------------ - -The `fftout` object converts the spectral representation of a signal -into its temporal form (real signal). It takes a real and imaginary -parts, coming from an FFT process, to compute the inverse FFT and -return the corresponding audio signal. - -Initializer ------------ - -#### fftout(size, olaps, [window]) #### - -Initializes an Inverse Fast Fourier Transform algorithm. The FFT size, -in samples, given by the `size` argument, must be a power of two. -The `olaps` argument specifies the number of overlapping analysis. -There will be a sample block outputted every `size / olaps` samples. -The `window` argument, as an integer, gives the shape of the analysis -envelope (see `buffer` object for the available windows). The default -is a hanning window. - -Methods -------- - -#### fftout_resize(size, olaps) #### - -Resizes internal memories of the FFT agorithm with the new `size` -and `olaps` factors. The corresponding `fftin` object (and every -processes in between) should always use the same size and number -of overlaps. - -#### fftout_set_window(window) #### - -Sets a new analysis window. See `buffer` object for the available -windows. - -#### fftout_get_output(count) #### - -Use this function to retrieve the output sample, from the -Inverse Fast Fourier Transform, at the position `count`. If -the position comes from the `count` attribute of a `fftin` -object, the current output sample will be retrieved. - -#### fftout_do(real, imag) #### - -Computes an Inverse Fast Fourier Transform with the arrays -`real` and `imag`. This function should be called only when -the `fftin` attribute `ready` is 1. - -Example -------- - - desc:FFT Comb Filter - - import cookdsp.jsfx-inc - - // FFT parameters (only FFT Size for the example). - slider1:5<0,8,1{32,64,128,256,512,1024,2048,4096,8192}>FFT Size - // Effect's specific slider. - slider2:2<2,100,1>Bin Step - - @init - size = pow(2, slider1+5); - // Initialize FFT with 4 overlaps and hanning window - fin.fftin(size, 4); - fout.fftout(size, 4); - real = memalloc(size/2); - imag = memalloc(size/2); - - @slider - size = pow(2, slider1+5); - // If size changed, re-initialize FFTs. - size != fin.size ? ( - fin.fftin_resize(size, 4); - fout.fftout_resize(size, 4); - // Initialize effect's specific memories - real = memalloc(size/2); - imag = memalloc(size/2); - ); - - @sample - // Compute FFT on both channels at the same time to save space - fin.fftin_do((spl0 + spl1) * 0.707); - spl0 = spl1 = fout.fftout_get_output(fin.count); - - fin.ready ? ( // New buffers ready for processing. - k = 0; - while (k < size/2) ( - // Passes the signal only for bins that are multiples of slider2 value - k % slider2 == 0 ? ( - real[k] = fin.real[k]; - imag[k] = fin.imag[k]; - ) : ( - real[k] = imag[k] = 0; - ); - k += 1; - ); - // compute the inverse FFT. - fout.fftout_do(real, imag); - ); - -********************************************************/ -// private fftout initialization function -function _fftout_init(size, olaps, window) -( - // init variables - this.size = size; - this.olaps = olaps; - this.ampscl = 1.0 / sqrt(olaps); - this.hsize = this.size / 2; - this.hopsize = this.size / this.olaps; - this.overcount = 0; - // init memories - this.outbuf = memalloc(this.size); - this.frame = memalloc(this.size); - this.accum = memalloc(this.size + this.hopsize); - this.twiddle = memalloc(4 * (this.size >> 3)); - this._fft_generate_window(window); - this._fft_generate_twiddle(); -); - -function fftout(size olaps window) -( - this._fftout_init(size, olaps, window); -); - -function fftout(size olaps) -( - this._fftout_init(size, olaps, 1); -); - -function fftout_resize(size olaps) -( - this._fftout_init(size, olaps, this.window); -); - -function fftout_set_window(window) -( - this._fft_generate_window(window); -); - -function fftout_get_output(count) -( - // count is fftin.count - this.outbuf[count]; -); - -// call fftout_do only when fftin.ready is true -function fftout_do(real imag) -( - mod_ = this.hopsize * this.overcount; - this.frame[0] = real[0]; this.frame[this.hsize] = 0.0; - k_ = 1; - while (k_ < this.hsize) ( - this.frame[k_] = real[k_]; this.frame[this.size - k_] = imag[k_]; - k_ += 1; - ); - irealfft(this.frame, this.size, this.twiddle); - k_ = 0; - while (k_ < this.size) ( - this.accum[k_] += this.frame[(k_+mod_)%this.size] * this.ampscl * this.wind.buffer_fread(k_); - k_ += 1; - ); - k_ = 0; - while (k_ < this.hopsize) ( - this.outbuf[k_] = this.accum[k_]; - k_ += 1; - ); - k_ = 0; - while (k_ < this.size) ( - this.accum[k_] = this.accum[k_ + this.hopsize]; - k_ += 1; - ); - this.overcount += 1; - this.overcount >= this.olaps ? this.overcount = 0; -); - -/******************************************************* -FFTBRICK -======== - -Apply a brickwall filter on a FFT analysis signal. - -Description ------------ - -The `fftbrick` object takes a complex signal in input (real -and imaginary parts of a FFT spectral analysis) and applies -either a lowpass or a highpass brickwall filter on it. - -Initializer ------------ - -#### fftbrick(freq, type, size) #### - -Initializes either a lowpass or a highpass filter, accroding -to the `type` argument (0 means a lowpass, 1 means a highpass), -with `freq` argument as the cutoff frequency, in Hz. The `size` -argument is the length of the `real` and `imag` arrays, -usually half the FFT analysis size. - -Methods -------- - -#### fftbrick_resize(size) #### - -Resizes internal memories of the process with the new `size`. -The size of a FFT process must be half the size of the FFT -used to analyse to input signal. This is the size of the real -and imaginary buffers. - -#### fftbrick_set_freq(freq) #### - -Sets a new cutoff frequency `freq`, in Hz. - -#### fftbrick_set_type(type) #### - -Sets a new filter type. 0 means a lowpass filter and 1 means a -highpass filter. - -#### fftbrick_do(real, imag) #### - -Computes one frame of the process on a complex signal (`real` and -`imag` are the real and imaginary parts coming from a `fftin` or -any FFT processing object). The internal `real` and `imag` buffers -hold the processed complex signal. This function should be called -only when the `ready` attribute of a `fftin` object has a value of 1. - -Attributes ----------- - -#### fftbrick.real #### - -Buffer that holds the real part of the process. Indexes run from -0 to the process size (usually half the FFT size). - -#### fftbrick.imag #### - -Buffer that holds the imaginary part of the process. Indexes run -from 0 to the process size (usually half the FFT size). - -Example -------- - - desc:FFT Stereo BrickWall Filter - - import cookdsp.jsfx-inc - - // FFT parameters (only FFT Size for the example). - slider1:5<0,8,1{32,64,128,256,512,1024,2048,4096,8192}>FFT Size - // Effect's specific sliders. - slider2:1000<100,18000>Filter Frequency - slider3:0<0,1,1{Lowpass,Highpass}>Filter Type - - @init - size = pow(2, slider1+5); - fin.fftin(size, 4); - fin2.fftin(size, 4); - fout.fftout(size, 4); - fout2.fftout(size, 4); - brk.fftbrick(slider2, slider3, size/2); - brk2.fftbrick(slider2, slider3, size/2); - - @slider - size = pow(2, slider1+5); - // If size changed, re-initialize FFTs. - size != fin.size ? ( - fin.fftin_resize(size, 4); - fin2.fftin_resize(size, 4); - fout.fftout_resize(size, 4); - fout2.fftout_resize(size, 4); - // Initialize effect's specific memories. - brk.fftbrick_resize(size/2); - brk2.fftbrick_resize(size/2); - ); - // If cutoff frequency changed. - slider2 != brk.freq ? ( - brk.fftbrick_set_freq(slider2); - brk2.fftbrick_set_freq(slider2); - ); - brk.fftbrick_set_type(slider3); - brk2.fftbrick_set_type(slider3); - - @sample - // Input / Output - fin.fftin_do(spl0); - fin2.fftin_do(spl1); - spl0 = fout.fftout_get_output(fin.count); - spl1 = fout2.fftout_get_output(fin2.count); - - fin.ready ? ( - // New buffers ready for processing. - brk.fftbrick_do(fin.real, fin.imag); - brk2.fftbrick_do(fin2.real, fin2.imag); - // compute the inverse FFT. - fout.fftout_do(brk.real, brk.imag); - fout2.fftout_do(brk2.real, brk2.imag); - ); - -********************************************************/ -function fftbrick(freq type size) -( - this.ny = srate / 0.49; - freq < 20 ? freq = 20 : freq > this.ny ? freq = this.ny; - this.freq = freq; - type < 0 ? type = 0 : type > 1 ? type = 1; - this.type = type; - this.size = size; - this.factor = this.size * 2.0 / srate; - this.bin = floor(this.freq * this.factor + 0.5); - this.real = memalloc(size); - this.imag = memalloc(size); -); - -function fftbrick_set_freq(freq) -( - freq < 20 ? freq = 20 : freq > this.ny ? freq = this.ny; - this.freq = freq; - this.bin = floor(this.freq * this.factor + 0.5); -); - -function fftbrick_set_type(type) -( - type < 0 ? type = 0 : type > 1 ? type = 1; - this.type = type; -); - -function fftbrick_resize(size) -( - this.size = size; - this.factor = this.size * 2.0 / srate;; - this.bin = floor(this.freq * this.factor + 0.5); - this.real = memalloc(size); - this.imag = memalloc(size); -); - -function fftbrick_do(real imag) -( - k_ = 0; - this.type == 0 ? ( - // Lowpass - while (k_ < this.bin) ( - this.real[k_] = real[k_]; this.imag[k_] = imag[k_]; - k_ += 1; - ); - while (k_ < this.size) ( - this.real[k_] = 0.0; this.imag[k_] = 0.0; - k_ += 1; - ); - ) : ( - // Highpass - while (k_ < this.bin) ( - this.real[k_] = 0.0; this.imag[k_] = 0.0; - k_ += 1; - ); - while (k_ < this.size) ( - this.real[k_] = real[k_]; this.imag[k_] = imag[k_]; - k_ += 1; - ); - ); -); - -/******************************************************* -FFTBAND -======= - -Apply a bandpass filter on a FFT analysis signal. - -Description ------------ - -The `fftband` object takes a complex signal in input (real -and imaginary parts of a FFT spectral analysis) and applies -either a bandpass or a bandstop brickwall filter on it. - -Initializer ------------ - -#### fftband(freq, bw, type, size) #### - -Initializes either a bandpass or a bandstop filter, accroding -to the `type` argument (0 means a bandpass, 1 means a bandstop), -with `freq` argument as the center frequency and `bw` argument -as the filter's bandwidth, both in Hz. The `size` argument is -the length of the `real` and `imag` arrays, usually half the -FFT analysis size. - -Methods -------- - -#### fftband_resize(size) #### - -Resizes internal memories of the process with the new `size`. -The size of a FFT process must be half the size of the FFT -used to analyse to input signal. This is the size of the real -and imaginary buffers. - -#### fftband_set_freq(freq) #### - -Sets a new center frequency `freq`, in Hz. - -#### fftband_set_bw(bw) #### - -Sets a new filter's bandwidth `bw`, in Hz. - -#### fftband_set_type(type) #### - -Sets a new filter type. 0 means a bandpass filter and 1 means -a bandstop filter. - -#### fftband_do(real, imag) #### - -Computes one frame of the process on a complex signal (`real` and -`imag` are the real and imaginary parts coming from a `fftin` or -any FFT processing object). The internal `real` and `imag` buffers -hold the processed complex signal. This function should be called -only when the `ready` attribute of a `fftin` object has a value of 1. - -Attributes ----------- - -#### fftband.real #### - -Buffer that holds the real part of the process. Indexes run from -0 to the process size (usually half the FFT size). - -#### fftband.imag #### - -Buffer that holds the imaginary part of the process. Indexes run -from 0 to the process size (usually half the FFT size). - -Example -------- - - desc:FFT Stereo Bandpass/Bandstop Filter - - import cookdsp.jsfx-inc - - // FFT parameters (only FFT Size for the example). - slider1:5<0,8,1{32,64,128,256,512,1024,2048,4096,8192}>FFT Size - // Effect's specific sliders. - slider2:1000<100,18000>Filter Frequency (Hz) - slider3:500<10,10000>Filter Bandwidth (Hz) - slider4:0<0,1,1{Bandpass,Bandstop}>Filter Type - - @init - size = pow(2, slider1+5); - fin.fftin(size, 4); - fin2.fftin(size, 4); - fout.fftout(size, 4); - fout2.fftout(size, 4); - filt.fftband(slider2, slider3, slider4, size/2); - filt2.fftband(slider2, slider3, slider4, size/2); - - @slider - size = pow(2, slider1+5); - // If size changed, re-initialize FFTs. - size != fin.size ? ( - fin.fftin_resize(size, 4); - fin2.fftin_resize(size, 4); - fout.fftout_resize(size, 4); - fout2.fftout_resize(size, 4); - // Initialize effect's specific memories. - filt.fftband_resize(size/2); - filt2.fftband_resize(size/2); - ); - // If center frequency changed. - slider2 != filt.freq ? ( - filt.fftband_set_freq(slider2); - filt2.fftband_set_freq(slider2); - ); - // If bandwidth changed. - slider3 != filt.bw ? ( - filt.fftband_set_bw(slider3); - filt2.fftband_set_bw(slider3); - ); - filt.fftband_set_type(slider4); - filt2.fftband_set_type(slider4); - - @sample - // Input / Output - fin.fftin_do(spl0); - fin2.fftin_do(spl1); - spl0 = fout.fftout_get_output(fin.count); - spl1 = fout2.fftout_get_output(fin2.count); - - fin.ready ? ( - // New buffers ready for processing. - filt.fftband_do(fin.real, fin.imag); - filt2.fftband_do(fin2.real, fin2.imag); - // compute the inverse FFT. - fout.fftout_do(filt.real, filt.imag); - fout2.fftout_do(filt2.real, filt2.imag); - ); - -********************************************************/ -function fftband(freq bw type size) -( - this.ny = srate / 0.49; - this.ny2 = this.ny / 2; - freq < 20 ? freq = 20 : freq > this.ny ? freq = this.ny; - this.freq = freq; - bw < 5 ? bw = 5 : bw > this.ny2 ? bw = this.ny2; - this.bw = bw; - type < 0 ? type = 0 : type > 1 ? type = 1; - this.type = type; - this.size = size; - this.factor = this.size * 2.0 / srate; - this.bin1 = floor((this.freq - (this.bw / 2)) * this.factor + 0.5); - this.bin2 = floor((this.freq + (this.bw / 2)) * this.factor + 0.5); - this.real = memalloc(size); - this.imag = memalloc(size); -); - -function fftband_set_freq(freq) -( - freq < 20 ? freq = 20 : freq > this.ny ? freq = this.ny; - this.freq = freq; - this.bin1 = floor((this.freq - (this.bw / 2)) * this.factor + 0.5); - this.bin2 = floor((this.freq + (this.bw / 2)) * this.factor + 0.5); -); - -function fftband_set_bw(bw) -( - bw < 5 ? bw = 5 : bw > this.ny2 ? bw = this.ny2; - this.bw = bw; - this.bin1 = floor((this.freq - (this.bw / 2)) * this.factor + 0.5); - this.bin2 = floor((this.freq + (this.bw / 2)) * this.factor + 0.5); -); - -function fftband_set_type(type) -( - type < 0 ? type = 0 : type > 1 ? type = 1; - this.type = type; -); - -function fftband_resize(size) -( - this.size = size; - this.factor = this.size * 2.0 / srate; - this.bin1 = floor((this.freq - (this.bw / 2)) * this.factor + 0.5); - this.bin2 = floor((this.freq + (this.bw / 2)) * this.factor + 0.5); - this.real = memalloc(size); - this.imag = memalloc(size); -); - -function fftband_do(real imag) -( - k_ = 0; - this.type == 0 ? ( - // Bandpass - while (k_ < this.bin1) ( - this.real[k_] = 0.0; this.imag[k_] = 0.0; - k_ += 1; - ); - while (k_ < this.bin2) ( - this.real[k_] = real[k_]; this.imag[k_] = imag[k_]; - k_ += 1; - ); - while (k_ < this.size) ( - this.real[k_] = 0.0; this.imag[k_] = 0.0; - k_ += 1; - ); - ) : ( - // Bandstop - while (k_ < this.bin1) ( - this.real[k_] = real[k_]; this.imag[k_] = imag[k_]; - k_ += 1; - ); - while (k_ < this.bin2) ( - this.real[k_] = 0.0; this.imag[k_] = 0.0; - k_ += 1; - ); - while (k_ < this.size) ( - this.real[k_] = real[k_]; this.imag[k_] = imag[k_]; - k_ += 1; - ); - ); -); - -/******************************************************* -FFTFILTER -========= - -Filters an FFT-analysed signal according to the values in an array. - -Description ------------ - -The `fftfilter` object takes a complex signal in input (real -and imaginary parts of a FFT spectral analysis) and weights -every bins according to the values stored in an array. - -Initializer ------------ - -#### fftfilter(filtarray, size) #### - -Initializes the spectral filter with an argument `filtarray`, which -is the first position of an array of amplitude values. The array -length must equal or greater than the object's size. The `size` -argument is the length of the `real` and `imag` arrays, usually -half the FFT analysis size. - -Methods -------- - -#### fftfilter_resize(size) #### - -Resizes internal memories of the process with the new `size`. -The size of a FFT process must be half the size of the FFT -used to analyse to input signal. This is the size of the real -and imaginary buffers. - -#### fftfilter_set_filtarray(filtarray) #### - -Sets a new amplitude array. - -#### fftfilter_do(real, imag) #### - -Computes one frame of the process on a complex signal (`real` and -`imag` are the real and imaginary parts coming from a `fftin` or -any FFT processing object). The internal `real` and `imag` buffers -hold the processed complex signal. This function should be called -only when the `ready` attribute of a `fftin` object has a value of 1. - -Attributes ----------- - -#### fftfilter.real #### - -Buffer that holds the real part of the process. Indexes run from -0 to the process size (usually half the FFT size). - -#### fftfilter.imag #### - -Buffer that holds the imaginary part of the process. Indexes run -from 0 to the process size (usually half the FFT size). - -Example -------- - - desc:Spectral Filter - - import cookdsp.jsfx-inc - - // FFT parameters (only FFT Size for the example). - slider1:5<0,8,1{32,64,128,256,512,1024,2048,4096,8192}>FFT Size - - @init - function rand_filter(filtarray size) - ( - // Generate a random filter - k = 0; - while (k < size) ( - val = min(rand(1), rand(1)); - filtarray[k] = val; - k += 1; - ) - ); - - size = pow(2, slider1+5); - hsize = size / 2; - fin.fftin(size, 4); - fin2.fftin(size, 4); - fout.fftout(size, 4); - fout2.fftout(size, 4); - filter = memalloc(hsize); - filt.fftfilter(filter, hsize); - filt2.fftfilter(filter, hsize); - rand_filter(filter, hsize); - - @slider - size = pow(2, slider1+5); - // If size changed, re-initialize FFTs. - size != fin.size ? ( - hsize = size / 2; - fin.fftin_resize(size, 4); - fin2.fftin_resize(size, 4); - fout.fftout_resize(size, 4); - fout2.fftout_resize(size, 4); - // Initialize effect's specific memories. - filter = memalloc(hsize); - filt.fftfilter_resize(hsize); - filt2.fftfilter_resize(hsize); - filt.fftfilter_set_filtarray(filter); - filt2.fftfilter_set_filtarray(filter); - rand_filter(filter, hsize); - ); - - @sample - // Input / Output - fin.fftin_do(spl0); - fin2.fftin_do(spl1); - spl0 = fout.fftout_get_output(fin.count); - spl1 = fout2.fftout_get_output(fin2.count); - - fin.ready ? ( - // New buffers ready for processing. - filt.fftfilter_do(fin.real, fin.imag); - filt2.fftfilter_do(fin2.real, fin2.imag); - // compute the inverse FFT. - fout.fftout_do(filt.real, filt.imag); - fout2.fftout_do(filt2.real, filt2.imag); - ); - -********************************************************/ -function fftfilter(filtarray size) -( - this.filtarray = filtarray; - this.size = size; - this.real = memalloc(size); - this.imag = memalloc(size); -); - -function fftfilter_set_filtarray(filtarray) -( - this.filtarray = filtarray; -); - -function fftfilter_resize(size) -( - this.size = size; - this.real = memalloc(size); - this.imag = memalloc(size); -); - -function fftfilter_do(real imag) -( - k_ = 0; - while (k_ < this.size) ( - this.real[k_] = real[k_] * this.filtarray[k_]; - this.imag[k_] = imag[k_] * this.filtarray[k_]; - k_ += 1; - ); -); - -/******************************************************* -FFTGATE -======= - -Passes only the bins whose amplitude is above a given threshold. - -Description ------------ - -The `fftgate` object takes a complex signal in input (real -and imaginary parts of a FFT spectral analysis) and leaves -only the bins whose amplitude is above a given threshold -unmodified. The bins whose amplitude is below the threshold -are scaled by the damping factor. - -Initializer ------------ - -#### fftgate(thresh, damp, size) #### - -Initializes the spectral gate with a threshold `thresh`, in dB, -and a damping factor `damp`. The `size` argument is the length of -the `real` and `imag` arrays, usually half the FFT analysis size. - -Methods -------- - -#### fftgate_resize(size) #### - -Resizes internal memories of the process with the new `size`. -The size of a FFT process must be half the size of the FFT -used to analyse to input signal. This is the size of the real -and imaginary buffers. - -#### fftgate_set_thresh(thresh) #### - -Sets a new threshold `thresh`, in dB. - -#### fftgate_set_damp(damp) #### - -Sets a new damping factor `damp`. - -#### fftgate_do(real, imag) #### - -Computes one frame of the process on a complex signal (`real` and -`imag` are the real and imaginary parts coming from a `fftin` or -any FFT processing object). The internal `real` and `imag` buffers -hold the processed complex signal. This function should be called -only when the `ready` attribute of a `fftin` object has a value of 1. - -Attributes ----------- - -#### fftgate.real #### - -Buffer that holds the real part of the process. Indexes run from -0 to the process size (usually half the FFT size). - -#### fftgate.imag #### - -Buffer that holds the imaginary part of the process. Indexes run -from 0 to the process size (usually half the FFT size). - -Example -------- - - desc:Spectral Gate - - import cookdsp.jsfx-inc - - // FFT parameters (only FFT Size for the example). - slider1:5<0,8,1{32,64,128,256,512,1024,2048,4096,8192}>FFT Size - // Effect's specific sliders. - slider2:-20<-90,0>Threshold in dB - slider3:0<0,1>Damping Factor - - @init - size = pow(2, slider1+5); - fin.fftin(size, 4); - fin2.fftin(size, 4); - fout.fftout(size, 4); - fout2.fftout(size, 4); - gate.fftgate(slider2, slider3, size/2); - gate2.fftgate(slider2, slider3, size/2); - - @slider - size = pow(2, slider1+5); - // If size changed, re-initialize FFTs. - size != fin.size ? ( - fin.fftin_resize(size, 4); - fin2.fftin_resize(size, 4); - fout.fftout_resize(size, 4); - fout2.fftout_resize(size, 4); - // Initialize effect's specific memories. - gate.fftgate_resize(size/2); - gate2.fftgate_resize(size/2); - ); - gate.fftgate_set_thresh(slider2); - gate2.fftgate_set_thresh(slider2); - gate.fftgate_set_damp(slider3); - gate2.fftgate_set_damp(slider3); - - @sample - // Input / Output - fin.fftin_do(spl0); - fin2.fftin_do(spl1); - spl0 = fout.fftout_get_output(fin.count); - spl1 = fout2.fftout_get_output(fin2.count); - - fin.ready ? ( - // New buffers ready for processing. - gate.fftgate_do(fin.real, fin.imag); - gate2.fftgate_do(fin2.real, fin2.imag); - // compute the inverse FFT. - fout.fftout_do(gate.real, gate.imag); - fout2.fftout_do(gate2.real, gate2.imag); - ); - -********************************************************/ -function fftgate(thresh damp size) -( - this.thresh = thresh; - this.linthresh = dbtoa(this.thresh); - this.damp = damp; - this.size = size; - this.real = memalloc(size); - this.imag = memalloc(size); -); - -function fftgate_set_thresh(thresh) -( - this.thresh = thresh; - this.linthresh = dbtoa(this.thresh); -); - -function fftgate_set_damp(damp) -( - this.damp = damp; -); - -function fftgate_resize(size) -( - this.size = size; - this.real = memalloc(size); - this.imag = memalloc(size); -); - -function fftgate_do(real imag) -( - k_ = 0; - while (k_ < this.size) ( - a_ = sqrt(real[k_] * real[k_] + imag[k_] * imag[k_]); - a_ < this.linthresh ? ( - this.real[k_] = real[k_] * this.damp; - this.imag[k_] = imag[k_] * this.damp; - ) : ( - this.real[k_] = real[k_]; - this.imag[k_] = imag[k_]; - ); - k_ += 1; - ); -); diff --git a/FX/BryanChi_FX Devices/cookdsp/filters.jsfx-inc b/FX/BryanChi_FX Devices/cookdsp/filters.jsfx-inc deleted file mode 100644 index 3f27e1be5..000000000 --- a/FX/BryanChi_FX Devices/cookdsp/filters.jsfx-inc +++ /dev/null @@ -1,1690 +0,0 @@ -///////////////////////////////////////////////////////////////// -// Copyright (c) - 2014 - Olivier Belanger // -// Permission to use, copy, modify, and/or distribute this // -// software for any purpose with or without fee is hereby // -// granted, provided that the above copyright notice and this // -// permission notice appear in all copies. CookDSP IS PROVIDED // -// "AS IS", WITHOUT WARRANTY OF ANY KIND FROM THE AUTHOR. // -///////////////////////////////////////////////////////////////// - -@init - -/******************************************************* -LOP -=== - -First-order IIR lowpass filter. - -Description ------------ - -The lop object initializes a first-order IIR lowpass filter. -It takes the cutoff frequency, in Hz, as argument. - -With very low cutoff frequency (< 10 Hz), this filter can do -parameter interpolation efficiently. - -It must be used with a variable name as prefix (object oriented). - -Initializer ------------ - -#### lop(freq) #### - -Initializes a lowpass filter with `freq` as the cutoff frequency. - -Methods -------- - -#### lop_set_freq(freq) #### - -Sets a new cutoff frequency `freq`, in Hz. - -#### lop_do(signal) #### - -Processes one samples of an input signal `signal` and outputs -the filtered sample. - -Example -------- - - desc:Interpolated Stereo Lowpass Filter - - import cookdsp.jsfx-inc - - slider1:3500<100,10000>Cutoff Frequency In Hz - slider2:1<0.01,10>Interpolation Time In Seconds - - @init - // Initializes the interpolator - interp.lop(1.0 / slider2); - // Initializes the filters - filt1.lop(slider1); - filt2.lop(slider1); - - @slider - // Sets the interpolator's frequency - interp.lop_set_freq(1.0 / slider2); - - @sample - // Compute and sets the filters's frequency - freq = interp.lop_do(slider1); - filt1.lop_set_freq(freq); - filt2.lop_set_freq(freq); - // Filters the input signal - spl0 = filt1.lop_do(spl0); - spl1 = filt2.lop_do(spl1); - -********************************************************/ -function lop(freq) -( - this.y0 = 0; - this.ny = srate * 0.49; - freq < 0.1 ? freq = 0.1 : freq > this.ny ? freq = this.ny; - this.freq = freq; - this.c = exp(-2 * $pi * this.freq / srate); -); - -function lop_set_freq(freq) -( - freq < 0.1 ? freq = 0.1 : freq > this.ny ? freq = this.ny; - this.freq = freq; - this.c = exp(-2 * $pi * this.freq / srate); -); - -function lop_do(signal) -( - this.y0 = signal + (this.y0 - signal) * this.c; - this.y0; -); - -/******************************************************* -HIP -=== - -First-order IIR highpass filter. - -Description ------------ - -The hip object initializes a first-order IIR highpass filter. -It takes the cutoff frequency, in Hz, as argument. - -It must be used with a variable name as prefix (object oriented). - -Initializer ------------ - -#### hip(freq) #### - -Initializes a highpass filter with `freq` as the cutoff frequency. - -Methods -------- - -#### hip_set_freq(freq) #### - -Sets a new cutoff frequency `freq`, in Hz. - -#### hip_do(signal) #### - -Processes one samples of an input signal `signal` and outputs -the filtered sample. - -Example -------- - - desc:Interpolated Stereo Highpass Filter - - import cookdsp.jsfx-inc - - slider1:3500<50,10000>Cutoff Frequency In Hz - slider2:1<0.01,10>Interpolation Time In Seconds - - @init - // Initializes the interpolator - interp.lop(1.0 / slider2); - // Initializes the filters - filt1.hip(slider1); - filt2.hip(slider1); - - @slider - // Sets the interpolator's frequency - interp.lop_set_freq(1.0 / slider2); - - @sample - // Compute and sets the filters's frequency - freq = interp.lop_do(slider1); - filt1.hip_set_freq(freq); - filt2.hip_set_freq(freq); - // Filters the input signal - spl0 = filt1.hip_do(spl0); - spl1 = filt2.hip_do(spl1); - -********************************************************/ -function _hip_compute_coeffs() -( - this.b1 = exp(-2 * $pi * this.freq / srate); - this.a0 = (1 + this.b1) / 2; - this.a1 = -this.a0; -); - -function hip(freq) -( - this.x0 = this.y0 = 0; - this.ny = srate * 0.49; - freq < 0.1 ? freq = 0.1 : freq > this.ny ? freq = this.ny; - this.freq = freq; - this._hip_compute_coeffs(); -); - -function hip_set_freq(freq) -( - freq < 0.1 ? freq = 0.1 : freq > this.ny ? freq = this.ny; - this.freq = freq; - this._hip_compute_coeffs(); -); - -function hip_do(signal) -( - this.y0 = signal * this.a0 + this.x0 * this.a1 + this.y0 * this.b1; - this.x0 = signal; - this.y0; -); - -/******************************************************* -BP -=== - -Second-order IIR bandpass filter. - - -Description ------------ - -The bp object initializes a second-order IIR bandpass -filter. It takes center frequency, in Hz, and Q as -arguments. - -It must be used with a variable name as prefix (object oriented). - -Initializer ------------ - -#### bp(freq, q) #### - -Initializes a second order IIR bandpass filter with `freq` as the -center frequency, in Hz, and `q` as the Q factor (ie. the amount -of resonance). The bandwidth of the filter is computed as `freq / q`. - -Methods -------- - -#### bp_set_freq(freq) #### - -Sets a new center frequency, `freq`, to the filter. - -#### bp_set_q(q) #### - -Sets a new Q, ie. amount of resonance, to the filter. - -#### bp_do(signal) #### - -Processes one samples of an input signal `signal` and outputs -the filtered sample. - -Example -------- - - desc:Second Order Stereo Bandpass Filter - - import cookdsp.jsfx-inc - - slider1:3500<100,10000>Center Frequency In Hz - slider2:20<1,100>Q Factor - - @init - // Initializes the filters - filt1.bp(slider1, slider2); - filt2.bp(slider1, slider2); - - @slider - filt1.bp_set_freq(slider1); - filt2.bp_set_freq(slider1); - filt1.bp_set_q(slider2); - filt2.bp_set_q(slider2); - - @sample - // Filters the input signal - spl0 = filt1.bp_do(spl0); - spl1 = filt2.bp_do(spl1); - -********************************************************/ -// Private function // -function _bp_compute_coeffs() -( - bw_ = this.freq / this.q; - this.b2 = exp(-2 * $pi / srate * bw_); - this.b1 = (-4.0 * this.b2) / (1.0 + this.b2) * cos(2 * $pi * this.freq / srate); - this.a1 = 1.0 - sqrt(this.b2); -); - -function bp(freq q) -( - this.ny = srate * 0.49; - freq < 20 ? freq = 20 : freq > this.ny ? freq = this.ny; - this.freq = freq; - q < 0.5 ? q = 0.5 : q > 1000 ? q = 1000; - this.q = q; - this.x1 = this.x2 = this.y1 = this.y2 = 0.0; - this._bp_compute_coeffs(); -); - -function bp_set_freq(freq) -( - freq < 20 ? freq = 20 : freq > this.ny ? freq = this.ny; - this.freq = freq; - this._bp_compute_coeffs(); -); - -function bp_set_q(q) -( - q < 0.5 ? q = 0.5 : q > 1000 ? q = 1000; - this.q = q; - this._bp_compute_coeffs(); -); - -function bp_do(signal) -( - tmp_ = (this.a1 * signal) - (this.a1 * this.x2) - (this.b1 * this.y1) - (this.b2 * this.y2); - this.x2 = this.x1; this.x1 = signal; this.y2 = this.y1; this.y1 = tmp_; - tmp_; -); - -/******************************************************* -BUTLP -===== - -Second-order Butterworth lowpass filter. - -Description ------------ - -The butlp object initializes a second-order IIR Butterworth -lowpass filter. It takes the cutoff frequency, in Hz, as argument. - -The Butterworth filter is a type of signal processing filter designed -to have as flat a frequency response as possible in the passband. - -It must be used with a variable name as prefix (object oriented). - -Initializer ------------ - -#### butlp(freq) #### - -Initializes a lowpass filter with `freq` as the cutoff frequency. - -Methods -------- - -#### butlp_set_freq(freq) #### - -Sets a new cutoff frequency `freq`, in Hz. - -#### butlp_do(signal) #### - -Processes one samples of an input signal `signal` and outputs -the filtered sample. - -Example -------- - - desc:Butterworth Lowpass Filter - - import cookdsp.jsfx-inc - - slider1:3500<100,10000>Cutoff Frequency In Hz - - @init - // Initializes the filters - filt1.butlp(slider1); - filt2.butlp(slider1); - - @slider - filt1.butlp_set_freq(slider1); - filt2.butlp_set_freq(slider1); - - @sample - // Filters the input signal - spl0 = filt1.butlp_do(spl0); - spl1 = filt2.butlp_do(spl1); - -********************************************************/ -function _butlp_compute_coeffs(freq) -( - freq < 1.0 ? freq = 1.0 : freq > this.ny ? freq = this.ny; - this.freq = freq; - c_ = 1.0 / tan(this.pioversr * this.freq); - c2_ = c_ * c_; - this.a0 = this.a2 = 1.0 / (1.0 + this.sqrt2 * c_ + c2_); - this.a1 = 2.0 * this.a0; - this.b1 = this.a1 * (1.0 - c2_); - this.b2 = this.a0 * (1.0 - this.sqrt2 * c_ + c2_); -); - -function butlp(freq) -( - this.x1 = this.x2 = this.y1 = this.y2 = 0.0; - this.pioversr = $pi / srate; - this.sqrt2 = sqrt(2.0); - this.ny = srate * 0.49; - this._butlp_compute_coeffs(freq); -); - -function butlp_set_freq(freq) -( - this._butlp_compute_coeffs(freq); -); - -function butlp_do(signal) -( - tmp_ = this.a0 * signal + this.a1 * this.x1 + this.a2 * this.x2 - this.b1 * this.y1 - this.b2 * this.y2; - this.x2 = this.x1; this.x1 = signal; this.y2 = this.y1; this.y1 = tmp_; - tmp_; -); - -/******************************************************* -BUTHP -===== - -Second-order Butterworth highpass filter. - -Description ------------ - -The buthp object initializes a second-order IIR Butterworth -highpass filter. It takes the cutoff frequency, in Hz, as argument. - -The Butterworth filter is a type of signal processing filter designed -to have as flat a frequency response as possible in the passband. - -It must be used with a variable name as prefix (object oriented). - -Initializer ------------ - -#### buthp(freq) #### - -Initializes a highpass filter with `freq` as the cutoff frequency. - -Methods -------- - -#### buthp_set_freq(freq) #### - -Sets a new cutoff frequency `freq`, in Hz. - -#### buthp_do(signal) #### - -Processes one samples of an input signal `signal` and outputs -the filtered sample. - -Example -------- - - desc:Butterworth Highpass Filter - - import cookdsp.jsfx-inc - - slider1:3500<100,10000>Cutoff Frequency In Hz - - @init - // Initializes the filter - filt1.buthp(slider1); - filt2.buthp(slider1); - - @slider - filt1.buthp_set_freq(slider1); - filt2.buthp_set_freq(slider1); - - @sample - // Filters the input signal - spl0 = filt1.buthp_do(spl0); - spl1 = filt2.buthp_do(spl1); - -********************************************************/ -function _buthp_compute_coeffs(freq) -( - freq < 1.0 ? freq = 1.0 : freq > this.ny ? freq = this.ny; - this.freq = freq; - c_ = tan(this.pioversr * this.freq); - c2_ = c_ * c_; - this.a0 = this.a2 = 1.0 / (1.0 + this.sqrt2 * c_ + c2_); - this.a1 = -2.0 * this.a0; - this.b1 = 2.0 * this.a0 * (c2_ - 1.0); - this.b2 = this.a0 * (1.0 - this.sqrt2 * c_ + c2_); -); - -function buthp(freq) -( - this.x1 = this.x2 = this.y1 = this.y2 = 0.0; - this.pioversr = $pi / srate; - this.sqrt2 = sqrt(2.0); - this.ny = srate * 0.49; - this._buthp_compute_coeffs(freq); -); - -function buthp_set_freq(freq) -( - this._buthp_compute_coeffs(freq); -); - -function buthp_do(signal) -( - tmp_ = this.a0 * signal + this.a1 * this.x1 + this.a2 * this.x2 - this.b1 * this.y1 - this.b2 * this.y2; - this.x2 = this.x1; this.x1 = signal; this.y2 = this.y1; this.y1 = tmp_; - tmp_; -); - -/******************************************************* -BUTBP -===== - -Second-order Butterworth bandpass filter. - -Description ------------ - -The butbp object initializes a second-order IIR Butterworth -bandpass filter. It takes the center frequency, in Hz, and -the Q, as argument. - -The Butterworth filter is a type of signal processing filter designed -to have as flat a frequency response as possible in the passband. - -It must be used with a variable name as prefix (object oriented). - -Initializer ------------ - -#### butbp(freq, q) #### - -Initializes a bandpass filter with `freq` as the center frequency, -and `q` as the inverse of the filter's bandwidth. - -Methods -------- - -#### butbp_set_freq(freq) #### - -Sets a new center frequency `freq`, in Hz. - -#### butbp_set_q(q) #### - -Sets a new `q`. The Q of the filter is the inverse of the bandwidth. - -#### butbp_do(signal) #### - -Processes one samples of an input signal `signal` and outputs -the filtered sample. - -Example -------- - - desc:Butterworth Bandpass Filter - - import cookdsp.jsfx-inc - - slider1:3500<100,10000>Cutoff Frequency In Hz - slider2:5<1,100>Filter Q - - @init - // Initializes the filter - filt1.butbp(slider1, slider2); - filt2.butbp(slider1, slider2); - - @slider - filt1.butbp_set_freq(slider1); - filt2.butbp_set_freq(slider1); - filt1.butbp_set_q(slider2); - filt2.butbp_set_q(slider2); - - @sample - // Filters the input signal - spl0 = filt1.butbp_do(spl0); - spl1 = filt2.butbp_do(spl1); - -********************************************************/ -function _butbp_compute_coeffs() -( - bw_ = this.freq / this.q; - c_ = 1.0 / tan(this.pioversr * bw_); - d_ = 2.0 * cos(2.0 * this.pioversr * this.freq); - this.a0 = 1.0 / (1.0 + c_); - this.a2 = -this.a0; - this.b1 = this.a2 * c_ * d_; - this.b2 = this.a0 * (c_ - 1.0); -); - -function butbp(freq q) -( - freq < 1.0 ? freq = 1.0 : freq > this.ny ? freq = this.ny; - this.freq = freq; - q < 0.5 ? q = 0.5 : q > 1000 ? q = 1000; - this.q = q; - this.x1 = this.x2 = this.y1 = this.y2 = 0.0; - this.pioversr = $pi / srate; - this.ny = srate * 0.49; - this._butbp_compute_coeffs(); -); - -function butbp_set_freq(freq) -( - freq < 1.0 ? freq = 1.0 : freq > this.ny ? freq = this.ny; - this.freq = freq; - this._butbp_compute_coeffs(); -); - -function butbp_set_q(q) -( - q < 0.5 ? q = 0.5 : q > 1000 ? q = 1000; - this.q = q; - this._butbp_compute_coeffs(); -); - -function butbp_do(signal) -( - tmp_ = this.a0 * signal + this.a2 * this.x2 - this.b1 * this.y1 - this.b2 * this.y2; - this.x2 = this.x1; this.x1 = signal; this.y2 = this.y1; this.y1 = tmp_; - tmp_; -); - -/******************************************************* -BUTBR -===== - -Second-order Butterworth band reject filter. - -Description ------------ - -The butbp object initializes a second-order IIR Butterworth -band reject filter. It takes the center frequency, in Hz, and -the Q, as argument. - -The Butterworth filter is a type of signal processing filter designed -to have as flat a frequency response as possible in the passband. - -It must be used with a variable name as prefix (object oriented). - -Initializer ------------ - -#### butbr(freq, q) #### - -Initializes a band reject filter with `freq` as the center frequency, -and `q` as the inverse of the filter's bandwidth. - -Methods -------- - -#### butbr_set_freq(freq) #### - -Sets a new center frequency `freq`, in Hz. - -#### butbr_set_q(q) #### - -Sets a new `q`. The Q of the filter is the inverse of the bandwidth. - -#### butbr_do(signal) #### - -Processes one samples of an input signal `signal` and outputs -the filtered sample. - -Example -------- - - desc:Butterworth Band Reject Filter - - import cookdsp.jsfx-inc - - slider1:3500<100,10000>Cutoff Frequency In Hz - slider2:5<1,100>Filter Q - - @init - // Initializes the filter - filt1.butbr(slider1, slider2); - filt2.butbr(slider1, slider2); - - @slider - filt1.butbr_set_freq(slider1); - filt2.butbr_set_freq(slider1); - filt1.butbr_set_q(slider2); - filt2.butbr_set_q(slider2); - - @sample - // Filters the input signal - spl0 = filt1.butbr_do(spl0); - spl1 = filt2.butbr_do(spl1); - -********************************************************/ -function _butbr_compute_coeffs() -( - bw_ = this.freq / this.q; - c_ = tan(this.pioversr * bw_); - d_ = 2.0 * cos(2.0 * this.pioversr * this.freq); - this.a0 = this.a2 = 1.0 / (1.0 + c_); - this.a1 = this.b1 = -this.a0 * d_; - this.b2 = this.a0 * (1.0 - c_); -); - -function butbr(freq q) -( - freq < 1.0 ? freq = 1.0 : freq > this.ny ? freq = this.ny; - this.freq = freq; - q < 0.5 ? q = 0.5 : q > 1000 ? q = 1000; - this.q = q; - this.x1 = this.x2 = this.y1 = this.y2 = 0.0; - this.pioversr = $pi / srate; - this.ny = srate * 0.49; - this._butbr_compute_coeffs(); -); - -function butbr_set_freq(freq) -( - freq < 1.0 ? freq = 1.0 : freq > this.ny ? freq = this.ny; - this.freq = freq; - this._butbr_compute_coeffs(); -); - -function butbr_set_q(q) -( - q < 0.5 ? q = 0.5 : q > 1000 ? q = 1000; - this.q = q; - this._butbr_compute_coeffs(); -); - -function butbr_do(signal) -( - tmp_ = this.a0 * signal + this.a1 * this.x1 + this.a2 * this.x2 - this.b1 * this.y1 - this.b2 * this.y2; - this.x2 = this.x1; this.x1 = signal; this.y2 = this.y1; this.y1 = tmp_; - tmp_; -); - -/******************************************************* -APASS -===== - -Second-order phase shifter allpass. - - -Description ------------ - -This kind of filter is used in phaser implementation. The signal -produced by this filter, when added to original sound, creates a -notch in the spectrum at a frequency given by the `freq` argument. -The `apass` object also takes the bandwidth of the filter and the -feedback coefficient as argument. - -It must be used with a variable name as prefix (object oriented). - -Initializer ------------ - -#### apass(freq, bw [, feed]) #### - -Initializes a second order IIR phase shifter allpass with `freq` as -the center frequency, in Hz, and `bw` as the bandwidth of the , also -in Hz. The optional argument `feed` is the feedback coefficient. It -defaults to 0. - -Methods -------- - -#### apass_set_freq(freq) #### - -Sets a new center frequency, `freq`, to the filter. - -#### apass_set_bw(bw) #### - -Sets a new bandwidth, `bw`, to the filter. - -#### apass_set_feed(feed) #### - -Sets a new feedback coefficient, `feed`, to the filter. - -#### apass_do(signal) #### - -Processes one samples of an input signal `signal` and outputs -the filtered sample. - -Example -------- - - desc: Second-Order Phase Shifter Allpass - - import cookdsp.jsfx-inc - - slider1:1000<100,10000>Notch Frequency (Hz) - slider2:1000<100,2000>Bandwidth (Hz) - slider3:0<0,0.99>Feedback - - @init - apL.apass(slider1, slider2, slider3); - apR.apass(slider1, slider2, slider3); - - @slider - apL.apass_set_freq(slider1); - apR.apass_set_freq(slider1); - apL.apass_set_bw(slider2); - apR.apass_set_bw(slider2); - apL.apass_set_feed(slider3); - apR.apass_set_feed(slider3); - - @sample - filt = apL.apass_do(spl0); - spl0 = (spl0 + filt) * 0.5; - - filt = apR.apass_do(spl1); - spl1 = (spl1 + filt) * 0.5; - -********************************************************/ -// Private function // -function _apass_compute_coeffs() -( - r_ = exp(-$pi * this.bw / srate); - this.a = r_ * r_; - this.b = -2 * r_ * cos(2 * $pi * this.freq / srate); -); - -function apass(freq bw feed) -( - this.ny = srate * 0.49; - freq < 10 ? freq = 10 : freq > this.ny ? freq = this.ny; - this.freq = freq; - bw < 1 ? bw = 1 : bw > this.ny ? bw = this.ny; - this.bw = bw; - feed < 0 ? feed = 0 : feed > 0.999 ? feed = 0.999; - this.feed = feed; - this.y = this.y1 = this.y2 = 0.0; - this._apass_compute_coeffs(); -); - -function apass(freq bw) -( - this.apass(freq, bw, 0); -); - -function apass_set_freq(freq) -( - freq < 10 ? freq = 10 : freq > this.ny ? freq = this.ny; - this.freq = freq; - this._apass_compute_coeffs(); -); - -function apass_set_bw(bw) -( - bw < 1 ? bw = 1 : bw > this.ny ? bw = this.ny; - this.bw = bw; - this._apass_compute_coeffs(); -); - -function apass_set_feed(feed) -( - feed < 0 ? feed = 0 : feed > 0.999 ? feed = 0.999; - this.feed = feed; -); - -function apass_do(signal) -( - in_ = signal + this.y * this.feed; - tmp_ = in_ + (this.y1 * -this.b) + (this.y2 * -this.a); - this.y = (tmp_ * this.a) + (this.y1 * this.b) + this.y2; - this.y2 = this.y1; this.y1 = tmp_; - this.y; -); - -/******************************************************* -HILBERT -======= - -Hilbert transform. - -Description ------------ - -Hilbert is an IIR filter based implementation of a broad-band 90 degree -phase difference network. The outputs of hilbert have an identical -frequency response to the input (i.e. they sound the same), but the two -outputs have a constant phase difference of 90 degrees, plus or minus some -small amount of error, throughout the entire frequency range. The outputs -are in quadrature. - -Hilbert is useful in the implementation of many digital signal processing -techniques that require a signal in phase quadrature. The real part corresponds -to the cosine output of hilbert, while the imaginary part corresponds to the -sine output. The two outputs have a constant phase difference throughout the -audio range that corresponds to the phase relationship between cosine and sine -waves. - -It must be used with a variable name as prefix (object oriented). - -Initializer ------------ - -#### hilbert() #### - -Initializes a sixth-order IIR Hilbert filter. - -Methods -------- - -#### hilbert_do(signal) #### - -Processes one samples of an input signal `signal` and stores the real part -in the `real` attribute and the imaginary part in the `imag` attribute. - -Attributes ----------- - -#### hilbert.real #### - -Floating-point value that holds the real part of the complex filtering. - -#### hilbert.imag #### - -Floating-point value that holds the imaginary part of the complex filtering. - -Example -------- - - desc:Single-Sideband-Modulation Via The Hilbert Transform - - import cookdsp.jsfx-inc - - slider1:1000<1,2000>Shifting Frequency (Hz) - slider2:0<0,1,1{Down Shifting, Up Shifting}>Shifting Sideband - - @init - // Initializes the Hilbert transform - hilb.hilbert(); - // Sinusoid phase - ph.phasor(slider1, 0); - - @slider - ph.phasor_set_freq(slider1); - - @sample - // Mixed input - input = (spl0 + spl1) * 0.5; - // Complex phase - ph1 = ph.phasor_do(); - ph2 = wrap(ph1+0.25, 0, 1); - // Complex sinusoid - q1 = sin(2 * $pi * ph1); - q2 = sin(2 * $pi * ph2); - // Hilbert transform - hilb.hilbert_do(input); - // Complex modulation - mod1 = hilb.real * q1; - mod2 = hilb.imag * q2; - // Sideband separation - down = mod1 + mod2; - up = mod1 - mod2; - // Choose the desired sideband - slider2 == 0 ? side = down : side = up; - // Mix the sideband with input signal - spl0 = (spl0 + side) * 0.5; - spl1 = (spl1 + side) * 0.5; - -********************************************************/ -function hilbert() -( - this.real = this.imag = 0.0; - this.poles.buffer(12); - this.poles.buffer_init(.3609, 2.7412, 11.1573, 44.7581, 179.6242, - 798.4578, 1.2524, 5.5671, 22.3423, 89.6271, - 364.7914, 2770.1114); - this.coeffs.buffer(12); - this.x1.buffer(12); - this.y1.buffer(12); - twopi_ = $pi * 2; - i_ = 0; - loop(12, - pf_ = this.poles.buffer_fread(i_) * 15.0; - rc_ = 1.0 / (twopi_ * pf_); - al_ = 1.0 / rc_; - fac_ = al_ / (2.0 * srate); - beta_ = (1.0 - fac_) / (1.0 + fac_); - this.coeffs.buffer_write(i_, -beta_); - i_ += 1; - ); -); - -function hilbert_do(signal) -( - xn1_ = signal; - i_ = 0; - loop(6, - c_ = this.coeffs.buffer_fread(i_); - x1_ = this.x1.buffer_fread(i_); - y1_ = this.y1.buffer_fread(i_); - yn1_ = x1_ + (xn1_ - y1_) * c_; - this.x1.buffer_write(i_, xn1_); - this.y1.buffer_write(i_, yn1_); - xn1_ = yn1_; - i_ += 1; - ); - xn2_ = signal; - loop(6, - c_ = this.coeffs.buffer_fread(i_); - x2_ = this.x1.buffer_fread(i_); - y2_ = this.y1.buffer_fread(i_); - yn2_ = x2_ + (xn2_ - y2_) * c_; - this.x1.buffer_write(i_, xn2_); - this.y1.buffer_write(i_, yn2_); - xn2_ = yn2_; - i_ += 1; - ); - this.real = yn1_; - this.imag = yn2_; -); - -/******************************************************* -BIQUAD -====== - -A sweepable general purpose biquadratic digital filter. - -Description ------------ - -The `biquad` object initializes a second-order IIR general purpose -biquadratic digital filter. It takes the cutoff frequency `freq`, -in Hz, the quality factor `q` (as `freq` / `bandwidth`) and the -filter's type `type`, as argument. - -It must be used with a variable name as prefix (object oriented). - -Initializer ------------ - -#### biquad(freq, q, type) #### - -Initializes a second-order IIR general purpose biquadratic digital filter. -It takes the cutoff frequency `freq`, in Hz, the quality factor `q` -(as `freq` / `bandwidth`) and the filter's type `type`, as argument. -Possible types are: - - - 0 : lowpass - - 1 : highpass - - 2 : bandpass - - 3 : bandstop - - 4 : allpass - -Methods -------- - -#### biquad_set_freq(freq) #### - -Sets a new cutoff frequency `freq`, in Hz. - -#### biquad_set_q(q) #### - -Sets a new quality factor `q` (as `freq` / `bandwidth`). - -#### biquad_set_type(type) #### - -Sets a new filter's type. Possible types are: - - - 0 : lowpass - - 1 : highpass - - 2 : bandpass - - 3 : bandstop - - 4 : allpass - -#### biquad_do(signal) #### - -Processes one samples of an input signal `signal` and outputs -the filtered sample. - -Example -------- - - desc:Resonant Multi-type Filter - - import cookdsp.jsfx-inc - - slider1:3500<100,10000>Cutoff Frequency In Hz - slider2:5<1,100>Quality Factor (Q) - slider3:0<0,4,1{lowpass,highpass,bandpass,bandstop,allpass}>Filter Type - - @init - // Initializes the filter - filt1.biquad(slider1, slider2, slider3); - filt2.biquad(slider1, slider2, slider3); - - @slider - filt1.biquad_set_freq(slider1); - filt2.biquad_set_freq(slider1); - filt1.biquad_set_q(slider2); - filt2.biquad_set_q(slider2); - filt1.biquad_set_type(slider3); - filt2.biquad_set_type(slider3); - - @sample - // Filters the input signal - spl0 = filt1.biquad_do(spl0); - spl1 = filt2.biquad_do(spl1); - -********************************************************/ -function _biquad_compute_lp_coeffs() -( - this.b0 = this.b2 = (1 - this.c) / 2; - this.b1 = 1 - this.c; - this.a0 = 1 + this.alpha; - this.a1 = -2 * this.c; - this.a2 = 1 - this.alpha; -); - -function _biquad_compute_hp_coeffs() -( - this.b0 = (1 + this.c) / 2; - this.b1 = -(1 + this.c); - this.b2 = this.b0; - this.a0 = 1 + this.alpha; - this.a1 = -2 * this.c; - this.a2 = 1 - this.alpha; -); - -function _biquad_compute_bp_coeffs() -( - this.b0 = this.alpha; - this.b1 = 0; - this.b2 = -this.alpha; - this.a0 = 1 + this.alpha; - this.a1 = -2 * this.c; - this.a2 = 1 - this.alpha; -); - -function _biquad_compute_bs_coeffs() -( - this.b0 = 1; - this.b1 = this.a1 = -2 * this.c; - this.b2 = 1; - this.a0 = 1 + this.alpha; - this.a2 = 1 - this.alpha; -); - -function _biquad_compute_ap_coeffs() -( - this.b0 = this.a2 = 1 - this.alpha; - this.b1 = this.a1 = -2 * this.c; - this.b2 = this.a0 = 1 + this.alpha; -); - -function _biquad_compute_vars(freq q) -( - freq <= 0.1 ? freq = 0.1 : freq > this.ny ? freq = this.ny; - this.freq = freq; - q < 0.1 ? q = 0.1; - this.q = q; - w0 = this.twopi * this.freq / srate; - this.c = cos(w0); - this.alpha = sin(w0) / (2 * this.q); - this.type == 0 ? this._biquad_compute_lp_coeffs() : - this.type == 1 ? this._biquad_compute_hp_coeffs() : - this.type == 2 ? this._biquad_compute_bp_coeffs() : - this.type == 3 ? this._biquad_compute_bs_coeffs() : - this.type == 4 ? this._biquad_compute_ap_coeffs(); -); - -function biquad(freq q type) -( - this.x1 = this.x2 = this.y1 = this.y2 = 0.0; - this.twopi = $pi * 2; - this.ny = srate * 0.49; - type < 0 ? type = 0 : type > 4 ? type = 4; - this.type = type; - this._biquad_compute_vars(freq, q); -); - -function biquad_set_freq(freq) -( - freq != this.freq ? this._biquad_compute_vars(freq, this.q); -); - -function biquad_set_q(q) -( - q != this.q ? this._biquad_compute_vars(this.freq, q); -); - -function biquad_set_type(type) -( - type != this.type ? ( - type < 0 ? type = 0 : type > 4 ? type = 4; - this.type = type; - this._biquad_compute_vars(this.freq, this.q); - ); -); - -function biquad_do(signal) -( - tmp_ = (this.b0 * signal + this.b1 * this.x1 + this.b2 * this.x2 - this.a1 * this.y1 - this.a2 * this.y2) / this.a0; - this.x2 = this.x1; this.x1 = signal; this.y2 = this.y1; this.y1 = tmp_; - tmp_; -); - -/******************************************************* -MOOG -==== - -24dB/oct resonant lowpass filter. - -Description ------------ - -Implementation of the Moog ladder filter based on the work of Antti -Huovilainen, described in the paper "Non-Linear Digital Implementation -of the Moog Ladder Filter" (Proceedings of DaFX04, University of Napoli). -Adapted from Csound code for the moogladder opcode (Victor Lazzarini). - -It must be used with a variable name as prefix (object oriented). - -Initializer ------------ - -#### moog(freq, res) #### - -Initializes a fourth-order IIR resonant lowpass filter with cutoff -frequency `freq`, in Hz, and amount of resonance `res`, between 0 -(no resonance) and 1 (self-oscillation). - -Methods -------- - -#### moog_set_freq(freq) #### - -Sets a new cutoff frequency `freq`, in Hz. - -#### moog_set_res(res) #### - -Sets a new resonance factor, between 0 and 1. - -#### moog_do(signal) #### - -Processes one samples of an input signal `signal` and outputs -the filtered sample. - -Example -------- - - desc:24dB/oct Resonant Lowpass Filter - - import cookdsp.jsfx-inc - - slider1:3500<100,12000>Cutoff Frequency in Hz - slider2:0.5<0,1>Resonance - - @init - // Initializes the filter - filt1.moog(slider1, slider2); - filt2.moog(slider1, slider2); - - @slider - filt1.moog_set_freq(slider1); - filt2.moog_set_freq(slider1); - filt1.moog_set_res(slider2); - filt2.moog_set_res(slider2); - - @sample - // Filters the input signal - spl0 = filt1.moog_do(spl0); - spl1 = filt2.moog_do(spl1); - -********************************************************/ -function _moog_compute_coeffs(freq res) -( - freq < 1 ? freq = 1 : freq > this.ny ? freq = this.ny; - this.freq = freq; - res < 0 ? res = 0 : res > 1 ? res = 1; - this.res = res; - // srate is half the actual filter sampling rate - fc_ = this.freq / srate; - f_ = 0.5 * fc_; - fc2_ = fc_ * fc_; - fc3_ = fc2_ * fc_; - // frequency & amplitude correction - fcr_ = 1.8730 * fc3_ + 0.4955 * fc2_ - 0.6490 * fc_ + 0.9988; - acr_ = -3.9364 * fc2_ + 1.8409 * fc_ + 0.9968; - this.scl = (1.0 - exp(-2 * $pi * f_ * fcr_)) / this.z; // filter tuning - this.r4 = 3.96 * this.res * acr_; // filter feedback -); - -function moog(freq res) -( - this.y1 = this.y2 = this.y3 = this.y4 = this.y5 = this.out = 0; - this.ny = srate * 0.49; - this.z = 1/40000; // twice the "thermal voltage of a transistor" - this._moog_compute_coeffs(freq, res); -); - -function moog_set_freq(freq) -( - freq != this.freq ? this._moog_compute_coeffs(freq, this.res); -); - -function moog_set_res(res) -( - res != this.res ? this._moog_compute_coeffs(this.freq, res); -); - -function moog_do(signal) -( - loop(2, - this.y1 = this.y1 + this.scl * (tanh((signal - this.r4 * this.out) * this.z) - tanh(this.y1*this.z)); - this.y2 = this.y2 + this.scl * (tanh(this.y1 * this.z) - tanh(this.y2 * this.z)); - this.y3 = this.y3 + this.scl * (tanh(this.y2 * this.z) - tanh(this.y3 * this.z)); - this.y4 = this.y4 + this.scl * (tanh(this.y3 * this.z) - tanh(this.y4 * this.z)); - this.out = (this.y4 + this.y5) * 0.5; - this.y5 = this.y4; - ); - this.out; -); - - -/******************************************************* -COMB -==== - -Reverberates an input signal with a colored frequency response. - -Description ------------ - -Comb creates a comb filter with peaks in the spectrum located at all -multiples of `1 / delay time`. This kind of filter is often used in simple -digital reverb implementations. - -It must be used with a variable name as prefix (object oriented). - -Initializer ------------ - -#### comb(delay, feed) #### - -Initializes acomb filter with frequency as the inverse of the delay -time `delay`, in seconds, and feedback `feed`, between 0 and 1. - -Methods -------- - -#### comb_set_delay(delay) #### - -Sets a new delay time, in seconds. - -#### comb_set_feed(feed) #### - -Sets a new feedback factor, between 0 and 1. - -#### comb_do(signal) #### - -Processes one samples of an input signal `signal` and outputs -the filtered sample. - -Example -------- - - desc:Schroeder Reverb 2 - - import cookdsp.jsfx-inc - - slider1:3500<500,10000>Lowpass Cutoff - slider2:0.2<0,1>Balance Dry/Wet - - @init - // Left ch. comb filters Right ch. comb filters - c1L.comb(0.0297, 0.65); c1R.comb(0.0277, 0.65); - c2L.comb(0.0371, 0.51); c2R.comb(0.0393, 0.51); - c3L.comb(0.0411, 0.5); c3R.comb(0.0409, 0.5); - c4L.comb(0.0137, 0.73); c4R.comb(0.0155, 0.73); - // Left ch. allpass filters Right ch. allpass filters - a1L.allpass(0.005, 0.75); a1R.allpass(0.00507, 0.75); - a2L.allpass(0.0117, 0.61); a2R.allpass(0.0123, 0.61); - // Left ch. lowpass filter Right ch. lowpass filter - lpL.lop(3500); lpR.lop(3500); - - @slider - lpL.lop_set_freq(slider1); - lpR.lop_set_freq(slider1); - - @sample - // Left ch. comb filters Right ch. comb filters - sig1L = c1L.comb_do(spl0); sig1R = c1R.comb_do(spl1); - sig2L = c2L.comb_do(spl0); sig2R = c2R.comb_do(spl1); - sig3L = c3L.comb_do(spl0); sig3R = c3R.comb_do(spl1); - sig4L = c4L.comb_do(spl0); sig4R = c4R.comb_do(spl1); - // Comb filters summation - sumL = spl0 + sig1L + sig2L + sig3L + sig4L; - sumR = spl1 + sig1R + sig2R + sig3R + sig4R; - // Left ch. allpass filters Right ch. allpass filters - all1L = a1L.allpass_do(sumL); all1R = a1R.allpass_do(sumR); - all2L = a2L.allpass_do(all1L); all2R = a2R.allpass_do(all1R); - // Left ch. lowpass filter Right ch. lowpass filter - sigL = lpL.lop_do(all2L) * .2; sigR = lpR.lop_do(all2R) * .2; - // Balance and output - spl0 = spl0 + (sigL - spl0) * slider2; - spl1 = spl1 + (sigR - spl1) * slider2; - -********************************************************/ -function comb(delay feed) -( - this.dline.delay(srate/2); - delay < 1/srate ? delay = 1/srate : delay > 0.5 ? delay = 0.5; - this.delay = delay; - feed < 0 ? feed = 0 : feed > 1 ? feed = 1; - this.feed = feed; -); - -function comb_set_delay(delay) -( - delay < 1/srate ? delay = 1/srate : delay > 0.5 ? delay = 0.5; - this.delay = delay; -); - -function comb_set_feed(feed) -( - feed < 0 ? feed = 0 : feed > 1 ? feed = 1; - this.feed = feed; -); - -function comb_do(signal) -( - tmp_ = this.dline.delay_fsread2(this.delay); - this.dline.delay_write(signal + tmp_ * this.feed); - tmp_; -); - -/******************************************************* -ALLPASS -======= - -Reverberates an input signal with a flat frequency response. - -Description ------------ - -Allpass is based on the combination of feedforward and feedback comb filter. -This kind of filter is often used in simple digital reverb implementations. - -It must be used with a variable name as prefix (object oriented). - -Initializer ------------ - -#### allpass(delay, feed) #### - -Initializes an allpass filter with frequency as the inverse of the delay -time `delay`, in seconds, and feedback `feed`, between 0 and 1. - -Methods -------- - -#### allpass_set_delay(delay) #### - -Sets a new delay time, in seconds. - -#### allpass_set_feed(feed) #### - -Sets a new feedback factor, between 0 and 1. - -#### allpass_do(signal) #### - -Processes one samples of an input signal `signal` and outputs -the filtered sample. - -Example -------- - - desc:Schroeder Reverb 1 - - import cookdsp.jsfx-inc - - slider1:0.2<0,1>Balance Dry/Wet - - @init - // Left ch. allpass filters Right ch. allpass filters - a1L.allpass(0.0204, 0.35); a1R.allpass(0.02011, 0.35); - a2L.allpass(0.06653, 0.41); a2R.allpass(0.06641, 0.41); - a3L.allpass(0.035007, 0.5); a3R.allpass(0.03504, 0.5); - a4L.allpass(0.023021, 0.65); a4R.allpass(0.022987, 0.65); - // Left ch. lowpass filters Right ch. lowpass filters - lp1L.lop(5000); lp1R.lop(5000); - lp2L.lop(3000); lp2R.lop(3000); - lp3L.lop(1500); lp3R.lop(1500); - lp4L.lop(500); lp4R.lop(500); - - @sample - // Left channel Right channel - sig1L = a1L.allpass_do(spl0); sig1R = a1R.allpass_do(spl1); - sig2L = a2L.allpass_do(sig1L); sig2R = a2R.allpass_do(sig1R); - sig3L = a3L.allpass_do(sig2L); sig3R = a3R.allpass_do(sig2R); - sig4L = a4L.allpass_do(sig3L); sig4R = a4R.allpass_do(sig3R); - lop1L = lp1L.lop_do(sig1L); lop1R = lp1R.lop_do(sig1R); - lop2L = lp2L.lop_do(sig2L); lop2R = lp2R.lop_do(sig2R); - lop3L = lp3L.lop_do(sig3L); lop3R = lp3R.lop_do(sig3R); - lop4L = lp4L.lop_do(sig4L); lop4R = lp4R.lop_do(sig4R); - sigL = (lop1L + lop2L + lop3L + lop4L) * 0.5; - sigR = (lop1R + lop2R + lop3R + lop4R) * 0.5; - spl0 = spl0 + (sigL - spl0) * slider1; - spl1 = spl1 + (sigR - spl1) * slider1; - -********************************************************/ -function allpass(delay feed) -( - this.dline.delay(srate/2); - delay < 1/srate ? delay = 1/srate : delay > 0.5 ? delay = 0.5; - this.delay = delay; - feed < 0 ? feed = 0 : feed > 1 ? feed = 1; - this.feed = feed; -); - -function allpass_set_delay(delay) -( - delay < 1/srate ? delay = 1/srate : delay > 0.5 ? delay = 0.5; - this.delay = delay; -); - -function allpass_set_feed(feed) -( - feed < 0 ? feed = 0 : feed > 1 ? feed = 1; - this.feed = feed; -); - -function allpass_do(signal) -( - tmp_ = this.dline.delay_fsread2(this.delay); - this.dline.delay_write(signal + tmp_ * this.feed); - tmp_ * (1 - this.feed * this.feed) + signal * -this.feed; -); - -/******************************************************* -EQ -=== - -Equalizer filter. - -Description ------------ - -EQ is a biquadratic digital filter designed for equalization. -It provides peak/notch and lowshelf/highshelf filters for building -parametric equalizers. - -It must be used with a variable name as prefix (object oriented). - -Initializer ------------ - -#### eq(freq, q, boost, type) #### - -Initializes a second-order IIR equalizer filter. It takes as arguments the -center (or cutoff) frequency `freq`, in Hz, the quality factor `q` -(defined as `freq` / `bandwidth`), the amount of boost/cut, expressed in -dB, and the filter's type `type`. Possible types are: - - - 0 : peak/notch - - 1 : lowshelf - - 2 : highshelf - -Methods -------- - -#### eq_set_freq(freq) #### - -Sets a new center or cutoff frequency `freq`, in Hz. - -#### eq_set_q(q) #### - -Sets a new quality factor `q` (defined as `freq` / `bandwidth`). - -#### eq_set_boost(boost) #### - -Sets a new boost/cut gain factor, expressed in dB (0 dB is nominal gain). - -#### eq_set_type(type) #### - -Sets a new filter's type. Possible types are: - - - 0 : peak/notch - - 1 : lowshelf - - 2 : highshelf - -#### eq_do(signal) #### - -Processes one samples of an input signal `signal` and outputs -the filtered sample. - -Example -------- - - desc:Parametric EQ Filter - - import cookdsp.jsfx-inc - - slider1:1000<100,10000>Center Frequency - slider2:1<0.5,20>Filter Q - slider3:0<-18,18>Boost/Cut (dB) - slider4:0<0,2,1{Peak/Notch,Lowshelf,Highshelf}>Filter type - - @init - f1.eq(slider1, slider2, slider3, slider4); - f2.eq(slider1, slider2, slider3, slider4); - - @slider - f1.eq_set_freq(slider1); f2.eq_set_freq(slider1); - f1.eq_set_q(slider2); f2.eq_set_q(slider2); - f1.eq_set_boost(slider3); f2.eq_set_boost(slider3); - f1.eq_set_type(slider4); f2.eq_set_type(slider4); - - @sample - spl0 = f1.eq_do(spl0); - spl1 = f2.eq_do(spl1); - -********************************************************/ -function _eq_compute_peak_coeffs() -( - amul_ = this.alpha * this.a; - adiv_ = this.alpha / this.a; - this.b0 = 1.0 + amul_; - this.b1 = this.a1 = -2.0 * this.c; - this.b2 = 1.0 - amul_; - this.a0 = 1 + adiv_; - this.a2 = 1 - adiv_; -); - -function _eq_compute_ls_coeffs() -( - sqrt2a_ = sqrt(this.a * 2.0) * this.alpha; - amin1c_ = (this.a - 1.0) * this.c; - aadd1c_ = (this.a + 1.0) * this.c; - this.b0 = this.a * ((this.a + 1.0) - amin1c_ + sqrt2a_); - this.b1 = 2.0 * this.a * ((this.a - 1.0) - aadd1c_); - this.b2 = this.a * ((this.a + 1.0) - amin1c_ - sqrt2a_); - this.a0 = (this.a + 1.0) + amin1c_ + sqrt2a_; - this.a1 = -2.0 * ((this.a - 1.0) + aadd1c_); - this.a2 = (this.a + 1.0) + amin1c_ - sqrt2a_; -); - -function _eq_compute_hs_coeffs() -( - sqrt2a_ = sqrt(this.a * 2.0) * this.alpha; - amin1c_ = (this.a - 1.0) * this.c; - aadd1c_ = (this.a + 1.0) * this.c; - this.b0 = this.a * ((this.a + 1.0) + amin1c_ + sqrt2a_); - this.b1 = -2.0 * this.a * ((this.a - 1.0) + aadd1c_); - this.b2 = this.a * ((this.a + 1.0) + amin1c_ - sqrt2a_); - this.a0 = (this.a + 1.0) - amin1c_ + sqrt2a_; - this.a1 = 2.0 * ((this.a - 1.0) - aadd1c_); - this.a2 = (this.a + 1.0) - amin1c_ - sqrt2a_; -); - -function _eq_compute_vars(freq q boost) -( - freq <= 1 ? freq = 1 : freq > this.ny ? freq = this.ny; - this.freq = freq; - q < 0.1 ? q = 0.1; - this.q = q; - this.boost = boost; - - this.a = pow(10, boost/40); - w0 = this.twopi * this.freq / srate; - this.c = cos(w0); - this.alpha = sin(w0) / (2 * this.q); - this.type == 0 ? this._eq_compute_peak_coeffs() : - this.type == 1 ? this._eq_compute_ls_coeffs() : - this.type == 2 ? this._eq_compute_hs_coeffs(); -); - -function eq(freq q boost type) -( - this.x1 = this.x2 = this.y1 = this.y2 = 0.0; - this.twopi = $pi * 2; - this.ny = srate * 0.49; - type < 0 ? type = 0 : type > 2 ? type = 2; - this.type = type; - this._eq_compute_vars(freq, q, boost); -); - -function eq_set_freq(freq) -( - freq != this.freq ? this._eq_compute_vars(freq, this.q, this.boost); -); - -function eq_set_q(q) -( - q != this.q ? this._eq_compute_vars(this.freq, q, this.boost); -); - -function eq_set_boost(boost) -( - boost != this.boost ? this._eq_compute_vars(this.freq, this.q, boost); -); - -function eq_set_type(type) -( - type != this.type ? ( - type < 0 ? type = 0 : type > 2 ? type = 2; - this.type = type; - this._eq_compute_vars(this.freq, this.q, this.boost); - ); -); - -function eq_do(signal) -( - tmp_ = (this.b0 * signal + this.b1 * this.x1 + this.b2 * this.x2 - this.a1 * this.y1 - this.a2 * this.y2) / this.a0; - this.x2 = this.x1; this.x1 = signal; this.y2 = this.y1; this.y1 = tmp_; - tmp_; -); diff --git a/FX/BryanChi_FX Devices/cookdsp/granulator.jsfx-inc b/FX/BryanChi_FX Devices/cookdsp/granulator.jsfx-inc deleted file mode 100644 index ef6e2bfd5..000000000 --- a/FX/BryanChi_FX Devices/cookdsp/granulator.jsfx-inc +++ /dev/null @@ -1,286 +0,0 @@ -///////////////////////////////////////////////////////////////// -// Copyright (c) - 2015 - Olivier Belanger // -// Permission to use, copy, modify, and/or distribute this // -// software for any purpose with or without fee is hereby // -// granted, provided that the above copyright notice and this // -// permission notice appear in all copies. CookDSP IS PROVIDED // -// "AS IS", WITHOUT WARRANTY OF ANY KIND FROM THE AUTHOR. // -///////////////////////////////////////////////////////////////// - -@init - -/******************************************************* -GRAINS -====== - -Simple granular synthesis generator. - -Description ------------ - -The `grains` object implements a synchronous granular synthesis. -There will be `num` grains with their starting point equally spaced -in time over the duration specified with the `dur` parameter. It uses -an internal tuckey window function as the grain envelope. - -It must be used with a variable name as prefix (object oriented). - -Initializer ------------ - -#### grains(num, pitch, pos, dur, pitrnd, posrnd, maxlen) #### - -The `grains` function initializes a synchronous granular synthesis -generator. It provides control over the number of overlapped grains -(`num`), the overall transposition (`pitch`), the position of the -playback pointer (`pos`), normalized between 0 and 1 and the duration, -in seconds, of the grains (`dur`). The arguments `pitrnd` and `posrnd` -control the amount of random applied to the pitch and the playback -position of each grain (regardless of the values of the other grains). -These arguments are normalized between 0 and 1. The `maxlen` argument -is the length of the internal memory, in seconds, allocated at -initialization time. This space will be used to record the samples -to be granulated. - -Methods -------- - -#### grains_record(state) #### - -If `state` is 1, the object starts recording the samples given as -argument to `grains_do` method into the internal memory space. A -`state` of 0 stops the recording and switch back to the playing mode. -If the recording reach the end of the internal memory, the recording -is stopped automatically. - -#### grains_set(num, pitch, pos, dur, pitrnd, posrnd) #### - -Sets all parameters at once. See other methods for more details. - -#### grains_set_num(num) #### - -Sets a new number of overlapped grains `num`. The maximum number of -grains is 128. - -#### grains_set_pitch(pitch) #### - -Sets a new transposition factor `pitch` (1 means no transposition). - -#### grains_set_pos(pos) #### - -Sets a new playback position `pos`, normalized between 0 (beginning) -and 1 (end), into the recording chunk. - -#### grains_set_dur(dur) #### - -Sets a new grain duration `dur`, in seconds. - -#### grains_set_pitrnd(pitrnd) #### - -Sets a new pitch random factor, between 0 (no transposition) and 1 -(full range random transposition). - -#### grains_set_posrnd(posrnd) #### - -Sets a new position random factor, between 0 (no deviation) and 1 -(full range random deviation). - -#### grains_do(signal) #### - -Processes one samples of an input signal `signal` and outputs -the processed sample. - -Example -------- - - desc:Simple Granulator - - slider1:24<1,64,1>Number Of Grains - slider2:1<0.125,4>Transposition - slider3:0.5<0,1>Reading Position - slider4:0.1<0.01,0.5>Grain Duration - slider5:0.1<0,1>Random Transposition - slider6:0.1<0,1>Random Position - slider7:0<0,1,1{Playing,Recording}>Play/Record Mode - - import cookdsp.jsfx-inc - - @init - // Initializes 2 granulators with an internal memory of 10 seconds. - bufL = grL.grains(slider1, slider2, slider3, slider4, slider5, slider6, 10); - bufR = grR.grains(slider1, slider2, slider3, slider4, slider5, slider6, 10); - - @slider - // Sets all parameters at once. - grL.grains_set(slider1, slider2, slider3, slider4, slider5, slider6); - grR.grains_set(slider1, slider2, slider3, slider4, slider5, slider6); - // We need to record some samples in memory to be able to granulate them. - grL.grains_record(slider7); - grR.grains_record(slider7); - - @sample - // Only output signal when in playing state. - play_state == 1 ? ( - spl0 = grL.grains_do(spl0); - spl1 = grR.grains_do(spl1); - ); - -********************************************************/ - -// Private functions -function _grains_init_memories() -( - this.startpos = memalloc(128); - this.gsize = memalloc(128); - this.gphase = memalloc(128); - this.lastpos = memalloc(128); -); - -function _grains_reset_memories() -( - memset(this.startpos, 0, 128); - memset(this.gsize, 0, 128); - memset(this.gphase, 0, 128); - memset(this.lastpos, 0, 128); -); - -function _grains_compute_phase_inc() -( - this.dur == 0 ? durtosamps_ = 0 : durtosamps_ = (1 / this.dur) / srate; - this.inc = this.pitch * durtosamps_; -); - -// grains setter functions -function grains_set_num(num) -( - num != this.num ? ( - num > 128 ? num = 128; - this.num = num; - num <= 24 ? ( - this.gain = pow(10, -num/2 * 0.05); - ) : ( - this.gain = pow(10, -12 * 0.05); - ); - this._grains_reset_memories(); - nc_ = 0; - loop(num, - ph_ = (nc_/num) * (1.0 + (rand(2)-1) * 0.01); - ph_ < 0 ? ph_ = 0 : ph_ >= 1 ? ph_ -= 1; - this.gphase[nc_] = ph_; - this.lastpos[nc_] = 1; - nc_ += 1; - ); - ); -); - -function grains_set_pitch(pitch) -( - pitch != this.pitch ? ( - this.pitch = pitch; - this._grains_compute_phase_inc(); - ); -); - -function grains_set_pos(pos) -( - pos < 0 ? pos = 0 : pos > 1 ? pos = 1; - this.pos = pos; -); - -function grains_set_dur(dur) -( - dur != this.dur ? ( - this.dur = dur; - this._grains_compute_phase_inc(); - ); -); - -function grains_set_pitrnd(pitrnd) -( - pitrnd < 0 ? pitrnd = 0 : pitrnd > 1 ? pitrnd = 1; - this.pitrnd = pow(pitrnd, 3) * 0.5; -); - -function grains_set_posrnd(posrnd) -( - posrnd < 0 ? posrnd = 0 : posrnd > 1 ? posrnd = 1; - this.posrnd = pow(posrnd, 3) * 0.5; -); - -function grains_set(num pitch pos dur pitrnd posrnd) -( - this.grains_set_num(num); - this.grains_set_pitch(pitch); - this.grains_set_pos(pos); - this.grains_set_dur(dur); - this.grains_set_pitrnd(pitrnd); - this.grains_set_posrnd(posrnd); -); - -// grains initializer -function grains(num pitch pos dur pitrnd posrnd maxlen) -( - this.maxlen = maxlen; - bufloc_ = this.buf.buffer(srate*maxlen); - this.env.buffer(1024); this.env.buffer_window(6); - this.grains_set_pitch(pitch); - this.grains_set_pos(pos); - this.grains_set_dur(dur); - this.grains_set_pitrnd(pitrnd); - this.grains_set_posrnd(posrnd); - this._grains_init_memories(); - this.grains_set_num(num); - this.phase = this.recpos = this.reclen = this.sum = this.record = 0; - bufloc_; // return buffer location into the global memory -); - -// grains start/stop record function -function grains_record(state) -( - state == 1 && this.record == 0 ? ( - this.record = 1; - ) : state == 0 && this.record == 1 ? ( - this.record = this.recpos = 0; - ); -); - -function grains_do(signal) -( - this.record == 1 ? ( // record input signal - tmp_ = signal; - this.buf.buffer_write(this.recpos, signal); - this.recpos += 1; - this.reclen = this.recpos; - this.recpos == (srate*this.maxlen) ? this.grains_record(0); - ) : ( // granulate recorded signal - tmp_ = 0; - nc_ = 0; - loop(this.num, - ppos_ = this.phase + this.gphase[nc_]; - ppos_ >= 1 ? ppos_ -= 1; - amp_ = this.env.buffer_fnread2(ppos_); - ppos_ < this.lastpos[nc_] ? ( - len_ = this.reclen - this.gsize[nc_]; - this.gsize[nc_] = this.dur * srate; - this.gsize[nc_] *= 1 + (rand(2)-1) * this.pitrnd; - this.startpos[nc_] = this.pos * len_; - this.startpos[nc_] += (rand(2)-1) * this.posrnd * this.reclen; - this.startpos[nc_] < 0 ? ( - this.startpos[nc_] += len_; - ) : this.startpos[nc_] >= len_ ? ( - this.startpos[nc_] -= len_; - ); - ); - this.lastpos[nc_] = ppos_; - index_ = ppos_ * this.gsize[nc_] + this.startpos[nc_]; - index_ >= 0 && index_ < this.reclen ? ( - tmp_ += this.buf.buffer_fread2(index_) * amp_; - ); - nc_ += 1; - ); - tmp_ *= this.gain; - this.phase += this.inc; - this.phase < 0 ? this.phase += 1 : this.phase >= 1 ? this.phase -= 1; - ); - tmp_; -); diff --git a/FX/BryanChi_FX Devices/cookdsp/list.jsfx-inc b/FX/BryanChi_FX Devices/cookdsp/list.jsfx-inc deleted file mode 100644 index 011d4368a..000000000 --- a/FX/BryanChi_FX Devices/cookdsp/list.jsfx-inc +++ /dev/null @@ -1,1280 +0,0 @@ -///////////////////////////////////////////////////////////////// -// Copyright (c) - 2015 - Olivier Belanger // -// Permission to use, copy, modify, and/or distribute this // -// software for any purpose with or without fee is hereby // -// granted, provided that the above copyright notice and this // -// permission notice appear in all copies. CookDSP IS PROVIDED // -// "AS IS", WITHOUT WARRANTY OF ANY KIND FROM THE AUTHOR. // -///////////////////////////////////////////////////////////////// - -/******************************************************* -LIST -==== - -Create a list and fill it with the given arguments. - -Signature ---------- - -index = list(h1 [, ..., h40]) - -Description ------------ - -The `list` function initializes a list of length equal to -the *number of arguments + 1*. The first position in the -list (index[0]) hold the list length and the remaining -spaces are filled with the arguments given at the function -call. The function returns the first position of the -allocated memory (ie the length of the list). To loop -over the list, do something like: - - mylist = list(100,200,300,400,500); - k = 1; - while (k <= mylist[0]) ( - v = mylist[k]; - k += 1; - ) - -This function uses `memalloc` internally, so it is safe to -use it beside other CookDSP objects that use memory. - -Arguments ---------- - -- *h1* {float} : First value stored into the list. -- *h2, ..., h40* {float} : Following values, up to 40 arguments. - -Return ------- - -- *index* {int} : first index of the allocated memory. - -Example -------- - - desc:Bandpass Filter Bank - - import cookdsp.jsfx-inc - - slider1:600<20, 1000>Filter Freq 1 - slider2:900<200, 1500>Filter Freq 2 - slider3:1500<1000, 2000>Filter Freq 3 - slider4:2000<1500, 3000>Filter Freq 4 - slider5:10<1,100>Filters Q - - @init - // Create lists for filters's frequency and Q - freq = list(400, 1700, 3500, 8000); - q = list(slider5, slider5, slider5, slider5); - // Create a bank of bandpass filters - bps.Pbp(freq, q); - - @slider - // Update lists values - k = 1; - while (k <= freq[0]) ( - freq[k] = slider(k); - q[k] = slider5; - k += 1; - ); - // Sets the new values to the filters - bps.Pbp_set_freq(freq); - bps.Pbp_set_q(q); - gain = scale(slider5, 1, 100, 1, 10, 1); - - @sample - outbp = bps.Pbp_do(tmp(spl0, spl1)); - outsig = sumchnls(2, outbp); - spl0 = outsig[0] * gain; - spl1 = outsig[1] * gain; - -********************************************************/ - -@init - -_TMPLISTFIRSTPOS_ = 8388500; -_SUMLISTFIRSTPOS_ = 8388550; - -function list(h1) -( - this.buf = memalloc(2); - this.buf[0] = 1; - this.buf[1] = h1; - this.buf; -); -function list(h1 h2) -( - this.buf = memalloc(3); - this.buf[0] = 2; - this.buf[1] = h1; this.buf[2] = h2; - this.buf; -); -function list(h1 h2 h3) -( - this.buf = memalloc(4); - this.buf[0] = 3; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; - this.buf; -); -function list(h1 h2 h3 h4) -( - this.buf = memalloc(5); - this.buf[0] = 4; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf; -); -function list(h1 h2 h3 h4 h5) -( - this.buf = memalloc(6); - this.buf[0] = 5; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; - this.buf; -); -function list(h1 h2 h3 h4 h5 h6) -( - this.buf = memalloc(7); - this.buf[0] = 6; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; - this.buf; -); -function list(h1 h2 h3 h4 h5 h6 h7) -( - this.buf = memalloc(8); - this.buf[0] = 7; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; - this.buf; -); -function list(h1 h2 h3 h4 h5 h6 h7 h8) -( - this.buf = memalloc(9); - this.buf[0] = 8; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf; -); -function list(h1 h2 h3 h4 h5 h6 h7 h8 h9) -( - this.buf = memalloc(10); - this.buf[0] = 9; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; - this.buf; -); -function list(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10) -( - this.buf = memalloc(11); - this.buf[0] = 10; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; - this.buf; -); -function list(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11) -( - this.buf = memalloc(12); - this.buf[0] = 11; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; - this.buf; -); -function list(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12) -( - this.buf = memalloc(13); - this.buf[0] = 12; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf; -); -function list(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13) -( - this.buf = memalloc(14); - this.buf[0] = 13; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; - this.buf; -); -function list(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14) -( - this.buf = memalloc(15); - this.buf[0] = 14; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; - this.buf; -); -function list(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15) -( - this.buf = memalloc(16); - this.buf[0] = 15; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; - this.buf; -); -function list(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16) -( - this.buf = memalloc(17); - this.buf[0] = 16; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf; -); -function list(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17) -( - this.buf = memalloc(18); - this.buf[0] = 17; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; - this.buf; -); -function list(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18) -( - this.buf = memalloc(19); - this.buf[0] = 18; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; - this.buf; -); -function list(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19) -( - this.buf = memalloc(20); - this.buf[0] = 19; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; - this.buf; -); -function list(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20) -( - this.buf = memalloc(21); - this.buf[0] = 20; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; this.buf[20] = h20; - this.buf; -); -function list(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21) -( - this.buf = memalloc(22); - this.buf[0] = 21; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; this.buf[20] = h20; - this.buf[21] = h21; - this.buf; -); -function list(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22) -( - this.buf = memalloc(23); - this.buf[0] = 22; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; this.buf[20] = h20; - this.buf[21] = h21; this.buf[22] = h22; - this.buf; -); -function list(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23) -( - this.buf = memalloc(24); - this.buf[0] = 23; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; this.buf[20] = h20; - this.buf[21] = h21; this.buf[22] = h22; this.buf[23] = h23; - this.buf; -); -function list(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24) -( - this.buf = memalloc(25); - this.buf[0] = 24; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; this.buf[20] = h20; - this.buf[21] = h21; this.buf[22] = h22; this.buf[23] = h23; this.buf[24] = h24; - this.buf; -); -function list(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25) -( - this.buf = memalloc(26); - this.buf[0] = 25; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; this.buf[20] = h20; - this.buf[21] = h21; this.buf[22] = h22; this.buf[23] = h23; this.buf[24] = h24; - this.buf[25] = h25; - this.buf; -); -function list(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26) -( - this.buf = memalloc(27); - this.buf[0] = 26; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; this.buf[20] = h20; - this.buf[21] = h21; this.buf[22] = h22; this.buf[23] = h23; this.buf[24] = h24; - this.buf[25] = h25; this.buf[26] = h26; - this.buf; -); -function list(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27) -( - this.buf = memalloc(28); - this.buf[0] = 27; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; this.buf[20] = h20; - this.buf[21] = h21; this.buf[22] = h22; this.buf[23] = h23; this.buf[24] = h24; - this.buf[25] = h25; this.buf[26] = h26; this.buf[27] = h27; - this.buf; -); -function list(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28) -( - this.buf = memalloc(29); - this.buf[0] = 28; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; this.buf[20] = h20; - this.buf[21] = h21; this.buf[22] = h22; this.buf[23] = h23; this.buf[24] = h24; - this.buf[25] = h25; this.buf[26] = h26; this.buf[27] = h27; this.buf[28] = h28; - this.buf; -); -function list(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29) -( - this.buf = memalloc(30); - this.buf[0] = 29; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; this.buf[20] = h20; - this.buf[21] = h21; this.buf[22] = h22; this.buf[23] = h23; this.buf[24] = h24; - this.buf[25] = h25; this.buf[26] = h26; this.buf[27] = h27; this.buf[28] = h28; - this.buf[29] = h29; - this.buf; -); -function list(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30) -( - this.buf = memalloc(31); - this.buf[0] = 30; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; this.buf[20] = h20; - this.buf[21] = h21; this.buf[22] = h22; this.buf[23] = h23; this.buf[24] = h24; - this.buf[25] = h25; this.buf[26] = h26; this.buf[27] = h27; this.buf[28] = h28; - this.buf[29] = h29; this.buf[30] = h30; - this.buf; -); -function list(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30 h31) -( - this.buf = memalloc(32); - this.buf[0] = 31; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; this.buf[20] = h20; - this.buf[21] = h21; this.buf[22] = h22; this.buf[23] = h23; this.buf[24] = h24; - this.buf[25] = h25; this.buf[26] = h26; this.buf[27] = h27; this.buf[28] = h28; - this.buf[29] = h29; this.buf[30] = h30; this.buf[31] = h31; - this.buf; -); -function list(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30 h31 h32) -( - this.buf = memalloc(33); - this.buf[0] = 32; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; this.buf[20] = h20; - this.buf[21] = h21; this.buf[22] = h22; this.buf[23] = h23; this.buf[24] = h24; - this.buf[25] = h25; this.buf[26] = h26; this.buf[27] = h27; this.buf[28] = h28; - this.buf[29] = h29; this.buf[30] = h30; this.buf[31] = h31; this.buf[32] = h32; - this.buf; -); -function list(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30 h31 h32 h33) -( - this.buf = memalloc(34); - this.buf[0] = 33; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; this.buf[20] = h20; - this.buf[21] = h21; this.buf[22] = h22; this.buf[23] = h23; this.buf[24] = h24; - this.buf[25] = h25; this.buf[26] = h26; this.buf[27] = h27; this.buf[28] = h28; - this.buf[29] = h29; this.buf[30] = h30; this.buf[31] = h31; this.buf[32] = h32; - this.buf[33] = h33; - this.buf; -); -function list(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30 h31 h32 h33 h34) -( - this.buf = memalloc(35); - this.buf[0] = 34; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; this.buf[20] = h20; - this.buf[21] = h21; this.buf[22] = h22; this.buf[23] = h23; this.buf[24] = h24; - this.buf[25] = h25; this.buf[26] = h26; this.buf[27] = h27; this.buf[28] = h28; - this.buf[29] = h29; this.buf[30] = h30; this.buf[31] = h31; this.buf[32] = h32; - this.buf[33] = h33; this.buf[34] = h34; - this.buf; -); -function list(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30 h31 h32 h33 h34 h35) -( - this.buf = memalloc(36); - this.buf[0] = 35; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; this.buf[20] = h20; - this.buf[21] = h21; this.buf[22] = h22; this.buf[23] = h23; this.buf[24] = h24; - this.buf[25] = h25; this.buf[26] = h26; this.buf[27] = h27; this.buf[28] = h28; - this.buf[29] = h29; this.buf[30] = h30; this.buf[31] = h31; this.buf[32] = h32; - this.buf[33] = h33; this.buf[34] = h34; this.buf[35] = h35; - this.buf; -); -function list(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30 h31 h32 h33 h34 h35 h36) -( - this.buf = memalloc(37); - this.buf[0] = 36; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; this.buf[20] = h20; - this.buf[21] = h21; this.buf[22] = h22; this.buf[23] = h23; this.buf[24] = h24; - this.buf[25] = h25; this.buf[26] = h26; this.buf[27] = h27; this.buf[28] = h28; - this.buf[29] = h29; this.buf[30] = h30; this.buf[31] = h31; this.buf[32] = h32; - this.buf[33] = h33; this.buf[34] = h34; this.buf[35] = h35; this.buf[36] = h36; - this.buf; -); -function list(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30 h31 h32 h33 h34 h35 h36 h37) -( - this.buf = memalloc(38); - this.buf[0] = 37; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; this.buf[20] = h20; - this.buf[21] = h21; this.buf[22] = h22; this.buf[23] = h23; this.buf[24] = h24; - this.buf[25] = h25; this.buf[26] = h26; this.buf[27] = h27; this.buf[28] = h28; - this.buf[29] = h29; this.buf[30] = h30; this.buf[31] = h31; this.buf[32] = h32; - this.buf[33] = h33; this.buf[34] = h34; this.buf[35] = h35; this.buf[36] = h36; - this.buf[37] = h37; - this.buf; -); -function list(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30 h31 h32 h33 h34 h35 h36 h37 h38) -( - this.buf = memalloc(39); - this.buf[0] = 38; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; this.buf[20] = h20; - this.buf[21] = h21; this.buf[22] = h22; this.buf[23] = h23; this.buf[24] = h24; - this.buf[25] = h25; this.buf[26] = h26; this.buf[27] = h27; this.buf[28] = h28; - this.buf[29] = h29; this.buf[30] = h30; this.buf[31] = h31; this.buf[32] = h32; - this.buf[33] = h33; this.buf[34] = h34; this.buf[35] = h35; this.buf[36] = h36; - this.buf[37] = h37; this.buf[38] = h38; - this.buf; -); -function list(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30 h31 h32 h33 h34 h35 h36 h37 h38 h39) -( - this.buf = memalloc(40); - this.buf[0] = 39; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; this.buf[20] = h20; - this.buf[21] = h21; this.buf[22] = h22; this.buf[23] = h23; this.buf[24] = h24; - this.buf[25] = h25; this.buf[26] = h26; this.buf[27] = h27; this.buf[28] = h28; - this.buf[29] = h29; this.buf[30] = h30; this.buf[31] = h31; this.buf[32] = h32; - this.buf[33] = h33; this.buf[34] = h34; this.buf[35] = h35; this.buf[36] = h36; - this.buf[37] = h37; this.buf[38] = h38; this.buf[39] = h39; - this.buf; -); -function list(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30 h31 h32 h33 h34 h35 h36 h37 h38 h39 h40) -( - this.buf = memalloc(41); - this.buf[0] = 40; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; this.buf[20] = h20; - this.buf[21] = h21; this.buf[22] = h22; this.buf[23] = h23; this.buf[24] = h24; - this.buf[25] = h25; this.buf[26] = h26; this.buf[27] = h27; this.buf[28] = h28; - this.buf[29] = h29; this.buf[30] = h30; this.buf[31] = h31; this.buf[32] = h32; - this.buf[33] = h33; this.buf[34] = h34; this.buf[35] = h35; this.buf[36] = h36; - this.buf[37] = h37; this.buf[38] = h38; this.buf[39] = h39; this.buf[40] = h40; - this.buf; -); - -/******************************************************* -SET -=== - -Create a list and fill it with a single value. - -Signature ---------- - -index = set(n, value) - -Description ------------ - -The `set` function initializes a list of length equal to -*n + 1*. The first position in the list (index[0]) hold -the list length and the remaining spaces are filled with -the value `value` given at the function call. The -function returns the first position of the allocated -memory (ie the length of the list). To loop over the -list, do something like: - - mylist = set(8, 0); - k = 1; - while (k <= mylist[0]) ( - mylist[k] = rand(2) - 1; - k += 1; - ) - -This function uses `memalloc` internally, so it is safe to -use it beside other CookDSP objects that use memory. - -Arguments ---------- - -- *n* {int} : Length of the list. -- *value* {float} : Floating-point value used to fill the list. - -Return ------- - -- *index* {int} : first index of the allocated memory. - -Example -------- - - desc:Bandpass Filter Bank - - import cookdsp.jsfx-inc - - slider1:600<20, 1000>Filter Freq 1 - slider2:900<200, 1500>Filter Freq 2 - slider3:1500<1000, 2000>Filter Freq 3 - slider4:2000<1500, 3000>Filter Freq 4 - slider5:10<1,100>Filters Q - - @init - // Just initialize lists, to be filled later, - // for filters's frequency and Q - freq = set(4, 0); - q = set(4, 0); - // Create a bank of bandpass filters - bps.Pbp(freq, q); - - @slider - // Update list values - k = 1; - while (k <= freq[0]) ( - freq[k] = slider(k); - q[k] = slider5; - k += 1; - ); - // Sets the new values to the filters - bps.Pbp_set_freq(freq); - bps.Pbp_set_q(q); - gain = scale(slider5, 1, 100, 1, 10, 1); - - @sample - outbp = bps.Pbp_do(tmp(spl0, spl1)); - outsig = sumchnls(2, outbp); - spl0 = outsig[0] * gain; - spl1 = outsig[1] * gain; - -********************************************************/ -function set(n value) -( - this.buf = memalloc(n+1); - this.buf[0] = n; - memset(this.buf+1, value, n); - this.buf; -); - -/******************************************************* -TMP -=== - -Fill the temporary memory with the given arguments. - -Signature ---------- - -index = tmp(h1 [, ..., h40]) - -Description ------------ - -The `tmp` function fills the temporary memory for a total -length equal to the *number of arguments + 1*. The first -position in the list (index[0]) hold the list length and -the remaining spaces are filled with the arguments given -at the function call. The function returns the first -position of the reserved temporary memory (holding the -length of the list). - -This function always uses the same memory space (beginning -at index 8388500) and should be use immediately after storing -values. It is primarily intended to be used in the @sample -section of code, where we don't want to continuously -allocate new memory spaces. - -Arguments ---------- - -- *h1* {float} : First value stored into the list. -- *h2, ..., h40* {float} : Following values, up to 40 arguments. - -Return ------- - -- *index* {int} : first index of the temporary reserved memory. - -Example -------- - - desc:Bandpass Filter Bank - - import cookdsp.jsfx-inc - - slider1:600<20, 1000>Filter Freq 1 - slider2:900<200, 1500>Filter Freq 2 - slider3:1500<1000, 2000>Filter Freq 3 - slider4:2000<1500, 3000>Filter Freq 4 - slider5:10<1,100>Filters Q - - @init - freq = list(400, 1700, 3500, 8000); - q = list(slider5, slider5, slider5, slider5); - bps.Pbp(freq, q); - - @slider - k = 1; - while (k <= freq[0]) ( - freq[k] = slider(k); - q[k] = slider5; - k += 1; - ); - bps.Pbp_set_freq(freq); - bps.Pbp_set_q(q); - gain = scale(slider5, 1, 100, 1, 10, 1); - - @sample - // Use "tmp" function to pass a list of floats - // to the Pbp_do() function. All P*_do() functions - // wraps around the tmp list length so it is - // safe to pass a list of different length than - // the number of internal objects. - outbp = bps.Pbp_do(tmp(spl0, spl1)); - outsig = sumchnls(2, outbp); - spl0 = outsig[0] * gain; - spl1 = outsig[1] * gain; - -********************************************************/ -function tmp(h1) -( - this.buf = _TMPLISTFIRSTPOS_; - this.buf[0] = 1; - this.buf[1] = h1; - this.buf; -); -function tmp(h1 h2) -( - this.buf = _TMPLISTFIRSTPOS_; - this.buf[0] = 2; - this.buf[1] = h1; this.buf[2] = h2; - this.buf; -); -function tmp(h1 h2 h3) -( - this.buf = _TMPLISTFIRSTPOS_; - this.buf[0] = 3; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; - this.buf; -); -function tmp(h1 h2 h3 h4) -( - this.buf = _TMPLISTFIRSTPOS_; - this.buf[0] = 4; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf; -); -function tmp(h1 h2 h3 h4 h5) -( - this.buf = _TMPLISTFIRSTPOS_; - this.buf[0] = 5; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; - this.buf; -); -function tmp(h1 h2 h3 h4 h5 h6) -( - this.buf = _TMPLISTFIRSTPOS_; - this.buf[0] = 6; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; - this.buf; -); -function tmp(h1 h2 h3 h4 h5 h6 h7) -( - this.buf = _TMPLISTFIRSTPOS_; - this.buf[0] = 7; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; - this.buf; -); -function tmp(h1 h2 h3 h4 h5 h6 h7 h8) -( - this.buf = _TMPLISTFIRSTPOS_; - this.buf[0] = 8; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf; -); -function tmp(h1 h2 h3 h4 h5 h6 h7 h8 h9) -( - this.buf = _TMPLISTFIRSTPOS_; - this.buf[0] = 9; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; - this.buf; -); -function tmp(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10) -( - this.buf = _TMPLISTFIRSTPOS_; - this.buf[0] = 10; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; - this.buf; -); -function tmp(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11) -( - this.buf = _TMPLISTFIRSTPOS_; - this.buf[0] = 11; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; - this.buf; -); -function tmp(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12) -( - this.buf = _TMPLISTFIRSTPOS_; - this.buf[0] = 12; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf; -); -function tmp(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13) -( - this.buf = _TMPLISTFIRSTPOS_; - this.buf[0] = 13; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; - this.buf; -); -function tmp(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14) -( - this.buf = _TMPLISTFIRSTPOS_; - this.buf[0] = 14; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; - this.buf; -); -function tmp(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15) -( - this.buf = _TMPLISTFIRSTPOS_; - this.buf[0] = 15; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; - this.buf; -); -function tmp(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16) -( - this.buf = _TMPLISTFIRSTPOS_; - this.buf[0] = 16; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf; -); -function tmp(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17) -( - this.buf = _TMPLISTFIRSTPOS_; - this.buf[0] = 17; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; - this.buf; -); -function tmp(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18) -( - this.buf = _TMPLISTFIRSTPOS_; - this.buf[0] = 18; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; - this.buf; -); -function tmp(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19) -( - this.buf = _TMPLISTFIRSTPOS_; - this.buf[0] = 19; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; - this.buf; -); -function tmp(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20) -( - this.buf = _TMPLISTFIRSTPOS_; - this.buf[0] = 20; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; this.buf[20] = h20; - this.buf; -); -function tmp(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21) -( - this.buf = _TMPLISTFIRSTPOS_; - this.buf[0] = 21; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; this.buf[20] = h20; - this.buf[21] = h21; - this.buf; -); -function tmp(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22) -( - this.buf = _TMPLISTFIRSTPOS_; - this.buf[0] = 22; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; this.buf[20] = h20; - this.buf[21] = h21; this.buf[22] = h22; - this.buf; -); -function tmp(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23) -( - this.buf = _TMPLISTFIRSTPOS_; - this.buf[0] = 23; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; this.buf[20] = h20; - this.buf[21] = h21; this.buf[22] = h22; this.buf[23] = h23; - this.buf; -); -function tmp(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24) -( - this.buf = _TMPLISTFIRSTPOS_; - this.buf[0] = 24; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; this.buf[20] = h20; - this.buf[21] = h21; this.buf[22] = h22; this.buf[23] = h23; this.buf[24] = h24; - this.buf; -); -function tmp(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25) -( - this.buf = _TMPLISTFIRSTPOS_; - this.buf[0] = 25; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; this.buf[20] = h20; - this.buf[21] = h21; this.buf[22] = h22; this.buf[23] = h23; this.buf[24] = h24; - this.buf[25] = h25; - this.buf; -); -function tmp(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26) -( - this.buf = _TMPLISTFIRSTPOS_; - this.buf[0] = 26; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; this.buf[20] = h20; - this.buf[21] = h21; this.buf[22] = h22; this.buf[23] = h23; this.buf[24] = h24; - this.buf[25] = h25; this.buf[26] = h26; - this.buf; -); -function tmp(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27) -( - this.buf = _TMPLISTFIRSTPOS_; - this.buf[0] = 27; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; this.buf[20] = h20; - this.buf[21] = h21; this.buf[22] = h22; this.buf[23] = h23; this.buf[24] = h24; - this.buf[25] = h25; this.buf[26] = h26; this.buf[27] = h27; - this.buf; -); -function tmp(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28) -( - this.buf = _TMPLISTFIRSTPOS_; - this.buf[0] = 28; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; this.buf[20] = h20; - this.buf[21] = h21; this.buf[22] = h22; this.buf[23] = h23; this.buf[24] = h24; - this.buf[25] = h25; this.buf[26] = h26; this.buf[27] = h27; this.buf[28] = h28; - this.buf; -); -function tmp(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29) -( - this.buf = _TMPLISTFIRSTPOS_; - this.buf[0] = 29; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; this.buf[20] = h20; - this.buf[21] = h21; this.buf[22] = h22; this.buf[23] = h23; this.buf[24] = h24; - this.buf[25] = h25; this.buf[26] = h26; this.buf[27] = h27; this.buf[28] = h28; - this.buf[29] = h29; - this.buf; -); -function tmp(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30) -( - this.buf = _TMPLISTFIRSTPOS_; - this.buf[0] = 30; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; this.buf[20] = h20; - this.buf[21] = h21; this.buf[22] = h22; this.buf[23] = h23; this.buf[24] = h24; - this.buf[25] = h25; this.buf[26] = h26; this.buf[27] = h27; this.buf[28] = h28; - this.buf[29] = h29; this.buf[30] = h30; - this.buf; -); -function tmp(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30 h31) -( - this.buf = _TMPLISTFIRSTPOS_; - this.buf[0] = 31; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; this.buf[20] = h20; - this.buf[21] = h21; this.buf[22] = h22; this.buf[23] = h23; this.buf[24] = h24; - this.buf[25] = h25; this.buf[26] = h26; this.buf[27] = h27; this.buf[28] = h28; - this.buf[29] = h29; this.buf[30] = h30; this.buf[31] = h31; - this.buf; -); -function tmp(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30 h31 h32) -( - this.buf = _TMPLISTFIRSTPOS_; - this.buf[0] = 32; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; this.buf[20] = h20; - this.buf[21] = h21; this.buf[22] = h22; this.buf[23] = h23; this.buf[24] = h24; - this.buf[25] = h25; this.buf[26] = h26; this.buf[27] = h27; this.buf[28] = h28; - this.buf[29] = h29; this.buf[30] = h30; this.buf[31] = h31; this.buf[32] = h32; - this.buf; -); -function tmp(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30 h31 h32 h33) -( - this.buf = _TMPLISTFIRSTPOS_; - this.buf[0] = 33; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; this.buf[20] = h20; - this.buf[21] = h21; this.buf[22] = h22; this.buf[23] = h23; this.buf[24] = h24; - this.buf[25] = h25; this.buf[26] = h26; this.buf[27] = h27; this.buf[28] = h28; - this.buf[29] = h29; this.buf[30] = h30; this.buf[31] = h31; this.buf[32] = h32; - this.buf[33] = h33; - this.buf; -); -function tmp(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30 h31 h32 h33 h34) -( - this.buf = _TMPLISTFIRSTPOS_; - this.buf[0] = 34; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; this.buf[20] = h20; - this.buf[21] = h21; this.buf[22] = h22; this.buf[23] = h23; this.buf[24] = h24; - this.buf[25] = h25; this.buf[26] = h26; this.buf[27] = h27; this.buf[28] = h28; - this.buf[29] = h29; this.buf[30] = h30; this.buf[31] = h31; this.buf[32] = h32; - this.buf[33] = h33; this.buf[34] = h34; - this.buf; -); -function tmp(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30 h31 h32 h33 h34 h35) -( - this.buf = _TMPLISTFIRSTPOS_; - this.buf[0] = 35; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; this.buf[20] = h20; - this.buf[21] = h21; this.buf[22] = h22; this.buf[23] = h23; this.buf[24] = h24; - this.buf[25] = h25; this.buf[26] = h26; this.buf[27] = h27; this.buf[28] = h28; - this.buf[29] = h29; this.buf[30] = h30; this.buf[31] = h31; this.buf[32] = h32; - this.buf[33] = h33; this.buf[34] = h34; this.buf[35] = h35; - this.buf; -); -function tmp(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30 h31 h32 h33 h34 h35 h36) -( - this.buf = _TMPLISTFIRSTPOS_; - this.buf[0] = 36; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; this.buf[20] = h20; - this.buf[21] = h21; this.buf[22] = h22; this.buf[23] = h23; this.buf[24] = h24; - this.buf[25] = h25; this.buf[26] = h26; this.buf[27] = h27; this.buf[28] = h28; - this.buf[29] = h29; this.buf[30] = h30; this.buf[31] = h31; this.buf[32] = h32; - this.buf[33] = h33; this.buf[34] = h34; this.buf[35] = h35; this.buf[36] = h36; - this.buf; -); -function tmp(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30 h31 h32 h33 h34 h35 h36 h37) -( - this.buf = _TMPLISTFIRSTPOS_; - this.buf[0] = 37; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; this.buf[20] = h20; - this.buf[21] = h21; this.buf[22] = h22; this.buf[23] = h23; this.buf[24] = h24; - this.buf[25] = h25; this.buf[26] = h26; this.buf[27] = h27; this.buf[28] = h28; - this.buf[29] = h29; this.buf[30] = h30; this.buf[31] = h31; this.buf[32] = h32; - this.buf[33] = h33; this.buf[34] = h34; this.buf[35] = h35; this.buf[36] = h36; - this.buf[37] = h37; - this.buf; -); -function tmp(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30 h31 h32 h33 h34 h35 h36 h37 h38) -( - this.buf = _TMPLISTFIRSTPOS_; - this.buf[0] = 38; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; this.buf[20] = h20; - this.buf[21] = h21; this.buf[22] = h22; this.buf[23] = h23; this.buf[24] = h24; - this.buf[25] = h25; this.buf[26] = h26; this.buf[27] = h27; this.buf[28] = h28; - this.buf[29] = h29; this.buf[30] = h30; this.buf[31] = h31; this.buf[32] = h32; - this.buf[33] = h33; this.buf[34] = h34; this.buf[35] = h35; this.buf[36] = h36; - this.buf[37] = h37; this.buf[38] = h38; - this.buf; -); -function tmp(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30 h31 h32 h33 h34 h35 h36 h37 h38 h39) -( - this.buf = _TMPLISTFIRSTPOS_; - this.buf[0] = 39; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; this.buf[20] = h20; - this.buf[21] = h21; this.buf[22] = h22; this.buf[23] = h23; this.buf[24] = h24; - this.buf[25] = h25; this.buf[26] = h26; this.buf[27] = h27; this.buf[28] = h28; - this.buf[29] = h29; this.buf[30] = h30; this.buf[31] = h31; this.buf[32] = h32; - this.buf[33] = h33; this.buf[34] = h34; this.buf[35] = h35; this.buf[36] = h36; - this.buf[37] = h37; this.buf[38] = h38; this.buf[39] = h39; - this.buf; -); -function tmp(h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24 h25 h26 h27 h28 h29 h30 h31 h32 h33 h34 h35 h36 h37 h38 h39 h40) -( - this.buf = _TMPLISTFIRSTPOS_; - this.buf[0] = 40; - this.buf[1] = h1; this.buf[2] = h2; this.buf[3] = h3; this.buf[4] = h4; - this.buf[5] = h5; this.buf[6] = h6; this.buf[7] = h7; this.buf[8] = h8; - this.buf[9] = h9; this.buf[10] = h10; this.buf[11] = h11; this.buf[12] = h12; - this.buf[13] = h13; this.buf[14] = h14; this.buf[15] = h15; this.buf[16] = h16; - this.buf[17] = h17; this.buf[18] = h18; this.buf[19] = h19; this.buf[20] = h20; - this.buf[21] = h21; this.buf[22] = h22; this.buf[23] = h23; this.buf[24] = h24; - this.buf[25] = h25; this.buf[26] = h26; this.buf[27] = h27; this.buf[28] = h28; - this.buf[29] = h29; this.buf[30] = h30; this.buf[31] = h31; this.buf[32] = h32; - this.buf[33] = h33; this.buf[34] = h34; this.buf[35] = h35; this.buf[36] = h36; - this.buf[37] = h37; this.buf[38] = h38; this.buf[39] = h39; this.buf[40] = h40; - this.buf; -); - -/******************************************************* -SUMCHNLS -======== - -Mix down a list of `n` values to the desired number of channels. - -Signature ---------- - -index = sumchnls(chnls, list) - -Description ------------ - -The `sunchnls` function wraps any number of values (packed -in a CookDSP list, ie with the list length as first index) -to `chnls` number of values. It computes a simple sum. That -is, a two-channels sum for a list (4, 0.25, 0.1, 0.4, 0.75) -will return a two-values array (0.65, 0.85). The function -returns the first position of the reserved summation memory. - -This function always uses the same memory space (beginning -at index 8388550) and should be use immediately after mixing -values. It is primarily intended to be used in the @sample -section of code, where we don't want to continuously -allocate new memory spaces. - -Arguments ---------- - -- *chnls* {int} : Number of output values. -- *list* {CookDSP list} : List of values to mix together. - -Return ------- - -- *index* {int} : first channel of the summation reserved memory. - -Example -------- - - desc:Bandpass Filter Bank - - import cookdsp.jsfx-inc - - slider1:600<20, 1000>Filter Freq 1 - slider2:900<200, 1500>Filter Freq 2 - slider3:1500<1000, 2000>Filter Freq 3 - slider4:2000<1500, 3000>Filter Freq 4 - slider5:10<1,100>Filters Q - - @init - freq = list(400, 1700, 3500, 8000); - q = list(slider5, slider5, slider5, slider5); - bps.Pbp(freq, q); - - @slider - k = 1; - while (k <= freq[0]) ( - freq[k] = slider(k); - q[k] = slider5; - k += 1; - ); - bps.Pbp_set_freq(freq); - bps.Pbp_set_q(q); - gain = scale(slider5, 1, 100, 1, 10, 1); - - @sample - outbp = bps.Pbp_do(tmp(spl0, spl1)); - // Takes the four bandpass output values and mix them - // in stereo (first + third, second + fourth) - outsig = sumchnls(2, outbp); - spl0 = outsig[0] * gain; - spl1 = outsig[1] * gain; - -********************************************************/ -function sumchnls(chnls, list) -( - num = list[0]; - this.buf = _SUMLISTFIRSTPOS_; - memset(this.buf, 0.0, chnls); - k_ = 0; - while (k_ < num) ( - this.buf[k_ % chnls] += list[k_ + 1]; - k_ += 1; - ); - this.buf; -); diff --git a/FX/BryanChi_FX Devices/cookdsp/memalloc.jsfx-inc b/FX/BryanChi_FX Devices/cookdsp/memalloc.jsfx-inc deleted file mode 100644 index a98288b6c..000000000 --- a/FX/BryanChi_FX Devices/cookdsp/memalloc.jsfx-inc +++ /dev/null @@ -1,104 +0,0 @@ -///////////////////////////////////////////////////////////////// -// Copyright (c) - 2014 - Olivier Belanger // -// Permission to use, copy, modify, and/or distribute this // -// software for any purpose with or without fee is hereby // -// granted, provided that the above copyright notice and this // -// permission notice appear in all copies. CookDSP IS PROVIDED // -// "AS IS", WITHOUT WARRANTY OF ANY KIND FROM THE AUTHOR. // -///////////////////////////////////////////////////////////////// - -@init - -/******************************************************* -MEMALLOC -======== - -Allocate a region of the local memory buffer. - -Signature ---------- - -ret = memalloc(size [, noreinit]) - -Description ------------ - -The memalloc function reserves a region of the local -memory buffer and returns its first index in the memory. -The function will leave 8 memory slots between each -region. These slots can be used as extra spaces, as -needed by interpolation algorithms. - -Other objects of the library that use the local memory -buffer use this function for their space allocations, so -it is recommended to use it every time a space in the -local memory is needed to prevent interferences. - -If `noreinit` is not specified or 0, this function resets -all memory slots to 0.0. - -Arguments ---------- - -- *size* {int} : size, in samples, of the memory region. -- *noreinit* {int} : if greater than 0, the memory slots will - not be initialized to 0.0. Defaults to 0. - -Return ------- - -- *ret* {int} : first index of the buffer in the plugin's memory. - -Example -------- - - desc: Hand-Written Simple Delay Line - - import cookdsp.jsfx-inc - - slider1:0.25<0.001,0.999>Delay in seconds - - @init - // one second stereo memory - buf0 = memalloc(srate); - buf1 = memalloc(srate); - // sample counter - count = 0; - - @sample - // compute delay position - pos = count - floor(slider1 * srate); - pos < 0 ? pos += srate; - // read memories at delay position - out0 = buf0[pos]; - out1 = buf1[pos]; - // record current samples into memories - buf0[count] = spl0; - buf1[count] = spl1; - // output a mix of current and delayed samples - spl0 = (spl0 + out0) * 0.7; - spl1 = (spl1 + out1) * 0.7; - // increment and wrap the counter - count = (count + 1) % srate; - -********************************************************/ -function memalloc(size) -( - __memory_index = __memory_next + 8; - __memory_next = __memory_index + size; - memset(__memory_index, 0.0, size); - __memory_index; -); - -function memalloc(size, noreinit) -( - noreinit == 0 ? ( - __memory_index = __memory_next + 8; - __memory_next = __memory_index + size; - memset(__memory_index, 0.0, size); - ) : ( - __memory_index = __memory_next + 8; - __memory_next = __memory_index + size; - ); - __memory_index; -); diff --git a/FX/BryanChi_FX Devices/cookdsp/midi.jsfx-inc b/FX/BryanChi_FX Devices/cookdsp/midi.jsfx-inc deleted file mode 100644 index effb43db5..000000000 --- a/FX/BryanChi_FX Devices/cookdsp/midi.jsfx-inc +++ /dev/null @@ -1,426 +0,0 @@ -///////////////////////////////////////////////////////////////// -// Copyright (c) - 2014 - Olivier Belanger // -// Permission to use, copy, modify, and/or distribute this // -// software for any purpose with or without fee is hereby // -// granted, provided that the above copyright notice and this // -// permission notice appear in all copies. CookDSP IS PROVIDED // -// "AS IS", WITHOUT WARRANTY OF ANY KIND FROM THE AUTHOR. // -///////////////////////////////////////////////////////////////// - -@init - -/******************************************************* -MASR -==== - -Generate a Midi-triggered Attack-Sustain-Release envelope. - -Description ------------ - -The masr object initializes a midi-triggered attack- -sustain-release envelope with different slope times for -the attack and the release. A positive value given to the -masr_do function triggers the attack part of the envelope -(with the given value as the target amplitude). The value is -held until a 0 comes to the masr_do function. The 0 -triggers the release part of the envelope. - -It must be used with a variable name as prefix (object oriented). - -Initializer ------------ - -#### masr(risetime, falltime) #### - -Initializes the envelope with the attack duration `risetime` -and the release duration `falltime`. Both are times, in seconds, -taken by the envelope to reach the target amplitude or the 0. - -Methods -------- - -#### masr_set_risetime(risetime) #### - -Sets a new rising time in seconds. - -#### masr_set_falltime(falltime) #### - -Sets a new falling time in seconds. - -#### masr_do(signal) #### - -Computes and returns the next value of the envelope. `signal` is -the target value, either positive for the rising part or zero for -the falling part. - -Example -------- - - desc:Midi Filter - - import cookdsp.jsfx-inc - - slider1:0.01<0.001,1>Attack Time - slider2:1<0.01,10>Release Time - - @init - midiamp = midinote = 0; - // Initializes the envelope - env.masr(slider1, slider2); - // Stereo bandpass filter - f1.bp(1000, 5); - f2.bp(1000, 5); - - @slider - // Handle envelope slopes - env.masr_set_risetime(slider1); - env.masr_set_falltime(slider2); - - @block - while (midirecv(offset, msg1, msg2, msg3)) ( - // get noteons and noteoffs from all channels - (msg1 & $xF0) == $x90 || (msg1 & $xF0) == $x80 ? ( - msg3 != 0 ? ( - // noteon - midinote = msg2; - // Sets filter's frequency - f1.bp_set_freq(mtof(midinote)); - f2.bp_set_freq(mtof(midinote)); - // Normalizes amplitude value - midiamp = msg3 / 127; - ) : ( - // noteoff - msg2 == midinote ? midiamp = 0; - ); - ) : ( - // passthrough other events - midisend(offset,msg1,msg2,msg3); - ); - ); - - @sample - // Compute the envelope - gain = env.masr_do(midiamp); - // Filters the signal - spl0 = f1.bp_do(spl0) * gain; - spl1 = f2.bp_do(spl1) * gain; - -********************************************************/ -function masr(risetime, falltime) -( - risetime < 0.001 ? risetime = 0.001; - falltime < 0.001 ? falltime = 0.001; - this.risetime = risetime; - this.falltime = falltime; - this.c1 = exp(-2 * $pi / risetime / srate); - this.c2 = exp(-2 * $pi / falltime / srate); - this.fac = this.c1; - this.y0 = this.last = 0; -); - -function masr_set_risetime(risetime) -( - risetime < 0.001 ? risetime = 0.001; - this.risetime = risetime; - this.c1 = exp(-2 * $pi / risetime / srate); -); - -function masr_get_risetime() -( - this.risetime; -); - -function masr_set_falltime(falltime) -( - falltime < 0.001 ? falltime = 0.001; - this.falltime = falltime; - this.c2 = exp(-2 * $pi / falltime / srate); -); - -function masr_get_falltime() -( - this.falltime; -); - -function masr_do(signal) -( - signal != this.last ? ( - signal > this.last ? ( - this.fac = this.c1; - ) : ( - this.fac = this.c2; - ); - this.last = signal; - ); - this.y0 = signal + (this.y0 - signal) * this.fac; - this.y0; -); - -/******************************************************* -NOTEIN -====== - -Retrieves information about midi note events. - -Description ------------ - -The `notein` object allow the user to retrieve information about -midi note events sent to the process. - -It must be used with a variable name as prefix (object oriented), -in order to be able to retrieve the midi note data. - -Methods -------- - -#### notein() #### - -The function `notein` returns `true` if there is other midi events -to process and `false` when it's done. Usually, `notein` is called -(with a variable name as prefix) inside a `while` loop within the -"block" code section. Each call to `notein` should be followed by some -attribute processing. If a midi note has been detected, the attribute -`ok` will be set to `true`. Attributes `channel`, `pitch` and `velocity` -will then hold the midi note data. - -Attributes ----------- - -#### notein.ok #### - -If a midi note has been detected, this attribute will be set to `true`. - -#### notein.channel #### - -Holds the channel number of the current midi note. - -#### notein.pitch #### - -Holds the pitch value of the current midi note. - -#### notein.velocity #### - -Holds the velocity value of the current midi note. - -Example -------- - - desc:Midi Driven Bandpass Filter - - import cookdsp.jsfx-inc - - @init - amp = midinote = 0; - // Initializes the envelope - env.masr(0.01, 1); - // Stereo bandpass filter - f1.bp(1000, 10); - f2.bp(1000, 10); - - @block - // Until all midi events have been processed - while (n.notein()) ( - // If midi event is a midi note - n.ok ? ( - n.velocity > 0 ? ( - // noteon - midinote = n.pitch; - freq = mtof(midinote); - f1.bp_set_freq(freq); - f2.bp_set_freq(freq); - amp = n.velocity / 127; - ) : ( - // noteoff - n.pitch == midinote ? amp = 0; - ); - ); - ); - - @sample - // Compute the envelope - gain = env.masr_do(amp); - // Filters the signal - spl0 = f1.bp_do(spl0) * gain; - spl1 = f2.bp_do(spl1) * gain; - -********************************************************/ -function notein() -( - this.ok = this.channel = this.pitch = this.velocity = 0; - ret = midirecv(offset, msg1, msg2, msg3); - ret ? ( - // Retrieve midi note messages - (msg1 & 0xF0) == 0x90 || (msg1 & 0xF0) == 0x80 ? ( - this.ok = 1; - this.channel = (msg1 & 0x0F) + 1; - this.pitch = msg2; - this.velocity = msg3; - ) : ( - // Passthrough other events - midisend(offset,msg1,msg2,msg3); - ); - ); - ret; -); - -/******************************************************* -POLY -==== - -Midi polyphony voice manager. - -Description ------------ - -The `poly` object collects noteon messages and assigns them -a voice number. Noteoff messages will be assigned to the same -voice number than the corresponding noteon pitch. - -It must be used with a variable name as prefix (object oriented). - -Initializer ------------ - -#### poly(voices, [stealing]) - -Initializes the voice manager with a `voices` maximum of simultaneous -midi notes. The optional `stealing` argument controls the behaviour -of the manager. A value of 0 (the default) will ignore additional notes -while a value of 1 will activate the stealing mode. In stealing mode, -when the manager is full, the newest note replaces the oldest ones. - -Methods -------- - -#### poly_do(pitch, velocity) #### - -The `poly_do` function takes pitch and velocity from a midi note and -assigns a voice number to the pitch if the velocity is greater than -0 (a noteon). When a noteoff comes in (velocity of 0), the voice -number assigned to the noteon with the same pitch will be reused. -The voice number can be used to assign the noteoff to the process -that received the corresponding noteon. - -Attributes ----------- - -#### poly.voice #### - -This attribute holds the current voice number. - -#### poly.pitch #### - -This attribute holds the current pitch value. - -#### poly.velocity #### - -This attribute holds the current velocity value. - -Example -------- - - desc:Polyphonic Midi Filter - - import cookdsp.jsfx-inc - - @init - amps = memalloc(3); - // Initializes the envelopes - env1.masr(0.01, 1); - env2.masr(0.01, 1); - env3.masr(0.01, 1); - // Initializes stereo filters - f1.bp(1000, 10); f2.bp(1000, 10); - ff1.bp(1000, 10); ff2.bp(1000, 10); - fff1.bp(1000, 10); fff2.bp(1000, 10); - // Initializes polyphony manager - p.poly(3, 1); - - @block - // Until all midi events have been processed - while (n.notein()) ( - // If midi event is a midi note - n.ok ? ( - p.poly_do(n.pitch, n.velocity); - // If a voice has been assigned - p.voice != -1 ? ( - freq = mtof(p.pitch); - p.voice == 0 ? ( - f1.bp_set_freq(freq); f2.bp_set_freq(freq); - ) : p.voice == 1 ? ( - ff1.bp_set_freq(freq); ff2.bp_set_freq(freq); - ) : p.voice == 2 ? ( - fff1.bp_set_freq(freq); fff2.bp_set_freq(freq); - ); - amps[p.voice] = p.velocity / 127; - ); - ); - ); - - @sample - // Computes the envelopes - gain1 = env1.masr_do(amps[0]); - gain2 = env2.masr_do(amps[1]); - gain3 = env3.masr_do(amps[2]); - // Filters the signal - outl1 = f1.bp_do(spl0) * gain1; outr1 = f2.bp_do(spl1) * gain1; - outl2 = ff1.bp_do(spl0) * gain2; outr2 = ff2.bp_do(spl1) * gain2; - outl3 = fff1.bp_do(spl0) * gain3; outr3 = fff2.bp_do(spl1) * gain3; - // Sum and output - spl0 = outl1 + outl2 + outl3; - spl1 = outr1 + outr2 + outr3; - -********************************************************/ -function poly(voices stealing) -( - this.voices = voices; - this.stealing = stealing; - this.pitches = memalloc(this.voices); - this.indexes = memalloc(this.voices); - this.icount = 0; - this.voice = this.pitch = this.velocity = -1; - memset(this.pitches, -1, this.voices); -); - -function poly(voices) -( - this.poly(voices, 0); -); - -function poly_do(pitch velocity) -( - this.pitch = pitch; - this.velocity = velocity; - this.voice = -1; - k_ = 0; - found_ = 0; - velocity > 0 ? ( - while (k_ < this.voices && found_ == 0) ( - this.pitches[k_] == -1 ? ( - this.voice = k_; - this.pitches[k_] = pitch; - found_ = 1; - this.indexes[this.icount] = k_; - this.icount = (this.icount + 1) % this.voices; - ); - k_ += 1; - ); - found_ == 0 && this.stealing ? ( - k_ = this.indexes[this.icount]; - this.voice = k_; - this.pitches[k_] = pitch; - this.icount = (this.icount + 1) % this.voices; - ); - ) : ( - while (k_ < this.voices && found_ == 0) ( - this.pitches[k_] == pitch ? ( - this.voice = k_; - this.pitches[k_] = -1; - found_ = 1; - ); - k_ += 1; - ); - ); -); diff --git a/FX/BryanChi_FX Devices/cookdsp/mmath.jsfx-inc b/FX/BryanChi_FX Devices/cookdsp/mmath.jsfx-inc deleted file mode 100644 index e82c4a8e2..000000000 --- a/FX/BryanChi_FX Devices/cookdsp/mmath.jsfx-inc +++ /dev/null @@ -1,123 +0,0 @@ -///////////////////////////////////////////////////////////////// -// Copyright (c) - 2015 - Olivier Belanger // -// Permission to use, copy, modify, and/or distribute this // -// software for any purpose with or without fee is hereby // -// granted, provided that the above copyright notice and this // -// permission notice appear in all copies. CookDSP IS PROVIDED // -// "AS IS", WITHOUT WARRANTY OF ANY KIND FROM THE AUTHOR. // -///////////////////////////////////////////////////////////////// - -@init - -/******************************************************* -TANH -==== - -Returns the hyperbolic tangent of the parameter. - -Signature ----------- - -ret = tanh(x) - -Description ------------ - -Tanh(x) is defined as the ratio of the corresponding hyperbolic sine and -hyperbolic cosine functions via `tanh(x) = sinh(x)/cosh(x)`. Tanh may also -be defined as `tanh(x) = (exp(2x)-1)/(exp(2x)+1)`, where `exp(x)` returns the -natural logarithm of `x`. - -Arguments ---------- - -- *x* {float} : The input value. - -Return ------- - -- *ret* {float} : Hyperbolic tangent of `x `. - -Example -------- - - desc:Hyperbolic Tangent Simple Distortion - - import cookdsp.jsfx-inc - - slider1:0<0,1>Drive - slider2:3500<100,10000>Lowpass Cutoff - - @init - lp0.butlp(slider2); - lp1.butlp(slider2); - - @slider - drv = scale(slider1, 0, 1, 1, 100, 3); - lp0.butlp_set_freq(slider2); - lp1.butlp_set_freq(slider2); - - @sample - spl0 = lp0.butlp_do(tanh(spl0 * drv) * 0.5); - spl1 = lp1.butlp_do(tanh(spl1 * drv) * 0.5); - -********************************************************/ -function tanh(x) -( - (exp(2*x) - 1) / (exp(2*x) + 1); -); - -/******************************************************* -LOG2 -==== - -Returns the logarithm (base 2) of the parameter. - -Signature ----------- - -ret = log2(x) - -Description ------------ - -Log2(x) the logarithm (base 2) of `x`, defined as `log(x) / log(2)`. -Note that log2(x) is defined for any `x` greater than zero. - -Arguments ---------- - -- *x* {float} : The input value. - -Return ------- - -- *ret* {float} : Logarithm (base 2) of `x `. - -Example -------- - - desc:Logarithmic Envelope - - import cookdsp.jsfx-inc - - slider1:1<0.1,10>LFO Frequency - - @init - lfo.phasor(slider1, 0); - - @slider - lfo.phasor_set_freq(slider1); - - @sample - ramp = lfo.phasor_do(); - tri = min(ramp, 1-ramp) * 2 + 1; - env = log2(tri); - spl0 *= env; - spl1 *= env; - -********************************************************/ -function log2(x) -( - log(x) / log(2); -); diff --git a/FX/BryanChi_FX Devices/cookdsp/oscil.jsfx-inc b/FX/BryanChi_FX Devices/cookdsp/oscil.jsfx-inc deleted file mode 100644 index d8b79c260..000000000 --- a/FX/BryanChi_FX Devices/cookdsp/oscil.jsfx-inc +++ /dev/null @@ -1,389 +0,0 @@ -///////////////////////////////////////////////////////////////// -// Copyright (c) - 2014 - Olivier Belanger // -// Permission to use, copy, modify, and/or distribute this // -// software for any purpose with or without fee is hereby // -// granted, provided that the above copyright notice and this // -// permission notice appear in all copies. CookDSP IS PROVIDED // -// "AS IS", WITHOUT WARRANTY OF ANY KIND FROM THE AUTHOR. // -///////////////////////////////////////////////////////////////// - -@init - -/******************************************************* -PHASOR -====== - -Generate an ascending ramp with sharp corner (sawtooth wave). - - -Description ------------ - -The phasor function initializes an ascending ramp (from 0 to 1) -with the given frequency and phase. Useful for looping over the -content of a buffer to produce arbitrary waveforms. - -It must be used with a variable name as prefix (object oriented). - -Initializer ------------ - -#### phasor(freq, phase) #### - -Initializes the oscillator with the given frequency `freq`, in Hz, -and initial phase `phase`, between 0 and 1. - -Methods -------- - -#### phasor_set_freq(freq) #### - -Sets a new frequency `freq`, in Hz, to the oscillator. - -#### phasor_set_phase(phase) #### - -Sets a new phase `phase`, between 0 and 1, to the oscillator. - -#### phasor_reset() #### - -Resets immediately the oscillator phase to 0. - -#### phasor_do() #### - -Processes one sample of the oscillator and increment the internal -reading pointer. Returns the current value, between 0 and 1, of -the oscilator. - -Example -------- - - desc:Alternating Channels - - import cookdsp.jsfx-inc - - slider1:4<0.25,20>LFO Speed - - @init - // Initialize a buffer - b.buffer(8192); - // Write a square wave into it - b.buffer_square(50); - // Remove the negative part - b.buffer_clip(0, 1); - // Initialize an upward ramp - ph.phasor(slider1, 0); - - @slider - ph.phasor_set_freq(slider1); - - @sample - // Compute the phase for the left channel - phL = ph.phasor_do(); - // 180 degrees out-of-phase for the right channel - phR = wrap(phL+0.5, 0, 1); - // Read the buffer and multiply each channel - spl0 *= b.buffer_fnread2(phL); - spl1 *= b.buffer_fnread2(phR); - -********************************************************/ -function phasor(freq phase) -( - phase < 0 ? phase = 0 : phase > 1 ? phase = 1; - this.phase = phase; - this.freq = freq; - this.inc = this.freq / srate; - this.current = 0; -); - -function phasor_set_freq(freq) -( - this.freq = freq; - this.inc = this.freq / srate; -); - -function phasor_set_phase(phase) -( - phase < 0 ? phase = 0 : phase > 1 ? phase = 1; - this.phase = phase; -); - -function phasor_reset() -( - this.current = 0; -); - -function phasor_do() -( - val_ = this.current + this.phase; - val_ >= 1 ? val_ -= 1 : val_ < 0 ? val_ += 1; - this.current += this.inc; - this.current >= 1 ? this.current -= 1 : this.current < 0 ? this.current += 1; - val_; -); - -/******************************************************* -SINE -==== - -Generate a sine wave oscillator. - - -Description ------------ - -The `sine` object initializes a sine wave oscillator with the -given frequency and phase. - -It must be used with a variable name as prefix (object oriented). - -Initializer ------------ - -#### sine(freq, phase) #### - -Initializes the oscillator with the given frequency `freq`, in Hz, -and initial phase `phase`, between 0 and 1. - -Methods -------- - -#### sine_set_freq(freq) #### - -Sets a new frequency `freq`, in Hz, to the oscillator. - -#### sine_set_phase(phase) #### - -Sets a new phase `phase`, between 0 and 1, to the oscillator. - -#### sine_reset() #### - -Resets immediately the oscillator phase to 0. - -#### sine_do() #### - -Processes one sample of the oscillator and increment the internal -reading pointer. Returns the current value, between -1 and 1, of -the oscilator. - -Example -------- - - desc:Ring Modulation - - import cookdsp.jsfx-inc - - slider1:100<1,500>Modulation Frequency - - @init - rm.sine(slider1, 0); - - @slider - rm.sine_set_freq(slider1); - - @sample - x = rm.sine_do(); - spl0 *= x; - spl1 *= x; - -********************************************************/ -function sine(freq phase) -( - this.ph.phasor(freq, phase); - this.freq = this.ph.freq; - this.phase = this.ph.phase; - this.buf.buffer(1024); - this.buf.buffer_gen10(1); -); - -function sine_set_freq(freq) -( - this.ph.phasor_set_freq(freq); - this.freq = this.ph.freq; -); - -function sine_set_phase(phase) -( - this.ph.phasor_set_phase(phase); - this.phase = this.ph.phase; -); - -function sine_reset() -( - this.ph.phasor_reset(); -); - -function sine_do() -( - this.buf.buffer_fnread2(this.ph.phasor_do()); -); - -/******************************************************* -BLOSC -===== - -Band-limited oscillator with different wave shapes. - - -Description ------------ - -This object implements a collection of oscillators that don't have -frequencies above the Nyquist frequency (anti-aliased). - -It must be used with a variable name as prefix (object oriented). - -Initializer ------------ - -#### blosc(freq, sharp, type) #### - -Initializes the oscillator with the given frequency `freq`, in Hz, -edge sharp factor `sharp`, between 0 and 1, and waveform shape `type` (int). -Available shapes are: - - 0. Upward Sawtooth - 1. Downward Sawtooth - 2. Square - 3. Triangle - 4. Pulse - 5. Bipolar Pulse - -Methods -------- - -#### blosc_set_freq(freq) #### - -Sets a new frequency `freq`, in Hz, to the oscillator. - -#### blosc_set_sharp(sharp) #### - -Sets a new sharp factor `sharp`, between 0 and 1, to the oscillator. - -#### blosc_set_type(type) #### - -Changes the current waveform shape of the oscillator (`type` in an integer). -Available shapes are: - - 0. Upward Sawtooth - 1. Downward Sawtooth - 2. Square - 3. Triangle - 4. Pulse - 5. Bipolar Pulse - -#### blosc_reset() #### - -Resets immediately the oscillator phase to 0. - -#### blosc_do() #### - -Processes one sample of the oscillator and increment the internal -reading pointer. Returns the current value, between -1 and 1, of -the oscilator. - -Example -------- - - desc:Complex Ring-Modulation - - import cookdsp.jsfx-inc - - slider1:20<20,500>Frequency - slider2:0.5<0,1>Sharp - slider3:0<0,5,1{Saw Up,Saw Down,Square,Triangle,Pulse,Bi-Pulse}>Shape - - @init - blo.blosc(slider1, slider2, slider3); - - @slider - blo.blosc_set_freq(slider1); - blo.blosc_set_sharp(slider2); - blo.blosc_set_type(slider3); - - @sample - amp = blo.blosc_do(); - spl0 *= amp; - spl1 *= amp; - -********************************************************/ -function blosc(freq sharp type) -( - this.ph.phasor(freq, 0); - this.freq = this.ph.freq; - sharp < 0 ? sharp = 0 : sharp > 1 ? sharp = 1; - this.sharp = sharp; - type < 0 ? type = 0 : type > 5 ? type = 5; - this.type = floor(type); - this.srOnFour = srate * 0.25; - this.srOnEight = srate * 0.125; - this.twopi = 2 * $pi; - this.oneOnPiOnTwo = 1 / ($pi / 2); -); - -function blosc_set_freq(freq) -( - this.ph.phasor_set_freq(freq); - this.freq = this.ph.freq; -); - -function blosc_set_sharp(sharp) -( - sharp < 0 ? sharp = 0 : sharp > 1 ? sharp = 1; - this.sharp = sharp; -); - -function blosc_set_type(type) -( - type < 0 ? type = 0 : type > 5 ? type = 5; - this.type = floor(type); -); - -function blosc_reset() -( - this.ph.phasor_reset(); -); - -function blosc_do() -( - val_ = 0; - ph_ = this.ph.phasor_do(); - this.type == 0 ? ( - maxh_ = floor(this.srOnFour/this.freq); - numh_ = this.sharp * 46.0 + 4.0; - numh_ > maxh_ ? numh_ = maxh_; - ph_ = ph_ * 2 - 1; - val_ = ph_ - tanh(numh_ * ph_) / tanh(numh_); - ) : this.type == 1 ? ( - maxh_ = floor(this.srOnFour/this.freq); - numh_ = this.sharp * 46.0 + 4.0; - numh_ > maxh_ ? numh_ = maxh_; - ph_ = ph_ * 2 - 1; - val_ = -(ph_ - tanh(numh_ * ph_) / tanh(numh_)); - ) : this.type == 2 ? ( - maxh_ = floor(this.srOnEight/this.freq); - numh_ = this.sharp * 46.0 + 4.0; - numh_ > maxh_ ? numh_ = maxh_; - val_ = atan(numh_ * sin(this.twopi * ph_)) * this.oneOnPiOnTwo; - ) : this.type == 3 ? ( - maxh_ = floor(this.srOnFour/this.freq); - this.sharp * 36.0 > maxh_ ? numh_ = maxh_ / 36 : numh_ = this.sharp; - v1_ = tan(sin(this.twopi * ph_)) * this.oneOnPiOnTwo; - ph2_ = ph_ + 0.25; - ph2_ > 1 ? ph2_ -= 1; - v2_ = 4 * (0.5 - abs(ph2_ - 0.5)) - 1; - val_ = v1_ + (v2_ - v1_) * numh_; - ) : this.type == 4 ? ( - maxh_ = floor(this.srOnEight/this.freq); - numh_ = floor(this.sharp * 46.0 + 4.0); - numh_ > maxh_ ? numh_ = maxh_; - numh_ % 2 == 0 ? numh_ += 1; - val_ = tan(pow(abs(sin(this.twopi*ph_)), numh_)) * this.oneOnPiOnTwo; - ) : this.type == 5 ? ( - maxh_ = floor(this.srOnEight/this.freq); - numh_ = floor(this.sharp * 46.0 + 4.0); - numh_ > maxh_ ? numh_ = maxh_; - numh_ % 2 == 0 ? numh_ += 1; - val_ = tan(pow(sin(this.twopi*ph_), numh_)) * this.oneOnPiOnTwo; - ); - val_; -); diff --git a/FX/BryanChi_FX Devices/cookdsp/pobjects.jsfx-inc b/FX/BryanChi_FX Devices/cookdsp/pobjects.jsfx-inc deleted file mode 100644 index 3e17000c8..000000000 --- a/FX/BryanChi_FX Devices/cookdsp/pobjects.jsfx-inc +++ /dev/null @@ -1,8456 +0,0 @@ -@init - -/******************************************************* -POBJECTS -======== - -Polyphonic objects. - -A `Pobject` is the polyphonic variation of a current object in -the library. It works exactly as the original object but every -arguments for its methods must be a CookDSP list instead of a -single value. The _do() method also returns a list holding all -internal objects output values. - -In addition to importing **cookdsp.jsfx-inc**, to use the polyphonic -objects you also have to import **cookdsp/pobjects.jsfx-inc**. It is -a separated import in order to accelerate the loading of the standard -library. pobjects.jsfx-inc is a fairly big file. - -Available `Pobjects` are: - -`Pallpass`, `Papass`, `Pbiquad`, `Pblosc`, `Pbp`, `Pbutbp`, `Pbutbr`, `Pbuthp`, -`Pbutlp`, `Pchorus`, `Pcomb`, `Pcompress`, `Pdelay`, `Pdisto`, `Peq`, `Pexpand`, -`Pflanger`, `Pfollow`, `Pgate`, `Pgrains`, `Pharmon`, `Phip`, `Plop`, `Pmasr`, -`Pmoog`, `Ponset`, `Pphasor`, `Prandom`, `Psdelay`, `Psine`, `Pwaveguide`, `Pwgverb`, -`Pyin`, `Pzcross`, - -They must be used with a variable name as prefix (object oriented). - -Here is an example, using the `follow` object, of the method -signatures: - -Initializer ------------ - -#### Pfollow(lst1) #### - -Initializes as many envelope follower as the length of the list -`lst1`, corresponding to the `freq` argument of `follow`. - -Methods -------- - -#### Pfollow_set_freq(lst1) #### - -Sets a new cutoff frequency, in Hz, to each of the internal -`follow` object. The list `lst1` must be of the same length -as the list given to the initializer. - -#### Pfollow_do(signal) #### - -Processes one samples of a multi-channel input signal `signal` -and outputs a list of amplitudes, between 0 and 1. The argument -`signal` must be a `tmp` list of any length, the method will -wrap around the inputs to fill every internal object. This -method returns a CookDSP list (ie starting at index 1, index 0 -hold the list length). - -Example -------- - - desc:Stereo Amplitude Follower - - import cookdsp.jsfx-inc - import cookdsp/pobjects.jsfx-inc - - slider1:10<1,100>Follower Responsiveness In Hz - - @init - // Initializes cutoff frequencies - freq = set(2, slider1); - // Initializes the followers - fol.Pfollow(freq); - - @slider - // Sets follower's responsiveness - freq[1] = freq[2] = slider1; - fol.Pfollow_set_freq(freq); - - @sample - // Follow a stereo input signal - amps = fol.Pfollow_do(tmp(spl0, spl1)); - // Add modulated noise to the input signal - spl0 += (rand(2) - 1) * 0.5 * amps[1]; - spl1 += (rand(2) - 1) * 0.5 * amps[2]; - -********************************************************/ -function Pdelay(lst1) -( - this.num = lst1[0]; - this.outlist = memalloc(this.num + 1); - this.outlist[0] = this.num; - this.num > 0 ? this.0.delay(lst1[1]); - this.num > 1 ? this.1.delay(lst1[2]); - this.num > 2 ? this.2.delay(lst1[3]); - this.num > 3 ? this.3.delay(lst1[4]); - this.num > 4 ? this.4.delay(lst1[5]); - this.num > 5 ? this.5.delay(lst1[6]); - this.num > 6 ? this.6.delay(lst1[7]); - this.num > 7 ? this.7.delay(lst1[8]); - this.num > 8 ? this.8.delay(lst1[9]); - this.num > 9 ? this.9.delay(lst1[10]); - this.num > 10 ? this.10.delay(lst1[11]); - this.num > 11 ? this.11.delay(lst1[12]); - this.num > 12 ? this.12.delay(lst1[13]); - this.num > 13 ? this.13.delay(lst1[14]); - this.num > 14 ? this.14.delay(lst1[15]); - this.num > 15 ? this.15.delay(lst1[16]); - this.num > 16 ? this.16.delay(lst1[17]); - this.num > 17 ? this.17.delay(lst1[18]); - this.num > 18 ? this.18.delay(lst1[19]); - this.num > 19 ? this.19.delay(lst1[20]); - this.num > 20 ? this.20.delay(lst1[21]); - this.num > 21 ? this.21.delay(lst1[22]); - this.num > 22 ? this.22.delay(lst1[23]); - this.num > 23 ? this.23.delay(lst1[24]); - this.num > 24 ? this.24.delay(lst1[25]); - this.num > 25 ? this.25.delay(lst1[26]); - this.num > 26 ? this.26.delay(lst1[27]); - this.num > 27 ? this.27.delay(lst1[28]); - this.num > 28 ? this.28.delay(lst1[29]); - this.num > 29 ? this.29.delay(lst1[30]); - this.num > 30 ? this.30.delay(lst1[31]); - this.num > 31 ? this.31.delay(lst1[32]); - this.num > 32 ? this.32.delay(lst1[33]); - this.num > 33 ? this.33.delay(lst1[34]); - this.num > 34 ? this.34.delay(lst1[35]); - this.num > 35 ? this.35.delay(lst1[36]); - this.num > 36 ? this.36.delay(lst1[37]); - this.num > 37 ? this.37.delay(lst1[38]); - this.num > 38 ? this.38.delay(lst1[39]); - this.num > 39 ? this.39.delay(lst1[40]); -); -function Pdelay_write(lst1) -( - this.num > 0 ? this.0.delay_write(lst1[1]); - this.num > 1 ? this.1.delay_write(lst1[2]); - this.num > 2 ? this.2.delay_write(lst1[3]); - this.num > 3 ? this.3.delay_write(lst1[4]); - this.num > 4 ? this.4.delay_write(lst1[5]); - this.num > 5 ? this.5.delay_write(lst1[6]); - this.num > 6 ? this.6.delay_write(lst1[7]); - this.num > 7 ? this.7.delay_write(lst1[8]); - this.num > 8 ? this.8.delay_write(lst1[9]); - this.num > 9 ? this.9.delay_write(lst1[10]); - this.num > 10 ? this.10.delay_write(lst1[11]); - this.num > 11 ? this.11.delay_write(lst1[12]); - this.num > 12 ? this.12.delay_write(lst1[13]); - this.num > 13 ? this.13.delay_write(lst1[14]); - this.num > 14 ? this.14.delay_write(lst1[15]); - this.num > 15 ? this.15.delay_write(lst1[16]); - this.num > 16 ? this.16.delay_write(lst1[17]); - this.num > 17 ? this.17.delay_write(lst1[18]); - this.num > 18 ? this.18.delay_write(lst1[19]); - this.num > 19 ? this.19.delay_write(lst1[20]); - this.num > 20 ? this.20.delay_write(lst1[21]); - this.num > 21 ? this.21.delay_write(lst1[22]); - this.num > 22 ? this.22.delay_write(lst1[23]); - this.num > 23 ? this.23.delay_write(lst1[24]); - this.num > 24 ? this.24.delay_write(lst1[25]); - this.num > 25 ? this.25.delay_write(lst1[26]); - this.num > 26 ? this.26.delay_write(lst1[27]); - this.num > 27 ? this.27.delay_write(lst1[28]); - this.num > 28 ? this.28.delay_write(lst1[29]); - this.num > 29 ? this.29.delay_write(lst1[30]); - this.num > 30 ? this.30.delay_write(lst1[31]); - this.num > 31 ? this.31.delay_write(lst1[32]); - this.num > 32 ? this.32.delay_write(lst1[33]); - this.num > 33 ? this.33.delay_write(lst1[34]); - this.num > 34 ? this.34.delay_write(lst1[35]); - this.num > 35 ? this.35.delay_write(lst1[36]); - this.num > 36 ? this.36.delay_write(lst1[37]); - this.num > 37 ? this.37.delay_write(lst1[38]); - this.num > 38 ? this.38.delay_write(lst1[39]); - this.num > 39 ? this.39.delay_write(lst1[40]); -); -function Pdelay_read(lst1) -( - this.num > 0 ? this.outlist[1] = this.0.delay_read(lst1[1]); - this.num > 1 ? this.outlist[2] = this.1.delay_read(lst1[2]); - this.num > 2 ? this.outlist[3] = this.2.delay_read(lst1[3]); - this.num > 3 ? this.outlist[4] = this.3.delay_read(lst1[4]); - this.num > 4 ? this.outlist[5] = this.4.delay_read(lst1[5]); - this.num > 5 ? this.outlist[6] = this.5.delay_read(lst1[6]); - this.num > 6 ? this.outlist[7] = this.6.delay_read(lst1[7]); - this.num > 7 ? this.outlist[8] = this.7.delay_read(lst1[8]); - this.num > 8 ? this.outlist[9] = this.8.delay_read(lst1[9]); - this.num > 9 ? this.outlist[10] = this.9.delay_read(lst1[10]); - this.num > 10 ? this.outlist[11] = this.10.delay_read(lst1[11]); - this.num > 11 ? this.outlist[12] = this.11.delay_read(lst1[12]); - this.num > 12 ? this.outlist[13] = this.12.delay_read(lst1[13]); - this.num > 13 ? this.outlist[14] = this.13.delay_read(lst1[14]); - this.num > 14 ? this.outlist[15] = this.14.delay_read(lst1[15]); - this.num > 15 ? this.outlist[16] = this.15.delay_read(lst1[16]); - this.num > 16 ? this.outlist[17] = this.16.delay_read(lst1[17]); - this.num > 17 ? this.outlist[18] = this.17.delay_read(lst1[18]); - this.num > 18 ? this.outlist[19] = this.18.delay_read(lst1[19]); - this.num > 19 ? this.outlist[20] = this.19.delay_read(lst1[20]); - this.num > 20 ? this.outlist[21] = this.20.delay_read(lst1[21]); - this.num > 21 ? this.outlist[22] = this.21.delay_read(lst1[22]); - this.num > 22 ? this.outlist[23] = this.22.delay_read(lst1[23]); - this.num > 23 ? this.outlist[24] = this.23.delay_read(lst1[24]); - this.num > 24 ? this.outlist[25] = this.24.delay_read(lst1[25]); - this.num > 25 ? this.outlist[26] = this.25.delay_read(lst1[26]); - this.num > 26 ? this.outlist[27] = this.26.delay_read(lst1[27]); - this.num > 27 ? this.outlist[28] = this.27.delay_read(lst1[28]); - this.num > 28 ? this.outlist[29] = this.28.delay_read(lst1[29]); - this.num > 29 ? this.outlist[30] = this.29.delay_read(lst1[30]); - this.num > 30 ? this.outlist[31] = this.30.delay_read(lst1[31]); - this.num > 31 ? this.outlist[32] = this.31.delay_read(lst1[32]); - this.num > 32 ? this.outlist[33] = this.32.delay_read(lst1[33]); - this.num > 33 ? this.outlist[34] = this.33.delay_read(lst1[34]); - this.num > 34 ? this.outlist[35] = this.34.delay_read(lst1[35]); - this.num > 35 ? this.outlist[36] = this.35.delay_read(lst1[36]); - this.num > 36 ? this.outlist[37] = this.36.delay_read(lst1[37]); - this.num > 37 ? this.outlist[38] = this.37.delay_read(lst1[38]); - this.num > 38 ? this.outlist[39] = this.38.delay_read(lst1[39]); - this.num > 39 ? this.outlist[40] = this.39.delay_read(lst1[40]); - this.outlist; -); - -function Pdelay_fread(lst1) -( - this.num > 0 ? this.outlist[1] = this.0.delay_fread(lst1[1]); - this.num > 1 ? this.outlist[2] = this.1.delay_fread(lst1[2]); - this.num > 2 ? this.outlist[3] = this.2.delay_fread(lst1[3]); - this.num > 3 ? this.outlist[4] = this.3.delay_fread(lst1[4]); - this.num > 4 ? this.outlist[5] = this.4.delay_fread(lst1[5]); - this.num > 5 ? this.outlist[6] = this.5.delay_fread(lst1[6]); - this.num > 6 ? this.outlist[7] = this.6.delay_fread(lst1[7]); - this.num > 7 ? this.outlist[8] = this.7.delay_fread(lst1[8]); - this.num > 8 ? this.outlist[9] = this.8.delay_fread(lst1[9]); - this.num > 9 ? this.outlist[10] = this.9.delay_fread(lst1[10]); - this.num > 10 ? this.outlist[11] = this.10.delay_fread(lst1[11]); - this.num > 11 ? this.outlist[12] = this.11.delay_fread(lst1[12]); - this.num > 12 ? this.outlist[13] = this.12.delay_fread(lst1[13]); - this.num > 13 ? this.outlist[14] = this.13.delay_fread(lst1[14]); - this.num > 14 ? this.outlist[15] = this.14.delay_fread(lst1[15]); - this.num > 15 ? this.outlist[16] = this.15.delay_fread(lst1[16]); - this.num > 16 ? this.outlist[17] = this.16.delay_fread(lst1[17]); - this.num > 17 ? this.outlist[18] = this.17.delay_fread(lst1[18]); - this.num > 18 ? this.outlist[19] = this.18.delay_fread(lst1[19]); - this.num > 19 ? this.outlist[20] = this.19.delay_fread(lst1[20]); - this.num > 20 ? this.outlist[21] = this.20.delay_fread(lst1[21]); - this.num > 21 ? this.outlist[22] = this.21.delay_fread(lst1[22]); - this.num > 22 ? this.outlist[23] = this.22.delay_fread(lst1[23]); - this.num > 23 ? this.outlist[24] = this.23.delay_fread(lst1[24]); - this.num > 24 ? this.outlist[25] = this.24.delay_fread(lst1[25]); - this.num > 25 ? this.outlist[26] = this.25.delay_fread(lst1[26]); - this.num > 26 ? this.outlist[27] = this.26.delay_fread(lst1[27]); - this.num > 27 ? this.outlist[28] = this.27.delay_fread(lst1[28]); - this.num > 28 ? this.outlist[29] = this.28.delay_fread(lst1[29]); - this.num > 29 ? this.outlist[30] = this.29.delay_fread(lst1[30]); - this.num > 30 ? this.outlist[31] = this.30.delay_fread(lst1[31]); - this.num > 31 ? this.outlist[32] = this.31.delay_fread(lst1[32]); - this.num > 32 ? this.outlist[33] = this.32.delay_fread(lst1[33]); - this.num > 33 ? this.outlist[34] = this.33.delay_fread(lst1[34]); - this.num > 34 ? this.outlist[35] = this.34.delay_fread(lst1[35]); - this.num > 35 ? this.outlist[36] = this.35.delay_fread(lst1[36]); - this.num > 36 ? this.outlist[37] = this.36.delay_fread(lst1[37]); - this.num > 37 ? this.outlist[38] = this.37.delay_fread(lst1[38]); - this.num > 38 ? this.outlist[39] = this.38.delay_fread(lst1[39]); - this.num > 39 ? this.outlist[40] = this.39.delay_fread(lst1[40]); - this.outlist; -); - -function Pdelay_sread(lst1) -( - this.num > 0 ? this.outlist[1] = this.0.delay_sread(lst1[1]); - this.num > 1 ? this.outlist[2] = this.1.delay_sread(lst1[2]); - this.num > 2 ? this.outlist[3] = this.2.delay_sread(lst1[3]); - this.num > 3 ? this.outlist[4] = this.3.delay_sread(lst1[4]); - this.num > 4 ? this.outlist[5] = this.4.delay_sread(lst1[5]); - this.num > 5 ? this.outlist[6] = this.5.delay_sread(lst1[6]); - this.num > 6 ? this.outlist[7] = this.6.delay_sread(lst1[7]); - this.num > 7 ? this.outlist[8] = this.7.delay_sread(lst1[8]); - this.num > 8 ? this.outlist[9] = this.8.delay_sread(lst1[9]); - this.num > 9 ? this.outlist[10] = this.9.delay_sread(lst1[10]); - this.num > 10 ? this.outlist[11] = this.10.delay_sread(lst1[11]); - this.num > 11 ? this.outlist[12] = this.11.delay_sread(lst1[12]); - this.num > 12 ? this.outlist[13] = this.12.delay_sread(lst1[13]); - this.num > 13 ? this.outlist[14] = this.13.delay_sread(lst1[14]); - this.num > 14 ? this.outlist[15] = this.14.delay_sread(lst1[15]); - this.num > 15 ? this.outlist[16] = this.15.delay_sread(lst1[16]); - this.num > 16 ? this.outlist[17] = this.16.delay_sread(lst1[17]); - this.num > 17 ? this.outlist[18] = this.17.delay_sread(lst1[18]); - this.num > 18 ? this.outlist[19] = this.18.delay_sread(lst1[19]); - this.num > 19 ? this.outlist[20] = this.19.delay_sread(lst1[20]); - this.num > 20 ? this.outlist[21] = this.20.delay_sread(lst1[21]); - this.num > 21 ? this.outlist[22] = this.21.delay_sread(lst1[22]); - this.num > 22 ? this.outlist[23] = this.22.delay_sread(lst1[23]); - this.num > 23 ? this.outlist[24] = this.23.delay_sread(lst1[24]); - this.num > 24 ? this.outlist[25] = this.24.delay_sread(lst1[25]); - this.num > 25 ? this.outlist[26] = this.25.delay_sread(lst1[26]); - this.num > 26 ? this.outlist[27] = this.26.delay_sread(lst1[27]); - this.num > 27 ? this.outlist[28] = this.27.delay_sread(lst1[28]); - this.num > 28 ? this.outlist[29] = this.28.delay_sread(lst1[29]); - this.num > 29 ? this.outlist[30] = this.29.delay_sread(lst1[30]); - this.num > 30 ? this.outlist[31] = this.30.delay_sread(lst1[31]); - this.num > 31 ? this.outlist[32] = this.31.delay_sread(lst1[32]); - this.num > 32 ? this.outlist[33] = this.32.delay_sread(lst1[33]); - this.num > 33 ? this.outlist[34] = this.33.delay_sread(lst1[34]); - this.num > 34 ? this.outlist[35] = this.34.delay_sread(lst1[35]); - this.num > 35 ? this.outlist[36] = this.35.delay_sread(lst1[36]); - this.num > 36 ? this.outlist[37] = this.36.delay_sread(lst1[37]); - this.num > 37 ? this.outlist[38] = this.37.delay_sread(lst1[38]); - this.num > 38 ? this.outlist[39] = this.38.delay_sread(lst1[39]); - this.num > 39 ? this.outlist[40] = this.39.delay_sread(lst1[40]); - this.outlist; -); - -function Pdelay_fsread(lst1) -( - this.num > 0 ? this.outlist[1] = this.0.delay_fsread(lst1[1]); - this.num > 1 ? this.outlist[2] = this.1.delay_fsread(lst1[2]); - this.num > 2 ? this.outlist[3] = this.2.delay_fsread(lst1[3]); - this.num > 3 ? this.outlist[4] = this.3.delay_fsread(lst1[4]); - this.num > 4 ? this.outlist[5] = this.4.delay_fsread(lst1[5]); - this.num > 5 ? this.outlist[6] = this.5.delay_fsread(lst1[6]); - this.num > 6 ? this.outlist[7] = this.6.delay_fsread(lst1[7]); - this.num > 7 ? this.outlist[8] = this.7.delay_fsread(lst1[8]); - this.num > 8 ? this.outlist[9] = this.8.delay_fsread(lst1[9]); - this.num > 9 ? this.outlist[10] = this.9.delay_fsread(lst1[10]); - this.num > 10 ? this.outlist[11] = this.10.delay_fsread(lst1[11]); - this.num > 11 ? this.outlist[12] = this.11.delay_fsread(lst1[12]); - this.num > 12 ? this.outlist[13] = this.12.delay_fsread(lst1[13]); - this.num > 13 ? this.outlist[14] = this.13.delay_fsread(lst1[14]); - this.num > 14 ? this.outlist[15] = this.14.delay_fsread(lst1[15]); - this.num > 15 ? this.outlist[16] = this.15.delay_fsread(lst1[16]); - this.num > 16 ? this.outlist[17] = this.16.delay_fsread(lst1[17]); - this.num > 17 ? this.outlist[18] = this.17.delay_fsread(lst1[18]); - this.num > 18 ? this.outlist[19] = this.18.delay_fsread(lst1[19]); - this.num > 19 ? this.outlist[20] = this.19.delay_fsread(lst1[20]); - this.num > 20 ? this.outlist[21] = this.20.delay_fsread(lst1[21]); - this.num > 21 ? this.outlist[22] = this.21.delay_fsread(lst1[22]); - this.num > 22 ? this.outlist[23] = this.22.delay_fsread(lst1[23]); - this.num > 23 ? this.outlist[24] = this.23.delay_fsread(lst1[24]); - this.num > 24 ? this.outlist[25] = this.24.delay_fsread(lst1[25]); - this.num > 25 ? this.outlist[26] = this.25.delay_fsread(lst1[26]); - this.num > 26 ? this.outlist[27] = this.26.delay_fsread(lst1[27]); - this.num > 27 ? this.outlist[28] = this.27.delay_fsread(lst1[28]); - this.num > 28 ? this.outlist[29] = this.28.delay_fsread(lst1[29]); - this.num > 29 ? this.outlist[30] = this.29.delay_fsread(lst1[30]); - this.num > 30 ? this.outlist[31] = this.30.delay_fsread(lst1[31]); - this.num > 31 ? this.outlist[32] = this.31.delay_fsread(lst1[32]); - this.num > 32 ? this.outlist[33] = this.32.delay_fsread(lst1[33]); - this.num > 33 ? this.outlist[34] = this.33.delay_fsread(lst1[34]); - this.num > 34 ? this.outlist[35] = this.34.delay_fsread(lst1[35]); - this.num > 35 ? this.outlist[36] = this.35.delay_fsread(lst1[36]); - this.num > 36 ? this.outlist[37] = this.36.delay_fsread(lst1[37]); - this.num > 37 ? this.outlist[38] = this.37.delay_fsread(lst1[38]); - this.num > 38 ? this.outlist[39] = this.38.delay_fsread(lst1[39]); - this.num > 39 ? this.outlist[40] = this.39.delay_fsread(lst1[40]); - this.outlist; -); - -function Pdelay_read2(lst1) -( - this.num > 0 ? this.outlist[1] = this.0.delay_read2(lst1[1]); - this.num > 1 ? this.outlist[2] = this.1.delay_read2(lst1[2]); - this.num > 2 ? this.outlist[3] = this.2.delay_read2(lst1[3]); - this.num > 3 ? this.outlist[4] = this.3.delay_read2(lst1[4]); - this.num > 4 ? this.outlist[5] = this.4.delay_read2(lst1[5]); - this.num > 5 ? this.outlist[6] = this.5.delay_read2(lst1[6]); - this.num > 6 ? this.outlist[7] = this.6.delay_read2(lst1[7]); - this.num > 7 ? this.outlist[8] = this.7.delay_read2(lst1[8]); - this.num > 8 ? this.outlist[9] = this.8.delay_read2(lst1[9]); - this.num > 9 ? this.outlist[10] = this.9.delay_read2(lst1[10]); - this.num > 10 ? this.outlist[11] = this.10.delay_read2(lst1[11]); - this.num > 11 ? this.outlist[12] = this.11.delay_read2(lst1[12]); - this.num > 12 ? this.outlist[13] = this.12.delay_read2(lst1[13]); - this.num > 13 ? this.outlist[14] = this.13.delay_read2(lst1[14]); - this.num > 14 ? this.outlist[15] = this.14.delay_read2(lst1[15]); - this.num > 15 ? this.outlist[16] = this.15.delay_read2(lst1[16]); - this.num > 16 ? this.outlist[17] = this.16.delay_read2(lst1[17]); - this.num > 17 ? this.outlist[18] = this.17.delay_read2(lst1[18]); - this.num > 18 ? this.outlist[19] = this.18.delay_read2(lst1[19]); - this.num > 19 ? this.outlist[20] = this.19.delay_read2(lst1[20]); - this.num > 20 ? this.outlist[21] = this.20.delay_read2(lst1[21]); - this.num > 21 ? this.outlist[22] = this.21.delay_read2(lst1[22]); - this.num > 22 ? this.outlist[23] = this.22.delay_read2(lst1[23]); - this.num > 23 ? this.outlist[24] = this.23.delay_read2(lst1[24]); - this.num > 24 ? this.outlist[25] = this.24.delay_read2(lst1[25]); - this.num > 25 ? this.outlist[26] = this.25.delay_read2(lst1[26]); - this.num > 26 ? this.outlist[27] = this.26.delay_read2(lst1[27]); - this.num > 27 ? this.outlist[28] = this.27.delay_read2(lst1[28]); - this.num > 28 ? this.outlist[29] = this.28.delay_read2(lst1[29]); - this.num > 29 ? this.outlist[30] = this.29.delay_read2(lst1[30]); - this.num > 30 ? this.outlist[31] = this.30.delay_read2(lst1[31]); - this.num > 31 ? this.outlist[32] = this.31.delay_read2(lst1[32]); - this.num > 32 ? this.outlist[33] = this.32.delay_read2(lst1[33]); - this.num > 33 ? this.outlist[34] = this.33.delay_read2(lst1[34]); - this.num > 34 ? this.outlist[35] = this.34.delay_read2(lst1[35]); - this.num > 35 ? this.outlist[36] = this.35.delay_read2(lst1[36]); - this.num > 36 ? this.outlist[37] = this.36.delay_read2(lst1[37]); - this.num > 37 ? this.outlist[38] = this.37.delay_read2(lst1[38]); - this.num > 38 ? this.outlist[39] = this.38.delay_read2(lst1[39]); - this.num > 39 ? this.outlist[40] = this.39.delay_read2(lst1[40]); - this.outlist; -); - -function Pdelay_fread2(lst1) -( - this.num > 0 ? this.outlist[1] = this.0.delay_fread2(lst1[1]); - this.num > 1 ? this.outlist[2] = this.1.delay_fread2(lst1[2]); - this.num > 2 ? this.outlist[3] = this.2.delay_fread2(lst1[3]); - this.num > 3 ? this.outlist[4] = this.3.delay_fread2(lst1[4]); - this.num > 4 ? this.outlist[5] = this.4.delay_fread2(lst1[5]); - this.num > 5 ? this.outlist[6] = this.5.delay_fread2(lst1[6]); - this.num > 6 ? this.outlist[7] = this.6.delay_fread2(lst1[7]); - this.num > 7 ? this.outlist[8] = this.7.delay_fread2(lst1[8]); - this.num > 8 ? this.outlist[9] = this.8.delay_fread2(lst1[9]); - this.num > 9 ? this.outlist[10] = this.9.delay_fread2(lst1[10]); - this.num > 10 ? this.outlist[11] = this.10.delay_fread2(lst1[11]); - this.num > 11 ? this.outlist[12] = this.11.delay_fread2(lst1[12]); - this.num > 12 ? this.outlist[13] = this.12.delay_fread2(lst1[13]); - this.num > 13 ? this.outlist[14] = this.13.delay_fread2(lst1[14]); - this.num > 14 ? this.outlist[15] = this.14.delay_fread2(lst1[15]); - this.num > 15 ? this.outlist[16] = this.15.delay_fread2(lst1[16]); - this.num > 16 ? this.outlist[17] = this.16.delay_fread2(lst1[17]); - this.num > 17 ? this.outlist[18] = this.17.delay_fread2(lst1[18]); - this.num > 18 ? this.outlist[19] = this.18.delay_fread2(lst1[19]); - this.num > 19 ? this.outlist[20] = this.19.delay_fread2(lst1[20]); - this.num > 20 ? this.outlist[21] = this.20.delay_fread2(lst1[21]); - this.num > 21 ? this.outlist[22] = this.21.delay_fread2(lst1[22]); - this.num > 22 ? this.outlist[23] = this.22.delay_fread2(lst1[23]); - this.num > 23 ? this.outlist[24] = this.23.delay_fread2(lst1[24]); - this.num > 24 ? this.outlist[25] = this.24.delay_fread2(lst1[25]); - this.num > 25 ? this.outlist[26] = this.25.delay_fread2(lst1[26]); - this.num > 26 ? this.outlist[27] = this.26.delay_fread2(lst1[27]); - this.num > 27 ? this.outlist[28] = this.27.delay_fread2(lst1[28]); - this.num > 28 ? this.outlist[29] = this.28.delay_fread2(lst1[29]); - this.num > 29 ? this.outlist[30] = this.29.delay_fread2(lst1[30]); - this.num > 30 ? this.outlist[31] = this.30.delay_fread2(lst1[31]); - this.num > 31 ? this.outlist[32] = this.31.delay_fread2(lst1[32]); - this.num > 32 ? this.outlist[33] = this.32.delay_fread2(lst1[33]); - this.num > 33 ? this.outlist[34] = this.33.delay_fread2(lst1[34]); - this.num > 34 ? this.outlist[35] = this.34.delay_fread2(lst1[35]); - this.num > 35 ? this.outlist[36] = this.35.delay_fread2(lst1[36]); - this.num > 36 ? this.outlist[37] = this.36.delay_fread2(lst1[37]); - this.num > 37 ? this.outlist[38] = this.37.delay_fread2(lst1[38]); - this.num > 38 ? this.outlist[39] = this.38.delay_fread2(lst1[39]); - this.num > 39 ? this.outlist[40] = this.39.delay_fread2(lst1[40]); - this.outlist; -); - -function Pdelay_sread2(lst1) -( - this.num > 0 ? this.outlist[1] = this.0.delay_sread2(lst1[1]); - this.num > 1 ? this.outlist[2] = this.1.delay_sread2(lst1[2]); - this.num > 2 ? this.outlist[3] = this.2.delay_sread2(lst1[3]); - this.num > 3 ? this.outlist[4] = this.3.delay_sread2(lst1[4]); - this.num > 4 ? this.outlist[5] = this.4.delay_sread2(lst1[5]); - this.num > 5 ? this.outlist[6] = this.5.delay_sread2(lst1[6]); - this.num > 6 ? this.outlist[7] = this.6.delay_sread2(lst1[7]); - this.num > 7 ? this.outlist[8] = this.7.delay_sread2(lst1[8]); - this.num > 8 ? this.outlist[9] = this.8.delay_sread2(lst1[9]); - this.num > 9 ? this.outlist[10] = this.9.delay_sread2(lst1[10]); - this.num > 10 ? this.outlist[11] = this.10.delay_sread2(lst1[11]); - this.num > 11 ? this.outlist[12] = this.11.delay_sread2(lst1[12]); - this.num > 12 ? this.outlist[13] = this.12.delay_sread2(lst1[13]); - this.num > 13 ? this.outlist[14] = this.13.delay_sread2(lst1[14]); - this.num > 14 ? this.outlist[15] = this.14.delay_sread2(lst1[15]); - this.num > 15 ? this.outlist[16] = this.15.delay_sread2(lst1[16]); - this.num > 16 ? this.outlist[17] = this.16.delay_sread2(lst1[17]); - this.num > 17 ? this.outlist[18] = this.17.delay_sread2(lst1[18]); - this.num > 18 ? this.outlist[19] = this.18.delay_sread2(lst1[19]); - this.num > 19 ? this.outlist[20] = this.19.delay_sread2(lst1[20]); - this.num > 20 ? this.outlist[21] = this.20.delay_sread2(lst1[21]); - this.num > 21 ? this.outlist[22] = this.21.delay_sread2(lst1[22]); - this.num > 22 ? this.outlist[23] = this.22.delay_sread2(lst1[23]); - this.num > 23 ? this.outlist[24] = this.23.delay_sread2(lst1[24]); - this.num > 24 ? this.outlist[25] = this.24.delay_sread2(lst1[25]); - this.num > 25 ? this.outlist[26] = this.25.delay_sread2(lst1[26]); - this.num > 26 ? this.outlist[27] = this.26.delay_sread2(lst1[27]); - this.num > 27 ? this.outlist[28] = this.27.delay_sread2(lst1[28]); - this.num > 28 ? this.outlist[29] = this.28.delay_sread2(lst1[29]); - this.num > 29 ? this.outlist[30] = this.29.delay_sread2(lst1[30]); - this.num > 30 ? this.outlist[31] = this.30.delay_sread2(lst1[31]); - this.num > 31 ? this.outlist[32] = this.31.delay_sread2(lst1[32]); - this.num > 32 ? this.outlist[33] = this.32.delay_sread2(lst1[33]); - this.num > 33 ? this.outlist[34] = this.33.delay_sread2(lst1[34]); - this.num > 34 ? this.outlist[35] = this.34.delay_sread2(lst1[35]); - this.num > 35 ? this.outlist[36] = this.35.delay_sread2(lst1[36]); - this.num > 36 ? this.outlist[37] = this.36.delay_sread2(lst1[37]); - this.num > 37 ? this.outlist[38] = this.37.delay_sread2(lst1[38]); - this.num > 38 ? this.outlist[39] = this.38.delay_sread2(lst1[39]); - this.num > 39 ? this.outlist[40] = this.39.delay_sread2(lst1[40]); - this.outlist; -); - -function Pdelay_fsread2(lst1) -( - this.num > 0 ? this.outlist[1] = this.0.delay_fsread2(lst1[1]); - this.num > 1 ? this.outlist[2] = this.1.delay_fsread2(lst1[2]); - this.num > 2 ? this.outlist[3] = this.2.delay_fsread2(lst1[3]); - this.num > 3 ? this.outlist[4] = this.3.delay_fsread2(lst1[4]); - this.num > 4 ? this.outlist[5] = this.4.delay_fsread2(lst1[5]); - this.num > 5 ? this.outlist[6] = this.5.delay_fsread2(lst1[6]); - this.num > 6 ? this.outlist[7] = this.6.delay_fsread2(lst1[7]); - this.num > 7 ? this.outlist[8] = this.7.delay_fsread2(lst1[8]); - this.num > 8 ? this.outlist[9] = this.8.delay_fsread2(lst1[9]); - this.num > 9 ? this.outlist[10] = this.9.delay_fsread2(lst1[10]); - this.num > 10 ? this.outlist[11] = this.10.delay_fsread2(lst1[11]); - this.num > 11 ? this.outlist[12] = this.11.delay_fsread2(lst1[12]); - this.num > 12 ? this.outlist[13] = this.12.delay_fsread2(lst1[13]); - this.num > 13 ? this.outlist[14] = this.13.delay_fsread2(lst1[14]); - this.num > 14 ? this.outlist[15] = this.14.delay_fsread2(lst1[15]); - this.num > 15 ? this.outlist[16] = this.15.delay_fsread2(lst1[16]); - this.num > 16 ? this.outlist[17] = this.16.delay_fsread2(lst1[17]); - this.num > 17 ? this.outlist[18] = this.17.delay_fsread2(lst1[18]); - this.num > 18 ? this.outlist[19] = this.18.delay_fsread2(lst1[19]); - this.num > 19 ? this.outlist[20] = this.19.delay_fsread2(lst1[20]); - this.num > 20 ? this.outlist[21] = this.20.delay_fsread2(lst1[21]); - this.num > 21 ? this.outlist[22] = this.21.delay_fsread2(lst1[22]); - this.num > 22 ? this.outlist[23] = this.22.delay_fsread2(lst1[23]); - this.num > 23 ? this.outlist[24] = this.23.delay_fsread2(lst1[24]); - this.num > 24 ? this.outlist[25] = this.24.delay_fsread2(lst1[25]); - this.num > 25 ? this.outlist[26] = this.25.delay_fsread2(lst1[26]); - this.num > 26 ? this.outlist[27] = this.26.delay_fsread2(lst1[27]); - this.num > 27 ? this.outlist[28] = this.27.delay_fsread2(lst1[28]); - this.num > 28 ? this.outlist[29] = this.28.delay_fsread2(lst1[29]); - this.num > 29 ? this.outlist[30] = this.29.delay_fsread2(lst1[30]); - this.num > 30 ? this.outlist[31] = this.30.delay_fsread2(lst1[31]); - this.num > 31 ? this.outlist[32] = this.31.delay_fsread2(lst1[32]); - this.num > 32 ? this.outlist[33] = this.32.delay_fsread2(lst1[33]); - this.num > 33 ? this.outlist[34] = this.33.delay_fsread2(lst1[34]); - this.num > 34 ? this.outlist[35] = this.34.delay_fsread2(lst1[35]); - this.num > 35 ? this.outlist[36] = this.35.delay_fsread2(lst1[36]); - this.num > 36 ? this.outlist[37] = this.36.delay_fsread2(lst1[37]); - this.num > 37 ? this.outlist[38] = this.37.delay_fsread2(lst1[38]); - this.num > 38 ? this.outlist[39] = this.38.delay_fsread2(lst1[39]); - this.num > 39 ? this.outlist[40] = this.39.delay_fsread2(lst1[40]); - this.outlist; -); - -function Pdelay_read3(lst1) -( - this.num > 0 ? this.outlist[1] = this.0.delay_read3(lst1[1]); - this.num > 1 ? this.outlist[2] = this.1.delay_read3(lst1[2]); - this.num > 2 ? this.outlist[3] = this.2.delay_read3(lst1[3]); - this.num > 3 ? this.outlist[4] = this.3.delay_read3(lst1[4]); - this.num > 4 ? this.outlist[5] = this.4.delay_read3(lst1[5]); - this.num > 5 ? this.outlist[6] = this.5.delay_read3(lst1[6]); - this.num > 6 ? this.outlist[7] = this.6.delay_read3(lst1[7]); - this.num > 7 ? this.outlist[8] = this.7.delay_read3(lst1[8]); - this.num > 8 ? this.outlist[9] = this.8.delay_read3(lst1[9]); - this.num > 9 ? this.outlist[10] = this.9.delay_read3(lst1[10]); - this.num > 10 ? this.outlist[11] = this.10.delay_read3(lst1[11]); - this.num > 11 ? this.outlist[12] = this.11.delay_read3(lst1[12]); - this.num > 12 ? this.outlist[13] = this.12.delay_read3(lst1[13]); - this.num > 13 ? this.outlist[14] = this.13.delay_read3(lst1[14]); - this.num > 14 ? this.outlist[15] = this.14.delay_read3(lst1[15]); - this.num > 15 ? this.outlist[16] = this.15.delay_read3(lst1[16]); - this.num > 16 ? this.outlist[17] = this.16.delay_read3(lst1[17]); - this.num > 17 ? this.outlist[18] = this.17.delay_read3(lst1[18]); - this.num > 18 ? this.outlist[19] = this.18.delay_read3(lst1[19]); - this.num > 19 ? this.outlist[20] = this.19.delay_read3(lst1[20]); - this.num > 20 ? this.outlist[21] = this.20.delay_read3(lst1[21]); - this.num > 21 ? this.outlist[22] = this.21.delay_read3(lst1[22]); - this.num > 22 ? this.outlist[23] = this.22.delay_read3(lst1[23]); - this.num > 23 ? this.outlist[24] = this.23.delay_read3(lst1[24]); - this.num > 24 ? this.outlist[25] = this.24.delay_read3(lst1[25]); - this.num > 25 ? this.outlist[26] = this.25.delay_read3(lst1[26]); - this.num > 26 ? this.outlist[27] = this.26.delay_read3(lst1[27]); - this.num > 27 ? this.outlist[28] = this.27.delay_read3(lst1[28]); - this.num > 28 ? this.outlist[29] = this.28.delay_read3(lst1[29]); - this.num > 29 ? this.outlist[30] = this.29.delay_read3(lst1[30]); - this.num > 30 ? this.outlist[31] = this.30.delay_read3(lst1[31]); - this.num > 31 ? this.outlist[32] = this.31.delay_read3(lst1[32]); - this.num > 32 ? this.outlist[33] = this.32.delay_read3(lst1[33]); - this.num > 33 ? this.outlist[34] = this.33.delay_read3(lst1[34]); - this.num > 34 ? this.outlist[35] = this.34.delay_read3(lst1[35]); - this.num > 35 ? this.outlist[36] = this.35.delay_read3(lst1[36]); - this.num > 36 ? this.outlist[37] = this.36.delay_read3(lst1[37]); - this.num > 37 ? this.outlist[38] = this.37.delay_read3(lst1[38]); - this.num > 38 ? this.outlist[39] = this.38.delay_read3(lst1[39]); - this.num > 39 ? this.outlist[40] = this.39.delay_read3(lst1[40]); - this.outlist; -); - -function Pdelay_fread3(lst1) -( - this.num > 0 ? this.outlist[1] = this.0.delay_fread3(lst1[1]); - this.num > 1 ? this.outlist[2] = this.1.delay_fread3(lst1[2]); - this.num > 2 ? this.outlist[3] = this.2.delay_fread3(lst1[3]); - this.num > 3 ? this.outlist[4] = this.3.delay_fread3(lst1[4]); - this.num > 4 ? this.outlist[5] = this.4.delay_fread3(lst1[5]); - this.num > 5 ? this.outlist[6] = this.5.delay_fread3(lst1[6]); - this.num > 6 ? this.outlist[7] = this.6.delay_fread3(lst1[7]); - this.num > 7 ? this.outlist[8] = this.7.delay_fread3(lst1[8]); - this.num > 8 ? this.outlist[9] = this.8.delay_fread3(lst1[9]); - this.num > 9 ? this.outlist[10] = this.9.delay_fread3(lst1[10]); - this.num > 10 ? this.outlist[11] = this.10.delay_fread3(lst1[11]); - this.num > 11 ? this.outlist[12] = this.11.delay_fread3(lst1[12]); - this.num > 12 ? this.outlist[13] = this.12.delay_fread3(lst1[13]); - this.num > 13 ? this.outlist[14] = this.13.delay_fread3(lst1[14]); - this.num > 14 ? this.outlist[15] = this.14.delay_fread3(lst1[15]); - this.num > 15 ? this.outlist[16] = this.15.delay_fread3(lst1[16]); - this.num > 16 ? this.outlist[17] = this.16.delay_fread3(lst1[17]); - this.num > 17 ? this.outlist[18] = this.17.delay_fread3(lst1[18]); - this.num > 18 ? this.outlist[19] = this.18.delay_fread3(lst1[19]); - this.num > 19 ? this.outlist[20] = this.19.delay_fread3(lst1[20]); - this.num > 20 ? this.outlist[21] = this.20.delay_fread3(lst1[21]); - this.num > 21 ? this.outlist[22] = this.21.delay_fread3(lst1[22]); - this.num > 22 ? this.outlist[23] = this.22.delay_fread3(lst1[23]); - this.num > 23 ? this.outlist[24] = this.23.delay_fread3(lst1[24]); - this.num > 24 ? this.outlist[25] = this.24.delay_fread3(lst1[25]); - this.num > 25 ? this.outlist[26] = this.25.delay_fread3(lst1[26]); - this.num > 26 ? this.outlist[27] = this.26.delay_fread3(lst1[27]); - this.num > 27 ? this.outlist[28] = this.27.delay_fread3(lst1[28]); - this.num > 28 ? this.outlist[29] = this.28.delay_fread3(lst1[29]); - this.num > 29 ? this.outlist[30] = this.29.delay_fread3(lst1[30]); - this.num > 30 ? this.outlist[31] = this.30.delay_fread3(lst1[31]); - this.num > 31 ? this.outlist[32] = this.31.delay_fread3(lst1[32]); - this.num > 32 ? this.outlist[33] = this.32.delay_fread3(lst1[33]); - this.num > 33 ? this.outlist[34] = this.33.delay_fread3(lst1[34]); - this.num > 34 ? this.outlist[35] = this.34.delay_fread3(lst1[35]); - this.num > 35 ? this.outlist[36] = this.35.delay_fread3(lst1[36]); - this.num > 36 ? this.outlist[37] = this.36.delay_fread3(lst1[37]); - this.num > 37 ? this.outlist[38] = this.37.delay_fread3(lst1[38]); - this.num > 38 ? this.outlist[39] = this.38.delay_fread3(lst1[39]); - this.num > 39 ? this.outlist[40] = this.39.delay_fread3(lst1[40]); - this.outlist; -); - -function Pdelay_sread3(lst1) -( - this.num > 0 ? this.outlist[1] = this.0.delay_sread3(lst1[1]); - this.num > 1 ? this.outlist[2] = this.1.delay_sread3(lst1[2]); - this.num > 2 ? this.outlist[3] = this.2.delay_sread3(lst1[3]); - this.num > 3 ? this.outlist[4] = this.3.delay_sread3(lst1[4]); - this.num > 4 ? this.outlist[5] = this.4.delay_sread3(lst1[5]); - this.num > 5 ? this.outlist[6] = this.5.delay_sread3(lst1[6]); - this.num > 6 ? this.outlist[7] = this.6.delay_sread3(lst1[7]); - this.num > 7 ? this.outlist[8] = this.7.delay_sread3(lst1[8]); - this.num > 8 ? this.outlist[9] = this.8.delay_sread3(lst1[9]); - this.num > 9 ? this.outlist[10] = this.9.delay_sread3(lst1[10]); - this.num > 10 ? this.outlist[11] = this.10.delay_sread3(lst1[11]); - this.num > 11 ? this.outlist[12] = this.11.delay_sread3(lst1[12]); - this.num > 12 ? this.outlist[13] = this.12.delay_sread3(lst1[13]); - this.num > 13 ? this.outlist[14] = this.13.delay_sread3(lst1[14]); - this.num > 14 ? this.outlist[15] = this.14.delay_sread3(lst1[15]); - this.num > 15 ? this.outlist[16] = this.15.delay_sread3(lst1[16]); - this.num > 16 ? this.outlist[17] = this.16.delay_sread3(lst1[17]); - this.num > 17 ? this.outlist[18] = this.17.delay_sread3(lst1[18]); - this.num > 18 ? this.outlist[19] = this.18.delay_sread3(lst1[19]); - this.num > 19 ? this.outlist[20] = this.19.delay_sread3(lst1[20]); - this.num > 20 ? this.outlist[21] = this.20.delay_sread3(lst1[21]); - this.num > 21 ? this.outlist[22] = this.21.delay_sread3(lst1[22]); - this.num > 22 ? this.outlist[23] = this.22.delay_sread3(lst1[23]); - this.num > 23 ? this.outlist[24] = this.23.delay_sread3(lst1[24]); - this.num > 24 ? this.outlist[25] = this.24.delay_sread3(lst1[25]); - this.num > 25 ? this.outlist[26] = this.25.delay_sread3(lst1[26]); - this.num > 26 ? this.outlist[27] = this.26.delay_sread3(lst1[27]); - this.num > 27 ? this.outlist[28] = this.27.delay_sread3(lst1[28]); - this.num > 28 ? this.outlist[29] = this.28.delay_sread3(lst1[29]); - this.num > 29 ? this.outlist[30] = this.29.delay_sread3(lst1[30]); - this.num > 30 ? this.outlist[31] = this.30.delay_sread3(lst1[31]); - this.num > 31 ? this.outlist[32] = this.31.delay_sread3(lst1[32]); - this.num > 32 ? this.outlist[33] = this.32.delay_sread3(lst1[33]); - this.num > 33 ? this.outlist[34] = this.33.delay_sread3(lst1[34]); - this.num > 34 ? this.outlist[35] = this.34.delay_sread3(lst1[35]); - this.num > 35 ? this.outlist[36] = this.35.delay_sread3(lst1[36]); - this.num > 36 ? this.outlist[37] = this.36.delay_sread3(lst1[37]); - this.num > 37 ? this.outlist[38] = this.37.delay_sread3(lst1[38]); - this.num > 38 ? this.outlist[39] = this.38.delay_sread3(lst1[39]); - this.num > 39 ? this.outlist[40] = this.39.delay_sread3(lst1[40]); - this.outlist; -); - -function Pdelay_fsread3(lst1) -( - this.num > 0 ? this.outlist[1] = this.0.delay_fsread3(lst1[1]); - this.num > 1 ? this.outlist[2] = this.1.delay_fsread3(lst1[2]); - this.num > 2 ? this.outlist[3] = this.2.delay_fsread3(lst1[3]); - this.num > 3 ? this.outlist[4] = this.3.delay_fsread3(lst1[4]); - this.num > 4 ? this.outlist[5] = this.4.delay_fsread3(lst1[5]); - this.num > 5 ? this.outlist[6] = this.5.delay_fsread3(lst1[6]); - this.num > 6 ? this.outlist[7] = this.6.delay_fsread3(lst1[7]); - this.num > 7 ? this.outlist[8] = this.7.delay_fsread3(lst1[8]); - this.num > 8 ? this.outlist[9] = this.8.delay_fsread3(lst1[9]); - this.num > 9 ? this.outlist[10] = this.9.delay_fsread3(lst1[10]); - this.num > 10 ? this.outlist[11] = this.10.delay_fsread3(lst1[11]); - this.num > 11 ? this.outlist[12] = this.11.delay_fsread3(lst1[12]); - this.num > 12 ? this.outlist[13] = this.12.delay_fsread3(lst1[13]); - this.num > 13 ? this.outlist[14] = this.13.delay_fsread3(lst1[14]); - this.num > 14 ? this.outlist[15] = this.14.delay_fsread3(lst1[15]); - this.num > 15 ? this.outlist[16] = this.15.delay_fsread3(lst1[16]); - this.num > 16 ? this.outlist[17] = this.16.delay_fsread3(lst1[17]); - this.num > 17 ? this.outlist[18] = this.17.delay_fsread3(lst1[18]); - this.num > 18 ? this.outlist[19] = this.18.delay_fsread3(lst1[19]); - this.num > 19 ? this.outlist[20] = this.19.delay_fsread3(lst1[20]); - this.num > 20 ? this.outlist[21] = this.20.delay_fsread3(lst1[21]); - this.num > 21 ? this.outlist[22] = this.21.delay_fsread3(lst1[22]); - this.num > 22 ? this.outlist[23] = this.22.delay_fsread3(lst1[23]); - this.num > 23 ? this.outlist[24] = this.23.delay_fsread3(lst1[24]); - this.num > 24 ? this.outlist[25] = this.24.delay_fsread3(lst1[25]); - this.num > 25 ? this.outlist[26] = this.25.delay_fsread3(lst1[26]); - this.num > 26 ? this.outlist[27] = this.26.delay_fsread3(lst1[27]); - this.num > 27 ? this.outlist[28] = this.27.delay_fsread3(lst1[28]); - this.num > 28 ? this.outlist[29] = this.28.delay_fsread3(lst1[29]); - this.num > 29 ? this.outlist[30] = this.29.delay_fsread3(lst1[30]); - this.num > 30 ? this.outlist[31] = this.30.delay_fsread3(lst1[31]); - this.num > 31 ? this.outlist[32] = this.31.delay_fsread3(lst1[32]); - this.num > 32 ? this.outlist[33] = this.32.delay_fsread3(lst1[33]); - this.num > 33 ? this.outlist[34] = this.33.delay_fsread3(lst1[34]); - this.num > 34 ? this.outlist[35] = this.34.delay_fsread3(lst1[35]); - this.num > 35 ? this.outlist[36] = this.35.delay_fsread3(lst1[36]); - this.num > 36 ? this.outlist[37] = this.36.delay_fsread3(lst1[37]); - this.num > 37 ? this.outlist[38] = this.37.delay_fsread3(lst1[38]); - this.num > 38 ? this.outlist[39] = this.38.delay_fsread3(lst1[39]); - this.num > 39 ? this.outlist[40] = this.39.delay_fsread3(lst1[40]); - this.outlist; -); - -function Psdelay(lst1 lst2) -( - this.num = lst1[0]; - this.outlist = memalloc(this.num + 1); - this.outlist[0] = this.num; - this.num > 0 ? this.0.sdelay(lst1[1], lst2[1]); - this.num > 1 ? this.1.sdelay(lst1[2], lst2[2]); - this.num > 2 ? this.2.sdelay(lst1[3], lst2[3]); - this.num > 3 ? this.3.sdelay(lst1[4], lst2[4]); - this.num > 4 ? this.4.sdelay(lst1[5], lst2[5]); - this.num > 5 ? this.5.sdelay(lst1[6], lst2[6]); - this.num > 6 ? this.6.sdelay(lst1[7], lst2[7]); - this.num > 7 ? this.7.sdelay(lst1[8], lst2[8]); - this.num > 8 ? this.8.sdelay(lst1[9], lst2[9]); - this.num > 9 ? this.9.sdelay(lst1[10], lst2[10]); - this.num > 10 ? this.10.sdelay(lst1[11], lst2[11]); - this.num > 11 ? this.11.sdelay(lst1[12], lst2[12]); - this.num > 12 ? this.12.sdelay(lst1[13], lst2[13]); - this.num > 13 ? this.13.sdelay(lst1[14], lst2[14]); - this.num > 14 ? this.14.sdelay(lst1[15], lst2[15]); - this.num > 15 ? this.15.sdelay(lst1[16], lst2[16]); - this.num > 16 ? this.16.sdelay(lst1[17], lst2[17]); - this.num > 17 ? this.17.sdelay(lst1[18], lst2[18]); - this.num > 18 ? this.18.sdelay(lst1[19], lst2[19]); - this.num > 19 ? this.19.sdelay(lst1[20], lst2[20]); - this.num > 20 ? this.20.sdelay(lst1[21], lst2[21]); - this.num > 21 ? this.21.sdelay(lst1[22], lst2[22]); - this.num > 22 ? this.22.sdelay(lst1[23], lst2[23]); - this.num > 23 ? this.23.sdelay(lst1[24], lst2[24]); - this.num > 24 ? this.24.sdelay(lst1[25], lst2[25]); - this.num > 25 ? this.25.sdelay(lst1[26], lst2[26]); - this.num > 26 ? this.26.sdelay(lst1[27], lst2[27]); - this.num > 27 ? this.27.sdelay(lst1[28], lst2[28]); - this.num > 28 ? this.28.sdelay(lst1[29], lst2[29]); - this.num > 29 ? this.29.sdelay(lst1[30], lst2[30]); - this.num > 30 ? this.30.sdelay(lst1[31], lst2[31]); - this.num > 31 ? this.31.sdelay(lst1[32], lst2[32]); - this.num > 32 ? this.32.sdelay(lst1[33], lst2[33]); - this.num > 33 ? this.33.sdelay(lst1[34], lst2[34]); - this.num > 34 ? this.34.sdelay(lst1[35], lst2[35]); - this.num > 35 ? this.35.sdelay(lst1[36], lst2[36]); - this.num > 36 ? this.36.sdelay(lst1[37], lst2[37]); - this.num > 37 ? this.37.sdelay(lst1[38], lst2[38]); - this.num > 38 ? this.38.sdelay(lst1[39], lst2[39]); - this.num > 39 ? this.39.sdelay(lst1[40], lst2[40]); -); -function Psdelay_write(lst1) -( - this.num > 0 ? this.0.sdelay_write(lst1[1]); - this.num > 1 ? this.1.sdelay_write(lst1[2]); - this.num > 2 ? this.2.sdelay_write(lst1[3]); - this.num > 3 ? this.3.sdelay_write(lst1[4]); - this.num > 4 ? this.4.sdelay_write(lst1[5]); - this.num > 5 ? this.5.sdelay_write(lst1[6]); - this.num > 6 ? this.6.sdelay_write(lst1[7]); - this.num > 7 ? this.7.sdelay_write(lst1[8]); - this.num > 8 ? this.8.sdelay_write(lst1[9]); - this.num > 9 ? this.9.sdelay_write(lst1[10]); - this.num > 10 ? this.10.sdelay_write(lst1[11]); - this.num > 11 ? this.11.sdelay_write(lst1[12]); - this.num > 12 ? this.12.sdelay_write(lst1[13]); - this.num > 13 ? this.13.sdelay_write(lst1[14]); - this.num > 14 ? this.14.sdelay_write(lst1[15]); - this.num > 15 ? this.15.sdelay_write(lst1[16]); - this.num > 16 ? this.16.sdelay_write(lst1[17]); - this.num > 17 ? this.17.sdelay_write(lst1[18]); - this.num > 18 ? this.18.sdelay_write(lst1[19]); - this.num > 19 ? this.19.sdelay_write(lst1[20]); - this.num > 20 ? this.20.sdelay_write(lst1[21]); - this.num > 21 ? this.21.sdelay_write(lst1[22]); - this.num > 22 ? this.22.sdelay_write(lst1[23]); - this.num > 23 ? this.23.sdelay_write(lst1[24]); - this.num > 24 ? this.24.sdelay_write(lst1[25]); - this.num > 25 ? this.25.sdelay_write(lst1[26]); - this.num > 26 ? this.26.sdelay_write(lst1[27]); - this.num > 27 ? this.27.sdelay_write(lst1[28]); - this.num > 28 ? this.28.sdelay_write(lst1[29]); - this.num > 29 ? this.29.sdelay_write(lst1[30]); - this.num > 30 ? this.30.sdelay_write(lst1[31]); - this.num > 31 ? this.31.sdelay_write(lst1[32]); - this.num > 32 ? this.32.sdelay_write(lst1[33]); - this.num > 33 ? this.33.sdelay_write(lst1[34]); - this.num > 34 ? this.34.sdelay_write(lst1[35]); - this.num > 35 ? this.35.sdelay_write(lst1[36]); - this.num > 36 ? this.36.sdelay_write(lst1[37]); - this.num > 37 ? this.37.sdelay_write(lst1[38]); - this.num > 38 ? this.38.sdelay_write(lst1[39]); - this.num > 39 ? this.39.sdelay_write(lst1[40]); -); -function Psdelay_set_xfade(lst1) -( - this.num > 0 ? this.0.sdelay_set_xfade(lst1[1]); - this.num > 1 ? this.1.sdelay_set_xfade(lst1[2]); - this.num > 2 ? this.2.sdelay_set_xfade(lst1[3]); - this.num > 3 ? this.3.sdelay_set_xfade(lst1[4]); - this.num > 4 ? this.4.sdelay_set_xfade(lst1[5]); - this.num > 5 ? this.5.sdelay_set_xfade(lst1[6]); - this.num > 6 ? this.6.sdelay_set_xfade(lst1[7]); - this.num > 7 ? this.7.sdelay_set_xfade(lst1[8]); - this.num > 8 ? this.8.sdelay_set_xfade(lst1[9]); - this.num > 9 ? this.9.sdelay_set_xfade(lst1[10]); - this.num > 10 ? this.10.sdelay_set_xfade(lst1[11]); - this.num > 11 ? this.11.sdelay_set_xfade(lst1[12]); - this.num > 12 ? this.12.sdelay_set_xfade(lst1[13]); - this.num > 13 ? this.13.sdelay_set_xfade(lst1[14]); - this.num > 14 ? this.14.sdelay_set_xfade(lst1[15]); - this.num > 15 ? this.15.sdelay_set_xfade(lst1[16]); - this.num > 16 ? this.16.sdelay_set_xfade(lst1[17]); - this.num > 17 ? this.17.sdelay_set_xfade(lst1[18]); - this.num > 18 ? this.18.sdelay_set_xfade(lst1[19]); - this.num > 19 ? this.19.sdelay_set_xfade(lst1[20]); - this.num > 20 ? this.20.sdelay_set_xfade(lst1[21]); - this.num > 21 ? this.21.sdelay_set_xfade(lst1[22]); - this.num > 22 ? this.22.sdelay_set_xfade(lst1[23]); - this.num > 23 ? this.23.sdelay_set_xfade(lst1[24]); - this.num > 24 ? this.24.sdelay_set_xfade(lst1[25]); - this.num > 25 ? this.25.sdelay_set_xfade(lst1[26]); - this.num > 26 ? this.26.sdelay_set_xfade(lst1[27]); - this.num > 27 ? this.27.sdelay_set_xfade(lst1[28]); - this.num > 28 ? this.28.sdelay_set_xfade(lst1[29]); - this.num > 29 ? this.29.sdelay_set_xfade(lst1[30]); - this.num > 30 ? this.30.sdelay_set_xfade(lst1[31]); - this.num > 31 ? this.31.sdelay_set_xfade(lst1[32]); - this.num > 32 ? this.32.sdelay_set_xfade(lst1[33]); - this.num > 33 ? this.33.sdelay_set_xfade(lst1[34]); - this.num > 34 ? this.34.sdelay_set_xfade(lst1[35]); - this.num > 35 ? this.35.sdelay_set_xfade(lst1[36]); - this.num > 36 ? this.36.sdelay_set_xfade(lst1[37]); - this.num > 37 ? this.37.sdelay_set_xfade(lst1[38]); - this.num > 38 ? this.38.sdelay_set_xfade(lst1[39]); - this.num > 39 ? this.39.sdelay_set_xfade(lst1[40]); -); -function Psdelay_read(lst1) -( - this.num > 0 ? this.outlist[1] = this.0.sdelay_read(lst1[1]); - this.num > 1 ? this.outlist[2] = this.1.sdelay_read(lst1[2]); - this.num > 2 ? this.outlist[3] = this.2.sdelay_read(lst1[3]); - this.num > 3 ? this.outlist[4] = this.3.sdelay_read(lst1[4]); - this.num > 4 ? this.outlist[5] = this.4.sdelay_read(lst1[5]); - this.num > 5 ? this.outlist[6] = this.5.sdelay_read(lst1[6]); - this.num > 6 ? this.outlist[7] = this.6.sdelay_read(lst1[7]); - this.num > 7 ? this.outlist[8] = this.7.sdelay_read(lst1[8]); - this.num > 8 ? this.outlist[9] = this.8.sdelay_read(lst1[9]); - this.num > 9 ? this.outlist[10] = this.9.sdelay_read(lst1[10]); - this.num > 10 ? this.outlist[11] = this.10.sdelay_read(lst1[11]); - this.num > 11 ? this.outlist[12] = this.11.sdelay_read(lst1[12]); - this.num > 12 ? this.outlist[13] = this.12.sdelay_read(lst1[13]); - this.num > 13 ? this.outlist[14] = this.13.sdelay_read(lst1[14]); - this.num > 14 ? this.outlist[15] = this.14.sdelay_read(lst1[15]); - this.num > 15 ? this.outlist[16] = this.15.sdelay_read(lst1[16]); - this.num > 16 ? this.outlist[17] = this.16.sdelay_read(lst1[17]); - this.num > 17 ? this.outlist[18] = this.17.sdelay_read(lst1[18]); - this.num > 18 ? this.outlist[19] = this.18.sdelay_read(lst1[19]); - this.num > 19 ? this.outlist[20] = this.19.sdelay_read(lst1[20]); - this.num > 20 ? this.outlist[21] = this.20.sdelay_read(lst1[21]); - this.num > 21 ? this.outlist[22] = this.21.sdelay_read(lst1[22]); - this.num > 22 ? this.outlist[23] = this.22.sdelay_read(lst1[23]); - this.num > 23 ? this.outlist[24] = this.23.sdelay_read(lst1[24]); - this.num > 24 ? this.outlist[25] = this.24.sdelay_read(lst1[25]); - this.num > 25 ? this.outlist[26] = this.25.sdelay_read(lst1[26]); - this.num > 26 ? this.outlist[27] = this.26.sdelay_read(lst1[27]); - this.num > 27 ? this.outlist[28] = this.27.sdelay_read(lst1[28]); - this.num > 28 ? this.outlist[29] = this.28.sdelay_read(lst1[29]); - this.num > 29 ? this.outlist[30] = this.29.sdelay_read(lst1[30]); - this.num > 30 ? this.outlist[31] = this.30.sdelay_read(lst1[31]); - this.num > 31 ? this.outlist[32] = this.31.sdelay_read(lst1[32]); - this.num > 32 ? this.outlist[33] = this.32.sdelay_read(lst1[33]); - this.num > 33 ? this.outlist[34] = this.33.sdelay_read(lst1[34]); - this.num > 34 ? this.outlist[35] = this.34.sdelay_read(lst1[35]); - this.num > 35 ? this.outlist[36] = this.35.sdelay_read(lst1[36]); - this.num > 36 ? this.outlist[37] = this.36.sdelay_read(lst1[37]); - this.num > 37 ? this.outlist[38] = this.37.sdelay_read(lst1[38]); - this.num > 38 ? this.outlist[39] = this.38.sdelay_read(lst1[39]); - this.num > 39 ? this.outlist[40] = this.39.sdelay_read(lst1[40]); - this.outlist; -); - -function Psdelay_fread(lst1) -( - this.num > 0 ? this.outlist[1] = this.0.sdelay_fread(lst1[1]); - this.num > 1 ? this.outlist[2] = this.1.sdelay_fread(lst1[2]); - this.num > 2 ? this.outlist[3] = this.2.sdelay_fread(lst1[3]); - this.num > 3 ? this.outlist[4] = this.3.sdelay_fread(lst1[4]); - this.num > 4 ? this.outlist[5] = this.4.sdelay_fread(lst1[5]); - this.num > 5 ? this.outlist[6] = this.5.sdelay_fread(lst1[6]); - this.num > 6 ? this.outlist[7] = this.6.sdelay_fread(lst1[7]); - this.num > 7 ? this.outlist[8] = this.7.sdelay_fread(lst1[8]); - this.num > 8 ? this.outlist[9] = this.8.sdelay_fread(lst1[9]); - this.num > 9 ? this.outlist[10] = this.9.sdelay_fread(lst1[10]); - this.num > 10 ? this.outlist[11] = this.10.sdelay_fread(lst1[11]); - this.num > 11 ? this.outlist[12] = this.11.sdelay_fread(lst1[12]); - this.num > 12 ? this.outlist[13] = this.12.sdelay_fread(lst1[13]); - this.num > 13 ? this.outlist[14] = this.13.sdelay_fread(lst1[14]); - this.num > 14 ? this.outlist[15] = this.14.sdelay_fread(lst1[15]); - this.num > 15 ? this.outlist[16] = this.15.sdelay_fread(lst1[16]); - this.num > 16 ? this.outlist[17] = this.16.sdelay_fread(lst1[17]); - this.num > 17 ? this.outlist[18] = this.17.sdelay_fread(lst1[18]); - this.num > 18 ? this.outlist[19] = this.18.sdelay_fread(lst1[19]); - this.num > 19 ? this.outlist[20] = this.19.sdelay_fread(lst1[20]); - this.num > 20 ? this.outlist[21] = this.20.sdelay_fread(lst1[21]); - this.num > 21 ? this.outlist[22] = this.21.sdelay_fread(lst1[22]); - this.num > 22 ? this.outlist[23] = this.22.sdelay_fread(lst1[23]); - this.num > 23 ? this.outlist[24] = this.23.sdelay_fread(lst1[24]); - this.num > 24 ? this.outlist[25] = this.24.sdelay_fread(lst1[25]); - this.num > 25 ? this.outlist[26] = this.25.sdelay_fread(lst1[26]); - this.num > 26 ? this.outlist[27] = this.26.sdelay_fread(lst1[27]); - this.num > 27 ? this.outlist[28] = this.27.sdelay_fread(lst1[28]); - this.num > 28 ? this.outlist[29] = this.28.sdelay_fread(lst1[29]); - this.num > 29 ? this.outlist[30] = this.29.sdelay_fread(lst1[30]); - this.num > 30 ? this.outlist[31] = this.30.sdelay_fread(lst1[31]); - this.num > 31 ? this.outlist[32] = this.31.sdelay_fread(lst1[32]); - this.num > 32 ? this.outlist[33] = this.32.sdelay_fread(lst1[33]); - this.num > 33 ? this.outlist[34] = this.33.sdelay_fread(lst1[34]); - this.num > 34 ? this.outlist[35] = this.34.sdelay_fread(lst1[35]); - this.num > 35 ? this.outlist[36] = this.35.sdelay_fread(lst1[36]); - this.num > 36 ? this.outlist[37] = this.36.sdelay_fread(lst1[37]); - this.num > 37 ? this.outlist[38] = this.37.sdelay_fread(lst1[38]); - this.num > 38 ? this.outlist[39] = this.38.sdelay_fread(lst1[39]); - this.num > 39 ? this.outlist[40] = this.39.sdelay_fread(lst1[40]); - this.outlist; -); - -function Psdelay_sread(lst1) -( - this.num > 0 ? this.outlist[1] = this.0.sdelay_sread(lst1[1]); - this.num > 1 ? this.outlist[2] = this.1.sdelay_sread(lst1[2]); - this.num > 2 ? this.outlist[3] = this.2.sdelay_sread(lst1[3]); - this.num > 3 ? this.outlist[4] = this.3.sdelay_sread(lst1[4]); - this.num > 4 ? this.outlist[5] = this.4.sdelay_sread(lst1[5]); - this.num > 5 ? this.outlist[6] = this.5.sdelay_sread(lst1[6]); - this.num > 6 ? this.outlist[7] = this.6.sdelay_sread(lst1[7]); - this.num > 7 ? this.outlist[8] = this.7.sdelay_sread(lst1[8]); - this.num > 8 ? this.outlist[9] = this.8.sdelay_sread(lst1[9]); - this.num > 9 ? this.outlist[10] = this.9.sdelay_sread(lst1[10]); - this.num > 10 ? this.outlist[11] = this.10.sdelay_sread(lst1[11]); - this.num > 11 ? this.outlist[12] = this.11.sdelay_sread(lst1[12]); - this.num > 12 ? this.outlist[13] = this.12.sdelay_sread(lst1[13]); - this.num > 13 ? this.outlist[14] = this.13.sdelay_sread(lst1[14]); - this.num > 14 ? this.outlist[15] = this.14.sdelay_sread(lst1[15]); - this.num > 15 ? this.outlist[16] = this.15.sdelay_sread(lst1[16]); - this.num > 16 ? this.outlist[17] = this.16.sdelay_sread(lst1[17]); - this.num > 17 ? this.outlist[18] = this.17.sdelay_sread(lst1[18]); - this.num > 18 ? this.outlist[19] = this.18.sdelay_sread(lst1[19]); - this.num > 19 ? this.outlist[20] = this.19.sdelay_sread(lst1[20]); - this.num > 20 ? this.outlist[21] = this.20.sdelay_sread(lst1[21]); - this.num > 21 ? this.outlist[22] = this.21.sdelay_sread(lst1[22]); - this.num > 22 ? this.outlist[23] = this.22.sdelay_sread(lst1[23]); - this.num > 23 ? this.outlist[24] = this.23.sdelay_sread(lst1[24]); - this.num > 24 ? this.outlist[25] = this.24.sdelay_sread(lst1[25]); - this.num > 25 ? this.outlist[26] = this.25.sdelay_sread(lst1[26]); - this.num > 26 ? this.outlist[27] = this.26.sdelay_sread(lst1[27]); - this.num > 27 ? this.outlist[28] = this.27.sdelay_sread(lst1[28]); - this.num > 28 ? this.outlist[29] = this.28.sdelay_sread(lst1[29]); - this.num > 29 ? this.outlist[30] = this.29.sdelay_sread(lst1[30]); - this.num > 30 ? this.outlist[31] = this.30.sdelay_sread(lst1[31]); - this.num > 31 ? this.outlist[32] = this.31.sdelay_sread(lst1[32]); - this.num > 32 ? this.outlist[33] = this.32.sdelay_sread(lst1[33]); - this.num > 33 ? this.outlist[34] = this.33.sdelay_sread(lst1[34]); - this.num > 34 ? this.outlist[35] = this.34.sdelay_sread(lst1[35]); - this.num > 35 ? this.outlist[36] = this.35.sdelay_sread(lst1[36]); - this.num > 36 ? this.outlist[37] = this.36.sdelay_sread(lst1[37]); - this.num > 37 ? this.outlist[38] = this.37.sdelay_sread(lst1[38]); - this.num > 38 ? this.outlist[39] = this.38.sdelay_sread(lst1[39]); - this.num > 39 ? this.outlist[40] = this.39.sdelay_sread(lst1[40]); - this.outlist; -); - -function Psdelay_fsread(lst1) -( - this.num > 0 ? this.outlist[1] = this.0.sdelay_fsread(lst1[1]); - this.num > 1 ? this.outlist[2] = this.1.sdelay_fsread(lst1[2]); - this.num > 2 ? this.outlist[3] = this.2.sdelay_fsread(lst1[3]); - this.num > 3 ? this.outlist[4] = this.3.sdelay_fsread(lst1[4]); - this.num > 4 ? this.outlist[5] = this.4.sdelay_fsread(lst1[5]); - this.num > 5 ? this.outlist[6] = this.5.sdelay_fsread(lst1[6]); - this.num > 6 ? this.outlist[7] = this.6.sdelay_fsread(lst1[7]); - this.num > 7 ? this.outlist[8] = this.7.sdelay_fsread(lst1[8]); - this.num > 8 ? this.outlist[9] = this.8.sdelay_fsread(lst1[9]); - this.num > 9 ? this.outlist[10] = this.9.sdelay_fsread(lst1[10]); - this.num > 10 ? this.outlist[11] = this.10.sdelay_fsread(lst1[11]); - this.num > 11 ? this.outlist[12] = this.11.sdelay_fsread(lst1[12]); - this.num > 12 ? this.outlist[13] = this.12.sdelay_fsread(lst1[13]); - this.num > 13 ? this.outlist[14] = this.13.sdelay_fsread(lst1[14]); - this.num > 14 ? this.outlist[15] = this.14.sdelay_fsread(lst1[15]); - this.num > 15 ? this.outlist[16] = this.15.sdelay_fsread(lst1[16]); - this.num > 16 ? this.outlist[17] = this.16.sdelay_fsread(lst1[17]); - this.num > 17 ? this.outlist[18] = this.17.sdelay_fsread(lst1[18]); - this.num > 18 ? this.outlist[19] = this.18.sdelay_fsread(lst1[19]); - this.num > 19 ? this.outlist[20] = this.19.sdelay_fsread(lst1[20]); - this.num > 20 ? this.outlist[21] = this.20.sdelay_fsread(lst1[21]); - this.num > 21 ? this.outlist[22] = this.21.sdelay_fsread(lst1[22]); - this.num > 22 ? this.outlist[23] = this.22.sdelay_fsread(lst1[23]); - this.num > 23 ? this.outlist[24] = this.23.sdelay_fsread(lst1[24]); - this.num > 24 ? this.outlist[25] = this.24.sdelay_fsread(lst1[25]); - this.num > 25 ? this.outlist[26] = this.25.sdelay_fsread(lst1[26]); - this.num > 26 ? this.outlist[27] = this.26.sdelay_fsread(lst1[27]); - this.num > 27 ? this.outlist[28] = this.27.sdelay_fsread(lst1[28]); - this.num > 28 ? this.outlist[29] = this.28.sdelay_fsread(lst1[29]); - this.num > 29 ? this.outlist[30] = this.29.sdelay_fsread(lst1[30]); - this.num > 30 ? this.outlist[31] = this.30.sdelay_fsread(lst1[31]); - this.num > 31 ? this.outlist[32] = this.31.sdelay_fsread(lst1[32]); - this.num > 32 ? this.outlist[33] = this.32.sdelay_fsread(lst1[33]); - this.num > 33 ? this.outlist[34] = this.33.sdelay_fsread(lst1[34]); - this.num > 34 ? this.outlist[35] = this.34.sdelay_fsread(lst1[35]); - this.num > 35 ? this.outlist[36] = this.35.sdelay_fsread(lst1[36]); - this.num > 36 ? this.outlist[37] = this.36.sdelay_fsread(lst1[37]); - this.num > 37 ? this.outlist[38] = this.37.sdelay_fsread(lst1[38]); - this.num > 38 ? this.outlist[39] = this.38.sdelay_fsread(lst1[39]); - this.num > 39 ? this.outlist[40] = this.39.sdelay_fsread(lst1[40]); - this.outlist; -); - -function Psdelay_read2(lst1) -( - this.num > 0 ? this.outlist[1] = this.0.sdelay_read2(lst1[1]); - this.num > 1 ? this.outlist[2] = this.1.sdelay_read2(lst1[2]); - this.num > 2 ? this.outlist[3] = this.2.sdelay_read2(lst1[3]); - this.num > 3 ? this.outlist[4] = this.3.sdelay_read2(lst1[4]); - this.num > 4 ? this.outlist[5] = this.4.sdelay_read2(lst1[5]); - this.num > 5 ? this.outlist[6] = this.5.sdelay_read2(lst1[6]); - this.num > 6 ? this.outlist[7] = this.6.sdelay_read2(lst1[7]); - this.num > 7 ? this.outlist[8] = this.7.sdelay_read2(lst1[8]); - this.num > 8 ? this.outlist[9] = this.8.sdelay_read2(lst1[9]); - this.num > 9 ? this.outlist[10] = this.9.sdelay_read2(lst1[10]); - this.num > 10 ? this.outlist[11] = this.10.sdelay_read2(lst1[11]); - this.num > 11 ? this.outlist[12] = this.11.sdelay_read2(lst1[12]); - this.num > 12 ? this.outlist[13] = this.12.sdelay_read2(lst1[13]); - this.num > 13 ? this.outlist[14] = this.13.sdelay_read2(lst1[14]); - this.num > 14 ? this.outlist[15] = this.14.sdelay_read2(lst1[15]); - this.num > 15 ? this.outlist[16] = this.15.sdelay_read2(lst1[16]); - this.num > 16 ? this.outlist[17] = this.16.sdelay_read2(lst1[17]); - this.num > 17 ? this.outlist[18] = this.17.sdelay_read2(lst1[18]); - this.num > 18 ? this.outlist[19] = this.18.sdelay_read2(lst1[19]); - this.num > 19 ? this.outlist[20] = this.19.sdelay_read2(lst1[20]); - this.num > 20 ? this.outlist[21] = this.20.sdelay_read2(lst1[21]); - this.num > 21 ? this.outlist[22] = this.21.sdelay_read2(lst1[22]); - this.num > 22 ? this.outlist[23] = this.22.sdelay_read2(lst1[23]); - this.num > 23 ? this.outlist[24] = this.23.sdelay_read2(lst1[24]); - this.num > 24 ? this.outlist[25] = this.24.sdelay_read2(lst1[25]); - this.num > 25 ? this.outlist[26] = this.25.sdelay_read2(lst1[26]); - this.num > 26 ? this.outlist[27] = this.26.sdelay_read2(lst1[27]); - this.num > 27 ? this.outlist[28] = this.27.sdelay_read2(lst1[28]); - this.num > 28 ? this.outlist[29] = this.28.sdelay_read2(lst1[29]); - this.num > 29 ? this.outlist[30] = this.29.sdelay_read2(lst1[30]); - this.num > 30 ? this.outlist[31] = this.30.sdelay_read2(lst1[31]); - this.num > 31 ? this.outlist[32] = this.31.sdelay_read2(lst1[32]); - this.num > 32 ? this.outlist[33] = this.32.sdelay_read2(lst1[33]); - this.num > 33 ? this.outlist[34] = this.33.sdelay_read2(lst1[34]); - this.num > 34 ? this.outlist[35] = this.34.sdelay_read2(lst1[35]); - this.num > 35 ? this.outlist[36] = this.35.sdelay_read2(lst1[36]); - this.num > 36 ? this.outlist[37] = this.36.sdelay_read2(lst1[37]); - this.num > 37 ? this.outlist[38] = this.37.sdelay_read2(lst1[38]); - this.num > 38 ? this.outlist[39] = this.38.sdelay_read2(lst1[39]); - this.num > 39 ? this.outlist[40] = this.39.sdelay_read2(lst1[40]); - this.outlist; -); - -function Psdelay_fread2(lst1) -( - this.num > 0 ? this.outlist[1] = this.0.sdelay_fread2(lst1[1]); - this.num > 1 ? this.outlist[2] = this.1.sdelay_fread2(lst1[2]); - this.num > 2 ? this.outlist[3] = this.2.sdelay_fread2(lst1[3]); - this.num > 3 ? this.outlist[4] = this.3.sdelay_fread2(lst1[4]); - this.num > 4 ? this.outlist[5] = this.4.sdelay_fread2(lst1[5]); - this.num > 5 ? this.outlist[6] = this.5.sdelay_fread2(lst1[6]); - this.num > 6 ? this.outlist[7] = this.6.sdelay_fread2(lst1[7]); - this.num > 7 ? this.outlist[8] = this.7.sdelay_fread2(lst1[8]); - this.num > 8 ? this.outlist[9] = this.8.sdelay_fread2(lst1[9]); - this.num > 9 ? this.outlist[10] = this.9.sdelay_fread2(lst1[10]); - this.num > 10 ? this.outlist[11] = this.10.sdelay_fread2(lst1[11]); - this.num > 11 ? this.outlist[12] = this.11.sdelay_fread2(lst1[12]); - this.num > 12 ? this.outlist[13] = this.12.sdelay_fread2(lst1[13]); - this.num > 13 ? this.outlist[14] = this.13.sdelay_fread2(lst1[14]); - this.num > 14 ? this.outlist[15] = this.14.sdelay_fread2(lst1[15]); - this.num > 15 ? this.outlist[16] = this.15.sdelay_fread2(lst1[16]); - this.num > 16 ? this.outlist[17] = this.16.sdelay_fread2(lst1[17]); - this.num > 17 ? this.outlist[18] = this.17.sdelay_fread2(lst1[18]); - this.num > 18 ? this.outlist[19] = this.18.sdelay_fread2(lst1[19]); - this.num > 19 ? this.outlist[20] = this.19.sdelay_fread2(lst1[20]); - this.num > 20 ? this.outlist[21] = this.20.sdelay_fread2(lst1[21]); - this.num > 21 ? this.outlist[22] = this.21.sdelay_fread2(lst1[22]); - this.num > 22 ? this.outlist[23] = this.22.sdelay_fread2(lst1[23]); - this.num > 23 ? this.outlist[24] = this.23.sdelay_fread2(lst1[24]); - this.num > 24 ? this.outlist[25] = this.24.sdelay_fread2(lst1[25]); - this.num > 25 ? this.outlist[26] = this.25.sdelay_fread2(lst1[26]); - this.num > 26 ? this.outlist[27] = this.26.sdelay_fread2(lst1[27]); - this.num > 27 ? this.outlist[28] = this.27.sdelay_fread2(lst1[28]); - this.num > 28 ? this.outlist[29] = this.28.sdelay_fread2(lst1[29]); - this.num > 29 ? this.outlist[30] = this.29.sdelay_fread2(lst1[30]); - this.num > 30 ? this.outlist[31] = this.30.sdelay_fread2(lst1[31]); - this.num > 31 ? this.outlist[32] = this.31.sdelay_fread2(lst1[32]); - this.num > 32 ? this.outlist[33] = this.32.sdelay_fread2(lst1[33]); - this.num > 33 ? this.outlist[34] = this.33.sdelay_fread2(lst1[34]); - this.num > 34 ? this.outlist[35] = this.34.sdelay_fread2(lst1[35]); - this.num > 35 ? this.outlist[36] = this.35.sdelay_fread2(lst1[36]); - this.num > 36 ? this.outlist[37] = this.36.sdelay_fread2(lst1[37]); - this.num > 37 ? this.outlist[38] = this.37.sdelay_fread2(lst1[38]); - this.num > 38 ? this.outlist[39] = this.38.sdelay_fread2(lst1[39]); - this.num > 39 ? this.outlist[40] = this.39.sdelay_fread2(lst1[40]); - this.outlist; -); - -function Psdelay_sread2(lst1) -( - this.num > 0 ? this.outlist[1] = this.0.sdelay_sread2(lst1[1]); - this.num > 1 ? this.outlist[2] = this.1.sdelay_sread2(lst1[2]); - this.num > 2 ? this.outlist[3] = this.2.sdelay_sread2(lst1[3]); - this.num > 3 ? this.outlist[4] = this.3.sdelay_sread2(lst1[4]); - this.num > 4 ? this.outlist[5] = this.4.sdelay_sread2(lst1[5]); - this.num > 5 ? this.outlist[6] = this.5.sdelay_sread2(lst1[6]); - this.num > 6 ? this.outlist[7] = this.6.sdelay_sread2(lst1[7]); - this.num > 7 ? this.outlist[8] = this.7.sdelay_sread2(lst1[8]); - this.num > 8 ? this.outlist[9] = this.8.sdelay_sread2(lst1[9]); - this.num > 9 ? this.outlist[10] = this.9.sdelay_sread2(lst1[10]); - this.num > 10 ? this.outlist[11] = this.10.sdelay_sread2(lst1[11]); - this.num > 11 ? this.outlist[12] = this.11.sdelay_sread2(lst1[12]); - this.num > 12 ? this.outlist[13] = this.12.sdelay_sread2(lst1[13]); - this.num > 13 ? this.outlist[14] = this.13.sdelay_sread2(lst1[14]); - this.num > 14 ? this.outlist[15] = this.14.sdelay_sread2(lst1[15]); - this.num > 15 ? this.outlist[16] = this.15.sdelay_sread2(lst1[16]); - this.num > 16 ? this.outlist[17] = this.16.sdelay_sread2(lst1[17]); - this.num > 17 ? this.outlist[18] = this.17.sdelay_sread2(lst1[18]); - this.num > 18 ? this.outlist[19] = this.18.sdelay_sread2(lst1[19]); - this.num > 19 ? this.outlist[20] = this.19.sdelay_sread2(lst1[20]); - this.num > 20 ? this.outlist[21] = this.20.sdelay_sread2(lst1[21]); - this.num > 21 ? this.outlist[22] = this.21.sdelay_sread2(lst1[22]); - this.num > 22 ? this.outlist[23] = this.22.sdelay_sread2(lst1[23]); - this.num > 23 ? this.outlist[24] = this.23.sdelay_sread2(lst1[24]); - this.num > 24 ? this.outlist[25] = this.24.sdelay_sread2(lst1[25]); - this.num > 25 ? this.outlist[26] = this.25.sdelay_sread2(lst1[26]); - this.num > 26 ? this.outlist[27] = this.26.sdelay_sread2(lst1[27]); - this.num > 27 ? this.outlist[28] = this.27.sdelay_sread2(lst1[28]); - this.num > 28 ? this.outlist[29] = this.28.sdelay_sread2(lst1[29]); - this.num > 29 ? this.outlist[30] = this.29.sdelay_sread2(lst1[30]); - this.num > 30 ? this.outlist[31] = this.30.sdelay_sread2(lst1[31]); - this.num > 31 ? this.outlist[32] = this.31.sdelay_sread2(lst1[32]); - this.num > 32 ? this.outlist[33] = this.32.sdelay_sread2(lst1[33]); - this.num > 33 ? this.outlist[34] = this.33.sdelay_sread2(lst1[34]); - this.num > 34 ? this.outlist[35] = this.34.sdelay_sread2(lst1[35]); - this.num > 35 ? this.outlist[36] = this.35.sdelay_sread2(lst1[36]); - this.num > 36 ? this.outlist[37] = this.36.sdelay_sread2(lst1[37]); - this.num > 37 ? this.outlist[38] = this.37.sdelay_sread2(lst1[38]); - this.num > 38 ? this.outlist[39] = this.38.sdelay_sread2(lst1[39]); - this.num > 39 ? this.outlist[40] = this.39.sdelay_sread2(lst1[40]); - this.outlist; -); - -function Psdelay_fsread2(lst1) -( - this.num > 0 ? this.outlist[1] = this.0.sdelay_fsread2(lst1[1]); - this.num > 1 ? this.outlist[2] = this.1.sdelay_fsread2(lst1[2]); - this.num > 2 ? this.outlist[3] = this.2.sdelay_fsread2(lst1[3]); - this.num > 3 ? this.outlist[4] = this.3.sdelay_fsread2(lst1[4]); - this.num > 4 ? this.outlist[5] = this.4.sdelay_fsread2(lst1[5]); - this.num > 5 ? this.outlist[6] = this.5.sdelay_fsread2(lst1[6]); - this.num > 6 ? this.outlist[7] = this.6.sdelay_fsread2(lst1[7]); - this.num > 7 ? this.outlist[8] = this.7.sdelay_fsread2(lst1[8]); - this.num > 8 ? this.outlist[9] = this.8.sdelay_fsread2(lst1[9]); - this.num > 9 ? this.outlist[10] = this.9.sdelay_fsread2(lst1[10]); - this.num > 10 ? this.outlist[11] = this.10.sdelay_fsread2(lst1[11]); - this.num > 11 ? this.outlist[12] = this.11.sdelay_fsread2(lst1[12]); - this.num > 12 ? this.outlist[13] = this.12.sdelay_fsread2(lst1[13]); - this.num > 13 ? this.outlist[14] = this.13.sdelay_fsread2(lst1[14]); - this.num > 14 ? this.outlist[15] = this.14.sdelay_fsread2(lst1[15]); - this.num > 15 ? this.outlist[16] = this.15.sdelay_fsread2(lst1[16]); - this.num > 16 ? this.outlist[17] = this.16.sdelay_fsread2(lst1[17]); - this.num > 17 ? this.outlist[18] = this.17.sdelay_fsread2(lst1[18]); - this.num > 18 ? this.outlist[19] = this.18.sdelay_fsread2(lst1[19]); - this.num > 19 ? this.outlist[20] = this.19.sdelay_fsread2(lst1[20]); - this.num > 20 ? this.outlist[21] = this.20.sdelay_fsread2(lst1[21]); - this.num > 21 ? this.outlist[22] = this.21.sdelay_fsread2(lst1[22]); - this.num > 22 ? this.outlist[23] = this.22.sdelay_fsread2(lst1[23]); - this.num > 23 ? this.outlist[24] = this.23.sdelay_fsread2(lst1[24]); - this.num > 24 ? this.outlist[25] = this.24.sdelay_fsread2(lst1[25]); - this.num > 25 ? this.outlist[26] = this.25.sdelay_fsread2(lst1[26]); - this.num > 26 ? this.outlist[27] = this.26.sdelay_fsread2(lst1[27]); - this.num > 27 ? this.outlist[28] = this.27.sdelay_fsread2(lst1[28]); - this.num > 28 ? this.outlist[29] = this.28.sdelay_fsread2(lst1[29]); - this.num > 29 ? this.outlist[30] = this.29.sdelay_fsread2(lst1[30]); - this.num > 30 ? this.outlist[31] = this.30.sdelay_fsread2(lst1[31]); - this.num > 31 ? this.outlist[32] = this.31.sdelay_fsread2(lst1[32]); - this.num > 32 ? this.outlist[33] = this.32.sdelay_fsread2(lst1[33]); - this.num > 33 ? this.outlist[34] = this.33.sdelay_fsread2(lst1[34]); - this.num > 34 ? this.outlist[35] = this.34.sdelay_fsread2(lst1[35]); - this.num > 35 ? this.outlist[36] = this.35.sdelay_fsread2(lst1[36]); - this.num > 36 ? this.outlist[37] = this.36.sdelay_fsread2(lst1[37]); - this.num > 37 ? this.outlist[38] = this.37.sdelay_fsread2(lst1[38]); - this.num > 38 ? this.outlist[39] = this.38.sdelay_fsread2(lst1[39]); - this.num > 39 ? this.outlist[40] = this.39.sdelay_fsread2(lst1[40]); - this.outlist; -); - -function Psdelay_read3(lst1) -( - this.num > 0 ? this.outlist[1] = this.0.sdelay_read3(lst1[1]); - this.num > 1 ? this.outlist[2] = this.1.sdelay_read3(lst1[2]); - this.num > 2 ? this.outlist[3] = this.2.sdelay_read3(lst1[3]); - this.num > 3 ? this.outlist[4] = this.3.sdelay_read3(lst1[4]); - this.num > 4 ? this.outlist[5] = this.4.sdelay_read3(lst1[5]); - this.num > 5 ? this.outlist[6] = this.5.sdelay_read3(lst1[6]); - this.num > 6 ? this.outlist[7] = this.6.sdelay_read3(lst1[7]); - this.num > 7 ? this.outlist[8] = this.7.sdelay_read3(lst1[8]); - this.num > 8 ? this.outlist[9] = this.8.sdelay_read3(lst1[9]); - this.num > 9 ? this.outlist[10] = this.9.sdelay_read3(lst1[10]); - this.num > 10 ? this.outlist[11] = this.10.sdelay_read3(lst1[11]); - this.num > 11 ? this.outlist[12] = this.11.sdelay_read3(lst1[12]); - this.num > 12 ? this.outlist[13] = this.12.sdelay_read3(lst1[13]); - this.num > 13 ? this.outlist[14] = this.13.sdelay_read3(lst1[14]); - this.num > 14 ? this.outlist[15] = this.14.sdelay_read3(lst1[15]); - this.num > 15 ? this.outlist[16] = this.15.sdelay_read3(lst1[16]); - this.num > 16 ? this.outlist[17] = this.16.sdelay_read3(lst1[17]); - this.num > 17 ? this.outlist[18] = this.17.sdelay_read3(lst1[18]); - this.num > 18 ? this.outlist[19] = this.18.sdelay_read3(lst1[19]); - this.num > 19 ? this.outlist[20] = this.19.sdelay_read3(lst1[20]); - this.num > 20 ? this.outlist[21] = this.20.sdelay_read3(lst1[21]); - this.num > 21 ? this.outlist[22] = this.21.sdelay_read3(lst1[22]); - this.num > 22 ? this.outlist[23] = this.22.sdelay_read3(lst1[23]); - this.num > 23 ? this.outlist[24] = this.23.sdelay_read3(lst1[24]); - this.num > 24 ? this.outlist[25] = this.24.sdelay_read3(lst1[25]); - this.num > 25 ? this.outlist[26] = this.25.sdelay_read3(lst1[26]); - this.num > 26 ? this.outlist[27] = this.26.sdelay_read3(lst1[27]); - this.num > 27 ? this.outlist[28] = this.27.sdelay_read3(lst1[28]); - this.num > 28 ? this.outlist[29] = this.28.sdelay_read3(lst1[29]); - this.num > 29 ? this.outlist[30] = this.29.sdelay_read3(lst1[30]); - this.num > 30 ? this.outlist[31] = this.30.sdelay_read3(lst1[31]); - this.num > 31 ? this.outlist[32] = this.31.sdelay_read3(lst1[32]); - this.num > 32 ? this.outlist[33] = this.32.sdelay_read3(lst1[33]); - this.num > 33 ? this.outlist[34] = this.33.sdelay_read3(lst1[34]); - this.num > 34 ? this.outlist[35] = this.34.sdelay_read3(lst1[35]); - this.num > 35 ? this.outlist[36] = this.35.sdelay_read3(lst1[36]); - this.num > 36 ? this.outlist[37] = this.36.sdelay_read3(lst1[37]); - this.num > 37 ? this.outlist[38] = this.37.sdelay_read3(lst1[38]); - this.num > 38 ? this.outlist[39] = this.38.sdelay_read3(lst1[39]); - this.num > 39 ? this.outlist[40] = this.39.sdelay_read3(lst1[40]); - this.outlist; -); - -function Psdelay_fread3(lst1) -( - this.num > 0 ? this.outlist[1] = this.0.sdelay_fread3(lst1[1]); - this.num > 1 ? this.outlist[2] = this.1.sdelay_fread3(lst1[2]); - this.num > 2 ? this.outlist[3] = this.2.sdelay_fread3(lst1[3]); - this.num > 3 ? this.outlist[4] = this.3.sdelay_fread3(lst1[4]); - this.num > 4 ? this.outlist[5] = this.4.sdelay_fread3(lst1[5]); - this.num > 5 ? this.outlist[6] = this.5.sdelay_fread3(lst1[6]); - this.num > 6 ? this.outlist[7] = this.6.sdelay_fread3(lst1[7]); - this.num > 7 ? this.outlist[8] = this.7.sdelay_fread3(lst1[8]); - this.num > 8 ? this.outlist[9] = this.8.sdelay_fread3(lst1[9]); - this.num > 9 ? this.outlist[10] = this.9.sdelay_fread3(lst1[10]); - this.num > 10 ? this.outlist[11] = this.10.sdelay_fread3(lst1[11]); - this.num > 11 ? this.outlist[12] = this.11.sdelay_fread3(lst1[12]); - this.num > 12 ? this.outlist[13] = this.12.sdelay_fread3(lst1[13]); - this.num > 13 ? this.outlist[14] = this.13.sdelay_fread3(lst1[14]); - this.num > 14 ? this.outlist[15] = this.14.sdelay_fread3(lst1[15]); - this.num > 15 ? this.outlist[16] = this.15.sdelay_fread3(lst1[16]); - this.num > 16 ? this.outlist[17] = this.16.sdelay_fread3(lst1[17]); - this.num > 17 ? this.outlist[18] = this.17.sdelay_fread3(lst1[18]); - this.num > 18 ? this.outlist[19] = this.18.sdelay_fread3(lst1[19]); - this.num > 19 ? this.outlist[20] = this.19.sdelay_fread3(lst1[20]); - this.num > 20 ? this.outlist[21] = this.20.sdelay_fread3(lst1[21]); - this.num > 21 ? this.outlist[22] = this.21.sdelay_fread3(lst1[22]); - this.num > 22 ? this.outlist[23] = this.22.sdelay_fread3(lst1[23]); - this.num > 23 ? this.outlist[24] = this.23.sdelay_fread3(lst1[24]); - this.num > 24 ? this.outlist[25] = this.24.sdelay_fread3(lst1[25]); - this.num > 25 ? this.outlist[26] = this.25.sdelay_fread3(lst1[26]); - this.num > 26 ? this.outlist[27] = this.26.sdelay_fread3(lst1[27]); - this.num > 27 ? this.outlist[28] = this.27.sdelay_fread3(lst1[28]); - this.num > 28 ? this.outlist[29] = this.28.sdelay_fread3(lst1[29]); - this.num > 29 ? this.outlist[30] = this.29.sdelay_fread3(lst1[30]); - this.num > 30 ? this.outlist[31] = this.30.sdelay_fread3(lst1[31]); - this.num > 31 ? this.outlist[32] = this.31.sdelay_fread3(lst1[32]); - this.num > 32 ? this.outlist[33] = this.32.sdelay_fread3(lst1[33]); - this.num > 33 ? this.outlist[34] = this.33.sdelay_fread3(lst1[34]); - this.num > 34 ? this.outlist[35] = this.34.sdelay_fread3(lst1[35]); - this.num > 35 ? this.outlist[36] = this.35.sdelay_fread3(lst1[36]); - this.num > 36 ? this.outlist[37] = this.36.sdelay_fread3(lst1[37]); - this.num > 37 ? this.outlist[38] = this.37.sdelay_fread3(lst1[38]); - this.num > 38 ? this.outlist[39] = this.38.sdelay_fread3(lst1[39]); - this.num > 39 ? this.outlist[40] = this.39.sdelay_fread3(lst1[40]); - this.outlist; -); - -function Psdelay_sread3(lst1) -( - this.num > 0 ? this.outlist[1] = this.0.sdelay_sread3(lst1[1]); - this.num > 1 ? this.outlist[2] = this.1.sdelay_sread3(lst1[2]); - this.num > 2 ? this.outlist[3] = this.2.sdelay_sread3(lst1[3]); - this.num > 3 ? this.outlist[4] = this.3.sdelay_sread3(lst1[4]); - this.num > 4 ? this.outlist[5] = this.4.sdelay_sread3(lst1[5]); - this.num > 5 ? this.outlist[6] = this.5.sdelay_sread3(lst1[6]); - this.num > 6 ? this.outlist[7] = this.6.sdelay_sread3(lst1[7]); - this.num > 7 ? this.outlist[8] = this.7.sdelay_sread3(lst1[8]); - this.num > 8 ? this.outlist[9] = this.8.sdelay_sread3(lst1[9]); - this.num > 9 ? this.outlist[10] = this.9.sdelay_sread3(lst1[10]); - this.num > 10 ? this.outlist[11] = this.10.sdelay_sread3(lst1[11]); - this.num > 11 ? this.outlist[12] = this.11.sdelay_sread3(lst1[12]); - this.num > 12 ? this.outlist[13] = this.12.sdelay_sread3(lst1[13]); - this.num > 13 ? this.outlist[14] = this.13.sdelay_sread3(lst1[14]); - this.num > 14 ? this.outlist[15] = this.14.sdelay_sread3(lst1[15]); - this.num > 15 ? this.outlist[16] = this.15.sdelay_sread3(lst1[16]); - this.num > 16 ? this.outlist[17] = this.16.sdelay_sread3(lst1[17]); - this.num > 17 ? this.outlist[18] = this.17.sdelay_sread3(lst1[18]); - this.num > 18 ? this.outlist[19] = this.18.sdelay_sread3(lst1[19]); - this.num > 19 ? this.outlist[20] = this.19.sdelay_sread3(lst1[20]); - this.num > 20 ? this.outlist[21] = this.20.sdelay_sread3(lst1[21]); - this.num > 21 ? this.outlist[22] = this.21.sdelay_sread3(lst1[22]); - this.num > 22 ? this.outlist[23] = this.22.sdelay_sread3(lst1[23]); - this.num > 23 ? this.outlist[24] = this.23.sdelay_sread3(lst1[24]); - this.num > 24 ? this.outlist[25] = this.24.sdelay_sread3(lst1[25]); - this.num > 25 ? this.outlist[26] = this.25.sdelay_sread3(lst1[26]); - this.num > 26 ? this.outlist[27] = this.26.sdelay_sread3(lst1[27]); - this.num > 27 ? this.outlist[28] = this.27.sdelay_sread3(lst1[28]); - this.num > 28 ? this.outlist[29] = this.28.sdelay_sread3(lst1[29]); - this.num > 29 ? this.outlist[30] = this.29.sdelay_sread3(lst1[30]); - this.num > 30 ? this.outlist[31] = this.30.sdelay_sread3(lst1[31]); - this.num > 31 ? this.outlist[32] = this.31.sdelay_sread3(lst1[32]); - this.num > 32 ? this.outlist[33] = this.32.sdelay_sread3(lst1[33]); - this.num > 33 ? this.outlist[34] = this.33.sdelay_sread3(lst1[34]); - this.num > 34 ? this.outlist[35] = this.34.sdelay_sread3(lst1[35]); - this.num > 35 ? this.outlist[36] = this.35.sdelay_sread3(lst1[36]); - this.num > 36 ? this.outlist[37] = this.36.sdelay_sread3(lst1[37]); - this.num > 37 ? this.outlist[38] = this.37.sdelay_sread3(lst1[38]); - this.num > 38 ? this.outlist[39] = this.38.sdelay_sread3(lst1[39]); - this.num > 39 ? this.outlist[40] = this.39.sdelay_sread3(lst1[40]); - this.outlist; -); - -function Psdelay_fsread3(lst1) -( - this.num > 0 ? this.outlist[1] = this.0.sdelay_fsread3(lst1[1]); - this.num > 1 ? this.outlist[2] = this.1.sdelay_fsread3(lst1[2]); - this.num > 2 ? this.outlist[3] = this.2.sdelay_fsread3(lst1[3]); - this.num > 3 ? this.outlist[4] = this.3.sdelay_fsread3(lst1[4]); - this.num > 4 ? this.outlist[5] = this.4.sdelay_fsread3(lst1[5]); - this.num > 5 ? this.outlist[6] = this.5.sdelay_fsread3(lst1[6]); - this.num > 6 ? this.outlist[7] = this.6.sdelay_fsread3(lst1[7]); - this.num > 7 ? this.outlist[8] = this.7.sdelay_fsread3(lst1[8]); - this.num > 8 ? this.outlist[9] = this.8.sdelay_fsread3(lst1[9]); - this.num > 9 ? this.outlist[10] = this.9.sdelay_fsread3(lst1[10]); - this.num > 10 ? this.outlist[11] = this.10.sdelay_fsread3(lst1[11]); - this.num > 11 ? this.outlist[12] = this.11.sdelay_fsread3(lst1[12]); - this.num > 12 ? this.outlist[13] = this.12.sdelay_fsread3(lst1[13]); - this.num > 13 ? this.outlist[14] = this.13.sdelay_fsread3(lst1[14]); - this.num > 14 ? this.outlist[15] = this.14.sdelay_fsread3(lst1[15]); - this.num > 15 ? this.outlist[16] = this.15.sdelay_fsread3(lst1[16]); - this.num > 16 ? this.outlist[17] = this.16.sdelay_fsread3(lst1[17]); - this.num > 17 ? this.outlist[18] = this.17.sdelay_fsread3(lst1[18]); - this.num > 18 ? this.outlist[19] = this.18.sdelay_fsread3(lst1[19]); - this.num > 19 ? this.outlist[20] = this.19.sdelay_fsread3(lst1[20]); - this.num > 20 ? this.outlist[21] = this.20.sdelay_fsread3(lst1[21]); - this.num > 21 ? this.outlist[22] = this.21.sdelay_fsread3(lst1[22]); - this.num > 22 ? this.outlist[23] = this.22.sdelay_fsread3(lst1[23]); - this.num > 23 ? this.outlist[24] = this.23.sdelay_fsread3(lst1[24]); - this.num > 24 ? this.outlist[25] = this.24.sdelay_fsread3(lst1[25]); - this.num > 25 ? this.outlist[26] = this.25.sdelay_fsread3(lst1[26]); - this.num > 26 ? this.outlist[27] = this.26.sdelay_fsread3(lst1[27]); - this.num > 27 ? this.outlist[28] = this.27.sdelay_fsread3(lst1[28]); - this.num > 28 ? this.outlist[29] = this.28.sdelay_fsread3(lst1[29]); - this.num > 29 ? this.outlist[30] = this.29.sdelay_fsread3(lst1[30]); - this.num > 30 ? this.outlist[31] = this.30.sdelay_fsread3(lst1[31]); - this.num > 31 ? this.outlist[32] = this.31.sdelay_fsread3(lst1[32]); - this.num > 32 ? this.outlist[33] = this.32.sdelay_fsread3(lst1[33]); - this.num > 33 ? this.outlist[34] = this.33.sdelay_fsread3(lst1[34]); - this.num > 34 ? this.outlist[35] = this.34.sdelay_fsread3(lst1[35]); - this.num > 35 ? this.outlist[36] = this.35.sdelay_fsread3(lst1[36]); - this.num > 36 ? this.outlist[37] = this.36.sdelay_fsread3(lst1[37]); - this.num > 37 ? this.outlist[38] = this.37.sdelay_fsread3(lst1[38]); - this.num > 38 ? this.outlist[39] = this.38.sdelay_fsread3(lst1[39]); - this.num > 39 ? this.outlist[40] = this.39.sdelay_fsread3(lst1[40]); - this.outlist; -); - -function Pmoog(lst1 lst2) -( - this.num = lst1[0]; - this.outlist = memalloc(this.num + 1); - this.outlist[0] = this.num; - this.num > 0 ? this.0.moog(lst1[1], lst2[1]); - this.num > 1 ? this.1.moog(lst1[2], lst2[2]); - this.num > 2 ? this.2.moog(lst1[3], lst2[3]); - this.num > 3 ? this.3.moog(lst1[4], lst2[4]); - this.num > 4 ? this.4.moog(lst1[5], lst2[5]); - this.num > 5 ? this.5.moog(lst1[6], lst2[6]); - this.num > 6 ? this.6.moog(lst1[7], lst2[7]); - this.num > 7 ? this.7.moog(lst1[8], lst2[8]); - this.num > 8 ? this.8.moog(lst1[9], lst2[9]); - this.num > 9 ? this.9.moog(lst1[10], lst2[10]); - this.num > 10 ? this.10.moog(lst1[11], lst2[11]); - this.num > 11 ? this.11.moog(lst1[12], lst2[12]); - this.num > 12 ? this.12.moog(lst1[13], lst2[13]); - this.num > 13 ? this.13.moog(lst1[14], lst2[14]); - this.num > 14 ? this.14.moog(lst1[15], lst2[15]); - this.num > 15 ? this.15.moog(lst1[16], lst2[16]); - this.num > 16 ? this.16.moog(lst1[17], lst2[17]); - this.num > 17 ? this.17.moog(lst1[18], lst2[18]); - this.num > 18 ? this.18.moog(lst1[19], lst2[19]); - this.num > 19 ? this.19.moog(lst1[20], lst2[20]); - this.num > 20 ? this.20.moog(lst1[21], lst2[21]); - this.num > 21 ? this.21.moog(lst1[22], lst2[22]); - this.num > 22 ? this.22.moog(lst1[23], lst2[23]); - this.num > 23 ? this.23.moog(lst1[24], lst2[24]); - this.num > 24 ? this.24.moog(lst1[25], lst2[25]); - this.num > 25 ? this.25.moog(lst1[26], lst2[26]); - this.num > 26 ? this.26.moog(lst1[27], lst2[27]); - this.num > 27 ? this.27.moog(lst1[28], lst2[28]); - this.num > 28 ? this.28.moog(lst1[29], lst2[29]); - this.num > 29 ? this.29.moog(lst1[30], lst2[30]); - this.num > 30 ? this.30.moog(lst1[31], lst2[31]); - this.num > 31 ? this.31.moog(lst1[32], lst2[32]); - this.num > 32 ? this.32.moog(lst1[33], lst2[33]); - this.num > 33 ? this.33.moog(lst1[34], lst2[34]); - this.num > 34 ? this.34.moog(lst1[35], lst2[35]); - this.num > 35 ? this.35.moog(lst1[36], lst2[36]); - this.num > 36 ? this.36.moog(lst1[37], lst2[37]); - this.num > 37 ? this.37.moog(lst1[38], lst2[38]); - this.num > 38 ? this.38.moog(lst1[39], lst2[39]); - this.num > 39 ? this.39.moog(lst1[40], lst2[40]); -); -function Pmoog_set_freq(lst1) -( - this.num > 0 ? this.0.moog_set_freq(lst1[1]); - this.num > 1 ? this.1.moog_set_freq(lst1[2]); - this.num > 2 ? this.2.moog_set_freq(lst1[3]); - this.num > 3 ? this.3.moog_set_freq(lst1[4]); - this.num > 4 ? this.4.moog_set_freq(lst1[5]); - this.num > 5 ? this.5.moog_set_freq(lst1[6]); - this.num > 6 ? this.6.moog_set_freq(lst1[7]); - this.num > 7 ? this.7.moog_set_freq(lst1[8]); - this.num > 8 ? this.8.moog_set_freq(lst1[9]); - this.num > 9 ? this.9.moog_set_freq(lst1[10]); - this.num > 10 ? this.10.moog_set_freq(lst1[11]); - this.num > 11 ? this.11.moog_set_freq(lst1[12]); - this.num > 12 ? this.12.moog_set_freq(lst1[13]); - this.num > 13 ? this.13.moog_set_freq(lst1[14]); - this.num > 14 ? this.14.moog_set_freq(lst1[15]); - this.num > 15 ? this.15.moog_set_freq(lst1[16]); - this.num > 16 ? this.16.moog_set_freq(lst1[17]); - this.num > 17 ? this.17.moog_set_freq(lst1[18]); - this.num > 18 ? this.18.moog_set_freq(lst1[19]); - this.num > 19 ? this.19.moog_set_freq(lst1[20]); - this.num > 20 ? this.20.moog_set_freq(lst1[21]); - this.num > 21 ? this.21.moog_set_freq(lst1[22]); - this.num > 22 ? this.22.moog_set_freq(lst1[23]); - this.num > 23 ? this.23.moog_set_freq(lst1[24]); - this.num > 24 ? this.24.moog_set_freq(lst1[25]); - this.num > 25 ? this.25.moog_set_freq(lst1[26]); - this.num > 26 ? this.26.moog_set_freq(lst1[27]); - this.num > 27 ? this.27.moog_set_freq(lst1[28]); - this.num > 28 ? this.28.moog_set_freq(lst1[29]); - this.num > 29 ? this.29.moog_set_freq(lst1[30]); - this.num > 30 ? this.30.moog_set_freq(lst1[31]); - this.num > 31 ? this.31.moog_set_freq(lst1[32]); - this.num > 32 ? this.32.moog_set_freq(lst1[33]); - this.num > 33 ? this.33.moog_set_freq(lst1[34]); - this.num > 34 ? this.34.moog_set_freq(lst1[35]); - this.num > 35 ? this.35.moog_set_freq(lst1[36]); - this.num > 36 ? this.36.moog_set_freq(lst1[37]); - this.num > 37 ? this.37.moog_set_freq(lst1[38]); - this.num > 38 ? this.38.moog_set_freq(lst1[39]); - this.num > 39 ? this.39.moog_set_freq(lst1[40]); -); -function Pmoog_set_res(lst1) -( - this.num > 0 ? this.0.moog_set_res(lst1[1]); - this.num > 1 ? this.1.moog_set_res(lst1[2]); - this.num > 2 ? this.2.moog_set_res(lst1[3]); - this.num > 3 ? this.3.moog_set_res(lst1[4]); - this.num > 4 ? this.4.moog_set_res(lst1[5]); - this.num > 5 ? this.5.moog_set_res(lst1[6]); - this.num > 6 ? this.6.moog_set_res(lst1[7]); - this.num > 7 ? this.7.moog_set_res(lst1[8]); - this.num > 8 ? this.8.moog_set_res(lst1[9]); - this.num > 9 ? this.9.moog_set_res(lst1[10]); - this.num > 10 ? this.10.moog_set_res(lst1[11]); - this.num > 11 ? this.11.moog_set_res(lst1[12]); - this.num > 12 ? this.12.moog_set_res(lst1[13]); - this.num > 13 ? this.13.moog_set_res(lst1[14]); - this.num > 14 ? this.14.moog_set_res(lst1[15]); - this.num > 15 ? this.15.moog_set_res(lst1[16]); - this.num > 16 ? this.16.moog_set_res(lst1[17]); - this.num > 17 ? this.17.moog_set_res(lst1[18]); - this.num > 18 ? this.18.moog_set_res(lst1[19]); - this.num > 19 ? this.19.moog_set_res(lst1[20]); - this.num > 20 ? this.20.moog_set_res(lst1[21]); - this.num > 21 ? this.21.moog_set_res(lst1[22]); - this.num > 22 ? this.22.moog_set_res(lst1[23]); - this.num > 23 ? this.23.moog_set_res(lst1[24]); - this.num > 24 ? this.24.moog_set_res(lst1[25]); - this.num > 25 ? this.25.moog_set_res(lst1[26]); - this.num > 26 ? this.26.moog_set_res(lst1[27]); - this.num > 27 ? this.27.moog_set_res(lst1[28]); - this.num > 28 ? this.28.moog_set_res(lst1[29]); - this.num > 29 ? this.29.moog_set_res(lst1[30]); - this.num > 30 ? this.30.moog_set_res(lst1[31]); - this.num > 31 ? this.31.moog_set_res(lst1[32]); - this.num > 32 ? this.32.moog_set_res(lst1[33]); - this.num > 33 ? this.33.moog_set_res(lst1[34]); - this.num > 34 ? this.34.moog_set_res(lst1[35]); - this.num > 35 ? this.35.moog_set_res(lst1[36]); - this.num > 36 ? this.36.moog_set_res(lst1[37]); - this.num > 37 ? this.37.moog_set_res(lst1[38]); - this.num > 38 ? this.38.moog_set_res(lst1[39]); - this.num > 39 ? this.39.moog_set_res(lst1[40]); -); -function Pmoog_do(signal) -( - num = signal[0]; - this.num > 0 ? this.outlist[1] = this.0.moog_do(signal[(0 % num) + 1]); - this.num > 1 ? this.outlist[2] = this.1.moog_do(signal[(1 % num) + 1]); - this.num > 2 ? this.outlist[3] = this.2.moog_do(signal[(2 % num) + 1]); - this.num > 3 ? this.outlist[4] = this.3.moog_do(signal[(3 % num) + 1]); - this.num > 4 ? this.outlist[5] = this.4.moog_do(signal[(4 % num) + 1]); - this.num > 5 ? this.outlist[6] = this.5.moog_do(signal[(5 % num) + 1]); - this.num > 6 ? this.outlist[7] = this.6.moog_do(signal[(6 % num) + 1]); - this.num > 7 ? this.outlist[8] = this.7.moog_do(signal[(7 % num) + 1]); - this.num > 8 ? this.outlist[9] = this.8.moog_do(signal[(8 % num) + 1]); - this.num > 9 ? this.outlist[10] = this.9.moog_do(signal[(9 % num) + 1]); - this.num > 10 ? this.outlist[11] = this.10.moog_do(signal[(10 % num) + 1]); - this.num > 11 ? this.outlist[12] = this.11.moog_do(signal[(11 % num) + 1]); - this.num > 12 ? this.outlist[13] = this.12.moog_do(signal[(12 % num) + 1]); - this.num > 13 ? this.outlist[14] = this.13.moog_do(signal[(13 % num) + 1]); - this.num > 14 ? this.outlist[15] = this.14.moog_do(signal[(14 % num) + 1]); - this.num > 15 ? this.outlist[16] = this.15.moog_do(signal[(15 % num) + 1]); - this.num > 16 ? this.outlist[17] = this.16.moog_do(signal[(16 % num) + 1]); - this.num > 17 ? this.outlist[18] = this.17.moog_do(signal[(17 % num) + 1]); - this.num > 18 ? this.outlist[19] = this.18.moog_do(signal[(18 % num) + 1]); - this.num > 19 ? this.outlist[20] = this.19.moog_do(signal[(19 % num) + 1]); - this.num > 20 ? this.outlist[21] = this.20.moog_do(signal[(20 % num) + 1]); - this.num > 21 ? this.outlist[22] = this.21.moog_do(signal[(21 % num) + 1]); - this.num > 22 ? this.outlist[23] = this.22.moog_do(signal[(22 % num) + 1]); - this.num > 23 ? this.outlist[24] = this.23.moog_do(signal[(23 % num) + 1]); - this.num > 24 ? this.outlist[25] = this.24.moog_do(signal[(24 % num) + 1]); - this.num > 25 ? this.outlist[26] = this.25.moog_do(signal[(25 % num) + 1]); - this.num > 26 ? this.outlist[27] = this.26.moog_do(signal[(26 % num) + 1]); - this.num > 27 ? this.outlist[28] = this.27.moog_do(signal[(27 % num) + 1]); - this.num > 28 ? this.outlist[29] = this.28.moog_do(signal[(28 % num) + 1]); - this.num > 29 ? this.outlist[30] = this.29.moog_do(signal[(29 % num) + 1]); - this.num > 30 ? this.outlist[31] = this.30.moog_do(signal[(30 % num) + 1]); - this.num > 31 ? this.outlist[32] = this.31.moog_do(signal[(31 % num) + 1]); - this.num > 32 ? this.outlist[33] = this.32.moog_do(signal[(32 % num) + 1]); - this.num > 33 ? this.outlist[34] = this.33.moog_do(signal[(33 % num) + 1]); - this.num > 34 ? this.outlist[35] = this.34.moog_do(signal[(34 % num) + 1]); - this.num > 35 ? this.outlist[36] = this.35.moog_do(signal[(35 % num) + 1]); - this.num > 36 ? this.outlist[37] = this.36.moog_do(signal[(36 % num) + 1]); - this.num > 37 ? this.outlist[38] = this.37.moog_do(signal[(37 % num) + 1]); - this.num > 38 ? this.outlist[39] = this.38.moog_do(signal[(38 % num) + 1]); - this.num > 39 ? this.outlist[40] = this.39.moog_do(signal[(39 % num) + 1]); - this.outlist; -); - -function Pcomb(lst1 lst2) -( - this.num = lst1[0]; - this.outlist = memalloc(this.num + 1); - this.outlist[0] = this.num; - this.num > 0 ? this.0.comb(lst1[1], lst2[1]); - this.num > 1 ? this.1.comb(lst1[2], lst2[2]); - this.num > 2 ? this.2.comb(lst1[3], lst2[3]); - this.num > 3 ? this.3.comb(lst1[4], lst2[4]); - this.num > 4 ? this.4.comb(lst1[5], lst2[5]); - this.num > 5 ? this.5.comb(lst1[6], lst2[6]); - this.num > 6 ? this.6.comb(lst1[7], lst2[7]); - this.num > 7 ? this.7.comb(lst1[8], lst2[8]); - this.num > 8 ? this.8.comb(lst1[9], lst2[9]); - this.num > 9 ? this.9.comb(lst1[10], lst2[10]); - this.num > 10 ? this.10.comb(lst1[11], lst2[11]); - this.num > 11 ? this.11.comb(lst1[12], lst2[12]); - this.num > 12 ? this.12.comb(lst1[13], lst2[13]); - this.num > 13 ? this.13.comb(lst1[14], lst2[14]); - this.num > 14 ? this.14.comb(lst1[15], lst2[15]); - this.num > 15 ? this.15.comb(lst1[16], lst2[16]); - this.num > 16 ? this.16.comb(lst1[17], lst2[17]); - this.num > 17 ? this.17.comb(lst1[18], lst2[18]); - this.num > 18 ? this.18.comb(lst1[19], lst2[19]); - this.num > 19 ? this.19.comb(lst1[20], lst2[20]); - this.num > 20 ? this.20.comb(lst1[21], lst2[21]); - this.num > 21 ? this.21.comb(lst1[22], lst2[22]); - this.num > 22 ? this.22.comb(lst1[23], lst2[23]); - this.num > 23 ? this.23.comb(lst1[24], lst2[24]); - this.num > 24 ? this.24.comb(lst1[25], lst2[25]); - this.num > 25 ? this.25.comb(lst1[26], lst2[26]); - this.num > 26 ? this.26.comb(lst1[27], lst2[27]); - this.num > 27 ? this.27.comb(lst1[28], lst2[28]); - this.num > 28 ? this.28.comb(lst1[29], lst2[29]); - this.num > 29 ? this.29.comb(lst1[30], lst2[30]); - this.num > 30 ? this.30.comb(lst1[31], lst2[31]); - this.num > 31 ? this.31.comb(lst1[32], lst2[32]); - this.num > 32 ? this.32.comb(lst1[33], lst2[33]); - this.num > 33 ? this.33.comb(lst1[34], lst2[34]); - this.num > 34 ? this.34.comb(lst1[35], lst2[35]); - this.num > 35 ? this.35.comb(lst1[36], lst2[36]); - this.num > 36 ? this.36.comb(lst1[37], lst2[37]); - this.num > 37 ? this.37.comb(lst1[38], lst2[38]); - this.num > 38 ? this.38.comb(lst1[39], lst2[39]); - this.num > 39 ? this.39.comb(lst1[40], lst2[40]); -); -function Pcomb_set_delay(lst1) -( - this.num > 0 ? this.0.comb_set_delay(lst1[1]); - this.num > 1 ? this.1.comb_set_delay(lst1[2]); - this.num > 2 ? this.2.comb_set_delay(lst1[3]); - this.num > 3 ? this.3.comb_set_delay(lst1[4]); - this.num > 4 ? this.4.comb_set_delay(lst1[5]); - this.num > 5 ? this.5.comb_set_delay(lst1[6]); - this.num > 6 ? this.6.comb_set_delay(lst1[7]); - this.num > 7 ? this.7.comb_set_delay(lst1[8]); - this.num > 8 ? this.8.comb_set_delay(lst1[9]); - this.num > 9 ? this.9.comb_set_delay(lst1[10]); - this.num > 10 ? this.10.comb_set_delay(lst1[11]); - this.num > 11 ? this.11.comb_set_delay(lst1[12]); - this.num > 12 ? this.12.comb_set_delay(lst1[13]); - this.num > 13 ? this.13.comb_set_delay(lst1[14]); - this.num > 14 ? this.14.comb_set_delay(lst1[15]); - this.num > 15 ? this.15.comb_set_delay(lst1[16]); - this.num > 16 ? this.16.comb_set_delay(lst1[17]); - this.num > 17 ? this.17.comb_set_delay(lst1[18]); - this.num > 18 ? this.18.comb_set_delay(lst1[19]); - this.num > 19 ? this.19.comb_set_delay(lst1[20]); - this.num > 20 ? this.20.comb_set_delay(lst1[21]); - this.num > 21 ? this.21.comb_set_delay(lst1[22]); - this.num > 22 ? this.22.comb_set_delay(lst1[23]); - this.num > 23 ? this.23.comb_set_delay(lst1[24]); - this.num > 24 ? this.24.comb_set_delay(lst1[25]); - this.num > 25 ? this.25.comb_set_delay(lst1[26]); - this.num > 26 ? this.26.comb_set_delay(lst1[27]); - this.num > 27 ? this.27.comb_set_delay(lst1[28]); - this.num > 28 ? this.28.comb_set_delay(lst1[29]); - this.num > 29 ? this.29.comb_set_delay(lst1[30]); - this.num > 30 ? this.30.comb_set_delay(lst1[31]); - this.num > 31 ? this.31.comb_set_delay(lst1[32]); - this.num > 32 ? this.32.comb_set_delay(lst1[33]); - this.num > 33 ? this.33.comb_set_delay(lst1[34]); - this.num > 34 ? this.34.comb_set_delay(lst1[35]); - this.num > 35 ? this.35.comb_set_delay(lst1[36]); - this.num > 36 ? this.36.comb_set_delay(lst1[37]); - this.num > 37 ? this.37.comb_set_delay(lst1[38]); - this.num > 38 ? this.38.comb_set_delay(lst1[39]); - this.num > 39 ? this.39.comb_set_delay(lst1[40]); -); -function Pcomb_set_feed(lst1) -( - this.num > 0 ? this.0.comb_set_feed(lst1[1]); - this.num > 1 ? this.1.comb_set_feed(lst1[2]); - this.num > 2 ? this.2.comb_set_feed(lst1[3]); - this.num > 3 ? this.3.comb_set_feed(lst1[4]); - this.num > 4 ? this.4.comb_set_feed(lst1[5]); - this.num > 5 ? this.5.comb_set_feed(lst1[6]); - this.num > 6 ? this.6.comb_set_feed(lst1[7]); - this.num > 7 ? this.7.comb_set_feed(lst1[8]); - this.num > 8 ? this.8.comb_set_feed(lst1[9]); - this.num > 9 ? this.9.comb_set_feed(lst1[10]); - this.num > 10 ? this.10.comb_set_feed(lst1[11]); - this.num > 11 ? this.11.comb_set_feed(lst1[12]); - this.num > 12 ? this.12.comb_set_feed(lst1[13]); - this.num > 13 ? this.13.comb_set_feed(lst1[14]); - this.num > 14 ? this.14.comb_set_feed(lst1[15]); - this.num > 15 ? this.15.comb_set_feed(lst1[16]); - this.num > 16 ? this.16.comb_set_feed(lst1[17]); - this.num > 17 ? this.17.comb_set_feed(lst1[18]); - this.num > 18 ? this.18.comb_set_feed(lst1[19]); - this.num > 19 ? this.19.comb_set_feed(lst1[20]); - this.num > 20 ? this.20.comb_set_feed(lst1[21]); - this.num > 21 ? this.21.comb_set_feed(lst1[22]); - this.num > 22 ? this.22.comb_set_feed(lst1[23]); - this.num > 23 ? this.23.comb_set_feed(lst1[24]); - this.num > 24 ? this.24.comb_set_feed(lst1[25]); - this.num > 25 ? this.25.comb_set_feed(lst1[26]); - this.num > 26 ? this.26.comb_set_feed(lst1[27]); - this.num > 27 ? this.27.comb_set_feed(lst1[28]); - this.num > 28 ? this.28.comb_set_feed(lst1[29]); - this.num > 29 ? this.29.comb_set_feed(lst1[30]); - this.num > 30 ? this.30.comb_set_feed(lst1[31]); - this.num > 31 ? this.31.comb_set_feed(lst1[32]); - this.num > 32 ? this.32.comb_set_feed(lst1[33]); - this.num > 33 ? this.33.comb_set_feed(lst1[34]); - this.num > 34 ? this.34.comb_set_feed(lst1[35]); - this.num > 35 ? this.35.comb_set_feed(lst1[36]); - this.num > 36 ? this.36.comb_set_feed(lst1[37]); - this.num > 37 ? this.37.comb_set_feed(lst1[38]); - this.num > 38 ? this.38.comb_set_feed(lst1[39]); - this.num > 39 ? this.39.comb_set_feed(lst1[40]); -); -function Pcomb_do(signal) -( - num = signal[0]; - this.num > 0 ? this.outlist[1] = this.0.comb_do(signal[(0 % num) + 1]); - this.num > 1 ? this.outlist[2] = this.1.comb_do(signal[(1 % num) + 1]); - this.num > 2 ? this.outlist[3] = this.2.comb_do(signal[(2 % num) + 1]); - this.num > 3 ? this.outlist[4] = this.3.comb_do(signal[(3 % num) + 1]); - this.num > 4 ? this.outlist[5] = this.4.comb_do(signal[(4 % num) + 1]); - this.num > 5 ? this.outlist[6] = this.5.comb_do(signal[(5 % num) + 1]); - this.num > 6 ? this.outlist[7] = this.6.comb_do(signal[(6 % num) + 1]); - this.num > 7 ? this.outlist[8] = this.7.comb_do(signal[(7 % num) + 1]); - this.num > 8 ? this.outlist[9] = this.8.comb_do(signal[(8 % num) + 1]); - this.num > 9 ? this.outlist[10] = this.9.comb_do(signal[(9 % num) + 1]); - this.num > 10 ? this.outlist[11] = this.10.comb_do(signal[(10 % num) + 1]); - this.num > 11 ? this.outlist[12] = this.11.comb_do(signal[(11 % num) + 1]); - this.num > 12 ? this.outlist[13] = this.12.comb_do(signal[(12 % num) + 1]); - this.num > 13 ? this.outlist[14] = this.13.comb_do(signal[(13 % num) + 1]); - this.num > 14 ? this.outlist[15] = this.14.comb_do(signal[(14 % num) + 1]); - this.num > 15 ? this.outlist[16] = this.15.comb_do(signal[(15 % num) + 1]); - this.num > 16 ? this.outlist[17] = this.16.comb_do(signal[(16 % num) + 1]); - this.num > 17 ? this.outlist[18] = this.17.comb_do(signal[(17 % num) + 1]); - this.num > 18 ? this.outlist[19] = this.18.comb_do(signal[(18 % num) + 1]); - this.num > 19 ? this.outlist[20] = this.19.comb_do(signal[(19 % num) + 1]); - this.num > 20 ? this.outlist[21] = this.20.comb_do(signal[(20 % num) + 1]); - this.num > 21 ? this.outlist[22] = this.21.comb_do(signal[(21 % num) + 1]); - this.num > 22 ? this.outlist[23] = this.22.comb_do(signal[(22 % num) + 1]); - this.num > 23 ? this.outlist[24] = this.23.comb_do(signal[(23 % num) + 1]); - this.num > 24 ? this.outlist[25] = this.24.comb_do(signal[(24 % num) + 1]); - this.num > 25 ? this.outlist[26] = this.25.comb_do(signal[(25 % num) + 1]); - this.num > 26 ? this.outlist[27] = this.26.comb_do(signal[(26 % num) + 1]); - this.num > 27 ? this.outlist[28] = this.27.comb_do(signal[(27 % num) + 1]); - this.num > 28 ? this.outlist[29] = this.28.comb_do(signal[(28 % num) + 1]); - this.num > 29 ? this.outlist[30] = this.29.comb_do(signal[(29 % num) + 1]); - this.num > 30 ? this.outlist[31] = this.30.comb_do(signal[(30 % num) + 1]); - this.num > 31 ? this.outlist[32] = this.31.comb_do(signal[(31 % num) + 1]); - this.num > 32 ? this.outlist[33] = this.32.comb_do(signal[(32 % num) + 1]); - this.num > 33 ? this.outlist[34] = this.33.comb_do(signal[(33 % num) + 1]); - this.num > 34 ? this.outlist[35] = this.34.comb_do(signal[(34 % num) + 1]); - this.num > 35 ? this.outlist[36] = this.35.comb_do(signal[(35 % num) + 1]); - this.num > 36 ? this.outlist[37] = this.36.comb_do(signal[(36 % num) + 1]); - this.num > 37 ? this.outlist[38] = this.37.comb_do(signal[(37 % num) + 1]); - this.num > 38 ? this.outlist[39] = this.38.comb_do(signal[(38 % num) + 1]); - this.num > 39 ? this.outlist[40] = this.39.comb_do(signal[(39 % num) + 1]); - this.outlist; -); - -function Pallpass(lst1 lst2) -( - this.num = lst1[0]; - this.outlist = memalloc(this.num + 1); - this.outlist[0] = this.num; - this.num > 0 ? this.0.allpass(lst1[1], lst2[1]); - this.num > 1 ? this.1.allpass(lst1[2], lst2[2]); - this.num > 2 ? this.2.allpass(lst1[3], lst2[3]); - this.num > 3 ? this.3.allpass(lst1[4], lst2[4]); - this.num > 4 ? this.4.allpass(lst1[5], lst2[5]); - this.num > 5 ? this.5.allpass(lst1[6], lst2[6]); - this.num > 6 ? this.6.allpass(lst1[7], lst2[7]); - this.num > 7 ? this.7.allpass(lst1[8], lst2[8]); - this.num > 8 ? this.8.allpass(lst1[9], lst2[9]); - this.num > 9 ? this.9.allpass(lst1[10], lst2[10]); - this.num > 10 ? this.10.allpass(lst1[11], lst2[11]); - this.num > 11 ? this.11.allpass(lst1[12], lst2[12]); - this.num > 12 ? this.12.allpass(lst1[13], lst2[13]); - this.num > 13 ? this.13.allpass(lst1[14], lst2[14]); - this.num > 14 ? this.14.allpass(lst1[15], lst2[15]); - this.num > 15 ? this.15.allpass(lst1[16], lst2[16]); - this.num > 16 ? this.16.allpass(lst1[17], lst2[17]); - this.num > 17 ? this.17.allpass(lst1[18], lst2[18]); - this.num > 18 ? this.18.allpass(lst1[19], lst2[19]); - this.num > 19 ? this.19.allpass(lst1[20], lst2[20]); - this.num > 20 ? this.20.allpass(lst1[21], lst2[21]); - this.num > 21 ? this.21.allpass(lst1[22], lst2[22]); - this.num > 22 ? this.22.allpass(lst1[23], lst2[23]); - this.num > 23 ? this.23.allpass(lst1[24], lst2[24]); - this.num > 24 ? this.24.allpass(lst1[25], lst2[25]); - this.num > 25 ? this.25.allpass(lst1[26], lst2[26]); - this.num > 26 ? this.26.allpass(lst1[27], lst2[27]); - this.num > 27 ? this.27.allpass(lst1[28], lst2[28]); - this.num > 28 ? this.28.allpass(lst1[29], lst2[29]); - this.num > 29 ? this.29.allpass(lst1[30], lst2[30]); - this.num > 30 ? this.30.allpass(lst1[31], lst2[31]); - this.num > 31 ? this.31.allpass(lst1[32], lst2[32]); - this.num > 32 ? this.32.allpass(lst1[33], lst2[33]); - this.num > 33 ? this.33.allpass(lst1[34], lst2[34]); - this.num > 34 ? this.34.allpass(lst1[35], lst2[35]); - this.num > 35 ? this.35.allpass(lst1[36], lst2[36]); - this.num > 36 ? this.36.allpass(lst1[37], lst2[37]); - this.num > 37 ? this.37.allpass(lst1[38], lst2[38]); - this.num > 38 ? this.38.allpass(lst1[39], lst2[39]); - this.num > 39 ? this.39.allpass(lst1[40], lst2[40]); -); -function Pallpass_set_delay(lst1) -( - this.num > 0 ? this.0.allpass_set_delay(lst1[1]); - this.num > 1 ? this.1.allpass_set_delay(lst1[2]); - this.num > 2 ? this.2.allpass_set_delay(lst1[3]); - this.num > 3 ? this.3.allpass_set_delay(lst1[4]); - this.num > 4 ? this.4.allpass_set_delay(lst1[5]); - this.num > 5 ? this.5.allpass_set_delay(lst1[6]); - this.num > 6 ? this.6.allpass_set_delay(lst1[7]); - this.num > 7 ? this.7.allpass_set_delay(lst1[8]); - this.num > 8 ? this.8.allpass_set_delay(lst1[9]); - this.num > 9 ? this.9.allpass_set_delay(lst1[10]); - this.num > 10 ? this.10.allpass_set_delay(lst1[11]); - this.num > 11 ? this.11.allpass_set_delay(lst1[12]); - this.num > 12 ? this.12.allpass_set_delay(lst1[13]); - this.num > 13 ? this.13.allpass_set_delay(lst1[14]); - this.num > 14 ? this.14.allpass_set_delay(lst1[15]); - this.num > 15 ? this.15.allpass_set_delay(lst1[16]); - this.num > 16 ? this.16.allpass_set_delay(lst1[17]); - this.num > 17 ? this.17.allpass_set_delay(lst1[18]); - this.num > 18 ? this.18.allpass_set_delay(lst1[19]); - this.num > 19 ? this.19.allpass_set_delay(lst1[20]); - this.num > 20 ? this.20.allpass_set_delay(lst1[21]); - this.num > 21 ? this.21.allpass_set_delay(lst1[22]); - this.num > 22 ? this.22.allpass_set_delay(lst1[23]); - this.num > 23 ? this.23.allpass_set_delay(lst1[24]); - this.num > 24 ? this.24.allpass_set_delay(lst1[25]); - this.num > 25 ? this.25.allpass_set_delay(lst1[26]); - this.num > 26 ? this.26.allpass_set_delay(lst1[27]); - this.num > 27 ? this.27.allpass_set_delay(lst1[28]); - this.num > 28 ? this.28.allpass_set_delay(lst1[29]); - this.num > 29 ? this.29.allpass_set_delay(lst1[30]); - this.num > 30 ? this.30.allpass_set_delay(lst1[31]); - this.num > 31 ? this.31.allpass_set_delay(lst1[32]); - this.num > 32 ? this.32.allpass_set_delay(lst1[33]); - this.num > 33 ? this.33.allpass_set_delay(lst1[34]); - this.num > 34 ? this.34.allpass_set_delay(lst1[35]); - this.num > 35 ? this.35.allpass_set_delay(lst1[36]); - this.num > 36 ? this.36.allpass_set_delay(lst1[37]); - this.num > 37 ? this.37.allpass_set_delay(lst1[38]); - this.num > 38 ? this.38.allpass_set_delay(lst1[39]); - this.num > 39 ? this.39.allpass_set_delay(lst1[40]); -); -function Pallpass_set_feed(lst1) -( - this.num > 0 ? this.0.allpass_set_feed(lst1[1]); - this.num > 1 ? this.1.allpass_set_feed(lst1[2]); - this.num > 2 ? this.2.allpass_set_feed(lst1[3]); - this.num > 3 ? this.3.allpass_set_feed(lst1[4]); - this.num > 4 ? this.4.allpass_set_feed(lst1[5]); - this.num > 5 ? this.5.allpass_set_feed(lst1[6]); - this.num > 6 ? this.6.allpass_set_feed(lst1[7]); - this.num > 7 ? this.7.allpass_set_feed(lst1[8]); - this.num > 8 ? this.8.allpass_set_feed(lst1[9]); - this.num > 9 ? this.9.allpass_set_feed(lst1[10]); - this.num > 10 ? this.10.allpass_set_feed(lst1[11]); - this.num > 11 ? this.11.allpass_set_feed(lst1[12]); - this.num > 12 ? this.12.allpass_set_feed(lst1[13]); - this.num > 13 ? this.13.allpass_set_feed(lst1[14]); - this.num > 14 ? this.14.allpass_set_feed(lst1[15]); - this.num > 15 ? this.15.allpass_set_feed(lst1[16]); - this.num > 16 ? this.16.allpass_set_feed(lst1[17]); - this.num > 17 ? this.17.allpass_set_feed(lst1[18]); - this.num > 18 ? this.18.allpass_set_feed(lst1[19]); - this.num > 19 ? this.19.allpass_set_feed(lst1[20]); - this.num > 20 ? this.20.allpass_set_feed(lst1[21]); - this.num > 21 ? this.21.allpass_set_feed(lst1[22]); - this.num > 22 ? this.22.allpass_set_feed(lst1[23]); - this.num > 23 ? this.23.allpass_set_feed(lst1[24]); - this.num > 24 ? this.24.allpass_set_feed(lst1[25]); - this.num > 25 ? this.25.allpass_set_feed(lst1[26]); - this.num > 26 ? this.26.allpass_set_feed(lst1[27]); - this.num > 27 ? this.27.allpass_set_feed(lst1[28]); - this.num > 28 ? this.28.allpass_set_feed(lst1[29]); - this.num > 29 ? this.29.allpass_set_feed(lst1[30]); - this.num > 30 ? this.30.allpass_set_feed(lst1[31]); - this.num > 31 ? this.31.allpass_set_feed(lst1[32]); - this.num > 32 ? this.32.allpass_set_feed(lst1[33]); - this.num > 33 ? this.33.allpass_set_feed(lst1[34]); - this.num > 34 ? this.34.allpass_set_feed(lst1[35]); - this.num > 35 ? this.35.allpass_set_feed(lst1[36]); - this.num > 36 ? this.36.allpass_set_feed(lst1[37]); - this.num > 37 ? this.37.allpass_set_feed(lst1[38]); - this.num > 38 ? this.38.allpass_set_feed(lst1[39]); - this.num > 39 ? this.39.allpass_set_feed(lst1[40]); -); -function Pallpass_do(signal) -( - num = signal[0]; - this.num > 0 ? this.outlist[1] = this.0.allpass_do(signal[(0 % num) + 1]); - this.num > 1 ? this.outlist[2] = this.1.allpass_do(signal[(1 % num) + 1]); - this.num > 2 ? this.outlist[3] = this.2.allpass_do(signal[(2 % num) + 1]); - this.num > 3 ? this.outlist[4] = this.3.allpass_do(signal[(3 % num) + 1]); - this.num > 4 ? this.outlist[5] = this.4.allpass_do(signal[(4 % num) + 1]); - this.num > 5 ? this.outlist[6] = this.5.allpass_do(signal[(5 % num) + 1]); - this.num > 6 ? this.outlist[7] = this.6.allpass_do(signal[(6 % num) + 1]); - this.num > 7 ? this.outlist[8] = this.7.allpass_do(signal[(7 % num) + 1]); - this.num > 8 ? this.outlist[9] = this.8.allpass_do(signal[(8 % num) + 1]); - this.num > 9 ? this.outlist[10] = this.9.allpass_do(signal[(9 % num) + 1]); - this.num > 10 ? this.outlist[11] = this.10.allpass_do(signal[(10 % num) + 1]); - this.num > 11 ? this.outlist[12] = this.11.allpass_do(signal[(11 % num) + 1]); - this.num > 12 ? this.outlist[13] = this.12.allpass_do(signal[(12 % num) + 1]); - this.num > 13 ? this.outlist[14] = this.13.allpass_do(signal[(13 % num) + 1]); - this.num > 14 ? this.outlist[15] = this.14.allpass_do(signal[(14 % num) + 1]); - this.num > 15 ? this.outlist[16] = this.15.allpass_do(signal[(15 % num) + 1]); - this.num > 16 ? this.outlist[17] = this.16.allpass_do(signal[(16 % num) + 1]); - this.num > 17 ? this.outlist[18] = this.17.allpass_do(signal[(17 % num) + 1]); - this.num > 18 ? this.outlist[19] = this.18.allpass_do(signal[(18 % num) + 1]); - this.num > 19 ? this.outlist[20] = this.19.allpass_do(signal[(19 % num) + 1]); - this.num > 20 ? this.outlist[21] = this.20.allpass_do(signal[(20 % num) + 1]); - this.num > 21 ? this.outlist[22] = this.21.allpass_do(signal[(21 % num) + 1]); - this.num > 22 ? this.outlist[23] = this.22.allpass_do(signal[(22 % num) + 1]); - this.num > 23 ? this.outlist[24] = this.23.allpass_do(signal[(23 % num) + 1]); - this.num > 24 ? this.outlist[25] = this.24.allpass_do(signal[(24 % num) + 1]); - this.num > 25 ? this.outlist[26] = this.25.allpass_do(signal[(25 % num) + 1]); - this.num > 26 ? this.outlist[27] = this.26.allpass_do(signal[(26 % num) + 1]); - this.num > 27 ? this.outlist[28] = this.27.allpass_do(signal[(27 % num) + 1]); - this.num > 28 ? this.outlist[29] = this.28.allpass_do(signal[(28 % num) + 1]); - this.num > 29 ? this.outlist[30] = this.29.allpass_do(signal[(29 % num) + 1]); - this.num > 30 ? this.outlist[31] = this.30.allpass_do(signal[(30 % num) + 1]); - this.num > 31 ? this.outlist[32] = this.31.allpass_do(signal[(31 % num) + 1]); - this.num > 32 ? this.outlist[33] = this.32.allpass_do(signal[(32 % num) + 1]); - this.num > 33 ? this.outlist[34] = this.33.allpass_do(signal[(33 % num) + 1]); - this.num > 34 ? this.outlist[35] = this.34.allpass_do(signal[(34 % num) + 1]); - this.num > 35 ? this.outlist[36] = this.35.allpass_do(signal[(35 % num) + 1]); - this.num > 36 ? this.outlist[37] = this.36.allpass_do(signal[(36 % num) + 1]); - this.num > 37 ? this.outlist[38] = this.37.allpass_do(signal[(37 % num) + 1]); - this.num > 38 ? this.outlist[39] = this.38.allpass_do(signal[(38 % num) + 1]); - this.num > 39 ? this.outlist[40] = this.39.allpass_do(signal[(39 % num) + 1]); - this.outlist; -); - -function Plop(lst1) -( - this.num = lst1[0]; - this.outlist = memalloc(this.num + 1); - this.outlist[0] = this.num; - this.num > 0 ? this.0.lop(lst1[1]); - this.num > 1 ? this.1.lop(lst1[2]); - this.num > 2 ? this.2.lop(lst1[3]); - this.num > 3 ? this.3.lop(lst1[4]); - this.num > 4 ? this.4.lop(lst1[5]); - this.num > 5 ? this.5.lop(lst1[6]); - this.num > 6 ? this.6.lop(lst1[7]); - this.num > 7 ? this.7.lop(lst1[8]); - this.num > 8 ? this.8.lop(lst1[9]); - this.num > 9 ? this.9.lop(lst1[10]); - this.num > 10 ? this.10.lop(lst1[11]); - this.num > 11 ? this.11.lop(lst1[12]); - this.num > 12 ? this.12.lop(lst1[13]); - this.num > 13 ? this.13.lop(lst1[14]); - this.num > 14 ? this.14.lop(lst1[15]); - this.num > 15 ? this.15.lop(lst1[16]); - this.num > 16 ? this.16.lop(lst1[17]); - this.num > 17 ? this.17.lop(lst1[18]); - this.num > 18 ? this.18.lop(lst1[19]); - this.num > 19 ? this.19.lop(lst1[20]); - this.num > 20 ? this.20.lop(lst1[21]); - this.num > 21 ? this.21.lop(lst1[22]); - this.num > 22 ? this.22.lop(lst1[23]); - this.num > 23 ? this.23.lop(lst1[24]); - this.num > 24 ? this.24.lop(lst1[25]); - this.num > 25 ? this.25.lop(lst1[26]); - this.num > 26 ? this.26.lop(lst1[27]); - this.num > 27 ? this.27.lop(lst1[28]); - this.num > 28 ? this.28.lop(lst1[29]); - this.num > 29 ? this.29.lop(lst1[30]); - this.num > 30 ? this.30.lop(lst1[31]); - this.num > 31 ? this.31.lop(lst1[32]); - this.num > 32 ? this.32.lop(lst1[33]); - this.num > 33 ? this.33.lop(lst1[34]); - this.num > 34 ? this.34.lop(lst1[35]); - this.num > 35 ? this.35.lop(lst1[36]); - this.num > 36 ? this.36.lop(lst1[37]); - this.num > 37 ? this.37.lop(lst1[38]); - this.num > 38 ? this.38.lop(lst1[39]); - this.num > 39 ? this.39.lop(lst1[40]); -); -function Plop_set_freq(lst1) -( - this.num > 0 ? this.0.lop_set_freq(lst1[1]); - this.num > 1 ? this.1.lop_set_freq(lst1[2]); - this.num > 2 ? this.2.lop_set_freq(lst1[3]); - this.num > 3 ? this.3.lop_set_freq(lst1[4]); - this.num > 4 ? this.4.lop_set_freq(lst1[5]); - this.num > 5 ? this.5.lop_set_freq(lst1[6]); - this.num > 6 ? this.6.lop_set_freq(lst1[7]); - this.num > 7 ? this.7.lop_set_freq(lst1[8]); - this.num > 8 ? this.8.lop_set_freq(lst1[9]); - this.num > 9 ? this.9.lop_set_freq(lst1[10]); - this.num > 10 ? this.10.lop_set_freq(lst1[11]); - this.num > 11 ? this.11.lop_set_freq(lst1[12]); - this.num > 12 ? this.12.lop_set_freq(lst1[13]); - this.num > 13 ? this.13.lop_set_freq(lst1[14]); - this.num > 14 ? this.14.lop_set_freq(lst1[15]); - this.num > 15 ? this.15.lop_set_freq(lst1[16]); - this.num > 16 ? this.16.lop_set_freq(lst1[17]); - this.num > 17 ? this.17.lop_set_freq(lst1[18]); - this.num > 18 ? this.18.lop_set_freq(lst1[19]); - this.num > 19 ? this.19.lop_set_freq(lst1[20]); - this.num > 20 ? this.20.lop_set_freq(lst1[21]); - this.num > 21 ? this.21.lop_set_freq(lst1[22]); - this.num > 22 ? this.22.lop_set_freq(lst1[23]); - this.num > 23 ? this.23.lop_set_freq(lst1[24]); - this.num > 24 ? this.24.lop_set_freq(lst1[25]); - this.num > 25 ? this.25.lop_set_freq(lst1[26]); - this.num > 26 ? this.26.lop_set_freq(lst1[27]); - this.num > 27 ? this.27.lop_set_freq(lst1[28]); - this.num > 28 ? this.28.lop_set_freq(lst1[29]); - this.num > 29 ? this.29.lop_set_freq(lst1[30]); - this.num > 30 ? this.30.lop_set_freq(lst1[31]); - this.num > 31 ? this.31.lop_set_freq(lst1[32]); - this.num > 32 ? this.32.lop_set_freq(lst1[33]); - this.num > 33 ? this.33.lop_set_freq(lst1[34]); - this.num > 34 ? this.34.lop_set_freq(lst1[35]); - this.num > 35 ? this.35.lop_set_freq(lst1[36]); - this.num > 36 ? this.36.lop_set_freq(lst1[37]); - this.num > 37 ? this.37.lop_set_freq(lst1[38]); - this.num > 38 ? this.38.lop_set_freq(lst1[39]); - this.num > 39 ? this.39.lop_set_freq(lst1[40]); -); -function Plop_do(signal) -( - num = signal[0]; - this.num > 0 ? this.outlist[1] = this.0.lop_do(signal[(0 % num) + 1]); - this.num > 1 ? this.outlist[2] = this.1.lop_do(signal[(1 % num) + 1]); - this.num > 2 ? this.outlist[3] = this.2.lop_do(signal[(2 % num) + 1]); - this.num > 3 ? this.outlist[4] = this.3.lop_do(signal[(3 % num) + 1]); - this.num > 4 ? this.outlist[5] = this.4.lop_do(signal[(4 % num) + 1]); - this.num > 5 ? this.outlist[6] = this.5.lop_do(signal[(5 % num) + 1]); - this.num > 6 ? this.outlist[7] = this.6.lop_do(signal[(6 % num) + 1]); - this.num > 7 ? this.outlist[8] = this.7.lop_do(signal[(7 % num) + 1]); - this.num > 8 ? this.outlist[9] = this.8.lop_do(signal[(8 % num) + 1]); - this.num > 9 ? this.outlist[10] = this.9.lop_do(signal[(9 % num) + 1]); - this.num > 10 ? this.outlist[11] = this.10.lop_do(signal[(10 % num) + 1]); - this.num > 11 ? this.outlist[12] = this.11.lop_do(signal[(11 % num) + 1]); - this.num > 12 ? this.outlist[13] = this.12.lop_do(signal[(12 % num) + 1]); - this.num > 13 ? this.outlist[14] = this.13.lop_do(signal[(13 % num) + 1]); - this.num > 14 ? this.outlist[15] = this.14.lop_do(signal[(14 % num) + 1]); - this.num > 15 ? this.outlist[16] = this.15.lop_do(signal[(15 % num) + 1]); - this.num > 16 ? this.outlist[17] = this.16.lop_do(signal[(16 % num) + 1]); - this.num > 17 ? this.outlist[18] = this.17.lop_do(signal[(17 % num) + 1]); - this.num > 18 ? this.outlist[19] = this.18.lop_do(signal[(18 % num) + 1]); - this.num > 19 ? this.outlist[20] = this.19.lop_do(signal[(19 % num) + 1]); - this.num > 20 ? this.outlist[21] = this.20.lop_do(signal[(20 % num) + 1]); - this.num > 21 ? this.outlist[22] = this.21.lop_do(signal[(21 % num) + 1]); - this.num > 22 ? this.outlist[23] = this.22.lop_do(signal[(22 % num) + 1]); - this.num > 23 ? this.outlist[24] = this.23.lop_do(signal[(23 % num) + 1]); - this.num > 24 ? this.outlist[25] = this.24.lop_do(signal[(24 % num) + 1]); - this.num > 25 ? this.outlist[26] = this.25.lop_do(signal[(25 % num) + 1]); - this.num > 26 ? this.outlist[27] = this.26.lop_do(signal[(26 % num) + 1]); - this.num > 27 ? this.outlist[28] = this.27.lop_do(signal[(27 % num) + 1]); - this.num > 28 ? this.outlist[29] = this.28.lop_do(signal[(28 % num) + 1]); - this.num > 29 ? this.outlist[30] = this.29.lop_do(signal[(29 % num) + 1]); - this.num > 30 ? this.outlist[31] = this.30.lop_do(signal[(30 % num) + 1]); - this.num > 31 ? this.outlist[32] = this.31.lop_do(signal[(31 % num) + 1]); - this.num > 32 ? this.outlist[33] = this.32.lop_do(signal[(32 % num) + 1]); - this.num > 33 ? this.outlist[34] = this.33.lop_do(signal[(33 % num) + 1]); - this.num > 34 ? this.outlist[35] = this.34.lop_do(signal[(34 % num) + 1]); - this.num > 35 ? this.outlist[36] = this.35.lop_do(signal[(35 % num) + 1]); - this.num > 36 ? this.outlist[37] = this.36.lop_do(signal[(36 % num) + 1]); - this.num > 37 ? this.outlist[38] = this.37.lop_do(signal[(37 % num) + 1]); - this.num > 38 ? this.outlist[39] = this.38.lop_do(signal[(38 % num) + 1]); - this.num > 39 ? this.outlist[40] = this.39.lop_do(signal[(39 % num) + 1]); - this.outlist; -); - -function Phip(lst1) -( - this.num = lst1[0]; - this.outlist = memalloc(this.num + 1); - this.outlist[0] = this.num; - this.num > 0 ? this.0.hip(lst1[1]); - this.num > 1 ? this.1.hip(lst1[2]); - this.num > 2 ? this.2.hip(lst1[3]); - this.num > 3 ? this.3.hip(lst1[4]); - this.num > 4 ? this.4.hip(lst1[5]); - this.num > 5 ? this.5.hip(lst1[6]); - this.num > 6 ? this.6.hip(lst1[7]); - this.num > 7 ? this.7.hip(lst1[8]); - this.num > 8 ? this.8.hip(lst1[9]); - this.num > 9 ? this.9.hip(lst1[10]); - this.num > 10 ? this.10.hip(lst1[11]); - this.num > 11 ? this.11.hip(lst1[12]); - this.num > 12 ? this.12.hip(lst1[13]); - this.num > 13 ? this.13.hip(lst1[14]); - this.num > 14 ? this.14.hip(lst1[15]); - this.num > 15 ? this.15.hip(lst1[16]); - this.num > 16 ? this.16.hip(lst1[17]); - this.num > 17 ? this.17.hip(lst1[18]); - this.num > 18 ? this.18.hip(lst1[19]); - this.num > 19 ? this.19.hip(lst1[20]); - this.num > 20 ? this.20.hip(lst1[21]); - this.num > 21 ? this.21.hip(lst1[22]); - this.num > 22 ? this.22.hip(lst1[23]); - this.num > 23 ? this.23.hip(lst1[24]); - this.num > 24 ? this.24.hip(lst1[25]); - this.num > 25 ? this.25.hip(lst1[26]); - this.num > 26 ? this.26.hip(lst1[27]); - this.num > 27 ? this.27.hip(lst1[28]); - this.num > 28 ? this.28.hip(lst1[29]); - this.num > 29 ? this.29.hip(lst1[30]); - this.num > 30 ? this.30.hip(lst1[31]); - this.num > 31 ? this.31.hip(lst1[32]); - this.num > 32 ? this.32.hip(lst1[33]); - this.num > 33 ? this.33.hip(lst1[34]); - this.num > 34 ? this.34.hip(lst1[35]); - this.num > 35 ? this.35.hip(lst1[36]); - this.num > 36 ? this.36.hip(lst1[37]); - this.num > 37 ? this.37.hip(lst1[38]); - this.num > 38 ? this.38.hip(lst1[39]); - this.num > 39 ? this.39.hip(lst1[40]); -); -function Phip_set_freq(lst1) -( - this.num > 0 ? this.0.hip_set_freq(lst1[1]); - this.num > 1 ? this.1.hip_set_freq(lst1[2]); - this.num > 2 ? this.2.hip_set_freq(lst1[3]); - this.num > 3 ? this.3.hip_set_freq(lst1[4]); - this.num > 4 ? this.4.hip_set_freq(lst1[5]); - this.num > 5 ? this.5.hip_set_freq(lst1[6]); - this.num > 6 ? this.6.hip_set_freq(lst1[7]); - this.num > 7 ? this.7.hip_set_freq(lst1[8]); - this.num > 8 ? this.8.hip_set_freq(lst1[9]); - this.num > 9 ? this.9.hip_set_freq(lst1[10]); - this.num > 10 ? this.10.hip_set_freq(lst1[11]); - this.num > 11 ? this.11.hip_set_freq(lst1[12]); - this.num > 12 ? this.12.hip_set_freq(lst1[13]); - this.num > 13 ? this.13.hip_set_freq(lst1[14]); - this.num > 14 ? this.14.hip_set_freq(lst1[15]); - this.num > 15 ? this.15.hip_set_freq(lst1[16]); - this.num > 16 ? this.16.hip_set_freq(lst1[17]); - this.num > 17 ? this.17.hip_set_freq(lst1[18]); - this.num > 18 ? this.18.hip_set_freq(lst1[19]); - this.num > 19 ? this.19.hip_set_freq(lst1[20]); - this.num > 20 ? this.20.hip_set_freq(lst1[21]); - this.num > 21 ? this.21.hip_set_freq(lst1[22]); - this.num > 22 ? this.22.hip_set_freq(lst1[23]); - this.num > 23 ? this.23.hip_set_freq(lst1[24]); - this.num > 24 ? this.24.hip_set_freq(lst1[25]); - this.num > 25 ? this.25.hip_set_freq(lst1[26]); - this.num > 26 ? this.26.hip_set_freq(lst1[27]); - this.num > 27 ? this.27.hip_set_freq(lst1[28]); - this.num > 28 ? this.28.hip_set_freq(lst1[29]); - this.num > 29 ? this.29.hip_set_freq(lst1[30]); - this.num > 30 ? this.30.hip_set_freq(lst1[31]); - this.num > 31 ? this.31.hip_set_freq(lst1[32]); - this.num > 32 ? this.32.hip_set_freq(lst1[33]); - this.num > 33 ? this.33.hip_set_freq(lst1[34]); - this.num > 34 ? this.34.hip_set_freq(lst1[35]); - this.num > 35 ? this.35.hip_set_freq(lst1[36]); - this.num > 36 ? this.36.hip_set_freq(lst1[37]); - this.num > 37 ? this.37.hip_set_freq(lst1[38]); - this.num > 38 ? this.38.hip_set_freq(lst1[39]); - this.num > 39 ? this.39.hip_set_freq(lst1[40]); -); -function Phip_do(signal) -( - num = signal[0]; - this.num > 0 ? this.outlist[1] = this.0.hip_do(signal[(0 % num) + 1]); - this.num > 1 ? this.outlist[2] = this.1.hip_do(signal[(1 % num) + 1]); - this.num > 2 ? this.outlist[3] = this.2.hip_do(signal[(2 % num) + 1]); - this.num > 3 ? this.outlist[4] = this.3.hip_do(signal[(3 % num) + 1]); - this.num > 4 ? this.outlist[5] = this.4.hip_do(signal[(4 % num) + 1]); - this.num > 5 ? this.outlist[6] = this.5.hip_do(signal[(5 % num) + 1]); - this.num > 6 ? this.outlist[7] = this.6.hip_do(signal[(6 % num) + 1]); - this.num > 7 ? this.outlist[8] = this.7.hip_do(signal[(7 % num) + 1]); - this.num > 8 ? this.outlist[9] = this.8.hip_do(signal[(8 % num) + 1]); - this.num > 9 ? this.outlist[10] = this.9.hip_do(signal[(9 % num) + 1]); - this.num > 10 ? this.outlist[11] = this.10.hip_do(signal[(10 % num) + 1]); - this.num > 11 ? this.outlist[12] = this.11.hip_do(signal[(11 % num) + 1]); - this.num > 12 ? this.outlist[13] = this.12.hip_do(signal[(12 % num) + 1]); - this.num > 13 ? this.outlist[14] = this.13.hip_do(signal[(13 % num) + 1]); - this.num > 14 ? this.outlist[15] = this.14.hip_do(signal[(14 % num) + 1]); - this.num > 15 ? this.outlist[16] = this.15.hip_do(signal[(15 % num) + 1]); - this.num > 16 ? this.outlist[17] = this.16.hip_do(signal[(16 % num) + 1]); - this.num > 17 ? this.outlist[18] = this.17.hip_do(signal[(17 % num) + 1]); - this.num > 18 ? this.outlist[19] = this.18.hip_do(signal[(18 % num) + 1]); - this.num > 19 ? this.outlist[20] = this.19.hip_do(signal[(19 % num) + 1]); - this.num > 20 ? this.outlist[21] = this.20.hip_do(signal[(20 % num) + 1]); - this.num > 21 ? this.outlist[22] = this.21.hip_do(signal[(21 % num) + 1]); - this.num > 22 ? this.outlist[23] = this.22.hip_do(signal[(22 % num) + 1]); - this.num > 23 ? this.outlist[24] = this.23.hip_do(signal[(23 % num) + 1]); - this.num > 24 ? this.outlist[25] = this.24.hip_do(signal[(24 % num) + 1]); - this.num > 25 ? this.outlist[26] = this.25.hip_do(signal[(25 % num) + 1]); - this.num > 26 ? this.outlist[27] = this.26.hip_do(signal[(26 % num) + 1]); - this.num > 27 ? this.outlist[28] = this.27.hip_do(signal[(27 % num) + 1]); - this.num > 28 ? this.outlist[29] = this.28.hip_do(signal[(28 % num) + 1]); - this.num > 29 ? this.outlist[30] = this.29.hip_do(signal[(29 % num) + 1]); - this.num > 30 ? this.outlist[31] = this.30.hip_do(signal[(30 % num) + 1]); - this.num > 31 ? this.outlist[32] = this.31.hip_do(signal[(31 % num) + 1]); - this.num > 32 ? this.outlist[33] = this.32.hip_do(signal[(32 % num) + 1]); - this.num > 33 ? this.outlist[34] = this.33.hip_do(signal[(33 % num) + 1]); - this.num > 34 ? this.outlist[35] = this.34.hip_do(signal[(34 % num) + 1]); - this.num > 35 ? this.outlist[36] = this.35.hip_do(signal[(35 % num) + 1]); - this.num > 36 ? this.outlist[37] = this.36.hip_do(signal[(36 % num) + 1]); - this.num > 37 ? this.outlist[38] = this.37.hip_do(signal[(37 % num) + 1]); - this.num > 38 ? this.outlist[39] = this.38.hip_do(signal[(38 % num) + 1]); - this.num > 39 ? this.outlist[40] = this.39.hip_do(signal[(39 % num) + 1]); - this.outlist; -); - -function Pbp(lst1 lst2) -( - this.num = lst1[0]; - this.outlist = memalloc(this.num + 1); - this.outlist[0] = this.num; - this.num > 0 ? this.0.bp(lst1[1], lst2[1]); - this.num > 1 ? this.1.bp(lst1[2], lst2[2]); - this.num > 2 ? this.2.bp(lst1[3], lst2[3]); - this.num > 3 ? this.3.bp(lst1[4], lst2[4]); - this.num > 4 ? this.4.bp(lst1[5], lst2[5]); - this.num > 5 ? this.5.bp(lst1[6], lst2[6]); - this.num > 6 ? this.6.bp(lst1[7], lst2[7]); - this.num > 7 ? this.7.bp(lst1[8], lst2[8]); - this.num > 8 ? this.8.bp(lst1[9], lst2[9]); - this.num > 9 ? this.9.bp(lst1[10], lst2[10]); - this.num > 10 ? this.10.bp(lst1[11], lst2[11]); - this.num > 11 ? this.11.bp(lst1[12], lst2[12]); - this.num > 12 ? this.12.bp(lst1[13], lst2[13]); - this.num > 13 ? this.13.bp(lst1[14], lst2[14]); - this.num > 14 ? this.14.bp(lst1[15], lst2[15]); - this.num > 15 ? this.15.bp(lst1[16], lst2[16]); - this.num > 16 ? this.16.bp(lst1[17], lst2[17]); - this.num > 17 ? this.17.bp(lst1[18], lst2[18]); - this.num > 18 ? this.18.bp(lst1[19], lst2[19]); - this.num > 19 ? this.19.bp(lst1[20], lst2[20]); - this.num > 20 ? this.20.bp(lst1[21], lst2[21]); - this.num > 21 ? this.21.bp(lst1[22], lst2[22]); - this.num > 22 ? this.22.bp(lst1[23], lst2[23]); - this.num > 23 ? this.23.bp(lst1[24], lst2[24]); - this.num > 24 ? this.24.bp(lst1[25], lst2[25]); - this.num > 25 ? this.25.bp(lst1[26], lst2[26]); - this.num > 26 ? this.26.bp(lst1[27], lst2[27]); - this.num > 27 ? this.27.bp(lst1[28], lst2[28]); - this.num > 28 ? this.28.bp(lst1[29], lst2[29]); - this.num > 29 ? this.29.bp(lst1[30], lst2[30]); - this.num > 30 ? this.30.bp(lst1[31], lst2[31]); - this.num > 31 ? this.31.bp(lst1[32], lst2[32]); - this.num > 32 ? this.32.bp(lst1[33], lst2[33]); - this.num > 33 ? this.33.bp(lst1[34], lst2[34]); - this.num > 34 ? this.34.bp(lst1[35], lst2[35]); - this.num > 35 ? this.35.bp(lst1[36], lst2[36]); - this.num > 36 ? this.36.bp(lst1[37], lst2[37]); - this.num > 37 ? this.37.bp(lst1[38], lst2[38]); - this.num > 38 ? this.38.bp(lst1[39], lst2[39]); - this.num > 39 ? this.39.bp(lst1[40], lst2[40]); -); -function Pbp_set_freq(lst1) -( - this.num > 0 ? this.0.bp_set_freq(lst1[1]); - this.num > 1 ? this.1.bp_set_freq(lst1[2]); - this.num > 2 ? this.2.bp_set_freq(lst1[3]); - this.num > 3 ? this.3.bp_set_freq(lst1[4]); - this.num > 4 ? this.4.bp_set_freq(lst1[5]); - this.num > 5 ? this.5.bp_set_freq(lst1[6]); - this.num > 6 ? this.6.bp_set_freq(lst1[7]); - this.num > 7 ? this.7.bp_set_freq(lst1[8]); - this.num > 8 ? this.8.bp_set_freq(lst1[9]); - this.num > 9 ? this.9.bp_set_freq(lst1[10]); - this.num > 10 ? this.10.bp_set_freq(lst1[11]); - this.num > 11 ? this.11.bp_set_freq(lst1[12]); - this.num > 12 ? this.12.bp_set_freq(lst1[13]); - this.num > 13 ? this.13.bp_set_freq(lst1[14]); - this.num > 14 ? this.14.bp_set_freq(lst1[15]); - this.num > 15 ? this.15.bp_set_freq(lst1[16]); - this.num > 16 ? this.16.bp_set_freq(lst1[17]); - this.num > 17 ? this.17.bp_set_freq(lst1[18]); - this.num > 18 ? this.18.bp_set_freq(lst1[19]); - this.num > 19 ? this.19.bp_set_freq(lst1[20]); - this.num > 20 ? this.20.bp_set_freq(lst1[21]); - this.num > 21 ? this.21.bp_set_freq(lst1[22]); - this.num > 22 ? this.22.bp_set_freq(lst1[23]); - this.num > 23 ? this.23.bp_set_freq(lst1[24]); - this.num > 24 ? this.24.bp_set_freq(lst1[25]); - this.num > 25 ? this.25.bp_set_freq(lst1[26]); - this.num > 26 ? this.26.bp_set_freq(lst1[27]); - this.num > 27 ? this.27.bp_set_freq(lst1[28]); - this.num > 28 ? this.28.bp_set_freq(lst1[29]); - this.num > 29 ? this.29.bp_set_freq(lst1[30]); - this.num > 30 ? this.30.bp_set_freq(lst1[31]); - this.num > 31 ? this.31.bp_set_freq(lst1[32]); - this.num > 32 ? this.32.bp_set_freq(lst1[33]); - this.num > 33 ? this.33.bp_set_freq(lst1[34]); - this.num > 34 ? this.34.bp_set_freq(lst1[35]); - this.num > 35 ? this.35.bp_set_freq(lst1[36]); - this.num > 36 ? this.36.bp_set_freq(lst1[37]); - this.num > 37 ? this.37.bp_set_freq(lst1[38]); - this.num > 38 ? this.38.bp_set_freq(lst1[39]); - this.num > 39 ? this.39.bp_set_freq(lst1[40]); -); -function Pbp_set_q(lst1) -( - this.num > 0 ? this.0.bp_set_q(lst1[1]); - this.num > 1 ? this.1.bp_set_q(lst1[2]); - this.num > 2 ? this.2.bp_set_q(lst1[3]); - this.num > 3 ? this.3.bp_set_q(lst1[4]); - this.num > 4 ? this.4.bp_set_q(lst1[5]); - this.num > 5 ? this.5.bp_set_q(lst1[6]); - this.num > 6 ? this.6.bp_set_q(lst1[7]); - this.num > 7 ? this.7.bp_set_q(lst1[8]); - this.num > 8 ? this.8.bp_set_q(lst1[9]); - this.num > 9 ? this.9.bp_set_q(lst1[10]); - this.num > 10 ? this.10.bp_set_q(lst1[11]); - this.num > 11 ? this.11.bp_set_q(lst1[12]); - this.num > 12 ? this.12.bp_set_q(lst1[13]); - this.num > 13 ? this.13.bp_set_q(lst1[14]); - this.num > 14 ? this.14.bp_set_q(lst1[15]); - this.num > 15 ? this.15.bp_set_q(lst1[16]); - this.num > 16 ? this.16.bp_set_q(lst1[17]); - this.num > 17 ? this.17.bp_set_q(lst1[18]); - this.num > 18 ? this.18.bp_set_q(lst1[19]); - this.num > 19 ? this.19.bp_set_q(lst1[20]); - this.num > 20 ? this.20.bp_set_q(lst1[21]); - this.num > 21 ? this.21.bp_set_q(lst1[22]); - this.num > 22 ? this.22.bp_set_q(lst1[23]); - this.num > 23 ? this.23.bp_set_q(lst1[24]); - this.num > 24 ? this.24.bp_set_q(lst1[25]); - this.num > 25 ? this.25.bp_set_q(lst1[26]); - this.num > 26 ? this.26.bp_set_q(lst1[27]); - this.num > 27 ? this.27.bp_set_q(lst1[28]); - this.num > 28 ? this.28.bp_set_q(lst1[29]); - this.num > 29 ? this.29.bp_set_q(lst1[30]); - this.num > 30 ? this.30.bp_set_q(lst1[31]); - this.num > 31 ? this.31.bp_set_q(lst1[32]); - this.num > 32 ? this.32.bp_set_q(lst1[33]); - this.num > 33 ? this.33.bp_set_q(lst1[34]); - this.num > 34 ? this.34.bp_set_q(lst1[35]); - this.num > 35 ? this.35.bp_set_q(lst1[36]); - this.num > 36 ? this.36.bp_set_q(lst1[37]); - this.num > 37 ? this.37.bp_set_q(lst1[38]); - this.num > 38 ? this.38.bp_set_q(lst1[39]); - this.num > 39 ? this.39.bp_set_q(lst1[40]); -); -function Pbp_do(signal) -( - num = signal[0]; - this.num > 0 ? this.outlist[1] = this.0.bp_do(signal[(0 % num) + 1]); - this.num > 1 ? this.outlist[2] = this.1.bp_do(signal[(1 % num) + 1]); - this.num > 2 ? this.outlist[3] = this.2.bp_do(signal[(2 % num) + 1]); - this.num > 3 ? this.outlist[4] = this.3.bp_do(signal[(3 % num) + 1]); - this.num > 4 ? this.outlist[5] = this.4.bp_do(signal[(4 % num) + 1]); - this.num > 5 ? this.outlist[6] = this.5.bp_do(signal[(5 % num) + 1]); - this.num > 6 ? this.outlist[7] = this.6.bp_do(signal[(6 % num) + 1]); - this.num > 7 ? this.outlist[8] = this.7.bp_do(signal[(7 % num) + 1]); - this.num > 8 ? this.outlist[9] = this.8.bp_do(signal[(8 % num) + 1]); - this.num > 9 ? this.outlist[10] = this.9.bp_do(signal[(9 % num) + 1]); - this.num > 10 ? this.outlist[11] = this.10.bp_do(signal[(10 % num) + 1]); - this.num > 11 ? this.outlist[12] = this.11.bp_do(signal[(11 % num) + 1]); - this.num > 12 ? this.outlist[13] = this.12.bp_do(signal[(12 % num) + 1]); - this.num > 13 ? this.outlist[14] = this.13.bp_do(signal[(13 % num) + 1]); - this.num > 14 ? this.outlist[15] = this.14.bp_do(signal[(14 % num) + 1]); - this.num > 15 ? this.outlist[16] = this.15.bp_do(signal[(15 % num) + 1]); - this.num > 16 ? this.outlist[17] = this.16.bp_do(signal[(16 % num) + 1]); - this.num > 17 ? this.outlist[18] = this.17.bp_do(signal[(17 % num) + 1]); - this.num > 18 ? this.outlist[19] = this.18.bp_do(signal[(18 % num) + 1]); - this.num > 19 ? this.outlist[20] = this.19.bp_do(signal[(19 % num) + 1]); - this.num > 20 ? this.outlist[21] = this.20.bp_do(signal[(20 % num) + 1]); - this.num > 21 ? this.outlist[22] = this.21.bp_do(signal[(21 % num) + 1]); - this.num > 22 ? this.outlist[23] = this.22.bp_do(signal[(22 % num) + 1]); - this.num > 23 ? this.outlist[24] = this.23.bp_do(signal[(23 % num) + 1]); - this.num > 24 ? this.outlist[25] = this.24.bp_do(signal[(24 % num) + 1]); - this.num > 25 ? this.outlist[26] = this.25.bp_do(signal[(25 % num) + 1]); - this.num > 26 ? this.outlist[27] = this.26.bp_do(signal[(26 % num) + 1]); - this.num > 27 ? this.outlist[28] = this.27.bp_do(signal[(27 % num) + 1]); - this.num > 28 ? this.outlist[29] = this.28.bp_do(signal[(28 % num) + 1]); - this.num > 29 ? this.outlist[30] = this.29.bp_do(signal[(29 % num) + 1]); - this.num > 30 ? this.outlist[31] = this.30.bp_do(signal[(30 % num) + 1]); - this.num > 31 ? this.outlist[32] = this.31.bp_do(signal[(31 % num) + 1]); - this.num > 32 ? this.outlist[33] = this.32.bp_do(signal[(32 % num) + 1]); - this.num > 33 ? this.outlist[34] = this.33.bp_do(signal[(33 % num) + 1]); - this.num > 34 ? this.outlist[35] = this.34.bp_do(signal[(34 % num) + 1]); - this.num > 35 ? this.outlist[36] = this.35.bp_do(signal[(35 % num) + 1]); - this.num > 36 ? this.outlist[37] = this.36.bp_do(signal[(36 % num) + 1]); - this.num > 37 ? this.outlist[38] = this.37.bp_do(signal[(37 % num) + 1]); - this.num > 38 ? this.outlist[39] = this.38.bp_do(signal[(38 % num) + 1]); - this.num > 39 ? this.outlist[40] = this.39.bp_do(signal[(39 % num) + 1]); - this.outlist; -); - -function Pbutlp(lst1) -( - this.num = lst1[0]; - this.outlist = memalloc(this.num + 1); - this.outlist[0] = this.num; - this.num > 0 ? this.0.butlp(lst1[1]); - this.num > 1 ? this.1.butlp(lst1[2]); - this.num > 2 ? this.2.butlp(lst1[3]); - this.num > 3 ? this.3.butlp(lst1[4]); - this.num > 4 ? this.4.butlp(lst1[5]); - this.num > 5 ? this.5.butlp(lst1[6]); - this.num > 6 ? this.6.butlp(lst1[7]); - this.num > 7 ? this.7.butlp(lst1[8]); - this.num > 8 ? this.8.butlp(lst1[9]); - this.num > 9 ? this.9.butlp(lst1[10]); - this.num > 10 ? this.10.butlp(lst1[11]); - this.num > 11 ? this.11.butlp(lst1[12]); - this.num > 12 ? this.12.butlp(lst1[13]); - this.num > 13 ? this.13.butlp(lst1[14]); - this.num > 14 ? this.14.butlp(lst1[15]); - this.num > 15 ? this.15.butlp(lst1[16]); - this.num > 16 ? this.16.butlp(lst1[17]); - this.num > 17 ? this.17.butlp(lst1[18]); - this.num > 18 ? this.18.butlp(lst1[19]); - this.num > 19 ? this.19.butlp(lst1[20]); - this.num > 20 ? this.20.butlp(lst1[21]); - this.num > 21 ? this.21.butlp(lst1[22]); - this.num > 22 ? this.22.butlp(lst1[23]); - this.num > 23 ? this.23.butlp(lst1[24]); - this.num > 24 ? this.24.butlp(lst1[25]); - this.num > 25 ? this.25.butlp(lst1[26]); - this.num > 26 ? this.26.butlp(lst1[27]); - this.num > 27 ? this.27.butlp(lst1[28]); - this.num > 28 ? this.28.butlp(lst1[29]); - this.num > 29 ? this.29.butlp(lst1[30]); - this.num > 30 ? this.30.butlp(lst1[31]); - this.num > 31 ? this.31.butlp(lst1[32]); - this.num > 32 ? this.32.butlp(lst1[33]); - this.num > 33 ? this.33.butlp(lst1[34]); - this.num > 34 ? this.34.butlp(lst1[35]); - this.num > 35 ? this.35.butlp(lst1[36]); - this.num > 36 ? this.36.butlp(lst1[37]); - this.num > 37 ? this.37.butlp(lst1[38]); - this.num > 38 ? this.38.butlp(lst1[39]); - this.num > 39 ? this.39.butlp(lst1[40]); -); -function Pbutlp_set_freq(lst1) -( - this.num > 0 ? this.0.butlp_set_freq(lst1[1]); - this.num > 1 ? this.1.butlp_set_freq(lst1[2]); - this.num > 2 ? this.2.butlp_set_freq(lst1[3]); - this.num > 3 ? this.3.butlp_set_freq(lst1[4]); - this.num > 4 ? this.4.butlp_set_freq(lst1[5]); - this.num > 5 ? this.5.butlp_set_freq(lst1[6]); - this.num > 6 ? this.6.butlp_set_freq(lst1[7]); - this.num > 7 ? this.7.butlp_set_freq(lst1[8]); - this.num > 8 ? this.8.butlp_set_freq(lst1[9]); - this.num > 9 ? this.9.butlp_set_freq(lst1[10]); - this.num > 10 ? this.10.butlp_set_freq(lst1[11]); - this.num > 11 ? this.11.butlp_set_freq(lst1[12]); - this.num > 12 ? this.12.butlp_set_freq(lst1[13]); - this.num > 13 ? this.13.butlp_set_freq(lst1[14]); - this.num > 14 ? this.14.butlp_set_freq(lst1[15]); - this.num > 15 ? this.15.butlp_set_freq(lst1[16]); - this.num > 16 ? this.16.butlp_set_freq(lst1[17]); - this.num > 17 ? this.17.butlp_set_freq(lst1[18]); - this.num > 18 ? this.18.butlp_set_freq(lst1[19]); - this.num > 19 ? this.19.butlp_set_freq(lst1[20]); - this.num > 20 ? this.20.butlp_set_freq(lst1[21]); - this.num > 21 ? this.21.butlp_set_freq(lst1[22]); - this.num > 22 ? this.22.butlp_set_freq(lst1[23]); - this.num > 23 ? this.23.butlp_set_freq(lst1[24]); - this.num > 24 ? this.24.butlp_set_freq(lst1[25]); - this.num > 25 ? this.25.butlp_set_freq(lst1[26]); - this.num > 26 ? this.26.butlp_set_freq(lst1[27]); - this.num > 27 ? this.27.butlp_set_freq(lst1[28]); - this.num > 28 ? this.28.butlp_set_freq(lst1[29]); - this.num > 29 ? this.29.butlp_set_freq(lst1[30]); - this.num > 30 ? this.30.butlp_set_freq(lst1[31]); - this.num > 31 ? this.31.butlp_set_freq(lst1[32]); - this.num > 32 ? this.32.butlp_set_freq(lst1[33]); - this.num > 33 ? this.33.butlp_set_freq(lst1[34]); - this.num > 34 ? this.34.butlp_set_freq(lst1[35]); - this.num > 35 ? this.35.butlp_set_freq(lst1[36]); - this.num > 36 ? this.36.butlp_set_freq(lst1[37]); - this.num > 37 ? this.37.butlp_set_freq(lst1[38]); - this.num > 38 ? this.38.butlp_set_freq(lst1[39]); - this.num > 39 ? this.39.butlp_set_freq(lst1[40]); -); -function Pbutlp_do(signal) -( - num = signal[0]; - this.num > 0 ? this.outlist[1] = this.0.butlp_do(signal[(0 % num) + 1]); - this.num > 1 ? this.outlist[2] = this.1.butlp_do(signal[(1 % num) + 1]); - this.num > 2 ? this.outlist[3] = this.2.butlp_do(signal[(2 % num) + 1]); - this.num > 3 ? this.outlist[4] = this.3.butlp_do(signal[(3 % num) + 1]); - this.num > 4 ? this.outlist[5] = this.4.butlp_do(signal[(4 % num) + 1]); - this.num > 5 ? this.outlist[6] = this.5.butlp_do(signal[(5 % num) + 1]); - this.num > 6 ? this.outlist[7] = this.6.butlp_do(signal[(6 % num) + 1]); - this.num > 7 ? this.outlist[8] = this.7.butlp_do(signal[(7 % num) + 1]); - this.num > 8 ? this.outlist[9] = this.8.butlp_do(signal[(8 % num) + 1]); - this.num > 9 ? this.outlist[10] = this.9.butlp_do(signal[(9 % num) + 1]); - this.num > 10 ? this.outlist[11] = this.10.butlp_do(signal[(10 % num) + 1]); - this.num > 11 ? this.outlist[12] = this.11.butlp_do(signal[(11 % num) + 1]); - this.num > 12 ? this.outlist[13] = this.12.butlp_do(signal[(12 % num) + 1]); - this.num > 13 ? this.outlist[14] = this.13.butlp_do(signal[(13 % num) + 1]); - this.num > 14 ? this.outlist[15] = this.14.butlp_do(signal[(14 % num) + 1]); - this.num > 15 ? this.outlist[16] = this.15.butlp_do(signal[(15 % num) + 1]); - this.num > 16 ? this.outlist[17] = this.16.butlp_do(signal[(16 % num) + 1]); - this.num > 17 ? this.outlist[18] = this.17.butlp_do(signal[(17 % num) + 1]); - this.num > 18 ? this.outlist[19] = this.18.butlp_do(signal[(18 % num) + 1]); - this.num > 19 ? this.outlist[20] = this.19.butlp_do(signal[(19 % num) + 1]); - this.num > 20 ? this.outlist[21] = this.20.butlp_do(signal[(20 % num) + 1]); - this.num > 21 ? this.outlist[22] = this.21.butlp_do(signal[(21 % num) + 1]); - this.num > 22 ? this.outlist[23] = this.22.butlp_do(signal[(22 % num) + 1]); - this.num > 23 ? this.outlist[24] = this.23.butlp_do(signal[(23 % num) + 1]); - this.num > 24 ? this.outlist[25] = this.24.butlp_do(signal[(24 % num) + 1]); - this.num > 25 ? this.outlist[26] = this.25.butlp_do(signal[(25 % num) + 1]); - this.num > 26 ? this.outlist[27] = this.26.butlp_do(signal[(26 % num) + 1]); - this.num > 27 ? this.outlist[28] = this.27.butlp_do(signal[(27 % num) + 1]); - this.num > 28 ? this.outlist[29] = this.28.butlp_do(signal[(28 % num) + 1]); - this.num > 29 ? this.outlist[30] = this.29.butlp_do(signal[(29 % num) + 1]); - this.num > 30 ? this.outlist[31] = this.30.butlp_do(signal[(30 % num) + 1]); - this.num > 31 ? this.outlist[32] = this.31.butlp_do(signal[(31 % num) + 1]); - this.num > 32 ? this.outlist[33] = this.32.butlp_do(signal[(32 % num) + 1]); - this.num > 33 ? this.outlist[34] = this.33.butlp_do(signal[(33 % num) + 1]); - this.num > 34 ? this.outlist[35] = this.34.butlp_do(signal[(34 % num) + 1]); - this.num > 35 ? this.outlist[36] = this.35.butlp_do(signal[(35 % num) + 1]); - this.num > 36 ? this.outlist[37] = this.36.butlp_do(signal[(36 % num) + 1]); - this.num > 37 ? this.outlist[38] = this.37.butlp_do(signal[(37 % num) + 1]); - this.num > 38 ? this.outlist[39] = this.38.butlp_do(signal[(38 % num) + 1]); - this.num > 39 ? this.outlist[40] = this.39.butlp_do(signal[(39 % num) + 1]); - this.outlist; -); - -function Pbuthp(lst1) -( - this.num = lst1[0]; - this.outlist = memalloc(this.num + 1); - this.outlist[0] = this.num; - this.num > 0 ? this.0.buthp(lst1[1]); - this.num > 1 ? this.1.buthp(lst1[2]); - this.num > 2 ? this.2.buthp(lst1[3]); - this.num > 3 ? this.3.buthp(lst1[4]); - this.num > 4 ? this.4.buthp(lst1[5]); - this.num > 5 ? this.5.buthp(lst1[6]); - this.num > 6 ? this.6.buthp(lst1[7]); - this.num > 7 ? this.7.buthp(lst1[8]); - this.num > 8 ? this.8.buthp(lst1[9]); - this.num > 9 ? this.9.buthp(lst1[10]); - this.num > 10 ? this.10.buthp(lst1[11]); - this.num > 11 ? this.11.buthp(lst1[12]); - this.num > 12 ? this.12.buthp(lst1[13]); - this.num > 13 ? this.13.buthp(lst1[14]); - this.num > 14 ? this.14.buthp(lst1[15]); - this.num > 15 ? this.15.buthp(lst1[16]); - this.num > 16 ? this.16.buthp(lst1[17]); - this.num > 17 ? this.17.buthp(lst1[18]); - this.num > 18 ? this.18.buthp(lst1[19]); - this.num > 19 ? this.19.buthp(lst1[20]); - this.num > 20 ? this.20.buthp(lst1[21]); - this.num > 21 ? this.21.buthp(lst1[22]); - this.num > 22 ? this.22.buthp(lst1[23]); - this.num > 23 ? this.23.buthp(lst1[24]); - this.num > 24 ? this.24.buthp(lst1[25]); - this.num > 25 ? this.25.buthp(lst1[26]); - this.num > 26 ? this.26.buthp(lst1[27]); - this.num > 27 ? this.27.buthp(lst1[28]); - this.num > 28 ? this.28.buthp(lst1[29]); - this.num > 29 ? this.29.buthp(lst1[30]); - this.num > 30 ? this.30.buthp(lst1[31]); - this.num > 31 ? this.31.buthp(lst1[32]); - this.num > 32 ? this.32.buthp(lst1[33]); - this.num > 33 ? this.33.buthp(lst1[34]); - this.num > 34 ? this.34.buthp(lst1[35]); - this.num > 35 ? this.35.buthp(lst1[36]); - this.num > 36 ? this.36.buthp(lst1[37]); - this.num > 37 ? this.37.buthp(lst1[38]); - this.num > 38 ? this.38.buthp(lst1[39]); - this.num > 39 ? this.39.buthp(lst1[40]); -); -function Pbuthp_set_freq(lst1) -( - this.num > 0 ? this.0.buthp_set_freq(lst1[1]); - this.num > 1 ? this.1.buthp_set_freq(lst1[2]); - this.num > 2 ? this.2.buthp_set_freq(lst1[3]); - this.num > 3 ? this.3.buthp_set_freq(lst1[4]); - this.num > 4 ? this.4.buthp_set_freq(lst1[5]); - this.num > 5 ? this.5.buthp_set_freq(lst1[6]); - this.num > 6 ? this.6.buthp_set_freq(lst1[7]); - this.num > 7 ? this.7.buthp_set_freq(lst1[8]); - this.num > 8 ? this.8.buthp_set_freq(lst1[9]); - this.num > 9 ? this.9.buthp_set_freq(lst1[10]); - this.num > 10 ? this.10.buthp_set_freq(lst1[11]); - this.num > 11 ? this.11.buthp_set_freq(lst1[12]); - this.num > 12 ? this.12.buthp_set_freq(lst1[13]); - this.num > 13 ? this.13.buthp_set_freq(lst1[14]); - this.num > 14 ? this.14.buthp_set_freq(lst1[15]); - this.num > 15 ? this.15.buthp_set_freq(lst1[16]); - this.num > 16 ? this.16.buthp_set_freq(lst1[17]); - this.num > 17 ? this.17.buthp_set_freq(lst1[18]); - this.num > 18 ? this.18.buthp_set_freq(lst1[19]); - this.num > 19 ? this.19.buthp_set_freq(lst1[20]); - this.num > 20 ? this.20.buthp_set_freq(lst1[21]); - this.num > 21 ? this.21.buthp_set_freq(lst1[22]); - this.num > 22 ? this.22.buthp_set_freq(lst1[23]); - this.num > 23 ? this.23.buthp_set_freq(lst1[24]); - this.num > 24 ? this.24.buthp_set_freq(lst1[25]); - this.num > 25 ? this.25.buthp_set_freq(lst1[26]); - this.num > 26 ? this.26.buthp_set_freq(lst1[27]); - this.num > 27 ? this.27.buthp_set_freq(lst1[28]); - this.num > 28 ? this.28.buthp_set_freq(lst1[29]); - this.num > 29 ? this.29.buthp_set_freq(lst1[30]); - this.num > 30 ? this.30.buthp_set_freq(lst1[31]); - this.num > 31 ? this.31.buthp_set_freq(lst1[32]); - this.num > 32 ? this.32.buthp_set_freq(lst1[33]); - this.num > 33 ? this.33.buthp_set_freq(lst1[34]); - this.num > 34 ? this.34.buthp_set_freq(lst1[35]); - this.num > 35 ? this.35.buthp_set_freq(lst1[36]); - this.num > 36 ? this.36.buthp_set_freq(lst1[37]); - this.num > 37 ? this.37.buthp_set_freq(lst1[38]); - this.num > 38 ? this.38.buthp_set_freq(lst1[39]); - this.num > 39 ? this.39.buthp_set_freq(lst1[40]); -); -function Pbuthp_do(signal) -( - num = signal[0]; - this.num > 0 ? this.outlist[1] = this.0.buthp_do(signal[(0 % num) + 1]); - this.num > 1 ? this.outlist[2] = this.1.buthp_do(signal[(1 % num) + 1]); - this.num > 2 ? this.outlist[3] = this.2.buthp_do(signal[(2 % num) + 1]); - this.num > 3 ? this.outlist[4] = this.3.buthp_do(signal[(3 % num) + 1]); - this.num > 4 ? this.outlist[5] = this.4.buthp_do(signal[(4 % num) + 1]); - this.num > 5 ? this.outlist[6] = this.5.buthp_do(signal[(5 % num) + 1]); - this.num > 6 ? this.outlist[7] = this.6.buthp_do(signal[(6 % num) + 1]); - this.num > 7 ? this.outlist[8] = this.7.buthp_do(signal[(7 % num) + 1]); - this.num > 8 ? this.outlist[9] = this.8.buthp_do(signal[(8 % num) + 1]); - this.num > 9 ? this.outlist[10] = this.9.buthp_do(signal[(9 % num) + 1]); - this.num > 10 ? this.outlist[11] = this.10.buthp_do(signal[(10 % num) + 1]); - this.num > 11 ? this.outlist[12] = this.11.buthp_do(signal[(11 % num) + 1]); - this.num > 12 ? this.outlist[13] = this.12.buthp_do(signal[(12 % num) + 1]); - this.num > 13 ? this.outlist[14] = this.13.buthp_do(signal[(13 % num) + 1]); - this.num > 14 ? this.outlist[15] = this.14.buthp_do(signal[(14 % num) + 1]); - this.num > 15 ? this.outlist[16] = this.15.buthp_do(signal[(15 % num) + 1]); - this.num > 16 ? this.outlist[17] = this.16.buthp_do(signal[(16 % num) + 1]); - this.num > 17 ? this.outlist[18] = this.17.buthp_do(signal[(17 % num) + 1]); - this.num > 18 ? this.outlist[19] = this.18.buthp_do(signal[(18 % num) + 1]); - this.num > 19 ? this.outlist[20] = this.19.buthp_do(signal[(19 % num) + 1]); - this.num > 20 ? this.outlist[21] = this.20.buthp_do(signal[(20 % num) + 1]); - this.num > 21 ? this.outlist[22] = this.21.buthp_do(signal[(21 % num) + 1]); - this.num > 22 ? this.outlist[23] = this.22.buthp_do(signal[(22 % num) + 1]); - this.num > 23 ? this.outlist[24] = this.23.buthp_do(signal[(23 % num) + 1]); - this.num > 24 ? this.outlist[25] = this.24.buthp_do(signal[(24 % num) + 1]); - this.num > 25 ? this.outlist[26] = this.25.buthp_do(signal[(25 % num) + 1]); - this.num > 26 ? this.outlist[27] = this.26.buthp_do(signal[(26 % num) + 1]); - this.num > 27 ? this.outlist[28] = this.27.buthp_do(signal[(27 % num) + 1]); - this.num > 28 ? this.outlist[29] = this.28.buthp_do(signal[(28 % num) + 1]); - this.num > 29 ? this.outlist[30] = this.29.buthp_do(signal[(29 % num) + 1]); - this.num > 30 ? this.outlist[31] = this.30.buthp_do(signal[(30 % num) + 1]); - this.num > 31 ? this.outlist[32] = this.31.buthp_do(signal[(31 % num) + 1]); - this.num > 32 ? this.outlist[33] = this.32.buthp_do(signal[(32 % num) + 1]); - this.num > 33 ? this.outlist[34] = this.33.buthp_do(signal[(33 % num) + 1]); - this.num > 34 ? this.outlist[35] = this.34.buthp_do(signal[(34 % num) + 1]); - this.num > 35 ? this.outlist[36] = this.35.buthp_do(signal[(35 % num) + 1]); - this.num > 36 ? this.outlist[37] = this.36.buthp_do(signal[(36 % num) + 1]); - this.num > 37 ? this.outlist[38] = this.37.buthp_do(signal[(37 % num) + 1]); - this.num > 38 ? this.outlist[39] = this.38.buthp_do(signal[(38 % num) + 1]); - this.num > 39 ? this.outlist[40] = this.39.buthp_do(signal[(39 % num) + 1]); - this.outlist; -); - -function Pbutbp(lst1 lst2) -( - this.num = lst1[0]; - this.outlist = memalloc(this.num + 1); - this.outlist[0] = this.num; - this.num > 0 ? this.0.butbp(lst1[1], lst2[1]); - this.num > 1 ? this.1.butbp(lst1[2], lst2[2]); - this.num > 2 ? this.2.butbp(lst1[3], lst2[3]); - this.num > 3 ? this.3.butbp(lst1[4], lst2[4]); - this.num > 4 ? this.4.butbp(lst1[5], lst2[5]); - this.num > 5 ? this.5.butbp(lst1[6], lst2[6]); - this.num > 6 ? this.6.butbp(lst1[7], lst2[7]); - this.num > 7 ? this.7.butbp(lst1[8], lst2[8]); - this.num > 8 ? this.8.butbp(lst1[9], lst2[9]); - this.num > 9 ? this.9.butbp(lst1[10], lst2[10]); - this.num > 10 ? this.10.butbp(lst1[11], lst2[11]); - this.num > 11 ? this.11.butbp(lst1[12], lst2[12]); - this.num > 12 ? this.12.butbp(lst1[13], lst2[13]); - this.num > 13 ? this.13.butbp(lst1[14], lst2[14]); - this.num > 14 ? this.14.butbp(lst1[15], lst2[15]); - this.num > 15 ? this.15.butbp(lst1[16], lst2[16]); - this.num > 16 ? this.16.butbp(lst1[17], lst2[17]); - this.num > 17 ? this.17.butbp(lst1[18], lst2[18]); - this.num > 18 ? this.18.butbp(lst1[19], lst2[19]); - this.num > 19 ? this.19.butbp(lst1[20], lst2[20]); - this.num > 20 ? this.20.butbp(lst1[21], lst2[21]); - this.num > 21 ? this.21.butbp(lst1[22], lst2[22]); - this.num > 22 ? this.22.butbp(lst1[23], lst2[23]); - this.num > 23 ? this.23.butbp(lst1[24], lst2[24]); - this.num > 24 ? this.24.butbp(lst1[25], lst2[25]); - this.num > 25 ? this.25.butbp(lst1[26], lst2[26]); - this.num > 26 ? this.26.butbp(lst1[27], lst2[27]); - this.num > 27 ? this.27.butbp(lst1[28], lst2[28]); - this.num > 28 ? this.28.butbp(lst1[29], lst2[29]); - this.num > 29 ? this.29.butbp(lst1[30], lst2[30]); - this.num > 30 ? this.30.butbp(lst1[31], lst2[31]); - this.num > 31 ? this.31.butbp(lst1[32], lst2[32]); - this.num > 32 ? this.32.butbp(lst1[33], lst2[33]); - this.num > 33 ? this.33.butbp(lst1[34], lst2[34]); - this.num > 34 ? this.34.butbp(lst1[35], lst2[35]); - this.num > 35 ? this.35.butbp(lst1[36], lst2[36]); - this.num > 36 ? this.36.butbp(lst1[37], lst2[37]); - this.num > 37 ? this.37.butbp(lst1[38], lst2[38]); - this.num > 38 ? this.38.butbp(lst1[39], lst2[39]); - this.num > 39 ? this.39.butbp(lst1[40], lst2[40]); -); -function Pbutbp_set_freq(lst1) -( - this.num > 0 ? this.0.butbp_set_freq(lst1[1]); - this.num > 1 ? this.1.butbp_set_freq(lst1[2]); - this.num > 2 ? this.2.butbp_set_freq(lst1[3]); - this.num > 3 ? this.3.butbp_set_freq(lst1[4]); - this.num > 4 ? this.4.butbp_set_freq(lst1[5]); - this.num > 5 ? this.5.butbp_set_freq(lst1[6]); - this.num > 6 ? this.6.butbp_set_freq(lst1[7]); - this.num > 7 ? this.7.butbp_set_freq(lst1[8]); - this.num > 8 ? this.8.butbp_set_freq(lst1[9]); - this.num > 9 ? this.9.butbp_set_freq(lst1[10]); - this.num > 10 ? this.10.butbp_set_freq(lst1[11]); - this.num > 11 ? this.11.butbp_set_freq(lst1[12]); - this.num > 12 ? this.12.butbp_set_freq(lst1[13]); - this.num > 13 ? this.13.butbp_set_freq(lst1[14]); - this.num > 14 ? this.14.butbp_set_freq(lst1[15]); - this.num > 15 ? this.15.butbp_set_freq(lst1[16]); - this.num > 16 ? this.16.butbp_set_freq(lst1[17]); - this.num > 17 ? this.17.butbp_set_freq(lst1[18]); - this.num > 18 ? this.18.butbp_set_freq(lst1[19]); - this.num > 19 ? this.19.butbp_set_freq(lst1[20]); - this.num > 20 ? this.20.butbp_set_freq(lst1[21]); - this.num > 21 ? this.21.butbp_set_freq(lst1[22]); - this.num > 22 ? this.22.butbp_set_freq(lst1[23]); - this.num > 23 ? this.23.butbp_set_freq(lst1[24]); - this.num > 24 ? this.24.butbp_set_freq(lst1[25]); - this.num > 25 ? this.25.butbp_set_freq(lst1[26]); - this.num > 26 ? this.26.butbp_set_freq(lst1[27]); - this.num > 27 ? this.27.butbp_set_freq(lst1[28]); - this.num > 28 ? this.28.butbp_set_freq(lst1[29]); - this.num > 29 ? this.29.butbp_set_freq(lst1[30]); - this.num > 30 ? this.30.butbp_set_freq(lst1[31]); - this.num > 31 ? this.31.butbp_set_freq(lst1[32]); - this.num > 32 ? this.32.butbp_set_freq(lst1[33]); - this.num > 33 ? this.33.butbp_set_freq(lst1[34]); - this.num > 34 ? this.34.butbp_set_freq(lst1[35]); - this.num > 35 ? this.35.butbp_set_freq(lst1[36]); - this.num > 36 ? this.36.butbp_set_freq(lst1[37]); - this.num > 37 ? this.37.butbp_set_freq(lst1[38]); - this.num > 38 ? this.38.butbp_set_freq(lst1[39]); - this.num > 39 ? this.39.butbp_set_freq(lst1[40]); -); -function Pbutbp_set_q(lst1) -( - this.num > 0 ? this.0.butbp_set_q(lst1[1]); - this.num > 1 ? this.1.butbp_set_q(lst1[2]); - this.num > 2 ? this.2.butbp_set_q(lst1[3]); - this.num > 3 ? this.3.butbp_set_q(lst1[4]); - this.num > 4 ? this.4.butbp_set_q(lst1[5]); - this.num > 5 ? this.5.butbp_set_q(lst1[6]); - this.num > 6 ? this.6.butbp_set_q(lst1[7]); - this.num > 7 ? this.7.butbp_set_q(lst1[8]); - this.num > 8 ? this.8.butbp_set_q(lst1[9]); - this.num > 9 ? this.9.butbp_set_q(lst1[10]); - this.num > 10 ? this.10.butbp_set_q(lst1[11]); - this.num > 11 ? this.11.butbp_set_q(lst1[12]); - this.num > 12 ? this.12.butbp_set_q(lst1[13]); - this.num > 13 ? this.13.butbp_set_q(lst1[14]); - this.num > 14 ? this.14.butbp_set_q(lst1[15]); - this.num > 15 ? this.15.butbp_set_q(lst1[16]); - this.num > 16 ? this.16.butbp_set_q(lst1[17]); - this.num > 17 ? this.17.butbp_set_q(lst1[18]); - this.num > 18 ? this.18.butbp_set_q(lst1[19]); - this.num > 19 ? this.19.butbp_set_q(lst1[20]); - this.num > 20 ? this.20.butbp_set_q(lst1[21]); - this.num > 21 ? this.21.butbp_set_q(lst1[22]); - this.num > 22 ? this.22.butbp_set_q(lst1[23]); - this.num > 23 ? this.23.butbp_set_q(lst1[24]); - this.num > 24 ? this.24.butbp_set_q(lst1[25]); - this.num > 25 ? this.25.butbp_set_q(lst1[26]); - this.num > 26 ? this.26.butbp_set_q(lst1[27]); - this.num > 27 ? this.27.butbp_set_q(lst1[28]); - this.num > 28 ? this.28.butbp_set_q(lst1[29]); - this.num > 29 ? this.29.butbp_set_q(lst1[30]); - this.num > 30 ? this.30.butbp_set_q(lst1[31]); - this.num > 31 ? this.31.butbp_set_q(lst1[32]); - this.num > 32 ? this.32.butbp_set_q(lst1[33]); - this.num > 33 ? this.33.butbp_set_q(lst1[34]); - this.num > 34 ? this.34.butbp_set_q(lst1[35]); - this.num > 35 ? this.35.butbp_set_q(lst1[36]); - this.num > 36 ? this.36.butbp_set_q(lst1[37]); - this.num > 37 ? this.37.butbp_set_q(lst1[38]); - this.num > 38 ? this.38.butbp_set_q(lst1[39]); - this.num > 39 ? this.39.butbp_set_q(lst1[40]); -); -function Pbutbp_do(signal) -( - num = signal[0]; - this.num > 0 ? this.outlist[1] = this.0.butbp_do(signal[(0 % num) + 1]); - this.num > 1 ? this.outlist[2] = this.1.butbp_do(signal[(1 % num) + 1]); - this.num > 2 ? this.outlist[3] = this.2.butbp_do(signal[(2 % num) + 1]); - this.num > 3 ? this.outlist[4] = this.3.butbp_do(signal[(3 % num) + 1]); - this.num > 4 ? this.outlist[5] = this.4.butbp_do(signal[(4 % num) + 1]); - this.num > 5 ? this.outlist[6] = this.5.butbp_do(signal[(5 % num) + 1]); - this.num > 6 ? this.outlist[7] = this.6.butbp_do(signal[(6 % num) + 1]); - this.num > 7 ? this.outlist[8] = this.7.butbp_do(signal[(7 % num) + 1]); - this.num > 8 ? this.outlist[9] = this.8.butbp_do(signal[(8 % num) + 1]); - this.num > 9 ? this.outlist[10] = this.9.butbp_do(signal[(9 % num) + 1]); - this.num > 10 ? this.outlist[11] = this.10.butbp_do(signal[(10 % num) + 1]); - this.num > 11 ? this.outlist[12] = this.11.butbp_do(signal[(11 % num) + 1]); - this.num > 12 ? this.outlist[13] = this.12.butbp_do(signal[(12 % num) + 1]); - this.num > 13 ? this.outlist[14] = this.13.butbp_do(signal[(13 % num) + 1]); - this.num > 14 ? this.outlist[15] = this.14.butbp_do(signal[(14 % num) + 1]); - this.num > 15 ? this.outlist[16] = this.15.butbp_do(signal[(15 % num) + 1]); - this.num > 16 ? this.outlist[17] = this.16.butbp_do(signal[(16 % num) + 1]); - this.num > 17 ? this.outlist[18] = this.17.butbp_do(signal[(17 % num) + 1]); - this.num > 18 ? this.outlist[19] = this.18.butbp_do(signal[(18 % num) + 1]); - this.num > 19 ? this.outlist[20] = this.19.butbp_do(signal[(19 % num) + 1]); - this.num > 20 ? this.outlist[21] = this.20.butbp_do(signal[(20 % num) + 1]); - this.num > 21 ? this.outlist[22] = this.21.butbp_do(signal[(21 % num) + 1]); - this.num > 22 ? this.outlist[23] = this.22.butbp_do(signal[(22 % num) + 1]); - this.num > 23 ? this.outlist[24] = this.23.butbp_do(signal[(23 % num) + 1]); - this.num > 24 ? this.outlist[25] = this.24.butbp_do(signal[(24 % num) + 1]); - this.num > 25 ? this.outlist[26] = this.25.butbp_do(signal[(25 % num) + 1]); - this.num > 26 ? this.outlist[27] = this.26.butbp_do(signal[(26 % num) + 1]); - this.num > 27 ? this.outlist[28] = this.27.butbp_do(signal[(27 % num) + 1]); - this.num > 28 ? this.outlist[29] = this.28.butbp_do(signal[(28 % num) + 1]); - this.num > 29 ? this.outlist[30] = this.29.butbp_do(signal[(29 % num) + 1]); - this.num > 30 ? this.outlist[31] = this.30.butbp_do(signal[(30 % num) + 1]); - this.num > 31 ? this.outlist[32] = this.31.butbp_do(signal[(31 % num) + 1]); - this.num > 32 ? this.outlist[33] = this.32.butbp_do(signal[(32 % num) + 1]); - this.num > 33 ? this.outlist[34] = this.33.butbp_do(signal[(33 % num) + 1]); - this.num > 34 ? this.outlist[35] = this.34.butbp_do(signal[(34 % num) + 1]); - this.num > 35 ? this.outlist[36] = this.35.butbp_do(signal[(35 % num) + 1]); - this.num > 36 ? this.outlist[37] = this.36.butbp_do(signal[(36 % num) + 1]); - this.num > 37 ? this.outlist[38] = this.37.butbp_do(signal[(37 % num) + 1]); - this.num > 38 ? this.outlist[39] = this.38.butbp_do(signal[(38 % num) + 1]); - this.num > 39 ? this.outlist[40] = this.39.butbp_do(signal[(39 % num) + 1]); - this.outlist; -); - -function Pbutbr(lst1 lst2) -( - this.num = lst1[0]; - this.outlist = memalloc(this.num + 1); - this.outlist[0] = this.num; - this.num > 0 ? this.0.butbr(lst1[1], lst2[1]); - this.num > 1 ? this.1.butbr(lst1[2], lst2[2]); - this.num > 2 ? this.2.butbr(lst1[3], lst2[3]); - this.num > 3 ? this.3.butbr(lst1[4], lst2[4]); - this.num > 4 ? this.4.butbr(lst1[5], lst2[5]); - this.num > 5 ? this.5.butbr(lst1[6], lst2[6]); - this.num > 6 ? this.6.butbr(lst1[7], lst2[7]); - this.num > 7 ? this.7.butbr(lst1[8], lst2[8]); - this.num > 8 ? this.8.butbr(lst1[9], lst2[9]); - this.num > 9 ? this.9.butbr(lst1[10], lst2[10]); - this.num > 10 ? this.10.butbr(lst1[11], lst2[11]); - this.num > 11 ? this.11.butbr(lst1[12], lst2[12]); - this.num > 12 ? this.12.butbr(lst1[13], lst2[13]); - this.num > 13 ? this.13.butbr(lst1[14], lst2[14]); - this.num > 14 ? this.14.butbr(lst1[15], lst2[15]); - this.num > 15 ? this.15.butbr(lst1[16], lst2[16]); - this.num > 16 ? this.16.butbr(lst1[17], lst2[17]); - this.num > 17 ? this.17.butbr(lst1[18], lst2[18]); - this.num > 18 ? this.18.butbr(lst1[19], lst2[19]); - this.num > 19 ? this.19.butbr(lst1[20], lst2[20]); - this.num > 20 ? this.20.butbr(lst1[21], lst2[21]); - this.num > 21 ? this.21.butbr(lst1[22], lst2[22]); - this.num > 22 ? this.22.butbr(lst1[23], lst2[23]); - this.num > 23 ? this.23.butbr(lst1[24], lst2[24]); - this.num > 24 ? this.24.butbr(lst1[25], lst2[25]); - this.num > 25 ? this.25.butbr(lst1[26], lst2[26]); - this.num > 26 ? this.26.butbr(lst1[27], lst2[27]); - this.num > 27 ? this.27.butbr(lst1[28], lst2[28]); - this.num > 28 ? this.28.butbr(lst1[29], lst2[29]); - this.num > 29 ? this.29.butbr(lst1[30], lst2[30]); - this.num > 30 ? this.30.butbr(lst1[31], lst2[31]); - this.num > 31 ? this.31.butbr(lst1[32], lst2[32]); - this.num > 32 ? this.32.butbr(lst1[33], lst2[33]); - this.num > 33 ? this.33.butbr(lst1[34], lst2[34]); - this.num > 34 ? this.34.butbr(lst1[35], lst2[35]); - this.num > 35 ? this.35.butbr(lst1[36], lst2[36]); - this.num > 36 ? this.36.butbr(lst1[37], lst2[37]); - this.num > 37 ? this.37.butbr(lst1[38], lst2[38]); - this.num > 38 ? this.38.butbr(lst1[39], lst2[39]); - this.num > 39 ? this.39.butbr(lst1[40], lst2[40]); -); -function Pbutbr_set_freq(lst1) -( - this.num > 0 ? this.0.butbr_set_freq(lst1[1]); - this.num > 1 ? this.1.butbr_set_freq(lst1[2]); - this.num > 2 ? this.2.butbr_set_freq(lst1[3]); - this.num > 3 ? this.3.butbr_set_freq(lst1[4]); - this.num > 4 ? this.4.butbr_set_freq(lst1[5]); - this.num > 5 ? this.5.butbr_set_freq(lst1[6]); - this.num > 6 ? this.6.butbr_set_freq(lst1[7]); - this.num > 7 ? this.7.butbr_set_freq(lst1[8]); - this.num > 8 ? this.8.butbr_set_freq(lst1[9]); - this.num > 9 ? this.9.butbr_set_freq(lst1[10]); - this.num > 10 ? this.10.butbr_set_freq(lst1[11]); - this.num > 11 ? this.11.butbr_set_freq(lst1[12]); - this.num > 12 ? this.12.butbr_set_freq(lst1[13]); - this.num > 13 ? this.13.butbr_set_freq(lst1[14]); - this.num > 14 ? this.14.butbr_set_freq(lst1[15]); - this.num > 15 ? this.15.butbr_set_freq(lst1[16]); - this.num > 16 ? this.16.butbr_set_freq(lst1[17]); - this.num > 17 ? this.17.butbr_set_freq(lst1[18]); - this.num > 18 ? this.18.butbr_set_freq(lst1[19]); - this.num > 19 ? this.19.butbr_set_freq(lst1[20]); - this.num > 20 ? this.20.butbr_set_freq(lst1[21]); - this.num > 21 ? this.21.butbr_set_freq(lst1[22]); - this.num > 22 ? this.22.butbr_set_freq(lst1[23]); - this.num > 23 ? this.23.butbr_set_freq(lst1[24]); - this.num > 24 ? this.24.butbr_set_freq(lst1[25]); - this.num > 25 ? this.25.butbr_set_freq(lst1[26]); - this.num > 26 ? this.26.butbr_set_freq(lst1[27]); - this.num > 27 ? this.27.butbr_set_freq(lst1[28]); - this.num > 28 ? this.28.butbr_set_freq(lst1[29]); - this.num > 29 ? this.29.butbr_set_freq(lst1[30]); - this.num > 30 ? this.30.butbr_set_freq(lst1[31]); - this.num > 31 ? this.31.butbr_set_freq(lst1[32]); - this.num > 32 ? this.32.butbr_set_freq(lst1[33]); - this.num > 33 ? this.33.butbr_set_freq(lst1[34]); - this.num > 34 ? this.34.butbr_set_freq(lst1[35]); - this.num > 35 ? this.35.butbr_set_freq(lst1[36]); - this.num > 36 ? this.36.butbr_set_freq(lst1[37]); - this.num > 37 ? this.37.butbr_set_freq(lst1[38]); - this.num > 38 ? this.38.butbr_set_freq(lst1[39]); - this.num > 39 ? this.39.butbr_set_freq(lst1[40]); -); -function Pbutbr_set_q(lst1) -( - this.num > 0 ? this.0.butbr_set_q(lst1[1]); - this.num > 1 ? this.1.butbr_set_q(lst1[2]); - this.num > 2 ? this.2.butbr_set_q(lst1[3]); - this.num > 3 ? this.3.butbr_set_q(lst1[4]); - this.num > 4 ? this.4.butbr_set_q(lst1[5]); - this.num > 5 ? this.5.butbr_set_q(lst1[6]); - this.num > 6 ? this.6.butbr_set_q(lst1[7]); - this.num > 7 ? this.7.butbr_set_q(lst1[8]); - this.num > 8 ? this.8.butbr_set_q(lst1[9]); - this.num > 9 ? this.9.butbr_set_q(lst1[10]); - this.num > 10 ? this.10.butbr_set_q(lst1[11]); - this.num > 11 ? this.11.butbr_set_q(lst1[12]); - this.num > 12 ? this.12.butbr_set_q(lst1[13]); - this.num > 13 ? this.13.butbr_set_q(lst1[14]); - this.num > 14 ? this.14.butbr_set_q(lst1[15]); - this.num > 15 ? this.15.butbr_set_q(lst1[16]); - this.num > 16 ? this.16.butbr_set_q(lst1[17]); - this.num > 17 ? this.17.butbr_set_q(lst1[18]); - this.num > 18 ? this.18.butbr_set_q(lst1[19]); - this.num > 19 ? this.19.butbr_set_q(lst1[20]); - this.num > 20 ? this.20.butbr_set_q(lst1[21]); - this.num > 21 ? this.21.butbr_set_q(lst1[22]); - this.num > 22 ? this.22.butbr_set_q(lst1[23]); - this.num > 23 ? this.23.butbr_set_q(lst1[24]); - this.num > 24 ? this.24.butbr_set_q(lst1[25]); - this.num > 25 ? this.25.butbr_set_q(lst1[26]); - this.num > 26 ? this.26.butbr_set_q(lst1[27]); - this.num > 27 ? this.27.butbr_set_q(lst1[28]); - this.num > 28 ? this.28.butbr_set_q(lst1[29]); - this.num > 29 ? this.29.butbr_set_q(lst1[30]); - this.num > 30 ? this.30.butbr_set_q(lst1[31]); - this.num > 31 ? this.31.butbr_set_q(lst1[32]); - this.num > 32 ? this.32.butbr_set_q(lst1[33]); - this.num > 33 ? this.33.butbr_set_q(lst1[34]); - this.num > 34 ? this.34.butbr_set_q(lst1[35]); - this.num > 35 ? this.35.butbr_set_q(lst1[36]); - this.num > 36 ? this.36.butbr_set_q(lst1[37]); - this.num > 37 ? this.37.butbr_set_q(lst1[38]); - this.num > 38 ? this.38.butbr_set_q(lst1[39]); - this.num > 39 ? this.39.butbr_set_q(lst1[40]); -); -function Pbutbr_do(signal) -( - num = signal[0]; - this.num > 0 ? this.outlist[1] = this.0.butbr_do(signal[(0 % num) + 1]); - this.num > 1 ? this.outlist[2] = this.1.butbr_do(signal[(1 % num) + 1]); - this.num > 2 ? this.outlist[3] = this.2.butbr_do(signal[(2 % num) + 1]); - this.num > 3 ? this.outlist[4] = this.3.butbr_do(signal[(3 % num) + 1]); - this.num > 4 ? this.outlist[5] = this.4.butbr_do(signal[(4 % num) + 1]); - this.num > 5 ? this.outlist[6] = this.5.butbr_do(signal[(5 % num) + 1]); - this.num > 6 ? this.outlist[7] = this.6.butbr_do(signal[(6 % num) + 1]); - this.num > 7 ? this.outlist[8] = this.7.butbr_do(signal[(7 % num) + 1]); - this.num > 8 ? this.outlist[9] = this.8.butbr_do(signal[(8 % num) + 1]); - this.num > 9 ? this.outlist[10] = this.9.butbr_do(signal[(9 % num) + 1]); - this.num > 10 ? this.outlist[11] = this.10.butbr_do(signal[(10 % num) + 1]); - this.num > 11 ? this.outlist[12] = this.11.butbr_do(signal[(11 % num) + 1]); - this.num > 12 ? this.outlist[13] = this.12.butbr_do(signal[(12 % num) + 1]); - this.num > 13 ? this.outlist[14] = this.13.butbr_do(signal[(13 % num) + 1]); - this.num > 14 ? this.outlist[15] = this.14.butbr_do(signal[(14 % num) + 1]); - this.num > 15 ? this.outlist[16] = this.15.butbr_do(signal[(15 % num) + 1]); - this.num > 16 ? this.outlist[17] = this.16.butbr_do(signal[(16 % num) + 1]); - this.num > 17 ? this.outlist[18] = this.17.butbr_do(signal[(17 % num) + 1]); - this.num > 18 ? this.outlist[19] = this.18.butbr_do(signal[(18 % num) + 1]); - this.num > 19 ? this.outlist[20] = this.19.butbr_do(signal[(19 % num) + 1]); - this.num > 20 ? this.outlist[21] = this.20.butbr_do(signal[(20 % num) + 1]); - this.num > 21 ? this.outlist[22] = this.21.butbr_do(signal[(21 % num) + 1]); - this.num > 22 ? this.outlist[23] = this.22.butbr_do(signal[(22 % num) + 1]); - this.num > 23 ? this.outlist[24] = this.23.butbr_do(signal[(23 % num) + 1]); - this.num > 24 ? this.outlist[25] = this.24.butbr_do(signal[(24 % num) + 1]); - this.num > 25 ? this.outlist[26] = this.25.butbr_do(signal[(25 % num) + 1]); - this.num > 26 ? this.outlist[27] = this.26.butbr_do(signal[(26 % num) + 1]); - this.num > 27 ? this.outlist[28] = this.27.butbr_do(signal[(27 % num) + 1]); - this.num > 28 ? this.outlist[29] = this.28.butbr_do(signal[(28 % num) + 1]); - this.num > 29 ? this.outlist[30] = this.29.butbr_do(signal[(29 % num) + 1]); - this.num > 30 ? this.outlist[31] = this.30.butbr_do(signal[(30 % num) + 1]); - this.num > 31 ? this.outlist[32] = this.31.butbr_do(signal[(31 % num) + 1]); - this.num > 32 ? this.outlist[33] = this.32.butbr_do(signal[(32 % num) + 1]); - this.num > 33 ? this.outlist[34] = this.33.butbr_do(signal[(33 % num) + 1]); - this.num > 34 ? this.outlist[35] = this.34.butbr_do(signal[(34 % num) + 1]); - this.num > 35 ? this.outlist[36] = this.35.butbr_do(signal[(35 % num) + 1]); - this.num > 36 ? this.outlist[37] = this.36.butbr_do(signal[(36 % num) + 1]); - this.num > 37 ? this.outlist[38] = this.37.butbr_do(signal[(37 % num) + 1]); - this.num > 38 ? this.outlist[39] = this.38.butbr_do(signal[(38 % num) + 1]); - this.num > 39 ? this.outlist[40] = this.39.butbr_do(signal[(39 % num) + 1]); - this.outlist; -); - -function Papass(lst1 lst2 lst3) -( - this.num = lst1[0]; - this.outlist = memalloc(this.num + 1); - this.outlist[0] = this.num; - this.num > 0 ? this.0.apass(lst1[1], lst2[1], lst3[1]); - this.num > 1 ? this.1.apass(lst1[2], lst2[2], lst3[2]); - this.num > 2 ? this.2.apass(lst1[3], lst2[3], lst3[3]); - this.num > 3 ? this.3.apass(lst1[4], lst2[4], lst3[4]); - this.num > 4 ? this.4.apass(lst1[5], lst2[5], lst3[5]); - this.num > 5 ? this.5.apass(lst1[6], lst2[6], lst3[6]); - this.num > 6 ? this.6.apass(lst1[7], lst2[7], lst3[7]); - this.num > 7 ? this.7.apass(lst1[8], lst2[8], lst3[8]); - this.num > 8 ? this.8.apass(lst1[9], lst2[9], lst3[9]); - this.num > 9 ? this.9.apass(lst1[10], lst2[10], lst3[10]); - this.num > 10 ? this.10.apass(lst1[11], lst2[11], lst3[11]); - this.num > 11 ? this.11.apass(lst1[12], lst2[12], lst3[12]); - this.num > 12 ? this.12.apass(lst1[13], lst2[13], lst3[13]); - this.num > 13 ? this.13.apass(lst1[14], lst2[14], lst3[14]); - this.num > 14 ? this.14.apass(lst1[15], lst2[15], lst3[15]); - this.num > 15 ? this.15.apass(lst1[16], lst2[16], lst3[16]); - this.num > 16 ? this.16.apass(lst1[17], lst2[17], lst3[17]); - this.num > 17 ? this.17.apass(lst1[18], lst2[18], lst3[18]); - this.num > 18 ? this.18.apass(lst1[19], lst2[19], lst3[19]); - this.num > 19 ? this.19.apass(lst1[20], lst2[20], lst3[20]); - this.num > 20 ? this.20.apass(lst1[21], lst2[21], lst3[21]); - this.num > 21 ? this.21.apass(lst1[22], lst2[22], lst3[22]); - this.num > 22 ? this.22.apass(lst1[23], lst2[23], lst3[23]); - this.num > 23 ? this.23.apass(lst1[24], lst2[24], lst3[24]); - this.num > 24 ? this.24.apass(lst1[25], lst2[25], lst3[25]); - this.num > 25 ? this.25.apass(lst1[26], lst2[26], lst3[26]); - this.num > 26 ? this.26.apass(lst1[27], lst2[27], lst3[27]); - this.num > 27 ? this.27.apass(lst1[28], lst2[28], lst3[28]); - this.num > 28 ? this.28.apass(lst1[29], lst2[29], lst3[29]); - this.num > 29 ? this.29.apass(lst1[30], lst2[30], lst3[30]); - this.num > 30 ? this.30.apass(lst1[31], lst2[31], lst3[31]); - this.num > 31 ? this.31.apass(lst1[32], lst2[32], lst3[32]); - this.num > 32 ? this.32.apass(lst1[33], lst2[33], lst3[33]); - this.num > 33 ? this.33.apass(lst1[34], lst2[34], lst3[34]); - this.num > 34 ? this.34.apass(lst1[35], lst2[35], lst3[35]); - this.num > 35 ? this.35.apass(lst1[36], lst2[36], lst3[36]); - this.num > 36 ? this.36.apass(lst1[37], lst2[37], lst3[37]); - this.num > 37 ? this.37.apass(lst1[38], lst2[38], lst3[38]); - this.num > 38 ? this.38.apass(lst1[39], lst2[39], lst3[39]); - this.num > 39 ? this.39.apass(lst1[40], lst2[40], lst3[40]); -); -function Papass(lst1 lst2) -( - this.num > 0 ? this.0.apass(lst1[1], lst2[1]); - this.num > 1 ? this.1.apass(lst1[2], lst2[2]); - this.num > 2 ? this.2.apass(lst1[3], lst2[3]); - this.num > 3 ? this.3.apass(lst1[4], lst2[4]); - this.num > 4 ? this.4.apass(lst1[5], lst2[5]); - this.num > 5 ? this.5.apass(lst1[6], lst2[6]); - this.num > 6 ? this.6.apass(lst1[7], lst2[7]); - this.num > 7 ? this.7.apass(lst1[8], lst2[8]); - this.num > 8 ? this.8.apass(lst1[9], lst2[9]); - this.num > 9 ? this.9.apass(lst1[10], lst2[10]); - this.num > 10 ? this.10.apass(lst1[11], lst2[11]); - this.num > 11 ? this.11.apass(lst1[12], lst2[12]); - this.num > 12 ? this.12.apass(lst1[13], lst2[13]); - this.num > 13 ? this.13.apass(lst1[14], lst2[14]); - this.num > 14 ? this.14.apass(lst1[15], lst2[15]); - this.num > 15 ? this.15.apass(lst1[16], lst2[16]); - this.num > 16 ? this.16.apass(lst1[17], lst2[17]); - this.num > 17 ? this.17.apass(lst1[18], lst2[18]); - this.num > 18 ? this.18.apass(lst1[19], lst2[19]); - this.num > 19 ? this.19.apass(lst1[20], lst2[20]); - this.num > 20 ? this.20.apass(lst1[21], lst2[21]); - this.num > 21 ? this.21.apass(lst1[22], lst2[22]); - this.num > 22 ? this.22.apass(lst1[23], lst2[23]); - this.num > 23 ? this.23.apass(lst1[24], lst2[24]); - this.num > 24 ? this.24.apass(lst1[25], lst2[25]); - this.num > 25 ? this.25.apass(lst1[26], lst2[26]); - this.num > 26 ? this.26.apass(lst1[27], lst2[27]); - this.num > 27 ? this.27.apass(lst1[28], lst2[28]); - this.num > 28 ? this.28.apass(lst1[29], lst2[29]); - this.num > 29 ? this.29.apass(lst1[30], lst2[30]); - this.num > 30 ? this.30.apass(lst1[31], lst2[31]); - this.num > 31 ? this.31.apass(lst1[32], lst2[32]); - this.num > 32 ? this.32.apass(lst1[33], lst2[33]); - this.num > 33 ? this.33.apass(lst1[34], lst2[34]); - this.num > 34 ? this.34.apass(lst1[35], lst2[35]); - this.num > 35 ? this.35.apass(lst1[36], lst2[36]); - this.num > 36 ? this.36.apass(lst1[37], lst2[37]); - this.num > 37 ? this.37.apass(lst1[38], lst2[38]); - this.num > 38 ? this.38.apass(lst1[39], lst2[39]); - this.num > 39 ? this.39.apass(lst1[40], lst2[40]); -); -function Papass_set_freq(lst1) -( - this.num > 0 ? this.0.apass_set_freq(lst1[1]); - this.num > 1 ? this.1.apass_set_freq(lst1[2]); - this.num > 2 ? this.2.apass_set_freq(lst1[3]); - this.num > 3 ? this.3.apass_set_freq(lst1[4]); - this.num > 4 ? this.4.apass_set_freq(lst1[5]); - this.num > 5 ? this.5.apass_set_freq(lst1[6]); - this.num > 6 ? this.6.apass_set_freq(lst1[7]); - this.num > 7 ? this.7.apass_set_freq(lst1[8]); - this.num > 8 ? this.8.apass_set_freq(lst1[9]); - this.num > 9 ? this.9.apass_set_freq(lst1[10]); - this.num > 10 ? this.10.apass_set_freq(lst1[11]); - this.num > 11 ? this.11.apass_set_freq(lst1[12]); - this.num > 12 ? this.12.apass_set_freq(lst1[13]); - this.num > 13 ? this.13.apass_set_freq(lst1[14]); - this.num > 14 ? this.14.apass_set_freq(lst1[15]); - this.num > 15 ? this.15.apass_set_freq(lst1[16]); - this.num > 16 ? this.16.apass_set_freq(lst1[17]); - this.num > 17 ? this.17.apass_set_freq(lst1[18]); - this.num > 18 ? this.18.apass_set_freq(lst1[19]); - this.num > 19 ? this.19.apass_set_freq(lst1[20]); - this.num > 20 ? this.20.apass_set_freq(lst1[21]); - this.num > 21 ? this.21.apass_set_freq(lst1[22]); - this.num > 22 ? this.22.apass_set_freq(lst1[23]); - this.num > 23 ? this.23.apass_set_freq(lst1[24]); - this.num > 24 ? this.24.apass_set_freq(lst1[25]); - this.num > 25 ? this.25.apass_set_freq(lst1[26]); - this.num > 26 ? this.26.apass_set_freq(lst1[27]); - this.num > 27 ? this.27.apass_set_freq(lst1[28]); - this.num > 28 ? this.28.apass_set_freq(lst1[29]); - this.num > 29 ? this.29.apass_set_freq(lst1[30]); - this.num > 30 ? this.30.apass_set_freq(lst1[31]); - this.num > 31 ? this.31.apass_set_freq(lst1[32]); - this.num > 32 ? this.32.apass_set_freq(lst1[33]); - this.num > 33 ? this.33.apass_set_freq(lst1[34]); - this.num > 34 ? this.34.apass_set_freq(lst1[35]); - this.num > 35 ? this.35.apass_set_freq(lst1[36]); - this.num > 36 ? this.36.apass_set_freq(lst1[37]); - this.num > 37 ? this.37.apass_set_freq(lst1[38]); - this.num > 38 ? this.38.apass_set_freq(lst1[39]); - this.num > 39 ? this.39.apass_set_freq(lst1[40]); -); -function Papass_set_bw(lst1) -( - this.num > 0 ? this.0.apass_set_bw(lst1[1]); - this.num > 1 ? this.1.apass_set_bw(lst1[2]); - this.num > 2 ? this.2.apass_set_bw(lst1[3]); - this.num > 3 ? this.3.apass_set_bw(lst1[4]); - this.num > 4 ? this.4.apass_set_bw(lst1[5]); - this.num > 5 ? this.5.apass_set_bw(lst1[6]); - this.num > 6 ? this.6.apass_set_bw(lst1[7]); - this.num > 7 ? this.7.apass_set_bw(lst1[8]); - this.num > 8 ? this.8.apass_set_bw(lst1[9]); - this.num > 9 ? this.9.apass_set_bw(lst1[10]); - this.num > 10 ? this.10.apass_set_bw(lst1[11]); - this.num > 11 ? this.11.apass_set_bw(lst1[12]); - this.num > 12 ? this.12.apass_set_bw(lst1[13]); - this.num > 13 ? this.13.apass_set_bw(lst1[14]); - this.num > 14 ? this.14.apass_set_bw(lst1[15]); - this.num > 15 ? this.15.apass_set_bw(lst1[16]); - this.num > 16 ? this.16.apass_set_bw(lst1[17]); - this.num > 17 ? this.17.apass_set_bw(lst1[18]); - this.num > 18 ? this.18.apass_set_bw(lst1[19]); - this.num > 19 ? this.19.apass_set_bw(lst1[20]); - this.num > 20 ? this.20.apass_set_bw(lst1[21]); - this.num > 21 ? this.21.apass_set_bw(lst1[22]); - this.num > 22 ? this.22.apass_set_bw(lst1[23]); - this.num > 23 ? this.23.apass_set_bw(lst1[24]); - this.num > 24 ? this.24.apass_set_bw(lst1[25]); - this.num > 25 ? this.25.apass_set_bw(lst1[26]); - this.num > 26 ? this.26.apass_set_bw(lst1[27]); - this.num > 27 ? this.27.apass_set_bw(lst1[28]); - this.num > 28 ? this.28.apass_set_bw(lst1[29]); - this.num > 29 ? this.29.apass_set_bw(lst1[30]); - this.num > 30 ? this.30.apass_set_bw(lst1[31]); - this.num > 31 ? this.31.apass_set_bw(lst1[32]); - this.num > 32 ? this.32.apass_set_bw(lst1[33]); - this.num > 33 ? this.33.apass_set_bw(lst1[34]); - this.num > 34 ? this.34.apass_set_bw(lst1[35]); - this.num > 35 ? this.35.apass_set_bw(lst1[36]); - this.num > 36 ? this.36.apass_set_bw(lst1[37]); - this.num > 37 ? this.37.apass_set_bw(lst1[38]); - this.num > 38 ? this.38.apass_set_bw(lst1[39]); - this.num > 39 ? this.39.apass_set_bw(lst1[40]); -); -function Papass_set_feed(lst1) -( - this.num > 0 ? this.0.apass_set_feed(lst1[1]); - this.num > 1 ? this.1.apass_set_feed(lst1[2]); - this.num > 2 ? this.2.apass_set_feed(lst1[3]); - this.num > 3 ? this.3.apass_set_feed(lst1[4]); - this.num > 4 ? this.4.apass_set_feed(lst1[5]); - this.num > 5 ? this.5.apass_set_feed(lst1[6]); - this.num > 6 ? this.6.apass_set_feed(lst1[7]); - this.num > 7 ? this.7.apass_set_feed(lst1[8]); - this.num > 8 ? this.8.apass_set_feed(lst1[9]); - this.num > 9 ? this.9.apass_set_feed(lst1[10]); - this.num > 10 ? this.10.apass_set_feed(lst1[11]); - this.num > 11 ? this.11.apass_set_feed(lst1[12]); - this.num > 12 ? this.12.apass_set_feed(lst1[13]); - this.num > 13 ? this.13.apass_set_feed(lst1[14]); - this.num > 14 ? this.14.apass_set_feed(lst1[15]); - this.num > 15 ? this.15.apass_set_feed(lst1[16]); - this.num > 16 ? this.16.apass_set_feed(lst1[17]); - this.num > 17 ? this.17.apass_set_feed(lst1[18]); - this.num > 18 ? this.18.apass_set_feed(lst1[19]); - this.num > 19 ? this.19.apass_set_feed(lst1[20]); - this.num > 20 ? this.20.apass_set_feed(lst1[21]); - this.num > 21 ? this.21.apass_set_feed(lst1[22]); - this.num > 22 ? this.22.apass_set_feed(lst1[23]); - this.num > 23 ? this.23.apass_set_feed(lst1[24]); - this.num > 24 ? this.24.apass_set_feed(lst1[25]); - this.num > 25 ? this.25.apass_set_feed(lst1[26]); - this.num > 26 ? this.26.apass_set_feed(lst1[27]); - this.num > 27 ? this.27.apass_set_feed(lst1[28]); - this.num > 28 ? this.28.apass_set_feed(lst1[29]); - this.num > 29 ? this.29.apass_set_feed(lst1[30]); - this.num > 30 ? this.30.apass_set_feed(lst1[31]); - this.num > 31 ? this.31.apass_set_feed(lst1[32]); - this.num > 32 ? this.32.apass_set_feed(lst1[33]); - this.num > 33 ? this.33.apass_set_feed(lst1[34]); - this.num > 34 ? this.34.apass_set_feed(lst1[35]); - this.num > 35 ? this.35.apass_set_feed(lst1[36]); - this.num > 36 ? this.36.apass_set_feed(lst1[37]); - this.num > 37 ? this.37.apass_set_feed(lst1[38]); - this.num > 38 ? this.38.apass_set_feed(lst1[39]); - this.num > 39 ? this.39.apass_set_feed(lst1[40]); -); -function Papass_do(signal) -( - num = signal[0]; - this.num > 0 ? this.outlist[1] = this.0.apass_do(signal[(0 % num) + 1]); - this.num > 1 ? this.outlist[2] = this.1.apass_do(signal[(1 % num) + 1]); - this.num > 2 ? this.outlist[3] = this.2.apass_do(signal[(2 % num) + 1]); - this.num > 3 ? this.outlist[4] = this.3.apass_do(signal[(3 % num) + 1]); - this.num > 4 ? this.outlist[5] = this.4.apass_do(signal[(4 % num) + 1]); - this.num > 5 ? this.outlist[6] = this.5.apass_do(signal[(5 % num) + 1]); - this.num > 6 ? this.outlist[7] = this.6.apass_do(signal[(6 % num) + 1]); - this.num > 7 ? this.outlist[8] = this.7.apass_do(signal[(7 % num) + 1]); - this.num > 8 ? this.outlist[9] = this.8.apass_do(signal[(8 % num) + 1]); - this.num > 9 ? this.outlist[10] = this.9.apass_do(signal[(9 % num) + 1]); - this.num > 10 ? this.outlist[11] = this.10.apass_do(signal[(10 % num) + 1]); - this.num > 11 ? this.outlist[12] = this.11.apass_do(signal[(11 % num) + 1]); - this.num > 12 ? this.outlist[13] = this.12.apass_do(signal[(12 % num) + 1]); - this.num > 13 ? this.outlist[14] = this.13.apass_do(signal[(13 % num) + 1]); - this.num > 14 ? this.outlist[15] = this.14.apass_do(signal[(14 % num) + 1]); - this.num > 15 ? this.outlist[16] = this.15.apass_do(signal[(15 % num) + 1]); - this.num > 16 ? this.outlist[17] = this.16.apass_do(signal[(16 % num) + 1]); - this.num > 17 ? this.outlist[18] = this.17.apass_do(signal[(17 % num) + 1]); - this.num > 18 ? this.outlist[19] = this.18.apass_do(signal[(18 % num) + 1]); - this.num > 19 ? this.outlist[20] = this.19.apass_do(signal[(19 % num) + 1]); - this.num > 20 ? this.outlist[21] = this.20.apass_do(signal[(20 % num) + 1]); - this.num > 21 ? this.outlist[22] = this.21.apass_do(signal[(21 % num) + 1]); - this.num > 22 ? this.outlist[23] = this.22.apass_do(signal[(22 % num) + 1]); - this.num > 23 ? this.outlist[24] = this.23.apass_do(signal[(23 % num) + 1]); - this.num > 24 ? this.outlist[25] = this.24.apass_do(signal[(24 % num) + 1]); - this.num > 25 ? this.outlist[26] = this.25.apass_do(signal[(25 % num) + 1]); - this.num > 26 ? this.outlist[27] = this.26.apass_do(signal[(26 % num) + 1]); - this.num > 27 ? this.outlist[28] = this.27.apass_do(signal[(27 % num) + 1]); - this.num > 28 ? this.outlist[29] = this.28.apass_do(signal[(28 % num) + 1]); - this.num > 29 ? this.outlist[30] = this.29.apass_do(signal[(29 % num) + 1]); - this.num > 30 ? this.outlist[31] = this.30.apass_do(signal[(30 % num) + 1]); - this.num > 31 ? this.outlist[32] = this.31.apass_do(signal[(31 % num) + 1]); - this.num > 32 ? this.outlist[33] = this.32.apass_do(signal[(32 % num) + 1]); - this.num > 33 ? this.outlist[34] = this.33.apass_do(signal[(33 % num) + 1]); - this.num > 34 ? this.outlist[35] = this.34.apass_do(signal[(34 % num) + 1]); - this.num > 35 ? this.outlist[36] = this.35.apass_do(signal[(35 % num) + 1]); - this.num > 36 ? this.outlist[37] = this.36.apass_do(signal[(36 % num) + 1]); - this.num > 37 ? this.outlist[38] = this.37.apass_do(signal[(37 % num) + 1]); - this.num > 38 ? this.outlist[39] = this.38.apass_do(signal[(38 % num) + 1]); - this.num > 39 ? this.outlist[40] = this.39.apass_do(signal[(39 % num) + 1]); - this.outlist; -); - -function Pbiquad(lst1 lst2 lst3) -( - this.num = lst1[0]; - this.outlist = memalloc(this.num + 1); - this.outlist[0] = this.num; - this.num > 0 ? this.0.biquad(lst1[1], lst2[1], lst3[1]); - this.num > 1 ? this.1.biquad(lst1[2], lst2[2], lst3[2]); - this.num > 2 ? this.2.biquad(lst1[3], lst2[3], lst3[3]); - this.num > 3 ? this.3.biquad(lst1[4], lst2[4], lst3[4]); - this.num > 4 ? this.4.biquad(lst1[5], lst2[5], lst3[5]); - this.num > 5 ? this.5.biquad(lst1[6], lst2[6], lst3[6]); - this.num > 6 ? this.6.biquad(lst1[7], lst2[7], lst3[7]); - this.num > 7 ? this.7.biquad(lst1[8], lst2[8], lst3[8]); - this.num > 8 ? this.8.biquad(lst1[9], lst2[9], lst3[9]); - this.num > 9 ? this.9.biquad(lst1[10], lst2[10], lst3[10]); - this.num > 10 ? this.10.biquad(lst1[11], lst2[11], lst3[11]); - this.num > 11 ? this.11.biquad(lst1[12], lst2[12], lst3[12]); - this.num > 12 ? this.12.biquad(lst1[13], lst2[13], lst3[13]); - this.num > 13 ? this.13.biquad(lst1[14], lst2[14], lst3[14]); - this.num > 14 ? this.14.biquad(lst1[15], lst2[15], lst3[15]); - this.num > 15 ? this.15.biquad(lst1[16], lst2[16], lst3[16]); - this.num > 16 ? this.16.biquad(lst1[17], lst2[17], lst3[17]); - this.num > 17 ? this.17.biquad(lst1[18], lst2[18], lst3[18]); - this.num > 18 ? this.18.biquad(lst1[19], lst2[19], lst3[19]); - this.num > 19 ? this.19.biquad(lst1[20], lst2[20], lst3[20]); - this.num > 20 ? this.20.biquad(lst1[21], lst2[21], lst3[21]); - this.num > 21 ? this.21.biquad(lst1[22], lst2[22], lst3[22]); - this.num > 22 ? this.22.biquad(lst1[23], lst2[23], lst3[23]); - this.num > 23 ? this.23.biquad(lst1[24], lst2[24], lst3[24]); - this.num > 24 ? this.24.biquad(lst1[25], lst2[25], lst3[25]); - this.num > 25 ? this.25.biquad(lst1[26], lst2[26], lst3[26]); - this.num > 26 ? this.26.biquad(lst1[27], lst2[27], lst3[27]); - this.num > 27 ? this.27.biquad(lst1[28], lst2[28], lst3[28]); - this.num > 28 ? this.28.biquad(lst1[29], lst2[29], lst3[29]); - this.num > 29 ? this.29.biquad(lst1[30], lst2[30], lst3[30]); - this.num > 30 ? this.30.biquad(lst1[31], lst2[31], lst3[31]); - this.num > 31 ? this.31.biquad(lst1[32], lst2[32], lst3[32]); - this.num > 32 ? this.32.biquad(lst1[33], lst2[33], lst3[33]); - this.num > 33 ? this.33.biquad(lst1[34], lst2[34], lst3[34]); - this.num > 34 ? this.34.biquad(lst1[35], lst2[35], lst3[35]); - this.num > 35 ? this.35.biquad(lst1[36], lst2[36], lst3[36]); - this.num > 36 ? this.36.biquad(lst1[37], lst2[37], lst3[37]); - this.num > 37 ? this.37.biquad(lst1[38], lst2[38], lst3[38]); - this.num > 38 ? this.38.biquad(lst1[39], lst2[39], lst3[39]); - this.num > 39 ? this.39.biquad(lst1[40], lst2[40], lst3[40]); -); -function Pbiquad_set_freq(lst1) -( - this.num > 0 ? this.0.biquad_set_freq(lst1[1]); - this.num > 1 ? this.1.biquad_set_freq(lst1[2]); - this.num > 2 ? this.2.biquad_set_freq(lst1[3]); - this.num > 3 ? this.3.biquad_set_freq(lst1[4]); - this.num > 4 ? this.4.biquad_set_freq(lst1[5]); - this.num > 5 ? this.5.biquad_set_freq(lst1[6]); - this.num > 6 ? this.6.biquad_set_freq(lst1[7]); - this.num > 7 ? this.7.biquad_set_freq(lst1[8]); - this.num > 8 ? this.8.biquad_set_freq(lst1[9]); - this.num > 9 ? this.9.biquad_set_freq(lst1[10]); - this.num > 10 ? this.10.biquad_set_freq(lst1[11]); - this.num > 11 ? this.11.biquad_set_freq(lst1[12]); - this.num > 12 ? this.12.biquad_set_freq(lst1[13]); - this.num > 13 ? this.13.biquad_set_freq(lst1[14]); - this.num > 14 ? this.14.biquad_set_freq(lst1[15]); - this.num > 15 ? this.15.biquad_set_freq(lst1[16]); - this.num > 16 ? this.16.biquad_set_freq(lst1[17]); - this.num > 17 ? this.17.biquad_set_freq(lst1[18]); - this.num > 18 ? this.18.biquad_set_freq(lst1[19]); - this.num > 19 ? this.19.biquad_set_freq(lst1[20]); - this.num > 20 ? this.20.biquad_set_freq(lst1[21]); - this.num > 21 ? this.21.biquad_set_freq(lst1[22]); - this.num > 22 ? this.22.biquad_set_freq(lst1[23]); - this.num > 23 ? this.23.biquad_set_freq(lst1[24]); - this.num > 24 ? this.24.biquad_set_freq(lst1[25]); - this.num > 25 ? this.25.biquad_set_freq(lst1[26]); - this.num > 26 ? this.26.biquad_set_freq(lst1[27]); - this.num > 27 ? this.27.biquad_set_freq(lst1[28]); - this.num > 28 ? this.28.biquad_set_freq(lst1[29]); - this.num > 29 ? this.29.biquad_set_freq(lst1[30]); - this.num > 30 ? this.30.biquad_set_freq(lst1[31]); - this.num > 31 ? this.31.biquad_set_freq(lst1[32]); - this.num > 32 ? this.32.biquad_set_freq(lst1[33]); - this.num > 33 ? this.33.biquad_set_freq(lst1[34]); - this.num > 34 ? this.34.biquad_set_freq(lst1[35]); - this.num > 35 ? this.35.biquad_set_freq(lst1[36]); - this.num > 36 ? this.36.biquad_set_freq(lst1[37]); - this.num > 37 ? this.37.biquad_set_freq(lst1[38]); - this.num > 38 ? this.38.biquad_set_freq(lst1[39]); - this.num > 39 ? this.39.biquad_set_freq(lst1[40]); -); -function Pbiquad_set_q(lst1) -( - this.num > 0 ? this.0.biquad_set_q(lst1[1]); - this.num > 1 ? this.1.biquad_set_q(lst1[2]); - this.num > 2 ? this.2.biquad_set_q(lst1[3]); - this.num > 3 ? this.3.biquad_set_q(lst1[4]); - this.num > 4 ? this.4.biquad_set_q(lst1[5]); - this.num > 5 ? this.5.biquad_set_q(lst1[6]); - this.num > 6 ? this.6.biquad_set_q(lst1[7]); - this.num > 7 ? this.7.biquad_set_q(lst1[8]); - this.num > 8 ? this.8.biquad_set_q(lst1[9]); - this.num > 9 ? this.9.biquad_set_q(lst1[10]); - this.num > 10 ? this.10.biquad_set_q(lst1[11]); - this.num > 11 ? this.11.biquad_set_q(lst1[12]); - this.num > 12 ? this.12.biquad_set_q(lst1[13]); - this.num > 13 ? this.13.biquad_set_q(lst1[14]); - this.num > 14 ? this.14.biquad_set_q(lst1[15]); - this.num > 15 ? this.15.biquad_set_q(lst1[16]); - this.num > 16 ? this.16.biquad_set_q(lst1[17]); - this.num > 17 ? this.17.biquad_set_q(lst1[18]); - this.num > 18 ? this.18.biquad_set_q(lst1[19]); - this.num > 19 ? this.19.biquad_set_q(lst1[20]); - this.num > 20 ? this.20.biquad_set_q(lst1[21]); - this.num > 21 ? this.21.biquad_set_q(lst1[22]); - this.num > 22 ? this.22.biquad_set_q(lst1[23]); - this.num > 23 ? this.23.biquad_set_q(lst1[24]); - this.num > 24 ? this.24.biquad_set_q(lst1[25]); - this.num > 25 ? this.25.biquad_set_q(lst1[26]); - this.num > 26 ? this.26.biquad_set_q(lst1[27]); - this.num > 27 ? this.27.biquad_set_q(lst1[28]); - this.num > 28 ? this.28.biquad_set_q(lst1[29]); - this.num > 29 ? this.29.biquad_set_q(lst1[30]); - this.num > 30 ? this.30.biquad_set_q(lst1[31]); - this.num > 31 ? this.31.biquad_set_q(lst1[32]); - this.num > 32 ? this.32.biquad_set_q(lst1[33]); - this.num > 33 ? this.33.biquad_set_q(lst1[34]); - this.num > 34 ? this.34.biquad_set_q(lst1[35]); - this.num > 35 ? this.35.biquad_set_q(lst1[36]); - this.num > 36 ? this.36.biquad_set_q(lst1[37]); - this.num > 37 ? this.37.biquad_set_q(lst1[38]); - this.num > 38 ? this.38.biquad_set_q(lst1[39]); - this.num > 39 ? this.39.biquad_set_q(lst1[40]); -); -function Pbiquad_set_type(lst1) -( - this.num > 0 ? this.0.biquad_set_type(lst1[1]); - this.num > 1 ? this.1.biquad_set_type(lst1[2]); - this.num > 2 ? this.2.biquad_set_type(lst1[3]); - this.num > 3 ? this.3.biquad_set_type(lst1[4]); - this.num > 4 ? this.4.biquad_set_type(lst1[5]); - this.num > 5 ? this.5.biquad_set_type(lst1[6]); - this.num > 6 ? this.6.biquad_set_type(lst1[7]); - this.num > 7 ? this.7.biquad_set_type(lst1[8]); - this.num > 8 ? this.8.biquad_set_type(lst1[9]); - this.num > 9 ? this.9.biquad_set_type(lst1[10]); - this.num > 10 ? this.10.biquad_set_type(lst1[11]); - this.num > 11 ? this.11.biquad_set_type(lst1[12]); - this.num > 12 ? this.12.biquad_set_type(lst1[13]); - this.num > 13 ? this.13.biquad_set_type(lst1[14]); - this.num > 14 ? this.14.biquad_set_type(lst1[15]); - this.num > 15 ? this.15.biquad_set_type(lst1[16]); - this.num > 16 ? this.16.biquad_set_type(lst1[17]); - this.num > 17 ? this.17.biquad_set_type(lst1[18]); - this.num > 18 ? this.18.biquad_set_type(lst1[19]); - this.num > 19 ? this.19.biquad_set_type(lst1[20]); - this.num > 20 ? this.20.biquad_set_type(lst1[21]); - this.num > 21 ? this.21.biquad_set_type(lst1[22]); - this.num > 22 ? this.22.biquad_set_type(lst1[23]); - this.num > 23 ? this.23.biquad_set_type(lst1[24]); - this.num > 24 ? this.24.biquad_set_type(lst1[25]); - this.num > 25 ? this.25.biquad_set_type(lst1[26]); - this.num > 26 ? this.26.biquad_set_type(lst1[27]); - this.num > 27 ? this.27.biquad_set_type(lst1[28]); - this.num > 28 ? this.28.biquad_set_type(lst1[29]); - this.num > 29 ? this.29.biquad_set_type(lst1[30]); - this.num > 30 ? this.30.biquad_set_type(lst1[31]); - this.num > 31 ? this.31.biquad_set_type(lst1[32]); - this.num > 32 ? this.32.biquad_set_type(lst1[33]); - this.num > 33 ? this.33.biquad_set_type(lst1[34]); - this.num > 34 ? this.34.biquad_set_type(lst1[35]); - this.num > 35 ? this.35.biquad_set_type(lst1[36]); - this.num > 36 ? this.36.biquad_set_type(lst1[37]); - this.num > 37 ? this.37.biquad_set_type(lst1[38]); - this.num > 38 ? this.38.biquad_set_type(lst1[39]); - this.num > 39 ? this.39.biquad_set_type(lst1[40]); -); -function Pbiquad_do(signal) -( - num = signal[0]; - this.num > 0 ? this.outlist[1] = this.0.biquad_do(signal[(0 % num) + 1]); - this.num > 1 ? this.outlist[2] = this.1.biquad_do(signal[(1 % num) + 1]); - this.num > 2 ? this.outlist[3] = this.2.biquad_do(signal[(2 % num) + 1]); - this.num > 3 ? this.outlist[4] = this.3.biquad_do(signal[(3 % num) + 1]); - this.num > 4 ? this.outlist[5] = this.4.biquad_do(signal[(4 % num) + 1]); - this.num > 5 ? this.outlist[6] = this.5.biquad_do(signal[(5 % num) + 1]); - this.num > 6 ? this.outlist[7] = this.6.biquad_do(signal[(6 % num) + 1]); - this.num > 7 ? this.outlist[8] = this.7.biquad_do(signal[(7 % num) + 1]); - this.num > 8 ? this.outlist[9] = this.8.biquad_do(signal[(8 % num) + 1]); - this.num > 9 ? this.outlist[10] = this.9.biquad_do(signal[(9 % num) + 1]); - this.num > 10 ? this.outlist[11] = this.10.biquad_do(signal[(10 % num) + 1]); - this.num > 11 ? this.outlist[12] = this.11.biquad_do(signal[(11 % num) + 1]); - this.num > 12 ? this.outlist[13] = this.12.biquad_do(signal[(12 % num) + 1]); - this.num > 13 ? this.outlist[14] = this.13.biquad_do(signal[(13 % num) + 1]); - this.num > 14 ? this.outlist[15] = this.14.biquad_do(signal[(14 % num) + 1]); - this.num > 15 ? this.outlist[16] = this.15.biquad_do(signal[(15 % num) + 1]); - this.num > 16 ? this.outlist[17] = this.16.biquad_do(signal[(16 % num) + 1]); - this.num > 17 ? this.outlist[18] = this.17.biquad_do(signal[(17 % num) + 1]); - this.num > 18 ? this.outlist[19] = this.18.biquad_do(signal[(18 % num) + 1]); - this.num > 19 ? this.outlist[20] = this.19.biquad_do(signal[(19 % num) + 1]); - this.num > 20 ? this.outlist[21] = this.20.biquad_do(signal[(20 % num) + 1]); - this.num > 21 ? this.outlist[22] = this.21.biquad_do(signal[(21 % num) + 1]); - this.num > 22 ? this.outlist[23] = this.22.biquad_do(signal[(22 % num) + 1]); - this.num > 23 ? this.outlist[24] = this.23.biquad_do(signal[(23 % num) + 1]); - this.num > 24 ? this.outlist[25] = this.24.biquad_do(signal[(24 % num) + 1]); - this.num > 25 ? this.outlist[26] = this.25.biquad_do(signal[(25 % num) + 1]); - this.num > 26 ? this.outlist[27] = this.26.biquad_do(signal[(26 % num) + 1]); - this.num > 27 ? this.outlist[28] = this.27.biquad_do(signal[(27 % num) + 1]); - this.num > 28 ? this.outlist[29] = this.28.biquad_do(signal[(28 % num) + 1]); - this.num > 29 ? this.outlist[30] = this.29.biquad_do(signal[(29 % num) + 1]); - this.num > 30 ? this.outlist[31] = this.30.biquad_do(signal[(30 % num) + 1]); - this.num > 31 ? this.outlist[32] = this.31.biquad_do(signal[(31 % num) + 1]); - this.num > 32 ? this.outlist[33] = this.32.biquad_do(signal[(32 % num) + 1]); - this.num > 33 ? this.outlist[34] = this.33.biquad_do(signal[(33 % num) + 1]); - this.num > 34 ? this.outlist[35] = this.34.biquad_do(signal[(34 % num) + 1]); - this.num > 35 ? this.outlist[36] = this.35.biquad_do(signal[(35 % num) + 1]); - this.num > 36 ? this.outlist[37] = this.36.biquad_do(signal[(36 % num) + 1]); - this.num > 37 ? this.outlist[38] = this.37.biquad_do(signal[(37 % num) + 1]); - this.num > 38 ? this.outlist[39] = this.38.biquad_do(signal[(38 % num) + 1]); - this.num > 39 ? this.outlist[40] = this.39.biquad_do(signal[(39 % num) + 1]); - this.outlist; -); - -function Pfollow(lst1) -( - this.num = lst1[0]; - this.outlist = memalloc(this.num + 1); - this.outlist[0] = this.num; - this.num > 0 ? this.0.follow(lst1[1]); - this.num > 1 ? this.1.follow(lst1[2]); - this.num > 2 ? this.2.follow(lst1[3]); - this.num > 3 ? this.3.follow(lst1[4]); - this.num > 4 ? this.4.follow(lst1[5]); - this.num > 5 ? this.5.follow(lst1[6]); - this.num > 6 ? this.6.follow(lst1[7]); - this.num > 7 ? this.7.follow(lst1[8]); - this.num > 8 ? this.8.follow(lst1[9]); - this.num > 9 ? this.9.follow(lst1[10]); - this.num > 10 ? this.10.follow(lst1[11]); - this.num > 11 ? this.11.follow(lst1[12]); - this.num > 12 ? this.12.follow(lst1[13]); - this.num > 13 ? this.13.follow(lst1[14]); - this.num > 14 ? this.14.follow(lst1[15]); - this.num > 15 ? this.15.follow(lst1[16]); - this.num > 16 ? this.16.follow(lst1[17]); - this.num > 17 ? this.17.follow(lst1[18]); - this.num > 18 ? this.18.follow(lst1[19]); - this.num > 19 ? this.19.follow(lst1[20]); - this.num > 20 ? this.20.follow(lst1[21]); - this.num > 21 ? this.21.follow(lst1[22]); - this.num > 22 ? this.22.follow(lst1[23]); - this.num > 23 ? this.23.follow(lst1[24]); - this.num > 24 ? this.24.follow(lst1[25]); - this.num > 25 ? this.25.follow(lst1[26]); - this.num > 26 ? this.26.follow(lst1[27]); - this.num > 27 ? this.27.follow(lst1[28]); - this.num > 28 ? this.28.follow(lst1[29]); - this.num > 29 ? this.29.follow(lst1[30]); - this.num > 30 ? this.30.follow(lst1[31]); - this.num > 31 ? this.31.follow(lst1[32]); - this.num > 32 ? this.32.follow(lst1[33]); - this.num > 33 ? this.33.follow(lst1[34]); - this.num > 34 ? this.34.follow(lst1[35]); - this.num > 35 ? this.35.follow(lst1[36]); - this.num > 36 ? this.36.follow(lst1[37]); - this.num > 37 ? this.37.follow(lst1[38]); - this.num > 38 ? this.38.follow(lst1[39]); - this.num > 39 ? this.39.follow(lst1[40]); -); -function Pfollow_set_freq(lst1) -( - this.num > 0 ? this.0.follow_set_freq(lst1[1]); - this.num > 1 ? this.1.follow_set_freq(lst1[2]); - this.num > 2 ? this.2.follow_set_freq(lst1[3]); - this.num > 3 ? this.3.follow_set_freq(lst1[4]); - this.num > 4 ? this.4.follow_set_freq(lst1[5]); - this.num > 5 ? this.5.follow_set_freq(lst1[6]); - this.num > 6 ? this.6.follow_set_freq(lst1[7]); - this.num > 7 ? this.7.follow_set_freq(lst1[8]); - this.num > 8 ? this.8.follow_set_freq(lst1[9]); - this.num > 9 ? this.9.follow_set_freq(lst1[10]); - this.num > 10 ? this.10.follow_set_freq(lst1[11]); - this.num > 11 ? this.11.follow_set_freq(lst1[12]); - this.num > 12 ? this.12.follow_set_freq(lst1[13]); - this.num > 13 ? this.13.follow_set_freq(lst1[14]); - this.num > 14 ? this.14.follow_set_freq(lst1[15]); - this.num > 15 ? this.15.follow_set_freq(lst1[16]); - this.num > 16 ? this.16.follow_set_freq(lst1[17]); - this.num > 17 ? this.17.follow_set_freq(lst1[18]); - this.num > 18 ? this.18.follow_set_freq(lst1[19]); - this.num > 19 ? this.19.follow_set_freq(lst1[20]); - this.num > 20 ? this.20.follow_set_freq(lst1[21]); - this.num > 21 ? this.21.follow_set_freq(lst1[22]); - this.num > 22 ? this.22.follow_set_freq(lst1[23]); - this.num > 23 ? this.23.follow_set_freq(lst1[24]); - this.num > 24 ? this.24.follow_set_freq(lst1[25]); - this.num > 25 ? this.25.follow_set_freq(lst1[26]); - this.num > 26 ? this.26.follow_set_freq(lst1[27]); - this.num > 27 ? this.27.follow_set_freq(lst1[28]); - this.num > 28 ? this.28.follow_set_freq(lst1[29]); - this.num > 29 ? this.29.follow_set_freq(lst1[30]); - this.num > 30 ? this.30.follow_set_freq(lst1[31]); - this.num > 31 ? this.31.follow_set_freq(lst1[32]); - this.num > 32 ? this.32.follow_set_freq(lst1[33]); - this.num > 33 ? this.33.follow_set_freq(lst1[34]); - this.num > 34 ? this.34.follow_set_freq(lst1[35]); - this.num > 35 ? this.35.follow_set_freq(lst1[36]); - this.num > 36 ? this.36.follow_set_freq(lst1[37]); - this.num > 37 ? this.37.follow_set_freq(lst1[38]); - this.num > 38 ? this.38.follow_set_freq(lst1[39]); - this.num > 39 ? this.39.follow_set_freq(lst1[40]); -); -function Pfollow_do(signal) -( - num = signal[0]; - this.num > 0 ? this.outlist[1] = this.0.follow_do(signal[(0 % num) + 1]); - this.num > 1 ? this.outlist[2] = this.1.follow_do(signal[(1 % num) + 1]); - this.num > 2 ? this.outlist[3] = this.2.follow_do(signal[(2 % num) + 1]); - this.num > 3 ? this.outlist[4] = this.3.follow_do(signal[(3 % num) + 1]); - this.num > 4 ? this.outlist[5] = this.4.follow_do(signal[(4 % num) + 1]); - this.num > 5 ? this.outlist[6] = this.5.follow_do(signal[(5 % num) + 1]); - this.num > 6 ? this.outlist[7] = this.6.follow_do(signal[(6 % num) + 1]); - this.num > 7 ? this.outlist[8] = this.7.follow_do(signal[(7 % num) + 1]); - this.num > 8 ? this.outlist[9] = this.8.follow_do(signal[(8 % num) + 1]); - this.num > 9 ? this.outlist[10] = this.9.follow_do(signal[(9 % num) + 1]); - this.num > 10 ? this.outlist[11] = this.10.follow_do(signal[(10 % num) + 1]); - this.num > 11 ? this.outlist[12] = this.11.follow_do(signal[(11 % num) + 1]); - this.num > 12 ? this.outlist[13] = this.12.follow_do(signal[(12 % num) + 1]); - this.num > 13 ? this.outlist[14] = this.13.follow_do(signal[(13 % num) + 1]); - this.num > 14 ? this.outlist[15] = this.14.follow_do(signal[(14 % num) + 1]); - this.num > 15 ? this.outlist[16] = this.15.follow_do(signal[(15 % num) + 1]); - this.num > 16 ? this.outlist[17] = this.16.follow_do(signal[(16 % num) + 1]); - this.num > 17 ? this.outlist[18] = this.17.follow_do(signal[(17 % num) + 1]); - this.num > 18 ? this.outlist[19] = this.18.follow_do(signal[(18 % num) + 1]); - this.num > 19 ? this.outlist[20] = this.19.follow_do(signal[(19 % num) + 1]); - this.num > 20 ? this.outlist[21] = this.20.follow_do(signal[(20 % num) + 1]); - this.num > 21 ? this.outlist[22] = this.21.follow_do(signal[(21 % num) + 1]); - this.num > 22 ? this.outlist[23] = this.22.follow_do(signal[(22 % num) + 1]); - this.num > 23 ? this.outlist[24] = this.23.follow_do(signal[(23 % num) + 1]); - this.num > 24 ? this.outlist[25] = this.24.follow_do(signal[(24 % num) + 1]); - this.num > 25 ? this.outlist[26] = this.25.follow_do(signal[(25 % num) + 1]); - this.num > 26 ? this.outlist[27] = this.26.follow_do(signal[(26 % num) + 1]); - this.num > 27 ? this.outlist[28] = this.27.follow_do(signal[(27 % num) + 1]); - this.num > 28 ? this.outlist[29] = this.28.follow_do(signal[(28 % num) + 1]); - this.num > 29 ? this.outlist[30] = this.29.follow_do(signal[(29 % num) + 1]); - this.num > 30 ? this.outlist[31] = this.30.follow_do(signal[(30 % num) + 1]); - this.num > 31 ? this.outlist[32] = this.31.follow_do(signal[(31 % num) + 1]); - this.num > 32 ? this.outlist[33] = this.32.follow_do(signal[(32 % num) + 1]); - this.num > 33 ? this.outlist[34] = this.33.follow_do(signal[(33 % num) + 1]); - this.num > 34 ? this.outlist[35] = this.34.follow_do(signal[(34 % num) + 1]); - this.num > 35 ? this.outlist[36] = this.35.follow_do(signal[(35 % num) + 1]); - this.num > 36 ? this.outlist[37] = this.36.follow_do(signal[(36 % num) + 1]); - this.num > 37 ? this.outlist[38] = this.37.follow_do(signal[(37 % num) + 1]); - this.num > 38 ? this.outlist[39] = this.38.follow_do(signal[(38 % num) + 1]); - this.num > 39 ? this.outlist[40] = this.39.follow_do(signal[(39 % num) + 1]); - this.outlist; -); - -function Pzcross(lst1) -( - this.num = lst1[0]; - this.outlist = memalloc(this.num + 1); - this.outlist[0] = this.num; - this.num > 0 ? this.0.zcross(lst1[1]); - this.num > 1 ? this.1.zcross(lst1[2]); - this.num > 2 ? this.2.zcross(lst1[3]); - this.num > 3 ? this.3.zcross(lst1[4]); - this.num > 4 ? this.4.zcross(lst1[5]); - this.num > 5 ? this.5.zcross(lst1[6]); - this.num > 6 ? this.6.zcross(lst1[7]); - this.num > 7 ? this.7.zcross(lst1[8]); - this.num > 8 ? this.8.zcross(lst1[9]); - this.num > 9 ? this.9.zcross(lst1[10]); - this.num > 10 ? this.10.zcross(lst1[11]); - this.num > 11 ? this.11.zcross(lst1[12]); - this.num > 12 ? this.12.zcross(lst1[13]); - this.num > 13 ? this.13.zcross(lst1[14]); - this.num > 14 ? this.14.zcross(lst1[15]); - this.num > 15 ? this.15.zcross(lst1[16]); - this.num > 16 ? this.16.zcross(lst1[17]); - this.num > 17 ? this.17.zcross(lst1[18]); - this.num > 18 ? this.18.zcross(lst1[19]); - this.num > 19 ? this.19.zcross(lst1[20]); - this.num > 20 ? this.20.zcross(lst1[21]); - this.num > 21 ? this.21.zcross(lst1[22]); - this.num > 22 ? this.22.zcross(lst1[23]); - this.num > 23 ? this.23.zcross(lst1[24]); - this.num > 24 ? this.24.zcross(lst1[25]); - this.num > 25 ? this.25.zcross(lst1[26]); - this.num > 26 ? this.26.zcross(lst1[27]); - this.num > 27 ? this.27.zcross(lst1[28]); - this.num > 28 ? this.28.zcross(lst1[29]); - this.num > 29 ? this.29.zcross(lst1[30]); - this.num > 30 ? this.30.zcross(lst1[31]); - this.num > 31 ? this.31.zcross(lst1[32]); - this.num > 32 ? this.32.zcross(lst1[33]); - this.num > 33 ? this.33.zcross(lst1[34]); - this.num > 34 ? this.34.zcross(lst1[35]); - this.num > 35 ? this.35.zcross(lst1[36]); - this.num > 36 ? this.36.zcross(lst1[37]); - this.num > 37 ? this.37.zcross(lst1[38]); - this.num > 38 ? this.38.zcross(lst1[39]); - this.num > 39 ? this.39.zcross(lst1[40]); -); -function Pzcross_set_size(lst1) -( - this.num > 0 ? this.0.zcross_set_size(lst1[1]); - this.num > 1 ? this.1.zcross_set_size(lst1[2]); - this.num > 2 ? this.2.zcross_set_size(lst1[3]); - this.num > 3 ? this.3.zcross_set_size(lst1[4]); - this.num > 4 ? this.4.zcross_set_size(lst1[5]); - this.num > 5 ? this.5.zcross_set_size(lst1[6]); - this.num > 6 ? this.6.zcross_set_size(lst1[7]); - this.num > 7 ? this.7.zcross_set_size(lst1[8]); - this.num > 8 ? this.8.zcross_set_size(lst1[9]); - this.num > 9 ? this.9.zcross_set_size(lst1[10]); - this.num > 10 ? this.10.zcross_set_size(lst1[11]); - this.num > 11 ? this.11.zcross_set_size(lst1[12]); - this.num > 12 ? this.12.zcross_set_size(lst1[13]); - this.num > 13 ? this.13.zcross_set_size(lst1[14]); - this.num > 14 ? this.14.zcross_set_size(lst1[15]); - this.num > 15 ? this.15.zcross_set_size(lst1[16]); - this.num > 16 ? this.16.zcross_set_size(lst1[17]); - this.num > 17 ? this.17.zcross_set_size(lst1[18]); - this.num > 18 ? this.18.zcross_set_size(lst1[19]); - this.num > 19 ? this.19.zcross_set_size(lst1[20]); - this.num > 20 ? this.20.zcross_set_size(lst1[21]); - this.num > 21 ? this.21.zcross_set_size(lst1[22]); - this.num > 22 ? this.22.zcross_set_size(lst1[23]); - this.num > 23 ? this.23.zcross_set_size(lst1[24]); - this.num > 24 ? this.24.zcross_set_size(lst1[25]); - this.num > 25 ? this.25.zcross_set_size(lst1[26]); - this.num > 26 ? this.26.zcross_set_size(lst1[27]); - this.num > 27 ? this.27.zcross_set_size(lst1[28]); - this.num > 28 ? this.28.zcross_set_size(lst1[29]); - this.num > 29 ? this.29.zcross_set_size(lst1[30]); - this.num > 30 ? this.30.zcross_set_size(lst1[31]); - this.num > 31 ? this.31.zcross_set_size(lst1[32]); - this.num > 32 ? this.32.zcross_set_size(lst1[33]); - this.num > 33 ? this.33.zcross_set_size(lst1[34]); - this.num > 34 ? this.34.zcross_set_size(lst1[35]); - this.num > 35 ? this.35.zcross_set_size(lst1[36]); - this.num > 36 ? this.36.zcross_set_size(lst1[37]); - this.num > 37 ? this.37.zcross_set_size(lst1[38]); - this.num > 38 ? this.38.zcross_set_size(lst1[39]); - this.num > 39 ? this.39.zcross_set_size(lst1[40]); -); -function Pzcross_do(signal) -( - num = signal[0]; - this.num > 0 ? this.outlist[1] = this.0.zcross_do(signal[(0 % num) + 1]); - this.num > 1 ? this.outlist[2] = this.1.zcross_do(signal[(1 % num) + 1]); - this.num > 2 ? this.outlist[3] = this.2.zcross_do(signal[(2 % num) + 1]); - this.num > 3 ? this.outlist[4] = this.3.zcross_do(signal[(3 % num) + 1]); - this.num > 4 ? this.outlist[5] = this.4.zcross_do(signal[(4 % num) + 1]); - this.num > 5 ? this.outlist[6] = this.5.zcross_do(signal[(5 % num) + 1]); - this.num > 6 ? this.outlist[7] = this.6.zcross_do(signal[(6 % num) + 1]); - this.num > 7 ? this.outlist[8] = this.7.zcross_do(signal[(7 % num) + 1]); - this.num > 8 ? this.outlist[9] = this.8.zcross_do(signal[(8 % num) + 1]); - this.num > 9 ? this.outlist[10] = this.9.zcross_do(signal[(9 % num) + 1]); - this.num > 10 ? this.outlist[11] = this.10.zcross_do(signal[(10 % num) + 1]); - this.num > 11 ? this.outlist[12] = this.11.zcross_do(signal[(11 % num) + 1]); - this.num > 12 ? this.outlist[13] = this.12.zcross_do(signal[(12 % num) + 1]); - this.num > 13 ? this.outlist[14] = this.13.zcross_do(signal[(13 % num) + 1]); - this.num > 14 ? this.outlist[15] = this.14.zcross_do(signal[(14 % num) + 1]); - this.num > 15 ? this.outlist[16] = this.15.zcross_do(signal[(15 % num) + 1]); - this.num > 16 ? this.outlist[17] = this.16.zcross_do(signal[(16 % num) + 1]); - this.num > 17 ? this.outlist[18] = this.17.zcross_do(signal[(17 % num) + 1]); - this.num > 18 ? this.outlist[19] = this.18.zcross_do(signal[(18 % num) + 1]); - this.num > 19 ? this.outlist[20] = this.19.zcross_do(signal[(19 % num) + 1]); - this.num > 20 ? this.outlist[21] = this.20.zcross_do(signal[(20 % num) + 1]); - this.num > 21 ? this.outlist[22] = this.21.zcross_do(signal[(21 % num) + 1]); - this.num > 22 ? this.outlist[23] = this.22.zcross_do(signal[(22 % num) + 1]); - this.num > 23 ? this.outlist[24] = this.23.zcross_do(signal[(23 % num) + 1]); - this.num > 24 ? this.outlist[25] = this.24.zcross_do(signal[(24 % num) + 1]); - this.num > 25 ? this.outlist[26] = this.25.zcross_do(signal[(25 % num) + 1]); - this.num > 26 ? this.outlist[27] = this.26.zcross_do(signal[(26 % num) + 1]); - this.num > 27 ? this.outlist[28] = this.27.zcross_do(signal[(27 % num) + 1]); - this.num > 28 ? this.outlist[29] = this.28.zcross_do(signal[(28 % num) + 1]); - this.num > 29 ? this.outlist[30] = this.29.zcross_do(signal[(29 % num) + 1]); - this.num > 30 ? this.outlist[31] = this.30.zcross_do(signal[(30 % num) + 1]); - this.num > 31 ? this.outlist[32] = this.31.zcross_do(signal[(31 % num) + 1]); - this.num > 32 ? this.outlist[33] = this.32.zcross_do(signal[(32 % num) + 1]); - this.num > 33 ? this.outlist[34] = this.33.zcross_do(signal[(33 % num) + 1]); - this.num > 34 ? this.outlist[35] = this.34.zcross_do(signal[(34 % num) + 1]); - this.num > 35 ? this.outlist[36] = this.35.zcross_do(signal[(35 % num) + 1]); - this.num > 36 ? this.outlist[37] = this.36.zcross_do(signal[(36 % num) + 1]); - this.num > 37 ? this.outlist[38] = this.37.zcross_do(signal[(37 % num) + 1]); - this.num > 38 ? this.outlist[39] = this.38.zcross_do(signal[(38 % num) + 1]); - this.num > 39 ? this.outlist[40] = this.39.zcross_do(signal[(39 % num) + 1]); - this.outlist; -); - -function Pyin(lst1 lst2 lst3 lst4 lst5) -( - this.num = lst1[0]; - this.outlist = memalloc(this.num + 1); - this.outlist[0] = this.num; - this.num > 0 ? this.0.yin(lst1[1], lst2[1], lst3[1], lst4[1], lst5[1]); - this.num > 1 ? this.1.yin(lst1[2], lst2[2], lst3[2], lst4[2], lst5[2]); - this.num > 2 ? this.2.yin(lst1[3], lst2[3], lst3[3], lst4[3], lst5[3]); - this.num > 3 ? this.3.yin(lst1[4], lst2[4], lst3[4], lst4[4], lst5[4]); - this.num > 4 ? this.4.yin(lst1[5], lst2[5], lst3[5], lst4[5], lst5[5]); - this.num > 5 ? this.5.yin(lst1[6], lst2[6], lst3[6], lst4[6], lst5[6]); - this.num > 6 ? this.6.yin(lst1[7], lst2[7], lst3[7], lst4[7], lst5[7]); - this.num > 7 ? this.7.yin(lst1[8], lst2[8], lst3[8], lst4[8], lst5[8]); - this.num > 8 ? this.8.yin(lst1[9], lst2[9], lst3[9], lst4[9], lst5[9]); - this.num > 9 ? this.9.yin(lst1[10], lst2[10], lst3[10], lst4[10], lst5[10]); - this.num > 10 ? this.10.yin(lst1[11], lst2[11], lst3[11], lst4[11], lst5[11]); - this.num > 11 ? this.11.yin(lst1[12], lst2[12], lst3[12], lst4[12], lst5[12]); - this.num > 12 ? this.12.yin(lst1[13], lst2[13], lst3[13], lst4[13], lst5[13]); - this.num > 13 ? this.13.yin(lst1[14], lst2[14], lst3[14], lst4[14], lst5[14]); - this.num > 14 ? this.14.yin(lst1[15], lst2[15], lst3[15], lst4[15], lst5[15]); - this.num > 15 ? this.15.yin(lst1[16], lst2[16], lst3[16], lst4[16], lst5[16]); - this.num > 16 ? this.16.yin(lst1[17], lst2[17], lst3[17], lst4[17], lst5[17]); - this.num > 17 ? this.17.yin(lst1[18], lst2[18], lst3[18], lst4[18], lst5[18]); - this.num > 18 ? this.18.yin(lst1[19], lst2[19], lst3[19], lst4[19], lst5[19]); - this.num > 19 ? this.19.yin(lst1[20], lst2[20], lst3[20], lst4[20], lst5[20]); - this.num > 20 ? this.20.yin(lst1[21], lst2[21], lst3[21], lst4[21], lst5[21]); - this.num > 21 ? this.21.yin(lst1[22], lst2[22], lst3[22], lst4[22], lst5[22]); - this.num > 22 ? this.22.yin(lst1[23], lst2[23], lst3[23], lst4[23], lst5[23]); - this.num > 23 ? this.23.yin(lst1[24], lst2[24], lst3[24], lst4[24], lst5[24]); - this.num > 24 ? this.24.yin(lst1[25], lst2[25], lst3[25], lst4[25], lst5[25]); - this.num > 25 ? this.25.yin(lst1[26], lst2[26], lst3[26], lst4[26], lst5[26]); - this.num > 26 ? this.26.yin(lst1[27], lst2[27], lst3[27], lst4[27], lst5[27]); - this.num > 27 ? this.27.yin(lst1[28], lst2[28], lst3[28], lst4[28], lst5[28]); - this.num > 28 ? this.28.yin(lst1[29], lst2[29], lst3[29], lst4[29], lst5[29]); - this.num > 29 ? this.29.yin(lst1[30], lst2[30], lst3[30], lst4[30], lst5[30]); - this.num > 30 ? this.30.yin(lst1[31], lst2[31], lst3[31], lst4[31], lst5[31]); - this.num > 31 ? this.31.yin(lst1[32], lst2[32], lst3[32], lst4[32], lst5[32]); - this.num > 32 ? this.32.yin(lst1[33], lst2[33], lst3[33], lst4[33], lst5[33]); - this.num > 33 ? this.33.yin(lst1[34], lst2[34], lst3[34], lst4[34], lst5[34]); - this.num > 34 ? this.34.yin(lst1[35], lst2[35], lst3[35], lst4[35], lst5[35]); - this.num > 35 ? this.35.yin(lst1[36], lst2[36], lst3[36], lst4[36], lst5[36]); - this.num > 36 ? this.36.yin(lst1[37], lst2[37], lst3[37], lst4[37], lst5[37]); - this.num > 37 ? this.37.yin(lst1[38], lst2[38], lst3[38], lst4[38], lst5[38]); - this.num > 38 ? this.38.yin(lst1[39], lst2[39], lst3[39], lst4[39], lst5[39]); - this.num > 39 ? this.39.yin(lst1[40], lst2[40], lst3[40], lst4[40], lst5[40]); -); -function Pyin_set_tolerance(lst1) -( - this.num > 0 ? this.0.yin_set_tolerance(lst1[1]); - this.num > 1 ? this.1.yin_set_tolerance(lst1[2]); - this.num > 2 ? this.2.yin_set_tolerance(lst1[3]); - this.num > 3 ? this.3.yin_set_tolerance(lst1[4]); - this.num > 4 ? this.4.yin_set_tolerance(lst1[5]); - this.num > 5 ? this.5.yin_set_tolerance(lst1[6]); - this.num > 6 ? this.6.yin_set_tolerance(lst1[7]); - this.num > 7 ? this.7.yin_set_tolerance(lst1[8]); - this.num > 8 ? this.8.yin_set_tolerance(lst1[9]); - this.num > 9 ? this.9.yin_set_tolerance(lst1[10]); - this.num > 10 ? this.10.yin_set_tolerance(lst1[11]); - this.num > 11 ? this.11.yin_set_tolerance(lst1[12]); - this.num > 12 ? this.12.yin_set_tolerance(lst1[13]); - this.num > 13 ? this.13.yin_set_tolerance(lst1[14]); - this.num > 14 ? this.14.yin_set_tolerance(lst1[15]); - this.num > 15 ? this.15.yin_set_tolerance(lst1[16]); - this.num > 16 ? this.16.yin_set_tolerance(lst1[17]); - this.num > 17 ? this.17.yin_set_tolerance(lst1[18]); - this.num > 18 ? this.18.yin_set_tolerance(lst1[19]); - this.num > 19 ? this.19.yin_set_tolerance(lst1[20]); - this.num > 20 ? this.20.yin_set_tolerance(lst1[21]); - this.num > 21 ? this.21.yin_set_tolerance(lst1[22]); - this.num > 22 ? this.22.yin_set_tolerance(lst1[23]); - this.num > 23 ? this.23.yin_set_tolerance(lst1[24]); - this.num > 24 ? this.24.yin_set_tolerance(lst1[25]); - this.num > 25 ? this.25.yin_set_tolerance(lst1[26]); - this.num > 26 ? this.26.yin_set_tolerance(lst1[27]); - this.num > 27 ? this.27.yin_set_tolerance(lst1[28]); - this.num > 28 ? this.28.yin_set_tolerance(lst1[29]); - this.num > 29 ? this.29.yin_set_tolerance(lst1[30]); - this.num > 30 ? this.30.yin_set_tolerance(lst1[31]); - this.num > 31 ? this.31.yin_set_tolerance(lst1[32]); - this.num > 32 ? this.32.yin_set_tolerance(lst1[33]); - this.num > 33 ? this.33.yin_set_tolerance(lst1[34]); - this.num > 34 ? this.34.yin_set_tolerance(lst1[35]); - this.num > 35 ? this.35.yin_set_tolerance(lst1[36]); - this.num > 36 ? this.36.yin_set_tolerance(lst1[37]); - this.num > 37 ? this.37.yin_set_tolerance(lst1[38]); - this.num > 38 ? this.38.yin_set_tolerance(lst1[39]); - this.num > 39 ? this.39.yin_set_tolerance(lst1[40]); -); -function Pyin_set_minfreq(lst1) -( - this.num > 0 ? this.0.yin_set_minfreq(lst1[1]); - this.num > 1 ? this.1.yin_set_minfreq(lst1[2]); - this.num > 2 ? this.2.yin_set_minfreq(lst1[3]); - this.num > 3 ? this.3.yin_set_minfreq(lst1[4]); - this.num > 4 ? this.4.yin_set_minfreq(lst1[5]); - this.num > 5 ? this.5.yin_set_minfreq(lst1[6]); - this.num > 6 ? this.6.yin_set_minfreq(lst1[7]); - this.num > 7 ? this.7.yin_set_minfreq(lst1[8]); - this.num > 8 ? this.8.yin_set_minfreq(lst1[9]); - this.num > 9 ? this.9.yin_set_minfreq(lst1[10]); - this.num > 10 ? this.10.yin_set_minfreq(lst1[11]); - this.num > 11 ? this.11.yin_set_minfreq(lst1[12]); - this.num > 12 ? this.12.yin_set_minfreq(lst1[13]); - this.num > 13 ? this.13.yin_set_minfreq(lst1[14]); - this.num > 14 ? this.14.yin_set_minfreq(lst1[15]); - this.num > 15 ? this.15.yin_set_minfreq(lst1[16]); - this.num > 16 ? this.16.yin_set_minfreq(lst1[17]); - this.num > 17 ? this.17.yin_set_minfreq(lst1[18]); - this.num > 18 ? this.18.yin_set_minfreq(lst1[19]); - this.num > 19 ? this.19.yin_set_minfreq(lst1[20]); - this.num > 20 ? this.20.yin_set_minfreq(lst1[21]); - this.num > 21 ? this.21.yin_set_minfreq(lst1[22]); - this.num > 22 ? this.22.yin_set_minfreq(lst1[23]); - this.num > 23 ? this.23.yin_set_minfreq(lst1[24]); - this.num > 24 ? this.24.yin_set_minfreq(lst1[25]); - this.num > 25 ? this.25.yin_set_minfreq(lst1[26]); - this.num > 26 ? this.26.yin_set_minfreq(lst1[27]); - this.num > 27 ? this.27.yin_set_minfreq(lst1[28]); - this.num > 28 ? this.28.yin_set_minfreq(lst1[29]); - this.num > 29 ? this.29.yin_set_minfreq(lst1[30]); - this.num > 30 ? this.30.yin_set_minfreq(lst1[31]); - this.num > 31 ? this.31.yin_set_minfreq(lst1[32]); - this.num > 32 ? this.32.yin_set_minfreq(lst1[33]); - this.num > 33 ? this.33.yin_set_minfreq(lst1[34]); - this.num > 34 ? this.34.yin_set_minfreq(lst1[35]); - this.num > 35 ? this.35.yin_set_minfreq(lst1[36]); - this.num > 36 ? this.36.yin_set_minfreq(lst1[37]); - this.num > 37 ? this.37.yin_set_minfreq(lst1[38]); - this.num > 38 ? this.38.yin_set_minfreq(lst1[39]); - this.num > 39 ? this.39.yin_set_minfreq(lst1[40]); -); -function Pyin_set_maxfreq(lst1) -( - this.num > 0 ? this.0.yin_set_maxfreq(lst1[1]); - this.num > 1 ? this.1.yin_set_maxfreq(lst1[2]); - this.num > 2 ? this.2.yin_set_maxfreq(lst1[3]); - this.num > 3 ? this.3.yin_set_maxfreq(lst1[4]); - this.num > 4 ? this.4.yin_set_maxfreq(lst1[5]); - this.num > 5 ? this.5.yin_set_maxfreq(lst1[6]); - this.num > 6 ? this.6.yin_set_maxfreq(lst1[7]); - this.num > 7 ? this.7.yin_set_maxfreq(lst1[8]); - this.num > 8 ? this.8.yin_set_maxfreq(lst1[9]); - this.num > 9 ? this.9.yin_set_maxfreq(lst1[10]); - this.num > 10 ? this.10.yin_set_maxfreq(lst1[11]); - this.num > 11 ? this.11.yin_set_maxfreq(lst1[12]); - this.num > 12 ? this.12.yin_set_maxfreq(lst1[13]); - this.num > 13 ? this.13.yin_set_maxfreq(lst1[14]); - this.num > 14 ? this.14.yin_set_maxfreq(lst1[15]); - this.num > 15 ? this.15.yin_set_maxfreq(lst1[16]); - this.num > 16 ? this.16.yin_set_maxfreq(lst1[17]); - this.num > 17 ? this.17.yin_set_maxfreq(lst1[18]); - this.num > 18 ? this.18.yin_set_maxfreq(lst1[19]); - this.num > 19 ? this.19.yin_set_maxfreq(lst1[20]); - this.num > 20 ? this.20.yin_set_maxfreq(lst1[21]); - this.num > 21 ? this.21.yin_set_maxfreq(lst1[22]); - this.num > 22 ? this.22.yin_set_maxfreq(lst1[23]); - this.num > 23 ? this.23.yin_set_maxfreq(lst1[24]); - this.num > 24 ? this.24.yin_set_maxfreq(lst1[25]); - this.num > 25 ? this.25.yin_set_maxfreq(lst1[26]); - this.num > 26 ? this.26.yin_set_maxfreq(lst1[27]); - this.num > 27 ? this.27.yin_set_maxfreq(lst1[28]); - this.num > 28 ? this.28.yin_set_maxfreq(lst1[29]); - this.num > 29 ? this.29.yin_set_maxfreq(lst1[30]); - this.num > 30 ? this.30.yin_set_maxfreq(lst1[31]); - this.num > 31 ? this.31.yin_set_maxfreq(lst1[32]); - this.num > 32 ? this.32.yin_set_maxfreq(lst1[33]); - this.num > 33 ? this.33.yin_set_maxfreq(lst1[34]); - this.num > 34 ? this.34.yin_set_maxfreq(lst1[35]); - this.num > 35 ? this.35.yin_set_maxfreq(lst1[36]); - this.num > 36 ? this.36.yin_set_maxfreq(lst1[37]); - this.num > 37 ? this.37.yin_set_maxfreq(lst1[38]); - this.num > 38 ? this.38.yin_set_maxfreq(lst1[39]); - this.num > 39 ? this.39.yin_set_maxfreq(lst1[40]); -); -function Pyin_set_cutoff(lst1) -( - this.num > 0 ? this.0.yin_set_cutoff(lst1[1]); - this.num > 1 ? this.1.yin_set_cutoff(lst1[2]); - this.num > 2 ? this.2.yin_set_cutoff(lst1[3]); - this.num > 3 ? this.3.yin_set_cutoff(lst1[4]); - this.num > 4 ? this.4.yin_set_cutoff(lst1[5]); - this.num > 5 ? this.5.yin_set_cutoff(lst1[6]); - this.num > 6 ? this.6.yin_set_cutoff(lst1[7]); - this.num > 7 ? this.7.yin_set_cutoff(lst1[8]); - this.num > 8 ? this.8.yin_set_cutoff(lst1[9]); - this.num > 9 ? this.9.yin_set_cutoff(lst1[10]); - this.num > 10 ? this.10.yin_set_cutoff(lst1[11]); - this.num > 11 ? this.11.yin_set_cutoff(lst1[12]); - this.num > 12 ? this.12.yin_set_cutoff(lst1[13]); - this.num > 13 ? this.13.yin_set_cutoff(lst1[14]); - this.num > 14 ? this.14.yin_set_cutoff(lst1[15]); - this.num > 15 ? this.15.yin_set_cutoff(lst1[16]); - this.num > 16 ? this.16.yin_set_cutoff(lst1[17]); - this.num > 17 ? this.17.yin_set_cutoff(lst1[18]); - this.num > 18 ? this.18.yin_set_cutoff(lst1[19]); - this.num > 19 ? this.19.yin_set_cutoff(lst1[20]); - this.num > 20 ? this.20.yin_set_cutoff(lst1[21]); - this.num > 21 ? this.21.yin_set_cutoff(lst1[22]); - this.num > 22 ? this.22.yin_set_cutoff(lst1[23]); - this.num > 23 ? this.23.yin_set_cutoff(lst1[24]); - this.num > 24 ? this.24.yin_set_cutoff(lst1[25]); - this.num > 25 ? this.25.yin_set_cutoff(lst1[26]); - this.num > 26 ? this.26.yin_set_cutoff(lst1[27]); - this.num > 27 ? this.27.yin_set_cutoff(lst1[28]); - this.num > 28 ? this.28.yin_set_cutoff(lst1[29]); - this.num > 29 ? this.29.yin_set_cutoff(lst1[30]); - this.num > 30 ? this.30.yin_set_cutoff(lst1[31]); - this.num > 31 ? this.31.yin_set_cutoff(lst1[32]); - this.num > 32 ? this.32.yin_set_cutoff(lst1[33]); - this.num > 33 ? this.33.yin_set_cutoff(lst1[34]); - this.num > 34 ? this.34.yin_set_cutoff(lst1[35]); - this.num > 35 ? this.35.yin_set_cutoff(lst1[36]); - this.num > 36 ? this.36.yin_set_cutoff(lst1[37]); - this.num > 37 ? this.37.yin_set_cutoff(lst1[38]); - this.num > 38 ? this.38.yin_set_cutoff(lst1[39]); - this.num > 39 ? this.39.yin_set_cutoff(lst1[40]); -); -function Pyin_set_size(lst1) -( - this.num > 0 ? this.0.yin_set_size(lst1[1]); - this.num > 1 ? this.1.yin_set_size(lst1[2]); - this.num > 2 ? this.2.yin_set_size(lst1[3]); - this.num > 3 ? this.3.yin_set_size(lst1[4]); - this.num > 4 ? this.4.yin_set_size(lst1[5]); - this.num > 5 ? this.5.yin_set_size(lst1[6]); - this.num > 6 ? this.6.yin_set_size(lst1[7]); - this.num > 7 ? this.7.yin_set_size(lst1[8]); - this.num > 8 ? this.8.yin_set_size(lst1[9]); - this.num > 9 ? this.9.yin_set_size(lst1[10]); - this.num > 10 ? this.10.yin_set_size(lst1[11]); - this.num > 11 ? this.11.yin_set_size(lst1[12]); - this.num > 12 ? this.12.yin_set_size(lst1[13]); - this.num > 13 ? this.13.yin_set_size(lst1[14]); - this.num > 14 ? this.14.yin_set_size(lst1[15]); - this.num > 15 ? this.15.yin_set_size(lst1[16]); - this.num > 16 ? this.16.yin_set_size(lst1[17]); - this.num > 17 ? this.17.yin_set_size(lst1[18]); - this.num > 18 ? this.18.yin_set_size(lst1[19]); - this.num > 19 ? this.19.yin_set_size(lst1[20]); - this.num > 20 ? this.20.yin_set_size(lst1[21]); - this.num > 21 ? this.21.yin_set_size(lst1[22]); - this.num > 22 ? this.22.yin_set_size(lst1[23]); - this.num > 23 ? this.23.yin_set_size(lst1[24]); - this.num > 24 ? this.24.yin_set_size(lst1[25]); - this.num > 25 ? this.25.yin_set_size(lst1[26]); - this.num > 26 ? this.26.yin_set_size(lst1[27]); - this.num > 27 ? this.27.yin_set_size(lst1[28]); - this.num > 28 ? this.28.yin_set_size(lst1[29]); - this.num > 29 ? this.29.yin_set_size(lst1[30]); - this.num > 30 ? this.30.yin_set_size(lst1[31]); - this.num > 31 ? this.31.yin_set_size(lst1[32]); - this.num > 32 ? this.32.yin_set_size(lst1[33]); - this.num > 33 ? this.33.yin_set_size(lst1[34]); - this.num > 34 ? this.34.yin_set_size(lst1[35]); - this.num > 35 ? this.35.yin_set_size(lst1[36]); - this.num > 36 ? this.36.yin_set_size(lst1[37]); - this.num > 37 ? this.37.yin_set_size(lst1[38]); - this.num > 38 ? this.38.yin_set_size(lst1[39]); - this.num > 39 ? this.39.yin_set_size(lst1[40]); -); -function Pyin_do(signal) -( - num = signal[0]; - this.num > 0 ? this.outlist[1] = this.0.yin_do(signal[(0 % num) + 1]); - this.num > 1 ? this.outlist[2] = this.1.yin_do(signal[(1 % num) + 1]); - this.num > 2 ? this.outlist[3] = this.2.yin_do(signal[(2 % num) + 1]); - this.num > 3 ? this.outlist[4] = this.3.yin_do(signal[(3 % num) + 1]); - this.num > 4 ? this.outlist[5] = this.4.yin_do(signal[(4 % num) + 1]); - this.num > 5 ? this.outlist[6] = this.5.yin_do(signal[(5 % num) + 1]); - this.num > 6 ? this.outlist[7] = this.6.yin_do(signal[(6 % num) + 1]); - this.num > 7 ? this.outlist[8] = this.7.yin_do(signal[(7 % num) + 1]); - this.num > 8 ? this.outlist[9] = this.8.yin_do(signal[(8 % num) + 1]); - this.num > 9 ? this.outlist[10] = this.9.yin_do(signal[(9 % num) + 1]); - this.num > 10 ? this.outlist[11] = this.10.yin_do(signal[(10 % num) + 1]); - this.num > 11 ? this.outlist[12] = this.11.yin_do(signal[(11 % num) + 1]); - this.num > 12 ? this.outlist[13] = this.12.yin_do(signal[(12 % num) + 1]); - this.num > 13 ? this.outlist[14] = this.13.yin_do(signal[(13 % num) + 1]); - this.num > 14 ? this.outlist[15] = this.14.yin_do(signal[(14 % num) + 1]); - this.num > 15 ? this.outlist[16] = this.15.yin_do(signal[(15 % num) + 1]); - this.num > 16 ? this.outlist[17] = this.16.yin_do(signal[(16 % num) + 1]); - this.num > 17 ? this.outlist[18] = this.17.yin_do(signal[(17 % num) + 1]); - this.num > 18 ? this.outlist[19] = this.18.yin_do(signal[(18 % num) + 1]); - this.num > 19 ? this.outlist[20] = this.19.yin_do(signal[(19 % num) + 1]); - this.num > 20 ? this.outlist[21] = this.20.yin_do(signal[(20 % num) + 1]); - this.num > 21 ? this.outlist[22] = this.21.yin_do(signal[(21 % num) + 1]); - this.num > 22 ? this.outlist[23] = this.22.yin_do(signal[(22 % num) + 1]); - this.num > 23 ? this.outlist[24] = this.23.yin_do(signal[(23 % num) + 1]); - this.num > 24 ? this.outlist[25] = this.24.yin_do(signal[(24 % num) + 1]); - this.num > 25 ? this.outlist[26] = this.25.yin_do(signal[(25 % num) + 1]); - this.num > 26 ? this.outlist[27] = this.26.yin_do(signal[(26 % num) + 1]); - this.num > 27 ? this.outlist[28] = this.27.yin_do(signal[(27 % num) + 1]); - this.num > 28 ? this.outlist[29] = this.28.yin_do(signal[(28 % num) + 1]); - this.num > 29 ? this.outlist[30] = this.29.yin_do(signal[(29 % num) + 1]); - this.num > 30 ? this.outlist[31] = this.30.yin_do(signal[(30 % num) + 1]); - this.num > 31 ? this.outlist[32] = this.31.yin_do(signal[(31 % num) + 1]); - this.num > 32 ? this.outlist[33] = this.32.yin_do(signal[(32 % num) + 1]); - this.num > 33 ? this.outlist[34] = this.33.yin_do(signal[(33 % num) + 1]); - this.num > 34 ? this.outlist[35] = this.34.yin_do(signal[(34 % num) + 1]); - this.num > 35 ? this.outlist[36] = this.35.yin_do(signal[(35 % num) + 1]); - this.num > 36 ? this.outlist[37] = this.36.yin_do(signal[(36 % num) + 1]); - this.num > 37 ? this.outlist[38] = this.37.yin_do(signal[(37 % num) + 1]); - this.num > 38 ? this.outlist[39] = this.38.yin_do(signal[(38 % num) + 1]); - this.num > 39 ? this.outlist[40] = this.39.yin_do(signal[(39 % num) + 1]); - this.outlist; -); - -function Ponset(lst1 lst2 lst3 lst4 lst5) -( - this.num = lst1[0]; - this.outlist = memalloc(this.num + 1); - this.outlist[0] = this.num; - this.num > 0 ? this.0.onset(lst1[1], lst2[1], lst3[1], lst4[1], lst5[1]); - this.num > 1 ? this.1.onset(lst1[2], lst2[2], lst3[2], lst4[2], lst5[2]); - this.num > 2 ? this.2.onset(lst1[3], lst2[3], lst3[3], lst4[3], lst5[3]); - this.num > 3 ? this.3.onset(lst1[4], lst2[4], lst3[4], lst4[4], lst5[4]); - this.num > 4 ? this.4.onset(lst1[5], lst2[5], lst3[5], lst4[5], lst5[5]); - this.num > 5 ? this.5.onset(lst1[6], lst2[6], lst3[6], lst4[6], lst5[6]); - this.num > 6 ? this.6.onset(lst1[7], lst2[7], lst3[7], lst4[7], lst5[7]); - this.num > 7 ? this.7.onset(lst1[8], lst2[8], lst3[8], lst4[8], lst5[8]); - this.num > 8 ? this.8.onset(lst1[9], lst2[9], lst3[9], lst4[9], lst5[9]); - this.num > 9 ? this.9.onset(lst1[10], lst2[10], lst3[10], lst4[10], lst5[10]); - this.num > 10 ? this.10.onset(lst1[11], lst2[11], lst3[11], lst4[11], lst5[11]); - this.num > 11 ? this.11.onset(lst1[12], lst2[12], lst3[12], lst4[12], lst5[12]); - this.num > 12 ? this.12.onset(lst1[13], lst2[13], lst3[13], lst4[13], lst5[13]); - this.num > 13 ? this.13.onset(lst1[14], lst2[14], lst3[14], lst4[14], lst5[14]); - this.num > 14 ? this.14.onset(lst1[15], lst2[15], lst3[15], lst4[15], lst5[15]); - this.num > 15 ? this.15.onset(lst1[16], lst2[16], lst3[16], lst4[16], lst5[16]); - this.num > 16 ? this.16.onset(lst1[17], lst2[17], lst3[17], lst4[17], lst5[17]); - this.num > 17 ? this.17.onset(lst1[18], lst2[18], lst3[18], lst4[18], lst5[18]); - this.num > 18 ? this.18.onset(lst1[19], lst2[19], lst3[19], lst4[19], lst5[19]); - this.num > 19 ? this.19.onset(lst1[20], lst2[20], lst3[20], lst4[20], lst5[20]); - this.num > 20 ? this.20.onset(lst1[21], lst2[21], lst3[21], lst4[21], lst5[21]); - this.num > 21 ? this.21.onset(lst1[22], lst2[22], lst3[22], lst4[22], lst5[22]); - this.num > 22 ? this.22.onset(lst1[23], lst2[23], lst3[23], lst4[23], lst5[23]); - this.num > 23 ? this.23.onset(lst1[24], lst2[24], lst3[24], lst4[24], lst5[24]); - this.num > 24 ? this.24.onset(lst1[25], lst2[25], lst3[25], lst4[25], lst5[25]); - this.num > 25 ? this.25.onset(lst1[26], lst2[26], lst3[26], lst4[26], lst5[26]); - this.num > 26 ? this.26.onset(lst1[27], lst2[27], lst3[27], lst4[27], lst5[27]); - this.num > 27 ? this.27.onset(lst1[28], lst2[28], lst3[28], lst4[28], lst5[28]); - this.num > 28 ? this.28.onset(lst1[29], lst2[29], lst3[29], lst4[29], lst5[29]); - this.num > 29 ? this.29.onset(lst1[30], lst2[30], lst3[30], lst4[30], lst5[30]); - this.num > 30 ? this.30.onset(lst1[31], lst2[31], lst3[31], lst4[31], lst5[31]); - this.num > 31 ? this.31.onset(lst1[32], lst2[32], lst3[32], lst4[32], lst5[32]); - this.num > 32 ? this.32.onset(lst1[33], lst2[33], lst3[33], lst4[33], lst5[33]); - this.num > 33 ? this.33.onset(lst1[34], lst2[34], lst3[34], lst4[34], lst5[34]); - this.num > 34 ? this.34.onset(lst1[35], lst2[35], lst3[35], lst4[35], lst5[35]); - this.num > 35 ? this.35.onset(lst1[36], lst2[36], lst3[36], lst4[36], lst5[36]); - this.num > 36 ? this.36.onset(lst1[37], lst2[37], lst3[37], lst4[37], lst5[37]); - this.num > 37 ? this.37.onset(lst1[38], lst2[38], lst3[38], lst4[38], lst5[38]); - this.num > 38 ? this.38.onset(lst1[39], lst2[39], lst3[39], lst4[39], lst5[39]); - this.num > 39 ? this.39.onset(lst1[40], lst2[40], lst3[40], lst4[40], lst5[40]); -); -function Ponset_set_deltime(lst1) -( - this.num > 0 ? this.0.onset_set_deltime(lst1[1]); - this.num > 1 ? this.1.onset_set_deltime(lst1[2]); - this.num > 2 ? this.2.onset_set_deltime(lst1[3]); - this.num > 3 ? this.3.onset_set_deltime(lst1[4]); - this.num > 4 ? this.4.onset_set_deltime(lst1[5]); - this.num > 5 ? this.5.onset_set_deltime(lst1[6]); - this.num > 6 ? this.6.onset_set_deltime(lst1[7]); - this.num > 7 ? this.7.onset_set_deltime(lst1[8]); - this.num > 8 ? this.8.onset_set_deltime(lst1[9]); - this.num > 9 ? this.9.onset_set_deltime(lst1[10]); - this.num > 10 ? this.10.onset_set_deltime(lst1[11]); - this.num > 11 ? this.11.onset_set_deltime(lst1[12]); - this.num > 12 ? this.12.onset_set_deltime(lst1[13]); - this.num > 13 ? this.13.onset_set_deltime(lst1[14]); - this.num > 14 ? this.14.onset_set_deltime(lst1[15]); - this.num > 15 ? this.15.onset_set_deltime(lst1[16]); - this.num > 16 ? this.16.onset_set_deltime(lst1[17]); - this.num > 17 ? this.17.onset_set_deltime(lst1[18]); - this.num > 18 ? this.18.onset_set_deltime(lst1[19]); - this.num > 19 ? this.19.onset_set_deltime(lst1[20]); - this.num > 20 ? this.20.onset_set_deltime(lst1[21]); - this.num > 21 ? this.21.onset_set_deltime(lst1[22]); - this.num > 22 ? this.22.onset_set_deltime(lst1[23]); - this.num > 23 ? this.23.onset_set_deltime(lst1[24]); - this.num > 24 ? this.24.onset_set_deltime(lst1[25]); - this.num > 25 ? this.25.onset_set_deltime(lst1[26]); - this.num > 26 ? this.26.onset_set_deltime(lst1[27]); - this.num > 27 ? this.27.onset_set_deltime(lst1[28]); - this.num > 28 ? this.28.onset_set_deltime(lst1[29]); - this.num > 29 ? this.29.onset_set_deltime(lst1[30]); - this.num > 30 ? this.30.onset_set_deltime(lst1[31]); - this.num > 31 ? this.31.onset_set_deltime(lst1[32]); - this.num > 32 ? this.32.onset_set_deltime(lst1[33]); - this.num > 33 ? this.33.onset_set_deltime(lst1[34]); - this.num > 34 ? this.34.onset_set_deltime(lst1[35]); - this.num > 35 ? this.35.onset_set_deltime(lst1[36]); - this.num > 36 ? this.36.onset_set_deltime(lst1[37]); - this.num > 37 ? this.37.onset_set_deltime(lst1[38]); - this.num > 38 ? this.38.onset_set_deltime(lst1[39]); - this.num > 39 ? this.39.onset_set_deltime(lst1[40]); -); -function Ponset_set_cutoff(lst1) -( - this.num > 0 ? this.0.onset_set_cutoff(lst1[1]); - this.num > 1 ? this.1.onset_set_cutoff(lst1[2]); - this.num > 2 ? this.2.onset_set_cutoff(lst1[3]); - this.num > 3 ? this.3.onset_set_cutoff(lst1[4]); - this.num > 4 ? this.4.onset_set_cutoff(lst1[5]); - this.num > 5 ? this.5.onset_set_cutoff(lst1[6]); - this.num > 6 ? this.6.onset_set_cutoff(lst1[7]); - this.num > 7 ? this.7.onset_set_cutoff(lst1[8]); - this.num > 8 ? this.8.onset_set_cutoff(lst1[9]); - this.num > 9 ? this.9.onset_set_cutoff(lst1[10]); - this.num > 10 ? this.10.onset_set_cutoff(lst1[11]); - this.num > 11 ? this.11.onset_set_cutoff(lst1[12]); - this.num > 12 ? this.12.onset_set_cutoff(lst1[13]); - this.num > 13 ? this.13.onset_set_cutoff(lst1[14]); - this.num > 14 ? this.14.onset_set_cutoff(lst1[15]); - this.num > 15 ? this.15.onset_set_cutoff(lst1[16]); - this.num > 16 ? this.16.onset_set_cutoff(lst1[17]); - this.num > 17 ? this.17.onset_set_cutoff(lst1[18]); - this.num > 18 ? this.18.onset_set_cutoff(lst1[19]); - this.num > 19 ? this.19.onset_set_cutoff(lst1[20]); - this.num > 20 ? this.20.onset_set_cutoff(lst1[21]); - this.num > 21 ? this.21.onset_set_cutoff(lst1[22]); - this.num > 22 ? this.22.onset_set_cutoff(lst1[23]); - this.num > 23 ? this.23.onset_set_cutoff(lst1[24]); - this.num > 24 ? this.24.onset_set_cutoff(lst1[25]); - this.num > 25 ? this.25.onset_set_cutoff(lst1[26]); - this.num > 26 ? this.26.onset_set_cutoff(lst1[27]); - this.num > 27 ? this.27.onset_set_cutoff(lst1[28]); - this.num > 28 ? this.28.onset_set_cutoff(lst1[29]); - this.num > 29 ? this.29.onset_set_cutoff(lst1[30]); - this.num > 30 ? this.30.onset_set_cutoff(lst1[31]); - this.num > 31 ? this.31.onset_set_cutoff(lst1[32]); - this.num > 32 ? this.32.onset_set_cutoff(lst1[33]); - this.num > 33 ? this.33.onset_set_cutoff(lst1[34]); - this.num > 34 ? this.34.onset_set_cutoff(lst1[35]); - this.num > 35 ? this.35.onset_set_cutoff(lst1[36]); - this.num > 36 ? this.36.onset_set_cutoff(lst1[37]); - this.num > 37 ? this.37.onset_set_cutoff(lst1[38]); - this.num > 38 ? this.38.onset_set_cutoff(lst1[39]); - this.num > 39 ? this.39.onset_set_cutoff(lst1[40]); -); -function Ponset_set_upthresh(lst1) -( - this.num > 0 ? this.0.onset_set_upthresh(lst1[1]); - this.num > 1 ? this.1.onset_set_upthresh(lst1[2]); - this.num > 2 ? this.2.onset_set_upthresh(lst1[3]); - this.num > 3 ? this.3.onset_set_upthresh(lst1[4]); - this.num > 4 ? this.4.onset_set_upthresh(lst1[5]); - this.num > 5 ? this.5.onset_set_upthresh(lst1[6]); - this.num > 6 ? this.6.onset_set_upthresh(lst1[7]); - this.num > 7 ? this.7.onset_set_upthresh(lst1[8]); - this.num > 8 ? this.8.onset_set_upthresh(lst1[9]); - this.num > 9 ? this.9.onset_set_upthresh(lst1[10]); - this.num > 10 ? this.10.onset_set_upthresh(lst1[11]); - this.num > 11 ? this.11.onset_set_upthresh(lst1[12]); - this.num > 12 ? this.12.onset_set_upthresh(lst1[13]); - this.num > 13 ? this.13.onset_set_upthresh(lst1[14]); - this.num > 14 ? this.14.onset_set_upthresh(lst1[15]); - this.num > 15 ? this.15.onset_set_upthresh(lst1[16]); - this.num > 16 ? this.16.onset_set_upthresh(lst1[17]); - this.num > 17 ? this.17.onset_set_upthresh(lst1[18]); - this.num > 18 ? this.18.onset_set_upthresh(lst1[19]); - this.num > 19 ? this.19.onset_set_upthresh(lst1[20]); - this.num > 20 ? this.20.onset_set_upthresh(lst1[21]); - this.num > 21 ? this.21.onset_set_upthresh(lst1[22]); - this.num > 22 ? this.22.onset_set_upthresh(lst1[23]); - this.num > 23 ? this.23.onset_set_upthresh(lst1[24]); - this.num > 24 ? this.24.onset_set_upthresh(lst1[25]); - this.num > 25 ? this.25.onset_set_upthresh(lst1[26]); - this.num > 26 ? this.26.onset_set_upthresh(lst1[27]); - this.num > 27 ? this.27.onset_set_upthresh(lst1[28]); - this.num > 28 ? this.28.onset_set_upthresh(lst1[29]); - this.num > 29 ? this.29.onset_set_upthresh(lst1[30]); - this.num > 30 ? this.30.onset_set_upthresh(lst1[31]); - this.num > 31 ? this.31.onset_set_upthresh(lst1[32]); - this.num > 32 ? this.32.onset_set_upthresh(lst1[33]); - this.num > 33 ? this.33.onset_set_upthresh(lst1[34]); - this.num > 34 ? this.34.onset_set_upthresh(lst1[35]); - this.num > 35 ? this.35.onset_set_upthresh(lst1[36]); - this.num > 36 ? this.36.onset_set_upthresh(lst1[37]); - this.num > 37 ? this.37.onset_set_upthresh(lst1[38]); - this.num > 38 ? this.38.onset_set_upthresh(lst1[39]); - this.num > 39 ? this.39.onset_set_upthresh(lst1[40]); -); -function Ponset_set_downthresh(lst1) -( - this.num > 0 ? this.0.onset_set_downthresh(lst1[1]); - this.num > 1 ? this.1.onset_set_downthresh(lst1[2]); - this.num > 2 ? this.2.onset_set_downthresh(lst1[3]); - this.num > 3 ? this.3.onset_set_downthresh(lst1[4]); - this.num > 4 ? this.4.onset_set_downthresh(lst1[5]); - this.num > 5 ? this.5.onset_set_downthresh(lst1[6]); - this.num > 6 ? this.6.onset_set_downthresh(lst1[7]); - this.num > 7 ? this.7.onset_set_downthresh(lst1[8]); - this.num > 8 ? this.8.onset_set_downthresh(lst1[9]); - this.num > 9 ? this.9.onset_set_downthresh(lst1[10]); - this.num > 10 ? this.10.onset_set_downthresh(lst1[11]); - this.num > 11 ? this.11.onset_set_downthresh(lst1[12]); - this.num > 12 ? this.12.onset_set_downthresh(lst1[13]); - this.num > 13 ? this.13.onset_set_downthresh(lst1[14]); - this.num > 14 ? this.14.onset_set_downthresh(lst1[15]); - this.num > 15 ? this.15.onset_set_downthresh(lst1[16]); - this.num > 16 ? this.16.onset_set_downthresh(lst1[17]); - this.num > 17 ? this.17.onset_set_downthresh(lst1[18]); - this.num > 18 ? this.18.onset_set_downthresh(lst1[19]); - this.num > 19 ? this.19.onset_set_downthresh(lst1[20]); - this.num > 20 ? this.20.onset_set_downthresh(lst1[21]); - this.num > 21 ? this.21.onset_set_downthresh(lst1[22]); - this.num > 22 ? this.22.onset_set_downthresh(lst1[23]); - this.num > 23 ? this.23.onset_set_downthresh(lst1[24]); - this.num > 24 ? this.24.onset_set_downthresh(lst1[25]); - this.num > 25 ? this.25.onset_set_downthresh(lst1[26]); - this.num > 26 ? this.26.onset_set_downthresh(lst1[27]); - this.num > 27 ? this.27.onset_set_downthresh(lst1[28]); - this.num > 28 ? this.28.onset_set_downthresh(lst1[29]); - this.num > 29 ? this.29.onset_set_downthresh(lst1[30]); - this.num > 30 ? this.30.onset_set_downthresh(lst1[31]); - this.num > 31 ? this.31.onset_set_downthresh(lst1[32]); - this.num > 32 ? this.32.onset_set_downthresh(lst1[33]); - this.num > 33 ? this.33.onset_set_downthresh(lst1[34]); - this.num > 34 ? this.34.onset_set_downthresh(lst1[35]); - this.num > 35 ? this.35.onset_set_downthresh(lst1[36]); - this.num > 36 ? this.36.onset_set_downthresh(lst1[37]); - this.num > 37 ? this.37.onset_set_downthresh(lst1[38]); - this.num > 38 ? this.38.onset_set_downthresh(lst1[39]); - this.num > 39 ? this.39.onset_set_downthresh(lst1[40]); -); -function Ponset_set_reltime(lst1) -( - this.num > 0 ? this.0.onset_set_reltime(lst1[1]); - this.num > 1 ? this.1.onset_set_reltime(lst1[2]); - this.num > 2 ? this.2.onset_set_reltime(lst1[3]); - this.num > 3 ? this.3.onset_set_reltime(lst1[4]); - this.num > 4 ? this.4.onset_set_reltime(lst1[5]); - this.num > 5 ? this.5.onset_set_reltime(lst1[6]); - this.num > 6 ? this.6.onset_set_reltime(lst1[7]); - this.num > 7 ? this.7.onset_set_reltime(lst1[8]); - this.num > 8 ? this.8.onset_set_reltime(lst1[9]); - this.num > 9 ? this.9.onset_set_reltime(lst1[10]); - this.num > 10 ? this.10.onset_set_reltime(lst1[11]); - this.num > 11 ? this.11.onset_set_reltime(lst1[12]); - this.num > 12 ? this.12.onset_set_reltime(lst1[13]); - this.num > 13 ? this.13.onset_set_reltime(lst1[14]); - this.num > 14 ? this.14.onset_set_reltime(lst1[15]); - this.num > 15 ? this.15.onset_set_reltime(lst1[16]); - this.num > 16 ? this.16.onset_set_reltime(lst1[17]); - this.num > 17 ? this.17.onset_set_reltime(lst1[18]); - this.num > 18 ? this.18.onset_set_reltime(lst1[19]); - this.num > 19 ? this.19.onset_set_reltime(lst1[20]); - this.num > 20 ? this.20.onset_set_reltime(lst1[21]); - this.num > 21 ? this.21.onset_set_reltime(lst1[22]); - this.num > 22 ? this.22.onset_set_reltime(lst1[23]); - this.num > 23 ? this.23.onset_set_reltime(lst1[24]); - this.num > 24 ? this.24.onset_set_reltime(lst1[25]); - this.num > 25 ? this.25.onset_set_reltime(lst1[26]); - this.num > 26 ? this.26.onset_set_reltime(lst1[27]); - this.num > 27 ? this.27.onset_set_reltime(lst1[28]); - this.num > 28 ? this.28.onset_set_reltime(lst1[29]); - this.num > 29 ? this.29.onset_set_reltime(lst1[30]); - this.num > 30 ? this.30.onset_set_reltime(lst1[31]); - this.num > 31 ? this.31.onset_set_reltime(lst1[32]); - this.num > 32 ? this.32.onset_set_reltime(lst1[33]); - this.num > 33 ? this.33.onset_set_reltime(lst1[34]); - this.num > 34 ? this.34.onset_set_reltime(lst1[35]); - this.num > 35 ? this.35.onset_set_reltime(lst1[36]); - this.num > 36 ? this.36.onset_set_reltime(lst1[37]); - this.num > 37 ? this.37.onset_set_reltime(lst1[38]); - this.num > 38 ? this.38.onset_set_reltime(lst1[39]); - this.num > 39 ? this.39.onset_set_reltime(lst1[40]); -); -function Ponset_do(signal) -( - num = signal[0]; - this.num > 0 ? this.outlist[1] = this.0.onset_do(signal[(0 % num) + 1]); - this.num > 1 ? this.outlist[2] = this.1.onset_do(signal[(1 % num) + 1]); - this.num > 2 ? this.outlist[3] = this.2.onset_do(signal[(2 % num) + 1]); - this.num > 3 ? this.outlist[4] = this.3.onset_do(signal[(3 % num) + 1]); - this.num > 4 ? this.outlist[5] = this.4.onset_do(signal[(4 % num) + 1]); - this.num > 5 ? this.outlist[6] = this.5.onset_do(signal[(5 % num) + 1]); - this.num > 6 ? this.outlist[7] = this.6.onset_do(signal[(6 % num) + 1]); - this.num > 7 ? this.outlist[8] = this.7.onset_do(signal[(7 % num) + 1]); - this.num > 8 ? this.outlist[9] = this.8.onset_do(signal[(8 % num) + 1]); - this.num > 9 ? this.outlist[10] = this.9.onset_do(signal[(9 % num) + 1]); - this.num > 10 ? this.outlist[11] = this.10.onset_do(signal[(10 % num) + 1]); - this.num > 11 ? this.outlist[12] = this.11.onset_do(signal[(11 % num) + 1]); - this.num > 12 ? this.outlist[13] = this.12.onset_do(signal[(12 % num) + 1]); - this.num > 13 ? this.outlist[14] = this.13.onset_do(signal[(13 % num) + 1]); - this.num > 14 ? this.outlist[15] = this.14.onset_do(signal[(14 % num) + 1]); - this.num > 15 ? this.outlist[16] = this.15.onset_do(signal[(15 % num) + 1]); - this.num > 16 ? this.outlist[17] = this.16.onset_do(signal[(16 % num) + 1]); - this.num > 17 ? this.outlist[18] = this.17.onset_do(signal[(17 % num) + 1]); - this.num > 18 ? this.outlist[19] = this.18.onset_do(signal[(18 % num) + 1]); - this.num > 19 ? this.outlist[20] = this.19.onset_do(signal[(19 % num) + 1]); - this.num > 20 ? this.outlist[21] = this.20.onset_do(signal[(20 % num) + 1]); - this.num > 21 ? this.outlist[22] = this.21.onset_do(signal[(21 % num) + 1]); - this.num > 22 ? this.outlist[23] = this.22.onset_do(signal[(22 % num) + 1]); - this.num > 23 ? this.outlist[24] = this.23.onset_do(signal[(23 % num) + 1]); - this.num > 24 ? this.outlist[25] = this.24.onset_do(signal[(24 % num) + 1]); - this.num > 25 ? this.outlist[26] = this.25.onset_do(signal[(25 % num) + 1]); - this.num > 26 ? this.outlist[27] = this.26.onset_do(signal[(26 % num) + 1]); - this.num > 27 ? this.outlist[28] = this.27.onset_do(signal[(27 % num) + 1]); - this.num > 28 ? this.outlist[29] = this.28.onset_do(signal[(28 % num) + 1]); - this.num > 29 ? this.outlist[30] = this.29.onset_do(signal[(29 % num) + 1]); - this.num > 30 ? this.outlist[31] = this.30.onset_do(signal[(30 % num) + 1]); - this.num > 31 ? this.outlist[32] = this.31.onset_do(signal[(31 % num) + 1]); - this.num > 32 ? this.outlist[33] = this.32.onset_do(signal[(32 % num) + 1]); - this.num > 33 ? this.outlist[34] = this.33.onset_do(signal[(33 % num) + 1]); - this.num > 34 ? this.outlist[35] = this.34.onset_do(signal[(34 % num) + 1]); - this.num > 35 ? this.outlist[36] = this.35.onset_do(signal[(35 % num) + 1]); - this.num > 36 ? this.outlist[37] = this.36.onset_do(signal[(36 % num) + 1]); - this.num > 37 ? this.outlist[38] = this.37.onset_do(signal[(37 % num) + 1]); - this.num > 38 ? this.outlist[39] = this.38.onset_do(signal[(38 % num) + 1]); - this.num > 39 ? this.outlist[40] = this.39.onset_do(signal[(39 % num) + 1]); - this.outlist; -); - -function Pphasor(lst1 lst2) -( - this.num = lst1[0]; - this.outlist = memalloc(this.num + 1); - this.outlist[0] = this.num; - this.num > 0 ? this.0.phasor(lst1[1], lst2[1]); - this.num > 1 ? this.1.phasor(lst1[2], lst2[2]); - this.num > 2 ? this.2.phasor(lst1[3], lst2[3]); - this.num > 3 ? this.3.phasor(lst1[4], lst2[4]); - this.num > 4 ? this.4.phasor(lst1[5], lst2[5]); - this.num > 5 ? this.5.phasor(lst1[6], lst2[6]); - this.num > 6 ? this.6.phasor(lst1[7], lst2[7]); - this.num > 7 ? this.7.phasor(lst1[8], lst2[8]); - this.num > 8 ? this.8.phasor(lst1[9], lst2[9]); - this.num > 9 ? this.9.phasor(lst1[10], lst2[10]); - this.num > 10 ? this.10.phasor(lst1[11], lst2[11]); - this.num > 11 ? this.11.phasor(lst1[12], lst2[12]); - this.num > 12 ? this.12.phasor(lst1[13], lst2[13]); - this.num > 13 ? this.13.phasor(lst1[14], lst2[14]); - this.num > 14 ? this.14.phasor(lst1[15], lst2[15]); - this.num > 15 ? this.15.phasor(lst1[16], lst2[16]); - this.num > 16 ? this.16.phasor(lst1[17], lst2[17]); - this.num > 17 ? this.17.phasor(lst1[18], lst2[18]); - this.num > 18 ? this.18.phasor(lst1[19], lst2[19]); - this.num > 19 ? this.19.phasor(lst1[20], lst2[20]); - this.num > 20 ? this.20.phasor(lst1[21], lst2[21]); - this.num > 21 ? this.21.phasor(lst1[22], lst2[22]); - this.num > 22 ? this.22.phasor(lst1[23], lst2[23]); - this.num > 23 ? this.23.phasor(lst1[24], lst2[24]); - this.num > 24 ? this.24.phasor(lst1[25], lst2[25]); - this.num > 25 ? this.25.phasor(lst1[26], lst2[26]); - this.num > 26 ? this.26.phasor(lst1[27], lst2[27]); - this.num > 27 ? this.27.phasor(lst1[28], lst2[28]); - this.num > 28 ? this.28.phasor(lst1[29], lst2[29]); - this.num > 29 ? this.29.phasor(lst1[30], lst2[30]); - this.num > 30 ? this.30.phasor(lst1[31], lst2[31]); - this.num > 31 ? this.31.phasor(lst1[32], lst2[32]); - this.num > 32 ? this.32.phasor(lst1[33], lst2[33]); - this.num > 33 ? this.33.phasor(lst1[34], lst2[34]); - this.num > 34 ? this.34.phasor(lst1[35], lst2[35]); - this.num > 35 ? this.35.phasor(lst1[36], lst2[36]); - this.num > 36 ? this.36.phasor(lst1[37], lst2[37]); - this.num > 37 ? this.37.phasor(lst1[38], lst2[38]); - this.num > 38 ? this.38.phasor(lst1[39], lst2[39]); - this.num > 39 ? this.39.phasor(lst1[40], lst2[40]); -); -function Pphasor_set_freq(lst1) -( - this.num > 0 ? this.0.phasor_set_freq(lst1[1]); - this.num > 1 ? this.1.phasor_set_freq(lst1[2]); - this.num > 2 ? this.2.phasor_set_freq(lst1[3]); - this.num > 3 ? this.3.phasor_set_freq(lst1[4]); - this.num > 4 ? this.4.phasor_set_freq(lst1[5]); - this.num > 5 ? this.5.phasor_set_freq(lst1[6]); - this.num > 6 ? this.6.phasor_set_freq(lst1[7]); - this.num > 7 ? this.7.phasor_set_freq(lst1[8]); - this.num > 8 ? this.8.phasor_set_freq(lst1[9]); - this.num > 9 ? this.9.phasor_set_freq(lst1[10]); - this.num > 10 ? this.10.phasor_set_freq(lst1[11]); - this.num > 11 ? this.11.phasor_set_freq(lst1[12]); - this.num > 12 ? this.12.phasor_set_freq(lst1[13]); - this.num > 13 ? this.13.phasor_set_freq(lst1[14]); - this.num > 14 ? this.14.phasor_set_freq(lst1[15]); - this.num > 15 ? this.15.phasor_set_freq(lst1[16]); - this.num > 16 ? this.16.phasor_set_freq(lst1[17]); - this.num > 17 ? this.17.phasor_set_freq(lst1[18]); - this.num > 18 ? this.18.phasor_set_freq(lst1[19]); - this.num > 19 ? this.19.phasor_set_freq(lst1[20]); - this.num > 20 ? this.20.phasor_set_freq(lst1[21]); - this.num > 21 ? this.21.phasor_set_freq(lst1[22]); - this.num > 22 ? this.22.phasor_set_freq(lst1[23]); - this.num > 23 ? this.23.phasor_set_freq(lst1[24]); - this.num > 24 ? this.24.phasor_set_freq(lst1[25]); - this.num > 25 ? this.25.phasor_set_freq(lst1[26]); - this.num > 26 ? this.26.phasor_set_freq(lst1[27]); - this.num > 27 ? this.27.phasor_set_freq(lst1[28]); - this.num > 28 ? this.28.phasor_set_freq(lst1[29]); - this.num > 29 ? this.29.phasor_set_freq(lst1[30]); - this.num > 30 ? this.30.phasor_set_freq(lst1[31]); - this.num > 31 ? this.31.phasor_set_freq(lst1[32]); - this.num > 32 ? this.32.phasor_set_freq(lst1[33]); - this.num > 33 ? this.33.phasor_set_freq(lst1[34]); - this.num > 34 ? this.34.phasor_set_freq(lst1[35]); - this.num > 35 ? this.35.phasor_set_freq(lst1[36]); - this.num > 36 ? this.36.phasor_set_freq(lst1[37]); - this.num > 37 ? this.37.phasor_set_freq(lst1[38]); - this.num > 38 ? this.38.phasor_set_freq(lst1[39]); - this.num > 39 ? this.39.phasor_set_freq(lst1[40]); -); -function Pphasor_set_phase(lst1) -( - this.num > 0 ? this.0.phasor_set_phase(lst1[1]); - this.num > 1 ? this.1.phasor_set_phase(lst1[2]); - this.num > 2 ? this.2.phasor_set_phase(lst1[3]); - this.num > 3 ? this.3.phasor_set_phase(lst1[4]); - this.num > 4 ? this.4.phasor_set_phase(lst1[5]); - this.num > 5 ? this.5.phasor_set_phase(lst1[6]); - this.num > 6 ? this.6.phasor_set_phase(lst1[7]); - this.num > 7 ? this.7.phasor_set_phase(lst1[8]); - this.num > 8 ? this.8.phasor_set_phase(lst1[9]); - this.num > 9 ? this.9.phasor_set_phase(lst1[10]); - this.num > 10 ? this.10.phasor_set_phase(lst1[11]); - this.num > 11 ? this.11.phasor_set_phase(lst1[12]); - this.num > 12 ? this.12.phasor_set_phase(lst1[13]); - this.num > 13 ? this.13.phasor_set_phase(lst1[14]); - this.num > 14 ? this.14.phasor_set_phase(lst1[15]); - this.num > 15 ? this.15.phasor_set_phase(lst1[16]); - this.num > 16 ? this.16.phasor_set_phase(lst1[17]); - this.num > 17 ? this.17.phasor_set_phase(lst1[18]); - this.num > 18 ? this.18.phasor_set_phase(lst1[19]); - this.num > 19 ? this.19.phasor_set_phase(lst1[20]); - this.num > 20 ? this.20.phasor_set_phase(lst1[21]); - this.num > 21 ? this.21.phasor_set_phase(lst1[22]); - this.num > 22 ? this.22.phasor_set_phase(lst1[23]); - this.num > 23 ? this.23.phasor_set_phase(lst1[24]); - this.num > 24 ? this.24.phasor_set_phase(lst1[25]); - this.num > 25 ? this.25.phasor_set_phase(lst1[26]); - this.num > 26 ? this.26.phasor_set_phase(lst1[27]); - this.num > 27 ? this.27.phasor_set_phase(lst1[28]); - this.num > 28 ? this.28.phasor_set_phase(lst1[29]); - this.num > 29 ? this.29.phasor_set_phase(lst1[30]); - this.num > 30 ? this.30.phasor_set_phase(lst1[31]); - this.num > 31 ? this.31.phasor_set_phase(lst1[32]); - this.num > 32 ? this.32.phasor_set_phase(lst1[33]); - this.num > 33 ? this.33.phasor_set_phase(lst1[34]); - this.num > 34 ? this.34.phasor_set_phase(lst1[35]); - this.num > 35 ? this.35.phasor_set_phase(lst1[36]); - this.num > 36 ? this.36.phasor_set_phase(lst1[37]); - this.num > 37 ? this.37.phasor_set_phase(lst1[38]); - this.num > 38 ? this.38.phasor_set_phase(lst1[39]); - this.num > 39 ? this.39.phasor_set_phase(lst1[40]); -); -function Pphasor_reset() -( - this.num > 0 ? this.0.phasor_reset(); - this.num > 1 ? this.1.phasor_reset(); - this.num > 2 ? this.2.phasor_reset(); - this.num > 3 ? this.3.phasor_reset(); - this.num > 4 ? this.4.phasor_reset(); - this.num > 5 ? this.5.phasor_reset(); - this.num > 6 ? this.6.phasor_reset(); - this.num > 7 ? this.7.phasor_reset(); - this.num > 8 ? this.8.phasor_reset(); - this.num > 9 ? this.9.phasor_reset(); - this.num > 10 ? this.10.phasor_reset(); - this.num > 11 ? this.11.phasor_reset(); - this.num > 12 ? this.12.phasor_reset(); - this.num > 13 ? this.13.phasor_reset(); - this.num > 14 ? this.14.phasor_reset(); - this.num > 15 ? this.15.phasor_reset(); - this.num > 16 ? this.16.phasor_reset(); - this.num > 17 ? this.17.phasor_reset(); - this.num > 18 ? this.18.phasor_reset(); - this.num > 19 ? this.19.phasor_reset(); - this.num > 20 ? this.20.phasor_reset(); - this.num > 21 ? this.21.phasor_reset(); - this.num > 22 ? this.22.phasor_reset(); - this.num > 23 ? this.23.phasor_reset(); - this.num > 24 ? this.24.phasor_reset(); - this.num > 25 ? this.25.phasor_reset(); - this.num > 26 ? this.26.phasor_reset(); - this.num > 27 ? this.27.phasor_reset(); - this.num > 28 ? this.28.phasor_reset(); - this.num > 29 ? this.29.phasor_reset(); - this.num > 30 ? this.30.phasor_reset(); - this.num > 31 ? this.31.phasor_reset(); - this.num > 32 ? this.32.phasor_reset(); - this.num > 33 ? this.33.phasor_reset(); - this.num > 34 ? this.34.phasor_reset(); - this.num > 35 ? this.35.phasor_reset(); - this.num > 36 ? this.36.phasor_reset(); - this.num > 37 ? this.37.phasor_reset(); - this.num > 38 ? this.38.phasor_reset(); - this.num > 39 ? this.39.phasor_reset(); -); -function Pphasor_do() -( - this.num > 0 ? this.outlist[1] = this.0.phasor_do(); - this.num > 1 ? this.outlist[2] = this.1.phasor_do(); - this.num > 2 ? this.outlist[3] = this.2.phasor_do(); - this.num > 3 ? this.outlist[4] = this.3.phasor_do(); - this.num > 4 ? this.outlist[5] = this.4.phasor_do(); - this.num > 5 ? this.outlist[6] = this.5.phasor_do(); - this.num > 6 ? this.outlist[7] = this.6.phasor_do(); - this.num > 7 ? this.outlist[8] = this.7.phasor_do(); - this.num > 8 ? this.outlist[9] = this.8.phasor_do(); - this.num > 9 ? this.outlist[10] = this.9.phasor_do(); - this.num > 10 ? this.outlist[11] = this.10.phasor_do(); - this.num > 11 ? this.outlist[12] = this.11.phasor_do(); - this.num > 12 ? this.outlist[13] = this.12.phasor_do(); - this.num > 13 ? this.outlist[14] = this.13.phasor_do(); - this.num > 14 ? this.outlist[15] = this.14.phasor_do(); - this.num > 15 ? this.outlist[16] = this.15.phasor_do(); - this.num > 16 ? this.outlist[17] = this.16.phasor_do(); - this.num > 17 ? this.outlist[18] = this.17.phasor_do(); - this.num > 18 ? this.outlist[19] = this.18.phasor_do(); - this.num > 19 ? this.outlist[20] = this.19.phasor_do(); - this.num > 20 ? this.outlist[21] = this.20.phasor_do(); - this.num > 21 ? this.outlist[22] = this.21.phasor_do(); - this.num > 22 ? this.outlist[23] = this.22.phasor_do(); - this.num > 23 ? this.outlist[24] = this.23.phasor_do(); - this.num > 24 ? this.outlist[25] = this.24.phasor_do(); - this.num > 25 ? this.outlist[26] = this.25.phasor_do(); - this.num > 26 ? this.outlist[27] = this.26.phasor_do(); - this.num > 27 ? this.outlist[28] = this.27.phasor_do(); - this.num > 28 ? this.outlist[29] = this.28.phasor_do(); - this.num > 29 ? this.outlist[30] = this.29.phasor_do(); - this.num > 30 ? this.outlist[31] = this.30.phasor_do(); - this.num > 31 ? this.outlist[32] = this.31.phasor_do(); - this.num > 32 ? this.outlist[33] = this.32.phasor_do(); - this.num > 33 ? this.outlist[34] = this.33.phasor_do(); - this.num > 34 ? this.outlist[35] = this.34.phasor_do(); - this.num > 35 ? this.outlist[36] = this.35.phasor_do(); - this.num > 36 ? this.outlist[37] = this.36.phasor_do(); - this.num > 37 ? this.outlist[38] = this.37.phasor_do(); - this.num > 38 ? this.outlist[39] = this.38.phasor_do(); - this.num > 39 ? this.outlist[40] = this.39.phasor_do(); - this.outlist; -); - -function Psine(lst1 lst2) -( - this.num = lst1[0]; - this.outlist = memalloc(this.num + 1); - this.outlist[0] = this.num; - this.num > 0 ? this.0.sine(lst1[1], lst2[1]); - this.num > 1 ? this.1.sine(lst1[2], lst2[2]); - this.num > 2 ? this.2.sine(lst1[3], lst2[3]); - this.num > 3 ? this.3.sine(lst1[4], lst2[4]); - this.num > 4 ? this.4.sine(lst1[5], lst2[5]); - this.num > 5 ? this.5.sine(lst1[6], lst2[6]); - this.num > 6 ? this.6.sine(lst1[7], lst2[7]); - this.num > 7 ? this.7.sine(lst1[8], lst2[8]); - this.num > 8 ? this.8.sine(lst1[9], lst2[9]); - this.num > 9 ? this.9.sine(lst1[10], lst2[10]); - this.num > 10 ? this.10.sine(lst1[11], lst2[11]); - this.num > 11 ? this.11.sine(lst1[12], lst2[12]); - this.num > 12 ? this.12.sine(lst1[13], lst2[13]); - this.num > 13 ? this.13.sine(lst1[14], lst2[14]); - this.num > 14 ? this.14.sine(lst1[15], lst2[15]); - this.num > 15 ? this.15.sine(lst1[16], lst2[16]); - this.num > 16 ? this.16.sine(lst1[17], lst2[17]); - this.num > 17 ? this.17.sine(lst1[18], lst2[18]); - this.num > 18 ? this.18.sine(lst1[19], lst2[19]); - this.num > 19 ? this.19.sine(lst1[20], lst2[20]); - this.num > 20 ? this.20.sine(lst1[21], lst2[21]); - this.num > 21 ? this.21.sine(lst1[22], lst2[22]); - this.num > 22 ? this.22.sine(lst1[23], lst2[23]); - this.num > 23 ? this.23.sine(lst1[24], lst2[24]); - this.num > 24 ? this.24.sine(lst1[25], lst2[25]); - this.num > 25 ? this.25.sine(lst1[26], lst2[26]); - this.num > 26 ? this.26.sine(lst1[27], lst2[27]); - this.num > 27 ? this.27.sine(lst1[28], lst2[28]); - this.num > 28 ? this.28.sine(lst1[29], lst2[29]); - this.num > 29 ? this.29.sine(lst1[30], lst2[30]); - this.num > 30 ? this.30.sine(lst1[31], lst2[31]); - this.num > 31 ? this.31.sine(lst1[32], lst2[32]); - this.num > 32 ? this.32.sine(lst1[33], lst2[33]); - this.num > 33 ? this.33.sine(lst1[34], lst2[34]); - this.num > 34 ? this.34.sine(lst1[35], lst2[35]); - this.num > 35 ? this.35.sine(lst1[36], lst2[36]); - this.num > 36 ? this.36.sine(lst1[37], lst2[37]); - this.num > 37 ? this.37.sine(lst1[38], lst2[38]); - this.num > 38 ? this.38.sine(lst1[39], lst2[39]); - this.num > 39 ? this.39.sine(lst1[40], lst2[40]); -); -function Psine_set_freq(lst1) -( - this.num > 0 ? this.0.sine_set_freq(lst1[1]); - this.num > 1 ? this.1.sine_set_freq(lst1[2]); - this.num > 2 ? this.2.sine_set_freq(lst1[3]); - this.num > 3 ? this.3.sine_set_freq(lst1[4]); - this.num > 4 ? this.4.sine_set_freq(lst1[5]); - this.num > 5 ? this.5.sine_set_freq(lst1[6]); - this.num > 6 ? this.6.sine_set_freq(lst1[7]); - this.num > 7 ? this.7.sine_set_freq(lst1[8]); - this.num > 8 ? this.8.sine_set_freq(lst1[9]); - this.num > 9 ? this.9.sine_set_freq(lst1[10]); - this.num > 10 ? this.10.sine_set_freq(lst1[11]); - this.num > 11 ? this.11.sine_set_freq(lst1[12]); - this.num > 12 ? this.12.sine_set_freq(lst1[13]); - this.num > 13 ? this.13.sine_set_freq(lst1[14]); - this.num > 14 ? this.14.sine_set_freq(lst1[15]); - this.num > 15 ? this.15.sine_set_freq(lst1[16]); - this.num > 16 ? this.16.sine_set_freq(lst1[17]); - this.num > 17 ? this.17.sine_set_freq(lst1[18]); - this.num > 18 ? this.18.sine_set_freq(lst1[19]); - this.num > 19 ? this.19.sine_set_freq(lst1[20]); - this.num > 20 ? this.20.sine_set_freq(lst1[21]); - this.num > 21 ? this.21.sine_set_freq(lst1[22]); - this.num > 22 ? this.22.sine_set_freq(lst1[23]); - this.num > 23 ? this.23.sine_set_freq(lst1[24]); - this.num > 24 ? this.24.sine_set_freq(lst1[25]); - this.num > 25 ? this.25.sine_set_freq(lst1[26]); - this.num > 26 ? this.26.sine_set_freq(lst1[27]); - this.num > 27 ? this.27.sine_set_freq(lst1[28]); - this.num > 28 ? this.28.sine_set_freq(lst1[29]); - this.num > 29 ? this.29.sine_set_freq(lst1[30]); - this.num > 30 ? this.30.sine_set_freq(lst1[31]); - this.num > 31 ? this.31.sine_set_freq(lst1[32]); - this.num > 32 ? this.32.sine_set_freq(lst1[33]); - this.num > 33 ? this.33.sine_set_freq(lst1[34]); - this.num > 34 ? this.34.sine_set_freq(lst1[35]); - this.num > 35 ? this.35.sine_set_freq(lst1[36]); - this.num > 36 ? this.36.sine_set_freq(lst1[37]); - this.num > 37 ? this.37.sine_set_freq(lst1[38]); - this.num > 38 ? this.38.sine_set_freq(lst1[39]); - this.num > 39 ? this.39.sine_set_freq(lst1[40]); -); -function Psine_set_phase(lst1) -( - this.num > 0 ? this.0.sine_set_phase(lst1[1]); - this.num > 1 ? this.1.sine_set_phase(lst1[2]); - this.num > 2 ? this.2.sine_set_phase(lst1[3]); - this.num > 3 ? this.3.sine_set_phase(lst1[4]); - this.num > 4 ? this.4.sine_set_phase(lst1[5]); - this.num > 5 ? this.5.sine_set_phase(lst1[6]); - this.num > 6 ? this.6.sine_set_phase(lst1[7]); - this.num > 7 ? this.7.sine_set_phase(lst1[8]); - this.num > 8 ? this.8.sine_set_phase(lst1[9]); - this.num > 9 ? this.9.sine_set_phase(lst1[10]); - this.num > 10 ? this.10.sine_set_phase(lst1[11]); - this.num > 11 ? this.11.sine_set_phase(lst1[12]); - this.num > 12 ? this.12.sine_set_phase(lst1[13]); - this.num > 13 ? this.13.sine_set_phase(lst1[14]); - this.num > 14 ? this.14.sine_set_phase(lst1[15]); - this.num > 15 ? this.15.sine_set_phase(lst1[16]); - this.num > 16 ? this.16.sine_set_phase(lst1[17]); - this.num > 17 ? this.17.sine_set_phase(lst1[18]); - this.num > 18 ? this.18.sine_set_phase(lst1[19]); - this.num > 19 ? this.19.sine_set_phase(lst1[20]); - this.num > 20 ? this.20.sine_set_phase(lst1[21]); - this.num > 21 ? this.21.sine_set_phase(lst1[22]); - this.num > 22 ? this.22.sine_set_phase(lst1[23]); - this.num > 23 ? this.23.sine_set_phase(lst1[24]); - this.num > 24 ? this.24.sine_set_phase(lst1[25]); - this.num > 25 ? this.25.sine_set_phase(lst1[26]); - this.num > 26 ? this.26.sine_set_phase(lst1[27]); - this.num > 27 ? this.27.sine_set_phase(lst1[28]); - this.num > 28 ? this.28.sine_set_phase(lst1[29]); - this.num > 29 ? this.29.sine_set_phase(lst1[30]); - this.num > 30 ? this.30.sine_set_phase(lst1[31]); - this.num > 31 ? this.31.sine_set_phase(lst1[32]); - this.num > 32 ? this.32.sine_set_phase(lst1[33]); - this.num > 33 ? this.33.sine_set_phase(lst1[34]); - this.num > 34 ? this.34.sine_set_phase(lst1[35]); - this.num > 35 ? this.35.sine_set_phase(lst1[36]); - this.num > 36 ? this.36.sine_set_phase(lst1[37]); - this.num > 37 ? this.37.sine_set_phase(lst1[38]); - this.num > 38 ? this.38.sine_set_phase(lst1[39]); - this.num > 39 ? this.39.sine_set_phase(lst1[40]); -); -function Psine_reset() -( - this.num > 0 ? this.0.sine_reset(); - this.num > 1 ? this.1.sine_reset(); - this.num > 2 ? this.2.sine_reset(); - this.num > 3 ? this.3.sine_reset(); - this.num > 4 ? this.4.sine_reset(); - this.num > 5 ? this.5.sine_reset(); - this.num > 6 ? this.6.sine_reset(); - this.num > 7 ? this.7.sine_reset(); - this.num > 8 ? this.8.sine_reset(); - this.num > 9 ? this.9.sine_reset(); - this.num > 10 ? this.10.sine_reset(); - this.num > 11 ? this.11.sine_reset(); - this.num > 12 ? this.12.sine_reset(); - this.num > 13 ? this.13.sine_reset(); - this.num > 14 ? this.14.sine_reset(); - this.num > 15 ? this.15.sine_reset(); - this.num > 16 ? this.16.sine_reset(); - this.num > 17 ? this.17.sine_reset(); - this.num > 18 ? this.18.sine_reset(); - this.num > 19 ? this.19.sine_reset(); - this.num > 20 ? this.20.sine_reset(); - this.num > 21 ? this.21.sine_reset(); - this.num > 22 ? this.22.sine_reset(); - this.num > 23 ? this.23.sine_reset(); - this.num > 24 ? this.24.sine_reset(); - this.num > 25 ? this.25.sine_reset(); - this.num > 26 ? this.26.sine_reset(); - this.num > 27 ? this.27.sine_reset(); - this.num > 28 ? this.28.sine_reset(); - this.num > 29 ? this.29.sine_reset(); - this.num > 30 ? this.30.sine_reset(); - this.num > 31 ? this.31.sine_reset(); - this.num > 32 ? this.32.sine_reset(); - this.num > 33 ? this.33.sine_reset(); - this.num > 34 ? this.34.sine_reset(); - this.num > 35 ? this.35.sine_reset(); - this.num > 36 ? this.36.sine_reset(); - this.num > 37 ? this.37.sine_reset(); - this.num > 38 ? this.38.sine_reset(); - this.num > 39 ? this.39.sine_reset(); -); -function Psine_do() -( - this.num > 0 ? this.outlist[1] = this.0.sine_do(); - this.num > 1 ? this.outlist[2] = this.1.sine_do(); - this.num > 2 ? this.outlist[3] = this.2.sine_do(); - this.num > 3 ? this.outlist[4] = this.3.sine_do(); - this.num > 4 ? this.outlist[5] = this.4.sine_do(); - this.num > 5 ? this.outlist[6] = this.5.sine_do(); - this.num > 6 ? this.outlist[7] = this.6.sine_do(); - this.num > 7 ? this.outlist[8] = this.7.sine_do(); - this.num > 8 ? this.outlist[9] = this.8.sine_do(); - this.num > 9 ? this.outlist[10] = this.9.sine_do(); - this.num > 10 ? this.outlist[11] = this.10.sine_do(); - this.num > 11 ? this.outlist[12] = this.11.sine_do(); - this.num > 12 ? this.outlist[13] = this.12.sine_do(); - this.num > 13 ? this.outlist[14] = this.13.sine_do(); - this.num > 14 ? this.outlist[15] = this.14.sine_do(); - this.num > 15 ? this.outlist[16] = this.15.sine_do(); - this.num > 16 ? this.outlist[17] = this.16.sine_do(); - this.num > 17 ? this.outlist[18] = this.17.sine_do(); - this.num > 18 ? this.outlist[19] = this.18.sine_do(); - this.num > 19 ? this.outlist[20] = this.19.sine_do(); - this.num > 20 ? this.outlist[21] = this.20.sine_do(); - this.num > 21 ? this.outlist[22] = this.21.sine_do(); - this.num > 22 ? this.outlist[23] = this.22.sine_do(); - this.num > 23 ? this.outlist[24] = this.23.sine_do(); - this.num > 24 ? this.outlist[25] = this.24.sine_do(); - this.num > 25 ? this.outlist[26] = this.25.sine_do(); - this.num > 26 ? this.outlist[27] = this.26.sine_do(); - this.num > 27 ? this.outlist[28] = this.27.sine_do(); - this.num > 28 ? this.outlist[29] = this.28.sine_do(); - this.num > 29 ? this.outlist[30] = this.29.sine_do(); - this.num > 30 ? this.outlist[31] = this.30.sine_do(); - this.num > 31 ? this.outlist[32] = this.31.sine_do(); - this.num > 32 ? this.outlist[33] = this.32.sine_do(); - this.num > 33 ? this.outlist[34] = this.33.sine_do(); - this.num > 34 ? this.outlist[35] = this.34.sine_do(); - this.num > 35 ? this.outlist[36] = this.35.sine_do(); - this.num > 36 ? this.outlist[37] = this.36.sine_do(); - this.num > 37 ? this.outlist[38] = this.37.sine_do(); - this.num > 38 ? this.outlist[39] = this.38.sine_do(); - this.num > 39 ? this.outlist[40] = this.39.sine_do(); - this.outlist; -); - -function Prandom(lst1 lst2 lst3 lst4) -( - this.num = lst1[0]; - this.outlist = memalloc(this.num + 1); - this.outlist[0] = this.num; - this.num > 0 ? this.0.random(lst1[1], lst2[1], lst3[1], lst4[1]); - this.num > 1 ? this.1.random(lst1[2], lst2[2], lst3[2], lst4[2]); - this.num > 2 ? this.2.random(lst1[3], lst2[3], lst3[3], lst4[3]); - this.num > 3 ? this.3.random(lst1[4], lst2[4], lst3[4], lst4[4]); - this.num > 4 ? this.4.random(lst1[5], lst2[5], lst3[5], lst4[5]); - this.num > 5 ? this.5.random(lst1[6], lst2[6], lst3[6], lst4[6]); - this.num > 6 ? this.6.random(lst1[7], lst2[7], lst3[7], lst4[7]); - this.num > 7 ? this.7.random(lst1[8], lst2[8], lst3[8], lst4[8]); - this.num > 8 ? this.8.random(lst1[9], lst2[9], lst3[9], lst4[9]); - this.num > 9 ? this.9.random(lst1[10], lst2[10], lst3[10], lst4[10]); - this.num > 10 ? this.10.random(lst1[11], lst2[11], lst3[11], lst4[11]); - this.num > 11 ? this.11.random(lst1[12], lst2[12], lst3[12], lst4[12]); - this.num > 12 ? this.12.random(lst1[13], lst2[13], lst3[13], lst4[13]); - this.num > 13 ? this.13.random(lst1[14], lst2[14], lst3[14], lst4[14]); - this.num > 14 ? this.14.random(lst1[15], lst2[15], lst3[15], lst4[15]); - this.num > 15 ? this.15.random(lst1[16], lst2[16], lst3[16], lst4[16]); - this.num > 16 ? this.16.random(lst1[17], lst2[17], lst3[17], lst4[17]); - this.num > 17 ? this.17.random(lst1[18], lst2[18], lst3[18], lst4[18]); - this.num > 18 ? this.18.random(lst1[19], lst2[19], lst3[19], lst4[19]); - this.num > 19 ? this.19.random(lst1[20], lst2[20], lst3[20], lst4[20]); - this.num > 20 ? this.20.random(lst1[21], lst2[21], lst3[21], lst4[21]); - this.num > 21 ? this.21.random(lst1[22], lst2[22], lst3[22], lst4[22]); - this.num > 22 ? this.22.random(lst1[23], lst2[23], lst3[23], lst4[23]); - this.num > 23 ? this.23.random(lst1[24], lst2[24], lst3[24], lst4[24]); - this.num > 24 ? this.24.random(lst1[25], lst2[25], lst3[25], lst4[25]); - this.num > 25 ? this.25.random(lst1[26], lst2[26], lst3[26], lst4[26]); - this.num > 26 ? this.26.random(lst1[27], lst2[27], lst3[27], lst4[27]); - this.num > 27 ? this.27.random(lst1[28], lst2[28], lst3[28], lst4[28]); - this.num > 28 ? this.28.random(lst1[29], lst2[29], lst3[29], lst4[29]); - this.num > 29 ? this.29.random(lst1[30], lst2[30], lst3[30], lst4[30]); - this.num > 30 ? this.30.random(lst1[31], lst2[31], lst3[31], lst4[31]); - this.num > 31 ? this.31.random(lst1[32], lst2[32], lst3[32], lst4[32]); - this.num > 32 ? this.32.random(lst1[33], lst2[33], lst3[33], lst4[33]); - this.num > 33 ? this.33.random(lst1[34], lst2[34], lst3[34], lst4[34]); - this.num > 34 ? this.34.random(lst1[35], lst2[35], lst3[35], lst4[35]); - this.num > 35 ? this.35.random(lst1[36], lst2[36], lst3[36], lst4[36]); - this.num > 36 ? this.36.random(lst1[37], lst2[37], lst3[37], lst4[37]); - this.num > 37 ? this.37.random(lst1[38], lst2[38], lst3[38], lst4[38]); - this.num > 38 ? this.38.random(lst1[39], lst2[39], lst3[39], lst4[39]); - this.num > 39 ? this.39.random(lst1[40], lst2[40], lst3[40], lst4[40]); -); -function Prandom_set_limits(lst1 lst2) -( - this.num > 0 ? this.0.random_set_limits(lst1[1], lst2[1]); - this.num > 1 ? this.1.random_set_limits(lst1[2], lst2[2]); - this.num > 2 ? this.2.random_set_limits(lst1[3], lst2[3]); - this.num > 3 ? this.3.random_set_limits(lst1[4], lst2[4]); - this.num > 4 ? this.4.random_set_limits(lst1[5], lst2[5]); - this.num > 5 ? this.5.random_set_limits(lst1[6], lst2[6]); - this.num > 6 ? this.6.random_set_limits(lst1[7], lst2[7]); - this.num > 7 ? this.7.random_set_limits(lst1[8], lst2[8]); - this.num > 8 ? this.8.random_set_limits(lst1[9], lst2[9]); - this.num > 9 ? this.9.random_set_limits(lst1[10], lst2[10]); - this.num > 10 ? this.10.random_set_limits(lst1[11], lst2[11]); - this.num > 11 ? this.11.random_set_limits(lst1[12], lst2[12]); - this.num > 12 ? this.12.random_set_limits(lst1[13], lst2[13]); - this.num > 13 ? this.13.random_set_limits(lst1[14], lst2[14]); - this.num > 14 ? this.14.random_set_limits(lst1[15], lst2[15]); - this.num > 15 ? this.15.random_set_limits(lst1[16], lst2[16]); - this.num > 16 ? this.16.random_set_limits(lst1[17], lst2[17]); - this.num > 17 ? this.17.random_set_limits(lst1[18], lst2[18]); - this.num > 18 ? this.18.random_set_limits(lst1[19], lst2[19]); - this.num > 19 ? this.19.random_set_limits(lst1[20], lst2[20]); - this.num > 20 ? this.20.random_set_limits(lst1[21], lst2[21]); - this.num > 21 ? this.21.random_set_limits(lst1[22], lst2[22]); - this.num > 22 ? this.22.random_set_limits(lst1[23], lst2[23]); - this.num > 23 ? this.23.random_set_limits(lst1[24], lst2[24]); - this.num > 24 ? this.24.random_set_limits(lst1[25], lst2[25]); - this.num > 25 ? this.25.random_set_limits(lst1[26], lst2[26]); - this.num > 26 ? this.26.random_set_limits(lst1[27], lst2[27]); - this.num > 27 ? this.27.random_set_limits(lst1[28], lst2[28]); - this.num > 28 ? this.28.random_set_limits(lst1[29], lst2[29]); - this.num > 29 ? this.29.random_set_limits(lst1[30], lst2[30]); - this.num > 30 ? this.30.random_set_limits(lst1[31], lst2[31]); - this.num > 31 ? this.31.random_set_limits(lst1[32], lst2[32]); - this.num > 32 ? this.32.random_set_limits(lst1[33], lst2[33]); - this.num > 33 ? this.33.random_set_limits(lst1[34], lst2[34]); - this.num > 34 ? this.34.random_set_limits(lst1[35], lst2[35]); - this.num > 35 ? this.35.random_set_limits(lst1[36], lst2[36]); - this.num > 36 ? this.36.random_set_limits(lst1[37], lst2[37]); - this.num > 37 ? this.37.random_set_limits(lst1[38], lst2[38]); - this.num > 38 ? this.38.random_set_limits(lst1[39], lst2[39]); - this.num > 39 ? this.39.random_set_limits(lst1[40], lst2[40]); -); -function Prandom_set_freq(lst1) -( - this.num > 0 ? this.0.random_set_freq(lst1[1]); - this.num > 1 ? this.1.random_set_freq(lst1[2]); - this.num > 2 ? this.2.random_set_freq(lst1[3]); - this.num > 3 ? this.3.random_set_freq(lst1[4]); - this.num > 4 ? this.4.random_set_freq(lst1[5]); - this.num > 5 ? this.5.random_set_freq(lst1[6]); - this.num > 6 ? this.6.random_set_freq(lst1[7]); - this.num > 7 ? this.7.random_set_freq(lst1[8]); - this.num > 8 ? this.8.random_set_freq(lst1[9]); - this.num > 9 ? this.9.random_set_freq(lst1[10]); - this.num > 10 ? this.10.random_set_freq(lst1[11]); - this.num > 11 ? this.11.random_set_freq(lst1[12]); - this.num > 12 ? this.12.random_set_freq(lst1[13]); - this.num > 13 ? this.13.random_set_freq(lst1[14]); - this.num > 14 ? this.14.random_set_freq(lst1[15]); - this.num > 15 ? this.15.random_set_freq(lst1[16]); - this.num > 16 ? this.16.random_set_freq(lst1[17]); - this.num > 17 ? this.17.random_set_freq(lst1[18]); - this.num > 18 ? this.18.random_set_freq(lst1[19]); - this.num > 19 ? this.19.random_set_freq(lst1[20]); - this.num > 20 ? this.20.random_set_freq(lst1[21]); - this.num > 21 ? this.21.random_set_freq(lst1[22]); - this.num > 22 ? this.22.random_set_freq(lst1[23]); - this.num > 23 ? this.23.random_set_freq(lst1[24]); - this.num > 24 ? this.24.random_set_freq(lst1[25]); - this.num > 25 ? this.25.random_set_freq(lst1[26]); - this.num > 26 ? this.26.random_set_freq(lst1[27]); - this.num > 27 ? this.27.random_set_freq(lst1[28]); - this.num > 28 ? this.28.random_set_freq(lst1[29]); - this.num > 29 ? this.29.random_set_freq(lst1[30]); - this.num > 30 ? this.30.random_set_freq(lst1[31]); - this.num > 31 ? this.31.random_set_freq(lst1[32]); - this.num > 32 ? this.32.random_set_freq(lst1[33]); - this.num > 33 ? this.33.random_set_freq(lst1[34]); - this.num > 34 ? this.34.random_set_freq(lst1[35]); - this.num > 35 ? this.35.random_set_freq(lst1[36]); - this.num > 36 ? this.36.random_set_freq(lst1[37]); - this.num > 37 ? this.37.random_set_freq(lst1[38]); - this.num > 38 ? this.38.random_set_freq(lst1[39]); - this.num > 39 ? this.39.random_set_freq(lst1[40]); -); -function Prandom_set_mode(lst1) -( - this.num > 0 ? this.0.random_set_mode(lst1[1]); - this.num > 1 ? this.1.random_set_mode(lst1[2]); - this.num > 2 ? this.2.random_set_mode(lst1[3]); - this.num > 3 ? this.3.random_set_mode(lst1[4]); - this.num > 4 ? this.4.random_set_mode(lst1[5]); - this.num > 5 ? this.5.random_set_mode(lst1[6]); - this.num > 6 ? this.6.random_set_mode(lst1[7]); - this.num > 7 ? this.7.random_set_mode(lst1[8]); - this.num > 8 ? this.8.random_set_mode(lst1[9]); - this.num > 9 ? this.9.random_set_mode(lst1[10]); - this.num > 10 ? this.10.random_set_mode(lst1[11]); - this.num > 11 ? this.11.random_set_mode(lst1[12]); - this.num > 12 ? this.12.random_set_mode(lst1[13]); - this.num > 13 ? this.13.random_set_mode(lst1[14]); - this.num > 14 ? this.14.random_set_mode(lst1[15]); - this.num > 15 ? this.15.random_set_mode(lst1[16]); - this.num > 16 ? this.16.random_set_mode(lst1[17]); - this.num > 17 ? this.17.random_set_mode(lst1[18]); - this.num > 18 ? this.18.random_set_mode(lst1[19]); - this.num > 19 ? this.19.random_set_mode(lst1[20]); - this.num > 20 ? this.20.random_set_mode(lst1[21]); - this.num > 21 ? this.21.random_set_mode(lst1[22]); - this.num > 22 ? this.22.random_set_mode(lst1[23]); - this.num > 23 ? this.23.random_set_mode(lst1[24]); - this.num > 24 ? this.24.random_set_mode(lst1[25]); - this.num > 25 ? this.25.random_set_mode(lst1[26]); - this.num > 26 ? this.26.random_set_mode(lst1[27]); - this.num > 27 ? this.27.random_set_mode(lst1[28]); - this.num > 28 ? this.28.random_set_mode(lst1[29]); - this.num > 29 ? this.29.random_set_mode(lst1[30]); - this.num > 30 ? this.30.random_set_mode(lst1[31]); - this.num > 31 ? this.31.random_set_mode(lst1[32]); - this.num > 32 ? this.32.random_set_mode(lst1[33]); - this.num > 33 ? this.33.random_set_mode(lst1[34]); - this.num > 34 ? this.34.random_set_mode(lst1[35]); - this.num > 35 ? this.35.random_set_mode(lst1[36]); - this.num > 36 ? this.36.random_set_mode(lst1[37]); - this.num > 37 ? this.37.random_set_mode(lst1[38]); - this.num > 38 ? this.38.random_set_mode(lst1[39]); - this.num > 39 ? this.39.random_set_mode(lst1[40]); -); -function Prandom_do() -( - this.num > 0 ? this.outlist[1] = this.0.random_do(); - this.num > 1 ? this.outlist[2] = this.1.random_do(); - this.num > 2 ? this.outlist[3] = this.2.random_do(); - this.num > 3 ? this.outlist[4] = this.3.random_do(); - this.num > 4 ? this.outlist[5] = this.4.random_do(); - this.num > 5 ? this.outlist[6] = this.5.random_do(); - this.num > 6 ? this.outlist[7] = this.6.random_do(); - this.num > 7 ? this.outlist[8] = this.7.random_do(); - this.num > 8 ? this.outlist[9] = this.8.random_do(); - this.num > 9 ? this.outlist[10] = this.9.random_do(); - this.num > 10 ? this.outlist[11] = this.10.random_do(); - this.num > 11 ? this.outlist[12] = this.11.random_do(); - this.num > 12 ? this.outlist[13] = this.12.random_do(); - this.num > 13 ? this.outlist[14] = this.13.random_do(); - this.num > 14 ? this.outlist[15] = this.14.random_do(); - this.num > 15 ? this.outlist[16] = this.15.random_do(); - this.num > 16 ? this.outlist[17] = this.16.random_do(); - this.num > 17 ? this.outlist[18] = this.17.random_do(); - this.num > 18 ? this.outlist[19] = this.18.random_do(); - this.num > 19 ? this.outlist[20] = this.19.random_do(); - this.num > 20 ? this.outlist[21] = this.20.random_do(); - this.num > 21 ? this.outlist[22] = this.21.random_do(); - this.num > 22 ? this.outlist[23] = this.22.random_do(); - this.num > 23 ? this.outlist[24] = this.23.random_do(); - this.num > 24 ? this.outlist[25] = this.24.random_do(); - this.num > 25 ? this.outlist[26] = this.25.random_do(); - this.num > 26 ? this.outlist[27] = this.26.random_do(); - this.num > 27 ? this.outlist[28] = this.27.random_do(); - this.num > 28 ? this.outlist[29] = this.28.random_do(); - this.num > 29 ? this.outlist[30] = this.29.random_do(); - this.num > 30 ? this.outlist[31] = this.30.random_do(); - this.num > 31 ? this.outlist[32] = this.31.random_do(); - this.num > 32 ? this.outlist[33] = this.32.random_do(); - this.num > 33 ? this.outlist[34] = this.33.random_do(); - this.num > 34 ? this.outlist[35] = this.34.random_do(); - this.num > 35 ? this.outlist[36] = this.35.random_do(); - this.num > 36 ? this.outlist[37] = this.36.random_do(); - this.num > 37 ? this.outlist[38] = this.37.random_do(); - this.num > 38 ? this.outlist[39] = this.38.random_do(); - this.num > 39 ? this.outlist[40] = this.39.random_do(); - this.outlist; -); - -function Pmasr(lst1 lst2) -( - this.num = lst1[0]; - this.outlist = memalloc(this.num + 1); - this.outlist[0] = this.num; - this.num > 0 ? this.0.masr(lst1[1], lst2[1]); - this.num > 1 ? this.1.masr(lst1[2], lst2[2]); - this.num > 2 ? this.2.masr(lst1[3], lst2[3]); - this.num > 3 ? this.3.masr(lst1[4], lst2[4]); - this.num > 4 ? this.4.masr(lst1[5], lst2[5]); - this.num > 5 ? this.5.masr(lst1[6], lst2[6]); - this.num > 6 ? this.6.masr(lst1[7], lst2[7]); - this.num > 7 ? this.7.masr(lst1[8], lst2[8]); - this.num > 8 ? this.8.masr(lst1[9], lst2[9]); - this.num > 9 ? this.9.masr(lst1[10], lst2[10]); - this.num > 10 ? this.10.masr(lst1[11], lst2[11]); - this.num > 11 ? this.11.masr(lst1[12], lst2[12]); - this.num > 12 ? this.12.masr(lst1[13], lst2[13]); - this.num > 13 ? this.13.masr(lst1[14], lst2[14]); - this.num > 14 ? this.14.masr(lst1[15], lst2[15]); - this.num > 15 ? this.15.masr(lst1[16], lst2[16]); - this.num > 16 ? this.16.masr(lst1[17], lst2[17]); - this.num > 17 ? this.17.masr(lst1[18], lst2[18]); - this.num > 18 ? this.18.masr(lst1[19], lst2[19]); - this.num > 19 ? this.19.masr(lst1[20], lst2[20]); - this.num > 20 ? this.20.masr(lst1[21], lst2[21]); - this.num > 21 ? this.21.masr(lst1[22], lst2[22]); - this.num > 22 ? this.22.masr(lst1[23], lst2[23]); - this.num > 23 ? this.23.masr(lst1[24], lst2[24]); - this.num > 24 ? this.24.masr(lst1[25], lst2[25]); - this.num > 25 ? this.25.masr(lst1[26], lst2[26]); - this.num > 26 ? this.26.masr(lst1[27], lst2[27]); - this.num > 27 ? this.27.masr(lst1[28], lst2[28]); - this.num > 28 ? this.28.masr(lst1[29], lst2[29]); - this.num > 29 ? this.29.masr(lst1[30], lst2[30]); - this.num > 30 ? this.30.masr(lst1[31], lst2[31]); - this.num > 31 ? this.31.masr(lst1[32], lst2[32]); - this.num > 32 ? this.32.masr(lst1[33], lst2[33]); - this.num > 33 ? this.33.masr(lst1[34], lst2[34]); - this.num > 34 ? this.34.masr(lst1[35], lst2[35]); - this.num > 35 ? this.35.masr(lst1[36], lst2[36]); - this.num > 36 ? this.36.masr(lst1[37], lst2[37]); - this.num > 37 ? this.37.masr(lst1[38], lst2[38]); - this.num > 38 ? this.38.masr(lst1[39], lst2[39]); - this.num > 39 ? this.39.masr(lst1[40], lst2[40]); -); -function Pmasr_set_risetime(lst1) -( - this.num > 0 ? this.0.masr_set_risetime(lst1[1]); - this.num > 1 ? this.1.masr_set_risetime(lst1[2]); - this.num > 2 ? this.2.masr_set_risetime(lst1[3]); - this.num > 3 ? this.3.masr_set_risetime(lst1[4]); - this.num > 4 ? this.4.masr_set_risetime(lst1[5]); - this.num > 5 ? this.5.masr_set_risetime(lst1[6]); - this.num > 6 ? this.6.masr_set_risetime(lst1[7]); - this.num > 7 ? this.7.masr_set_risetime(lst1[8]); - this.num > 8 ? this.8.masr_set_risetime(lst1[9]); - this.num > 9 ? this.9.masr_set_risetime(lst1[10]); - this.num > 10 ? this.10.masr_set_risetime(lst1[11]); - this.num > 11 ? this.11.masr_set_risetime(lst1[12]); - this.num > 12 ? this.12.masr_set_risetime(lst1[13]); - this.num > 13 ? this.13.masr_set_risetime(lst1[14]); - this.num > 14 ? this.14.masr_set_risetime(lst1[15]); - this.num > 15 ? this.15.masr_set_risetime(lst1[16]); - this.num > 16 ? this.16.masr_set_risetime(lst1[17]); - this.num > 17 ? this.17.masr_set_risetime(lst1[18]); - this.num > 18 ? this.18.masr_set_risetime(lst1[19]); - this.num > 19 ? this.19.masr_set_risetime(lst1[20]); - this.num > 20 ? this.20.masr_set_risetime(lst1[21]); - this.num > 21 ? this.21.masr_set_risetime(lst1[22]); - this.num > 22 ? this.22.masr_set_risetime(lst1[23]); - this.num > 23 ? this.23.masr_set_risetime(lst1[24]); - this.num > 24 ? this.24.masr_set_risetime(lst1[25]); - this.num > 25 ? this.25.masr_set_risetime(lst1[26]); - this.num > 26 ? this.26.masr_set_risetime(lst1[27]); - this.num > 27 ? this.27.masr_set_risetime(lst1[28]); - this.num > 28 ? this.28.masr_set_risetime(lst1[29]); - this.num > 29 ? this.29.masr_set_risetime(lst1[30]); - this.num > 30 ? this.30.masr_set_risetime(lst1[31]); - this.num > 31 ? this.31.masr_set_risetime(lst1[32]); - this.num > 32 ? this.32.masr_set_risetime(lst1[33]); - this.num > 33 ? this.33.masr_set_risetime(lst1[34]); - this.num > 34 ? this.34.masr_set_risetime(lst1[35]); - this.num > 35 ? this.35.masr_set_risetime(lst1[36]); - this.num > 36 ? this.36.masr_set_risetime(lst1[37]); - this.num > 37 ? this.37.masr_set_risetime(lst1[38]); - this.num > 38 ? this.38.masr_set_risetime(lst1[39]); - this.num > 39 ? this.39.masr_set_risetime(lst1[40]); -); -function Pmasr_get_risetime() -( - this.num > 0 ? this.0.masr_get_risetime(); - this.num > 1 ? this.1.masr_get_risetime(); - this.num > 2 ? this.2.masr_get_risetime(); - this.num > 3 ? this.3.masr_get_risetime(); - this.num > 4 ? this.4.masr_get_risetime(); - this.num > 5 ? this.5.masr_get_risetime(); - this.num > 6 ? this.6.masr_get_risetime(); - this.num > 7 ? this.7.masr_get_risetime(); - this.num > 8 ? this.8.masr_get_risetime(); - this.num > 9 ? this.9.masr_get_risetime(); - this.num > 10 ? this.10.masr_get_risetime(); - this.num > 11 ? this.11.masr_get_risetime(); - this.num > 12 ? this.12.masr_get_risetime(); - this.num > 13 ? this.13.masr_get_risetime(); - this.num > 14 ? this.14.masr_get_risetime(); - this.num > 15 ? this.15.masr_get_risetime(); - this.num > 16 ? this.16.masr_get_risetime(); - this.num > 17 ? this.17.masr_get_risetime(); - this.num > 18 ? this.18.masr_get_risetime(); - this.num > 19 ? this.19.masr_get_risetime(); - this.num > 20 ? this.20.masr_get_risetime(); - this.num > 21 ? this.21.masr_get_risetime(); - this.num > 22 ? this.22.masr_get_risetime(); - this.num > 23 ? this.23.masr_get_risetime(); - this.num > 24 ? this.24.masr_get_risetime(); - this.num > 25 ? this.25.masr_get_risetime(); - this.num > 26 ? this.26.masr_get_risetime(); - this.num > 27 ? this.27.masr_get_risetime(); - this.num > 28 ? this.28.masr_get_risetime(); - this.num > 29 ? this.29.masr_get_risetime(); - this.num > 30 ? this.30.masr_get_risetime(); - this.num > 31 ? this.31.masr_get_risetime(); - this.num > 32 ? this.32.masr_get_risetime(); - this.num > 33 ? this.33.masr_get_risetime(); - this.num > 34 ? this.34.masr_get_risetime(); - this.num > 35 ? this.35.masr_get_risetime(); - this.num > 36 ? this.36.masr_get_risetime(); - this.num > 37 ? this.37.masr_get_risetime(); - this.num > 38 ? this.38.masr_get_risetime(); - this.num > 39 ? this.39.masr_get_risetime(); -); -function Pmasr_set_falltime(lst1) -( - this.num > 0 ? this.0.masr_set_falltime(lst1[1]); - this.num > 1 ? this.1.masr_set_falltime(lst1[2]); - this.num > 2 ? this.2.masr_set_falltime(lst1[3]); - this.num > 3 ? this.3.masr_set_falltime(lst1[4]); - this.num > 4 ? this.4.masr_set_falltime(lst1[5]); - this.num > 5 ? this.5.masr_set_falltime(lst1[6]); - this.num > 6 ? this.6.masr_set_falltime(lst1[7]); - this.num > 7 ? this.7.masr_set_falltime(lst1[8]); - this.num > 8 ? this.8.masr_set_falltime(lst1[9]); - this.num > 9 ? this.9.masr_set_falltime(lst1[10]); - this.num > 10 ? this.10.masr_set_falltime(lst1[11]); - this.num > 11 ? this.11.masr_set_falltime(lst1[12]); - this.num > 12 ? this.12.masr_set_falltime(lst1[13]); - this.num > 13 ? this.13.masr_set_falltime(lst1[14]); - this.num > 14 ? this.14.masr_set_falltime(lst1[15]); - this.num > 15 ? this.15.masr_set_falltime(lst1[16]); - this.num > 16 ? this.16.masr_set_falltime(lst1[17]); - this.num > 17 ? this.17.masr_set_falltime(lst1[18]); - this.num > 18 ? this.18.masr_set_falltime(lst1[19]); - this.num > 19 ? this.19.masr_set_falltime(lst1[20]); - this.num > 20 ? this.20.masr_set_falltime(lst1[21]); - this.num > 21 ? this.21.masr_set_falltime(lst1[22]); - this.num > 22 ? this.22.masr_set_falltime(lst1[23]); - this.num > 23 ? this.23.masr_set_falltime(lst1[24]); - this.num > 24 ? this.24.masr_set_falltime(lst1[25]); - this.num > 25 ? this.25.masr_set_falltime(lst1[26]); - this.num > 26 ? this.26.masr_set_falltime(lst1[27]); - this.num > 27 ? this.27.masr_set_falltime(lst1[28]); - this.num > 28 ? this.28.masr_set_falltime(lst1[29]); - this.num > 29 ? this.29.masr_set_falltime(lst1[30]); - this.num > 30 ? this.30.masr_set_falltime(lst1[31]); - this.num > 31 ? this.31.masr_set_falltime(lst1[32]); - this.num > 32 ? this.32.masr_set_falltime(lst1[33]); - this.num > 33 ? this.33.masr_set_falltime(lst1[34]); - this.num > 34 ? this.34.masr_set_falltime(lst1[35]); - this.num > 35 ? this.35.masr_set_falltime(lst1[36]); - this.num > 36 ? this.36.masr_set_falltime(lst1[37]); - this.num > 37 ? this.37.masr_set_falltime(lst1[38]); - this.num > 38 ? this.38.masr_set_falltime(lst1[39]); - this.num > 39 ? this.39.masr_set_falltime(lst1[40]); -); -function Pmasr_get_falltime() -( - this.num > 0 ? this.0.masr_get_falltime(); - this.num > 1 ? this.1.masr_get_falltime(); - this.num > 2 ? this.2.masr_get_falltime(); - this.num > 3 ? this.3.masr_get_falltime(); - this.num > 4 ? this.4.masr_get_falltime(); - this.num > 5 ? this.5.masr_get_falltime(); - this.num > 6 ? this.6.masr_get_falltime(); - this.num > 7 ? this.7.masr_get_falltime(); - this.num > 8 ? this.8.masr_get_falltime(); - this.num > 9 ? this.9.masr_get_falltime(); - this.num > 10 ? this.10.masr_get_falltime(); - this.num > 11 ? this.11.masr_get_falltime(); - this.num > 12 ? this.12.masr_get_falltime(); - this.num > 13 ? this.13.masr_get_falltime(); - this.num > 14 ? this.14.masr_get_falltime(); - this.num > 15 ? this.15.masr_get_falltime(); - this.num > 16 ? this.16.masr_get_falltime(); - this.num > 17 ? this.17.masr_get_falltime(); - this.num > 18 ? this.18.masr_get_falltime(); - this.num > 19 ? this.19.masr_get_falltime(); - this.num > 20 ? this.20.masr_get_falltime(); - this.num > 21 ? this.21.masr_get_falltime(); - this.num > 22 ? this.22.masr_get_falltime(); - this.num > 23 ? this.23.masr_get_falltime(); - this.num > 24 ? this.24.masr_get_falltime(); - this.num > 25 ? this.25.masr_get_falltime(); - this.num > 26 ? this.26.masr_get_falltime(); - this.num > 27 ? this.27.masr_get_falltime(); - this.num > 28 ? this.28.masr_get_falltime(); - this.num > 29 ? this.29.masr_get_falltime(); - this.num > 30 ? this.30.masr_get_falltime(); - this.num > 31 ? this.31.masr_get_falltime(); - this.num > 32 ? this.32.masr_get_falltime(); - this.num > 33 ? this.33.masr_get_falltime(); - this.num > 34 ? this.34.masr_get_falltime(); - this.num > 35 ? this.35.masr_get_falltime(); - this.num > 36 ? this.36.masr_get_falltime(); - this.num > 37 ? this.37.masr_get_falltime(); - this.num > 38 ? this.38.masr_get_falltime(); - this.num > 39 ? this.39.masr_get_falltime(); -); -function Pmasr_do(signal) -( - num = signal[0]; - this.num > 0 ? this.outlist[1] = this.0.masr_do(signal[(0 % num) + 1]); - this.num > 1 ? this.outlist[2] = this.1.masr_do(signal[(1 % num) + 1]); - this.num > 2 ? this.outlist[3] = this.2.masr_do(signal[(2 % num) + 1]); - this.num > 3 ? this.outlist[4] = this.3.masr_do(signal[(3 % num) + 1]); - this.num > 4 ? this.outlist[5] = this.4.masr_do(signal[(4 % num) + 1]); - this.num > 5 ? this.outlist[6] = this.5.masr_do(signal[(5 % num) + 1]); - this.num > 6 ? this.outlist[7] = this.6.masr_do(signal[(6 % num) + 1]); - this.num > 7 ? this.outlist[8] = this.7.masr_do(signal[(7 % num) + 1]); - this.num > 8 ? this.outlist[9] = this.8.masr_do(signal[(8 % num) + 1]); - this.num > 9 ? this.outlist[10] = this.9.masr_do(signal[(9 % num) + 1]); - this.num > 10 ? this.outlist[11] = this.10.masr_do(signal[(10 % num) + 1]); - this.num > 11 ? this.outlist[12] = this.11.masr_do(signal[(11 % num) + 1]); - this.num > 12 ? this.outlist[13] = this.12.masr_do(signal[(12 % num) + 1]); - this.num > 13 ? this.outlist[14] = this.13.masr_do(signal[(13 % num) + 1]); - this.num > 14 ? this.outlist[15] = this.14.masr_do(signal[(14 % num) + 1]); - this.num > 15 ? this.outlist[16] = this.15.masr_do(signal[(15 % num) + 1]); - this.num > 16 ? this.outlist[17] = this.16.masr_do(signal[(16 % num) + 1]); - this.num > 17 ? this.outlist[18] = this.17.masr_do(signal[(17 % num) + 1]); - this.num > 18 ? this.outlist[19] = this.18.masr_do(signal[(18 % num) + 1]); - this.num > 19 ? this.outlist[20] = this.19.masr_do(signal[(19 % num) + 1]); - this.num > 20 ? this.outlist[21] = this.20.masr_do(signal[(20 % num) + 1]); - this.num > 21 ? this.outlist[22] = this.21.masr_do(signal[(21 % num) + 1]); - this.num > 22 ? this.outlist[23] = this.22.masr_do(signal[(22 % num) + 1]); - this.num > 23 ? this.outlist[24] = this.23.masr_do(signal[(23 % num) + 1]); - this.num > 24 ? this.outlist[25] = this.24.masr_do(signal[(24 % num) + 1]); - this.num > 25 ? this.outlist[26] = this.25.masr_do(signal[(25 % num) + 1]); - this.num > 26 ? this.outlist[27] = this.26.masr_do(signal[(26 % num) + 1]); - this.num > 27 ? this.outlist[28] = this.27.masr_do(signal[(27 % num) + 1]); - this.num > 28 ? this.outlist[29] = this.28.masr_do(signal[(28 % num) + 1]); - this.num > 29 ? this.outlist[30] = this.29.masr_do(signal[(29 % num) + 1]); - this.num > 30 ? this.outlist[31] = this.30.masr_do(signal[(30 % num) + 1]); - this.num > 31 ? this.outlist[32] = this.31.masr_do(signal[(31 % num) + 1]); - this.num > 32 ? this.outlist[33] = this.32.masr_do(signal[(32 % num) + 1]); - this.num > 33 ? this.outlist[34] = this.33.masr_do(signal[(33 % num) + 1]); - this.num > 34 ? this.outlist[35] = this.34.masr_do(signal[(34 % num) + 1]); - this.num > 35 ? this.outlist[36] = this.35.masr_do(signal[(35 % num) + 1]); - this.num > 36 ? this.outlist[37] = this.36.masr_do(signal[(36 % num) + 1]); - this.num > 37 ? this.outlist[38] = this.37.masr_do(signal[(37 % num) + 1]); - this.num > 38 ? this.outlist[39] = this.38.masr_do(signal[(38 % num) + 1]); - this.num > 39 ? this.outlist[40] = this.39.masr_do(signal[(39 % num) + 1]); - this.outlist; -); - -function Pcompress(lst1 lst2 lst3 lst4 lst5) -( - this.num = lst1[0]; - this.outlist = memalloc(this.num + 1); - this.outlist[0] = this.num; - this.num > 0 ? this.0.compress(lst1[1], lst2[1], lst3[1], lst4[1], lst5[1]); - this.num > 1 ? this.1.compress(lst1[2], lst2[2], lst3[2], lst4[2], lst5[2]); - this.num > 2 ? this.2.compress(lst1[3], lst2[3], lst3[3], lst4[3], lst5[3]); - this.num > 3 ? this.3.compress(lst1[4], lst2[4], lst3[4], lst4[4], lst5[4]); - this.num > 4 ? this.4.compress(lst1[5], lst2[5], lst3[5], lst4[5], lst5[5]); - this.num > 5 ? this.5.compress(lst1[6], lst2[6], lst3[6], lst4[6], lst5[6]); - this.num > 6 ? this.6.compress(lst1[7], lst2[7], lst3[7], lst4[7], lst5[7]); - this.num > 7 ? this.7.compress(lst1[8], lst2[8], lst3[8], lst4[8], lst5[8]); - this.num > 8 ? this.8.compress(lst1[9], lst2[9], lst3[9], lst4[9], lst5[9]); - this.num > 9 ? this.9.compress(lst1[10], lst2[10], lst3[10], lst4[10], lst5[10]); - this.num > 10 ? this.10.compress(lst1[11], lst2[11], lst3[11], lst4[11], lst5[11]); - this.num > 11 ? this.11.compress(lst1[12], lst2[12], lst3[12], lst4[12], lst5[12]); - this.num > 12 ? this.12.compress(lst1[13], lst2[13], lst3[13], lst4[13], lst5[13]); - this.num > 13 ? this.13.compress(lst1[14], lst2[14], lst3[14], lst4[14], lst5[14]); - this.num > 14 ? this.14.compress(lst1[15], lst2[15], lst3[15], lst4[15], lst5[15]); - this.num > 15 ? this.15.compress(lst1[16], lst2[16], lst3[16], lst4[16], lst5[16]); - this.num > 16 ? this.16.compress(lst1[17], lst2[17], lst3[17], lst4[17], lst5[17]); - this.num > 17 ? this.17.compress(lst1[18], lst2[18], lst3[18], lst4[18], lst5[18]); - this.num > 18 ? this.18.compress(lst1[19], lst2[19], lst3[19], lst4[19], lst5[19]); - this.num > 19 ? this.19.compress(lst1[20], lst2[20], lst3[20], lst4[20], lst5[20]); - this.num > 20 ? this.20.compress(lst1[21], lst2[21], lst3[21], lst4[21], lst5[21]); - this.num > 21 ? this.21.compress(lst1[22], lst2[22], lst3[22], lst4[22], lst5[22]); - this.num > 22 ? this.22.compress(lst1[23], lst2[23], lst3[23], lst4[23], lst5[23]); - this.num > 23 ? this.23.compress(lst1[24], lst2[24], lst3[24], lst4[24], lst5[24]); - this.num > 24 ? this.24.compress(lst1[25], lst2[25], lst3[25], lst4[25], lst5[25]); - this.num > 25 ? this.25.compress(lst1[26], lst2[26], lst3[26], lst4[26], lst5[26]); - this.num > 26 ? this.26.compress(lst1[27], lst2[27], lst3[27], lst4[27], lst5[27]); - this.num > 27 ? this.27.compress(lst1[28], lst2[28], lst3[28], lst4[28], lst5[28]); - this.num > 28 ? this.28.compress(lst1[29], lst2[29], lst3[29], lst4[29], lst5[29]); - this.num > 29 ? this.29.compress(lst1[30], lst2[30], lst3[30], lst4[30], lst5[30]); - this.num > 30 ? this.30.compress(lst1[31], lst2[31], lst3[31], lst4[31], lst5[31]); - this.num > 31 ? this.31.compress(lst1[32], lst2[32], lst3[32], lst4[32], lst5[32]); - this.num > 32 ? this.32.compress(lst1[33], lst2[33], lst3[33], lst4[33], lst5[33]); - this.num > 33 ? this.33.compress(lst1[34], lst2[34], lst3[34], lst4[34], lst5[34]); - this.num > 34 ? this.34.compress(lst1[35], lst2[35], lst3[35], lst4[35], lst5[35]); - this.num > 35 ? this.35.compress(lst1[36], lst2[36], lst3[36], lst4[36], lst5[36]); - this.num > 36 ? this.36.compress(lst1[37], lst2[37], lst3[37], lst4[37], lst5[37]); - this.num > 37 ? this.37.compress(lst1[38], lst2[38], lst3[38], lst4[38], lst5[38]); - this.num > 38 ? this.38.compress(lst1[39], lst2[39], lst3[39], lst4[39], lst5[39]); - this.num > 39 ? this.39.compress(lst1[40], lst2[40], lst3[40], lst4[40], lst5[40]); -); -function Pcompress_set_thresh(lst1) -( - this.num > 0 ? this.0.compress_set_thresh(lst1[1]); - this.num > 1 ? this.1.compress_set_thresh(lst1[2]); - this.num > 2 ? this.2.compress_set_thresh(lst1[3]); - this.num > 3 ? this.3.compress_set_thresh(lst1[4]); - this.num > 4 ? this.4.compress_set_thresh(lst1[5]); - this.num > 5 ? this.5.compress_set_thresh(lst1[6]); - this.num > 6 ? this.6.compress_set_thresh(lst1[7]); - this.num > 7 ? this.7.compress_set_thresh(lst1[8]); - this.num > 8 ? this.8.compress_set_thresh(lst1[9]); - this.num > 9 ? this.9.compress_set_thresh(lst1[10]); - this.num > 10 ? this.10.compress_set_thresh(lst1[11]); - this.num > 11 ? this.11.compress_set_thresh(lst1[12]); - this.num > 12 ? this.12.compress_set_thresh(lst1[13]); - this.num > 13 ? this.13.compress_set_thresh(lst1[14]); - this.num > 14 ? this.14.compress_set_thresh(lst1[15]); - this.num > 15 ? this.15.compress_set_thresh(lst1[16]); - this.num > 16 ? this.16.compress_set_thresh(lst1[17]); - this.num > 17 ? this.17.compress_set_thresh(lst1[18]); - this.num > 18 ? this.18.compress_set_thresh(lst1[19]); - this.num > 19 ? this.19.compress_set_thresh(lst1[20]); - this.num > 20 ? this.20.compress_set_thresh(lst1[21]); - this.num > 21 ? this.21.compress_set_thresh(lst1[22]); - this.num > 22 ? this.22.compress_set_thresh(lst1[23]); - this.num > 23 ? this.23.compress_set_thresh(lst1[24]); - this.num > 24 ? this.24.compress_set_thresh(lst1[25]); - this.num > 25 ? this.25.compress_set_thresh(lst1[26]); - this.num > 26 ? this.26.compress_set_thresh(lst1[27]); - this.num > 27 ? this.27.compress_set_thresh(lst1[28]); - this.num > 28 ? this.28.compress_set_thresh(lst1[29]); - this.num > 29 ? this.29.compress_set_thresh(lst1[30]); - this.num > 30 ? this.30.compress_set_thresh(lst1[31]); - this.num > 31 ? this.31.compress_set_thresh(lst1[32]); - this.num > 32 ? this.32.compress_set_thresh(lst1[33]); - this.num > 33 ? this.33.compress_set_thresh(lst1[34]); - this.num > 34 ? this.34.compress_set_thresh(lst1[35]); - this.num > 35 ? this.35.compress_set_thresh(lst1[36]); - this.num > 36 ? this.36.compress_set_thresh(lst1[37]); - this.num > 37 ? this.37.compress_set_thresh(lst1[38]); - this.num > 38 ? this.38.compress_set_thresh(lst1[39]); - this.num > 39 ? this.39.compress_set_thresh(lst1[40]); -); -function Pcompress_set_ratio(lst1) -( - this.num > 0 ? this.0.compress_set_ratio(lst1[1]); - this.num > 1 ? this.1.compress_set_ratio(lst1[2]); - this.num > 2 ? this.2.compress_set_ratio(lst1[3]); - this.num > 3 ? this.3.compress_set_ratio(lst1[4]); - this.num > 4 ? this.4.compress_set_ratio(lst1[5]); - this.num > 5 ? this.5.compress_set_ratio(lst1[6]); - this.num > 6 ? this.6.compress_set_ratio(lst1[7]); - this.num > 7 ? this.7.compress_set_ratio(lst1[8]); - this.num > 8 ? this.8.compress_set_ratio(lst1[9]); - this.num > 9 ? this.9.compress_set_ratio(lst1[10]); - this.num > 10 ? this.10.compress_set_ratio(lst1[11]); - this.num > 11 ? this.11.compress_set_ratio(lst1[12]); - this.num > 12 ? this.12.compress_set_ratio(lst1[13]); - this.num > 13 ? this.13.compress_set_ratio(lst1[14]); - this.num > 14 ? this.14.compress_set_ratio(lst1[15]); - this.num > 15 ? this.15.compress_set_ratio(lst1[16]); - this.num > 16 ? this.16.compress_set_ratio(lst1[17]); - this.num > 17 ? this.17.compress_set_ratio(lst1[18]); - this.num > 18 ? this.18.compress_set_ratio(lst1[19]); - this.num > 19 ? this.19.compress_set_ratio(lst1[20]); - this.num > 20 ? this.20.compress_set_ratio(lst1[21]); - this.num > 21 ? this.21.compress_set_ratio(lst1[22]); - this.num > 22 ? this.22.compress_set_ratio(lst1[23]); - this.num > 23 ? this.23.compress_set_ratio(lst1[24]); - this.num > 24 ? this.24.compress_set_ratio(lst1[25]); - this.num > 25 ? this.25.compress_set_ratio(lst1[26]); - this.num > 26 ? this.26.compress_set_ratio(lst1[27]); - this.num > 27 ? this.27.compress_set_ratio(lst1[28]); - this.num > 28 ? this.28.compress_set_ratio(lst1[29]); - this.num > 29 ? this.29.compress_set_ratio(lst1[30]); - this.num > 30 ? this.30.compress_set_ratio(lst1[31]); - this.num > 31 ? this.31.compress_set_ratio(lst1[32]); - this.num > 32 ? this.32.compress_set_ratio(lst1[33]); - this.num > 33 ? this.33.compress_set_ratio(lst1[34]); - this.num > 34 ? this.34.compress_set_ratio(lst1[35]); - this.num > 35 ? this.35.compress_set_ratio(lst1[36]); - this.num > 36 ? this.36.compress_set_ratio(lst1[37]); - this.num > 37 ? this.37.compress_set_ratio(lst1[38]); - this.num > 38 ? this.38.compress_set_ratio(lst1[39]); - this.num > 39 ? this.39.compress_set_ratio(lst1[40]); -); -function Pcompress_set_attack(lst1) -( - this.num > 0 ? this.0.compress_set_attack(lst1[1]); - this.num > 1 ? this.1.compress_set_attack(lst1[2]); - this.num > 2 ? this.2.compress_set_attack(lst1[3]); - this.num > 3 ? this.3.compress_set_attack(lst1[4]); - this.num > 4 ? this.4.compress_set_attack(lst1[5]); - this.num > 5 ? this.5.compress_set_attack(lst1[6]); - this.num > 6 ? this.6.compress_set_attack(lst1[7]); - this.num > 7 ? this.7.compress_set_attack(lst1[8]); - this.num > 8 ? this.8.compress_set_attack(lst1[9]); - this.num > 9 ? this.9.compress_set_attack(lst1[10]); - this.num > 10 ? this.10.compress_set_attack(lst1[11]); - this.num > 11 ? this.11.compress_set_attack(lst1[12]); - this.num > 12 ? this.12.compress_set_attack(lst1[13]); - this.num > 13 ? this.13.compress_set_attack(lst1[14]); - this.num > 14 ? this.14.compress_set_attack(lst1[15]); - this.num > 15 ? this.15.compress_set_attack(lst1[16]); - this.num > 16 ? this.16.compress_set_attack(lst1[17]); - this.num > 17 ? this.17.compress_set_attack(lst1[18]); - this.num > 18 ? this.18.compress_set_attack(lst1[19]); - this.num > 19 ? this.19.compress_set_attack(lst1[20]); - this.num > 20 ? this.20.compress_set_attack(lst1[21]); - this.num > 21 ? this.21.compress_set_attack(lst1[22]); - this.num > 22 ? this.22.compress_set_attack(lst1[23]); - this.num > 23 ? this.23.compress_set_attack(lst1[24]); - this.num > 24 ? this.24.compress_set_attack(lst1[25]); - this.num > 25 ? this.25.compress_set_attack(lst1[26]); - this.num > 26 ? this.26.compress_set_attack(lst1[27]); - this.num > 27 ? this.27.compress_set_attack(lst1[28]); - this.num > 28 ? this.28.compress_set_attack(lst1[29]); - this.num > 29 ? this.29.compress_set_attack(lst1[30]); - this.num > 30 ? this.30.compress_set_attack(lst1[31]); - this.num > 31 ? this.31.compress_set_attack(lst1[32]); - this.num > 32 ? this.32.compress_set_attack(lst1[33]); - this.num > 33 ? this.33.compress_set_attack(lst1[34]); - this.num > 34 ? this.34.compress_set_attack(lst1[35]); - this.num > 35 ? this.35.compress_set_attack(lst1[36]); - this.num > 36 ? this.36.compress_set_attack(lst1[37]); - this.num > 37 ? this.37.compress_set_attack(lst1[38]); - this.num > 38 ? this.38.compress_set_attack(lst1[39]); - this.num > 39 ? this.39.compress_set_attack(lst1[40]); -); -function Pcompress_set_release(lst1) -( - this.num > 0 ? this.0.compress_set_release(lst1[1]); - this.num > 1 ? this.1.compress_set_release(lst1[2]); - this.num > 2 ? this.2.compress_set_release(lst1[3]); - this.num > 3 ? this.3.compress_set_release(lst1[4]); - this.num > 4 ? this.4.compress_set_release(lst1[5]); - this.num > 5 ? this.5.compress_set_release(lst1[6]); - this.num > 6 ? this.6.compress_set_release(lst1[7]); - this.num > 7 ? this.7.compress_set_release(lst1[8]); - this.num > 8 ? this.8.compress_set_release(lst1[9]); - this.num > 9 ? this.9.compress_set_release(lst1[10]); - this.num > 10 ? this.10.compress_set_release(lst1[11]); - this.num > 11 ? this.11.compress_set_release(lst1[12]); - this.num > 12 ? this.12.compress_set_release(lst1[13]); - this.num > 13 ? this.13.compress_set_release(lst1[14]); - this.num > 14 ? this.14.compress_set_release(lst1[15]); - this.num > 15 ? this.15.compress_set_release(lst1[16]); - this.num > 16 ? this.16.compress_set_release(lst1[17]); - this.num > 17 ? this.17.compress_set_release(lst1[18]); - this.num > 18 ? this.18.compress_set_release(lst1[19]); - this.num > 19 ? this.19.compress_set_release(lst1[20]); - this.num > 20 ? this.20.compress_set_release(lst1[21]); - this.num > 21 ? this.21.compress_set_release(lst1[22]); - this.num > 22 ? this.22.compress_set_release(lst1[23]); - this.num > 23 ? this.23.compress_set_release(lst1[24]); - this.num > 24 ? this.24.compress_set_release(lst1[25]); - this.num > 25 ? this.25.compress_set_release(lst1[26]); - this.num > 26 ? this.26.compress_set_release(lst1[27]); - this.num > 27 ? this.27.compress_set_release(lst1[28]); - this.num > 28 ? this.28.compress_set_release(lst1[29]); - this.num > 29 ? this.29.compress_set_release(lst1[30]); - this.num > 30 ? this.30.compress_set_release(lst1[31]); - this.num > 31 ? this.31.compress_set_release(lst1[32]); - this.num > 32 ? this.32.compress_set_release(lst1[33]); - this.num > 33 ? this.33.compress_set_release(lst1[34]); - this.num > 34 ? this.34.compress_set_release(lst1[35]); - this.num > 35 ? this.35.compress_set_release(lst1[36]); - this.num > 36 ? this.36.compress_set_release(lst1[37]); - this.num > 37 ? this.37.compress_set_release(lst1[38]); - this.num > 38 ? this.38.compress_set_release(lst1[39]); - this.num > 39 ? this.39.compress_set_release(lst1[40]); -); -function Pcompress_set_lookahead(lst1) -( - this.num > 0 ? this.0.compress_set_lookahead(lst1[1]); - this.num > 1 ? this.1.compress_set_lookahead(lst1[2]); - this.num > 2 ? this.2.compress_set_lookahead(lst1[3]); - this.num > 3 ? this.3.compress_set_lookahead(lst1[4]); - this.num > 4 ? this.4.compress_set_lookahead(lst1[5]); - this.num > 5 ? this.5.compress_set_lookahead(lst1[6]); - this.num > 6 ? this.6.compress_set_lookahead(lst1[7]); - this.num > 7 ? this.7.compress_set_lookahead(lst1[8]); - this.num > 8 ? this.8.compress_set_lookahead(lst1[9]); - this.num > 9 ? this.9.compress_set_lookahead(lst1[10]); - this.num > 10 ? this.10.compress_set_lookahead(lst1[11]); - this.num > 11 ? this.11.compress_set_lookahead(lst1[12]); - this.num > 12 ? this.12.compress_set_lookahead(lst1[13]); - this.num > 13 ? this.13.compress_set_lookahead(lst1[14]); - this.num > 14 ? this.14.compress_set_lookahead(lst1[15]); - this.num > 15 ? this.15.compress_set_lookahead(lst1[16]); - this.num > 16 ? this.16.compress_set_lookahead(lst1[17]); - this.num > 17 ? this.17.compress_set_lookahead(lst1[18]); - this.num > 18 ? this.18.compress_set_lookahead(lst1[19]); - this.num > 19 ? this.19.compress_set_lookahead(lst1[20]); - this.num > 20 ? this.20.compress_set_lookahead(lst1[21]); - this.num > 21 ? this.21.compress_set_lookahead(lst1[22]); - this.num > 22 ? this.22.compress_set_lookahead(lst1[23]); - this.num > 23 ? this.23.compress_set_lookahead(lst1[24]); - this.num > 24 ? this.24.compress_set_lookahead(lst1[25]); - this.num > 25 ? this.25.compress_set_lookahead(lst1[26]); - this.num > 26 ? this.26.compress_set_lookahead(lst1[27]); - this.num > 27 ? this.27.compress_set_lookahead(lst1[28]); - this.num > 28 ? this.28.compress_set_lookahead(lst1[29]); - this.num > 29 ? this.29.compress_set_lookahead(lst1[30]); - this.num > 30 ? this.30.compress_set_lookahead(lst1[31]); - this.num > 31 ? this.31.compress_set_lookahead(lst1[32]); - this.num > 32 ? this.32.compress_set_lookahead(lst1[33]); - this.num > 33 ? this.33.compress_set_lookahead(lst1[34]); - this.num > 34 ? this.34.compress_set_lookahead(lst1[35]); - this.num > 35 ? this.35.compress_set_lookahead(lst1[36]); - this.num > 36 ? this.36.compress_set_lookahead(lst1[37]); - this.num > 37 ? this.37.compress_set_lookahead(lst1[38]); - this.num > 38 ? this.38.compress_set_lookahead(lst1[39]); - this.num > 39 ? this.39.compress_set_lookahead(lst1[40]); -); -function Pcompress_do(signal) -( - num = signal[0]; - this.num > 0 ? this.outlist[1] = this.0.compress_do(signal[(0 % num) + 1]); - this.num > 1 ? this.outlist[2] = this.1.compress_do(signal[(1 % num) + 1]); - this.num > 2 ? this.outlist[3] = this.2.compress_do(signal[(2 % num) + 1]); - this.num > 3 ? this.outlist[4] = this.3.compress_do(signal[(3 % num) + 1]); - this.num > 4 ? this.outlist[5] = this.4.compress_do(signal[(4 % num) + 1]); - this.num > 5 ? this.outlist[6] = this.5.compress_do(signal[(5 % num) + 1]); - this.num > 6 ? this.outlist[7] = this.6.compress_do(signal[(6 % num) + 1]); - this.num > 7 ? this.outlist[8] = this.7.compress_do(signal[(7 % num) + 1]); - this.num > 8 ? this.outlist[9] = this.8.compress_do(signal[(8 % num) + 1]); - this.num > 9 ? this.outlist[10] = this.9.compress_do(signal[(9 % num) + 1]); - this.num > 10 ? this.outlist[11] = this.10.compress_do(signal[(10 % num) + 1]); - this.num > 11 ? this.outlist[12] = this.11.compress_do(signal[(11 % num) + 1]); - this.num > 12 ? this.outlist[13] = this.12.compress_do(signal[(12 % num) + 1]); - this.num > 13 ? this.outlist[14] = this.13.compress_do(signal[(13 % num) + 1]); - this.num > 14 ? this.outlist[15] = this.14.compress_do(signal[(14 % num) + 1]); - this.num > 15 ? this.outlist[16] = this.15.compress_do(signal[(15 % num) + 1]); - this.num > 16 ? this.outlist[17] = this.16.compress_do(signal[(16 % num) + 1]); - this.num > 17 ? this.outlist[18] = this.17.compress_do(signal[(17 % num) + 1]); - this.num > 18 ? this.outlist[19] = this.18.compress_do(signal[(18 % num) + 1]); - this.num > 19 ? this.outlist[20] = this.19.compress_do(signal[(19 % num) + 1]); - this.num > 20 ? this.outlist[21] = this.20.compress_do(signal[(20 % num) + 1]); - this.num > 21 ? this.outlist[22] = this.21.compress_do(signal[(21 % num) + 1]); - this.num > 22 ? this.outlist[23] = this.22.compress_do(signal[(22 % num) + 1]); - this.num > 23 ? this.outlist[24] = this.23.compress_do(signal[(23 % num) + 1]); - this.num > 24 ? this.outlist[25] = this.24.compress_do(signal[(24 % num) + 1]); - this.num > 25 ? this.outlist[26] = this.25.compress_do(signal[(25 % num) + 1]); - this.num > 26 ? this.outlist[27] = this.26.compress_do(signal[(26 % num) + 1]); - this.num > 27 ? this.outlist[28] = this.27.compress_do(signal[(27 % num) + 1]); - this.num > 28 ? this.outlist[29] = this.28.compress_do(signal[(28 % num) + 1]); - this.num > 29 ? this.outlist[30] = this.29.compress_do(signal[(29 % num) + 1]); - this.num > 30 ? this.outlist[31] = this.30.compress_do(signal[(30 % num) + 1]); - this.num > 31 ? this.outlist[32] = this.31.compress_do(signal[(31 % num) + 1]); - this.num > 32 ? this.outlist[33] = this.32.compress_do(signal[(32 % num) + 1]); - this.num > 33 ? this.outlist[34] = this.33.compress_do(signal[(33 % num) + 1]); - this.num > 34 ? this.outlist[35] = this.34.compress_do(signal[(34 % num) + 1]); - this.num > 35 ? this.outlist[36] = this.35.compress_do(signal[(35 % num) + 1]); - this.num > 36 ? this.outlist[37] = this.36.compress_do(signal[(36 % num) + 1]); - this.num > 37 ? this.outlist[38] = this.37.compress_do(signal[(37 % num) + 1]); - this.num > 38 ? this.outlist[39] = this.38.compress_do(signal[(38 % num) + 1]); - this.num > 39 ? this.outlist[40] = this.39.compress_do(signal[(39 % num) + 1]); - this.outlist; -); - -function Pgate(lst1 lst2 lst3 lst4) -( - this.num = lst1[0]; - this.outlist = memalloc(this.num + 1); - this.outlist[0] = this.num; - this.num > 0 ? this.0.gate(lst1[1], lst2[1], lst3[1], lst4[1]); - this.num > 1 ? this.1.gate(lst1[2], lst2[2], lst3[2], lst4[2]); - this.num > 2 ? this.2.gate(lst1[3], lst2[3], lst3[3], lst4[3]); - this.num > 3 ? this.3.gate(lst1[4], lst2[4], lst3[4], lst4[4]); - this.num > 4 ? this.4.gate(lst1[5], lst2[5], lst3[5], lst4[5]); - this.num > 5 ? this.5.gate(lst1[6], lst2[6], lst3[6], lst4[6]); - this.num > 6 ? this.6.gate(lst1[7], lst2[7], lst3[7], lst4[7]); - this.num > 7 ? this.7.gate(lst1[8], lst2[8], lst3[8], lst4[8]); - this.num > 8 ? this.8.gate(lst1[9], lst2[9], lst3[9], lst4[9]); - this.num > 9 ? this.9.gate(lst1[10], lst2[10], lst3[10], lst4[10]); - this.num > 10 ? this.10.gate(lst1[11], lst2[11], lst3[11], lst4[11]); - this.num > 11 ? this.11.gate(lst1[12], lst2[12], lst3[12], lst4[12]); - this.num > 12 ? this.12.gate(lst1[13], lst2[13], lst3[13], lst4[13]); - this.num > 13 ? this.13.gate(lst1[14], lst2[14], lst3[14], lst4[14]); - this.num > 14 ? this.14.gate(lst1[15], lst2[15], lst3[15], lst4[15]); - this.num > 15 ? this.15.gate(lst1[16], lst2[16], lst3[16], lst4[16]); - this.num > 16 ? this.16.gate(lst1[17], lst2[17], lst3[17], lst4[17]); - this.num > 17 ? this.17.gate(lst1[18], lst2[18], lst3[18], lst4[18]); - this.num > 18 ? this.18.gate(lst1[19], lst2[19], lst3[19], lst4[19]); - this.num > 19 ? this.19.gate(lst1[20], lst2[20], lst3[20], lst4[20]); - this.num > 20 ? this.20.gate(lst1[21], lst2[21], lst3[21], lst4[21]); - this.num > 21 ? this.21.gate(lst1[22], lst2[22], lst3[22], lst4[22]); - this.num > 22 ? this.22.gate(lst1[23], lst2[23], lst3[23], lst4[23]); - this.num > 23 ? this.23.gate(lst1[24], lst2[24], lst3[24], lst4[24]); - this.num > 24 ? this.24.gate(lst1[25], lst2[25], lst3[25], lst4[25]); - this.num > 25 ? this.25.gate(lst1[26], lst2[26], lst3[26], lst4[26]); - this.num > 26 ? this.26.gate(lst1[27], lst2[27], lst3[27], lst4[27]); - this.num > 27 ? this.27.gate(lst1[28], lst2[28], lst3[28], lst4[28]); - this.num > 28 ? this.28.gate(lst1[29], lst2[29], lst3[29], lst4[29]); - this.num > 29 ? this.29.gate(lst1[30], lst2[30], lst3[30], lst4[30]); - this.num > 30 ? this.30.gate(lst1[31], lst2[31], lst3[31], lst4[31]); - this.num > 31 ? this.31.gate(lst1[32], lst2[32], lst3[32], lst4[32]); - this.num > 32 ? this.32.gate(lst1[33], lst2[33], lst3[33], lst4[33]); - this.num > 33 ? this.33.gate(lst1[34], lst2[34], lst3[34], lst4[34]); - this.num > 34 ? this.34.gate(lst1[35], lst2[35], lst3[35], lst4[35]); - this.num > 35 ? this.35.gate(lst1[36], lst2[36], lst3[36], lst4[36]); - this.num > 36 ? this.36.gate(lst1[37], lst2[37], lst3[37], lst4[37]); - this.num > 37 ? this.37.gate(lst1[38], lst2[38], lst3[38], lst4[38]); - this.num > 38 ? this.38.gate(lst1[39], lst2[39], lst3[39], lst4[39]); - this.num > 39 ? this.39.gate(lst1[40], lst2[40], lst3[40], lst4[40]); -); -function Pgate_set_thresh(lst1) -( - this.num > 0 ? this.0.gate_set_thresh(lst1[1]); - this.num > 1 ? this.1.gate_set_thresh(lst1[2]); - this.num > 2 ? this.2.gate_set_thresh(lst1[3]); - this.num > 3 ? this.3.gate_set_thresh(lst1[4]); - this.num > 4 ? this.4.gate_set_thresh(lst1[5]); - this.num > 5 ? this.5.gate_set_thresh(lst1[6]); - this.num > 6 ? this.6.gate_set_thresh(lst1[7]); - this.num > 7 ? this.7.gate_set_thresh(lst1[8]); - this.num > 8 ? this.8.gate_set_thresh(lst1[9]); - this.num > 9 ? this.9.gate_set_thresh(lst1[10]); - this.num > 10 ? this.10.gate_set_thresh(lst1[11]); - this.num > 11 ? this.11.gate_set_thresh(lst1[12]); - this.num > 12 ? this.12.gate_set_thresh(lst1[13]); - this.num > 13 ? this.13.gate_set_thresh(lst1[14]); - this.num > 14 ? this.14.gate_set_thresh(lst1[15]); - this.num > 15 ? this.15.gate_set_thresh(lst1[16]); - this.num > 16 ? this.16.gate_set_thresh(lst1[17]); - this.num > 17 ? this.17.gate_set_thresh(lst1[18]); - this.num > 18 ? this.18.gate_set_thresh(lst1[19]); - this.num > 19 ? this.19.gate_set_thresh(lst1[20]); - this.num > 20 ? this.20.gate_set_thresh(lst1[21]); - this.num > 21 ? this.21.gate_set_thresh(lst1[22]); - this.num > 22 ? this.22.gate_set_thresh(lst1[23]); - this.num > 23 ? this.23.gate_set_thresh(lst1[24]); - this.num > 24 ? this.24.gate_set_thresh(lst1[25]); - this.num > 25 ? this.25.gate_set_thresh(lst1[26]); - this.num > 26 ? this.26.gate_set_thresh(lst1[27]); - this.num > 27 ? this.27.gate_set_thresh(lst1[28]); - this.num > 28 ? this.28.gate_set_thresh(lst1[29]); - this.num > 29 ? this.29.gate_set_thresh(lst1[30]); - this.num > 30 ? this.30.gate_set_thresh(lst1[31]); - this.num > 31 ? this.31.gate_set_thresh(lst1[32]); - this.num > 32 ? this.32.gate_set_thresh(lst1[33]); - this.num > 33 ? this.33.gate_set_thresh(lst1[34]); - this.num > 34 ? this.34.gate_set_thresh(lst1[35]); - this.num > 35 ? this.35.gate_set_thresh(lst1[36]); - this.num > 36 ? this.36.gate_set_thresh(lst1[37]); - this.num > 37 ? this.37.gate_set_thresh(lst1[38]); - this.num > 38 ? this.38.gate_set_thresh(lst1[39]); - this.num > 39 ? this.39.gate_set_thresh(lst1[40]); -); -function Pgate_set_attack(lst1) -( - this.num > 0 ? this.0.gate_set_attack(lst1[1]); - this.num > 1 ? this.1.gate_set_attack(lst1[2]); - this.num > 2 ? this.2.gate_set_attack(lst1[3]); - this.num > 3 ? this.3.gate_set_attack(lst1[4]); - this.num > 4 ? this.4.gate_set_attack(lst1[5]); - this.num > 5 ? this.5.gate_set_attack(lst1[6]); - this.num > 6 ? this.6.gate_set_attack(lst1[7]); - this.num > 7 ? this.7.gate_set_attack(lst1[8]); - this.num > 8 ? this.8.gate_set_attack(lst1[9]); - this.num > 9 ? this.9.gate_set_attack(lst1[10]); - this.num > 10 ? this.10.gate_set_attack(lst1[11]); - this.num > 11 ? this.11.gate_set_attack(lst1[12]); - this.num > 12 ? this.12.gate_set_attack(lst1[13]); - this.num > 13 ? this.13.gate_set_attack(lst1[14]); - this.num > 14 ? this.14.gate_set_attack(lst1[15]); - this.num > 15 ? this.15.gate_set_attack(lst1[16]); - this.num > 16 ? this.16.gate_set_attack(lst1[17]); - this.num > 17 ? this.17.gate_set_attack(lst1[18]); - this.num > 18 ? this.18.gate_set_attack(lst1[19]); - this.num > 19 ? this.19.gate_set_attack(lst1[20]); - this.num > 20 ? this.20.gate_set_attack(lst1[21]); - this.num > 21 ? this.21.gate_set_attack(lst1[22]); - this.num > 22 ? this.22.gate_set_attack(lst1[23]); - this.num > 23 ? this.23.gate_set_attack(lst1[24]); - this.num > 24 ? this.24.gate_set_attack(lst1[25]); - this.num > 25 ? this.25.gate_set_attack(lst1[26]); - this.num > 26 ? this.26.gate_set_attack(lst1[27]); - this.num > 27 ? this.27.gate_set_attack(lst1[28]); - this.num > 28 ? this.28.gate_set_attack(lst1[29]); - this.num > 29 ? this.29.gate_set_attack(lst1[30]); - this.num > 30 ? this.30.gate_set_attack(lst1[31]); - this.num > 31 ? this.31.gate_set_attack(lst1[32]); - this.num > 32 ? this.32.gate_set_attack(lst1[33]); - this.num > 33 ? this.33.gate_set_attack(lst1[34]); - this.num > 34 ? this.34.gate_set_attack(lst1[35]); - this.num > 35 ? this.35.gate_set_attack(lst1[36]); - this.num > 36 ? this.36.gate_set_attack(lst1[37]); - this.num > 37 ? this.37.gate_set_attack(lst1[38]); - this.num > 38 ? this.38.gate_set_attack(lst1[39]); - this.num > 39 ? this.39.gate_set_attack(lst1[40]); -); -function Pgate_set_release(lst1) -( - this.num > 0 ? this.0.gate_set_release(lst1[1]); - this.num > 1 ? this.1.gate_set_release(lst1[2]); - this.num > 2 ? this.2.gate_set_release(lst1[3]); - this.num > 3 ? this.3.gate_set_release(lst1[4]); - this.num > 4 ? this.4.gate_set_release(lst1[5]); - this.num > 5 ? this.5.gate_set_release(lst1[6]); - this.num > 6 ? this.6.gate_set_release(lst1[7]); - this.num > 7 ? this.7.gate_set_release(lst1[8]); - this.num > 8 ? this.8.gate_set_release(lst1[9]); - this.num > 9 ? this.9.gate_set_release(lst1[10]); - this.num > 10 ? this.10.gate_set_release(lst1[11]); - this.num > 11 ? this.11.gate_set_release(lst1[12]); - this.num > 12 ? this.12.gate_set_release(lst1[13]); - this.num > 13 ? this.13.gate_set_release(lst1[14]); - this.num > 14 ? this.14.gate_set_release(lst1[15]); - this.num > 15 ? this.15.gate_set_release(lst1[16]); - this.num > 16 ? this.16.gate_set_release(lst1[17]); - this.num > 17 ? this.17.gate_set_release(lst1[18]); - this.num > 18 ? this.18.gate_set_release(lst1[19]); - this.num > 19 ? this.19.gate_set_release(lst1[20]); - this.num > 20 ? this.20.gate_set_release(lst1[21]); - this.num > 21 ? this.21.gate_set_release(lst1[22]); - this.num > 22 ? this.22.gate_set_release(lst1[23]); - this.num > 23 ? this.23.gate_set_release(lst1[24]); - this.num > 24 ? this.24.gate_set_release(lst1[25]); - this.num > 25 ? this.25.gate_set_release(lst1[26]); - this.num > 26 ? this.26.gate_set_release(lst1[27]); - this.num > 27 ? this.27.gate_set_release(lst1[28]); - this.num > 28 ? this.28.gate_set_release(lst1[29]); - this.num > 29 ? this.29.gate_set_release(lst1[30]); - this.num > 30 ? this.30.gate_set_release(lst1[31]); - this.num > 31 ? this.31.gate_set_release(lst1[32]); - this.num > 32 ? this.32.gate_set_release(lst1[33]); - this.num > 33 ? this.33.gate_set_release(lst1[34]); - this.num > 34 ? this.34.gate_set_release(lst1[35]); - this.num > 35 ? this.35.gate_set_release(lst1[36]); - this.num > 36 ? this.36.gate_set_release(lst1[37]); - this.num > 37 ? this.37.gate_set_release(lst1[38]); - this.num > 38 ? this.38.gate_set_release(lst1[39]); - this.num > 39 ? this.39.gate_set_release(lst1[40]); -); -function Pgate_set_lookahead(lst1) -( - this.num > 0 ? this.0.gate_set_lookahead(lst1[1]); - this.num > 1 ? this.1.gate_set_lookahead(lst1[2]); - this.num > 2 ? this.2.gate_set_lookahead(lst1[3]); - this.num > 3 ? this.3.gate_set_lookahead(lst1[4]); - this.num > 4 ? this.4.gate_set_lookahead(lst1[5]); - this.num > 5 ? this.5.gate_set_lookahead(lst1[6]); - this.num > 6 ? this.6.gate_set_lookahead(lst1[7]); - this.num > 7 ? this.7.gate_set_lookahead(lst1[8]); - this.num > 8 ? this.8.gate_set_lookahead(lst1[9]); - this.num > 9 ? this.9.gate_set_lookahead(lst1[10]); - this.num > 10 ? this.10.gate_set_lookahead(lst1[11]); - this.num > 11 ? this.11.gate_set_lookahead(lst1[12]); - this.num > 12 ? this.12.gate_set_lookahead(lst1[13]); - this.num > 13 ? this.13.gate_set_lookahead(lst1[14]); - this.num > 14 ? this.14.gate_set_lookahead(lst1[15]); - this.num > 15 ? this.15.gate_set_lookahead(lst1[16]); - this.num > 16 ? this.16.gate_set_lookahead(lst1[17]); - this.num > 17 ? this.17.gate_set_lookahead(lst1[18]); - this.num > 18 ? this.18.gate_set_lookahead(lst1[19]); - this.num > 19 ? this.19.gate_set_lookahead(lst1[20]); - this.num > 20 ? this.20.gate_set_lookahead(lst1[21]); - this.num > 21 ? this.21.gate_set_lookahead(lst1[22]); - this.num > 22 ? this.22.gate_set_lookahead(lst1[23]); - this.num > 23 ? this.23.gate_set_lookahead(lst1[24]); - this.num > 24 ? this.24.gate_set_lookahead(lst1[25]); - this.num > 25 ? this.25.gate_set_lookahead(lst1[26]); - this.num > 26 ? this.26.gate_set_lookahead(lst1[27]); - this.num > 27 ? this.27.gate_set_lookahead(lst1[28]); - this.num > 28 ? this.28.gate_set_lookahead(lst1[29]); - this.num > 29 ? this.29.gate_set_lookahead(lst1[30]); - this.num > 30 ? this.30.gate_set_lookahead(lst1[31]); - this.num > 31 ? this.31.gate_set_lookahead(lst1[32]); - this.num > 32 ? this.32.gate_set_lookahead(lst1[33]); - this.num > 33 ? this.33.gate_set_lookahead(lst1[34]); - this.num > 34 ? this.34.gate_set_lookahead(lst1[35]); - this.num > 35 ? this.35.gate_set_lookahead(lst1[36]); - this.num > 36 ? this.36.gate_set_lookahead(lst1[37]); - this.num > 37 ? this.37.gate_set_lookahead(lst1[38]); - this.num > 38 ? this.38.gate_set_lookahead(lst1[39]); - this.num > 39 ? this.39.gate_set_lookahead(lst1[40]); -); -function Pgate_do(signal) -( - num = signal[0]; - this.num > 0 ? this.outlist[1] = this.0.gate_do(signal[(0 % num) + 1]); - this.num > 1 ? this.outlist[2] = this.1.gate_do(signal[(1 % num) + 1]); - this.num > 2 ? this.outlist[3] = this.2.gate_do(signal[(2 % num) + 1]); - this.num > 3 ? this.outlist[4] = this.3.gate_do(signal[(3 % num) + 1]); - this.num > 4 ? this.outlist[5] = this.4.gate_do(signal[(4 % num) + 1]); - this.num > 5 ? this.outlist[6] = this.5.gate_do(signal[(5 % num) + 1]); - this.num > 6 ? this.outlist[7] = this.6.gate_do(signal[(6 % num) + 1]); - this.num > 7 ? this.outlist[8] = this.7.gate_do(signal[(7 % num) + 1]); - this.num > 8 ? this.outlist[9] = this.8.gate_do(signal[(8 % num) + 1]); - this.num > 9 ? this.outlist[10] = this.9.gate_do(signal[(9 % num) + 1]); - this.num > 10 ? this.outlist[11] = this.10.gate_do(signal[(10 % num) + 1]); - this.num > 11 ? this.outlist[12] = this.11.gate_do(signal[(11 % num) + 1]); - this.num > 12 ? this.outlist[13] = this.12.gate_do(signal[(12 % num) + 1]); - this.num > 13 ? this.outlist[14] = this.13.gate_do(signal[(13 % num) + 1]); - this.num > 14 ? this.outlist[15] = this.14.gate_do(signal[(14 % num) + 1]); - this.num > 15 ? this.outlist[16] = this.15.gate_do(signal[(15 % num) + 1]); - this.num > 16 ? this.outlist[17] = this.16.gate_do(signal[(16 % num) + 1]); - this.num > 17 ? this.outlist[18] = this.17.gate_do(signal[(17 % num) + 1]); - this.num > 18 ? this.outlist[19] = this.18.gate_do(signal[(18 % num) + 1]); - this.num > 19 ? this.outlist[20] = this.19.gate_do(signal[(19 % num) + 1]); - this.num > 20 ? this.outlist[21] = this.20.gate_do(signal[(20 % num) + 1]); - this.num > 21 ? this.outlist[22] = this.21.gate_do(signal[(21 % num) + 1]); - this.num > 22 ? this.outlist[23] = this.22.gate_do(signal[(22 % num) + 1]); - this.num > 23 ? this.outlist[24] = this.23.gate_do(signal[(23 % num) + 1]); - this.num > 24 ? this.outlist[25] = this.24.gate_do(signal[(24 % num) + 1]); - this.num > 25 ? this.outlist[26] = this.25.gate_do(signal[(25 % num) + 1]); - this.num > 26 ? this.outlist[27] = this.26.gate_do(signal[(26 % num) + 1]); - this.num > 27 ? this.outlist[28] = this.27.gate_do(signal[(27 % num) + 1]); - this.num > 28 ? this.outlist[29] = this.28.gate_do(signal[(28 % num) + 1]); - this.num > 29 ? this.outlist[30] = this.29.gate_do(signal[(29 % num) + 1]); - this.num > 30 ? this.outlist[31] = this.30.gate_do(signal[(30 % num) + 1]); - this.num > 31 ? this.outlist[32] = this.31.gate_do(signal[(31 % num) + 1]); - this.num > 32 ? this.outlist[33] = this.32.gate_do(signal[(32 % num) + 1]); - this.num > 33 ? this.outlist[34] = this.33.gate_do(signal[(33 % num) + 1]); - this.num > 34 ? this.outlist[35] = this.34.gate_do(signal[(34 % num) + 1]); - this.num > 35 ? this.outlist[36] = this.35.gate_do(signal[(35 % num) + 1]); - this.num > 36 ? this.outlist[37] = this.36.gate_do(signal[(36 % num) + 1]); - this.num > 37 ? this.outlist[38] = this.37.gate_do(signal[(37 % num) + 1]); - this.num > 38 ? this.outlist[39] = this.38.gate_do(signal[(38 % num) + 1]); - this.num > 39 ? this.outlist[40] = this.39.gate_do(signal[(39 % num) + 1]); - this.outlist; -); - -function Pexpand(lst1 lst2 lst3 lst4 lst5 lst6) -( - this.num = lst1[0]; - this.outlist = memalloc(this.num + 1); - this.outlist[0] = this.num; - this.num > 0 ? this.0.expand(lst1[1], lst2[1], lst3[1], lst4[1], lst5[1], lst6[1]); - this.num > 1 ? this.1.expand(lst1[2], lst2[2], lst3[2], lst4[2], lst5[2], lst6[2]); - this.num > 2 ? this.2.expand(lst1[3], lst2[3], lst3[3], lst4[3], lst5[3], lst6[3]); - this.num > 3 ? this.3.expand(lst1[4], lst2[4], lst3[4], lst4[4], lst5[4], lst6[4]); - this.num > 4 ? this.4.expand(lst1[5], lst2[5], lst3[5], lst4[5], lst5[5], lst6[5]); - this.num > 5 ? this.5.expand(lst1[6], lst2[6], lst3[6], lst4[6], lst5[6], lst6[6]); - this.num > 6 ? this.6.expand(lst1[7], lst2[7], lst3[7], lst4[7], lst5[7], lst6[7]); - this.num > 7 ? this.7.expand(lst1[8], lst2[8], lst3[8], lst4[8], lst5[8], lst6[8]); - this.num > 8 ? this.8.expand(lst1[9], lst2[9], lst3[9], lst4[9], lst5[9], lst6[9]); - this.num > 9 ? this.9.expand(lst1[10], lst2[10], lst3[10], lst4[10], lst5[10], lst6[10]); - this.num > 10 ? this.10.expand(lst1[11], lst2[11], lst3[11], lst4[11], lst5[11], lst6[11]); - this.num > 11 ? this.11.expand(lst1[12], lst2[12], lst3[12], lst4[12], lst5[12], lst6[12]); - this.num > 12 ? this.12.expand(lst1[13], lst2[13], lst3[13], lst4[13], lst5[13], lst6[13]); - this.num > 13 ? this.13.expand(lst1[14], lst2[14], lst3[14], lst4[14], lst5[14], lst6[14]); - this.num > 14 ? this.14.expand(lst1[15], lst2[15], lst3[15], lst4[15], lst5[15], lst6[15]); - this.num > 15 ? this.15.expand(lst1[16], lst2[16], lst3[16], lst4[16], lst5[16], lst6[16]); - this.num > 16 ? this.16.expand(lst1[17], lst2[17], lst3[17], lst4[17], lst5[17], lst6[17]); - this.num > 17 ? this.17.expand(lst1[18], lst2[18], lst3[18], lst4[18], lst5[18], lst6[18]); - this.num > 18 ? this.18.expand(lst1[19], lst2[19], lst3[19], lst4[19], lst5[19], lst6[19]); - this.num > 19 ? this.19.expand(lst1[20], lst2[20], lst3[20], lst4[20], lst5[20], lst6[20]); - this.num > 20 ? this.20.expand(lst1[21], lst2[21], lst3[21], lst4[21], lst5[21], lst6[21]); - this.num > 21 ? this.21.expand(lst1[22], lst2[22], lst3[22], lst4[22], lst5[22], lst6[22]); - this.num > 22 ? this.22.expand(lst1[23], lst2[23], lst3[23], lst4[23], lst5[23], lst6[23]); - this.num > 23 ? this.23.expand(lst1[24], lst2[24], lst3[24], lst4[24], lst5[24], lst6[24]); - this.num > 24 ? this.24.expand(lst1[25], lst2[25], lst3[25], lst4[25], lst5[25], lst6[25]); - this.num > 25 ? this.25.expand(lst1[26], lst2[26], lst3[26], lst4[26], lst5[26], lst6[26]); - this.num > 26 ? this.26.expand(lst1[27], lst2[27], lst3[27], lst4[27], lst5[27], lst6[27]); - this.num > 27 ? this.27.expand(lst1[28], lst2[28], lst3[28], lst4[28], lst5[28], lst6[28]); - this.num > 28 ? this.28.expand(lst1[29], lst2[29], lst3[29], lst4[29], lst5[29], lst6[29]); - this.num > 29 ? this.29.expand(lst1[30], lst2[30], lst3[30], lst4[30], lst5[30], lst6[30]); - this.num > 30 ? this.30.expand(lst1[31], lst2[31], lst3[31], lst4[31], lst5[31], lst6[31]); - this.num > 31 ? this.31.expand(lst1[32], lst2[32], lst3[32], lst4[32], lst5[32], lst6[32]); - this.num > 32 ? this.32.expand(lst1[33], lst2[33], lst3[33], lst4[33], lst5[33], lst6[33]); - this.num > 33 ? this.33.expand(lst1[34], lst2[34], lst3[34], lst4[34], lst5[34], lst6[34]); - this.num > 34 ? this.34.expand(lst1[35], lst2[35], lst3[35], lst4[35], lst5[35], lst6[35]); - this.num > 35 ? this.35.expand(lst1[36], lst2[36], lst3[36], lst4[36], lst5[36], lst6[36]); - this.num > 36 ? this.36.expand(lst1[37], lst2[37], lst3[37], lst4[37], lst5[37], lst6[37]); - this.num > 37 ? this.37.expand(lst1[38], lst2[38], lst3[38], lst4[38], lst5[38], lst6[38]); - this.num > 38 ? this.38.expand(lst1[39], lst2[39], lst3[39], lst4[39], lst5[39], lst6[39]); - this.num > 39 ? this.39.expand(lst1[40], lst2[40], lst3[40], lst4[40], lst5[40], lst6[40]); -); -function Pexpand_set_upthresh(lst1) -( - this.num > 0 ? this.0.expand_set_upthresh(lst1[1]); - this.num > 1 ? this.1.expand_set_upthresh(lst1[2]); - this.num > 2 ? this.2.expand_set_upthresh(lst1[3]); - this.num > 3 ? this.3.expand_set_upthresh(lst1[4]); - this.num > 4 ? this.4.expand_set_upthresh(lst1[5]); - this.num > 5 ? this.5.expand_set_upthresh(lst1[6]); - this.num > 6 ? this.6.expand_set_upthresh(lst1[7]); - this.num > 7 ? this.7.expand_set_upthresh(lst1[8]); - this.num > 8 ? this.8.expand_set_upthresh(lst1[9]); - this.num > 9 ? this.9.expand_set_upthresh(lst1[10]); - this.num > 10 ? this.10.expand_set_upthresh(lst1[11]); - this.num > 11 ? this.11.expand_set_upthresh(lst1[12]); - this.num > 12 ? this.12.expand_set_upthresh(lst1[13]); - this.num > 13 ? this.13.expand_set_upthresh(lst1[14]); - this.num > 14 ? this.14.expand_set_upthresh(lst1[15]); - this.num > 15 ? this.15.expand_set_upthresh(lst1[16]); - this.num > 16 ? this.16.expand_set_upthresh(lst1[17]); - this.num > 17 ? this.17.expand_set_upthresh(lst1[18]); - this.num > 18 ? this.18.expand_set_upthresh(lst1[19]); - this.num > 19 ? this.19.expand_set_upthresh(lst1[20]); - this.num > 20 ? this.20.expand_set_upthresh(lst1[21]); - this.num > 21 ? this.21.expand_set_upthresh(lst1[22]); - this.num > 22 ? this.22.expand_set_upthresh(lst1[23]); - this.num > 23 ? this.23.expand_set_upthresh(lst1[24]); - this.num > 24 ? this.24.expand_set_upthresh(lst1[25]); - this.num > 25 ? this.25.expand_set_upthresh(lst1[26]); - this.num > 26 ? this.26.expand_set_upthresh(lst1[27]); - this.num > 27 ? this.27.expand_set_upthresh(lst1[28]); - this.num > 28 ? this.28.expand_set_upthresh(lst1[29]); - this.num > 29 ? this.29.expand_set_upthresh(lst1[30]); - this.num > 30 ? this.30.expand_set_upthresh(lst1[31]); - this.num > 31 ? this.31.expand_set_upthresh(lst1[32]); - this.num > 32 ? this.32.expand_set_upthresh(lst1[33]); - this.num > 33 ? this.33.expand_set_upthresh(lst1[34]); - this.num > 34 ? this.34.expand_set_upthresh(lst1[35]); - this.num > 35 ? this.35.expand_set_upthresh(lst1[36]); - this.num > 36 ? this.36.expand_set_upthresh(lst1[37]); - this.num > 37 ? this.37.expand_set_upthresh(lst1[38]); - this.num > 38 ? this.38.expand_set_upthresh(lst1[39]); - this.num > 39 ? this.39.expand_set_upthresh(lst1[40]); -); -function Pexpand_set_downthresh(lst1) -( - this.num > 0 ? this.0.expand_set_downthresh(lst1[1]); - this.num > 1 ? this.1.expand_set_downthresh(lst1[2]); - this.num > 2 ? this.2.expand_set_downthresh(lst1[3]); - this.num > 3 ? this.3.expand_set_downthresh(lst1[4]); - this.num > 4 ? this.4.expand_set_downthresh(lst1[5]); - this.num > 5 ? this.5.expand_set_downthresh(lst1[6]); - this.num > 6 ? this.6.expand_set_downthresh(lst1[7]); - this.num > 7 ? this.7.expand_set_downthresh(lst1[8]); - this.num > 8 ? this.8.expand_set_downthresh(lst1[9]); - this.num > 9 ? this.9.expand_set_downthresh(lst1[10]); - this.num > 10 ? this.10.expand_set_downthresh(lst1[11]); - this.num > 11 ? this.11.expand_set_downthresh(lst1[12]); - this.num > 12 ? this.12.expand_set_downthresh(lst1[13]); - this.num > 13 ? this.13.expand_set_downthresh(lst1[14]); - this.num > 14 ? this.14.expand_set_downthresh(lst1[15]); - this.num > 15 ? this.15.expand_set_downthresh(lst1[16]); - this.num > 16 ? this.16.expand_set_downthresh(lst1[17]); - this.num > 17 ? this.17.expand_set_downthresh(lst1[18]); - this.num > 18 ? this.18.expand_set_downthresh(lst1[19]); - this.num > 19 ? this.19.expand_set_downthresh(lst1[20]); - this.num > 20 ? this.20.expand_set_downthresh(lst1[21]); - this.num > 21 ? this.21.expand_set_downthresh(lst1[22]); - this.num > 22 ? this.22.expand_set_downthresh(lst1[23]); - this.num > 23 ? this.23.expand_set_downthresh(lst1[24]); - this.num > 24 ? this.24.expand_set_downthresh(lst1[25]); - this.num > 25 ? this.25.expand_set_downthresh(lst1[26]); - this.num > 26 ? this.26.expand_set_downthresh(lst1[27]); - this.num > 27 ? this.27.expand_set_downthresh(lst1[28]); - this.num > 28 ? this.28.expand_set_downthresh(lst1[29]); - this.num > 29 ? this.29.expand_set_downthresh(lst1[30]); - this.num > 30 ? this.30.expand_set_downthresh(lst1[31]); - this.num > 31 ? this.31.expand_set_downthresh(lst1[32]); - this.num > 32 ? this.32.expand_set_downthresh(lst1[33]); - this.num > 33 ? this.33.expand_set_downthresh(lst1[34]); - this.num > 34 ? this.34.expand_set_downthresh(lst1[35]); - this.num > 35 ? this.35.expand_set_downthresh(lst1[36]); - this.num > 36 ? this.36.expand_set_downthresh(lst1[37]); - this.num > 37 ? this.37.expand_set_downthresh(lst1[38]); - this.num > 38 ? this.38.expand_set_downthresh(lst1[39]); - this.num > 39 ? this.39.expand_set_downthresh(lst1[40]); -); -function Pexpand_set_ratio(lst1) -( - this.num > 0 ? this.0.expand_set_ratio(lst1[1]); - this.num > 1 ? this.1.expand_set_ratio(lst1[2]); - this.num > 2 ? this.2.expand_set_ratio(lst1[3]); - this.num > 3 ? this.3.expand_set_ratio(lst1[4]); - this.num > 4 ? this.4.expand_set_ratio(lst1[5]); - this.num > 5 ? this.5.expand_set_ratio(lst1[6]); - this.num > 6 ? this.6.expand_set_ratio(lst1[7]); - this.num > 7 ? this.7.expand_set_ratio(lst1[8]); - this.num > 8 ? this.8.expand_set_ratio(lst1[9]); - this.num > 9 ? this.9.expand_set_ratio(lst1[10]); - this.num > 10 ? this.10.expand_set_ratio(lst1[11]); - this.num > 11 ? this.11.expand_set_ratio(lst1[12]); - this.num > 12 ? this.12.expand_set_ratio(lst1[13]); - this.num > 13 ? this.13.expand_set_ratio(lst1[14]); - this.num > 14 ? this.14.expand_set_ratio(lst1[15]); - this.num > 15 ? this.15.expand_set_ratio(lst1[16]); - this.num > 16 ? this.16.expand_set_ratio(lst1[17]); - this.num > 17 ? this.17.expand_set_ratio(lst1[18]); - this.num > 18 ? this.18.expand_set_ratio(lst1[19]); - this.num > 19 ? this.19.expand_set_ratio(lst1[20]); - this.num > 20 ? this.20.expand_set_ratio(lst1[21]); - this.num > 21 ? this.21.expand_set_ratio(lst1[22]); - this.num > 22 ? this.22.expand_set_ratio(lst1[23]); - this.num > 23 ? this.23.expand_set_ratio(lst1[24]); - this.num > 24 ? this.24.expand_set_ratio(lst1[25]); - this.num > 25 ? this.25.expand_set_ratio(lst1[26]); - this.num > 26 ? this.26.expand_set_ratio(lst1[27]); - this.num > 27 ? this.27.expand_set_ratio(lst1[28]); - this.num > 28 ? this.28.expand_set_ratio(lst1[29]); - this.num > 29 ? this.29.expand_set_ratio(lst1[30]); - this.num > 30 ? this.30.expand_set_ratio(lst1[31]); - this.num > 31 ? this.31.expand_set_ratio(lst1[32]); - this.num > 32 ? this.32.expand_set_ratio(lst1[33]); - this.num > 33 ? this.33.expand_set_ratio(lst1[34]); - this.num > 34 ? this.34.expand_set_ratio(lst1[35]); - this.num > 35 ? this.35.expand_set_ratio(lst1[36]); - this.num > 36 ? this.36.expand_set_ratio(lst1[37]); - this.num > 37 ? this.37.expand_set_ratio(lst1[38]); - this.num > 38 ? this.38.expand_set_ratio(lst1[39]); - this.num > 39 ? this.39.expand_set_ratio(lst1[40]); -); -function Pexpand_set_attack(lst1) -( - this.num > 0 ? this.0.expand_set_attack(lst1[1]); - this.num > 1 ? this.1.expand_set_attack(lst1[2]); - this.num > 2 ? this.2.expand_set_attack(lst1[3]); - this.num > 3 ? this.3.expand_set_attack(lst1[4]); - this.num > 4 ? this.4.expand_set_attack(lst1[5]); - this.num > 5 ? this.5.expand_set_attack(lst1[6]); - this.num > 6 ? this.6.expand_set_attack(lst1[7]); - this.num > 7 ? this.7.expand_set_attack(lst1[8]); - this.num > 8 ? this.8.expand_set_attack(lst1[9]); - this.num > 9 ? this.9.expand_set_attack(lst1[10]); - this.num > 10 ? this.10.expand_set_attack(lst1[11]); - this.num > 11 ? this.11.expand_set_attack(lst1[12]); - this.num > 12 ? this.12.expand_set_attack(lst1[13]); - this.num > 13 ? this.13.expand_set_attack(lst1[14]); - this.num > 14 ? this.14.expand_set_attack(lst1[15]); - this.num > 15 ? this.15.expand_set_attack(lst1[16]); - this.num > 16 ? this.16.expand_set_attack(lst1[17]); - this.num > 17 ? this.17.expand_set_attack(lst1[18]); - this.num > 18 ? this.18.expand_set_attack(lst1[19]); - this.num > 19 ? this.19.expand_set_attack(lst1[20]); - this.num > 20 ? this.20.expand_set_attack(lst1[21]); - this.num > 21 ? this.21.expand_set_attack(lst1[22]); - this.num > 22 ? this.22.expand_set_attack(lst1[23]); - this.num > 23 ? this.23.expand_set_attack(lst1[24]); - this.num > 24 ? this.24.expand_set_attack(lst1[25]); - this.num > 25 ? this.25.expand_set_attack(lst1[26]); - this.num > 26 ? this.26.expand_set_attack(lst1[27]); - this.num > 27 ? this.27.expand_set_attack(lst1[28]); - this.num > 28 ? this.28.expand_set_attack(lst1[29]); - this.num > 29 ? this.29.expand_set_attack(lst1[30]); - this.num > 30 ? this.30.expand_set_attack(lst1[31]); - this.num > 31 ? this.31.expand_set_attack(lst1[32]); - this.num > 32 ? this.32.expand_set_attack(lst1[33]); - this.num > 33 ? this.33.expand_set_attack(lst1[34]); - this.num > 34 ? this.34.expand_set_attack(lst1[35]); - this.num > 35 ? this.35.expand_set_attack(lst1[36]); - this.num > 36 ? this.36.expand_set_attack(lst1[37]); - this.num > 37 ? this.37.expand_set_attack(lst1[38]); - this.num > 38 ? this.38.expand_set_attack(lst1[39]); - this.num > 39 ? this.39.expand_set_attack(lst1[40]); -); -function Pexpand_set_release(lst1) -( - this.num > 0 ? this.0.expand_set_release(lst1[1]); - this.num > 1 ? this.1.expand_set_release(lst1[2]); - this.num > 2 ? this.2.expand_set_release(lst1[3]); - this.num > 3 ? this.3.expand_set_release(lst1[4]); - this.num > 4 ? this.4.expand_set_release(lst1[5]); - this.num > 5 ? this.5.expand_set_release(lst1[6]); - this.num > 6 ? this.6.expand_set_release(lst1[7]); - this.num > 7 ? this.7.expand_set_release(lst1[8]); - this.num > 8 ? this.8.expand_set_release(lst1[9]); - this.num > 9 ? this.9.expand_set_release(lst1[10]); - this.num > 10 ? this.10.expand_set_release(lst1[11]); - this.num > 11 ? this.11.expand_set_release(lst1[12]); - this.num > 12 ? this.12.expand_set_release(lst1[13]); - this.num > 13 ? this.13.expand_set_release(lst1[14]); - this.num > 14 ? this.14.expand_set_release(lst1[15]); - this.num > 15 ? this.15.expand_set_release(lst1[16]); - this.num > 16 ? this.16.expand_set_release(lst1[17]); - this.num > 17 ? this.17.expand_set_release(lst1[18]); - this.num > 18 ? this.18.expand_set_release(lst1[19]); - this.num > 19 ? this.19.expand_set_release(lst1[20]); - this.num > 20 ? this.20.expand_set_release(lst1[21]); - this.num > 21 ? this.21.expand_set_release(lst1[22]); - this.num > 22 ? this.22.expand_set_release(lst1[23]); - this.num > 23 ? this.23.expand_set_release(lst1[24]); - this.num > 24 ? this.24.expand_set_release(lst1[25]); - this.num > 25 ? this.25.expand_set_release(lst1[26]); - this.num > 26 ? this.26.expand_set_release(lst1[27]); - this.num > 27 ? this.27.expand_set_release(lst1[28]); - this.num > 28 ? this.28.expand_set_release(lst1[29]); - this.num > 29 ? this.29.expand_set_release(lst1[30]); - this.num > 30 ? this.30.expand_set_release(lst1[31]); - this.num > 31 ? this.31.expand_set_release(lst1[32]); - this.num > 32 ? this.32.expand_set_release(lst1[33]); - this.num > 33 ? this.33.expand_set_release(lst1[34]); - this.num > 34 ? this.34.expand_set_release(lst1[35]); - this.num > 35 ? this.35.expand_set_release(lst1[36]); - this.num > 36 ? this.36.expand_set_release(lst1[37]); - this.num > 37 ? this.37.expand_set_release(lst1[38]); - this.num > 38 ? this.38.expand_set_release(lst1[39]); - this.num > 39 ? this.39.expand_set_release(lst1[40]); -); -function Pexpand_set_lookahead(lst1) -( - this.num > 0 ? this.0.expand_set_lookahead(lst1[1]); - this.num > 1 ? this.1.expand_set_lookahead(lst1[2]); - this.num > 2 ? this.2.expand_set_lookahead(lst1[3]); - this.num > 3 ? this.3.expand_set_lookahead(lst1[4]); - this.num > 4 ? this.4.expand_set_lookahead(lst1[5]); - this.num > 5 ? this.5.expand_set_lookahead(lst1[6]); - this.num > 6 ? this.6.expand_set_lookahead(lst1[7]); - this.num > 7 ? this.7.expand_set_lookahead(lst1[8]); - this.num > 8 ? this.8.expand_set_lookahead(lst1[9]); - this.num > 9 ? this.9.expand_set_lookahead(lst1[10]); - this.num > 10 ? this.10.expand_set_lookahead(lst1[11]); - this.num > 11 ? this.11.expand_set_lookahead(lst1[12]); - this.num > 12 ? this.12.expand_set_lookahead(lst1[13]); - this.num > 13 ? this.13.expand_set_lookahead(lst1[14]); - this.num > 14 ? this.14.expand_set_lookahead(lst1[15]); - this.num > 15 ? this.15.expand_set_lookahead(lst1[16]); - this.num > 16 ? this.16.expand_set_lookahead(lst1[17]); - this.num > 17 ? this.17.expand_set_lookahead(lst1[18]); - this.num > 18 ? this.18.expand_set_lookahead(lst1[19]); - this.num > 19 ? this.19.expand_set_lookahead(lst1[20]); - this.num > 20 ? this.20.expand_set_lookahead(lst1[21]); - this.num > 21 ? this.21.expand_set_lookahead(lst1[22]); - this.num > 22 ? this.22.expand_set_lookahead(lst1[23]); - this.num > 23 ? this.23.expand_set_lookahead(lst1[24]); - this.num > 24 ? this.24.expand_set_lookahead(lst1[25]); - this.num > 25 ? this.25.expand_set_lookahead(lst1[26]); - this.num > 26 ? this.26.expand_set_lookahead(lst1[27]); - this.num > 27 ? this.27.expand_set_lookahead(lst1[28]); - this.num > 28 ? this.28.expand_set_lookahead(lst1[29]); - this.num > 29 ? this.29.expand_set_lookahead(lst1[30]); - this.num > 30 ? this.30.expand_set_lookahead(lst1[31]); - this.num > 31 ? this.31.expand_set_lookahead(lst1[32]); - this.num > 32 ? this.32.expand_set_lookahead(lst1[33]); - this.num > 33 ? this.33.expand_set_lookahead(lst1[34]); - this.num > 34 ? this.34.expand_set_lookahead(lst1[35]); - this.num > 35 ? this.35.expand_set_lookahead(lst1[36]); - this.num > 36 ? this.36.expand_set_lookahead(lst1[37]); - this.num > 37 ? this.37.expand_set_lookahead(lst1[38]); - this.num > 38 ? this.38.expand_set_lookahead(lst1[39]); - this.num > 39 ? this.39.expand_set_lookahead(lst1[40]); -); -function Pexpand_do(signal) -( - num = signal[0]; - this.num > 0 ? this.outlist[1] = this.0.expand_do(signal[(0 % num) + 1]); - this.num > 1 ? this.outlist[2] = this.1.expand_do(signal[(1 % num) + 1]); - this.num > 2 ? this.outlist[3] = this.2.expand_do(signal[(2 % num) + 1]); - this.num > 3 ? this.outlist[4] = this.3.expand_do(signal[(3 % num) + 1]); - this.num > 4 ? this.outlist[5] = this.4.expand_do(signal[(4 % num) + 1]); - this.num > 5 ? this.outlist[6] = this.5.expand_do(signal[(5 % num) + 1]); - this.num > 6 ? this.outlist[7] = this.6.expand_do(signal[(6 % num) + 1]); - this.num > 7 ? this.outlist[8] = this.7.expand_do(signal[(7 % num) + 1]); - this.num > 8 ? this.outlist[9] = this.8.expand_do(signal[(8 % num) + 1]); - this.num > 9 ? this.outlist[10] = this.9.expand_do(signal[(9 % num) + 1]); - this.num > 10 ? this.outlist[11] = this.10.expand_do(signal[(10 % num) + 1]); - this.num > 11 ? this.outlist[12] = this.11.expand_do(signal[(11 % num) + 1]); - this.num > 12 ? this.outlist[13] = this.12.expand_do(signal[(12 % num) + 1]); - this.num > 13 ? this.outlist[14] = this.13.expand_do(signal[(13 % num) + 1]); - this.num > 14 ? this.outlist[15] = this.14.expand_do(signal[(14 % num) + 1]); - this.num > 15 ? this.outlist[16] = this.15.expand_do(signal[(15 % num) + 1]); - this.num > 16 ? this.outlist[17] = this.16.expand_do(signal[(16 % num) + 1]); - this.num > 17 ? this.outlist[18] = this.17.expand_do(signal[(17 % num) + 1]); - this.num > 18 ? this.outlist[19] = this.18.expand_do(signal[(18 % num) + 1]); - this.num > 19 ? this.outlist[20] = this.19.expand_do(signal[(19 % num) + 1]); - this.num > 20 ? this.outlist[21] = this.20.expand_do(signal[(20 % num) + 1]); - this.num > 21 ? this.outlist[22] = this.21.expand_do(signal[(21 % num) + 1]); - this.num > 22 ? this.outlist[23] = this.22.expand_do(signal[(22 % num) + 1]); - this.num > 23 ? this.outlist[24] = this.23.expand_do(signal[(23 % num) + 1]); - this.num > 24 ? this.outlist[25] = this.24.expand_do(signal[(24 % num) + 1]); - this.num > 25 ? this.outlist[26] = this.25.expand_do(signal[(25 % num) + 1]); - this.num > 26 ? this.outlist[27] = this.26.expand_do(signal[(26 % num) + 1]); - this.num > 27 ? this.outlist[28] = this.27.expand_do(signal[(27 % num) + 1]); - this.num > 28 ? this.outlist[29] = this.28.expand_do(signal[(28 % num) + 1]); - this.num > 29 ? this.outlist[30] = this.29.expand_do(signal[(29 % num) + 1]); - this.num > 30 ? this.outlist[31] = this.30.expand_do(signal[(30 % num) + 1]); - this.num > 31 ? this.outlist[32] = this.31.expand_do(signal[(31 % num) + 1]); - this.num > 32 ? this.outlist[33] = this.32.expand_do(signal[(32 % num) + 1]); - this.num > 33 ? this.outlist[34] = this.33.expand_do(signal[(33 % num) + 1]); - this.num > 34 ? this.outlist[35] = this.34.expand_do(signal[(34 % num) + 1]); - this.num > 35 ? this.outlist[36] = this.35.expand_do(signal[(35 % num) + 1]); - this.num > 36 ? this.outlist[37] = this.36.expand_do(signal[(36 % num) + 1]); - this.num > 37 ? this.outlist[38] = this.37.expand_do(signal[(37 % num) + 1]); - this.num > 38 ? this.outlist[39] = this.38.expand_do(signal[(38 % num) + 1]); - this.num > 39 ? this.outlist[40] = this.39.expand_do(signal[(39 % num) + 1]); - this.outlist; -); - -function Peq(lst1 lst2 lst3 lst4) -( - this.num = lst1[0]; - this.outlist = memalloc(this.num + 1); - this.outlist[0] = this.num; - this.num > 0 ? this.0.eq(lst1[1], lst2[1], lst3[1], lst4[1]); - this.num > 1 ? this.1.eq(lst1[2], lst2[2], lst3[2], lst4[2]); - this.num > 2 ? this.2.eq(lst1[3], lst2[3], lst3[3], lst4[3]); - this.num > 3 ? this.3.eq(lst1[4], lst2[4], lst3[4], lst4[4]); - this.num > 4 ? this.4.eq(lst1[5], lst2[5], lst3[5], lst4[5]); - this.num > 5 ? this.5.eq(lst1[6], lst2[6], lst3[6], lst4[6]); - this.num > 6 ? this.6.eq(lst1[7], lst2[7], lst3[7], lst4[7]); - this.num > 7 ? this.7.eq(lst1[8], lst2[8], lst3[8], lst4[8]); - this.num > 8 ? this.8.eq(lst1[9], lst2[9], lst3[9], lst4[9]); - this.num > 9 ? this.9.eq(lst1[10], lst2[10], lst3[10], lst4[10]); - this.num > 10 ? this.10.eq(lst1[11], lst2[11], lst3[11], lst4[11]); - this.num > 11 ? this.11.eq(lst1[12], lst2[12], lst3[12], lst4[12]); - this.num > 12 ? this.12.eq(lst1[13], lst2[13], lst3[13], lst4[13]); - this.num > 13 ? this.13.eq(lst1[14], lst2[14], lst3[14], lst4[14]); - this.num > 14 ? this.14.eq(lst1[15], lst2[15], lst3[15], lst4[15]); - this.num > 15 ? this.15.eq(lst1[16], lst2[16], lst3[16], lst4[16]); - this.num > 16 ? this.16.eq(lst1[17], lst2[17], lst3[17], lst4[17]); - this.num > 17 ? this.17.eq(lst1[18], lst2[18], lst3[18], lst4[18]); - this.num > 18 ? this.18.eq(lst1[19], lst2[19], lst3[19], lst4[19]); - this.num > 19 ? this.19.eq(lst1[20], lst2[20], lst3[20], lst4[20]); - this.num > 20 ? this.20.eq(lst1[21], lst2[21], lst3[21], lst4[21]); - this.num > 21 ? this.21.eq(lst1[22], lst2[22], lst3[22], lst4[22]); - this.num > 22 ? this.22.eq(lst1[23], lst2[23], lst3[23], lst4[23]); - this.num > 23 ? this.23.eq(lst1[24], lst2[24], lst3[24], lst4[24]); - this.num > 24 ? this.24.eq(lst1[25], lst2[25], lst3[25], lst4[25]); - this.num > 25 ? this.25.eq(lst1[26], lst2[26], lst3[26], lst4[26]); - this.num > 26 ? this.26.eq(lst1[27], lst2[27], lst3[27], lst4[27]); - this.num > 27 ? this.27.eq(lst1[28], lst2[28], lst3[28], lst4[28]); - this.num > 28 ? this.28.eq(lst1[29], lst2[29], lst3[29], lst4[29]); - this.num > 29 ? this.29.eq(lst1[30], lst2[30], lst3[30], lst4[30]); - this.num > 30 ? this.30.eq(lst1[31], lst2[31], lst3[31], lst4[31]); - this.num > 31 ? this.31.eq(lst1[32], lst2[32], lst3[32], lst4[32]); - this.num > 32 ? this.32.eq(lst1[33], lst2[33], lst3[33], lst4[33]); - this.num > 33 ? this.33.eq(lst1[34], lst2[34], lst3[34], lst4[34]); - this.num > 34 ? this.34.eq(lst1[35], lst2[35], lst3[35], lst4[35]); - this.num > 35 ? this.35.eq(lst1[36], lst2[36], lst3[36], lst4[36]); - this.num > 36 ? this.36.eq(lst1[37], lst2[37], lst3[37], lst4[37]); - this.num > 37 ? this.37.eq(lst1[38], lst2[38], lst3[38], lst4[38]); - this.num > 38 ? this.38.eq(lst1[39], lst2[39], lst3[39], lst4[39]); - this.num > 39 ? this.39.eq(lst1[40], lst2[40], lst3[40], lst4[40]); -); -function Peq_set_freq(lst1) -( - this.num > 0 ? this.0.eq_set_freq(lst1[1]); - this.num > 1 ? this.1.eq_set_freq(lst1[2]); - this.num > 2 ? this.2.eq_set_freq(lst1[3]); - this.num > 3 ? this.3.eq_set_freq(lst1[4]); - this.num > 4 ? this.4.eq_set_freq(lst1[5]); - this.num > 5 ? this.5.eq_set_freq(lst1[6]); - this.num > 6 ? this.6.eq_set_freq(lst1[7]); - this.num > 7 ? this.7.eq_set_freq(lst1[8]); - this.num > 8 ? this.8.eq_set_freq(lst1[9]); - this.num > 9 ? this.9.eq_set_freq(lst1[10]); - this.num > 10 ? this.10.eq_set_freq(lst1[11]); - this.num > 11 ? this.11.eq_set_freq(lst1[12]); - this.num > 12 ? this.12.eq_set_freq(lst1[13]); - this.num > 13 ? this.13.eq_set_freq(lst1[14]); - this.num > 14 ? this.14.eq_set_freq(lst1[15]); - this.num > 15 ? this.15.eq_set_freq(lst1[16]); - this.num > 16 ? this.16.eq_set_freq(lst1[17]); - this.num > 17 ? this.17.eq_set_freq(lst1[18]); - this.num > 18 ? this.18.eq_set_freq(lst1[19]); - this.num > 19 ? this.19.eq_set_freq(lst1[20]); - this.num > 20 ? this.20.eq_set_freq(lst1[21]); - this.num > 21 ? this.21.eq_set_freq(lst1[22]); - this.num > 22 ? this.22.eq_set_freq(lst1[23]); - this.num > 23 ? this.23.eq_set_freq(lst1[24]); - this.num > 24 ? this.24.eq_set_freq(lst1[25]); - this.num > 25 ? this.25.eq_set_freq(lst1[26]); - this.num > 26 ? this.26.eq_set_freq(lst1[27]); - this.num > 27 ? this.27.eq_set_freq(lst1[28]); - this.num > 28 ? this.28.eq_set_freq(lst1[29]); - this.num > 29 ? this.29.eq_set_freq(lst1[30]); - this.num > 30 ? this.30.eq_set_freq(lst1[31]); - this.num > 31 ? this.31.eq_set_freq(lst1[32]); - this.num > 32 ? this.32.eq_set_freq(lst1[33]); - this.num > 33 ? this.33.eq_set_freq(lst1[34]); - this.num > 34 ? this.34.eq_set_freq(lst1[35]); - this.num > 35 ? this.35.eq_set_freq(lst1[36]); - this.num > 36 ? this.36.eq_set_freq(lst1[37]); - this.num > 37 ? this.37.eq_set_freq(lst1[38]); - this.num > 38 ? this.38.eq_set_freq(lst1[39]); - this.num > 39 ? this.39.eq_set_freq(lst1[40]); -); -function Peq_set_q(lst1) -( - this.num > 0 ? this.0.eq_set_q(lst1[1]); - this.num > 1 ? this.1.eq_set_q(lst1[2]); - this.num > 2 ? this.2.eq_set_q(lst1[3]); - this.num > 3 ? this.3.eq_set_q(lst1[4]); - this.num > 4 ? this.4.eq_set_q(lst1[5]); - this.num > 5 ? this.5.eq_set_q(lst1[6]); - this.num > 6 ? this.6.eq_set_q(lst1[7]); - this.num > 7 ? this.7.eq_set_q(lst1[8]); - this.num > 8 ? this.8.eq_set_q(lst1[9]); - this.num > 9 ? this.9.eq_set_q(lst1[10]); - this.num > 10 ? this.10.eq_set_q(lst1[11]); - this.num > 11 ? this.11.eq_set_q(lst1[12]); - this.num > 12 ? this.12.eq_set_q(lst1[13]); - this.num > 13 ? this.13.eq_set_q(lst1[14]); - this.num > 14 ? this.14.eq_set_q(lst1[15]); - this.num > 15 ? this.15.eq_set_q(lst1[16]); - this.num > 16 ? this.16.eq_set_q(lst1[17]); - this.num > 17 ? this.17.eq_set_q(lst1[18]); - this.num > 18 ? this.18.eq_set_q(lst1[19]); - this.num > 19 ? this.19.eq_set_q(lst1[20]); - this.num > 20 ? this.20.eq_set_q(lst1[21]); - this.num > 21 ? this.21.eq_set_q(lst1[22]); - this.num > 22 ? this.22.eq_set_q(lst1[23]); - this.num > 23 ? this.23.eq_set_q(lst1[24]); - this.num > 24 ? this.24.eq_set_q(lst1[25]); - this.num > 25 ? this.25.eq_set_q(lst1[26]); - this.num > 26 ? this.26.eq_set_q(lst1[27]); - this.num > 27 ? this.27.eq_set_q(lst1[28]); - this.num > 28 ? this.28.eq_set_q(lst1[29]); - this.num > 29 ? this.29.eq_set_q(lst1[30]); - this.num > 30 ? this.30.eq_set_q(lst1[31]); - this.num > 31 ? this.31.eq_set_q(lst1[32]); - this.num > 32 ? this.32.eq_set_q(lst1[33]); - this.num > 33 ? this.33.eq_set_q(lst1[34]); - this.num > 34 ? this.34.eq_set_q(lst1[35]); - this.num > 35 ? this.35.eq_set_q(lst1[36]); - this.num > 36 ? this.36.eq_set_q(lst1[37]); - this.num > 37 ? this.37.eq_set_q(lst1[38]); - this.num > 38 ? this.38.eq_set_q(lst1[39]); - this.num > 39 ? this.39.eq_set_q(lst1[40]); -); -function Peq_set_boost(lst1) -( - this.num > 0 ? this.0.eq_set_boost(lst1[1]); - this.num > 1 ? this.1.eq_set_boost(lst1[2]); - this.num > 2 ? this.2.eq_set_boost(lst1[3]); - this.num > 3 ? this.3.eq_set_boost(lst1[4]); - this.num > 4 ? this.4.eq_set_boost(lst1[5]); - this.num > 5 ? this.5.eq_set_boost(lst1[6]); - this.num > 6 ? this.6.eq_set_boost(lst1[7]); - this.num > 7 ? this.7.eq_set_boost(lst1[8]); - this.num > 8 ? this.8.eq_set_boost(lst1[9]); - this.num > 9 ? this.9.eq_set_boost(lst1[10]); - this.num > 10 ? this.10.eq_set_boost(lst1[11]); - this.num > 11 ? this.11.eq_set_boost(lst1[12]); - this.num > 12 ? this.12.eq_set_boost(lst1[13]); - this.num > 13 ? this.13.eq_set_boost(lst1[14]); - this.num > 14 ? this.14.eq_set_boost(lst1[15]); - this.num > 15 ? this.15.eq_set_boost(lst1[16]); - this.num > 16 ? this.16.eq_set_boost(lst1[17]); - this.num > 17 ? this.17.eq_set_boost(lst1[18]); - this.num > 18 ? this.18.eq_set_boost(lst1[19]); - this.num > 19 ? this.19.eq_set_boost(lst1[20]); - this.num > 20 ? this.20.eq_set_boost(lst1[21]); - this.num > 21 ? this.21.eq_set_boost(lst1[22]); - this.num > 22 ? this.22.eq_set_boost(lst1[23]); - this.num > 23 ? this.23.eq_set_boost(lst1[24]); - this.num > 24 ? this.24.eq_set_boost(lst1[25]); - this.num > 25 ? this.25.eq_set_boost(lst1[26]); - this.num > 26 ? this.26.eq_set_boost(lst1[27]); - this.num > 27 ? this.27.eq_set_boost(lst1[28]); - this.num > 28 ? this.28.eq_set_boost(lst1[29]); - this.num > 29 ? this.29.eq_set_boost(lst1[30]); - this.num > 30 ? this.30.eq_set_boost(lst1[31]); - this.num > 31 ? this.31.eq_set_boost(lst1[32]); - this.num > 32 ? this.32.eq_set_boost(lst1[33]); - this.num > 33 ? this.33.eq_set_boost(lst1[34]); - this.num > 34 ? this.34.eq_set_boost(lst1[35]); - this.num > 35 ? this.35.eq_set_boost(lst1[36]); - this.num > 36 ? this.36.eq_set_boost(lst1[37]); - this.num > 37 ? this.37.eq_set_boost(lst1[38]); - this.num > 38 ? this.38.eq_set_boost(lst1[39]); - this.num > 39 ? this.39.eq_set_boost(lst1[40]); -); -function Peq_set_type(lst1) -( - this.num > 0 ? this.0.eq_set_type(lst1[1]); - this.num > 1 ? this.1.eq_set_type(lst1[2]); - this.num > 2 ? this.2.eq_set_type(lst1[3]); - this.num > 3 ? this.3.eq_set_type(lst1[4]); - this.num > 4 ? this.4.eq_set_type(lst1[5]); - this.num > 5 ? this.5.eq_set_type(lst1[6]); - this.num > 6 ? this.6.eq_set_type(lst1[7]); - this.num > 7 ? this.7.eq_set_type(lst1[8]); - this.num > 8 ? this.8.eq_set_type(lst1[9]); - this.num > 9 ? this.9.eq_set_type(lst1[10]); - this.num > 10 ? this.10.eq_set_type(lst1[11]); - this.num > 11 ? this.11.eq_set_type(lst1[12]); - this.num > 12 ? this.12.eq_set_type(lst1[13]); - this.num > 13 ? this.13.eq_set_type(lst1[14]); - this.num > 14 ? this.14.eq_set_type(lst1[15]); - this.num > 15 ? this.15.eq_set_type(lst1[16]); - this.num > 16 ? this.16.eq_set_type(lst1[17]); - this.num > 17 ? this.17.eq_set_type(lst1[18]); - this.num > 18 ? this.18.eq_set_type(lst1[19]); - this.num > 19 ? this.19.eq_set_type(lst1[20]); - this.num > 20 ? this.20.eq_set_type(lst1[21]); - this.num > 21 ? this.21.eq_set_type(lst1[22]); - this.num > 22 ? this.22.eq_set_type(lst1[23]); - this.num > 23 ? this.23.eq_set_type(lst1[24]); - this.num > 24 ? this.24.eq_set_type(lst1[25]); - this.num > 25 ? this.25.eq_set_type(lst1[26]); - this.num > 26 ? this.26.eq_set_type(lst1[27]); - this.num > 27 ? this.27.eq_set_type(lst1[28]); - this.num > 28 ? this.28.eq_set_type(lst1[29]); - this.num > 29 ? this.29.eq_set_type(lst1[30]); - this.num > 30 ? this.30.eq_set_type(lst1[31]); - this.num > 31 ? this.31.eq_set_type(lst1[32]); - this.num > 32 ? this.32.eq_set_type(lst1[33]); - this.num > 33 ? this.33.eq_set_type(lst1[34]); - this.num > 34 ? this.34.eq_set_type(lst1[35]); - this.num > 35 ? this.35.eq_set_type(lst1[36]); - this.num > 36 ? this.36.eq_set_type(lst1[37]); - this.num > 37 ? this.37.eq_set_type(lst1[38]); - this.num > 38 ? this.38.eq_set_type(lst1[39]); - this.num > 39 ? this.39.eq_set_type(lst1[40]); -); -function Peq_do(signal) -( - num = signal[0]; - this.num > 0 ? this.outlist[1] = this.0.eq_do(signal[(0 % num) + 1]); - this.num > 1 ? this.outlist[2] = this.1.eq_do(signal[(1 % num) + 1]); - this.num > 2 ? this.outlist[3] = this.2.eq_do(signal[(2 % num) + 1]); - this.num > 3 ? this.outlist[4] = this.3.eq_do(signal[(3 % num) + 1]); - this.num > 4 ? this.outlist[5] = this.4.eq_do(signal[(4 % num) + 1]); - this.num > 5 ? this.outlist[6] = this.5.eq_do(signal[(5 % num) + 1]); - this.num > 6 ? this.outlist[7] = this.6.eq_do(signal[(6 % num) + 1]); - this.num > 7 ? this.outlist[8] = this.7.eq_do(signal[(7 % num) + 1]); - this.num > 8 ? this.outlist[9] = this.8.eq_do(signal[(8 % num) + 1]); - this.num > 9 ? this.outlist[10] = this.9.eq_do(signal[(9 % num) + 1]); - this.num > 10 ? this.outlist[11] = this.10.eq_do(signal[(10 % num) + 1]); - this.num > 11 ? this.outlist[12] = this.11.eq_do(signal[(11 % num) + 1]); - this.num > 12 ? this.outlist[13] = this.12.eq_do(signal[(12 % num) + 1]); - this.num > 13 ? this.outlist[14] = this.13.eq_do(signal[(13 % num) + 1]); - this.num > 14 ? this.outlist[15] = this.14.eq_do(signal[(14 % num) + 1]); - this.num > 15 ? this.outlist[16] = this.15.eq_do(signal[(15 % num) + 1]); - this.num > 16 ? this.outlist[17] = this.16.eq_do(signal[(16 % num) + 1]); - this.num > 17 ? this.outlist[18] = this.17.eq_do(signal[(17 % num) + 1]); - this.num > 18 ? this.outlist[19] = this.18.eq_do(signal[(18 % num) + 1]); - this.num > 19 ? this.outlist[20] = this.19.eq_do(signal[(19 % num) + 1]); - this.num > 20 ? this.outlist[21] = this.20.eq_do(signal[(20 % num) + 1]); - this.num > 21 ? this.outlist[22] = this.21.eq_do(signal[(21 % num) + 1]); - this.num > 22 ? this.outlist[23] = this.22.eq_do(signal[(22 % num) + 1]); - this.num > 23 ? this.outlist[24] = this.23.eq_do(signal[(23 % num) + 1]); - this.num > 24 ? this.outlist[25] = this.24.eq_do(signal[(24 % num) + 1]); - this.num > 25 ? this.outlist[26] = this.25.eq_do(signal[(25 % num) + 1]); - this.num > 26 ? this.outlist[27] = this.26.eq_do(signal[(26 % num) + 1]); - this.num > 27 ? this.outlist[28] = this.27.eq_do(signal[(27 % num) + 1]); - this.num > 28 ? this.outlist[29] = this.28.eq_do(signal[(28 % num) + 1]); - this.num > 29 ? this.outlist[30] = this.29.eq_do(signal[(29 % num) + 1]); - this.num > 30 ? this.outlist[31] = this.30.eq_do(signal[(30 % num) + 1]); - this.num > 31 ? this.outlist[32] = this.31.eq_do(signal[(31 % num) + 1]); - this.num > 32 ? this.outlist[33] = this.32.eq_do(signal[(32 % num) + 1]); - this.num > 33 ? this.outlist[34] = this.33.eq_do(signal[(33 % num) + 1]); - this.num > 34 ? this.outlist[35] = this.34.eq_do(signal[(34 % num) + 1]); - this.num > 35 ? this.outlist[36] = this.35.eq_do(signal[(35 % num) + 1]); - this.num > 36 ? this.outlist[37] = this.36.eq_do(signal[(36 % num) + 1]); - this.num > 37 ? this.outlist[38] = this.37.eq_do(signal[(37 % num) + 1]); - this.num > 38 ? this.outlist[39] = this.38.eq_do(signal[(38 % num) + 1]); - this.num > 39 ? this.outlist[40] = this.39.eq_do(signal[(39 % num) + 1]); - this.outlist; -); - -function Pgrains(lst1 lst2 lst3 lst4 lst5 lst6 lst7) -( - this.num = lst1[0]; - this.outlist = memalloc(this.num + 1); - this.outlist[0] = this.num; - this.num > 0 ? this.0.grains(lst1[1], lst2[1], lst3[1], lst4[1], lst5[1], lst6[1], lst7[1]); - this.num > 1 ? this.1.grains(lst1[2], lst2[2], lst3[2], lst4[2], lst5[2], lst6[2], lst7[2]); - this.num > 2 ? this.2.grains(lst1[3], lst2[3], lst3[3], lst4[3], lst5[3], lst6[3], lst7[3]); - this.num > 3 ? this.3.grains(lst1[4], lst2[4], lst3[4], lst4[4], lst5[4], lst6[4], lst7[4]); - this.num > 4 ? this.4.grains(lst1[5], lst2[5], lst3[5], lst4[5], lst5[5], lst6[5], lst7[5]); - this.num > 5 ? this.5.grains(lst1[6], lst2[6], lst3[6], lst4[6], lst5[6], lst6[6], lst7[6]); - this.num > 6 ? this.6.grains(lst1[7], lst2[7], lst3[7], lst4[7], lst5[7], lst6[7], lst7[7]); - this.num > 7 ? this.7.grains(lst1[8], lst2[8], lst3[8], lst4[8], lst5[8], lst6[8], lst7[8]); - this.num > 8 ? this.8.grains(lst1[9], lst2[9], lst3[9], lst4[9], lst5[9], lst6[9], lst7[9]); - this.num > 9 ? this.9.grains(lst1[10], lst2[10], lst3[10], lst4[10], lst5[10], lst6[10], lst7[10]); - this.num > 10 ? this.10.grains(lst1[11], lst2[11], lst3[11], lst4[11], lst5[11], lst6[11], lst7[11]); - this.num > 11 ? this.11.grains(lst1[12], lst2[12], lst3[12], lst4[12], lst5[12], lst6[12], lst7[12]); - this.num > 12 ? this.12.grains(lst1[13], lst2[13], lst3[13], lst4[13], lst5[13], lst6[13], lst7[13]); - this.num > 13 ? this.13.grains(lst1[14], lst2[14], lst3[14], lst4[14], lst5[14], lst6[14], lst7[14]); - this.num > 14 ? this.14.grains(lst1[15], lst2[15], lst3[15], lst4[15], lst5[15], lst6[15], lst7[15]); - this.num > 15 ? this.15.grains(lst1[16], lst2[16], lst3[16], lst4[16], lst5[16], lst6[16], lst7[16]); - this.num > 16 ? this.16.grains(lst1[17], lst2[17], lst3[17], lst4[17], lst5[17], lst6[17], lst7[17]); - this.num > 17 ? this.17.grains(lst1[18], lst2[18], lst3[18], lst4[18], lst5[18], lst6[18], lst7[18]); - this.num > 18 ? this.18.grains(lst1[19], lst2[19], lst3[19], lst4[19], lst5[19], lst6[19], lst7[19]); - this.num > 19 ? this.19.grains(lst1[20], lst2[20], lst3[20], lst4[20], lst5[20], lst6[20], lst7[20]); - this.num > 20 ? this.20.grains(lst1[21], lst2[21], lst3[21], lst4[21], lst5[21], lst6[21], lst7[21]); - this.num > 21 ? this.21.grains(lst1[22], lst2[22], lst3[22], lst4[22], lst5[22], lst6[22], lst7[22]); - this.num > 22 ? this.22.grains(lst1[23], lst2[23], lst3[23], lst4[23], lst5[23], lst6[23], lst7[23]); - this.num > 23 ? this.23.grains(lst1[24], lst2[24], lst3[24], lst4[24], lst5[24], lst6[24], lst7[24]); - this.num > 24 ? this.24.grains(lst1[25], lst2[25], lst3[25], lst4[25], lst5[25], lst6[25], lst7[25]); - this.num > 25 ? this.25.grains(lst1[26], lst2[26], lst3[26], lst4[26], lst5[26], lst6[26], lst7[26]); - this.num > 26 ? this.26.grains(lst1[27], lst2[27], lst3[27], lst4[27], lst5[27], lst6[27], lst7[27]); - this.num > 27 ? this.27.grains(lst1[28], lst2[28], lst3[28], lst4[28], lst5[28], lst6[28], lst7[28]); - this.num > 28 ? this.28.grains(lst1[29], lst2[29], lst3[29], lst4[29], lst5[29], lst6[29], lst7[29]); - this.num > 29 ? this.29.grains(lst1[30], lst2[30], lst3[30], lst4[30], lst5[30], lst6[30], lst7[30]); - this.num > 30 ? this.30.grains(lst1[31], lst2[31], lst3[31], lst4[31], lst5[31], lst6[31], lst7[31]); - this.num > 31 ? this.31.grains(lst1[32], lst2[32], lst3[32], lst4[32], lst5[32], lst6[32], lst7[32]); - this.num > 32 ? this.32.grains(lst1[33], lst2[33], lst3[33], lst4[33], lst5[33], lst6[33], lst7[33]); - this.num > 33 ? this.33.grains(lst1[34], lst2[34], lst3[34], lst4[34], lst5[34], lst6[34], lst7[34]); - this.num > 34 ? this.34.grains(lst1[35], lst2[35], lst3[35], lst4[35], lst5[35], lst6[35], lst7[35]); - this.num > 35 ? this.35.grains(lst1[36], lst2[36], lst3[36], lst4[36], lst5[36], lst6[36], lst7[36]); - this.num > 36 ? this.36.grains(lst1[37], lst2[37], lst3[37], lst4[37], lst5[37], lst6[37], lst7[37]); - this.num > 37 ? this.37.grains(lst1[38], lst2[38], lst3[38], lst4[38], lst5[38], lst6[38], lst7[38]); - this.num > 38 ? this.38.grains(lst1[39], lst2[39], lst3[39], lst4[39], lst5[39], lst6[39], lst7[39]); - this.num > 39 ? this.39.grains(lst1[40], lst2[40], lst3[40], lst4[40], lst5[40], lst6[40], lst7[40]); -); -function Pgrains_set_num(lst1) -( - this.num > 0 ? this.0.grains_set_num(lst1[1]); - this.num > 1 ? this.1.grains_set_num(lst1[2]); - this.num > 2 ? this.2.grains_set_num(lst1[3]); - this.num > 3 ? this.3.grains_set_num(lst1[4]); - this.num > 4 ? this.4.grains_set_num(lst1[5]); - this.num > 5 ? this.5.grains_set_num(lst1[6]); - this.num > 6 ? this.6.grains_set_num(lst1[7]); - this.num > 7 ? this.7.grains_set_num(lst1[8]); - this.num > 8 ? this.8.grains_set_num(lst1[9]); - this.num > 9 ? this.9.grains_set_num(lst1[10]); - this.num > 10 ? this.10.grains_set_num(lst1[11]); - this.num > 11 ? this.11.grains_set_num(lst1[12]); - this.num > 12 ? this.12.grains_set_num(lst1[13]); - this.num > 13 ? this.13.grains_set_num(lst1[14]); - this.num > 14 ? this.14.grains_set_num(lst1[15]); - this.num > 15 ? this.15.grains_set_num(lst1[16]); - this.num > 16 ? this.16.grains_set_num(lst1[17]); - this.num > 17 ? this.17.grains_set_num(lst1[18]); - this.num > 18 ? this.18.grains_set_num(lst1[19]); - this.num > 19 ? this.19.grains_set_num(lst1[20]); - this.num > 20 ? this.20.grains_set_num(lst1[21]); - this.num > 21 ? this.21.grains_set_num(lst1[22]); - this.num > 22 ? this.22.grains_set_num(lst1[23]); - this.num > 23 ? this.23.grains_set_num(lst1[24]); - this.num > 24 ? this.24.grains_set_num(lst1[25]); - this.num > 25 ? this.25.grains_set_num(lst1[26]); - this.num > 26 ? this.26.grains_set_num(lst1[27]); - this.num > 27 ? this.27.grains_set_num(lst1[28]); - this.num > 28 ? this.28.grains_set_num(lst1[29]); - this.num > 29 ? this.29.grains_set_num(lst1[30]); - this.num > 30 ? this.30.grains_set_num(lst1[31]); - this.num > 31 ? this.31.grains_set_num(lst1[32]); - this.num > 32 ? this.32.grains_set_num(lst1[33]); - this.num > 33 ? this.33.grains_set_num(lst1[34]); - this.num > 34 ? this.34.grains_set_num(lst1[35]); - this.num > 35 ? this.35.grains_set_num(lst1[36]); - this.num > 36 ? this.36.grains_set_num(lst1[37]); - this.num > 37 ? this.37.grains_set_num(lst1[38]); - this.num > 38 ? this.38.grains_set_num(lst1[39]); - this.num > 39 ? this.39.grains_set_num(lst1[40]); -); -function Pgrains_set_pitch(lst1) -( - this.num > 0 ? this.0.grains_set_pitch(lst1[1]); - this.num > 1 ? this.1.grains_set_pitch(lst1[2]); - this.num > 2 ? this.2.grains_set_pitch(lst1[3]); - this.num > 3 ? this.3.grains_set_pitch(lst1[4]); - this.num > 4 ? this.4.grains_set_pitch(lst1[5]); - this.num > 5 ? this.5.grains_set_pitch(lst1[6]); - this.num > 6 ? this.6.grains_set_pitch(lst1[7]); - this.num > 7 ? this.7.grains_set_pitch(lst1[8]); - this.num > 8 ? this.8.grains_set_pitch(lst1[9]); - this.num > 9 ? this.9.grains_set_pitch(lst1[10]); - this.num > 10 ? this.10.grains_set_pitch(lst1[11]); - this.num > 11 ? this.11.grains_set_pitch(lst1[12]); - this.num > 12 ? this.12.grains_set_pitch(lst1[13]); - this.num > 13 ? this.13.grains_set_pitch(lst1[14]); - this.num > 14 ? this.14.grains_set_pitch(lst1[15]); - this.num > 15 ? this.15.grains_set_pitch(lst1[16]); - this.num > 16 ? this.16.grains_set_pitch(lst1[17]); - this.num > 17 ? this.17.grains_set_pitch(lst1[18]); - this.num > 18 ? this.18.grains_set_pitch(lst1[19]); - this.num > 19 ? this.19.grains_set_pitch(lst1[20]); - this.num > 20 ? this.20.grains_set_pitch(lst1[21]); - this.num > 21 ? this.21.grains_set_pitch(lst1[22]); - this.num > 22 ? this.22.grains_set_pitch(lst1[23]); - this.num > 23 ? this.23.grains_set_pitch(lst1[24]); - this.num > 24 ? this.24.grains_set_pitch(lst1[25]); - this.num > 25 ? this.25.grains_set_pitch(lst1[26]); - this.num > 26 ? this.26.grains_set_pitch(lst1[27]); - this.num > 27 ? this.27.grains_set_pitch(lst1[28]); - this.num > 28 ? this.28.grains_set_pitch(lst1[29]); - this.num > 29 ? this.29.grains_set_pitch(lst1[30]); - this.num > 30 ? this.30.grains_set_pitch(lst1[31]); - this.num > 31 ? this.31.grains_set_pitch(lst1[32]); - this.num > 32 ? this.32.grains_set_pitch(lst1[33]); - this.num > 33 ? this.33.grains_set_pitch(lst1[34]); - this.num > 34 ? this.34.grains_set_pitch(lst1[35]); - this.num > 35 ? this.35.grains_set_pitch(lst1[36]); - this.num > 36 ? this.36.grains_set_pitch(lst1[37]); - this.num > 37 ? this.37.grains_set_pitch(lst1[38]); - this.num > 38 ? this.38.grains_set_pitch(lst1[39]); - this.num > 39 ? this.39.grains_set_pitch(lst1[40]); -); -function Pgrains_set_pos(lst1) -( - this.num > 0 ? this.0.grains_set_pos(lst1[1]); - this.num > 1 ? this.1.grains_set_pos(lst1[2]); - this.num > 2 ? this.2.grains_set_pos(lst1[3]); - this.num > 3 ? this.3.grains_set_pos(lst1[4]); - this.num > 4 ? this.4.grains_set_pos(lst1[5]); - this.num > 5 ? this.5.grains_set_pos(lst1[6]); - this.num > 6 ? this.6.grains_set_pos(lst1[7]); - this.num > 7 ? this.7.grains_set_pos(lst1[8]); - this.num > 8 ? this.8.grains_set_pos(lst1[9]); - this.num > 9 ? this.9.grains_set_pos(lst1[10]); - this.num > 10 ? this.10.grains_set_pos(lst1[11]); - this.num > 11 ? this.11.grains_set_pos(lst1[12]); - this.num > 12 ? this.12.grains_set_pos(lst1[13]); - this.num > 13 ? this.13.grains_set_pos(lst1[14]); - this.num > 14 ? this.14.grains_set_pos(lst1[15]); - this.num > 15 ? this.15.grains_set_pos(lst1[16]); - this.num > 16 ? this.16.grains_set_pos(lst1[17]); - this.num > 17 ? this.17.grains_set_pos(lst1[18]); - this.num > 18 ? this.18.grains_set_pos(lst1[19]); - this.num > 19 ? this.19.grains_set_pos(lst1[20]); - this.num > 20 ? this.20.grains_set_pos(lst1[21]); - this.num > 21 ? this.21.grains_set_pos(lst1[22]); - this.num > 22 ? this.22.grains_set_pos(lst1[23]); - this.num > 23 ? this.23.grains_set_pos(lst1[24]); - this.num > 24 ? this.24.grains_set_pos(lst1[25]); - this.num > 25 ? this.25.grains_set_pos(lst1[26]); - this.num > 26 ? this.26.grains_set_pos(lst1[27]); - this.num > 27 ? this.27.grains_set_pos(lst1[28]); - this.num > 28 ? this.28.grains_set_pos(lst1[29]); - this.num > 29 ? this.29.grains_set_pos(lst1[30]); - this.num > 30 ? this.30.grains_set_pos(lst1[31]); - this.num > 31 ? this.31.grains_set_pos(lst1[32]); - this.num > 32 ? this.32.grains_set_pos(lst1[33]); - this.num > 33 ? this.33.grains_set_pos(lst1[34]); - this.num > 34 ? this.34.grains_set_pos(lst1[35]); - this.num > 35 ? this.35.grains_set_pos(lst1[36]); - this.num > 36 ? this.36.grains_set_pos(lst1[37]); - this.num > 37 ? this.37.grains_set_pos(lst1[38]); - this.num > 38 ? this.38.grains_set_pos(lst1[39]); - this.num > 39 ? this.39.grains_set_pos(lst1[40]); -); -function Pgrains_set_dur(lst1) -( - this.num > 0 ? this.0.grains_set_dur(lst1[1]); - this.num > 1 ? this.1.grains_set_dur(lst1[2]); - this.num > 2 ? this.2.grains_set_dur(lst1[3]); - this.num > 3 ? this.3.grains_set_dur(lst1[4]); - this.num > 4 ? this.4.grains_set_dur(lst1[5]); - this.num > 5 ? this.5.grains_set_dur(lst1[6]); - this.num > 6 ? this.6.grains_set_dur(lst1[7]); - this.num > 7 ? this.7.grains_set_dur(lst1[8]); - this.num > 8 ? this.8.grains_set_dur(lst1[9]); - this.num > 9 ? this.9.grains_set_dur(lst1[10]); - this.num > 10 ? this.10.grains_set_dur(lst1[11]); - this.num > 11 ? this.11.grains_set_dur(lst1[12]); - this.num > 12 ? this.12.grains_set_dur(lst1[13]); - this.num > 13 ? this.13.grains_set_dur(lst1[14]); - this.num > 14 ? this.14.grains_set_dur(lst1[15]); - this.num > 15 ? this.15.grains_set_dur(lst1[16]); - this.num > 16 ? this.16.grains_set_dur(lst1[17]); - this.num > 17 ? this.17.grains_set_dur(lst1[18]); - this.num > 18 ? this.18.grains_set_dur(lst1[19]); - this.num > 19 ? this.19.grains_set_dur(lst1[20]); - this.num > 20 ? this.20.grains_set_dur(lst1[21]); - this.num > 21 ? this.21.grains_set_dur(lst1[22]); - this.num > 22 ? this.22.grains_set_dur(lst1[23]); - this.num > 23 ? this.23.grains_set_dur(lst1[24]); - this.num > 24 ? this.24.grains_set_dur(lst1[25]); - this.num > 25 ? this.25.grains_set_dur(lst1[26]); - this.num > 26 ? this.26.grains_set_dur(lst1[27]); - this.num > 27 ? this.27.grains_set_dur(lst1[28]); - this.num > 28 ? this.28.grains_set_dur(lst1[29]); - this.num > 29 ? this.29.grains_set_dur(lst1[30]); - this.num > 30 ? this.30.grains_set_dur(lst1[31]); - this.num > 31 ? this.31.grains_set_dur(lst1[32]); - this.num > 32 ? this.32.grains_set_dur(lst1[33]); - this.num > 33 ? this.33.grains_set_dur(lst1[34]); - this.num > 34 ? this.34.grains_set_dur(lst1[35]); - this.num > 35 ? this.35.grains_set_dur(lst1[36]); - this.num > 36 ? this.36.grains_set_dur(lst1[37]); - this.num > 37 ? this.37.grains_set_dur(lst1[38]); - this.num > 38 ? this.38.grains_set_dur(lst1[39]); - this.num > 39 ? this.39.grains_set_dur(lst1[40]); -); -function Pgrains_set_pitrnd(lst1) -( - this.num > 0 ? this.0.grains_set_pitrnd(lst1[1]); - this.num > 1 ? this.1.grains_set_pitrnd(lst1[2]); - this.num > 2 ? this.2.grains_set_pitrnd(lst1[3]); - this.num > 3 ? this.3.grains_set_pitrnd(lst1[4]); - this.num > 4 ? this.4.grains_set_pitrnd(lst1[5]); - this.num > 5 ? this.5.grains_set_pitrnd(lst1[6]); - this.num > 6 ? this.6.grains_set_pitrnd(lst1[7]); - this.num > 7 ? this.7.grains_set_pitrnd(lst1[8]); - this.num > 8 ? this.8.grains_set_pitrnd(lst1[9]); - this.num > 9 ? this.9.grains_set_pitrnd(lst1[10]); - this.num > 10 ? this.10.grains_set_pitrnd(lst1[11]); - this.num > 11 ? this.11.grains_set_pitrnd(lst1[12]); - this.num > 12 ? this.12.grains_set_pitrnd(lst1[13]); - this.num > 13 ? this.13.grains_set_pitrnd(lst1[14]); - this.num > 14 ? this.14.grains_set_pitrnd(lst1[15]); - this.num > 15 ? this.15.grains_set_pitrnd(lst1[16]); - this.num > 16 ? this.16.grains_set_pitrnd(lst1[17]); - this.num > 17 ? this.17.grains_set_pitrnd(lst1[18]); - this.num > 18 ? this.18.grains_set_pitrnd(lst1[19]); - this.num > 19 ? this.19.grains_set_pitrnd(lst1[20]); - this.num > 20 ? this.20.grains_set_pitrnd(lst1[21]); - this.num > 21 ? this.21.grains_set_pitrnd(lst1[22]); - this.num > 22 ? this.22.grains_set_pitrnd(lst1[23]); - this.num > 23 ? this.23.grains_set_pitrnd(lst1[24]); - this.num > 24 ? this.24.grains_set_pitrnd(lst1[25]); - this.num > 25 ? this.25.grains_set_pitrnd(lst1[26]); - this.num > 26 ? this.26.grains_set_pitrnd(lst1[27]); - this.num > 27 ? this.27.grains_set_pitrnd(lst1[28]); - this.num > 28 ? this.28.grains_set_pitrnd(lst1[29]); - this.num > 29 ? this.29.grains_set_pitrnd(lst1[30]); - this.num > 30 ? this.30.grains_set_pitrnd(lst1[31]); - this.num > 31 ? this.31.grains_set_pitrnd(lst1[32]); - this.num > 32 ? this.32.grains_set_pitrnd(lst1[33]); - this.num > 33 ? this.33.grains_set_pitrnd(lst1[34]); - this.num > 34 ? this.34.grains_set_pitrnd(lst1[35]); - this.num > 35 ? this.35.grains_set_pitrnd(lst1[36]); - this.num > 36 ? this.36.grains_set_pitrnd(lst1[37]); - this.num > 37 ? this.37.grains_set_pitrnd(lst1[38]); - this.num > 38 ? this.38.grains_set_pitrnd(lst1[39]); - this.num > 39 ? this.39.grains_set_pitrnd(lst1[40]); -); -function Pgrains_set_posrnd(lst1) -( - this.num > 0 ? this.0.grains_set_posrnd(lst1[1]); - this.num > 1 ? this.1.grains_set_posrnd(lst1[2]); - this.num > 2 ? this.2.grains_set_posrnd(lst1[3]); - this.num > 3 ? this.3.grains_set_posrnd(lst1[4]); - this.num > 4 ? this.4.grains_set_posrnd(lst1[5]); - this.num > 5 ? this.5.grains_set_posrnd(lst1[6]); - this.num > 6 ? this.6.grains_set_posrnd(lst1[7]); - this.num > 7 ? this.7.grains_set_posrnd(lst1[8]); - this.num > 8 ? this.8.grains_set_posrnd(lst1[9]); - this.num > 9 ? this.9.grains_set_posrnd(lst1[10]); - this.num > 10 ? this.10.grains_set_posrnd(lst1[11]); - this.num > 11 ? this.11.grains_set_posrnd(lst1[12]); - this.num > 12 ? this.12.grains_set_posrnd(lst1[13]); - this.num > 13 ? this.13.grains_set_posrnd(lst1[14]); - this.num > 14 ? this.14.grains_set_posrnd(lst1[15]); - this.num > 15 ? this.15.grains_set_posrnd(lst1[16]); - this.num > 16 ? this.16.grains_set_posrnd(lst1[17]); - this.num > 17 ? this.17.grains_set_posrnd(lst1[18]); - this.num > 18 ? this.18.grains_set_posrnd(lst1[19]); - this.num > 19 ? this.19.grains_set_posrnd(lst1[20]); - this.num > 20 ? this.20.grains_set_posrnd(lst1[21]); - this.num > 21 ? this.21.grains_set_posrnd(lst1[22]); - this.num > 22 ? this.22.grains_set_posrnd(lst1[23]); - this.num > 23 ? this.23.grains_set_posrnd(lst1[24]); - this.num > 24 ? this.24.grains_set_posrnd(lst1[25]); - this.num > 25 ? this.25.grains_set_posrnd(lst1[26]); - this.num > 26 ? this.26.grains_set_posrnd(lst1[27]); - this.num > 27 ? this.27.grains_set_posrnd(lst1[28]); - this.num > 28 ? this.28.grains_set_posrnd(lst1[29]); - this.num > 29 ? this.29.grains_set_posrnd(lst1[30]); - this.num > 30 ? this.30.grains_set_posrnd(lst1[31]); - this.num > 31 ? this.31.grains_set_posrnd(lst1[32]); - this.num > 32 ? this.32.grains_set_posrnd(lst1[33]); - this.num > 33 ? this.33.grains_set_posrnd(lst1[34]); - this.num > 34 ? this.34.grains_set_posrnd(lst1[35]); - this.num > 35 ? this.35.grains_set_posrnd(lst1[36]); - this.num > 36 ? this.36.grains_set_posrnd(lst1[37]); - this.num > 37 ? this.37.grains_set_posrnd(lst1[38]); - this.num > 38 ? this.38.grains_set_posrnd(lst1[39]); - this.num > 39 ? this.39.grains_set_posrnd(lst1[40]); -); -function Pgrains_set(lst1 lst2 lst3 lst4 lst5 lst6) -( - this.num > 0 ? this.0.grains_set(lst1[1], lst2[1], lst3[1], lst4[1], lst5[1], lst6[1]); - this.num > 1 ? this.1.grains_set(lst1[2], lst2[2], lst3[2], lst4[2], lst5[2], lst6[2]); - this.num > 2 ? this.2.grains_set(lst1[3], lst2[3], lst3[3], lst4[3], lst5[3], lst6[3]); - this.num > 3 ? this.3.grains_set(lst1[4], lst2[4], lst3[4], lst4[4], lst5[4], lst6[4]); - this.num > 4 ? this.4.grains_set(lst1[5], lst2[5], lst3[5], lst4[5], lst5[5], lst6[5]); - this.num > 5 ? this.5.grains_set(lst1[6], lst2[6], lst3[6], lst4[6], lst5[6], lst6[6]); - this.num > 6 ? this.6.grains_set(lst1[7], lst2[7], lst3[7], lst4[7], lst5[7], lst6[7]); - this.num > 7 ? this.7.grains_set(lst1[8], lst2[8], lst3[8], lst4[8], lst5[8], lst6[8]); - this.num > 8 ? this.8.grains_set(lst1[9], lst2[9], lst3[9], lst4[9], lst5[9], lst6[9]); - this.num > 9 ? this.9.grains_set(lst1[10], lst2[10], lst3[10], lst4[10], lst5[10], lst6[10]); - this.num > 10 ? this.10.grains_set(lst1[11], lst2[11], lst3[11], lst4[11], lst5[11], lst6[11]); - this.num > 11 ? this.11.grains_set(lst1[12], lst2[12], lst3[12], lst4[12], lst5[12], lst6[12]); - this.num > 12 ? this.12.grains_set(lst1[13], lst2[13], lst3[13], lst4[13], lst5[13], lst6[13]); - this.num > 13 ? this.13.grains_set(lst1[14], lst2[14], lst3[14], lst4[14], lst5[14], lst6[14]); - this.num > 14 ? this.14.grains_set(lst1[15], lst2[15], lst3[15], lst4[15], lst5[15], lst6[15]); - this.num > 15 ? this.15.grains_set(lst1[16], lst2[16], lst3[16], lst4[16], lst5[16], lst6[16]); - this.num > 16 ? this.16.grains_set(lst1[17], lst2[17], lst3[17], lst4[17], lst5[17], lst6[17]); - this.num > 17 ? this.17.grains_set(lst1[18], lst2[18], lst3[18], lst4[18], lst5[18], lst6[18]); - this.num > 18 ? this.18.grains_set(lst1[19], lst2[19], lst3[19], lst4[19], lst5[19], lst6[19]); - this.num > 19 ? this.19.grains_set(lst1[20], lst2[20], lst3[20], lst4[20], lst5[20], lst6[20]); - this.num > 20 ? this.20.grains_set(lst1[21], lst2[21], lst3[21], lst4[21], lst5[21], lst6[21]); - this.num > 21 ? this.21.grains_set(lst1[22], lst2[22], lst3[22], lst4[22], lst5[22], lst6[22]); - this.num > 22 ? this.22.grains_set(lst1[23], lst2[23], lst3[23], lst4[23], lst5[23], lst6[23]); - this.num > 23 ? this.23.grains_set(lst1[24], lst2[24], lst3[24], lst4[24], lst5[24], lst6[24]); - this.num > 24 ? this.24.grains_set(lst1[25], lst2[25], lst3[25], lst4[25], lst5[25], lst6[25]); - this.num > 25 ? this.25.grains_set(lst1[26], lst2[26], lst3[26], lst4[26], lst5[26], lst6[26]); - this.num > 26 ? this.26.grains_set(lst1[27], lst2[27], lst3[27], lst4[27], lst5[27], lst6[27]); - this.num > 27 ? this.27.grains_set(lst1[28], lst2[28], lst3[28], lst4[28], lst5[28], lst6[28]); - this.num > 28 ? this.28.grains_set(lst1[29], lst2[29], lst3[29], lst4[29], lst5[29], lst6[29]); - this.num > 29 ? this.29.grains_set(lst1[30], lst2[30], lst3[30], lst4[30], lst5[30], lst6[30]); - this.num > 30 ? this.30.grains_set(lst1[31], lst2[31], lst3[31], lst4[31], lst5[31], lst6[31]); - this.num > 31 ? this.31.grains_set(lst1[32], lst2[32], lst3[32], lst4[32], lst5[32], lst6[32]); - this.num > 32 ? this.32.grains_set(lst1[33], lst2[33], lst3[33], lst4[33], lst5[33], lst6[33]); - this.num > 33 ? this.33.grains_set(lst1[34], lst2[34], lst3[34], lst4[34], lst5[34], lst6[34]); - this.num > 34 ? this.34.grains_set(lst1[35], lst2[35], lst3[35], lst4[35], lst5[35], lst6[35]); - this.num > 35 ? this.35.grains_set(lst1[36], lst2[36], lst3[36], lst4[36], lst5[36], lst6[36]); - this.num > 36 ? this.36.grains_set(lst1[37], lst2[37], lst3[37], lst4[37], lst5[37], lst6[37]); - this.num > 37 ? this.37.grains_set(lst1[38], lst2[38], lst3[38], lst4[38], lst5[38], lst6[38]); - this.num > 38 ? this.38.grains_set(lst1[39], lst2[39], lst3[39], lst4[39], lst5[39], lst6[39]); - this.num > 39 ? this.39.grains_set(lst1[40], lst2[40], lst3[40], lst4[40], lst5[40], lst6[40]); -); -function Pgrains_record(lst1) -( - this.num > 0 ? this.0.grains_record(lst1[1]); - this.num > 1 ? this.1.grains_record(lst1[2]); - this.num > 2 ? this.2.grains_record(lst1[3]); - this.num > 3 ? this.3.grains_record(lst1[4]); - this.num > 4 ? this.4.grains_record(lst1[5]); - this.num > 5 ? this.5.grains_record(lst1[6]); - this.num > 6 ? this.6.grains_record(lst1[7]); - this.num > 7 ? this.7.grains_record(lst1[8]); - this.num > 8 ? this.8.grains_record(lst1[9]); - this.num > 9 ? this.9.grains_record(lst1[10]); - this.num > 10 ? this.10.grains_record(lst1[11]); - this.num > 11 ? this.11.grains_record(lst1[12]); - this.num > 12 ? this.12.grains_record(lst1[13]); - this.num > 13 ? this.13.grains_record(lst1[14]); - this.num > 14 ? this.14.grains_record(lst1[15]); - this.num > 15 ? this.15.grains_record(lst1[16]); - this.num > 16 ? this.16.grains_record(lst1[17]); - this.num > 17 ? this.17.grains_record(lst1[18]); - this.num > 18 ? this.18.grains_record(lst1[19]); - this.num > 19 ? this.19.grains_record(lst1[20]); - this.num > 20 ? this.20.grains_record(lst1[21]); - this.num > 21 ? this.21.grains_record(lst1[22]); - this.num > 22 ? this.22.grains_record(lst1[23]); - this.num > 23 ? this.23.grains_record(lst1[24]); - this.num > 24 ? this.24.grains_record(lst1[25]); - this.num > 25 ? this.25.grains_record(lst1[26]); - this.num > 26 ? this.26.grains_record(lst1[27]); - this.num > 27 ? this.27.grains_record(lst1[28]); - this.num > 28 ? this.28.grains_record(lst1[29]); - this.num > 29 ? this.29.grains_record(lst1[30]); - this.num > 30 ? this.30.grains_record(lst1[31]); - this.num > 31 ? this.31.grains_record(lst1[32]); - this.num > 32 ? this.32.grains_record(lst1[33]); - this.num > 33 ? this.33.grains_record(lst1[34]); - this.num > 34 ? this.34.grains_record(lst1[35]); - this.num > 35 ? this.35.grains_record(lst1[36]); - this.num > 36 ? this.36.grains_record(lst1[37]); - this.num > 37 ? this.37.grains_record(lst1[38]); - this.num > 38 ? this.38.grains_record(lst1[39]); - this.num > 39 ? this.39.grains_record(lst1[40]); -); -function Pgrains_do(signal) -( - num = signal[0]; - this.num > 0 ? this.outlist[1] = this.0.grains_do(signal[(0 % num) + 1]); - this.num > 1 ? this.outlist[2] = this.1.grains_do(signal[(1 % num) + 1]); - this.num > 2 ? this.outlist[3] = this.2.grains_do(signal[(2 % num) + 1]); - this.num > 3 ? this.outlist[4] = this.3.grains_do(signal[(3 % num) + 1]); - this.num > 4 ? this.outlist[5] = this.4.grains_do(signal[(4 % num) + 1]); - this.num > 5 ? this.outlist[6] = this.5.grains_do(signal[(5 % num) + 1]); - this.num > 6 ? this.outlist[7] = this.6.grains_do(signal[(6 % num) + 1]); - this.num > 7 ? this.outlist[8] = this.7.grains_do(signal[(7 % num) + 1]); - this.num > 8 ? this.outlist[9] = this.8.grains_do(signal[(8 % num) + 1]); - this.num > 9 ? this.outlist[10] = this.9.grains_do(signal[(9 % num) + 1]); - this.num > 10 ? this.outlist[11] = this.10.grains_do(signal[(10 % num) + 1]); - this.num > 11 ? this.outlist[12] = this.11.grains_do(signal[(11 % num) + 1]); - this.num > 12 ? this.outlist[13] = this.12.grains_do(signal[(12 % num) + 1]); - this.num > 13 ? this.outlist[14] = this.13.grains_do(signal[(13 % num) + 1]); - this.num > 14 ? this.outlist[15] = this.14.grains_do(signal[(14 % num) + 1]); - this.num > 15 ? this.outlist[16] = this.15.grains_do(signal[(15 % num) + 1]); - this.num > 16 ? this.outlist[17] = this.16.grains_do(signal[(16 % num) + 1]); - this.num > 17 ? this.outlist[18] = this.17.grains_do(signal[(17 % num) + 1]); - this.num > 18 ? this.outlist[19] = this.18.grains_do(signal[(18 % num) + 1]); - this.num > 19 ? this.outlist[20] = this.19.grains_do(signal[(19 % num) + 1]); - this.num > 20 ? this.outlist[21] = this.20.grains_do(signal[(20 % num) + 1]); - this.num > 21 ? this.outlist[22] = this.21.grains_do(signal[(21 % num) + 1]); - this.num > 22 ? this.outlist[23] = this.22.grains_do(signal[(22 % num) + 1]); - this.num > 23 ? this.outlist[24] = this.23.grains_do(signal[(23 % num) + 1]); - this.num > 24 ? this.outlist[25] = this.24.grains_do(signal[(24 % num) + 1]); - this.num > 25 ? this.outlist[26] = this.25.grains_do(signal[(25 % num) + 1]); - this.num > 26 ? this.outlist[27] = this.26.grains_do(signal[(26 % num) + 1]); - this.num > 27 ? this.outlist[28] = this.27.grains_do(signal[(27 % num) + 1]); - this.num > 28 ? this.outlist[29] = this.28.grains_do(signal[(28 % num) + 1]); - this.num > 29 ? this.outlist[30] = this.29.grains_do(signal[(29 % num) + 1]); - this.num > 30 ? this.outlist[31] = this.30.grains_do(signal[(30 % num) + 1]); - this.num > 31 ? this.outlist[32] = this.31.grains_do(signal[(31 % num) + 1]); - this.num > 32 ? this.outlist[33] = this.32.grains_do(signal[(32 % num) + 1]); - this.num > 33 ? this.outlist[34] = this.33.grains_do(signal[(33 % num) + 1]); - this.num > 34 ? this.outlist[35] = this.34.grains_do(signal[(34 % num) + 1]); - this.num > 35 ? this.outlist[36] = this.35.grains_do(signal[(35 % num) + 1]); - this.num > 36 ? this.outlist[37] = this.36.grains_do(signal[(36 % num) + 1]); - this.num > 37 ? this.outlist[38] = this.37.grains_do(signal[(37 % num) + 1]); - this.num > 38 ? this.outlist[39] = this.38.grains_do(signal[(38 % num) + 1]); - this.num > 39 ? this.outlist[40] = this.39.grains_do(signal[(39 % num) + 1]); - this.outlist; -); - -function Pdisto(lst1 lst2) -( - this.num = lst1[0]; - this.outlist = memalloc(this.num + 1); - this.outlist[0] = this.num; - this.num > 0 ? this.0.disto(lst1[1], lst2[1]); - this.num > 1 ? this.1.disto(lst1[2], lst2[2]); - this.num > 2 ? this.2.disto(lst1[3], lst2[3]); - this.num > 3 ? this.3.disto(lst1[4], lst2[4]); - this.num > 4 ? this.4.disto(lst1[5], lst2[5]); - this.num > 5 ? this.5.disto(lst1[6], lst2[6]); - this.num > 6 ? this.6.disto(lst1[7], lst2[7]); - this.num > 7 ? this.7.disto(lst1[8], lst2[8]); - this.num > 8 ? this.8.disto(lst1[9], lst2[9]); - this.num > 9 ? this.9.disto(lst1[10], lst2[10]); - this.num > 10 ? this.10.disto(lst1[11], lst2[11]); - this.num > 11 ? this.11.disto(lst1[12], lst2[12]); - this.num > 12 ? this.12.disto(lst1[13], lst2[13]); - this.num > 13 ? this.13.disto(lst1[14], lst2[14]); - this.num > 14 ? this.14.disto(lst1[15], lst2[15]); - this.num > 15 ? this.15.disto(lst1[16], lst2[16]); - this.num > 16 ? this.16.disto(lst1[17], lst2[17]); - this.num > 17 ? this.17.disto(lst1[18], lst2[18]); - this.num > 18 ? this.18.disto(lst1[19], lst2[19]); - this.num > 19 ? this.19.disto(lst1[20], lst2[20]); - this.num > 20 ? this.20.disto(lst1[21], lst2[21]); - this.num > 21 ? this.21.disto(lst1[22], lst2[22]); - this.num > 22 ? this.22.disto(lst1[23], lst2[23]); - this.num > 23 ? this.23.disto(lst1[24], lst2[24]); - this.num > 24 ? this.24.disto(lst1[25], lst2[25]); - this.num > 25 ? this.25.disto(lst1[26], lst2[26]); - this.num > 26 ? this.26.disto(lst1[27], lst2[27]); - this.num > 27 ? this.27.disto(lst1[28], lst2[28]); - this.num > 28 ? this.28.disto(lst1[29], lst2[29]); - this.num > 29 ? this.29.disto(lst1[30], lst2[30]); - this.num > 30 ? this.30.disto(lst1[31], lst2[31]); - this.num > 31 ? this.31.disto(lst1[32], lst2[32]); - this.num > 32 ? this.32.disto(lst1[33], lst2[33]); - this.num > 33 ? this.33.disto(lst1[34], lst2[34]); - this.num > 34 ? this.34.disto(lst1[35], lst2[35]); - this.num > 35 ? this.35.disto(lst1[36], lst2[36]); - this.num > 36 ? this.36.disto(lst1[37], lst2[37]); - this.num > 37 ? this.37.disto(lst1[38], lst2[38]); - this.num > 38 ? this.38.disto(lst1[39], lst2[39]); - this.num > 39 ? this.39.disto(lst1[40], lst2[40]); -); -function Pdisto_set_drive(lst1) -( - this.num > 0 ? this.0.disto_set_drive(lst1[1]); - this.num > 1 ? this.1.disto_set_drive(lst1[2]); - this.num > 2 ? this.2.disto_set_drive(lst1[3]); - this.num > 3 ? this.3.disto_set_drive(lst1[4]); - this.num > 4 ? this.4.disto_set_drive(lst1[5]); - this.num > 5 ? this.5.disto_set_drive(lst1[6]); - this.num > 6 ? this.6.disto_set_drive(lst1[7]); - this.num > 7 ? this.7.disto_set_drive(lst1[8]); - this.num > 8 ? this.8.disto_set_drive(lst1[9]); - this.num > 9 ? this.9.disto_set_drive(lst1[10]); - this.num > 10 ? this.10.disto_set_drive(lst1[11]); - this.num > 11 ? this.11.disto_set_drive(lst1[12]); - this.num > 12 ? this.12.disto_set_drive(lst1[13]); - this.num > 13 ? this.13.disto_set_drive(lst1[14]); - this.num > 14 ? this.14.disto_set_drive(lst1[15]); - this.num > 15 ? this.15.disto_set_drive(lst1[16]); - this.num > 16 ? this.16.disto_set_drive(lst1[17]); - this.num > 17 ? this.17.disto_set_drive(lst1[18]); - this.num > 18 ? this.18.disto_set_drive(lst1[19]); - this.num > 19 ? this.19.disto_set_drive(lst1[20]); - this.num > 20 ? this.20.disto_set_drive(lst1[21]); - this.num > 21 ? this.21.disto_set_drive(lst1[22]); - this.num > 22 ? this.22.disto_set_drive(lst1[23]); - this.num > 23 ? this.23.disto_set_drive(lst1[24]); - this.num > 24 ? this.24.disto_set_drive(lst1[25]); - this.num > 25 ? this.25.disto_set_drive(lst1[26]); - this.num > 26 ? this.26.disto_set_drive(lst1[27]); - this.num > 27 ? this.27.disto_set_drive(lst1[28]); - this.num > 28 ? this.28.disto_set_drive(lst1[29]); - this.num > 29 ? this.29.disto_set_drive(lst1[30]); - this.num > 30 ? this.30.disto_set_drive(lst1[31]); - this.num > 31 ? this.31.disto_set_drive(lst1[32]); - this.num > 32 ? this.32.disto_set_drive(lst1[33]); - this.num > 33 ? this.33.disto_set_drive(lst1[34]); - this.num > 34 ? this.34.disto_set_drive(lst1[35]); - this.num > 35 ? this.35.disto_set_drive(lst1[36]); - this.num > 36 ? this.36.disto_set_drive(lst1[37]); - this.num > 37 ? this.37.disto_set_drive(lst1[38]); - this.num > 38 ? this.38.disto_set_drive(lst1[39]); - this.num > 39 ? this.39.disto_set_drive(lst1[40]); -); -function Pdisto_set_cutoff(lst1) -( - this.num > 0 ? this.0.disto_set_cutoff(lst1[1]); - this.num > 1 ? this.1.disto_set_cutoff(lst1[2]); - this.num > 2 ? this.2.disto_set_cutoff(lst1[3]); - this.num > 3 ? this.3.disto_set_cutoff(lst1[4]); - this.num > 4 ? this.4.disto_set_cutoff(lst1[5]); - this.num > 5 ? this.5.disto_set_cutoff(lst1[6]); - this.num > 6 ? this.6.disto_set_cutoff(lst1[7]); - this.num > 7 ? this.7.disto_set_cutoff(lst1[8]); - this.num > 8 ? this.8.disto_set_cutoff(lst1[9]); - this.num > 9 ? this.9.disto_set_cutoff(lst1[10]); - this.num > 10 ? this.10.disto_set_cutoff(lst1[11]); - this.num > 11 ? this.11.disto_set_cutoff(lst1[12]); - this.num > 12 ? this.12.disto_set_cutoff(lst1[13]); - this.num > 13 ? this.13.disto_set_cutoff(lst1[14]); - this.num > 14 ? this.14.disto_set_cutoff(lst1[15]); - this.num > 15 ? this.15.disto_set_cutoff(lst1[16]); - this.num > 16 ? this.16.disto_set_cutoff(lst1[17]); - this.num > 17 ? this.17.disto_set_cutoff(lst1[18]); - this.num > 18 ? this.18.disto_set_cutoff(lst1[19]); - this.num > 19 ? this.19.disto_set_cutoff(lst1[20]); - this.num > 20 ? this.20.disto_set_cutoff(lst1[21]); - this.num > 21 ? this.21.disto_set_cutoff(lst1[22]); - this.num > 22 ? this.22.disto_set_cutoff(lst1[23]); - this.num > 23 ? this.23.disto_set_cutoff(lst1[24]); - this.num > 24 ? this.24.disto_set_cutoff(lst1[25]); - this.num > 25 ? this.25.disto_set_cutoff(lst1[26]); - this.num > 26 ? this.26.disto_set_cutoff(lst1[27]); - this.num > 27 ? this.27.disto_set_cutoff(lst1[28]); - this.num > 28 ? this.28.disto_set_cutoff(lst1[29]); - this.num > 29 ? this.29.disto_set_cutoff(lst1[30]); - this.num > 30 ? this.30.disto_set_cutoff(lst1[31]); - this.num > 31 ? this.31.disto_set_cutoff(lst1[32]); - this.num > 32 ? this.32.disto_set_cutoff(lst1[33]); - this.num > 33 ? this.33.disto_set_cutoff(lst1[34]); - this.num > 34 ? this.34.disto_set_cutoff(lst1[35]); - this.num > 35 ? this.35.disto_set_cutoff(lst1[36]); - this.num > 36 ? this.36.disto_set_cutoff(lst1[37]); - this.num > 37 ? this.37.disto_set_cutoff(lst1[38]); - this.num > 38 ? this.38.disto_set_cutoff(lst1[39]); - this.num > 39 ? this.39.disto_set_cutoff(lst1[40]); -); -function Pdisto_do(signal) -( - num = signal[0]; - this.num > 0 ? this.outlist[1] = this.0.disto_do(signal[(0 % num) + 1]); - this.num > 1 ? this.outlist[2] = this.1.disto_do(signal[(1 % num) + 1]); - this.num > 2 ? this.outlist[3] = this.2.disto_do(signal[(2 % num) + 1]); - this.num > 3 ? this.outlist[4] = this.3.disto_do(signal[(3 % num) + 1]); - this.num > 4 ? this.outlist[5] = this.4.disto_do(signal[(4 % num) + 1]); - this.num > 5 ? this.outlist[6] = this.5.disto_do(signal[(5 % num) + 1]); - this.num > 6 ? this.outlist[7] = this.6.disto_do(signal[(6 % num) + 1]); - this.num > 7 ? this.outlist[8] = this.7.disto_do(signal[(7 % num) + 1]); - this.num > 8 ? this.outlist[9] = this.8.disto_do(signal[(8 % num) + 1]); - this.num > 9 ? this.outlist[10] = this.9.disto_do(signal[(9 % num) + 1]); - this.num > 10 ? this.outlist[11] = this.10.disto_do(signal[(10 % num) + 1]); - this.num > 11 ? this.outlist[12] = this.11.disto_do(signal[(11 % num) + 1]); - this.num > 12 ? this.outlist[13] = this.12.disto_do(signal[(12 % num) + 1]); - this.num > 13 ? this.outlist[14] = this.13.disto_do(signal[(13 % num) + 1]); - this.num > 14 ? this.outlist[15] = this.14.disto_do(signal[(14 % num) + 1]); - this.num > 15 ? this.outlist[16] = this.15.disto_do(signal[(15 % num) + 1]); - this.num > 16 ? this.outlist[17] = this.16.disto_do(signal[(16 % num) + 1]); - this.num > 17 ? this.outlist[18] = this.17.disto_do(signal[(17 % num) + 1]); - this.num > 18 ? this.outlist[19] = this.18.disto_do(signal[(18 % num) + 1]); - this.num > 19 ? this.outlist[20] = this.19.disto_do(signal[(19 % num) + 1]); - this.num > 20 ? this.outlist[21] = this.20.disto_do(signal[(20 % num) + 1]); - this.num > 21 ? this.outlist[22] = this.21.disto_do(signal[(21 % num) + 1]); - this.num > 22 ? this.outlist[23] = this.22.disto_do(signal[(22 % num) + 1]); - this.num > 23 ? this.outlist[24] = this.23.disto_do(signal[(23 % num) + 1]); - this.num > 24 ? this.outlist[25] = this.24.disto_do(signal[(24 % num) + 1]); - this.num > 25 ? this.outlist[26] = this.25.disto_do(signal[(25 % num) + 1]); - this.num > 26 ? this.outlist[27] = this.26.disto_do(signal[(26 % num) + 1]); - this.num > 27 ? this.outlist[28] = this.27.disto_do(signal[(27 % num) + 1]); - this.num > 28 ? this.outlist[29] = this.28.disto_do(signal[(28 % num) + 1]); - this.num > 29 ? this.outlist[30] = this.29.disto_do(signal[(29 % num) + 1]); - this.num > 30 ? this.outlist[31] = this.30.disto_do(signal[(30 % num) + 1]); - this.num > 31 ? this.outlist[32] = this.31.disto_do(signal[(31 % num) + 1]); - this.num > 32 ? this.outlist[33] = this.32.disto_do(signal[(32 % num) + 1]); - this.num > 33 ? this.outlist[34] = this.33.disto_do(signal[(33 % num) + 1]); - this.num > 34 ? this.outlist[35] = this.34.disto_do(signal[(34 % num) + 1]); - this.num > 35 ? this.outlist[36] = this.35.disto_do(signal[(35 % num) + 1]); - this.num > 36 ? this.outlist[37] = this.36.disto_do(signal[(36 % num) + 1]); - this.num > 37 ? this.outlist[38] = this.37.disto_do(signal[(37 % num) + 1]); - this.num > 38 ? this.outlist[39] = this.38.disto_do(signal[(38 % num) + 1]); - this.num > 39 ? this.outlist[40] = this.39.disto_do(signal[(39 % num) + 1]); - this.outlist; -); - -function Pharmon(lst1 lst2 lst3) -( - this.num = lst1[0]; - this.outlist = memalloc(this.num + 1); - this.outlist[0] = this.num; - this.num > 0 ? this.0.harmon(lst1[1], lst2[1], lst3[1]); - this.num > 1 ? this.1.harmon(lst1[2], lst2[2], lst3[2]); - this.num > 2 ? this.2.harmon(lst1[3], lst2[3], lst3[3]); - this.num > 3 ? this.3.harmon(lst1[4], lst2[4], lst3[4]); - this.num > 4 ? this.4.harmon(lst1[5], lst2[5], lst3[5]); - this.num > 5 ? this.5.harmon(lst1[6], lst2[6], lst3[6]); - this.num > 6 ? this.6.harmon(lst1[7], lst2[7], lst3[7]); - this.num > 7 ? this.7.harmon(lst1[8], lst2[8], lst3[8]); - this.num > 8 ? this.8.harmon(lst1[9], lst2[9], lst3[9]); - this.num > 9 ? this.9.harmon(lst1[10], lst2[10], lst3[10]); - this.num > 10 ? this.10.harmon(lst1[11], lst2[11], lst3[11]); - this.num > 11 ? this.11.harmon(lst1[12], lst2[12], lst3[12]); - this.num > 12 ? this.12.harmon(lst1[13], lst2[13], lst3[13]); - this.num > 13 ? this.13.harmon(lst1[14], lst2[14], lst3[14]); - this.num > 14 ? this.14.harmon(lst1[15], lst2[15], lst3[15]); - this.num > 15 ? this.15.harmon(lst1[16], lst2[16], lst3[16]); - this.num > 16 ? this.16.harmon(lst1[17], lst2[17], lst3[17]); - this.num > 17 ? this.17.harmon(lst1[18], lst2[18], lst3[18]); - this.num > 18 ? this.18.harmon(lst1[19], lst2[19], lst3[19]); - this.num > 19 ? this.19.harmon(lst1[20], lst2[20], lst3[20]); - this.num > 20 ? this.20.harmon(lst1[21], lst2[21], lst3[21]); - this.num > 21 ? this.21.harmon(lst1[22], lst2[22], lst3[22]); - this.num > 22 ? this.22.harmon(lst1[23], lst2[23], lst3[23]); - this.num > 23 ? this.23.harmon(lst1[24], lst2[24], lst3[24]); - this.num > 24 ? this.24.harmon(lst1[25], lst2[25], lst3[25]); - this.num > 25 ? this.25.harmon(lst1[26], lst2[26], lst3[26]); - this.num > 26 ? this.26.harmon(lst1[27], lst2[27], lst3[27]); - this.num > 27 ? this.27.harmon(lst1[28], lst2[28], lst3[28]); - this.num > 28 ? this.28.harmon(lst1[29], lst2[29], lst3[29]); - this.num > 29 ? this.29.harmon(lst1[30], lst2[30], lst3[30]); - this.num > 30 ? this.30.harmon(lst1[31], lst2[31], lst3[31]); - this.num > 31 ? this.31.harmon(lst1[32], lst2[32], lst3[32]); - this.num > 32 ? this.32.harmon(lst1[33], lst2[33], lst3[33]); - this.num > 33 ? this.33.harmon(lst1[34], lst2[34], lst3[34]); - this.num > 34 ? this.34.harmon(lst1[35], lst2[35], lst3[35]); - this.num > 35 ? this.35.harmon(lst1[36], lst2[36], lst3[36]); - this.num > 36 ? this.36.harmon(lst1[37], lst2[37], lst3[37]); - this.num > 37 ? this.37.harmon(lst1[38], lst2[38], lst3[38]); - this.num > 38 ? this.38.harmon(lst1[39], lst2[39], lst3[39]); - this.num > 39 ? this.39.harmon(lst1[40], lst2[40], lst3[40]); -); -function Pharmon_set_transpo(lst1) -( - this.num > 0 ? this.0.harmon_set_transpo(lst1[1]); - this.num > 1 ? this.1.harmon_set_transpo(lst1[2]); - this.num > 2 ? this.2.harmon_set_transpo(lst1[3]); - this.num > 3 ? this.3.harmon_set_transpo(lst1[4]); - this.num > 4 ? this.4.harmon_set_transpo(lst1[5]); - this.num > 5 ? this.5.harmon_set_transpo(lst1[6]); - this.num > 6 ? this.6.harmon_set_transpo(lst1[7]); - this.num > 7 ? this.7.harmon_set_transpo(lst1[8]); - this.num > 8 ? this.8.harmon_set_transpo(lst1[9]); - this.num > 9 ? this.9.harmon_set_transpo(lst1[10]); - this.num > 10 ? this.10.harmon_set_transpo(lst1[11]); - this.num > 11 ? this.11.harmon_set_transpo(lst1[12]); - this.num > 12 ? this.12.harmon_set_transpo(lst1[13]); - this.num > 13 ? this.13.harmon_set_transpo(lst1[14]); - this.num > 14 ? this.14.harmon_set_transpo(lst1[15]); - this.num > 15 ? this.15.harmon_set_transpo(lst1[16]); - this.num > 16 ? this.16.harmon_set_transpo(lst1[17]); - this.num > 17 ? this.17.harmon_set_transpo(lst1[18]); - this.num > 18 ? this.18.harmon_set_transpo(lst1[19]); - this.num > 19 ? this.19.harmon_set_transpo(lst1[20]); - this.num > 20 ? this.20.harmon_set_transpo(lst1[21]); - this.num > 21 ? this.21.harmon_set_transpo(lst1[22]); - this.num > 22 ? this.22.harmon_set_transpo(lst1[23]); - this.num > 23 ? this.23.harmon_set_transpo(lst1[24]); - this.num > 24 ? this.24.harmon_set_transpo(lst1[25]); - this.num > 25 ? this.25.harmon_set_transpo(lst1[26]); - this.num > 26 ? this.26.harmon_set_transpo(lst1[27]); - this.num > 27 ? this.27.harmon_set_transpo(lst1[28]); - this.num > 28 ? this.28.harmon_set_transpo(lst1[29]); - this.num > 29 ? this.29.harmon_set_transpo(lst1[30]); - this.num > 30 ? this.30.harmon_set_transpo(lst1[31]); - this.num > 31 ? this.31.harmon_set_transpo(lst1[32]); - this.num > 32 ? this.32.harmon_set_transpo(lst1[33]); - this.num > 33 ? this.33.harmon_set_transpo(lst1[34]); - this.num > 34 ? this.34.harmon_set_transpo(lst1[35]); - this.num > 35 ? this.35.harmon_set_transpo(lst1[36]); - this.num > 36 ? this.36.harmon_set_transpo(lst1[37]); - this.num > 37 ? this.37.harmon_set_transpo(lst1[38]); - this.num > 38 ? this.38.harmon_set_transpo(lst1[39]); - this.num > 39 ? this.39.harmon_set_transpo(lst1[40]); -); -function Pharmon_set_feedback(lst1) -( - this.num > 0 ? this.0.harmon_set_feedback(lst1[1]); - this.num > 1 ? this.1.harmon_set_feedback(lst1[2]); - this.num > 2 ? this.2.harmon_set_feedback(lst1[3]); - this.num > 3 ? this.3.harmon_set_feedback(lst1[4]); - this.num > 4 ? this.4.harmon_set_feedback(lst1[5]); - this.num > 5 ? this.5.harmon_set_feedback(lst1[6]); - this.num > 6 ? this.6.harmon_set_feedback(lst1[7]); - this.num > 7 ? this.7.harmon_set_feedback(lst1[8]); - this.num > 8 ? this.8.harmon_set_feedback(lst1[9]); - this.num > 9 ? this.9.harmon_set_feedback(lst1[10]); - this.num > 10 ? this.10.harmon_set_feedback(lst1[11]); - this.num > 11 ? this.11.harmon_set_feedback(lst1[12]); - this.num > 12 ? this.12.harmon_set_feedback(lst1[13]); - this.num > 13 ? this.13.harmon_set_feedback(lst1[14]); - this.num > 14 ? this.14.harmon_set_feedback(lst1[15]); - this.num > 15 ? this.15.harmon_set_feedback(lst1[16]); - this.num > 16 ? this.16.harmon_set_feedback(lst1[17]); - this.num > 17 ? this.17.harmon_set_feedback(lst1[18]); - this.num > 18 ? this.18.harmon_set_feedback(lst1[19]); - this.num > 19 ? this.19.harmon_set_feedback(lst1[20]); - this.num > 20 ? this.20.harmon_set_feedback(lst1[21]); - this.num > 21 ? this.21.harmon_set_feedback(lst1[22]); - this.num > 22 ? this.22.harmon_set_feedback(lst1[23]); - this.num > 23 ? this.23.harmon_set_feedback(lst1[24]); - this.num > 24 ? this.24.harmon_set_feedback(lst1[25]); - this.num > 25 ? this.25.harmon_set_feedback(lst1[26]); - this.num > 26 ? this.26.harmon_set_feedback(lst1[27]); - this.num > 27 ? this.27.harmon_set_feedback(lst1[28]); - this.num > 28 ? this.28.harmon_set_feedback(lst1[29]); - this.num > 29 ? this.29.harmon_set_feedback(lst1[30]); - this.num > 30 ? this.30.harmon_set_feedback(lst1[31]); - this.num > 31 ? this.31.harmon_set_feedback(lst1[32]); - this.num > 32 ? this.32.harmon_set_feedback(lst1[33]); - this.num > 33 ? this.33.harmon_set_feedback(lst1[34]); - this.num > 34 ? this.34.harmon_set_feedback(lst1[35]); - this.num > 35 ? this.35.harmon_set_feedback(lst1[36]); - this.num > 36 ? this.36.harmon_set_feedback(lst1[37]); - this.num > 37 ? this.37.harmon_set_feedback(lst1[38]); - this.num > 38 ? this.38.harmon_set_feedback(lst1[39]); - this.num > 39 ? this.39.harmon_set_feedback(lst1[40]); -); -function Pharmon_set_winsize(lst1) -( - this.num > 0 ? this.0.harmon_set_winsize(lst1[1]); - this.num > 1 ? this.1.harmon_set_winsize(lst1[2]); - this.num > 2 ? this.2.harmon_set_winsize(lst1[3]); - this.num > 3 ? this.3.harmon_set_winsize(lst1[4]); - this.num > 4 ? this.4.harmon_set_winsize(lst1[5]); - this.num > 5 ? this.5.harmon_set_winsize(lst1[6]); - this.num > 6 ? this.6.harmon_set_winsize(lst1[7]); - this.num > 7 ? this.7.harmon_set_winsize(lst1[8]); - this.num > 8 ? this.8.harmon_set_winsize(lst1[9]); - this.num > 9 ? this.9.harmon_set_winsize(lst1[10]); - this.num > 10 ? this.10.harmon_set_winsize(lst1[11]); - this.num > 11 ? this.11.harmon_set_winsize(lst1[12]); - this.num > 12 ? this.12.harmon_set_winsize(lst1[13]); - this.num > 13 ? this.13.harmon_set_winsize(lst1[14]); - this.num > 14 ? this.14.harmon_set_winsize(lst1[15]); - this.num > 15 ? this.15.harmon_set_winsize(lst1[16]); - this.num > 16 ? this.16.harmon_set_winsize(lst1[17]); - this.num > 17 ? this.17.harmon_set_winsize(lst1[18]); - this.num > 18 ? this.18.harmon_set_winsize(lst1[19]); - this.num > 19 ? this.19.harmon_set_winsize(lst1[20]); - this.num > 20 ? this.20.harmon_set_winsize(lst1[21]); - this.num > 21 ? this.21.harmon_set_winsize(lst1[22]); - this.num > 22 ? this.22.harmon_set_winsize(lst1[23]); - this.num > 23 ? this.23.harmon_set_winsize(lst1[24]); - this.num > 24 ? this.24.harmon_set_winsize(lst1[25]); - this.num > 25 ? this.25.harmon_set_winsize(lst1[26]); - this.num > 26 ? this.26.harmon_set_winsize(lst1[27]); - this.num > 27 ? this.27.harmon_set_winsize(lst1[28]); - this.num > 28 ? this.28.harmon_set_winsize(lst1[29]); - this.num > 29 ? this.29.harmon_set_winsize(lst1[30]); - this.num > 30 ? this.30.harmon_set_winsize(lst1[31]); - this.num > 31 ? this.31.harmon_set_winsize(lst1[32]); - this.num > 32 ? this.32.harmon_set_winsize(lst1[33]); - this.num > 33 ? this.33.harmon_set_winsize(lst1[34]); - this.num > 34 ? this.34.harmon_set_winsize(lst1[35]); - this.num > 35 ? this.35.harmon_set_winsize(lst1[36]); - this.num > 36 ? this.36.harmon_set_winsize(lst1[37]); - this.num > 37 ? this.37.harmon_set_winsize(lst1[38]); - this.num > 38 ? this.38.harmon_set_winsize(lst1[39]); - this.num > 39 ? this.39.harmon_set_winsize(lst1[40]); -); -function Pharmon_do(signal) -( - num = signal[0]; - this.num > 0 ? this.outlist[1] = this.0.harmon_do(signal[(0 % num) + 1]); - this.num > 1 ? this.outlist[2] = this.1.harmon_do(signal[(1 % num) + 1]); - this.num > 2 ? this.outlist[3] = this.2.harmon_do(signal[(2 % num) + 1]); - this.num > 3 ? this.outlist[4] = this.3.harmon_do(signal[(3 % num) + 1]); - this.num > 4 ? this.outlist[5] = this.4.harmon_do(signal[(4 % num) + 1]); - this.num > 5 ? this.outlist[6] = this.5.harmon_do(signal[(5 % num) + 1]); - this.num > 6 ? this.outlist[7] = this.6.harmon_do(signal[(6 % num) + 1]); - this.num > 7 ? this.outlist[8] = this.7.harmon_do(signal[(7 % num) + 1]); - this.num > 8 ? this.outlist[9] = this.8.harmon_do(signal[(8 % num) + 1]); - this.num > 9 ? this.outlist[10] = this.9.harmon_do(signal[(9 % num) + 1]); - this.num > 10 ? this.outlist[11] = this.10.harmon_do(signal[(10 % num) + 1]); - this.num > 11 ? this.outlist[12] = this.11.harmon_do(signal[(11 % num) + 1]); - this.num > 12 ? this.outlist[13] = this.12.harmon_do(signal[(12 % num) + 1]); - this.num > 13 ? this.outlist[14] = this.13.harmon_do(signal[(13 % num) + 1]); - this.num > 14 ? this.outlist[15] = this.14.harmon_do(signal[(14 % num) + 1]); - this.num > 15 ? this.outlist[16] = this.15.harmon_do(signal[(15 % num) + 1]); - this.num > 16 ? this.outlist[17] = this.16.harmon_do(signal[(16 % num) + 1]); - this.num > 17 ? this.outlist[18] = this.17.harmon_do(signal[(17 % num) + 1]); - this.num > 18 ? this.outlist[19] = this.18.harmon_do(signal[(18 % num) + 1]); - this.num > 19 ? this.outlist[20] = this.19.harmon_do(signal[(19 % num) + 1]); - this.num > 20 ? this.outlist[21] = this.20.harmon_do(signal[(20 % num) + 1]); - this.num > 21 ? this.outlist[22] = this.21.harmon_do(signal[(21 % num) + 1]); - this.num > 22 ? this.outlist[23] = this.22.harmon_do(signal[(22 % num) + 1]); - this.num > 23 ? this.outlist[24] = this.23.harmon_do(signal[(23 % num) + 1]); - this.num > 24 ? this.outlist[25] = this.24.harmon_do(signal[(24 % num) + 1]); - this.num > 25 ? this.outlist[26] = this.25.harmon_do(signal[(25 % num) + 1]); - this.num > 26 ? this.outlist[27] = this.26.harmon_do(signal[(26 % num) + 1]); - this.num > 27 ? this.outlist[28] = this.27.harmon_do(signal[(27 % num) + 1]); - this.num > 28 ? this.outlist[29] = this.28.harmon_do(signal[(28 % num) + 1]); - this.num > 29 ? this.outlist[30] = this.29.harmon_do(signal[(29 % num) + 1]); - this.num > 30 ? this.outlist[31] = this.30.harmon_do(signal[(30 % num) + 1]); - this.num > 31 ? this.outlist[32] = this.31.harmon_do(signal[(31 % num) + 1]); - this.num > 32 ? this.outlist[33] = this.32.harmon_do(signal[(32 % num) + 1]); - this.num > 33 ? this.outlist[34] = this.33.harmon_do(signal[(33 % num) + 1]); - this.num > 34 ? this.outlist[35] = this.34.harmon_do(signal[(34 % num) + 1]); - this.num > 35 ? this.outlist[36] = this.35.harmon_do(signal[(35 % num) + 1]); - this.num > 36 ? this.outlist[37] = this.36.harmon_do(signal[(36 % num) + 1]); - this.num > 37 ? this.outlist[38] = this.37.harmon_do(signal[(37 % num) + 1]); - this.num > 38 ? this.outlist[39] = this.38.harmon_do(signal[(38 % num) + 1]); - this.num > 39 ? this.outlist[40] = this.39.harmon_do(signal[(39 % num) + 1]); - this.outlist; -); - -function Pwgverb(lst1 lst2 lst3) -( - this.num = lst1[0]; - this.outlist = memalloc(this.num + 1); - this.outlist[0] = this.num; - this.num > 0 ? this.0.wgverb(lst1[1], lst2[1], lst3[1]); - this.num > 1 ? this.1.wgverb(lst1[2], lst2[2], lst3[2]); - this.num > 2 ? this.2.wgverb(lst1[3], lst2[3], lst3[3]); - this.num > 3 ? this.3.wgverb(lst1[4], lst2[4], lst3[4]); - this.num > 4 ? this.4.wgverb(lst1[5], lst2[5], lst3[5]); - this.num > 5 ? this.5.wgverb(lst1[6], lst2[6], lst3[6]); - this.num > 6 ? this.6.wgverb(lst1[7], lst2[7], lst3[7]); - this.num > 7 ? this.7.wgverb(lst1[8], lst2[8], lst3[8]); - this.num > 8 ? this.8.wgverb(lst1[9], lst2[9], lst3[9]); - this.num > 9 ? this.9.wgverb(lst1[10], lst2[10], lst3[10]); - this.num > 10 ? this.10.wgverb(lst1[11], lst2[11], lst3[11]); - this.num > 11 ? this.11.wgverb(lst1[12], lst2[12], lst3[12]); - this.num > 12 ? this.12.wgverb(lst1[13], lst2[13], lst3[13]); - this.num > 13 ? this.13.wgverb(lst1[14], lst2[14], lst3[14]); - this.num > 14 ? this.14.wgverb(lst1[15], lst2[15], lst3[15]); - this.num > 15 ? this.15.wgverb(lst1[16], lst2[16], lst3[16]); - this.num > 16 ? this.16.wgverb(lst1[17], lst2[17], lst3[17]); - this.num > 17 ? this.17.wgverb(lst1[18], lst2[18], lst3[18]); - this.num > 18 ? this.18.wgverb(lst1[19], lst2[19], lst3[19]); - this.num > 19 ? this.19.wgverb(lst1[20], lst2[20], lst3[20]); - this.num > 20 ? this.20.wgverb(lst1[21], lst2[21], lst3[21]); - this.num > 21 ? this.21.wgverb(lst1[22], lst2[22], lst3[22]); - this.num > 22 ? this.22.wgverb(lst1[23], lst2[23], lst3[23]); - this.num > 23 ? this.23.wgverb(lst1[24], lst2[24], lst3[24]); - this.num > 24 ? this.24.wgverb(lst1[25], lst2[25], lst3[25]); - this.num > 25 ? this.25.wgverb(lst1[26], lst2[26], lst3[26]); - this.num > 26 ? this.26.wgverb(lst1[27], lst2[27], lst3[27]); - this.num > 27 ? this.27.wgverb(lst1[28], lst2[28], lst3[28]); - this.num > 28 ? this.28.wgverb(lst1[29], lst2[29], lst3[29]); - this.num > 29 ? this.29.wgverb(lst1[30], lst2[30], lst3[30]); - this.num > 30 ? this.30.wgverb(lst1[31], lst2[31], lst3[31]); - this.num > 31 ? this.31.wgverb(lst1[32], lst2[32], lst3[32]); - this.num > 32 ? this.32.wgverb(lst1[33], lst2[33], lst3[33]); - this.num > 33 ? this.33.wgverb(lst1[34], lst2[34], lst3[34]); - this.num > 34 ? this.34.wgverb(lst1[35], lst2[35], lst3[35]); - this.num > 35 ? this.35.wgverb(lst1[36], lst2[36], lst3[36]); - this.num > 36 ? this.36.wgverb(lst1[37], lst2[37], lst3[37]); - this.num > 37 ? this.37.wgverb(lst1[38], lst2[38], lst3[38]); - this.num > 38 ? this.38.wgverb(lst1[39], lst2[39], lst3[39]); - this.num > 39 ? this.39.wgverb(lst1[40], lst2[40], lst3[40]); -); -function Pwgverb_set_feed(lst1) -( - this.num > 0 ? this.0.wgverb_set_feed(lst1[1]); - this.num > 1 ? this.1.wgverb_set_feed(lst1[2]); - this.num > 2 ? this.2.wgverb_set_feed(lst1[3]); - this.num > 3 ? this.3.wgverb_set_feed(lst1[4]); - this.num > 4 ? this.4.wgverb_set_feed(lst1[5]); - this.num > 5 ? this.5.wgverb_set_feed(lst1[6]); - this.num > 6 ? this.6.wgverb_set_feed(lst1[7]); - this.num > 7 ? this.7.wgverb_set_feed(lst1[8]); - this.num > 8 ? this.8.wgverb_set_feed(lst1[9]); - this.num > 9 ? this.9.wgverb_set_feed(lst1[10]); - this.num > 10 ? this.10.wgverb_set_feed(lst1[11]); - this.num > 11 ? this.11.wgverb_set_feed(lst1[12]); - this.num > 12 ? this.12.wgverb_set_feed(lst1[13]); - this.num > 13 ? this.13.wgverb_set_feed(lst1[14]); - this.num > 14 ? this.14.wgverb_set_feed(lst1[15]); - this.num > 15 ? this.15.wgverb_set_feed(lst1[16]); - this.num > 16 ? this.16.wgverb_set_feed(lst1[17]); - this.num > 17 ? this.17.wgverb_set_feed(lst1[18]); - this.num > 18 ? this.18.wgverb_set_feed(lst1[19]); - this.num > 19 ? this.19.wgverb_set_feed(lst1[20]); - this.num > 20 ? this.20.wgverb_set_feed(lst1[21]); - this.num > 21 ? this.21.wgverb_set_feed(lst1[22]); - this.num > 22 ? this.22.wgverb_set_feed(lst1[23]); - this.num > 23 ? this.23.wgverb_set_feed(lst1[24]); - this.num > 24 ? this.24.wgverb_set_feed(lst1[25]); - this.num > 25 ? this.25.wgverb_set_feed(lst1[26]); - this.num > 26 ? this.26.wgverb_set_feed(lst1[27]); - this.num > 27 ? this.27.wgverb_set_feed(lst1[28]); - this.num > 28 ? this.28.wgverb_set_feed(lst1[29]); - this.num > 29 ? this.29.wgverb_set_feed(lst1[30]); - this.num > 30 ? this.30.wgverb_set_feed(lst1[31]); - this.num > 31 ? this.31.wgverb_set_feed(lst1[32]); - this.num > 32 ? this.32.wgverb_set_feed(lst1[33]); - this.num > 33 ? this.33.wgverb_set_feed(lst1[34]); - this.num > 34 ? this.34.wgverb_set_feed(lst1[35]); - this.num > 35 ? this.35.wgverb_set_feed(lst1[36]); - this.num > 36 ? this.36.wgverb_set_feed(lst1[37]); - this.num > 37 ? this.37.wgverb_set_feed(lst1[38]); - this.num > 38 ? this.38.wgverb_set_feed(lst1[39]); - this.num > 39 ? this.39.wgverb_set_feed(lst1[40]); -); -function Pwgverb_set_cutoff(lst1) -( - this.num > 0 ? this.0.wgverb_set_cutoff(lst1[1]); - this.num > 1 ? this.1.wgverb_set_cutoff(lst1[2]); - this.num > 2 ? this.2.wgverb_set_cutoff(lst1[3]); - this.num > 3 ? this.3.wgverb_set_cutoff(lst1[4]); - this.num > 4 ? this.4.wgverb_set_cutoff(lst1[5]); - this.num > 5 ? this.5.wgverb_set_cutoff(lst1[6]); - this.num > 6 ? this.6.wgverb_set_cutoff(lst1[7]); - this.num > 7 ? this.7.wgverb_set_cutoff(lst1[8]); - this.num > 8 ? this.8.wgverb_set_cutoff(lst1[9]); - this.num > 9 ? this.9.wgverb_set_cutoff(lst1[10]); - this.num > 10 ? this.10.wgverb_set_cutoff(lst1[11]); - this.num > 11 ? this.11.wgverb_set_cutoff(lst1[12]); - this.num > 12 ? this.12.wgverb_set_cutoff(lst1[13]); - this.num > 13 ? this.13.wgverb_set_cutoff(lst1[14]); - this.num > 14 ? this.14.wgverb_set_cutoff(lst1[15]); - this.num > 15 ? this.15.wgverb_set_cutoff(lst1[16]); - this.num > 16 ? this.16.wgverb_set_cutoff(lst1[17]); - this.num > 17 ? this.17.wgverb_set_cutoff(lst1[18]); - this.num > 18 ? this.18.wgverb_set_cutoff(lst1[19]); - this.num > 19 ? this.19.wgverb_set_cutoff(lst1[20]); - this.num > 20 ? this.20.wgverb_set_cutoff(lst1[21]); - this.num > 21 ? this.21.wgverb_set_cutoff(lst1[22]); - this.num > 22 ? this.22.wgverb_set_cutoff(lst1[23]); - this.num > 23 ? this.23.wgverb_set_cutoff(lst1[24]); - this.num > 24 ? this.24.wgverb_set_cutoff(lst1[25]); - this.num > 25 ? this.25.wgverb_set_cutoff(lst1[26]); - this.num > 26 ? this.26.wgverb_set_cutoff(lst1[27]); - this.num > 27 ? this.27.wgverb_set_cutoff(lst1[28]); - this.num > 28 ? this.28.wgverb_set_cutoff(lst1[29]); - this.num > 29 ? this.29.wgverb_set_cutoff(lst1[30]); - this.num > 30 ? this.30.wgverb_set_cutoff(lst1[31]); - this.num > 31 ? this.31.wgverb_set_cutoff(lst1[32]); - this.num > 32 ? this.32.wgverb_set_cutoff(lst1[33]); - this.num > 33 ? this.33.wgverb_set_cutoff(lst1[34]); - this.num > 34 ? this.34.wgverb_set_cutoff(lst1[35]); - this.num > 35 ? this.35.wgverb_set_cutoff(lst1[36]); - this.num > 36 ? this.36.wgverb_set_cutoff(lst1[37]); - this.num > 37 ? this.37.wgverb_set_cutoff(lst1[38]); - this.num > 38 ? this.38.wgverb_set_cutoff(lst1[39]); - this.num > 39 ? this.39.wgverb_set_cutoff(lst1[40]); -); -function Pwgverb_set_bal(lst1) -( - this.num > 0 ? this.0.wgverb_set_bal(lst1[1]); - this.num > 1 ? this.1.wgverb_set_bal(lst1[2]); - this.num > 2 ? this.2.wgverb_set_bal(lst1[3]); - this.num > 3 ? this.3.wgverb_set_bal(lst1[4]); - this.num > 4 ? this.4.wgverb_set_bal(lst1[5]); - this.num > 5 ? this.5.wgverb_set_bal(lst1[6]); - this.num > 6 ? this.6.wgverb_set_bal(lst1[7]); - this.num > 7 ? this.7.wgverb_set_bal(lst1[8]); - this.num > 8 ? this.8.wgverb_set_bal(lst1[9]); - this.num > 9 ? this.9.wgverb_set_bal(lst1[10]); - this.num > 10 ? this.10.wgverb_set_bal(lst1[11]); - this.num > 11 ? this.11.wgverb_set_bal(lst1[12]); - this.num > 12 ? this.12.wgverb_set_bal(lst1[13]); - this.num > 13 ? this.13.wgverb_set_bal(lst1[14]); - this.num > 14 ? this.14.wgverb_set_bal(lst1[15]); - this.num > 15 ? this.15.wgverb_set_bal(lst1[16]); - this.num > 16 ? this.16.wgverb_set_bal(lst1[17]); - this.num > 17 ? this.17.wgverb_set_bal(lst1[18]); - this.num > 18 ? this.18.wgverb_set_bal(lst1[19]); - this.num > 19 ? this.19.wgverb_set_bal(lst1[20]); - this.num > 20 ? this.20.wgverb_set_bal(lst1[21]); - this.num > 21 ? this.21.wgverb_set_bal(lst1[22]); - this.num > 22 ? this.22.wgverb_set_bal(lst1[23]); - this.num > 23 ? this.23.wgverb_set_bal(lst1[24]); - this.num > 24 ? this.24.wgverb_set_bal(lst1[25]); - this.num > 25 ? this.25.wgverb_set_bal(lst1[26]); - this.num > 26 ? this.26.wgverb_set_bal(lst1[27]); - this.num > 27 ? this.27.wgverb_set_bal(lst1[28]); - this.num > 28 ? this.28.wgverb_set_bal(lst1[29]); - this.num > 29 ? this.29.wgverb_set_bal(lst1[30]); - this.num > 30 ? this.30.wgverb_set_bal(lst1[31]); - this.num > 31 ? this.31.wgverb_set_bal(lst1[32]); - this.num > 32 ? this.32.wgverb_set_bal(lst1[33]); - this.num > 33 ? this.33.wgverb_set_bal(lst1[34]); - this.num > 34 ? this.34.wgverb_set_bal(lst1[35]); - this.num > 35 ? this.35.wgverb_set_bal(lst1[36]); - this.num > 36 ? this.36.wgverb_set_bal(lst1[37]); - this.num > 37 ? this.37.wgverb_set_bal(lst1[38]); - this.num > 38 ? this.38.wgverb_set_bal(lst1[39]); - this.num > 39 ? this.39.wgverb_set_bal(lst1[40]); -); -function Pwgverb_do(signal) -( - num = signal[0]; - this.num > 0 ? this.outlist[1] = this.0.wgverb_do(signal[(0 % num) + 1]); - this.num > 1 ? this.outlist[2] = this.1.wgverb_do(signal[(1 % num) + 1]); - this.num > 2 ? this.outlist[3] = this.2.wgverb_do(signal[(2 % num) + 1]); - this.num > 3 ? this.outlist[4] = this.3.wgverb_do(signal[(3 % num) + 1]); - this.num > 4 ? this.outlist[5] = this.4.wgverb_do(signal[(4 % num) + 1]); - this.num > 5 ? this.outlist[6] = this.5.wgverb_do(signal[(5 % num) + 1]); - this.num > 6 ? this.outlist[7] = this.6.wgverb_do(signal[(6 % num) + 1]); - this.num > 7 ? this.outlist[8] = this.7.wgverb_do(signal[(7 % num) + 1]); - this.num > 8 ? this.outlist[9] = this.8.wgverb_do(signal[(8 % num) + 1]); - this.num > 9 ? this.outlist[10] = this.9.wgverb_do(signal[(9 % num) + 1]); - this.num > 10 ? this.outlist[11] = this.10.wgverb_do(signal[(10 % num) + 1]); - this.num > 11 ? this.outlist[12] = this.11.wgverb_do(signal[(11 % num) + 1]); - this.num > 12 ? this.outlist[13] = this.12.wgverb_do(signal[(12 % num) + 1]); - this.num > 13 ? this.outlist[14] = this.13.wgverb_do(signal[(13 % num) + 1]); - this.num > 14 ? this.outlist[15] = this.14.wgverb_do(signal[(14 % num) + 1]); - this.num > 15 ? this.outlist[16] = this.15.wgverb_do(signal[(15 % num) + 1]); - this.num > 16 ? this.outlist[17] = this.16.wgverb_do(signal[(16 % num) + 1]); - this.num > 17 ? this.outlist[18] = this.17.wgverb_do(signal[(17 % num) + 1]); - this.num > 18 ? this.outlist[19] = this.18.wgverb_do(signal[(18 % num) + 1]); - this.num > 19 ? this.outlist[20] = this.19.wgverb_do(signal[(19 % num) + 1]); - this.num > 20 ? this.outlist[21] = this.20.wgverb_do(signal[(20 % num) + 1]); - this.num > 21 ? this.outlist[22] = this.21.wgverb_do(signal[(21 % num) + 1]); - this.num > 22 ? this.outlist[23] = this.22.wgverb_do(signal[(22 % num) + 1]); - this.num > 23 ? this.outlist[24] = this.23.wgverb_do(signal[(23 % num) + 1]); - this.num > 24 ? this.outlist[25] = this.24.wgverb_do(signal[(24 % num) + 1]); - this.num > 25 ? this.outlist[26] = this.25.wgverb_do(signal[(25 % num) + 1]); - this.num > 26 ? this.outlist[27] = this.26.wgverb_do(signal[(26 % num) + 1]); - this.num > 27 ? this.outlist[28] = this.27.wgverb_do(signal[(27 % num) + 1]); - this.num > 28 ? this.outlist[29] = this.28.wgverb_do(signal[(28 % num) + 1]); - this.num > 29 ? this.outlist[30] = this.29.wgverb_do(signal[(29 % num) + 1]); - this.num > 30 ? this.outlist[31] = this.30.wgverb_do(signal[(30 % num) + 1]); - this.num > 31 ? this.outlist[32] = this.31.wgverb_do(signal[(31 % num) + 1]); - this.num > 32 ? this.outlist[33] = this.32.wgverb_do(signal[(32 % num) + 1]); - this.num > 33 ? this.outlist[34] = this.33.wgverb_do(signal[(33 % num) + 1]); - this.num > 34 ? this.outlist[35] = this.34.wgverb_do(signal[(34 % num) + 1]); - this.num > 35 ? this.outlist[36] = this.35.wgverb_do(signal[(35 % num) + 1]); - this.num > 36 ? this.outlist[37] = this.36.wgverb_do(signal[(36 % num) + 1]); - this.num > 37 ? this.outlist[38] = this.37.wgverb_do(signal[(37 % num) + 1]); - this.num > 38 ? this.outlist[39] = this.38.wgverb_do(signal[(38 % num) + 1]); - this.num > 39 ? this.outlist[40] = this.39.wgverb_do(signal[(39 % num) + 1]); - this.outlist; -); - -function Pblosc(lst1 lst2 lst3) -( - this.num = lst1[0]; - this.outlist = memalloc(this.num + 1); - this.outlist[0] = this.num; - this.num > 0 ? this.0.blosc(lst1[1], lst2[1], lst3[1]); - this.num > 1 ? this.1.blosc(lst1[2], lst2[2], lst3[2]); - this.num > 2 ? this.2.blosc(lst1[3], lst2[3], lst3[3]); - this.num > 3 ? this.3.blosc(lst1[4], lst2[4], lst3[4]); - this.num > 4 ? this.4.blosc(lst1[5], lst2[5], lst3[5]); - this.num > 5 ? this.5.blosc(lst1[6], lst2[6], lst3[6]); - this.num > 6 ? this.6.blosc(lst1[7], lst2[7], lst3[7]); - this.num > 7 ? this.7.blosc(lst1[8], lst2[8], lst3[8]); - this.num > 8 ? this.8.blosc(lst1[9], lst2[9], lst3[9]); - this.num > 9 ? this.9.blosc(lst1[10], lst2[10], lst3[10]); - this.num > 10 ? this.10.blosc(lst1[11], lst2[11], lst3[11]); - this.num > 11 ? this.11.blosc(lst1[12], lst2[12], lst3[12]); - this.num > 12 ? this.12.blosc(lst1[13], lst2[13], lst3[13]); - this.num > 13 ? this.13.blosc(lst1[14], lst2[14], lst3[14]); - this.num > 14 ? this.14.blosc(lst1[15], lst2[15], lst3[15]); - this.num > 15 ? this.15.blosc(lst1[16], lst2[16], lst3[16]); - this.num > 16 ? this.16.blosc(lst1[17], lst2[17], lst3[17]); - this.num > 17 ? this.17.blosc(lst1[18], lst2[18], lst3[18]); - this.num > 18 ? this.18.blosc(lst1[19], lst2[19], lst3[19]); - this.num > 19 ? this.19.blosc(lst1[20], lst2[20], lst3[20]); - this.num > 20 ? this.20.blosc(lst1[21], lst2[21], lst3[21]); - this.num > 21 ? this.21.blosc(lst1[22], lst2[22], lst3[22]); - this.num > 22 ? this.22.blosc(lst1[23], lst2[23], lst3[23]); - this.num > 23 ? this.23.blosc(lst1[24], lst2[24], lst3[24]); - this.num > 24 ? this.24.blosc(lst1[25], lst2[25], lst3[25]); - this.num > 25 ? this.25.blosc(lst1[26], lst2[26], lst3[26]); - this.num > 26 ? this.26.blosc(lst1[27], lst2[27], lst3[27]); - this.num > 27 ? this.27.blosc(lst1[28], lst2[28], lst3[28]); - this.num > 28 ? this.28.blosc(lst1[29], lst2[29], lst3[29]); - this.num > 29 ? this.29.blosc(lst1[30], lst2[30], lst3[30]); - this.num > 30 ? this.30.blosc(lst1[31], lst2[31], lst3[31]); - this.num > 31 ? this.31.blosc(lst1[32], lst2[32], lst3[32]); - this.num > 32 ? this.32.blosc(lst1[33], lst2[33], lst3[33]); - this.num > 33 ? this.33.blosc(lst1[34], lst2[34], lst3[34]); - this.num > 34 ? this.34.blosc(lst1[35], lst2[35], lst3[35]); - this.num > 35 ? this.35.blosc(lst1[36], lst2[36], lst3[36]); - this.num > 36 ? this.36.blosc(lst1[37], lst2[37], lst3[37]); - this.num > 37 ? this.37.blosc(lst1[38], lst2[38], lst3[38]); - this.num > 38 ? this.38.blosc(lst1[39], lst2[39], lst3[39]); - this.num > 39 ? this.39.blosc(lst1[40], lst2[40], lst3[40]); -); -function Pblosc_set_freq(lst1) -( - this.num > 0 ? this.0.blosc_set_freq(lst1[1]); - this.num > 1 ? this.1.blosc_set_freq(lst1[2]); - this.num > 2 ? this.2.blosc_set_freq(lst1[3]); - this.num > 3 ? this.3.blosc_set_freq(lst1[4]); - this.num > 4 ? this.4.blosc_set_freq(lst1[5]); - this.num > 5 ? this.5.blosc_set_freq(lst1[6]); - this.num > 6 ? this.6.blosc_set_freq(lst1[7]); - this.num > 7 ? this.7.blosc_set_freq(lst1[8]); - this.num > 8 ? this.8.blosc_set_freq(lst1[9]); - this.num > 9 ? this.9.blosc_set_freq(lst1[10]); - this.num > 10 ? this.10.blosc_set_freq(lst1[11]); - this.num > 11 ? this.11.blosc_set_freq(lst1[12]); - this.num > 12 ? this.12.blosc_set_freq(lst1[13]); - this.num > 13 ? this.13.blosc_set_freq(lst1[14]); - this.num > 14 ? this.14.blosc_set_freq(lst1[15]); - this.num > 15 ? this.15.blosc_set_freq(lst1[16]); - this.num > 16 ? this.16.blosc_set_freq(lst1[17]); - this.num > 17 ? this.17.blosc_set_freq(lst1[18]); - this.num > 18 ? this.18.blosc_set_freq(lst1[19]); - this.num > 19 ? this.19.blosc_set_freq(lst1[20]); - this.num > 20 ? this.20.blosc_set_freq(lst1[21]); - this.num > 21 ? this.21.blosc_set_freq(lst1[22]); - this.num > 22 ? this.22.blosc_set_freq(lst1[23]); - this.num > 23 ? this.23.blosc_set_freq(lst1[24]); - this.num > 24 ? this.24.blosc_set_freq(lst1[25]); - this.num > 25 ? this.25.blosc_set_freq(lst1[26]); - this.num > 26 ? this.26.blosc_set_freq(lst1[27]); - this.num > 27 ? this.27.blosc_set_freq(lst1[28]); - this.num > 28 ? this.28.blosc_set_freq(lst1[29]); - this.num > 29 ? this.29.blosc_set_freq(lst1[30]); - this.num > 30 ? this.30.blosc_set_freq(lst1[31]); - this.num > 31 ? this.31.blosc_set_freq(lst1[32]); - this.num > 32 ? this.32.blosc_set_freq(lst1[33]); - this.num > 33 ? this.33.blosc_set_freq(lst1[34]); - this.num > 34 ? this.34.blosc_set_freq(lst1[35]); - this.num > 35 ? this.35.blosc_set_freq(lst1[36]); - this.num > 36 ? this.36.blosc_set_freq(lst1[37]); - this.num > 37 ? this.37.blosc_set_freq(lst1[38]); - this.num > 38 ? this.38.blosc_set_freq(lst1[39]); - this.num > 39 ? this.39.blosc_set_freq(lst1[40]); -); -function Pblosc_set_sharp(lst1) -( - this.num > 0 ? this.0.blosc_set_sharp(lst1[1]); - this.num > 1 ? this.1.blosc_set_sharp(lst1[2]); - this.num > 2 ? this.2.blosc_set_sharp(lst1[3]); - this.num > 3 ? this.3.blosc_set_sharp(lst1[4]); - this.num > 4 ? this.4.blosc_set_sharp(lst1[5]); - this.num > 5 ? this.5.blosc_set_sharp(lst1[6]); - this.num > 6 ? this.6.blosc_set_sharp(lst1[7]); - this.num > 7 ? this.7.blosc_set_sharp(lst1[8]); - this.num > 8 ? this.8.blosc_set_sharp(lst1[9]); - this.num > 9 ? this.9.blosc_set_sharp(lst1[10]); - this.num > 10 ? this.10.blosc_set_sharp(lst1[11]); - this.num > 11 ? this.11.blosc_set_sharp(lst1[12]); - this.num > 12 ? this.12.blosc_set_sharp(lst1[13]); - this.num > 13 ? this.13.blosc_set_sharp(lst1[14]); - this.num > 14 ? this.14.blosc_set_sharp(lst1[15]); - this.num > 15 ? this.15.blosc_set_sharp(lst1[16]); - this.num > 16 ? this.16.blosc_set_sharp(lst1[17]); - this.num > 17 ? this.17.blosc_set_sharp(lst1[18]); - this.num > 18 ? this.18.blosc_set_sharp(lst1[19]); - this.num > 19 ? this.19.blosc_set_sharp(lst1[20]); - this.num > 20 ? this.20.blosc_set_sharp(lst1[21]); - this.num > 21 ? this.21.blosc_set_sharp(lst1[22]); - this.num > 22 ? this.22.blosc_set_sharp(lst1[23]); - this.num > 23 ? this.23.blosc_set_sharp(lst1[24]); - this.num > 24 ? this.24.blosc_set_sharp(lst1[25]); - this.num > 25 ? this.25.blosc_set_sharp(lst1[26]); - this.num > 26 ? this.26.blosc_set_sharp(lst1[27]); - this.num > 27 ? this.27.blosc_set_sharp(lst1[28]); - this.num > 28 ? this.28.blosc_set_sharp(lst1[29]); - this.num > 29 ? this.29.blosc_set_sharp(lst1[30]); - this.num > 30 ? this.30.blosc_set_sharp(lst1[31]); - this.num > 31 ? this.31.blosc_set_sharp(lst1[32]); - this.num > 32 ? this.32.blosc_set_sharp(lst1[33]); - this.num > 33 ? this.33.blosc_set_sharp(lst1[34]); - this.num > 34 ? this.34.blosc_set_sharp(lst1[35]); - this.num > 35 ? this.35.blosc_set_sharp(lst1[36]); - this.num > 36 ? this.36.blosc_set_sharp(lst1[37]); - this.num > 37 ? this.37.blosc_set_sharp(lst1[38]); - this.num > 38 ? this.38.blosc_set_sharp(lst1[39]); - this.num > 39 ? this.39.blosc_set_sharp(lst1[40]); -); -function Pblosc_set_type(lst1) -( - this.num > 0 ? this.0.blosc_set_type(lst1[1]); - this.num > 1 ? this.1.blosc_set_type(lst1[2]); - this.num > 2 ? this.2.blosc_set_type(lst1[3]); - this.num > 3 ? this.3.blosc_set_type(lst1[4]); - this.num > 4 ? this.4.blosc_set_type(lst1[5]); - this.num > 5 ? this.5.blosc_set_type(lst1[6]); - this.num > 6 ? this.6.blosc_set_type(lst1[7]); - this.num > 7 ? this.7.blosc_set_type(lst1[8]); - this.num > 8 ? this.8.blosc_set_type(lst1[9]); - this.num > 9 ? this.9.blosc_set_type(lst1[10]); - this.num > 10 ? this.10.blosc_set_type(lst1[11]); - this.num > 11 ? this.11.blosc_set_type(lst1[12]); - this.num > 12 ? this.12.blosc_set_type(lst1[13]); - this.num > 13 ? this.13.blosc_set_type(lst1[14]); - this.num > 14 ? this.14.blosc_set_type(lst1[15]); - this.num > 15 ? this.15.blosc_set_type(lst1[16]); - this.num > 16 ? this.16.blosc_set_type(lst1[17]); - this.num > 17 ? this.17.blosc_set_type(lst1[18]); - this.num > 18 ? this.18.blosc_set_type(lst1[19]); - this.num > 19 ? this.19.blosc_set_type(lst1[20]); - this.num > 20 ? this.20.blosc_set_type(lst1[21]); - this.num > 21 ? this.21.blosc_set_type(lst1[22]); - this.num > 22 ? this.22.blosc_set_type(lst1[23]); - this.num > 23 ? this.23.blosc_set_type(lst1[24]); - this.num > 24 ? this.24.blosc_set_type(lst1[25]); - this.num > 25 ? this.25.blosc_set_type(lst1[26]); - this.num > 26 ? this.26.blosc_set_type(lst1[27]); - this.num > 27 ? this.27.blosc_set_type(lst1[28]); - this.num > 28 ? this.28.blosc_set_type(lst1[29]); - this.num > 29 ? this.29.blosc_set_type(lst1[30]); - this.num > 30 ? this.30.blosc_set_type(lst1[31]); - this.num > 31 ? this.31.blosc_set_type(lst1[32]); - this.num > 32 ? this.32.blosc_set_type(lst1[33]); - this.num > 33 ? this.33.blosc_set_type(lst1[34]); - this.num > 34 ? this.34.blosc_set_type(lst1[35]); - this.num > 35 ? this.35.blosc_set_type(lst1[36]); - this.num > 36 ? this.36.blosc_set_type(lst1[37]); - this.num > 37 ? this.37.blosc_set_type(lst1[38]); - this.num > 38 ? this.38.blosc_set_type(lst1[39]); - this.num > 39 ? this.39.blosc_set_type(lst1[40]); -); -function Pblosc_reset() -( - this.num > 0 ? this.0.blosc_reset(); - this.num > 1 ? this.1.blosc_reset(); - this.num > 2 ? this.2.blosc_reset(); - this.num > 3 ? this.3.blosc_reset(); - this.num > 4 ? this.4.blosc_reset(); - this.num > 5 ? this.5.blosc_reset(); - this.num > 6 ? this.6.blosc_reset(); - this.num > 7 ? this.7.blosc_reset(); - this.num > 8 ? this.8.blosc_reset(); - this.num > 9 ? this.9.blosc_reset(); - this.num > 10 ? this.10.blosc_reset(); - this.num > 11 ? this.11.blosc_reset(); - this.num > 12 ? this.12.blosc_reset(); - this.num > 13 ? this.13.blosc_reset(); - this.num > 14 ? this.14.blosc_reset(); - this.num > 15 ? this.15.blosc_reset(); - this.num > 16 ? this.16.blosc_reset(); - this.num > 17 ? this.17.blosc_reset(); - this.num > 18 ? this.18.blosc_reset(); - this.num > 19 ? this.19.blosc_reset(); - this.num > 20 ? this.20.blosc_reset(); - this.num > 21 ? this.21.blosc_reset(); - this.num > 22 ? this.22.blosc_reset(); - this.num > 23 ? this.23.blosc_reset(); - this.num > 24 ? this.24.blosc_reset(); - this.num > 25 ? this.25.blosc_reset(); - this.num > 26 ? this.26.blosc_reset(); - this.num > 27 ? this.27.blosc_reset(); - this.num > 28 ? this.28.blosc_reset(); - this.num > 29 ? this.29.blosc_reset(); - this.num > 30 ? this.30.blosc_reset(); - this.num > 31 ? this.31.blosc_reset(); - this.num > 32 ? this.32.blosc_reset(); - this.num > 33 ? this.33.blosc_reset(); - this.num > 34 ? this.34.blosc_reset(); - this.num > 35 ? this.35.blosc_reset(); - this.num > 36 ? this.36.blosc_reset(); - this.num > 37 ? this.37.blosc_reset(); - this.num > 38 ? this.38.blosc_reset(); - this.num > 39 ? this.39.blosc_reset(); -); -function Pblosc_do() -( - this.num > 0 ? this.outlist[1] = this.0.blosc_do(); - this.num > 1 ? this.outlist[2] = this.1.blosc_do(); - this.num > 2 ? this.outlist[3] = this.2.blosc_do(); - this.num > 3 ? this.outlist[4] = this.3.blosc_do(); - this.num > 4 ? this.outlist[5] = this.4.blosc_do(); - this.num > 5 ? this.outlist[6] = this.5.blosc_do(); - this.num > 6 ? this.outlist[7] = this.6.blosc_do(); - this.num > 7 ? this.outlist[8] = this.7.blosc_do(); - this.num > 8 ? this.outlist[9] = this.8.blosc_do(); - this.num > 9 ? this.outlist[10] = this.9.blosc_do(); - this.num > 10 ? this.outlist[11] = this.10.blosc_do(); - this.num > 11 ? this.outlist[12] = this.11.blosc_do(); - this.num > 12 ? this.outlist[13] = this.12.blosc_do(); - this.num > 13 ? this.outlist[14] = this.13.blosc_do(); - this.num > 14 ? this.outlist[15] = this.14.blosc_do(); - this.num > 15 ? this.outlist[16] = this.15.blosc_do(); - this.num > 16 ? this.outlist[17] = this.16.blosc_do(); - this.num > 17 ? this.outlist[18] = this.17.blosc_do(); - this.num > 18 ? this.outlist[19] = this.18.blosc_do(); - this.num > 19 ? this.outlist[20] = this.19.blosc_do(); - this.num > 20 ? this.outlist[21] = this.20.blosc_do(); - this.num > 21 ? this.outlist[22] = this.21.blosc_do(); - this.num > 22 ? this.outlist[23] = this.22.blosc_do(); - this.num > 23 ? this.outlist[24] = this.23.blosc_do(); - this.num > 24 ? this.outlist[25] = this.24.blosc_do(); - this.num > 25 ? this.outlist[26] = this.25.blosc_do(); - this.num > 26 ? this.outlist[27] = this.26.blosc_do(); - this.num > 27 ? this.outlist[28] = this.27.blosc_do(); - this.num > 28 ? this.outlist[29] = this.28.blosc_do(); - this.num > 29 ? this.outlist[30] = this.29.blosc_do(); - this.num > 30 ? this.outlist[31] = this.30.blosc_do(); - this.num > 31 ? this.outlist[32] = this.31.blosc_do(); - this.num > 32 ? this.outlist[33] = this.32.blosc_do(); - this.num > 33 ? this.outlist[34] = this.33.blosc_do(); - this.num > 34 ? this.outlist[35] = this.34.blosc_do(); - this.num > 35 ? this.outlist[36] = this.35.blosc_do(); - this.num > 36 ? this.outlist[37] = this.36.blosc_do(); - this.num > 37 ? this.outlist[38] = this.37.blosc_do(); - this.num > 38 ? this.outlist[39] = this.38.blosc_do(); - this.num > 39 ? this.outlist[40] = this.39.blosc_do(); - this.outlist; -); - -function Pchorus(lst1 lst2 lst3) -( - this.num = lst1[0]; - this.outlist = memalloc(this.num + 1); - this.outlist[0] = this.num; - this.num > 0 ? this.0.chorus(lst1[1], lst2[1], lst3[1]); - this.num > 1 ? this.1.chorus(lst1[2], lst2[2], lst3[2]); - this.num > 2 ? this.2.chorus(lst1[3], lst2[3], lst3[3]); - this.num > 3 ? this.3.chorus(lst1[4], lst2[4], lst3[4]); - this.num > 4 ? this.4.chorus(lst1[5], lst2[5], lst3[5]); - this.num > 5 ? this.5.chorus(lst1[6], lst2[6], lst3[6]); - this.num > 6 ? this.6.chorus(lst1[7], lst2[7], lst3[7]); - this.num > 7 ? this.7.chorus(lst1[8], lst2[8], lst3[8]); - this.num > 8 ? this.8.chorus(lst1[9], lst2[9], lst3[9]); - this.num > 9 ? this.9.chorus(lst1[10], lst2[10], lst3[10]); - this.num > 10 ? this.10.chorus(lst1[11], lst2[11], lst3[11]); - this.num > 11 ? this.11.chorus(lst1[12], lst2[12], lst3[12]); - this.num > 12 ? this.12.chorus(lst1[13], lst2[13], lst3[13]); - this.num > 13 ? this.13.chorus(lst1[14], lst2[14], lst3[14]); - this.num > 14 ? this.14.chorus(lst1[15], lst2[15], lst3[15]); - this.num > 15 ? this.15.chorus(lst1[16], lst2[16], lst3[16]); - this.num > 16 ? this.16.chorus(lst1[17], lst2[17], lst3[17]); - this.num > 17 ? this.17.chorus(lst1[18], lst2[18], lst3[18]); - this.num > 18 ? this.18.chorus(lst1[19], lst2[19], lst3[19]); - this.num > 19 ? this.19.chorus(lst1[20], lst2[20], lst3[20]); - this.num > 20 ? this.20.chorus(lst1[21], lst2[21], lst3[21]); - this.num > 21 ? this.21.chorus(lst1[22], lst2[22], lst3[22]); - this.num > 22 ? this.22.chorus(lst1[23], lst2[23], lst3[23]); - this.num > 23 ? this.23.chorus(lst1[24], lst2[24], lst3[24]); - this.num > 24 ? this.24.chorus(lst1[25], lst2[25], lst3[25]); - this.num > 25 ? this.25.chorus(lst1[26], lst2[26], lst3[26]); - this.num > 26 ? this.26.chorus(lst1[27], lst2[27], lst3[27]); - this.num > 27 ? this.27.chorus(lst1[28], lst2[28], lst3[28]); - this.num > 28 ? this.28.chorus(lst1[29], lst2[29], lst3[29]); - this.num > 29 ? this.29.chorus(lst1[30], lst2[30], lst3[30]); - this.num > 30 ? this.30.chorus(lst1[31], lst2[31], lst3[31]); - this.num > 31 ? this.31.chorus(lst1[32], lst2[32], lst3[32]); - this.num > 32 ? this.32.chorus(lst1[33], lst2[33], lst3[33]); - this.num > 33 ? this.33.chorus(lst1[34], lst2[34], lst3[34]); - this.num > 34 ? this.34.chorus(lst1[35], lst2[35], lst3[35]); - this.num > 35 ? this.35.chorus(lst1[36], lst2[36], lst3[36]); - this.num > 36 ? this.36.chorus(lst1[37], lst2[37], lst3[37]); - this.num > 37 ? this.37.chorus(lst1[38], lst2[38], lst3[38]); - this.num > 38 ? this.38.chorus(lst1[39], lst2[39], lst3[39]); - this.num > 39 ? this.39.chorus(lst1[40], lst2[40], lst3[40]); -); -function Pchorus_set_depth(lst1) -( - this.num > 0 ? this.0.chorus_set_depth(lst1[1]); - this.num > 1 ? this.1.chorus_set_depth(lst1[2]); - this.num > 2 ? this.2.chorus_set_depth(lst1[3]); - this.num > 3 ? this.3.chorus_set_depth(lst1[4]); - this.num > 4 ? this.4.chorus_set_depth(lst1[5]); - this.num > 5 ? this.5.chorus_set_depth(lst1[6]); - this.num > 6 ? this.6.chorus_set_depth(lst1[7]); - this.num > 7 ? this.7.chorus_set_depth(lst1[8]); - this.num > 8 ? this.8.chorus_set_depth(lst1[9]); - this.num > 9 ? this.9.chorus_set_depth(lst1[10]); - this.num > 10 ? this.10.chorus_set_depth(lst1[11]); - this.num > 11 ? this.11.chorus_set_depth(lst1[12]); - this.num > 12 ? this.12.chorus_set_depth(lst1[13]); - this.num > 13 ? this.13.chorus_set_depth(lst1[14]); - this.num > 14 ? this.14.chorus_set_depth(lst1[15]); - this.num > 15 ? this.15.chorus_set_depth(lst1[16]); - this.num > 16 ? this.16.chorus_set_depth(lst1[17]); - this.num > 17 ? this.17.chorus_set_depth(lst1[18]); - this.num > 18 ? this.18.chorus_set_depth(lst1[19]); - this.num > 19 ? this.19.chorus_set_depth(lst1[20]); - this.num > 20 ? this.20.chorus_set_depth(lst1[21]); - this.num > 21 ? this.21.chorus_set_depth(lst1[22]); - this.num > 22 ? this.22.chorus_set_depth(lst1[23]); - this.num > 23 ? this.23.chorus_set_depth(lst1[24]); - this.num > 24 ? this.24.chorus_set_depth(lst1[25]); - this.num > 25 ? this.25.chorus_set_depth(lst1[26]); - this.num > 26 ? this.26.chorus_set_depth(lst1[27]); - this.num > 27 ? this.27.chorus_set_depth(lst1[28]); - this.num > 28 ? this.28.chorus_set_depth(lst1[29]); - this.num > 29 ? this.29.chorus_set_depth(lst1[30]); - this.num > 30 ? this.30.chorus_set_depth(lst1[31]); - this.num > 31 ? this.31.chorus_set_depth(lst1[32]); - this.num > 32 ? this.32.chorus_set_depth(lst1[33]); - this.num > 33 ? this.33.chorus_set_depth(lst1[34]); - this.num > 34 ? this.34.chorus_set_depth(lst1[35]); - this.num > 35 ? this.35.chorus_set_depth(lst1[36]); - this.num > 36 ? this.36.chorus_set_depth(lst1[37]); - this.num > 37 ? this.37.chorus_set_depth(lst1[38]); - this.num > 38 ? this.38.chorus_set_depth(lst1[39]); - this.num > 39 ? this.39.chorus_set_depth(lst1[40]); -); -function Pchorus_set_feed(lst1) -( - this.num > 0 ? this.0.chorus_set_feed(lst1[1]); - this.num > 1 ? this.1.chorus_set_feed(lst1[2]); - this.num > 2 ? this.2.chorus_set_feed(lst1[3]); - this.num > 3 ? this.3.chorus_set_feed(lst1[4]); - this.num > 4 ? this.4.chorus_set_feed(lst1[5]); - this.num > 5 ? this.5.chorus_set_feed(lst1[6]); - this.num > 6 ? this.6.chorus_set_feed(lst1[7]); - this.num > 7 ? this.7.chorus_set_feed(lst1[8]); - this.num > 8 ? this.8.chorus_set_feed(lst1[9]); - this.num > 9 ? this.9.chorus_set_feed(lst1[10]); - this.num > 10 ? this.10.chorus_set_feed(lst1[11]); - this.num > 11 ? this.11.chorus_set_feed(lst1[12]); - this.num > 12 ? this.12.chorus_set_feed(lst1[13]); - this.num > 13 ? this.13.chorus_set_feed(lst1[14]); - this.num > 14 ? this.14.chorus_set_feed(lst1[15]); - this.num > 15 ? this.15.chorus_set_feed(lst1[16]); - this.num > 16 ? this.16.chorus_set_feed(lst1[17]); - this.num > 17 ? this.17.chorus_set_feed(lst1[18]); - this.num > 18 ? this.18.chorus_set_feed(lst1[19]); - this.num > 19 ? this.19.chorus_set_feed(lst1[20]); - this.num > 20 ? this.20.chorus_set_feed(lst1[21]); - this.num > 21 ? this.21.chorus_set_feed(lst1[22]); - this.num > 22 ? this.22.chorus_set_feed(lst1[23]); - this.num > 23 ? this.23.chorus_set_feed(lst1[24]); - this.num > 24 ? this.24.chorus_set_feed(lst1[25]); - this.num > 25 ? this.25.chorus_set_feed(lst1[26]); - this.num > 26 ? this.26.chorus_set_feed(lst1[27]); - this.num > 27 ? this.27.chorus_set_feed(lst1[28]); - this.num > 28 ? this.28.chorus_set_feed(lst1[29]); - this.num > 29 ? this.29.chorus_set_feed(lst1[30]); - this.num > 30 ? this.30.chorus_set_feed(lst1[31]); - this.num > 31 ? this.31.chorus_set_feed(lst1[32]); - this.num > 32 ? this.32.chorus_set_feed(lst1[33]); - this.num > 33 ? this.33.chorus_set_feed(lst1[34]); - this.num > 34 ? this.34.chorus_set_feed(lst1[35]); - this.num > 35 ? this.35.chorus_set_feed(lst1[36]); - this.num > 36 ? this.36.chorus_set_feed(lst1[37]); - this.num > 37 ? this.37.chorus_set_feed(lst1[38]); - this.num > 38 ? this.38.chorus_set_feed(lst1[39]); - this.num > 39 ? this.39.chorus_set_feed(lst1[40]); -); -function Pchorus_set_bal(lst1) -( - this.num > 0 ? this.0.chorus_set_bal(lst1[1]); - this.num > 1 ? this.1.chorus_set_bal(lst1[2]); - this.num > 2 ? this.2.chorus_set_bal(lst1[3]); - this.num > 3 ? this.3.chorus_set_bal(lst1[4]); - this.num > 4 ? this.4.chorus_set_bal(lst1[5]); - this.num > 5 ? this.5.chorus_set_bal(lst1[6]); - this.num > 6 ? this.6.chorus_set_bal(lst1[7]); - this.num > 7 ? this.7.chorus_set_bal(lst1[8]); - this.num > 8 ? this.8.chorus_set_bal(lst1[9]); - this.num > 9 ? this.9.chorus_set_bal(lst1[10]); - this.num > 10 ? this.10.chorus_set_bal(lst1[11]); - this.num > 11 ? this.11.chorus_set_bal(lst1[12]); - this.num > 12 ? this.12.chorus_set_bal(lst1[13]); - this.num > 13 ? this.13.chorus_set_bal(lst1[14]); - this.num > 14 ? this.14.chorus_set_bal(lst1[15]); - this.num > 15 ? this.15.chorus_set_bal(lst1[16]); - this.num > 16 ? this.16.chorus_set_bal(lst1[17]); - this.num > 17 ? this.17.chorus_set_bal(lst1[18]); - this.num > 18 ? this.18.chorus_set_bal(lst1[19]); - this.num > 19 ? this.19.chorus_set_bal(lst1[20]); - this.num > 20 ? this.20.chorus_set_bal(lst1[21]); - this.num > 21 ? this.21.chorus_set_bal(lst1[22]); - this.num > 22 ? this.22.chorus_set_bal(lst1[23]); - this.num > 23 ? this.23.chorus_set_bal(lst1[24]); - this.num > 24 ? this.24.chorus_set_bal(lst1[25]); - this.num > 25 ? this.25.chorus_set_bal(lst1[26]); - this.num > 26 ? this.26.chorus_set_bal(lst1[27]); - this.num > 27 ? this.27.chorus_set_bal(lst1[28]); - this.num > 28 ? this.28.chorus_set_bal(lst1[29]); - this.num > 29 ? this.29.chorus_set_bal(lst1[30]); - this.num > 30 ? this.30.chorus_set_bal(lst1[31]); - this.num > 31 ? this.31.chorus_set_bal(lst1[32]); - this.num > 32 ? this.32.chorus_set_bal(lst1[33]); - this.num > 33 ? this.33.chorus_set_bal(lst1[34]); - this.num > 34 ? this.34.chorus_set_bal(lst1[35]); - this.num > 35 ? this.35.chorus_set_bal(lst1[36]); - this.num > 36 ? this.36.chorus_set_bal(lst1[37]); - this.num > 37 ? this.37.chorus_set_bal(lst1[38]); - this.num > 38 ? this.38.chorus_set_bal(lst1[39]); - this.num > 39 ? this.39.chorus_set_bal(lst1[40]); -); -function Pchorus_do(signal) -( - num = signal[0]; - this.num > 0 ? this.outlist[1] = this.0.chorus_do(signal[(0 % num) + 1]); - this.num > 1 ? this.outlist[2] = this.1.chorus_do(signal[(1 % num) + 1]); - this.num > 2 ? this.outlist[3] = this.2.chorus_do(signal[(2 % num) + 1]); - this.num > 3 ? this.outlist[4] = this.3.chorus_do(signal[(3 % num) + 1]); - this.num > 4 ? this.outlist[5] = this.4.chorus_do(signal[(4 % num) + 1]); - this.num > 5 ? this.outlist[6] = this.5.chorus_do(signal[(5 % num) + 1]); - this.num > 6 ? this.outlist[7] = this.6.chorus_do(signal[(6 % num) + 1]); - this.num > 7 ? this.outlist[8] = this.7.chorus_do(signal[(7 % num) + 1]); - this.num > 8 ? this.outlist[9] = this.8.chorus_do(signal[(8 % num) + 1]); - this.num > 9 ? this.outlist[10] = this.9.chorus_do(signal[(9 % num) + 1]); - this.num > 10 ? this.outlist[11] = this.10.chorus_do(signal[(10 % num) + 1]); - this.num > 11 ? this.outlist[12] = this.11.chorus_do(signal[(11 % num) + 1]); - this.num > 12 ? this.outlist[13] = this.12.chorus_do(signal[(12 % num) + 1]); - this.num > 13 ? this.outlist[14] = this.13.chorus_do(signal[(13 % num) + 1]); - this.num > 14 ? this.outlist[15] = this.14.chorus_do(signal[(14 % num) + 1]); - this.num > 15 ? this.outlist[16] = this.15.chorus_do(signal[(15 % num) + 1]); - this.num > 16 ? this.outlist[17] = this.16.chorus_do(signal[(16 % num) + 1]); - this.num > 17 ? this.outlist[18] = this.17.chorus_do(signal[(17 % num) + 1]); - this.num > 18 ? this.outlist[19] = this.18.chorus_do(signal[(18 % num) + 1]); - this.num > 19 ? this.outlist[20] = this.19.chorus_do(signal[(19 % num) + 1]); - this.num > 20 ? this.outlist[21] = this.20.chorus_do(signal[(20 % num) + 1]); - this.num > 21 ? this.outlist[22] = this.21.chorus_do(signal[(21 % num) + 1]); - this.num > 22 ? this.outlist[23] = this.22.chorus_do(signal[(22 % num) + 1]); - this.num > 23 ? this.outlist[24] = this.23.chorus_do(signal[(23 % num) + 1]); - this.num > 24 ? this.outlist[25] = this.24.chorus_do(signal[(24 % num) + 1]); - this.num > 25 ? this.outlist[26] = this.25.chorus_do(signal[(25 % num) + 1]); - this.num > 26 ? this.outlist[27] = this.26.chorus_do(signal[(26 % num) + 1]); - this.num > 27 ? this.outlist[28] = this.27.chorus_do(signal[(27 % num) + 1]); - this.num > 28 ? this.outlist[29] = this.28.chorus_do(signal[(28 % num) + 1]); - this.num > 29 ? this.outlist[30] = this.29.chorus_do(signal[(29 % num) + 1]); - this.num > 30 ? this.outlist[31] = this.30.chorus_do(signal[(30 % num) + 1]); - this.num > 31 ? this.outlist[32] = this.31.chorus_do(signal[(31 % num) + 1]); - this.num > 32 ? this.outlist[33] = this.32.chorus_do(signal[(32 % num) + 1]); - this.num > 33 ? this.outlist[34] = this.33.chorus_do(signal[(33 % num) + 1]); - this.num > 34 ? this.outlist[35] = this.34.chorus_do(signal[(34 % num) + 1]); - this.num > 35 ? this.outlist[36] = this.35.chorus_do(signal[(35 % num) + 1]); - this.num > 36 ? this.outlist[37] = this.36.chorus_do(signal[(36 % num) + 1]); - this.num > 37 ? this.outlist[38] = this.37.chorus_do(signal[(37 % num) + 1]); - this.num > 38 ? this.outlist[39] = this.38.chorus_do(signal[(38 % num) + 1]); - this.num > 39 ? this.outlist[40] = this.39.chorus_do(signal[(39 % num) + 1]); - this.outlist; -); - -function Pflanger(lst1 lst2 lst3 lst4) -( - this.num = lst1[0]; - this.outlist = memalloc(this.num + 1); - this.outlist[0] = this.num; - this.num > 0 ? this.0.flanger(lst1[1], lst2[1], lst3[1], lst4[1]); - this.num > 1 ? this.1.flanger(lst1[2], lst2[2], lst3[2], lst4[2]); - this.num > 2 ? this.2.flanger(lst1[3], lst2[3], lst3[3], lst4[3]); - this.num > 3 ? this.3.flanger(lst1[4], lst2[4], lst3[4], lst4[4]); - this.num > 4 ? this.4.flanger(lst1[5], lst2[5], lst3[5], lst4[5]); - this.num > 5 ? this.5.flanger(lst1[6], lst2[6], lst3[6], lst4[6]); - this.num > 6 ? this.6.flanger(lst1[7], lst2[7], lst3[7], lst4[7]); - this.num > 7 ? this.7.flanger(lst1[8], lst2[8], lst3[8], lst4[8]); - this.num > 8 ? this.8.flanger(lst1[9], lst2[9], lst3[9], lst4[9]); - this.num > 9 ? this.9.flanger(lst1[10], lst2[10], lst3[10], lst4[10]); - this.num > 10 ? this.10.flanger(lst1[11], lst2[11], lst3[11], lst4[11]); - this.num > 11 ? this.11.flanger(lst1[12], lst2[12], lst3[12], lst4[12]); - this.num > 12 ? this.12.flanger(lst1[13], lst2[13], lst3[13], lst4[13]); - this.num > 13 ? this.13.flanger(lst1[14], lst2[14], lst3[14], lst4[14]); - this.num > 14 ? this.14.flanger(lst1[15], lst2[15], lst3[15], lst4[15]); - this.num > 15 ? this.15.flanger(lst1[16], lst2[16], lst3[16], lst4[16]); - this.num > 16 ? this.16.flanger(lst1[17], lst2[17], lst3[17], lst4[17]); - this.num > 17 ? this.17.flanger(lst1[18], lst2[18], lst3[18], lst4[18]); - this.num > 18 ? this.18.flanger(lst1[19], lst2[19], lst3[19], lst4[19]); - this.num > 19 ? this.19.flanger(lst1[20], lst2[20], lst3[20], lst4[20]); - this.num > 20 ? this.20.flanger(lst1[21], lst2[21], lst3[21], lst4[21]); - this.num > 21 ? this.21.flanger(lst1[22], lst2[22], lst3[22], lst4[22]); - this.num > 22 ? this.22.flanger(lst1[23], lst2[23], lst3[23], lst4[23]); - this.num > 23 ? this.23.flanger(lst1[24], lst2[24], lst3[24], lst4[24]); - this.num > 24 ? this.24.flanger(lst1[25], lst2[25], lst3[25], lst4[25]); - this.num > 25 ? this.25.flanger(lst1[26], lst2[26], lst3[26], lst4[26]); - this.num > 26 ? this.26.flanger(lst1[27], lst2[27], lst3[27], lst4[27]); - this.num > 27 ? this.27.flanger(lst1[28], lst2[28], lst3[28], lst4[28]); - this.num > 28 ? this.28.flanger(lst1[29], lst2[29], lst3[29], lst4[29]); - this.num > 29 ? this.29.flanger(lst1[30], lst2[30], lst3[30], lst4[30]); - this.num > 30 ? this.30.flanger(lst1[31], lst2[31], lst3[31], lst4[31]); - this.num > 31 ? this.31.flanger(lst1[32], lst2[32], lst3[32], lst4[32]); - this.num > 32 ? this.32.flanger(lst1[33], lst2[33], lst3[33], lst4[33]); - this.num > 33 ? this.33.flanger(lst1[34], lst2[34], lst3[34], lst4[34]); - this.num > 34 ? this.34.flanger(lst1[35], lst2[35], lst3[35], lst4[35]); - this.num > 35 ? this.35.flanger(lst1[36], lst2[36], lst3[36], lst4[36]); - this.num > 36 ? this.36.flanger(lst1[37], lst2[37], lst3[37], lst4[37]); - this.num > 37 ? this.37.flanger(lst1[38], lst2[38], lst3[38], lst4[38]); - this.num > 38 ? this.38.flanger(lst1[39], lst2[39], lst3[39], lst4[39]); - this.num > 39 ? this.39.flanger(lst1[40], lst2[40], lst3[40], lst4[40]); -); -function Pflanger_set_freq(lst1) -( - this.num > 0 ? this.0.flanger_set_freq(lst1[1]); - this.num > 1 ? this.1.flanger_set_freq(lst1[2]); - this.num > 2 ? this.2.flanger_set_freq(lst1[3]); - this.num > 3 ? this.3.flanger_set_freq(lst1[4]); - this.num > 4 ? this.4.flanger_set_freq(lst1[5]); - this.num > 5 ? this.5.flanger_set_freq(lst1[6]); - this.num > 6 ? this.6.flanger_set_freq(lst1[7]); - this.num > 7 ? this.7.flanger_set_freq(lst1[8]); - this.num > 8 ? this.8.flanger_set_freq(lst1[9]); - this.num > 9 ? this.9.flanger_set_freq(lst1[10]); - this.num > 10 ? this.10.flanger_set_freq(lst1[11]); - this.num > 11 ? this.11.flanger_set_freq(lst1[12]); - this.num > 12 ? this.12.flanger_set_freq(lst1[13]); - this.num > 13 ? this.13.flanger_set_freq(lst1[14]); - this.num > 14 ? this.14.flanger_set_freq(lst1[15]); - this.num > 15 ? this.15.flanger_set_freq(lst1[16]); - this.num > 16 ? this.16.flanger_set_freq(lst1[17]); - this.num > 17 ? this.17.flanger_set_freq(lst1[18]); - this.num > 18 ? this.18.flanger_set_freq(lst1[19]); - this.num > 19 ? this.19.flanger_set_freq(lst1[20]); - this.num > 20 ? this.20.flanger_set_freq(lst1[21]); - this.num > 21 ? this.21.flanger_set_freq(lst1[22]); - this.num > 22 ? this.22.flanger_set_freq(lst1[23]); - this.num > 23 ? this.23.flanger_set_freq(lst1[24]); - this.num > 24 ? this.24.flanger_set_freq(lst1[25]); - this.num > 25 ? this.25.flanger_set_freq(lst1[26]); - this.num > 26 ? this.26.flanger_set_freq(lst1[27]); - this.num > 27 ? this.27.flanger_set_freq(lst1[28]); - this.num > 28 ? this.28.flanger_set_freq(lst1[29]); - this.num > 29 ? this.29.flanger_set_freq(lst1[30]); - this.num > 30 ? this.30.flanger_set_freq(lst1[31]); - this.num > 31 ? this.31.flanger_set_freq(lst1[32]); - this.num > 32 ? this.32.flanger_set_freq(lst1[33]); - this.num > 33 ? this.33.flanger_set_freq(lst1[34]); - this.num > 34 ? this.34.flanger_set_freq(lst1[35]); - this.num > 35 ? this.35.flanger_set_freq(lst1[36]); - this.num > 36 ? this.36.flanger_set_freq(lst1[37]); - this.num > 37 ? this.37.flanger_set_freq(lst1[38]); - this.num > 38 ? this.38.flanger_set_freq(lst1[39]); - this.num > 39 ? this.39.flanger_set_freq(lst1[40]); -); -function Pflanger_set_cdelay(lst1) -( - this.num > 0 ? this.0.flanger_set_cdelay(lst1[1]); - this.num > 1 ? this.1.flanger_set_cdelay(lst1[2]); - this.num > 2 ? this.2.flanger_set_cdelay(lst1[3]); - this.num > 3 ? this.3.flanger_set_cdelay(lst1[4]); - this.num > 4 ? this.4.flanger_set_cdelay(lst1[5]); - this.num > 5 ? this.5.flanger_set_cdelay(lst1[6]); - this.num > 6 ? this.6.flanger_set_cdelay(lst1[7]); - this.num > 7 ? this.7.flanger_set_cdelay(lst1[8]); - this.num > 8 ? this.8.flanger_set_cdelay(lst1[9]); - this.num > 9 ? this.9.flanger_set_cdelay(lst1[10]); - this.num > 10 ? this.10.flanger_set_cdelay(lst1[11]); - this.num > 11 ? this.11.flanger_set_cdelay(lst1[12]); - this.num > 12 ? this.12.flanger_set_cdelay(lst1[13]); - this.num > 13 ? this.13.flanger_set_cdelay(lst1[14]); - this.num > 14 ? this.14.flanger_set_cdelay(lst1[15]); - this.num > 15 ? this.15.flanger_set_cdelay(lst1[16]); - this.num > 16 ? this.16.flanger_set_cdelay(lst1[17]); - this.num > 17 ? this.17.flanger_set_cdelay(lst1[18]); - this.num > 18 ? this.18.flanger_set_cdelay(lst1[19]); - this.num > 19 ? this.19.flanger_set_cdelay(lst1[20]); - this.num > 20 ? this.20.flanger_set_cdelay(lst1[21]); - this.num > 21 ? this.21.flanger_set_cdelay(lst1[22]); - this.num > 22 ? this.22.flanger_set_cdelay(lst1[23]); - this.num > 23 ? this.23.flanger_set_cdelay(lst1[24]); - this.num > 24 ? this.24.flanger_set_cdelay(lst1[25]); - this.num > 25 ? this.25.flanger_set_cdelay(lst1[26]); - this.num > 26 ? this.26.flanger_set_cdelay(lst1[27]); - this.num > 27 ? this.27.flanger_set_cdelay(lst1[28]); - this.num > 28 ? this.28.flanger_set_cdelay(lst1[29]); - this.num > 29 ? this.29.flanger_set_cdelay(lst1[30]); - this.num > 30 ? this.30.flanger_set_cdelay(lst1[31]); - this.num > 31 ? this.31.flanger_set_cdelay(lst1[32]); - this.num > 32 ? this.32.flanger_set_cdelay(lst1[33]); - this.num > 33 ? this.33.flanger_set_cdelay(lst1[34]); - this.num > 34 ? this.34.flanger_set_cdelay(lst1[35]); - this.num > 35 ? this.35.flanger_set_cdelay(lst1[36]); - this.num > 36 ? this.36.flanger_set_cdelay(lst1[37]); - this.num > 37 ? this.37.flanger_set_cdelay(lst1[38]); - this.num > 38 ? this.38.flanger_set_cdelay(lst1[39]); - this.num > 39 ? this.39.flanger_set_cdelay(lst1[40]); -); -function Pflanger_set_depth(lst1) -( - this.num > 0 ? this.0.flanger_set_depth(lst1[1]); - this.num > 1 ? this.1.flanger_set_depth(lst1[2]); - this.num > 2 ? this.2.flanger_set_depth(lst1[3]); - this.num > 3 ? this.3.flanger_set_depth(lst1[4]); - this.num > 4 ? this.4.flanger_set_depth(lst1[5]); - this.num > 5 ? this.5.flanger_set_depth(lst1[6]); - this.num > 6 ? this.6.flanger_set_depth(lst1[7]); - this.num > 7 ? this.7.flanger_set_depth(lst1[8]); - this.num > 8 ? this.8.flanger_set_depth(lst1[9]); - this.num > 9 ? this.9.flanger_set_depth(lst1[10]); - this.num > 10 ? this.10.flanger_set_depth(lst1[11]); - this.num > 11 ? this.11.flanger_set_depth(lst1[12]); - this.num > 12 ? this.12.flanger_set_depth(lst1[13]); - this.num > 13 ? this.13.flanger_set_depth(lst1[14]); - this.num > 14 ? this.14.flanger_set_depth(lst1[15]); - this.num > 15 ? this.15.flanger_set_depth(lst1[16]); - this.num > 16 ? this.16.flanger_set_depth(lst1[17]); - this.num > 17 ? this.17.flanger_set_depth(lst1[18]); - this.num > 18 ? this.18.flanger_set_depth(lst1[19]); - this.num > 19 ? this.19.flanger_set_depth(lst1[20]); - this.num > 20 ? this.20.flanger_set_depth(lst1[21]); - this.num > 21 ? this.21.flanger_set_depth(lst1[22]); - this.num > 22 ? this.22.flanger_set_depth(lst1[23]); - this.num > 23 ? this.23.flanger_set_depth(lst1[24]); - this.num > 24 ? this.24.flanger_set_depth(lst1[25]); - this.num > 25 ? this.25.flanger_set_depth(lst1[26]); - this.num > 26 ? this.26.flanger_set_depth(lst1[27]); - this.num > 27 ? this.27.flanger_set_depth(lst1[28]); - this.num > 28 ? this.28.flanger_set_depth(lst1[29]); - this.num > 29 ? this.29.flanger_set_depth(lst1[30]); - this.num > 30 ? this.30.flanger_set_depth(lst1[31]); - this.num > 31 ? this.31.flanger_set_depth(lst1[32]); - this.num > 32 ? this.32.flanger_set_depth(lst1[33]); - this.num > 33 ? this.33.flanger_set_depth(lst1[34]); - this.num > 34 ? this.34.flanger_set_depth(lst1[35]); - this.num > 35 ? this.35.flanger_set_depth(lst1[36]); - this.num > 36 ? this.36.flanger_set_depth(lst1[37]); - this.num > 37 ? this.37.flanger_set_depth(lst1[38]); - this.num > 38 ? this.38.flanger_set_depth(lst1[39]); - this.num > 39 ? this.39.flanger_set_depth(lst1[40]); -); -function Pflanger_set_feed(lst1) -( - this.num > 0 ? this.0.flanger_set_feed(lst1[1]); - this.num > 1 ? this.1.flanger_set_feed(lst1[2]); - this.num > 2 ? this.2.flanger_set_feed(lst1[3]); - this.num > 3 ? this.3.flanger_set_feed(lst1[4]); - this.num > 4 ? this.4.flanger_set_feed(lst1[5]); - this.num > 5 ? this.5.flanger_set_feed(lst1[6]); - this.num > 6 ? this.6.flanger_set_feed(lst1[7]); - this.num > 7 ? this.7.flanger_set_feed(lst1[8]); - this.num > 8 ? this.8.flanger_set_feed(lst1[9]); - this.num > 9 ? this.9.flanger_set_feed(lst1[10]); - this.num > 10 ? this.10.flanger_set_feed(lst1[11]); - this.num > 11 ? this.11.flanger_set_feed(lst1[12]); - this.num > 12 ? this.12.flanger_set_feed(lst1[13]); - this.num > 13 ? this.13.flanger_set_feed(lst1[14]); - this.num > 14 ? this.14.flanger_set_feed(lst1[15]); - this.num > 15 ? this.15.flanger_set_feed(lst1[16]); - this.num > 16 ? this.16.flanger_set_feed(lst1[17]); - this.num > 17 ? this.17.flanger_set_feed(lst1[18]); - this.num > 18 ? this.18.flanger_set_feed(lst1[19]); - this.num > 19 ? this.19.flanger_set_feed(lst1[20]); - this.num > 20 ? this.20.flanger_set_feed(lst1[21]); - this.num > 21 ? this.21.flanger_set_feed(lst1[22]); - this.num > 22 ? this.22.flanger_set_feed(lst1[23]); - this.num > 23 ? this.23.flanger_set_feed(lst1[24]); - this.num > 24 ? this.24.flanger_set_feed(lst1[25]); - this.num > 25 ? this.25.flanger_set_feed(lst1[26]); - this.num > 26 ? this.26.flanger_set_feed(lst1[27]); - this.num > 27 ? this.27.flanger_set_feed(lst1[28]); - this.num > 28 ? this.28.flanger_set_feed(lst1[29]); - this.num > 29 ? this.29.flanger_set_feed(lst1[30]); - this.num > 30 ? this.30.flanger_set_feed(lst1[31]); - this.num > 31 ? this.31.flanger_set_feed(lst1[32]); - this.num > 32 ? this.32.flanger_set_feed(lst1[33]); - this.num > 33 ? this.33.flanger_set_feed(lst1[34]); - this.num > 34 ? this.34.flanger_set_feed(lst1[35]); - this.num > 35 ? this.35.flanger_set_feed(lst1[36]); - this.num > 36 ? this.36.flanger_set_feed(lst1[37]); - this.num > 37 ? this.37.flanger_set_feed(lst1[38]); - this.num > 38 ? this.38.flanger_set_feed(lst1[39]); - this.num > 39 ? this.39.flanger_set_feed(lst1[40]); -); -function Pflanger_do(signal) -( - num = signal[0]; - this.num > 0 ? this.outlist[1] = this.0.flanger_do(signal[(0 % num) + 1]); - this.num > 1 ? this.outlist[2] = this.1.flanger_do(signal[(1 % num) + 1]); - this.num > 2 ? this.outlist[3] = this.2.flanger_do(signal[(2 % num) + 1]); - this.num > 3 ? this.outlist[4] = this.3.flanger_do(signal[(3 % num) + 1]); - this.num > 4 ? this.outlist[5] = this.4.flanger_do(signal[(4 % num) + 1]); - this.num > 5 ? this.outlist[6] = this.5.flanger_do(signal[(5 % num) + 1]); - this.num > 6 ? this.outlist[7] = this.6.flanger_do(signal[(6 % num) + 1]); - this.num > 7 ? this.outlist[8] = this.7.flanger_do(signal[(7 % num) + 1]); - this.num > 8 ? this.outlist[9] = this.8.flanger_do(signal[(8 % num) + 1]); - this.num > 9 ? this.outlist[10] = this.9.flanger_do(signal[(9 % num) + 1]); - this.num > 10 ? this.outlist[11] = this.10.flanger_do(signal[(10 % num) + 1]); - this.num > 11 ? this.outlist[12] = this.11.flanger_do(signal[(11 % num) + 1]); - this.num > 12 ? this.outlist[13] = this.12.flanger_do(signal[(12 % num) + 1]); - this.num > 13 ? this.outlist[14] = this.13.flanger_do(signal[(13 % num) + 1]); - this.num > 14 ? this.outlist[15] = this.14.flanger_do(signal[(14 % num) + 1]); - this.num > 15 ? this.outlist[16] = this.15.flanger_do(signal[(15 % num) + 1]); - this.num > 16 ? this.outlist[17] = this.16.flanger_do(signal[(16 % num) + 1]); - this.num > 17 ? this.outlist[18] = this.17.flanger_do(signal[(17 % num) + 1]); - this.num > 18 ? this.outlist[19] = this.18.flanger_do(signal[(18 % num) + 1]); - this.num > 19 ? this.outlist[20] = this.19.flanger_do(signal[(19 % num) + 1]); - this.num > 20 ? this.outlist[21] = this.20.flanger_do(signal[(20 % num) + 1]); - this.num > 21 ? this.outlist[22] = this.21.flanger_do(signal[(21 % num) + 1]); - this.num > 22 ? this.outlist[23] = this.22.flanger_do(signal[(22 % num) + 1]); - this.num > 23 ? this.outlist[24] = this.23.flanger_do(signal[(23 % num) + 1]); - this.num > 24 ? this.outlist[25] = this.24.flanger_do(signal[(24 % num) + 1]); - this.num > 25 ? this.outlist[26] = this.25.flanger_do(signal[(25 % num) + 1]); - this.num > 26 ? this.outlist[27] = this.26.flanger_do(signal[(26 % num) + 1]); - this.num > 27 ? this.outlist[28] = this.27.flanger_do(signal[(27 % num) + 1]); - this.num > 28 ? this.outlist[29] = this.28.flanger_do(signal[(28 % num) + 1]); - this.num > 29 ? this.outlist[30] = this.29.flanger_do(signal[(29 % num) + 1]); - this.num > 30 ? this.outlist[31] = this.30.flanger_do(signal[(30 % num) + 1]); - this.num > 31 ? this.outlist[32] = this.31.flanger_do(signal[(31 % num) + 1]); - this.num > 32 ? this.outlist[33] = this.32.flanger_do(signal[(32 % num) + 1]); - this.num > 33 ? this.outlist[34] = this.33.flanger_do(signal[(33 % num) + 1]); - this.num > 34 ? this.outlist[35] = this.34.flanger_do(signal[(34 % num) + 1]); - this.num > 35 ? this.outlist[36] = this.35.flanger_do(signal[(35 % num) + 1]); - this.num > 36 ? this.outlist[37] = this.36.flanger_do(signal[(36 % num) + 1]); - this.num > 37 ? this.outlist[38] = this.37.flanger_do(signal[(37 % num) + 1]); - this.num > 38 ? this.outlist[39] = this.38.flanger_do(signal[(38 % num) + 1]); - this.num > 39 ? this.outlist[40] = this.39.flanger_do(signal[(39 % num) + 1]); - this.outlist; -); - -function Pwaveguide(lst1 lst2) -( - this.num = lst1[0]; - this.outlist = memalloc(this.num + 1); - this.outlist[0] = this.num; - this.num > 0 ? this.0.waveguide(lst1[1], lst2[1]); - this.num > 1 ? this.1.waveguide(lst1[2], lst2[2]); - this.num > 2 ? this.2.waveguide(lst1[3], lst2[3]); - this.num > 3 ? this.3.waveguide(lst1[4], lst2[4]); - this.num > 4 ? this.4.waveguide(lst1[5], lst2[5]); - this.num > 5 ? this.5.waveguide(lst1[6], lst2[6]); - this.num > 6 ? this.6.waveguide(lst1[7], lst2[7]); - this.num > 7 ? this.7.waveguide(lst1[8], lst2[8]); - this.num > 8 ? this.8.waveguide(lst1[9], lst2[9]); - this.num > 9 ? this.9.waveguide(lst1[10], lst2[10]); - this.num > 10 ? this.10.waveguide(lst1[11], lst2[11]); - this.num > 11 ? this.11.waveguide(lst1[12], lst2[12]); - this.num > 12 ? this.12.waveguide(lst1[13], lst2[13]); - this.num > 13 ? this.13.waveguide(lst1[14], lst2[14]); - this.num > 14 ? this.14.waveguide(lst1[15], lst2[15]); - this.num > 15 ? this.15.waveguide(lst1[16], lst2[16]); - this.num > 16 ? this.16.waveguide(lst1[17], lst2[17]); - this.num > 17 ? this.17.waveguide(lst1[18], lst2[18]); - this.num > 18 ? this.18.waveguide(lst1[19], lst2[19]); - this.num > 19 ? this.19.waveguide(lst1[20], lst2[20]); - this.num > 20 ? this.20.waveguide(lst1[21], lst2[21]); - this.num > 21 ? this.21.waveguide(lst1[22], lst2[22]); - this.num > 22 ? this.22.waveguide(lst1[23], lst2[23]); - this.num > 23 ? this.23.waveguide(lst1[24], lst2[24]); - this.num > 24 ? this.24.waveguide(lst1[25], lst2[25]); - this.num > 25 ? this.25.waveguide(lst1[26], lst2[26]); - this.num > 26 ? this.26.waveguide(lst1[27], lst2[27]); - this.num > 27 ? this.27.waveguide(lst1[28], lst2[28]); - this.num > 28 ? this.28.waveguide(lst1[29], lst2[29]); - this.num > 29 ? this.29.waveguide(lst1[30], lst2[30]); - this.num > 30 ? this.30.waveguide(lst1[31], lst2[31]); - this.num > 31 ? this.31.waveguide(lst1[32], lst2[32]); - this.num > 32 ? this.32.waveguide(lst1[33], lst2[33]); - this.num > 33 ? this.33.waveguide(lst1[34], lst2[34]); - this.num > 34 ? this.34.waveguide(lst1[35], lst2[35]); - this.num > 35 ? this.35.waveguide(lst1[36], lst2[36]); - this.num > 36 ? this.36.waveguide(lst1[37], lst2[37]); - this.num > 37 ? this.37.waveguide(lst1[38], lst2[38]); - this.num > 38 ? this.38.waveguide(lst1[39], lst2[39]); - this.num > 39 ? this.39.waveguide(lst1[40], lst2[40]); -); -function Pwaveguide_set_freq(lst1) -( - this.num > 0 ? this.0.waveguide_set_freq(lst1[1]); - this.num > 1 ? this.1.waveguide_set_freq(lst1[2]); - this.num > 2 ? this.2.waveguide_set_freq(lst1[3]); - this.num > 3 ? this.3.waveguide_set_freq(lst1[4]); - this.num > 4 ? this.4.waveguide_set_freq(lst1[5]); - this.num > 5 ? this.5.waveguide_set_freq(lst1[6]); - this.num > 6 ? this.6.waveguide_set_freq(lst1[7]); - this.num > 7 ? this.7.waveguide_set_freq(lst1[8]); - this.num > 8 ? this.8.waveguide_set_freq(lst1[9]); - this.num > 9 ? this.9.waveguide_set_freq(lst1[10]); - this.num > 10 ? this.10.waveguide_set_freq(lst1[11]); - this.num > 11 ? this.11.waveguide_set_freq(lst1[12]); - this.num > 12 ? this.12.waveguide_set_freq(lst1[13]); - this.num > 13 ? this.13.waveguide_set_freq(lst1[14]); - this.num > 14 ? this.14.waveguide_set_freq(lst1[15]); - this.num > 15 ? this.15.waveguide_set_freq(lst1[16]); - this.num > 16 ? this.16.waveguide_set_freq(lst1[17]); - this.num > 17 ? this.17.waveguide_set_freq(lst1[18]); - this.num > 18 ? this.18.waveguide_set_freq(lst1[19]); - this.num > 19 ? this.19.waveguide_set_freq(lst1[20]); - this.num > 20 ? this.20.waveguide_set_freq(lst1[21]); - this.num > 21 ? this.21.waveguide_set_freq(lst1[22]); - this.num > 22 ? this.22.waveguide_set_freq(lst1[23]); - this.num > 23 ? this.23.waveguide_set_freq(lst1[24]); - this.num > 24 ? this.24.waveguide_set_freq(lst1[25]); - this.num > 25 ? this.25.waveguide_set_freq(lst1[26]); - this.num > 26 ? this.26.waveguide_set_freq(lst1[27]); - this.num > 27 ? this.27.waveguide_set_freq(lst1[28]); - this.num > 28 ? this.28.waveguide_set_freq(lst1[29]); - this.num > 29 ? this.29.waveguide_set_freq(lst1[30]); - this.num > 30 ? this.30.waveguide_set_freq(lst1[31]); - this.num > 31 ? this.31.waveguide_set_freq(lst1[32]); - this.num > 32 ? this.32.waveguide_set_freq(lst1[33]); - this.num > 33 ? this.33.waveguide_set_freq(lst1[34]); - this.num > 34 ? this.34.waveguide_set_freq(lst1[35]); - this.num > 35 ? this.35.waveguide_set_freq(lst1[36]); - this.num > 36 ? this.36.waveguide_set_freq(lst1[37]); - this.num > 37 ? this.37.waveguide_set_freq(lst1[38]); - this.num > 38 ? this.38.waveguide_set_freq(lst1[39]); - this.num > 39 ? this.39.waveguide_set_freq(lst1[40]); -); -function Pwaveguide_set_dur(lst1) -( - this.num > 0 ? this.0.waveguide_set_dur(lst1[1]); - this.num > 1 ? this.1.waveguide_set_dur(lst1[2]); - this.num > 2 ? this.2.waveguide_set_dur(lst1[3]); - this.num > 3 ? this.3.waveguide_set_dur(lst1[4]); - this.num > 4 ? this.4.waveguide_set_dur(lst1[5]); - this.num > 5 ? this.5.waveguide_set_dur(lst1[6]); - this.num > 6 ? this.6.waveguide_set_dur(lst1[7]); - this.num > 7 ? this.7.waveguide_set_dur(lst1[8]); - this.num > 8 ? this.8.waveguide_set_dur(lst1[9]); - this.num > 9 ? this.9.waveguide_set_dur(lst1[10]); - this.num > 10 ? this.10.waveguide_set_dur(lst1[11]); - this.num > 11 ? this.11.waveguide_set_dur(lst1[12]); - this.num > 12 ? this.12.waveguide_set_dur(lst1[13]); - this.num > 13 ? this.13.waveguide_set_dur(lst1[14]); - this.num > 14 ? this.14.waveguide_set_dur(lst1[15]); - this.num > 15 ? this.15.waveguide_set_dur(lst1[16]); - this.num > 16 ? this.16.waveguide_set_dur(lst1[17]); - this.num > 17 ? this.17.waveguide_set_dur(lst1[18]); - this.num > 18 ? this.18.waveguide_set_dur(lst1[19]); - this.num > 19 ? this.19.waveguide_set_dur(lst1[20]); - this.num > 20 ? this.20.waveguide_set_dur(lst1[21]); - this.num > 21 ? this.21.waveguide_set_dur(lst1[22]); - this.num > 22 ? this.22.waveguide_set_dur(lst1[23]); - this.num > 23 ? this.23.waveguide_set_dur(lst1[24]); - this.num > 24 ? this.24.waveguide_set_dur(lst1[25]); - this.num > 25 ? this.25.waveguide_set_dur(lst1[26]); - this.num > 26 ? this.26.waveguide_set_dur(lst1[27]); - this.num > 27 ? this.27.waveguide_set_dur(lst1[28]); - this.num > 28 ? this.28.waveguide_set_dur(lst1[29]); - this.num > 29 ? this.29.waveguide_set_dur(lst1[30]); - this.num > 30 ? this.30.waveguide_set_dur(lst1[31]); - this.num > 31 ? this.31.waveguide_set_dur(lst1[32]); - this.num > 32 ? this.32.waveguide_set_dur(lst1[33]); - this.num > 33 ? this.33.waveguide_set_dur(lst1[34]); - this.num > 34 ? this.34.waveguide_set_dur(lst1[35]); - this.num > 35 ? this.35.waveguide_set_dur(lst1[36]); - this.num > 36 ? this.36.waveguide_set_dur(lst1[37]); - this.num > 37 ? this.37.waveguide_set_dur(lst1[38]); - this.num > 38 ? this.38.waveguide_set_dur(lst1[39]); - this.num > 39 ? this.39.waveguide_set_dur(lst1[40]); -); -function Pwaveguide_do(signal) -( - num = signal[0]; - this.num > 0 ? this.outlist[1] = this.0.waveguide_do(signal[(0 % num) + 1]); - this.num > 1 ? this.outlist[2] = this.1.waveguide_do(signal[(1 % num) + 1]); - this.num > 2 ? this.outlist[3] = this.2.waveguide_do(signal[(2 % num) + 1]); - this.num > 3 ? this.outlist[4] = this.3.waveguide_do(signal[(3 % num) + 1]); - this.num > 4 ? this.outlist[5] = this.4.waveguide_do(signal[(4 % num) + 1]); - this.num > 5 ? this.outlist[6] = this.5.waveguide_do(signal[(5 % num) + 1]); - this.num > 6 ? this.outlist[7] = this.6.waveguide_do(signal[(6 % num) + 1]); - this.num > 7 ? this.outlist[8] = this.7.waveguide_do(signal[(7 % num) + 1]); - this.num > 8 ? this.outlist[9] = this.8.waveguide_do(signal[(8 % num) + 1]); - this.num > 9 ? this.outlist[10] = this.9.waveguide_do(signal[(9 % num) + 1]); - this.num > 10 ? this.outlist[11] = this.10.waveguide_do(signal[(10 % num) + 1]); - this.num > 11 ? this.outlist[12] = this.11.waveguide_do(signal[(11 % num) + 1]); - this.num > 12 ? this.outlist[13] = this.12.waveguide_do(signal[(12 % num) + 1]); - this.num > 13 ? this.outlist[14] = this.13.waveguide_do(signal[(13 % num) + 1]); - this.num > 14 ? this.outlist[15] = this.14.waveguide_do(signal[(14 % num) + 1]); - this.num > 15 ? this.outlist[16] = this.15.waveguide_do(signal[(15 % num) + 1]); - this.num > 16 ? this.outlist[17] = this.16.waveguide_do(signal[(16 % num) + 1]); - this.num > 17 ? this.outlist[18] = this.17.waveguide_do(signal[(17 % num) + 1]); - this.num > 18 ? this.outlist[19] = this.18.waveguide_do(signal[(18 % num) + 1]); - this.num > 19 ? this.outlist[20] = this.19.waveguide_do(signal[(19 % num) + 1]); - this.num > 20 ? this.outlist[21] = this.20.waveguide_do(signal[(20 % num) + 1]); - this.num > 21 ? this.outlist[22] = this.21.waveguide_do(signal[(21 % num) + 1]); - this.num > 22 ? this.outlist[23] = this.22.waveguide_do(signal[(22 % num) + 1]); - this.num > 23 ? this.outlist[24] = this.23.waveguide_do(signal[(23 % num) + 1]); - this.num > 24 ? this.outlist[25] = this.24.waveguide_do(signal[(24 % num) + 1]); - this.num > 25 ? this.outlist[26] = this.25.waveguide_do(signal[(25 % num) + 1]); - this.num > 26 ? this.outlist[27] = this.26.waveguide_do(signal[(26 % num) + 1]); - this.num > 27 ? this.outlist[28] = this.27.waveguide_do(signal[(27 % num) + 1]); - this.num > 28 ? this.outlist[29] = this.28.waveguide_do(signal[(28 % num) + 1]); - this.num > 29 ? this.outlist[30] = this.29.waveguide_do(signal[(29 % num) + 1]); - this.num > 30 ? this.outlist[31] = this.30.waveguide_do(signal[(30 % num) + 1]); - this.num > 31 ? this.outlist[32] = this.31.waveguide_do(signal[(31 % num) + 1]); - this.num > 32 ? this.outlist[33] = this.32.waveguide_do(signal[(32 % num) + 1]); - this.num > 33 ? this.outlist[34] = this.33.waveguide_do(signal[(33 % num) + 1]); - this.num > 34 ? this.outlist[35] = this.34.waveguide_do(signal[(34 % num) + 1]); - this.num > 35 ? this.outlist[36] = this.35.waveguide_do(signal[(35 % num) + 1]); - this.num > 36 ? this.outlist[37] = this.36.waveguide_do(signal[(36 % num) + 1]); - this.num > 37 ? this.outlist[38] = this.37.waveguide_do(signal[(37 % num) + 1]); - this.num > 38 ? this.outlist[39] = this.38.waveguide_do(signal[(38 % num) + 1]); - this.num > 39 ? this.outlist[40] = this.39.waveguide_do(signal[(39 % num) + 1]); - this.outlist; -); - diff --git a/FX/BryanChi_FX Devices/cookdsp/pv-mono-template b/FX/BryanChi_FX Devices/cookdsp/pv-mono-template deleted file mode 100644 index 108eebbd2..000000000 --- a/FX/BryanChi_FX Devices/cookdsp/pv-mono-template +++ /dev/null @@ -1,44 +0,0 @@ -desc:Phase Vocoder Mono Template - -import cookdsp.jsfx-inc - -slider1:5<0,8,1{32,64,128,256,512,1024,2048,4096,8192}>FFT Size -slider2:1<0,2,1{2,4,8}>Overlaps -slider3:1<0,3,1{hamming,hanning,bartlett,blackman}>Window Shape -// Effect's specific sliders here... - -@init -size = pow(2, slider1+5); -olaps = pow(2, slider2+1); -pin.pvin(size, olaps, slider3); -pout.pvout(size, olaps, slider3); - -@slider -size = pow(2, slider1+5); -olaps = pow(2, slider2+1); -// If fftsize or overlaps changed, re-initialize PVs. -size != fin.size || olaps != fin.olaps ? ( - pin.pvin_resize(size, olaps); - pout.pvout_resize(size, olaps); - // Initialize effect's specific memories here... - -); -// Generate a new window if slider3 has changed. -slider3 != pin.window ? ( - pin.pvin_set_window(slider3); - pout.pvout_set_window(slider3); -); -// Process effect's specific sliders here... - -@sample -// Input / Output -pin.pvin_do(spl0); -spl0 = pout.pvout_get_output(pin.count); - -pin.ready ? ( - // New buffers ready for processing. - // ... A simple thru... - // compute the inverse PV. - pout.pvout_do(pin.magn, pin.freq); -); - diff --git a/FX/BryanChi_FX Devices/cookdsp/pv-stereo-template b/FX/BryanChi_FX Devices/cookdsp/pv-stereo-template deleted file mode 100644 index 3da88dc62..000000000 --- a/FX/BryanChi_FX Devices/cookdsp/pv-stereo-template +++ /dev/null @@ -1,53 +0,0 @@ -desc: Phase Vocoder Stereo Template - -import cookdsp.jsfx-inc - -slider1:5<0,8,1{32,64,128,256,512,1024,2048,4096,8192}>FFT Size -slider2:1<0,2,1{2,4,8}>Overlaps -slider3:1<0,3,1{hamming,hanning,bartlett,blackman}>Window Shape -// Effect's specific sliders here... - -@init -size = pow(2, slider1+5); -olaps = pow(2, slider2+1); -pin.pvin(size, olaps, slider3); -pin2.pvin(size, olaps, slider3); -pout.pvout(size, olaps, slider3); -pout2.pvout(size, olaps, slider3); - -@slider -size = pow(2, slider1+5); -olaps = pow(2, slider2+1); -// If fftsize or overlaps changed, re-initialize PVs. -size != pin.size || olaps != pin.olaps ? ( - pin.pvin_resize(size, olaps); - pin2.pvin_resize(size, olaps); - pout.pvout_resize(size, olaps); - pout2.pvout_resize(size, olaps); - // Initialize effect's specific memories here... - -); -// Generate a new window if slider3 has changed. -slider3 != pin.window ? ( - pin.pvin_set_window(slider3); - pin2.pvin_set_window(slider3); - pout.pvout_set_window(slider3); - pout2.pvout_set_window(slider3); -); -// Process effect's specific sliders here... - -@sample -// Input / Output -pin.pvin_do(spl0); -pin2.pvin_do(spl1); -spl0 = pout.pvout_get_output(pin.count); -spl1 = pout2.pvout_get_output(pin2.count); - -pin.ready ? ( - // New buffers ready for processing. - // ... A simple thru... - // compute the inverse PV. - pout.pvout_do(pin.magn, pin.freq); - pout2.pvout_do(pin2.magn, pin2.freq); -); - diff --git a/FX/BryanChi_FX Devices/cookdsp/pvocobjects.jsfx-inc b/FX/BryanChi_FX Devices/cookdsp/pvocobjects.jsfx-inc deleted file mode 100644 index c022f1f92..000000000 --- a/FX/BryanChi_FX Devices/cookdsp/pvocobjects.jsfx-inc +++ /dev/null @@ -1,843 +0,0 @@ -@init - -/******************************************************* -PVIN -==== - -Apply a Phase Vocoder analysis on an input signal. - -Description ------------ - -The `pvin` object transforms an audio signal into its spectral -representation using a phase vocoder analysis. This results in -two streams, one for the bin's magnitudes and the other for the -bin's true frequencies. These two streams are used by the `pvxxx` -object family to transform the input signal using spectral domain -algorithms. The last object in the phase vocoder chain must be a -`pvout` to perform the spectral to time domain conversion. - -The magnitude and true frequency part from the analysis are stored -in the `magn` and `freq` internal arrays. - -Initializer ------------ - -#### pvin(size, olaps, [window]) #### - -Initializes a Phase Vocoder Transform algorithm. The PV size, in -samples, given by the `size` argument, must be a power of two. -The `olaps` argument specifies the number of overlapping analysis. -There will be an output analysis every `size / olaps` samples. The -`window` argument, as an integer, gives the shape of the analysis -envelope (see `buffer` object for the available windows). The default -is a hanning window. - -Methods -------- - -#### pvin_resize(size, olaps) #### - -Resizes internal memories of the PV agorithm with the new `size` -and `olaps` factors. The corresponding `pvout` object (and every -processes in between) should always use the same size and number -of overlaps. - -#### pvin_set_window(window) #### - -Sets a new analysis window. See `buffer` object for the available -windows. - -#### pvin_do(signal) #### - -Processes one sample of the input `signal` and updates the `count` -and `ready` attributes of the object. The `count` attribute should -be used to retrieve the current resynthesized sample from a `pvout` -object. The `ready` attribute indicates when `magn` and `freq` buffers -are ready to be processed. - -Attributes ----------- - -#### pvin.ready #### - -This attribute will have a value of 1 when a new frame (`magn` -and `freq` buffers) is ready to be processed. This will happen -every `size / olaps` samples. Otherwise, the `ready` attribute -holds a value of 0. - -#### pvin.count #### - -This attribute holds the current analysis sample count. It can -used to retrieve the current output sample from a `pvout` object. - -#### pvin.magn #### - -Buffer that holds the magnitude part of the analysis. Indexes run from -0 to half the PV size. - -#### pvin.freq #### - -Buffer that holds the true frequency part of the analysis. Indexes run -from 0 to half the PV size. - -Example -------- - - desc:Phase Vocoder Randomizer - - import cookdsp.jsfx-inc - - // PV parameters (only PV Size for the example). - slider1:5<0,8,1{32,64,128,256,512,1024,2048,4096,8192}>PV Size - // Effect's specific slider - slider2:10<1,100,1>How Many Bins - - @init - size = pow(2, slider1+5); - // Initialize PV with 4 overlaps and hanning window - pin.pvin(size, 4); - pout.pvout(size, 4); - magn = memalloc(size/2); - freq = memalloc(size/2); - - @slider - size = pow(2, slider1+5); - // If size or overlaps changed, re-initialize PVs. - size != pin.size ? ( - pin.pvin_resize(size, 4); - pout.pvout_resize(size, 4); - // Initialize effect's specific memories - magn = memalloc(size/2); - freq = memalloc(size/2); - ); - - @sample - // Compute PV on both channels at the same time to save space - pin.pvin_do((spl0 + spl1) * 0.707); - spl0 = spl1 = pout.pvout_get_output(pin.count); - - pin.ready ? ( // New buffers ready for processing. - // Resets output buffers to zeros - memset(magn, 0, size/2); - memset(freq, 0, size/2); - // Choose randomly "slider2" bins to output - loop(slider2, - bin = rand(size/2); - magn[bin] = pin.magn[bin]; - freq[bin] = pin.freq[bin]; - ); - // compute the inverse PV. - pout.pvout_do(magn, freq); - ); - -********************************************************/ -// Private function -function _pvin_init() -( - this.window = this.fftobj.window; - this.olaps = this.fftobj.olaps; - this.size = this.fftobj.size; - this.hsize = this.fftobj.hsize; - this.hopsize = this.fftobj.hopsize; - this.factor = srate / (this.hopsize * this.twopi); - this.scale = this.twopi * this.hopsize / this.size; - this.magn = memalloc(this.hsize); - this.freq = memalloc(this.hsize); - this.prev = memalloc(this.hsize); -); - -function pvin(size olaps window) -( - this.twopi = 2 * $pi; - this.fftobj.fftin(size, olaps, window); - this._pvin_init(); -); - -function pvin(size olaps) -( - this.twopi = 2 * $pi; - this.fftobj.fftin(size, olaps, 1); - this._pvin_init(); -); - -function pvin_resize(size olaps) -( - this.fftobj.fftin_resize(size, olaps); - this._pvin_init(); -); - -function pvin_set_window(window) -( - this.fftobj.fftin_set_window(window); - this.window = this.fftobj.window; -); - -function pvin_do(signal) -( - this.ready = 0; - this.fftobj.fftin_do(signal); - this.count = this.fftobj.count; - this.fftobj.ready ? ( - this.ready = 1; - k_ = 0; - while (k_ < this.hsize) ( - re_ = this.fftobj.real[k_]; - im_ = this.fftobj.imag[k_]; - mag_ = sqrt(re_*re_ + im_*im_); - phase_ = atan2(im_, re_); - tmp_ = phase_ - this.prev[k_]; - this.prev[k_] = phase_; - while (tmp_ > $pi) (tmp_ -= this.twopi;); - while (tmp_ < -$pi) (tmp_ += this.twopi;); - this.magn[k_] = mag_; - this.freq[k_] = (tmp_ + k_ * this.scale) * this.factor; - k_ += 1; - ); - ); -); - -/******************************************************* -PVOUT -===== - -Apply an Inverse Phase Vocoder Transform on an analysis signal. - -Description ------------ - -The `pvout` object converts the spectral representation of a signal -into its temporal form (real signal). It takes magnitude and true -frequency parts, coming from an PV process, to compute the inverse -PV and return the corresponding audio signal. - -Initializer ------------ - -#### pvout(size, olaps, [window]) #### - -Initializes an Inverse Phase Vocoder Transform algorithm. The PV size, -in samples, given by the `size` argument, must be a power of two. -The `olaps` argument specifies the number of overlapping analysis. -There will be a sample block outputted every `size / olaps` samples. -The `window` argument, as an integer, gives the shape of the analysis -envelope (see `buffer` object for the available windows). The default -is a hanning window. - -Methods -------- - -#### pvout_resize(size, olaps) #### - -Resizes internal memories of the PV agorithm with the new `size` -and `olaps` factors. The corresponding `pvin` object (and every -processes in between) should always use the same size and number -of overlaps. - -#### pvout_set_window(window) #### - -Sets a new analysis window. See `buffer` object for the available -windows. - -#### pvout_get_output(count) #### - -Use this function to retrieve the output sample, from the -Inverse Phase Vocoder Transform, at the position `count`. If -the position comes from the `count` attribute of a `pvin` -object, the current output sample will be retrieved. - -#### pvout_do(magn, freq) #### - -Computes an Inverse Phase Vocoder Transform with the arrays -`magn` and `freq`. This function should be called only when -the `pvin` attribute `ready` is 1. - -Example -------- - - desc:Phase Vocoder Comb Filter - - import cookdsp.jsfx-inc - - // PV parameters (only PV Size for the example). - slider1:5<0,8,1{32,64,128,256,512,1024,2048,4096,8192}>PV Size - // Effect's specific slider. - slider2:2<2,100,1>Bin Step - - @init - size = pow(2, slider1+5); - // Initialize PV with 4 overlaps and hanning window - pin.pvin(size, 4); - pout.pvout(size, 4); - magn = memalloc(size/2); - freq = memalloc(size/2); - - @slider - size = pow(2, slider1+5); - // If size changed, re-initialize PVs. - size != pin.size ? ( - pin.pvin_resize(size, 4); - pout.pvout_resize(size, 4); - // Initialize effect's specific memories - magn = memalloc(size/2); - freq = memalloc(size/2); - ); - - @sample - // Compute PV on both channels at the same time to save space - pin.pvin_do((spl0 + spl1) * 0.707); - spl0 = spl1 = pout.pvout_get_output(pin.count); - - pin.ready ? ( // New buffers ready for processing. - k = 0; - while (k < size/2) ( - // Passes the signal only for bins that are multiples of slider2 value - k % slider2 == 0 ? ( - magn[k] = pin.magn[k]; - freq[k] = pin.freq[k]; - ) : ( - magn[k] = freq[k] = 0; - ); - k += 1; - ); - // compute the inverse FFT. - pout.pvout_do(magn, freq); - ); - -********************************************************/ - -// Private function -function _pvout_init() -( - this.window = this.fftobj.window; - this.olaps = this.fftobj.olaps; - this.size = this.fftobj.size; - this.hsize = this.fftobj.hsize; - this.hopsize = this.fftobj.hopsize; - this.ifactor = this.hopsize * this.twopi / srate; - this.iscale = srate / this.size; - this.real = memalloc(this.hsize); - this.imag = memalloc(this.hsize); - this.phacc = memalloc(this.hsize); -); - -function pvout(size olaps window) -( - this.twopi = 2 * $pi; - this.fftobj.fftout(size, olaps, window); - this._pvout_init(); -); - -function pvout(size olaps) -( - this.twopi = 2 * $pi; - this.fftobj.fftout(size, olaps, 1); - this._pvout_init(); -); - -function pvout_resize(size olaps) -( - this.fftobj.fftout_resize(size, olaps); - this._pvout_init(); -); - -function pvout_set_window(window) -( - this.fftobj.fftout_set_window(window); - this.window = this.fftobj.window; -); - -function pvout_get_output(count) -( - // count is pvin.count - this.fftobj.outbuf[count]; -); - -// call pvout_do only when pvin.ready is true -function pvout_do(magn freq) -( - k_ = 0; - loop(this.hsize, - mag_ = magn[k_]; - tmp_ = freq[k_]; - tmp_ = (tmp_ - k_ * this.iscale) * this.ifactor; - this.phacc[k_] += tmp_; - phase_ = this.phacc[k_]; - this.real[k_] = mag_ * cos(phase_); - this.imag[k_] = mag_ * sin(phase_); - k_ += 1; - ); - this.fftobj.fftout_do(this.real, this.imag); -); - -/******************************************************* -PVSHIFT -======= - -Linearly moves the frequency components of a PV stream. - -Description ------------ - -The `pvshift` object takes a PV signal in input (magnitude -and true freqency parts of a PV spectral analysis) and -linearly moves its frequency components by an amount specified -in Hz. - -Initializer ------------ - -#### pvshift(shift, size) #### - -Initializes PV frequency shifter with the argument `shift` as the -amount of shifting in Hz. The `size` argument is the length of -the `magn` and `freq` arrays, usually half the PV analysis size. - -Methods -------- - -#### pvshift_resize(size) #### - -Resizes internal memories of the process with the new `size`. -The size of a PV process must be half the size of the PV -used to analyse to input signal. This is the size of the magnitude -and true frequency buffers. - -#### pvshift_set_shift(shift) #### - -Sets a new shifting factor `shift`, in Hz. - -#### pvshift_do(magn, freq) #### - -Computes one frame of the process on a complex signal (`magn` and -`freq` are the magnitude and true frequency parts coming from a `pvin` -or any PV processing object). The internal `magn` and `freq` buffers -hold the processed complex signal. This function should be called -only when the `ready` attribute of a `pvin` object has a value of 1. - -Attributes ----------- - -#### pvshift.magn #### - -Buffer that holds the magnitude part of the process. Indexes run -from 0 to the process size (usually half the PV size). - -#### pvshift.freq #### - -Buffer that holds the true frequency part of the process. Indexes -run from 0 to the process size (usually half the PV size). - -Example -------- - - desc: Phase Vocoder Frequency Shifter - - import cookdsp.jsfx-inc - - slider1:5<0,8,1{32,64,128,256,512,1024,2048,4096,8192}>PV Size - slider2:1<0,2,1{2,4,8}>Overlaps - slider3:0<-2000,2000>Amount Of Shifting In Hz - - @init - size = pow(2, slider1+5); - olaps = pow(2, slider2+1); - pin.pvin(size, olaps); - pin2.pvin(size, olaps); - pout.pvout(size, olaps); - pout2.pvout(size, olaps); - pvs.pvshift(slider3, size/2); - pvs2.pvshift(slider3, size/2); - - @slider - size = pow(2, slider1+5); - olaps = pow(2, slider2+1); - // If size or overlaps changed, re-initialize PVs. - size != pin.size || olaps != pin.olaps ? ( - pin.pvin_resize(size, olaps); - pin2.pvin_resize(size, olaps); - pout.pvout_resize(size, olaps); - pout2.pvout_resize(size, olaps); - // Initialize effect's specific memories here... - pvs.pvshift_resize(size/2); - pvs2.pvshift_resize(size/2); - ); - // Process effect's specific sliders here... - pvs.pvshift_set_shift(slider3); - pvs2.pvshift_set_shift(slider3); - - @sample - // Input / Output - pin.pvin_do(spl0); - pin2.pvin_do(spl1); - spl0 = pout.pvout_get_output(pin.count); - spl1 = pout2.pvout_get_output(pin2.count); - - pin.ready ? ( - pvs.pvshift_do(pin.magn, pin.freq); - pvs2.pvshift_do(pin2.magn, pin2.freq); - pout.pvout_do(pvs.magn, pvs.freq); - pout2.pvout_do(pvs2.magn, pvs2.freq); - ); - -*******************************************************/ -function pvshift(shift size) -( - this.shift = shift; - this.size = size; - this.magn = memalloc(size); - this.freq = memalloc(size); -); - -function pvshift_set_shift(shift) -( - this.shift = shift; -); - -function pvshift_resize(size) -( - this.size = size; - this.magn = memalloc(size); - this.freq = memalloc(size); -); - -function pvshift_do(magn freq) -( - k_ = 0; - while (k_ < this.size) ( - this.magn[k_] = this.freq[k_] = 0; - k_ += 1; - ); - binf_ = srate / this.size; - dev_ = floor(this.shift / binf_); - k_ = 0; - while (k_ < this.size) ( - index_ = k_ + dev_; - index_ >= 0 && index_ < this.size ? ( - this.magn[index_] += magn[k_]; - this.freq[index_] = freq[k_] + this.shift; - ); - k_ += 1; - ); -); - -/******************************************************* -PVTRANS -======= - -Transpose the frequency components of a PV stream. - -Description ------------ - -The `pvtrans` object takes a PV signal in input (magnitude -and true freqency parts of a PV spectral analysis) and -transpose its frequency components. - -Initializer ------------ - -#### pvtrans(transpo, size) #### - -Initializes PV transposer with the argument `transpo` as the -transposition factor. The `size` argument is the length of -the `magn` and `freq` arrays, usually half the PV analysis size. - -Methods -------- - -#### pvtrans_resize(size) #### - -Resizes internal memories of the process with the new `size`. -The size of a PV process must be half the size of the PV -used to analyse to input signal. This is the size of the magnitude -and true frequency buffers. - -#### pvtrans_set_transpo(transpo) #### - -Sets a new transposition factor `transpo`. - -#### pvtrans_do(magn, freq) #### - -Computes one frame of the process on a complex signal (`magn` and -`freq` are the magnitude and true frequency parts coming from a `pvin` -or any PV processing object). The internal `magn` and `freq` buffers -hold the processed complex signal. This function should be called -only when the `ready` attribute of a `pvin` object has a value of 1. - -Attributes ----------- - -#### pvtrans.magn #### - -Buffer that holds the magnitude part of the process. Indexes run -from 0 to the process size (usually half the PV size). - -#### pvtrans.freq #### - -Buffer that holds the true frequency part of the process. Indexes -run from 0 to the process size (usually half the PV size). - -Example -------- - - desc: Phase Vocoder Stereo Transposer - - import cookdsp.jsfx-inc - - slider1:5<0,8,1{32,64,128,256,512,1024,2048,4096,8192}>PV Size - slider2:1<0,2,1{2,4,8}>Overlaps - slider3:1<0.5,2>Transposition Factor - - @init - size = pow(2, slider1+5); - olaps = pow(2, slider2+1); - pin.pvin(size, olaps); - pin2.pvin(size, olaps); - pout.pvout(size, olaps); - pout2.pvout(size, olaps); - pvt.pvtrans(slider3, size/2); - pvt2.pvtrans(slider3, size/2); - - @slider - size = pow(2, slider1+5); - olaps = pow(2, slider2+1); - // If size or overlaps changed, re-initialize PVs. - size != pin.size || olaps != pin.olaps ? ( - pin.pvin_resize(size, olaps); - pin2.pvin_resize(size, olaps); - pout.pvout_resize(size, olaps); - pout2.pvout_resize(size, olaps); - // Initialize effect's specific memories here... - pvt.pvtrans_resize(size/2); - pvt2.pvtrans_resize(size/2); - ); - // Process effect's specific sliders here... - pvt.pvtrans_set_transpo(slider3); - pvt2.pvtrans_set_transpo(slider3); - - @sample - // Input / Output - pin.pvin_do(spl0); - pin2.pvin_do(spl1); - spl0 = pout.pvout_get_output(pin.count); - spl1 = pout2.pvout_get_output(pin2.count); - - pin.ready ? ( - pvt.pvtrans_do(pin.magn, pin.freq); - pvt2.pvtrans_do(pin2.magn, pin2.freq); - pout.pvout_do(pvt.magn, pvt.freq); - pout2.pvout_do(pvt2.magn, pvt2.freq); - ); - -*******************************************************/ -function pvtrans(transpo size) -( - transpo < 0.01 ? transpo = 0.01 : transpo > 10 ? transpo = 10; - this.transpo = transpo; - this.size = size; - this.magn = memalloc(size); - this.freq = memalloc(size); -); - -function pvtrans_set_transpo(transpo) -( - transpo < 0.01 ? transpo = 0.01 : transpo > 10 ? transpo = 10; - this.transpo = transpo; -); - -function pvtrans_resize(size) -( - this.size = size; - this.magn = memalloc(size); - this.freq = memalloc(size); -); - -function pvtrans_do(magn freq) -( - k_ = 0; - while (k_ < this.size) ( - this.magn[k_] = this.freq[k_] = 0; - k_ += 1; - ); - k_ = 0; - while (k_ < this.size) ( - index_ = floor(k_ * this.transpo); - index_ < this.size ? ( - this.magn[index_] += magn[k_]; - this.freq[index_] = freq[k_] * this.transpo; - ); - k_ += 1; - ); -); - -/******************************************************* -PVVERB -====== - -Spectral domain reverberation. - -Description ------------ - -The `pvverb` object takes a PV signal in input (magnitude -and true freqency parts of a PV spectral analysis) and -slow down the decay rate of both the magnitude and true -frequency components. - -Initializer ------------ - -#### pvverb(revtime, damp, size) #### - -Initializes PV verb with the argument `revtime` as the reverberation -factor, between 0 and 1. The `damp` argument (between 0 and 1) indicates -how faster the high frequencies will decay than the lower frequencies. -The `size` argument is the length of the `magn` and `freq` arrays, -usually half the PV analysis size. - -Methods -------- - -#### pvverb_resize(size) #### - -Resizes internal memories of the process with the new `size`. -The size of a PV process must be half the size of the PV -used to analyse to input signal. This is the size of the magnitude -and true frequency buffers. - -#### pvverb_set_revtime(revtime) #### - -Sets a new reverberation factor `revtime`, between 0 and 1. - -#### pvverb_set_damp(damp) #### - -Sets a new damping factor `damp`, between 0 and 1. - -#### pvverb_do(magn, freq) #### - -Computes one frame of the process on a complex signal (`magn` and -`freq` are the magnitude and true frequency parts coming from a `pvin` -or any PV processing object). The internal `magn` and `freq` buffers -hold the processed complex signal. This function should be called -only when the `ready` attribute of a `pvin` object has a value of 1. - -Attributes ----------- - -#### pvverb.magn #### - -Buffer that holds the magnitude part of the process. Indexes run -from 0 to the process size (usually half the PV size). - -#### pvverb.freq #### - -Buffer that holds the true frequency part of the process. Indexes -run from 0 to the process size (usually half the PV size). - -Example -------- - - desc: Phase Vocoder Stereo Verb - - import cookdsp.jsfx-inc - - slider1:5<0,8,1{32,64,128,256,512,1024,2048,4096,8192}>PV Size - slider2:1<0,2,1{2,4,8}>Overlaps - slider3:0.75<0,1>Reverb Time - slider4:0.9<0,1>Damping Factor - - @init - size = pow(2, slider1+5); - olaps = pow(2, slider2+1); - pin.pvin(size, olaps); - pin2.pvin(size, olaps); - pout.pvout(size, olaps); - pout2.pvout(size, olaps); - pvv.pvverb(slider3, slider4, size/2); - pvv2.pvverb(slider3, slider4, size/2); - - @slider - size = pow(2, slider1+5); - olaps = pow(2, slider2+1); - // If fftsize or overlaps changed, re-initialize PVs. - size != pin.size || olaps != pin.olaps ? ( - pin.pvin_resize(size, olaps); - pin2.pvin_resize(size, olaps); - pout.pvout_resize(size, olaps); - pout2.pvout_resize(size, olaps); - // Initialize effect's specific memories here... - pvv.pvverb_resize(size/2); - pvv2.pvverb_resize(size/2); - ); - // Process effect's specific sliders here... - pvv.pvverb_set_revtime(slider3); - pvv2.pvverb_set_revtime(slider3); - pvv.pvverb_set_damp(slider4); - pvv2.pvverb_set_damp(slider4); - - @sample - // Input / Output - pin.pvin_do(spl0); - pin2.pvin_do(spl1); - spl0 = pout.pvout_get_output(pin.count); - spl1 = pout2.pvout_get_output(pin2.count); - - pin.ready ? ( - pvv.pvverb_do(pin.magn, pin.freq); - pvv2.pvverb_do(pin2.magn, pin2.freq); - pout.pvout_do(pvv.magn, pvv.freq); - pout2.pvout_do(pvv2.magn, pvv2.freq); - ); - -*******************************************************/ -function pvverb(revtime damp size) -( - revtime < 0 ? revtime = 0 : revtime > 1 ? revtime = 1; - this.revtime = revtime; - damp < 0 ? damp = 0 : damp > 1 ? damp = 1; - this.damp = damp; - this.size = size; - this.magn = memalloc(size); - this.freq = memalloc(size); -); - -function pvverb_set_revtime(revtime) -( - revtime < 0 ? revtime = 0 : revtime > 1 ? revtime = 1; - this.revtime = revtime; -); - -function pvverb_set_damp(damp) -( - damp < 0 ? damp = 0 : damp > 1 ? damp = 1; - this.damp = damp; -); - -function pvverb_resize(size) -( - this.size = size; - this.magn = memalloc(size); - this.freq = memalloc(size); -); - -function pvverb_do(magn freq) -( - rev_ = this.revtime * 0.25 + 0.75; - dp_ = this.damp * 0.003 + 0.997; - k_ = 0; - amp_ = 1.0; - while (k_ < this.size) ( - mg_ = magn[k_]; - fq_ = freq[k_]; - mg_ > this.magn[k_] ? ( - this.magn[k_] = magn[k_]; - this.freq[k_] = freq[k_]; - ) : ( - this.magn[k_] = mg_ + (this.magn[k_] - mg_) * rev_ * amp_; - this.freq[k_] = fq_ + (this.freq[k_] - fq_) * rev_ * amp_; - ); - amp_ *= dp_; - k_ += 1; - ); -); diff --git a/FX/BryanChi_FX Devices/cookdsp/pvtrans-example b/FX/BryanChi_FX Devices/cookdsp/pvtrans-example deleted file mode 100644 index 7c039de9b..000000000 --- a/FX/BryanChi_FX Devices/cookdsp/pvtrans-example +++ /dev/null @@ -1,49 +0,0 @@ -desc: Phase Vocoder Stereo Transposer - -import cookdsp.jsfx-inc - -slider1:5<0,8,1{32,64,128,256,512,1024,2048,4096,8192}>FFT Size -slider2:1<0,2,1{2,4,8}>Overlaps -slider3:1<0.5,2>Transposition Factor - -@init -size = pow(2, slider1+5); -olaps = pow(2, slider2+1); -pin.pvin(size, olaps); -pin2.pvin(size, olaps); -pout.pvout(size, olaps); -pout2.pvout(size, olaps); -pvt.pvtrans(slider3, size/2); -pvt2.pvtrans(slider3, size/2); - -@slider -size = pow(2, slider1+5); -olaps = pow(2, slider2+1); -// If fftsize or overlaps changed, re-initialize PVs. -size != pin.size || olaps != pin.olaps ? ( - pin.pvin_resize(size, olaps); - pin2.pvin_resize(size, olaps); - pout.pvout_resize(size, olaps); - pout2.pvout_resize(size, olaps); - // Initialize effect's specific memories here... - pvt.pvtrans_resize(size/2); - pvt2.pvtrans_resize(size/2); -); - // Process effect's specific sliders here... - pvt.pvtrans_set_transpo(slider3); - pvt2.pvtrans_set_transpo(slider3); - -@sample -// Input / Output -pin.pvin_do(spl0); -pin2.pvin_do(spl1); -spl0 = pout.pvout_get_output(pin.count); -spl1 = pout2.pvout_get_output(pin2.count); - -pin.ready ? ( - pvt.pvtrans_do(pin.magn, pin.freq); - pvt2.pvtrans_do(pin2.magn, pin2.freq); - pout.pvout_do(pvt.magn, pvt.freq); - pout2.pvout_do(pvt2.magn, pvt2.freq); -); - diff --git a/FX/BryanChi_FX Devices/cookdsp/random.jsfx-inc b/FX/BryanChi_FX Devices/cookdsp/random.jsfx-inc deleted file mode 100644 index 74a64c363..000000000 --- a/FX/BryanChi_FX Devices/cookdsp/random.jsfx-inc +++ /dev/null @@ -1,139 +0,0 @@ -///////////////////////////////////////////////////////////////// -// Copyright (c) - 2014 - Olivier Belanger // -// Permission to use, copy, modify, and/or distribute this // -// software for any purpose with or without fee is hereby // -// granted, provided that the above copyright notice and this // -// permission notice appear in all copies. CookDSP IS PROVIDED // -// "AS IS", WITHOUT WARRANTY OF ANY KIND FROM THE AUTHOR. // -///////////////////////////////////////////////////////////////// - -@init - -/******************************************************* -RANDOM -====== - -Generate a periodic pseudo-random generator. - -Description ------------ - -The random object initializes a pseudo-random number generator -whose generated values lie between `mini` and `maxi` arguments. -A new value is chosen at a frequency specified by `freq` argument. -The random function can hold the generated value until the next -generation or linearly interpolate between the old value and the -new one. - -It must be used with a variable name as prefix (object oriented). - -Initializer ------------ - -#### random(mini, maxi, freq, mode) #### - -Initializes the random generator. Lower limit of the generation -is specified by `mini` argument while `maxi` argument id the -higher limit. A new value is chosen randomly at a rate given by -the `freq` argument and the `mode` argument indicates the -behaviour of the object : 0 means linear interpolation and 1 means -sample-and-hold. - -Methods -------- - -#### random_set_limits(mini, maxi) #### - -Sets new values for minimum (`mini`) and maximum (`maxi`) limits. - -#### random_set_freq(freq) #### - -Sets new generation frequency in Hz. - -#### random_set_mode(mode) #### - -Changes th behaviour of the object. 0 means linear interpolation -and 1 means sample-and-hold. - -#### random_do() #### - -Computes and returns the next value of the random generator. - -Example -------- - - desc:Randomizing Channels - - import cookdsp.jsfx-inc - - slider1:4<0.25,20>Random Speed - - @init - rL.random(0, 1, slider1, 0); - rR.random(0, 1, slider1, 0); - - - @slider - rL.random_set_freq(slider1); - rR.random_set_freq(slider1); - - @sample - spl0 *= rL.random_do(); - spl1 *= rR.random_do(); - -********************************************************/ -function random(mini maxi freq mode) -( - mode = floor(mode); - mode < 0 ? mode = 0 : mode > 1 ? mode = 1; - this.mode = mode; - mini > maxi ? ( - tmp_ = mini; mini = maxi; maxi = tmp_; - ); - this.mini = mini; - this.maxi = maxi; - this.freq = abs(freq); - this.range = this.maxi - this.mini; - this.inc = this.freq / srate; - this.diff = this.val = this.oldval = 0; - this.time = 1.0; -); - -function random_set_limits(mini maxi) -( - mini > maxi ? ( - tmp_ = mini; mini = maxi; maxi = tmp_; - ); - this.mini = mini; - this.maxi = maxi; - this.range = this.maxi - this.mini; -); - -function random_set_freq(freq) -( - this.freq = abs(freq); - this.inc = this.freq / srate; -); - -function random_set_mode(mode) -( - mode = floor(mode); - mode < 0 ? mode = 0 : mode > 1 ? mode = 1; - this.mode = mode; -); - -function random_do() -( - this.time += this.inc; - this.time >= 1 ? ( - this.time -= 1; - this.oldval = this.val; - this.val = this.range * rand(1) + this.mini; - this.diff = this.val - this.oldval; - ); - this.mode == 0 ? ( - this.oldval + this.diff * this.time; - ) : ( - this.val; - ); -); diff --git a/FX/BryanChi_FX Devices/cookdsp/scaling.jsfx-inc b/FX/BryanChi_FX Devices/cookdsp/scaling.jsfx-inc deleted file mode 100644 index fd28bbbe4..000000000 --- a/FX/BryanChi_FX Devices/cookdsp/scaling.jsfx-inc +++ /dev/null @@ -1,531 +0,0 @@ -///////////////////////////////////////////////////////////////// -// Copyright (c) - 2014 - Olivier Belanger // -// Permission to use, copy, modify, and/or distribute this // -// software for any purpose with or without fee is hereby // -// granted, provided that the above copyright notice and this // -// permission notice appear in all copies. CookDSP IS PROVIDED // -// "AS IS", WITHOUT WARRANTY OF ANY KIND FROM THE AUTHOR. // -///////////////////////////////////////////////////////////////// - -@init - -/******************************************************* -MTOF -==== - -Midi to frequency conversion. - -Signature ----------- - -ret = mtof(midinote) - -Description ------------ - -The mtof function takes a midi note as argument and returns -the corresponding frequency in Hertz. - -Arguments ---------- - -- *midinote* {float} : Midi note, between 0 and 127. can be a - float to do micro-tonal tunning. - -Return ------- - -- *ret* {float} : Frequency value corresponding to midi note in input. - -Example -------- - - desc:Simple Mono Midi Synth - - import cookdsp.jsfx-inc - - @init - midinote = midiamp = 0; - // Initialize two sawtooth waves - ph1.phasor(0, 0); - ph2.phasor(0, 0); - // Initialize a midi triggered envelope - env.masr(0.01, 1); - - @block - // Handle midi inputs - while (midirecv(offset, msg1, msg2, msg3)) ( - // get noteons and noteoffs from all channels - (msg1 & $xF0) == $x90 || (msg1 & $xF0) == $x80 ? ( - msg3 != 0 ? ( - // noteon - midinote = msg2; - // convert midi note to frequency in Hz - freq = mtof(midinote); - ph1.phasor_set_freq(freq); - ph2.phasor_set_freq(freq * 1.01); - // scales velocity to amplitude - midiamp = msg3 / 127; - ) : ( - // noteoff (only with current pitch) - msg2 == midinote ? midiamp = 0; - ); - ) : ( - // passthrough other events - midisend(offset,msg1,msg2,msg3); - ); - ); - - @sample - // Computes the envelope - gain = env.masr_do(midiamp) * 0.5; - // Computes the sawtooth waves - spl0 = (ph1.phasor_do() - 0.5) * gain; - spl1 = (ph2.phasor_do() - 0.5) * gain; - -********************************************************/ -function mtof(midinote) -( - 440.0 * pow(2.0, (midinote - 69) / 12.0); -); - -/******************************************************* -MTOT -==== - -Midi to transposition factor conversion. - -Signature ----------- - -ret = mtot(midinote, centralkey) - -Description ------------ - -The mtot function takes a midi note as argument and returns -the corresponding transposition factor according to a central key. -The central key is the midi note where there is no transposition -(a factor of 1). - -Arguments ---------- - -- *midinote* {float} : Midi note, between 0 and 127. can be a - float to do micro-tonal tunning. -- *centralkey* {float} : The midi note for which the transposition - factor is 1 (no transposition). - -Return ------- - -- *ret* {float} : The transposition factor corresponding to midi note in input. - -Example -------- - - @init - // one octave below (low = 0.5) - low = mtot(48, 60); - // a fifth above (fifth = 1.4999) - fifth = mtot(67, 60); - // one octave above (high = 2.0) - high = mtot(72, 60); - -********************************************************/ -function mtot(midinote, centralkey) -( - pow(1.0594630943592953, midinote - centralkey); -); - -/******************************************************* -FTOM -==== - -Frequency to midi conversion. - -Signature ----------- - -ret = ftom(freq) - -Description ------------ - -The ftom function takes a frequency value, in Hz, as argument -and returns the corresponding midi note number, as a float. If -an integer midi note number is needed, one must round it to the -nearest integer before using it. - -Arguments ---------- - -- *freq* {float} : Frequency value, in Hz, to convert. - -Return ------- - -- *ret* {float} : Midi note number corresponding to frequency in input. - -Example -------- - - @init - A = ftom(440.0); - -********************************************************/ -function ftom(freq) -( - 12.0 * log2(freq / 440.0) + 69; -); - -/******************************************************* -TTOS -==== - -Transposition factor to semitone conversion. - -Signature ----------- - -ret = ttos(transpo) - -Description ------------ - -The `ttos` function takes a transposition factor (1 means no -transposition) as argument and returns the corresponding -transposition in semitones (0 means no transposition). If -an integer semitone number is needed, one must round it to -the nearest integer before using it. - -Arguments ---------- - -- *transpo* {float} : Transposition factor to convert. - -Return ------- - -- *ret* {float} : Semitone value corresponding to dactor in input. - -Example -------- - - @init - // octave below (-12) - semi = ttos(0.5); - -********************************************************/ -function ttos(transpo) -( - 12.0 * log2(transpo); -); - -/******************************************************* -DBTOA -===== - -Decibel to linear amplitude conversion. - -Signature ----------- - -ret = dbtoa(db) - -Description ------------ - -The dbtoa function takes an amplitude defined on the decibel -scale (-120 and up, 0 as nominal amplitude) as argument and -returns the corresponding linear amplitude, as a float. - -Arguments ---------- - -- *db* {float} : Decibel value to convert. - -Return ------- - -- *ret* {float} : Linear amplitude corresponding to decibels in input. - -Example -------- - - desc:Decibel Amplitude - - import cookdsp.jsfx-inc - - slider1:0<-60,12,0.01>Amplitude (dB) - - @init - amp = 1; - - @slider - amp = dbtoa(slider1); - - @sample - spl0 *= amp; - spl1 *= amp; - -********************************************************/ -function dbtoa(db) -( - pow(10.0, db * 0.05); -); - -/******************************************************* -ATODB -===== - -Linear amplitude to decibel conversion. - -Signature ----------- - -ret = atodb(amp) - -Description ------------ - -The atodb function takes an amplitude defined on a linear -scale (0 means silence, 1 means nominal amplitude) as argument -and returns the corresponding value on the decibel scale, as a -float. On the decibel scale, 0 means the nominal amplitude and -negative values decrease the amplitude. - -Arguments ---------- - -- *amp* {float} : Linear amplitude value to convert. - -Return ------- - -- *ret* {float} : Decibel value corresponding to amplitude in input. - -Example -------- - - desc:Rough Gate - - import cookdsp.jsfx-inc - - slider1:-20<-90,0,0.01>Threshold (dB) - - @init - fol = amp = 0; - - @slider - thresh = slider1; - - @sample - // mix stereo signal - input = (abs(spl0) + abs(spl1)) * 0.707; - // follow its amplitude - fol = input + (fol - input) * 0.99; - // convert amplitude to decibels - db = atodb(fol); - // compare with db threshold - db > thresh ? a = 1 : a = 0; - // interpolate new gain value - amp = a + (amp - a) * 0.99; - // apply to both signals - spl0 *= amp; spl1 *= amp; - -********************************************************/ -function atodb(amp) -( - 20.0 * log10(amp); -); - -/******************************************************* -WRAP -==== - -Wraps-around an input value that exceeds the min and max limits. - -Signature ----------- - -ret = wrap(input, mini, maxi) - -Description ------------ - -The wrap function wraps an input value between the range -defined by `mini` and `maxi` values. - -Arguments ---------- - -- *input* {float} : Input value to constrain. -- *mini* {float} : Minimum possible value. -- *maxi* {float} : Maximum possible value. - -Return ------- - -- *ret* {float} : Input value constrained between `mini` and `maxi`. - -Example -------- - - desc:Out-Of-Phase Envelopes - - import cookdsp.jsfx-inc - - slider1:4<0.1,10,0.01>Modulation Frequency - - @init - ph.phasor(slider1, 0); - - @slider - ph.phasor_set_freq(slider1); - - @sample - amp0 = ph.phasor_do(); - // second ramp 180 degrees out-of-phase - amp1 = wrap(amp0 + 0.5, 0, 1); - spl0 *= amp0; - spl1 *= amp1; - -********************************************************/ -function wrap(input mini maxi) -( - while (input < mini) ( - input += mini; - ); - while (input >= maxi) ( - input -= maxi; - ); - input; -); - -/******************************************************* -CLIP -==== - -Clips an input value that exceeds the min and max limits. - -Signature ----------- - -ret = clip(input, mini, maxi) - -Description ------------ - -The clip function clips an input value to a range defined -by `mini` and `maxi` values. If `input` is lower than `mini`, -the output will be `mini`, if `input` is higher than `maxi`, -the output will be `maxi`, otherwise, `input` pass thru. - -Arguments ---------- - -- *input* {float} : Input value to constrain. -- *mini* {float} : Minimum possible value. -- *maxi* {float} : Maximum possible value. - -Return ------- - -- *ret* {float} : Input value clipped to the range defined by `mini` and `maxi`. - -Example -------- - - desc:Bell to Square Amplitude Envelope - - import cookdsp.jsfx-inc - - slider1:0.5<0.001,1,0.001>Clipping value - slider2:4<1,20,0.01>Envelope Frequency - - @init - ph.phasor(slider2, 0); - - @slider - ph.phasor_set_freq(slider2); - - @sample - sine = sin(2 * $pi * ph.phasor_do()); - amp = clip(sine, 0, slider1) / slider1; - spl0 *= amp; - spl1 *= amp; - -********************************************************/ -function clip(input mini maxi) -( - max(min(input, maxi), mini); -); - -/******************************************************* -SCALE -===== - -Maps an input value from an input range to an output range with power factor. - -Signature ----------- - -ret = scale(input, xmin, xmax, ymin, ymax, ex) - -Description ------------ - -The scale function takes an input value, scales it down -to a 0-1 range according to input range (`xmin` - `xmax`), -raises it to `ex` power and then rescales the result to -the output range (`ymin` - `ymax`). This function is useful -to convert a value from a linear scale to an exponential one, -like converting a midi slider (0-127 linear) to a frequency -scale (20-20000 exponential). - -Arguments ---------- - -- *input* {float} : The input value to convert. -- *xmin* {float} : Minimum of the input range. -- *xmax* {float} : Maximum of the input range. -- *ymin* {float} : Minimum of the output range. -- *ymax* {float} : Maximum of the output range. -- *ex* {float} : Power factor (1 is linear, les than 1 is logarithmic, greter than 1 is exponential). - -Return ------- - -- *ret* {float} : Value converted to the output range. - -Example -------- - - desc:Normalized to Frequency Range - - import cookdsp.jsfx-inc - - slider1:0<0,1,0.001>Normalized Frequency - - @init - lp.lop(20); - - @slider - // 0-1 range converted to frequency range - f = scale(slider1, 0, 1, 20, srate/2, 4); - lp.lop_set_freq(f); - - @sample - spl0 = lp.lop_do(spl0); - spl1 = lp.lop_do(spl1); - -********************************************************/ -function scale(x xmin xmax ymin ymax ex) -( - x -= xmin; - x /= (xmax - xmin); - x ^= ex; - x *= (ymax - ymin); - x + ymin; -); diff --git a/FX/BryanChi_FX Devices/firhalfband.jsfx-inc b/FX/BryanChi_FX Devices/firhalfband.jsfx-inc deleted file mode 100644 index 97a206a0d..000000000 --- a/FX/BryanChi_FX Devices/firhalfband.jsfx-inc +++ /dev/null @@ -1,302 +0,0 @@ -desc:FIR Filter Half Band -/* - FIR Half band filter - - Reference: http://www.labbookpages.co.uk/audio/firWindowing.html - - This filter is designed to do one job and do it well and as fast as JSFX can muster (almost). - - It's a half band low pass 65 tap FIR filter meant for use with oversampling x2. - - For 44.1Khz: At 88.2kHz it filters out frequencies after 22050hz which gets rid of aliasing introduced - by zero filling when oversampling. - - The filter is steep and uses the following vars (44.1kHz): - - Fa = 0 - Fb = 22050 - length = 65 - Fs = 88200 - Att = 96db - - From here: - - http://arc.id.au/FilterDesign.html - - Example: - - // DAW sample rate 44.1kHz (left channel given, same for right channel) - // Oversampling x 2 - - @init - firL.init_FIR_filter_44100(); - - @sample - y0 = left.do_process(spl0); // Apply application filters and other processing etc - y1 = left.do_process(0); // Zero padding - - spl0 = firL.do_FIR_filter(y0) * 2; // First fir application - firL.do_FIR_filter(y1); // Discard (crude decimation, only do this if you're - // not generating harmonics, ie. clean EQ) - - */ - -@init - -function init_FIR_filter_44100() - instance( - b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, - b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33, b34, b35, b36, b37, b38, b39, - b40, b41, b42, b43, b44, b45, b46, b47, b48, b49, b50, b51, b52, b53, b54, b55, b56, b57, b58, b59, - b60, b61, b62, b63, b64, - w0, w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12, w13, w14, w15, w16, w17, w18, w19, - w20, w21, w22, w23, w24, w25, w26, w27, w28, w29, w30, w31, w32 - ) -( - // Set the FIR window taking into account symmetry around the centre tap (w32). - w0 = -0.000000; - w1 = -0.000016; - w2 = 0.000000; - w3 = 0.000067; - w4 = -0.000000; - w5 = -0.000189; - w6 = -0.000000; - w7 = 0.000438; - w8 = -0.000000; - w9 = -0.000891; - w10 = 0.000000; - w11 = 0.001653; - w12 = -0.000000; - w13 = -0.002862; - w14 = 0.000000; - w15 = 0.004690; - w16 = -0.000000; - w17 = -0.007364; - w18 = 0.000000; - w19 = 0.011189; - w20 = -0.000000; - w21 = -0.016631; - w22 = 0.000000; - w23 = 0.024500; - w24 = -0.000000; - w25 = -0.036479; - w26 = 0.000000; - w27 = 0.056928; - w28 = -0.000000; - w29 = -0.101933; - w30 = 0.000000; - w31 = 0.316897; - w32 = 0.500000; -); - -function init_FIR_filter_48000() - instance( - b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, - b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33, b34, b35, b36, b37, b38, b39, - b40, b41, b42, b43, b44, b45, b46, b47, b48, b49, b50, b51, b52, b53, b54, b55, b56, b57, b58, b59, - b60, b61, b62, b63, b64, - w0, w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12, w13, w14, w15, w16, w17, w18, w19, - w20, w21, w22, w23, w24, w25, w26, w27, w28, w29, w30, w31, w32 - ) -( - // Set the FIR window taking into account symmetry around the centre tap (w32). - - w0 = -0.000005; - w1 = 0.000006; - w2 = 0.000034; - w3 = -0.000015; - w4 = -0.000115; - w5 = 0.000020; - w6 = 0.000293; - w7 = 0.000007; - w8 = -0.000631; - w9 = -0.000125; - w10 = 0.001200; - w11 = 0.000433; - w12 = -0.002076; - w13 = -0.001087; - w14 = 0.003317; - w15 = 0.002305; - w16 = -0.004952; - w17 = -0.004386; - w18 = 0.006964; - w19 = 0.007728; - w20 = -0.009278; - w21 = -0.012890; - w22 = 0.011759; - w23 = 0.020763; - w24 = -0.014222; - w25 = -0.033078; - w26 = 0.016454; - w27 = 0.054199; - w28 = -0.018238; - w29 = -0.100165; - w30 = 0.019392; - w31 = 0.316285; - w32 = 0.480208; -); - -function do_FIR_filter_less_efficient(input) - instance( - b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, - b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33, b34, b35, b36, b37, b38, b39, - b40, b41, b42, b43, b44, b45, b46, b47, b48, b49, b50, b51, b52, b53, b54, b55, b56, b57, b58, b59, - b60, b61, b62, b63, b64, - w0, w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12, w13, w14, w15, w16, w17, w18, w19, - w20, w21, w22, w23, w24, w25, w26, w27, w28, w29, w30, w31, w32 - ) -( - // Scroll the window - b64 = b63; b63 = b62; b62 = b61; b61 = b60; - b60 = b59; b59 = b58; b58 = b57; b57 = b56; b56 = b55; b55 = b54; b54 = b53; b53 = b52; b52 = b51; b51 = b50; - b50 = b49; b49 = b48; b48 = b47; b47 = b46; b46 = b45; b45 = b44; b44 = b43; b43 = b42; b42 = b41; b41 = b40; - b40 = b39; b39 = b38; b38 = b37; b37 = b36; b36 = b35; b35 = b34; b34 = b33; b33 = b32; b32 = b31; b31 = b30; - b30 = b29; b29 = b28; b28 = b27; b27 = b26; b26 = b25; b25 = b24; b24 = b23; b23 = b22; b22 = b21; b21 = b20; - b20 = b19; b19 = b18; b18 = b17; b17 = b16; b16 = b15; b15 = b14; b14 = b13; b13 = b12; b12 = b11; b11 = b10; - b10 = b9; b9 = b8; b8 = b7; b7 = b6; b6 = b5; b5 = b4; b4 = b3; b3 = b2; b2 = b1; b1 = b0; - - // Introduce the new sample into the window - b0 = input; - - // Compute and return, taking advantage of symmetrical fir filter to reduce operations - w0 * (b0 + b64) + w1 * (b1 + b63) + w2 * (b2 + b62) + w3 * (b3 + b61) + w4 * (b4 + b60) + w5 * (b5 + b59) + w6 * (b6 + b58) + - w7 * (b7 + b57) + w8 * (b8 + b56) + w9 * (b9 + b55) + w10 * (b10 + b54) + w11 * (b11 + b53) + w12 * (b12 + b52) + w13 * (b13 + b51) + - w14 * (b14 + b50) + w15 * (b15 + b49) + w16 * (b16 + b48) + w17 * (b17 + b47) + w18 * (b18 + b46) + w19 * (b19 + b45) + w20 * (b20 + b44) + - w21 * (b21 + b43) + w22 * (b22 + b42) + w23 * (b23 + b41) + w24 * (b24 + b40) + w25 * (b25 + b39) + w26 * (b26 + b38) + w27 * (b27 + b37) + - w28 * (b28 + b36) + w29 * (b29 + b35) + w30 * (b30 + b34) + w31 * (b31 + b33) + w32 * (b32); -); - -function do_FIR_filter(input0, input1) local(ret) - instance( - b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, - b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33, b34, b35, b36, b37, b38, b39, - b40, b41, b42, b43, b44, b45, b46, b47, b48, b49, b50, b51, b52, b53, b54, b55, b56, b57, b58, b59, - b60, b61, b62, b63, b64, - w0, w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12, w13, w14, w15, w16, w17, w18, w19, - w20, w21, w22, w23, w24, w25, w26, w27, w28, w29, w30, w31, w32 - ) -( - // Compute and return. - // We're zero padding so only interest in the result of input0 - // Taking advantage of symmetrical fir filter to reduce operations. - // We also arrange operations so that we don't need to scroll the window before calculating. - ret = w0 * (input0 + b63) + w1 * (b0 + b62) + w2 * (b1 + b61) + w3 * (b2 + b60) + w4 * (b3 + b59) + w5 * (b4 + b58) + w6 * (b5 + b57) + - w7 * (b6 + b56) + w8 * (b7 + b55) + w9 * (b8 + b54) + w10 * (b9 + b53) + w11 * (b10 + b52) + w12 * (b11 + b51) + w13 * (b12 + b50) + - w14 * (b13 + b49) + w15 * (b14 + b48) + w16 * (b15 + b47) + w17 * (b16 + b46) + w18 * (b17 + b45) + w19 * (b18 + b44) + w20 * (b19 + b43) + - w21 * (b20 + b42) + w22 * (b21 + b41) + w23 * (b22 + b40) + w24 * (b23 + b39) + w25 * (b24 + b38) + w26 * (b25 + b37) + w27 * (b26 + b36) + - w28 * (b27 + b35) + w29 * (b28 + b34) + w30 * (b29 + b33) + w31 * (b30 + b32) + w32 * (b31); - - // Scroll the window by two - b64 = b62; b63 = b61; b62 = b60; b61 = b59; - b60 = b58; b59 = b57; b58 = b56; b57 = b55; b56 = b54; b55 = b53; b54 = b52; b53 = b51; b52 = b50; b51 = b49; - b50 = b48; b49 = b47; b48 = b46; b47 = b45; b46 = b44; b45 = b43; b44 = b42; b43 = b41; b42 = b40; b41 = b39; - b40 = b38; b39 = b37; b38 = b36; b37 = b35; b36 = b34; b35 = b33; b34 = b32; b33 = b31; b32 = b30; b31 = b29; - b30 = b28; b29 = b27; b28 = b26; b27 = b25; b26 = b24; b25 = b23; b24 = b22; b23 = b21; b22 = b20; b21 = b19; - b20 = b18; b19 = b17; b18 = b16; b17 = b15; b16 = b14; b15 = b13; b14 = b12; b13 = b11; b12 = b10; b11 = b9; - b10 = b8; b9 = b7; b8 = b6; b7 = b5; b6 = b4; b5 = b3; b4 = b2; b3 = b1; b2 = b0; - - b1 = input0; - b0 = input1; - - // Filtering out the mirror beyond Nyquist reduces energy by half so multiply back out - ret * 2.0; -); - -function get_FIR_pdc() ( - // PDC is usually number of taps / 2 (that's 32) - // We'll be running x2 so the delay is halved again. - 16; -); - -// Included the un-rolled source code here for completeness and in case any other work -// on coefficients etc is required. -/* -function init_FIR_filter(bufmem, ntaps, coeffs) - instance(hist_buf, buf_ptr, buf_ptr2, len, w) -( - len = ntaps; - hist_buf = bufmem; - buf_ptr = hist_buf + (len-1); - buf_ptr2 = buf_ptr + len; - w = coeffs; - - w[0] = w[64] = -0.000000; - w[1] = w[63] = -0.000016; - w[2] = w[62] = 0.000000; - w[3] = w[61] = 0.000067; - w[4] = w[60] = -0.000000; - w[5] = w[59] = -0.000189; - w[6] = w[58] = -0.000000; - w[7] = w[57] = 0.000438; - w[8] = w[56] = -0.000000; - w[9] = w[55] = -0.000891; - w[10] = w[54] = 0.000000; - w[11] = w[53] = 0.001653; - w[12] = w[52] = -0.000000; - w[13] = w[51] = -0.002862; - w[14] = w[50] = 0.000000; - w[15] = w[49] = 0.004690; - w[16] = w[48] = -0.000000; - w[17] = w[47] = -0.007364; - w[18] = w[46] = 0.000000; - w[19] = w[45] = 0.011189; - w[20] = w[44] = -0.000000; - w[21] = w[43] = -0.016631; - w[22] = w[42] = 0.000000; - w[23] = w[41] = 0.024500; - w[24] = w[40] = -0.000000; - w[25] = w[39] = -0.036479; - w[26] = w[38] = 0.000000; - w[27] = w[37] = 0.056928; - w[28] = w[36] = -0.000000; - w[29] = w[35] = -0.101933; - w[30] = w[34] = 0.000000; - w[31] = w[33] = 0.316897; - w[32] = 0.500000; -); - -function do_FIR_filter(s0) - local(sum, n) - instance(hist_buf, buf_ptr, buf_ptr2, len, w) -( - buf_ptr[] = buf_ptr2[] = s0; - - sum = n = 0; - loop(len, - sum += w[n] * buf_ptr[n]; - n += 1; - ); - - buf_ptr -= 1; buf_ptr2 -= 1; - buf_ptr < hist_buf ? ( - buf_ptr = hist_buf + (len-1); - buf_ptr2 = buf_ptr + len; - ); - - sum; -); - -// Read coefficients from file using: -handle = file_open("coff.txt"); - -len = file_mem(handle, wm, 65); - -file_close(handle); - -m = len - 1; - -// Was the following normalisation really needed?? -n = 1; -normalize = w[0]; -loop(len, - normalize += w[n]; - n += 1; -); - -n = 0; -normalize = 1/normalize; -loop(len, - w[n] *= normalize; - n += 1; -); -*/ diff --git a/FX/BryanChi_FX Devices/spectrum.jsfx-inc b/FX/BryanChi_FX Devices/spectrum.jsfx-inc deleted file mode 100644 index 9b8302b78..000000000 --- a/FX/BryanChi_FX Devices/spectrum.jsfx-inc +++ /dev/null @@ -1,977 +0,0 @@ -desc: FFT Spectrum Analyzer -/* - Spectrum Analyzer Library - - Reference: - http://www.zytrax.com/tech/audio/calculator.html - https://lists.gnu.org/archive/html/help-octave/2015-07/msg00016.html - http://apmr.matelys.com/Standards/OctaveBands.html - */ -options:gmem=gmemReEQ_Spectrum -options:gfx_idle -options:gfx_hz=60 - -@init - -Diy_ID = gmem[1]; -/* - * Initialise spectrum memory allocater - * We pass in an existing memory index so that we can integrate with - * other allocaters - */ -function spectrum.init_memory(i) instance(mem_index) ( - mem_index = i; -); - -/* - * Allocate memory for spectrum analyzer - */ -function spectrum.alloc_memory(amount) instance(mem_index) local(i) ( - i = mem_index; - mem_index += amount; - i; -); - -/* - * Return the memory index so that we can integrate with other allocaters - */ -function spectrum.get_memory_index() instance(mem_index) ( - mem_index; -); - -/* - * Round a number up or down - */ -function spectrum.round(in) ( - in = floor(in + 0.5 * sign(in)); -); - -/* - * Given frequency, return screen x position - */ -function spectrum.freq_to_x(freq) ( - spectrum.left_margin + ((gfx_w - spectrum.left_margin - spectrum.right_margin) * log(freq / spectrum.min_freq) / spectrum.freq_log_max); -); - -/* - * Given screen x position, return frequency - */ -function spectrum.x_to_freq(x) ( - x = spectrum.min_freq * exp(spectrum.freq_log_max * (x - spectrum.left_margin) / (gfx_w - spectrum.left_margin - spectrum.right_margin)); - max(min(x, spectrum.max_freq), spectrum.min_freq); -); - -/* - * Given decibels, return screen y position - */ -function spectrum.db_to_y(db) ( - spectrum.top_margin + (((db - spectrum.ceiling) / (spectrum.noise_floor - spectrum.ceiling)) * (gfx_h - spectrum.top_margin - spectrum.bottom_margin - gfx_texth)); -); - -/* - * Given screen y position, return decibels - */ -function spectrum.y_to_db(y) ( - y = (y - spectrum.top_margin) / (gfx_h - spectrum.top_margin - spectrum.bottom_margin - gfx_texth); - spectrum.ceiling + (y * (spectrum.noise_floor - spectrum.ceiling) ); -); - -/* - * Given a magnitude (1.0 .... very small number), return y screen position - * No tilt - */ -function spectrum.magnitude_to_y(m) local(db) ( - db = 10 * log10(m); - spectrum.top_margin + (((db - spectrum.ceiling) / (spectrum.noise_floor - spectrum.ceiling)) * (gfx_h - spectrum.top_margin - spectrum.bottom_margin - gfx_texth)); -); - -/* - * Given a magnitude, return y screen position as 0..1 with applied tilt - */ -function spectrum.magnitude_to_01(m, freq) local(db) ( - db = 10 * log10(m); - - // Tilt around 1kHz - spectrum.tilt != 0.0 ? db += spectrum.tilt * ((log(freq) / log(2)) - (log(1024) / log(2))); - - 1.0 - ((db - spectrum.ceiling) / (spectrum.noise_floor - spectrum.ceiling)); -); - -/* - * Given a 0..1 screen coordinate, return y screen coordinate - */ -function spectrum.01_to_y(zo) ( - spectrum.top_margin + (1.0 - zo) * (gfx_h - spectrum.top_margin - spectrum.bottom_margin - gfx_texth); -); - -/* - * Put sample in spectrum buffer 0 - */ -function spectrum.sample0(s) ( - spectrum.pos0[] = s; - spectrum.pos0 += 1; - spectrum.pos0 >= spectrum.end0 ? spectrum.pos0 = spectrum.samples0; -); - -/* - * Put sample in spectrum buffer 1 - */ -function spectrum.sample1(s) ( - spectrum.pos1[] = s; - spectrum.pos1 += 1; - spectrum.pos1 >= spectrum.end1 ? spectrum.pos1 = spectrum.samples1; -); - -/* - * Put sample in spectrum buffer 2 - */ -function spectrum.sample2(s) ( - spectrum.pos2[] = s; - spectrum.pos2 += 1; - spectrum.pos2 >= spectrum.end2 ? spectrum.pos2 = spectrum.samples2; -); - -/* - * Put sample in spectrum buffer 3 - */ -function spectrum.sample3(s) ( - spectrum.pos3[] = s; - spectrum.pos3 += 1; - spectrum.pos3 >= spectrum.end3 ? spectrum.pos3 = spectrum.samples3; -); - -/* - * Put sample in spectrum buffer 4 - */ -function spectrum.sample4(s) ( - spectrum.pos4[] = s; - spectrum.pos4 += 1; - spectrum.pos4 >= spectrum.end4 ? spectrum.pos4 = spectrum.samples4; -); - -/* - * Put sample in spectrum buffer 5 - */ -function spectrum.sample5(s) ( - spectrum.pos5[] = s; - spectrum.pos5 += 1; - spectrum.pos5 >= spectrum.end5 ? spectrum.pos5 = spectrum.samples5; -); - -/* - * Reset all spectrum buffers - */ -function spectrum.reset_buffers() ( - // Clear sample buffers and force recalculate window - spectrum.windowsize = 0; - memset(spectrum.samples0, 0, spectrum.histsize); - memset(spectrum.samples1, 0, spectrum.histsize); - memset(spectrum.samples2, 0, spectrum.histsize); - memset(spectrum.samples3, 0, spectrum.histsize); - - // Spectrum 1 - memset(spectrum.bin_mag0, 0, spectrum.max_buffer); - memset(spectrum.bin_freq0, 0, spectrum.max_buffer); - memset(spectrum.bin_y0, 0, spectrum.max_buffer); - memset(spectrum.bin_peakmag0, spectrum.small_mag, spectrum.max_buffer); - memset(spectrum.bin_peakfreq0, 0, spectrum.max_buffer); - memset(spectrum.samples0, 0, spectrum.histsize); - spectrum.pos0 = spectrum.samples0; - spectrum.end0 = spectrum.samples0 + spectrum.histsize; - - // Spectrum 2 - memset(spectrum.bin_mag1, 0, spectrum.max_buffer); - memset(spectrum.bin_freq1, 0, spectrum.max_buffer); - memset(spectrum.bin_y1, 0, spectrum.max_buffer); - memset(spectrum.bin_peakmag1, spectrum.small_mag, spectrum.max_buffer); - memset(spectrum.bin_peakfreq1, 0, spectrum.max_buffer); - memset(spectrum.samples1, 0, spectrum.histsize); - spectrum.pos1 = spectrum.samples1; - spectrum.end1 = spectrum.samples1 + spectrum.histsize; - - // Spectrum 3 - memset(spectrum.bin_mag2, 0, spectrum.max_buffer); - memset(spectrum.bin_freq2, 0, spectrum.max_buffer); - memset(spectrum.bin_y2, 0, spectrum.max_buffer); - memset(spectrum.bin_peakmag2, spectrum.small_mag, spectrum.max_buffer); - memset(spectrum.bin_peakfreq2, 0, spectrum.max_buffer); - memset(spectrum.samples2, 0, spectrum.histsize); - spectrum.pos2 = spectrum.samples2; - spectrum.end2 = spectrum.samples2 + spectrum.histsize; - - // Spectrum 4 - memset(spectrum.bin_mag3, 0, spectrum.max_buffer); - memset(spectrum.bin_freq3, 0, spectrum.max_buffer); - memset(spectrum.bin_y3, 0, spectrum.max_buffer); - memset(spectrum.bin_peakmag3, spectrum.small_mag, spectrum.max_buffer); - memset(spectrum.bin_peakfreq3, 0, spectrum.max_buffer); - memset(spectrum.samples3, 0, spectrum.histsize); - spectrum.pos3 = spectrum.samples3; - spectrum.end3 = spectrum.samples3 + spectrum.histsize; - - // Spectrum 5 - memset(spectrum.bin_mag4, 0, spectrum.max_buffer); - memset(spectrum.bin_freq4, 0, spectrum.max_buffer); - memset(spectrum.bin_y4, 0, spectrum.max_buffer); - memset(spectrum.bin_peakmag4, spectrum.small_mag, spectrum.max_buffer); - memset(spectrum.bin_peakfreq4, 0, spectrum.max_buffer); - memset(spectrum.samples4, 0, spectrum.histsize); - spectrum.pos4 = spectrum.samples4; - spectrum.end4 = spectrum.samples4 + spectrum.histsize; - - // Spectrum 6 - memset(spectrum.bin_mag5, 0, spectrum.max_buffer); - memset(spectrum.bin_freq5, 0, spectrum.max_buffer); - memset(spectrum.bin_y5, 0, spectrum.max_buffer); - memset(spectrum.bin_peakmag5, spectrum.small_mag, spectrum.max_buffer); - memset(spectrum.bin_peakfreq5, 0, spectrum.max_buffer); - memset(spectrum.samples5, 0, spectrum.histsize); - spectrum.pos5 = spectrum.samples5; - spectrum.end5 = spectrum.samples5 + spectrum.histsize; -); - -/* - * Set the new fft block size for all buffers - */ -function spectrum.set_block_size(size) ( - spectrum.fftsize = size; - - spectrum.reset_buffers(); -); - -/* - * Set the windowing type for all buffers - */ -function spectrum.set_type(t) ( - spectrum.windowsize = 0; - spectrum.windowtype = t; -); - -/* - * Set a spectrum's color - */ -function spectrum.set_color(buf_index, r, g, b, a) ( - spectrum.red[buf_index] = r; - spectrum.green[buf_index] = g; - spectrum.blue[buf_index] = b; - spectrum.alpha[buf_index] = a; -); - -/* - * Set whether spectrum peaks are shown - */ -function spectrum.set_show_peaks(show) ( - spectrum.show_peaks = show; - - // Clear out the peak data - memset(spectrum.bin_peakmag0, spectrum.small_mag, spectrum.max_buffer); - memset(spectrum.bin_peakfreq0, 0, spectrum.max_buffer); - memset(spectrum.bin_peakmag1, spectrum.small_mag, spectrum.max_buffer); - memset(spectrum.bin_peakfreq1, 0, spectrum.max_buffer); - memset(spectrum.bin_peakmag2, spectrum.small_mag, spectrum.max_buffer); - memset(spectrum.bin_peakfreq2, 0, spectrum.max_buffer); - memset(spectrum.bin_peakmag3, spectrum.small_mag, spectrum.max_buffer); - memset(spectrum.bin_peakfreq3, 0, spectrum.max_buffer); - memset(spectrum.bin_peakmag4, spectrum.small_mag, spectrum.max_buffer); - memset(spectrum.bin_peakfreq4, 0, spectrum.max_buffer); - memset(spectrum.bin_peakmag5, spectrum.small_mag, spectrum.max_buffer); - memset(spectrum.bin_peakfreq5, 0, spectrum.max_buffer); -); - -/* - * Set whether a spectrum is line or filled - */ -function spectrum.set_fill(buf_index, fill) ( - spectrum.fill[buf_index] = fill; -); - -/* - * Initialise all variables and allocate buffers - */ -function spectrum.init() ( - // Main buffer size for all calcs - spectrum.max_buffer = 16384; - - // Range db - spectrum.ceiling = 0; - spectrum.noise_floor = -10; - - // Visible frequency limit - spectrum.max_freq = 44100 / 2.0; - spectrum.min_freq = 10; - spectrum.freq_log_max = log(spectrum.max_freq / spectrum.min_freq); - - spectrum.top_margin = 10; - spectrum.bottom_margin = 0; - spectrum.left_margin = 0; - spectrum.right_margin = 0; - - // Tilts around the 1kHz frequency - spectrum.tilt = 4.5; - - // Piano roll position - spectrum.piano_y = 50; - - // Smallest magnitude - spectrum.small_mag = 0.00000000000000000000000001; - - // FFT window - spectrum.max_fft_size = 32768; - spectrum.fftsize = 8192; - spectrum.histsize = spectrum.max_fft_size + (spectrum.max_fft_size * 0.5 - 1); - - spectrum.windowsize = 0; - - spectrum.show_peaks = 0; - - // Window types - // 1: hamming - // 2: blackman-harris - // 3: blackman - // 4: rectangular - spectrum.windowtype = 2; // blackman-harris default - spectrum.window = spectrum.alloc_memory(spectrum.histsize); - - spectrum.fftworkspace = spectrum.alloc_memory(spectrum.max_fft_size * 0.5 + 1); - - spectrum.default_r = 46 / 255; - spectrum.default_g = 71 / 255; - spectrum.default_b = 83 / 255; - spectrum.default_a = 1; - - spectrum.red = spectrum.alloc_memory(6); - spectrum.green = spectrum.alloc_memory(6); - spectrum.blue = spectrum.alloc_memory(6); - spectrum.alpha = spectrum.alloc_memory(6); - - spectrum.fill = spectrum.alloc_memory(6); - - spectrum.point_x = spectrum.alloc_memory(16384); - spectrum.point_y = spectrum.alloc_memory(16384); - - // Buffer 0 - spectrum.samples0 = spectrum.alloc_memory(spectrum.histsize); - spectrum.bin_mag0 = spectrum.alloc_memory(spectrum.max_buffer); - spectrum.bin_freq0 = spectrum.alloc_memory(spectrum.max_buffer); - spectrum.bin_y0 = spectrum.alloc_memory(spectrum.max_buffer); - spectrum.bin_peakmag0 = spectrum.alloc_memory(spectrum.max_buffer); - spectrum.bin_peakfreq0 = spectrum.alloc_memory(spectrum.max_buffer); - spectrum.pos0 = spectrum.samples0; - spectrum.end0 = spectrum.samples0 + spectrum.histsize; - spectrum.set_color(0, spectrum.default_r, spectrum.default_g, spectrum.default_b, spectrum.default_a); - spectrum.set_fill(0, 1); - - // Buffer 1 - spectrum.samples1 = spectrum.alloc_memory(spectrum.histsize); - spectrum.bin_mag1 = spectrum.alloc_memory(spectrum.max_buffer); - spectrum.bin_freq1 = spectrum.alloc_memory(spectrum.max_buffer); - spectrum.bin_y1 = spectrum.alloc_memory(spectrum.max_buffer); - spectrum.bin_peakmag1 = spectrum.alloc_memory(spectrum.max_buffer); - spectrum.bin_peakfreq1 = spectrum.alloc_memory(spectrum.max_buffer); - spectrum.pos1 = spectrum.samples1; - spectrum.end1 = spectrum.samples1 + spectrum.histsize; - spectrum.set_color(1, spectrum.default_r, spectrum.default_g, spectrum.default_b, spectrum.default_a); - spectrum.set_fill(1, 1); - - // Buffer 2 - spectrum.samples2 = spectrum.alloc_memory(spectrum.histsize); - spectrum.bin_mag2 = spectrum.alloc_memory(spectrum.max_buffer); - spectrum.bin_freq2 = spectrum.alloc_memory(spectrum.max_buffer); - spectrum.bin_y2 = spectrum.alloc_memory(spectrum.max_buffer); - spectrum.bin_peakmag2 = spectrum.alloc_memory(spectrum.max_buffer); - spectrum.bin_peakfreq2 = spectrum.alloc_memory(spectrum.max_buffer); - spectrum.pos2 = spectrum.samples2; - spectrum.end2 = spectrum.samples2 + spectrum.histsize; - spectrum.set_color(2, spectrum.default_r, spectrum.default_g, spectrum.default_b, spectrum.default_a); - spectrum.set_fill(2, 1); - - // Buffer 3 - spectrum.samples3 = spectrum.alloc_memory(spectrum.histsize); - spectrum.bin_mag3 = spectrum.alloc_memory(spectrum.max_buffer); - spectrum.bin_freq3 = spectrum.alloc_memory(spectrum.max_buffer); - spectrum.bin_y3 = spectrum.alloc_memory(spectrum.max_buffer); - spectrum.bin_peakmag3 = spectrum.alloc_memory(spectrum.max_buffer); - spectrum.bin_peakfreq3 = spectrum.alloc_memory(spectrum.max_buffer); - spectrum.pos3 = spectrum.samples3; - spectrum.end3 = spectrum.samples3 + spectrum.histsize; - spectrum.set_color(3, spectrum.default_r, spectrum.default_g, spectrum.default_b, spectrum.default_a); - spectrum.set_fill(3, 1); - - // Buffer 4 - spectrum.samples4 = spectrum.alloc_memory(spectrum.histsize); - spectrum.bin_mag4 = spectrum.alloc_memory(spectrum.max_buffer); - spectrum.bin_freq4 = spectrum.alloc_memory(spectrum.max_buffer); - spectrum.bin_y4 = spectrum.alloc_memory(spectrum.max_buffer); - spectrum.bin_peakmag4 = spectrum.alloc_memory(spectrum.max_buffer); - spectrum.bin_peakfreq4 = spectrum.alloc_memory(spectrum.max_buffer); - spectrum.pos4 = spectrum.samples4; - spectrum.end4 = spectrum.samples4 + spectrum.histsize; - spectrum.set_color(4, spectrum.default_r, spectrum.default_g, spectrum.default_b, spectrum.default_a); - spectrum.set_fill(4, 1); - - // Buffer 5 - spectrum.samples5 = spectrum.alloc_memory(spectrum.histsize); - spectrum.bin_mag5 = spectrum.alloc_memory(spectrum.max_buffer); - spectrum.bin_freq5 = spectrum.alloc_memory(spectrum.max_buffer); - spectrum.bin_y5 = spectrum.alloc_memory(spectrum.max_buffer); - spectrum.bin_peakmag5 = spectrum.alloc_memory(spectrum.max_buffer); - spectrum.bin_peakfreq5 = spectrum.alloc_memory(spectrum.max_buffer); - spectrum.pos5 = spectrum.samples5; - spectrum.end5 = spectrum.samples5 + spectrum.histsize; - spectrum.set_color(5, spectrum.default_r, spectrum.default_g, spectrum.default_b, spectrum.default_a); - spectrum.set_fill(5, 1); - - spectrum.last_time = spectrum.alloc_memory(6); -); - -/* - * Cubic hermite, given A,B,C,D and time (t) return cubic interpolation - * http://paulbourke.net/miscellaneous/interpolation/ - */ -function cubic_hermite(A, B, C, D, t) local(a0, a1, a2, a3, t2) -( - t2 = t * t; - - a0 = D - C - A + B; - a1 = A - B - a0; - a2 = C - A; - a3 = B; - - a0 * t * t2 + a1 * t2 + a2 * t + a3; -); - -function spectrum.draw_line(x1, y1, x2, y2) -( - x1 = floor(x1); - x2 = floor(x2); - x2 = floor(x2); - y2 = floor(y2); - - gfx_line(x1, y1-1, x2, y2-1, 1); - gfx_line(x1, y1, x2-1,y2-1, 1); -); - -/* - * Draw the specified spectrum - */ -function spectrum.draw(bufindex) - local(i, pwr, windowpos, dwindowpos, buf1, buf2, buf3, tx, ty, spectrum_fill, tpx, tpy, fill_slast, fill_slmin, - lx, ly, tx0, lx0, num_bins, last_bin, bin, ipnt, mag, freq, bottom, delta, time, rate_over_fftsize) -( - // Select buffer to draw - bufindex == 0 ? ( - spectrum.samples = spectrum.samples0; - spectrum.bin_mag = spectrum.bin_mag0; - spectrum.bin_freq = spectrum.bin_freq0; - spectrum.bin_y = spectrum.bin_y0; - spectrum.bin_peakmag = spectrum.bin_peakmag0; - spectrum.bin_peakfreq = spectrum.bin_peakfreq0; - spectrum.pos = spectrum.pos0; - spectrum.end = spectrum.end0; - ) : bufindex == 1 ? ( - spectrum.samples = spectrum.samples1; - spectrum.bin_mag = spectrum.bin_mag1; - spectrum.bin_freq = spectrum.bin_freq1; - spectrum.bin_y = spectrum.bin_y1; - spectrum.bin_peakmag = spectrum.bin_peakmag1; - spectrum.bin_peakfreq = spectrum.bin_peakfreq1; - spectrum.pos = spectrum.pos1; - spectrum.end = spectrum.end1; - ) : bufindex == 2 ? ( - spectrum.samples = spectrum.samples2; - spectrum.bin_mag = spectrum.bin_mag2; - spectrum.bin_freq = spectrum.bin_freq2; - spectrum.bin_y = spectrum.bin_y2; - spectrum.bin_peakmag = spectrum.bin_peakmag2; - spectrum.bin_peakfreq = spectrum.bin_peakfreq2; - spectrum.pos = spectrum.pos2; - spectrum.end = spectrum.end2; - ) : bufindex == 3 ? ( - spectrum.samples = spectrum.samples3; - spectrum.bin_mag = spectrum.bin_mag3; - spectrum.bin_freq = spectrum.bin_freq3; - spectrum.bin_y = spectrum.bin_y3; - spectrum.bin_peakmag = spectrum.bin_peakmag3; - spectrum.bin_peakfreq = spectrum.bin_peakfreq3; - spectrum.pos = spectrum.pos3; - spectrum.end = spectrum.end3; - ) : bufindex == 4 ? ( - spectrum.samples = spectrum.samples4; - spectrum.bin_mag = spectrum.bin_mag4; - spectrum.bin_freq = spectrum.bin_freq4; - spectrum.bin_y = spectrum.bin_y4; - spectrum.bin_peakmag = spectrum.bin_peakmag4; - spectrum.bin_peakfreq = spectrum.bin_peakfreq4; - spectrum.pos = spectrum.pos4; - spectrum.end = spectrum.end4; - ) : bufindex == 5 ? ( - spectrum.samples = spectrum.samples5; - spectrum.bin_mag = spectrum.bin_mag5; - spectrum.bin_freq = spectrum.bin_freq5; - spectrum.bin_y = spectrum.bin_y5; - spectrum.bin_peakmag = spectrum.bin_peakmag5; - spectrum.bin_peakfreq = spectrum.bin_peakfreq5; - spectrum.pos = spectrum.pos5; - spectrum.end = spectrum.end5; - ); - - // Create the smoothing spectrum.window if necessary - spectrum.windowsize != spectrum.fftsize ? ( - spectrum.windowsize = spectrum.fftsize; - dwindowpos = $pi * 2 / spectrum.fftsize; - i = pwr = 0; - loop(spectrum.fftsize*.5+1, - windowpos = i * dwindowpos; - pwr += (spectrum.window[i] = ( - // 1: hamming - spectrum.windowtype==1 ? 0.53836 - cos(windowpos) * 0.46164 : - // 2: blackman-harris - spectrum.windowtype==2 ? 0.35875 - 0.48829 * cos(windowpos) + 0.14128 * cos(2 * windowpos) - 0.01168 * cos(3 * windowpos) : - // 3: blackman - spectrum.windowtype==3 ? 0.42 - 0.50 * cos(windowpos) + 0.08 * cos(2.0 * windowpos) : - // 4: rectangular - 1.0)); - i += 1; - ); - pwr = 0.5 / (pwr * 2 - spectrum.window[i - 1]); - loop(spectrum.fftsize * 0.5 + 1,spectrum.window[i -= 1] *= pwr); - ); - - // Apply the frequency smoothing spectrum window - buf1=spectrum.pos - spectrum.fftsize; - buf1= spectrum.end ? buf1 = spectrum.samples; - ); - buf2 -= 1; - loop(spectrum.fftsize * 0.5 - 1, - buf3[] = buf1[] * (buf2-=1)[]; - buf3 += 1; - - (buf1 += 1) >= spectrum.end ? buf1 = spectrum.samples; - ); - - fft_real(spectrum.fftworkspace,spectrum.fftsize); - fft_permute(spectrum.fftworkspace,spectrum.fftsize / 2); - spectrum.fftworkspace[1] = 0; - - buf3 = spectrum.fftworkspace; - - memset(spectrum.bin_mag, spectrum.small_mag, spectrum.max_buffer); - - i = 1; - ipnt = 0; - num_bins = 0; - last_bin = -1; - - rate_over_fftsize = srate / spectrum.fftsize; - - loop(spectrum.fftsize * 0.5, - mag = sqr(buf3[i*2+0]) + sqr(buf3[i*2+1]); - - freq = i * rate_over_fftsize; - - bin = floor(32 * log(freq) / log(2)); - - bin != last_bin ? ( - num_bins += 1; - last_bin = bin; - ); - - // Set the dominant frequency for the bin - spectrum.bin_freq[num_bins] = freq; - spectrum.bin_peakfreq[num_bins] = freq; - - // Set the maximum magnitudes for the quantized bin - spectrum.bin_mag[num_bins] = max(mag, spectrum.bin_mag[num_bins]); - spectrum.bin_peakmag[num_bins] = max(mag, spectrum.bin_peakmag[num_bins]); - - i+=1; - ipnt += 1; - ); - - gfx_r = spectrum.red[bufindex]; - gfx_g = spectrum.green[bufindex]; - gfx_b = spectrum.blue[bufindex]; - gfx_a = spectrum.alpha[bufindex]; - - spectrum_fill = spectrum.fill[bufindex]; - - bottom = gfx_h - spectrum.bottom_margin - gfx_texth; - - time = time_precise(); - delta = 0.95 ^ ((time - spectrum.last_time[bufindex]) * 30); - - spectrum.last_time[bufindex] = time; - - ly = 0; - lx = -1; - ipnt = 0; - - loop(num_bins, ( - tx = spectrum.freq_to_x(spectrum.bin_freq[ipnt]); - ty = spectrum.magnitude_to_01(spectrum.bin_mag[ipnt], spectrum.bin_freq[ipnt]); - - // Decay - spectrum.bin_y[ipnt] *= delta; - - spectrum.bin_y[ipnt] = max(ty, spectrum.bin_y[ipnt]); - - ty = spectrum.01_to_y(spectrum.bin_y[ipnt]); - - lx != -1 && tx >= spectrum.left_margin && (ly < bottom-1 || ty < bottom-1) ? - ( - spectrum_fill ? ( - tx0=tx|0; - lx0=lx|0; - ipnt == 2 ? (AAAAA = spectrum.bin_y[ipnt]); - gmem[ipnt + (Fx_Idx+1)*1000]=spectrum.bin_y[ipnt]; - gmem[ipnt+300 + (Fx_Idx+1)*1000] = spectrum.bin_freq[ipnt]; - gfx_x = lx0; - ipnt> 249? ( - gfx_printf("%d",ipnt); - ); - - tx0>lx0? ( - ly < bottom || ty < bottom ? gfx_triangle(lx0,bottom,lx0,ly,tx0-1,ty,tx0-1,bottom); - - ) : ( - tx0 > fill_slast ? ( - fill_slast < bottom ? gfx_line(fill_slast,bottom,fill_slast,fill_slmin); - fill_slmin=bottom; - ) : ( - fill_slmin=min(fill_slmin,ty); - - ); - ); - fill_slast=tx0; - - // Draw a capping line for antialiasing - spectrum.draw_line(lx, ly, tx, ty); - - - ) : ( - (ly < bottom || ty < bottom) && !(ly > bottom - 1 && ty > bottom - 1) ? ( - //Line - spectrum.draw_line(lx, ly, tx, ty); - BBBBB=222; - gmem[ipnt + (Fx_Idx+1)*1000]=spectrum.bin_y[ipnt]; - gmem[ipnt+300 + (Fx_Idx+1)*1000] = spectrum.bin_freq[ipnt]; - - - ); - ); - ); - - lx=tx; ly=ty; - ipnt += 1; - ); - ); - - spectrum.show_peaks ? ( - gfx_r = gfx_g = gfx_b = 0.8; gfx_a = 1; - - lpx = -1; lpy = 0; tpy = 0; tpx = -1; - ipnt = 0; - - loop(num_bins, ( - // Calc max peaks - tpx = spectrum.freq_to_x(spectrum.bin_peakfreq[ipnt]); - tpy = spectrum.magnitude_to_01(spectrum.bin_peakmag[ipnt], spectrum.bin_peakfreq[ipnt]); - tpy = spectrum.01_to_y(tpy); - - tpy = min(bottom, tpy); - - // Draw max peaks - lpx != -1 && (lpy < bottom || tpy < bottom) ? ( - //Line - spectrum.draw_line(lpx, lpy, tpx, tpy); - ); - - lpx=tpx; lpy=tpy; - ipnt += 1; - )); - ); -/* - // Keep this around for reference/debugging. - i = 0; - ipnt = 0; - - buf3=spectrum.fftworkspace; - - gfx_r = 1; gfx_g = 1; gfx_b = 1; gfx_a = 1; - - lx = -1; - - loop(spectrum.fftsize*0.5, - mag = sqr(buf3[i*2+0]) + sqr(buf3[i*2+1]); - freq = (i * srate) / spectrum.fftsize; - - freq = max(1, freq); - - ty = spectrum.magnitude_to_y(mag); - tx = spectrum.freq_to_x(freq); - - lx != -1 ? ( - //Line - gfx_line(lx, ly, tx, ty, 1); - gfx_line(lx+1, ly+1, tx+1, ty+1,1); - ); - lx=tx; ly=ty; - i+=1; - ipnt += 1; - ); -*/ - -/* - // Keep this for reference - cubic curve fitting. - percent = ipnt / (num_samples - 1); - x = (num_bins-1) * percent; - - index = floor(x); - - t = x - floor(x); - - A = spectrum.point_x[max(0,index-1)]; - B = spectrum.point_x[index+0]; - C = spectrum.point_x[min(num_bins-1, index+1)]; - D = spectrum.point_x[min(num_bins-1, index+2)]; - tx = cubic_hermite(A, B, C, D, t); - - A = spectrum.point_y[max(0,index-1)]; - B = spectrum.point_y[index+0]; - C = spectrum.point_y[min(num_bins-1, index+1)]; - D = spectrum.point_y[min(num_bins-1, index+2)]; - ty = cubic_hermite(A, B, C, D, t); -*/ - -); - -/* - * Draw the spectrum bode grid - */ -function spectrum.draw_grid(skip_dblines) local(db, y, f, lx, tx, dotext, frq, width, height) ( - // Draw magnitude axis - gfx_y = -100; - db = spectrum.ceiling; - while( - y = spectrum.db_to_y(db); - - y > gfx_y ? ( - !skip_dblines ? ( - gfx_r=gfx_g=gfx_b=1; gfx_a=0.3; - gfx_line(gfx_texth*2,y,gfx_w,y,0); - ); - gfx_x=0; - gfx_r=gfx_g=gfx_b=0.4; gfx_a=1.0; - gfx_y = y - (gfx_texth * 0.5); - gfx_drawnumber(db,0); - - gfx_y+=gfx_texth; - ); - - db -= 10; - db >= spectrum.noise_floor; - ); - - // Draw frequency axis - f = 10; - gfx_x = 0; - lx = 0; - while( - tx = spectrum.freq_to_x(f); - - dotext = tx > gfx_x && (f==20 || f==50 || f==100 || f == 200 || f == 500 || f == 1000 || f == 2000 || f == 5000 || f == 10000); - gfx_a = dotext ? 0.8 : 0.6; - tx > lx ? ( lx=tx+4; gfx_line(tx,0,tx,gfx_h - (dotext ? 12 : gfx_texth+2) - spectrum.bottom_margin,0); ); - dotext ? ( - gfx_r=gfx_g=gfx_b=0.4; gfx_a=1.0; - - frq = #; - sprintf(frq,"%.1f Hz", read_freq); - f>=1000 ? sprintf(frq,"%dk",f/1000) : sprintf(frq,"%d",f); - - gfx_measurestr(frq, width, height); - - gfx_x = tx - (width*0.5); - - gfx_y = gfx_h-(gfx_texth-2)-spectrum.bottom_margin; - gfx_drawstr(frq); - ); - f += (f<100?10:f<1000?100:f<10000?1000:10000); - - f < spectrum.max_freq; - ); -); - -/* - * Draw a piano octave - * Also returns note frequency if a note was selected with mouse - */ -function draw_octave(anote) - local(a,b,c,d,e,f,g,aSharp,gSharp,fSharp,dSharp,cSharp,aa,gw,hw,sw,w, bx,ax,gx,fx,ex,dx,cx,aax, - cc,csx,cxx, i, note_select) -( - b = anote * pow(2, 2/12); - aSharp = anote * pow(2, 1/12); - a = anote; - gSharp = anote * pow(2, -1/12); - g = anote * pow(2, -2/12); - fSharp = anote * pow(2, -3/12); - f = anote * pow(2, -4/12); - e = anote * pow(2, -5/12); - dSharp = anote * pow(2, -6/12); - d = anote * pow(2, -7/12); - cSharp = anote * pow(2, -8/12); - c = anote * pow(2, -9/12); - - cc = c*2; - - bx = spectrum.freq_to_x(b); - asx = spectrum.freq_to_x(aSharp); - ax = spectrum.freq_to_x(a); - gsx = spectrum.freq_to_x(gSharp); - gx = spectrum.freq_to_x(g); - fsx = spectrum.freq_to_x(fSharp); - fx = spectrum.freq_to_x(f); - ex = spectrum.freq_to_x(e); - dsx = spectrum.freq_to_x(dSharp); - dx = spectrum.freq_to_x(d); - csx = spectrum.freq_to_x(cSharp); - cx = spectrum.freq_to_x(c); - - note_select = 0; - - cxx = spectrum.freq_to_x(cc); - - hw = (bx - ax) * 0.5; - w = dx - cx - 2; - - gfx_r = gfx_g = gfx_b = 1; - gfx_a = 1; - - sw = (cxx - cx) / 7; - - is_hover = 0; - hover_x = -1; - sharp_w = (sw * 0.50); - xp = cx + (sw * 0.75); - - ffw = spectrum.freq_to_x(cSharp) - cx; - - i = 0; - - while( - i != 2 ? ( - mouse_x >= xp && mouse_x <= xp + sharp_w && mouse_y >= spectrum.piano_y && mouse_y <= spectrum.piano_y + 35 ? ( - is_hover = 2; hover_sharp = i; - hover_x = xp; hover_w = sharp_w; hover_h = 35; - ); - ); - xp += sw; - i += 1; - i < 6; - ); - - i = 0; - xp = cx; - loop(7, - is_hover == 0 && mouse_x >= xp && mouse_x <= xp+sw && mouse_y >= spectrum.piano_y && mouse_y <= spectrum.piano_y + 60 ? ( - is_hover = 1; hover_key = i; - hover_x = xp; hover_w = sw-1; hover_h = 60; - ); - - gfx_rect(xp, spectrum.piano_y, sw-1, 60); - - i += 1; - xp += sw; - ); - - is_hover == 1 ? ( - gfx_r = 0.7; gfx_b = 0.7; gfx_g = 0.7; gfx_a = 1; - gfx_rect(hover_x, spectrum.piano_y, hover_w, hover_h); - ); - - gfx_r = gfx_g = gfx_b = 0; - - xp = cx + (sw * 0.75); - - i = 0; - - loop(6, - i != 2 ? ( - gfx_rect(xp, spectrum.piano_y, sw*0.50, 35); - ); - i += 1; - xp += sw; - ); - - is_hover == 2 ? ( - gfx_r = 0.7; gfx_b = 0.7; gfx_g = 0.7; gfx_a = 1; - gfx_rect(hover_x, spectrum.piano_y, hover_w, hover_h); - ); - - is_hover ? ( - is_hover == 1 ? ( - hover_key == 0 ? (frq = c; sw = csx - cx;); - hover_key == 1 ? (frq = d; sw = dsx - dx;); - hover_key == 2 ? (frq = e; sw = fx - ex;); - hover_key == 3 ? (frq = f; sw = fsx - fx;); - hover_key == 4 ? (frq = g; sw = gsx - gx;); - hover_key == 5 ? (frq = a; sw = asx - ax;); - hover_key == 6 ? (frq = b; sw = cxx - bx;); - - xp = spectrum.freq_to_x(frq); - note_select = frq; - - gfx_r = 1; gfx_g = 0.8; gfx_b = 0.8; gfx_a = 0.3; - gfx_rect(xp, spectrum.piano_y + 65, sw, gfx_h - spectrum.bottom_margin - (spectrum.piano_y + 65)); - ) : ( - hover_sharp == 0 ? (frq = cSharp; sw = dx - csx;); - hover_sharp == 1 ? (frq = dSharp; sw = ex - dsx;); - hover_sharp == 3 ? (frq = fSharp; sw = gx - fsx;); - hover_sharp == 4 ? (frq = gSharp; sw = ax - gsx;); - hover_sharp == 5 ? (frq = aSharp; sw = bx - asx;); - - xp = spectrum.freq_to_x(frq); - note_select = frq; - - gfx_r = 1; gfx_g = 0.8; gfx_b = 0.8; gfx_a = 0.3; - gfx_rect(xp, spectrum.piano_y + 65, sw, gfx_h - spectrum.bottom_margin - (spectrum.piano_y + 65)); - ); - ); - - note_select; -); - -/* - * Draw the piano keys (all octaves) - */ -function spectrum.draw_piano() local(A4, note_select) ( - - gfx_r = gfx_g = gfx_b = 1; gfx_a = 1; - - A4 = 440; - - note_select = 0; - note_select = max(draw_octave(A4 * pow(2, -5)), note_select); - note_select = max(draw_octave(A4 * pow(2, -4)), note_select); - note_select = max(draw_octave(A4 * pow(2, -3)), note_select); - note_select = max(draw_octave(A4 * pow(2, -2)), note_select); - note_select = max(draw_octave(A4 * pow(2, -1)), note_select); - note_select = max(draw_octave(A4 * pow(2, 0)), note_select); - note_select = max(draw_octave(A4 * pow(2, 1)), note_select); - note_select = max(draw_octave(A4 * pow(2, 2)), note_select); - note_select = max(draw_octave(A4 * pow(2, 3)), note_select); - note_select = max(draw_octave(A4 * pow(2, 4)), note_select); - note_select = max(draw_octave(A4 * pow(2, 5)), note_select); - note_select = max(draw_octave(A4 * pow(2, 6)), note_select); - - note_select; -); diff --git a/FX/BryanChi_FX Devices/svf_filter.jsfx-inc b/FX/BryanChi_FX Devices/svf_filter.jsfx-inc deleted file mode 100644 index 82ccd1dd7..000000000 --- a/FX/BryanChi_FX Devices/svf_filter.jsfx-inc +++ /dev/null @@ -1,1228 +0,0 @@ -desc: State Variable Filter -/* - SVF - State Variable Filter - - SVF filter math taken from Andy Simper's (Cytomic) SVF paper. - - https://cytomic.com/files/dsp/SvfLinearTrapOptimised2.pdf - - Supports a variety of filter types. The filter math produces - high quality filtering with stability. It holds up under rapid - automation. - - I've extended by including smooth interpolation to avoid zipper - effects when automating, low and high pass cascading up to 96dB - slopes in increments of 6dB and Butterworth modes for low and - high pass. -*/ - -@init - -SAMPLE_RATE = srate; -ONE_OVER_SAMPLE_RATE = 1.0 / srate; - -SMOOTHING_TIME_MS = 30; - -/* - * Check if all our interpolating coefficients at rest - */ -function svf_is_resting() local(resting) instance(onepole) -( - resting = this.iter_t == 1.0; - nlp > 2 ? ( - resting |= cas1.iter_t == 1.0; - nlp > 4 ? ( - resting |= cas2.iter_t == 1.0; - nlp > 6 ? ( - resting |= cas3.iter_t == 1.0; - nlp > 8 ? ( - resting |= cas4.iter_t == 1.0; - nlp > 10 ? ( - resting |= cas5.iter_t == 1.0; - nlp > 12 ? ( - resting |= cas6.iter_t == 1.0; - nlp > 14 ? ( - resting |= cas7.iter_t == 1.0; - nlp > 16 ? ( - resting |= cas8.iter_t == 1.0; - nlp > 18 ? ( - resting |= cas9.iter_t == 1.0; - ); - ); - ); - ); - ); - ); - ); - ); - ); - // Iterations are done or filter is onepole (no interpolation yet so always resting) - resting || onepole; -); - -/* - * Set the sample rate. Adjusts the low pass interpolators - */ -function svf_set_sample_rate_single(rate) - instance(iter_step) -( - SAMPLE_RATE = rate; - ONE_OVER_SAMPLE_RATE = 1.0 / rate; - - // Assumption: using 'srate' here on the basis that we'll - // only call tick() once per @sample - iter_step = 1.0 / (SMOOTHING_TIME_MS * 0.001 * srate); -); - -/* - * Set the sample rate for all filters - */ -function svf_set_sample_rate(rate) - instance(cas1, cas2, cas3, cas4, cas5, cas6, cas7, cas8, cas9) -( - this.svf_set_sample_rate_single(rate); //12 - cas1.svf_set_sample_rate_single(rate); //24 - cas2.svf_set_sample_rate_single(rate); //36 - cas3.svf_set_sample_rate_single(rate); //48 - cas4.svf_set_sample_rate_single(rate); //60 - cas5.svf_set_sample_rate_single(rate); //72 - cas6.svf_set_sample_rate_single(rate); //84 - cas7.svf_set_sample_rate_single(rate); //96 - cas8.svf_set_sample_rate_single(rate); //108 - cas9.svf_set_sample_rate_single(rate); //120 -); - -/* - * Set the target values for coefficient interpolation - */ -function svf_set_coeffs(tg, tk, ta1, ta2, ta3, tm0, tm1, tm2) - instance(g, k, a1, a2, a3, m0, m1, m2, t_g, t_k, t_a1, t_a2, t_a3, t_m0, t_m1, t_m2, s_g, s_k, s_a1, s_a2, s_a3, s_m0, s_m1, s_m2, iter_t) -( - iter_t = 0.0; - - // Start coefficients - s_g = g; - s_k = k; - s_a1 = a1; - s_a2 = a2; - s_a3 = a3; - s_m0 = m0; - s_m1 = m1; - s_m2 = m2; - - // Target coefficients - t_g = tg; - t_k = tk; - t_a1 = ta1; - t_a2 = ta2; - t_a3 = ta3; - t_m0 = tm0; - t_m1 = tm1; - t_m2 = tm2; -); - -/* - * Interpolate coefficients - */ -function svf_single_interpolate() - instance (g, k, a1, a2, a3, m0, m1, m2, t_g, t_k, t_a1, t_a2, t_a3, t_m0, t_m1, t_m2, s_g, s_k, s_a1, s_a2, s_a3, s_m0, s_m1, s_m2, iter_step, iter_t) -( - iter_t < 1.0 ? ( - g = s_g + iter_t * (t_g - s_g); - k = s_k + iter_t * (t_k - s_k); - a1 = s_a1 + iter_t * (t_a1 - s_a1); - a2 = s_a2 + iter_t * (t_a2 - s_a2); - a3 = s_a3 + iter_t * (t_a3 - s_a3); - m0 = s_m0 + iter_t * (t_m0 - s_m0); - m1 = s_m1 + iter_t * (t_m1 - s_m1); - m2 = s_m2 + iter_t * (t_m2 - s_m2); - iter_t = min(1.0, iter_t + iter_step); - ) : ( - g = t_g; - k = t_k; - a1 = t_a1; - a2 = t_a2; - a3 = t_a3; - m0 = t_m0; - m1 = t_m1; - m2 = t_m2; - ); -); - -/* - * Set the coefficients to the target and stop iterating - */ -function svf_single_set_to_target() - instance (g, k, a1, a2, a3, m0, m1, m2, t_g, t_k, t_a1, t_a2, t_a3, t_m0, t_m1, t_m2, iter_t) -( - iter_t = 1.0; - g = t_g; - k = t_k; - a1 = t_a1; - a2 = t_a2; - a3 = t_a3; - m0 = t_m0; - m1 = t_m1; - m2 = t_m2; -); - -/* - * Filter tick - * Hande interpolation. - */ -function svf_set_to_target() - instance (nlp, onepole, cas1, cas2, cas3, cas4, cas5, cas6, cas7, cas8, cas9) -( - nlp > 0 ? this.svf_single_set_to_target(); - nlp > 2 ? cas1.svf_single_set_to_target(); - nlp > 4 ? cas2.svf_single_set_to_target(); - nlp > 6 ? cas3.svf_single_set_to_target(); - nlp > 8 ? cas4.svf_single_set_to_target(); - nlp > 10 ? cas5.svf_single_set_to_target(); - nlp > 12 ? cas6.svf_single_set_to_target(); - nlp > 14 ? cas7.svf_single_set_to_target(); - nlp > 16 ? cas8.svf_single_set_to_target(); - nlp > 18 ? cas9.svf_single_set_to_target(); - - // TODO: need to interpolate one pole filter coefficients too!! -); - -/* - * Filter tick - * Hande interpolation. - */ -function svf_tick() - instance (nlp, onepole, cas1, cas2, cas3, cas4, cas5, cas6, cas7, cas8, cas9) -( - nlp > 0 ? this.svf_single_interpolate(); - nlp > 2 ? cas1.svf_single_interpolate(); - nlp > 4 ? cas2.svf_single_interpolate(); - nlp > 6 ? cas3.svf_single_interpolate(); - nlp > 8 ? cas4.svf_single_interpolate(); - nlp > 10 ? cas5.svf_single_interpolate(); - nlp > 12 ? cas6.svf_single_interpolate(); - nlp > 14 ? cas7.svf_single_interpolate(); - nlp > 16 ? cas8.svf_single_interpolate(); - nlp > 18 ? cas9.svf_single_interpolate(); - - // TODO: need to interpolate one pole filter coefficients too!! -); - -/* - * Bandwidth to Q - */ -function svf_bwtoq(bw) - local(x) -( - // q = 1/(2 * sinh(log(2) / 2 * bw)) - x = exp(0.5*log(2) * bw); - 1/(x - 1/x); -); - -/* - * Q to bandwidth - */ -function svf_qtobw(q) - local(x) -( - // bw = 2 * asinh(1/(2 * q)) / log(2) - x = 0.5 / q; - 2/log(2) * log(x + sqrt(sqr(x) + 1)); -); - -/* - * Compute butterworth maximal flat Q's for cascading filters - * Q's set so that the drop at cutoff is always by 3db - */ -function update_splane(slope) - instance(q0, q1, q2, q3, q4, q5, q6, q7, q8, q9) - local(onepole, order, poleInc, firstAngle) -( - order = slope + 1; - // pairs = order >> 1; - onepole = order & 1; - poleInc = $pi / order; - - // firstAngle = poleInc / 2; - firstAngle = poleInc; - - !onepole ? firstAngle /= 2; - - q0 = 1.0 / (2.0 * cos(firstAngle + 0 * poleInc)); - q1 = 1.0 / (2.0 * cos(firstAngle + 1 * poleInc)); - q2 = 1.0 / (2.0 * cos(firstAngle + 2 * poleInc)); - q3 = 1.0 / (2.0 * cos(firstAngle + 3 * poleInc)); - q4 = 1.0 / (2.0 * cos(firstAngle + 4 * poleInc)); - q5 = 1.0 / (2.0 * cos(firstAngle + 5 * poleInc)); - q6 = 1.0 / (2.0 * cos(firstAngle + 6 * poleInc)); - q7 = 1.0 / (2.0 * cos(firstAngle + 7 * poleInc)); - q8 = 1.0 / (2.0 * cos(firstAngle + 8 * poleInc)); - q9 = 1.0 / (2.0 * cos(firstAngle + 9 * poleInc)); -); - -/* - * Initialise one pole (6dB) filter - * 'passtype' is 0 for low pass filter, 1 for high pass filter - */ -function svf_onepole(mode, cutoff) instance(Acc, B0, B1, A1, Z0, Z1, passtype) local (W, N) ( - passtype = mode; - passtype == 0 ? ( - // Low pass - W = tan($pi * cutoff * ONE_OVER_SAMPLE_RATE); - N = 1/(1+W); - B0 = W * N; - B1 = B0; - A1 = N * (W-1); - ) : ( - // High pass - W = tan($pi * cutoff * ONE_OVER_SAMPLE_RATE); - N = 1/(1+W); - B0 = N; - B1 = -B0; - A1 = N * (W-1); - ); -); - -/* - * Apply one pole (6dB) filter - */ -function svf_onepole_do(in) instance(Acc, B0, B1, A1, Z0, Z1) ( - Acc = in*B0 + Z0*B1 - Z1*A1; - Z1 = Acc; - Z0 = in; - Acc; -); - -/* - * Set low pass filter for single cascade step - */ -function svf_single_lp(freq, q) - instance(cutoff, op0, op1) - local(g, k, a1, a2, a3, m0, m1, m2) -( - g = tan($pi * freq/SAMPLE_RATE); - k = 1.0 / q; - a1 = 1.0 / (1.0 + g * (g + k)); - a2 = g * a1; - a3 = g * a2; - m0 = 0; - m1 = 0; - m2 = 1; - this.svf_set_coeffs(g, k, a1, a2, a3, m0, m1, m2); - - cutoff = freq; - - op0.svf_onepole(0, cutoff); - op1.svf_onepole(0, cutoff); -); - -/* - * Set low pass filter - */ -function svf_lp(freq, q, slope) - instance(nlp, cas1, cas2, cas3, cas4, cas5, cas6, cas7, cas8, cas9, onepole) -( - nlp = slope; - onepole = (slope+1) & 1; - - this.svf_single_lp(freq, q); - cas1.svf_single_lp(freq, q); - cas2.svf_single_lp(freq, q); - cas3.svf_single_lp(freq, q); - cas4.svf_single_lp(freq, q); - cas5.svf_single_lp(freq, q); - cas6.svf_single_lp(freq, q); - cas7.svf_single_lp(freq, q); - cas8.svf_single_lp(freq, q); - cas9.svf_single_lp(freq, q); -); - -/* - * Set low pass butterworth filter - */ -function svf_lpb(freq, slope) - instance(nlp, onepole, cas1, cas2, cas3, cas4, cas5, cas6, cas7, cas8, cas9, q0, q1, q2, q3, q4, q5, q6, q7, q8, q9) -( - nlp = slope; - onepole = (slope+1) & 1; - - this.update_splane(nlp); - - this.svf_single_lp(freq, q0); - cas1.svf_single_lp(freq, q1); - cas2.svf_single_lp(freq, q2); - cas3.svf_single_lp(freq, q3); - cas4.svf_single_lp(freq, q4); - cas5.svf_single_lp(freq, q5); - cas6.svf_single_lp(freq, q6); - cas7.svf_single_lp(freq, q7); - cas8.svf_single_lp(freq, q8); - cas9.svf_single_lp(freq, q9); -); - -/* - * Set high pass filter for single cascade step - */ -function svf_single_hp(freq, q) - instance(cutoff, op0, op1) - local(g, k, a1, a2, a3, m0, m1, m2) -( - g = tan($pi * freq/SAMPLE_RATE); - k = 1.0 / q; - a1 = 1.0 / (1.0 + g * (g + k)); - a2 = g * a1; - a3 = g * a2; - m0 = 1.0; - m1 = -k; - m2 = -1.0; - this.svf_set_coeffs(g, k, a1, a2, a3, m0, m1, m2); - - cutoff = freq; - - op0.svf_onepole(1, cutoff); - op1.svf_onepole(1, cutoff); -); - -/* - * Set high pass filter - */ -function svf_hp(freq, q, slope) - instance(nlp, onepole, cas1, cas2, cas3, cas4, cas5, cas6, cas7, cas8, cas9) -( - nlp = slope; - onepole = (slope+1) & 1; - - this.svf_single_hp(freq, q); - cas1.svf_single_hp(freq, q); - cas2.svf_single_hp(freq, q); - cas3.svf_single_hp(freq, q); - cas4.svf_single_hp(freq, q); - cas5.svf_single_hp(freq, q); - cas6.svf_single_hp(freq, q); - cas7.svf_single_hp(freq, q); - cas8.svf_single_hp(freq, q); - cas9.svf_single_hp(freq, q); -); - -/* - * Set high pass butterworth filter - */ -function svf_hpb(freq, slope) - instance(nlp, onepole, cas1, cas2, cas3, cas4, cas5, cas6, cas7, cas8, cas9, q0, q1, q2, q3, q4, q5, q6, q7, q8, q9) -( - nlp = slope; - onepole = (slope+1) & 1; - - this.update_splane(nlp); - - this.svf_single_hp(freq, q0); - cas1.svf_single_hp(freq, q1); - cas2.svf_single_hp(freq, q2); - cas3.svf_single_hp(freq, q3); - cas4.svf_single_hp(freq, q4); - cas5.svf_single_hp(freq, q5); - cas6.svf_single_hp(freq, q6); - cas7.svf_single_hp(freq, q7); - cas8.svf_single_hp(freq, q8); - cas9.svf_single_hp(freq, q9); -); - -/* - * Band-pass (constant skirt gain, peak gain = Q) - */ -function _svf_bp(freq, q) - local(g, k, a1, a2, a3, m0, m1, m2) -( - g = tan($pi * freq/SAMPLE_RATE); - k = 1.0 / q; - a1 = 1.0 / (1.0 + g * (g + k)); - a2 = g * a1; - a3 = g * a2; - m0 = 0; - m1 = 1; - m2 = 0; - this.svf_set_coeffs(g, k, a1, a2, a2, m0, m1, m2); -); - -function svf_bp(freq, q) - instance(nlp, onepole) -( - nlp = 1; - onepole = 0; - this._svf_bp(freq, q); -); - -/* - * Band-pass (constant 0 dB peak gain) - */ -function _svf_bp2(freq, q) - local(g, k, a1, a2, a3, m0, m1, m2) -( - g = tan($pi * freq/SAMPLE_RATE); - k = 1.0 / q; - a1 = 1.0 / (1.0 + g * (g + k)); - a2 = g * a1; - a3 = g * a2; - m0 = 0; - m1 = 1/q; - m2 = 0; - this.svf_set_coeffs(g, k, a1, a2, a3, m0, m1, m2); -); - -function svf_bp2(freq, q) - instance(nlp, onepole) -( - nlp = 1; - onepole = 0; - this._svf_bp2(freq, q); -); - -/* - * Band-stop (Notch) - */ -function _svf_bs(freq, q) - local(g, k, a1, a2, a3, m0, m1, m2) -( - g = tan($pi * freq/SAMPLE_RATE); - k = 1.0 / q; - a1 = 1.0 / (1.0 + g * (g + k)); - a2 = g * a1; - a3 = g * a2; - m0 = 1; - m1 = -k; - m2 = 0; - this.svf_set_coeffs(g, k, a1, a2, a3, m0, m1, m2); -); - -function svf_bs(freq, q) - instance(nlp, onepole) -( - nlp = 1; - onepole = 0; - this._svf_bs(freq, q); -); - -/* - * All pass - */ -function _svf_ap(freq, q) - local(g, k, a1, a2, a3, m0, m1, m2) -( - g = tan($pi * freq/SAMPLE_RATE); - k = 1.0 / q; - a1 = 1.0 / (1.0 + g * (g + k)); - a2 = g * a1; - a3 = g * a2; - m0 = 1; - m1 = -2*k; - m2 = 0; - this.svf_set_coeffs(g, k, a1, a2, a3, m0, m1, m2); -); - -function svf_ap(freq, q) - instance(nlp, onepole) -( - nlp = 1; - onepole = 0; - this._svf_ap(freq, q); -); - -/* - * Peaking EQ (Bell) - */ -function _svf_eq(freq, q, gain) - local(A, a1, a2, a3, m0, m1, m2, g, k) -( - A = gain; //10.0 ^ (gain / 20.0); - g = tan($pi * freq/SAMPLE_RATE); - k = 1.0 / (q * A); - a1 = 1.0 / (1.0 + g * (g + k)); - a2 = g * a1; - a3 = g * a2; - m0 = 1; - m1 = k*(A*A-1); - m2 = 0; - this.svf_set_coeffs(g, k, a1, a2, a3, m0, m1, m2); -); - -function svf_eq(freq, q, gain) - instance(nlp, onepole) -( - nlp = 1; - onepole = 0; - this._svf_eq(freq, q, gain); -); - -/* - * Low Shelf - */ -function _svf_ls(freq, q, gain) - local(A, g, k, a1, a2, a3, m0, m1, m2) -( - A = gain; //10 ^ (gain / 40.0); - g = tan($pi * freq/SAMPLE_RATE) / sqrt(A); - k = 1.0 / q; - a1 = 1.0 / (1.0 + g * (g + k)); - a2 = g * a1; - a3 = g * a2; - m0 = 1; - m1 = k*(A - 1); - m2 = (A * A - 1); - this.svf_set_coeffs(g, k, a1, a2, a3, m0, m1, m2); -); - -function svf_ls(freq, q, gain) - instance(nlp, onepole) -( - nlp = 1; - onepole = 0; - this._svf_ls(freq, q, gain); -); - -/* - * High shelf - */ -function _svf_hs(freq, q, gain) - local(A, g, k, a1, a2, a3, m0, m1, m2) -( - A = gain; //10 ^ (gain / 40.0); - g = tan($pi * freq/SAMPLE_RATE) * sqrt(A); - k = 1.0 / q; - a1 = 1.0 / (1.0 + g * (g + k)); - a2 = g * a1; - a3 = g * a2; - m0 = A * A; - m1 = k * (1 - A) * A; - m2 = (1 - A * A); - this.svf_set_coeffs(g, k, a1, a2, a3, m0, m1, m2); -); - -function svf_hs(freq, q, gain) - instance(nlp, onepole) -( - nlp = 1; - onepole = 0; - this._svf_hs(freq, q, gain); -); - -/* - * Set shelf tilt filter - * (A cunning combination of high and low shelf with opposite gains) - */ -function svf_st(freq, q, gain) - instance(nlp, onepole, cas1, cas2, cas3, cas4, cas5, cas6, cas7, cas8, cas9, gain2) -( - nlp = 3; - onepole = 0; - gain2 = 10^(-gain / 40); - gain = 10^(gain / 40); - this._svf_hs(freq, q, gain); - cas1._svf_ls(freq, q, gain2); -); - -/* - * Pultec boost and cut - */ -function svf_pultecls(freq, q, gain) - instance(nlp, onepole, cas1, cas2, cas3, cas4, cas5, cas6, cas7, cas8, cas9, onepole, gain2, amm, freq) -( - freq *= 1.5; // Puts the frequency in a better place for adjustments - amm = gain; - amm > 10 ? amm = 10; - amm < 0 ? amm = 0; - amm = (amm) / 10; - - gain2 = (q / 40) * 10; - gain2 = gain2 * amm; - - gain2 = 10^(-(gain2) / 40); - gain = 10^(gain / 40); - - this._svf_ls(freq, 0.701, gain); - cas1.svf_eq(freq, 0.701, gain2); // Cut!! Make Q affect depth of this gain - nlp = 3; - onepole = 0; -); - -function db_to_gain(db) ( - 10^(db / 40); -); - -/* - * Low cut analog (low cut and shelf) - */ -function svf_analog_lowcut(freq, q, gain) - instance(nlp, onepole, cas1, cas2, cas3, cas4, cas5, cas6, cas7, cas8, cas9, gain2, amm, freq, op0, op1, cutoff) -( - gain = 10^(gain / 40); - - // Low shelf - // 1.25 so, 80Hz for high pass is 80Hz for low shelf - this.svf_ls(freq * 1.25, 0.701, gain); - - // High pass onepole - cutoff = freq; - op0.svf_onepole(1, cutoff); - op1.svf_onepole(1, cutoff); - - nlp = 1; - onepole = 1; -); - -/* - * High cut analog (high cut and shelf) - */ -function svf_analog_highcut(freq, q, gain) - local(gg) - instance(nlp, onepole, cas1, cas2, cas3, cas4, cas5, cas6, cas7, cas8, cas9, gain2, amm, freq, op0, op1, cutoff) -( - gg = gain; - gain = 10^(gain / 40); - - // High shelf - this.svf_hs(freq, 0.701, gain); - - // Low pass onepole - // The low pass 12dB filter starts off higher than the high shelf and gets - // closer to the node frequency with decreased negative gain. - gg > 0 ? cutoff = 22000 : ( - cutoff = freq * 4.25; - - gg < -12 ? gg = -12; - t = 1 - (-gg / 12); - - cutoff = freq + ((cutoff - freq) * t); - ); - - - // Clamp to a high safe frequency - cutoff > 22040 ? cutoff = 22040; - - cas1.svf_single_lp(cutoff, 0.701); - - nlp = 3; - onepole = 0; - // jj -); - - -function db_to_gain(db) ( - 10^(db / 40); -); - - -/* - * Listen filter for peak/bell eq - */ -function svf_listen_eq(leftfreq, rightfreq, bellfreq, bellq, bellgain) - instance(nlp, onepole, cas1, cas2, cas3, cas4, cas5, cas6, cas7, cas8, cas9, q0, q1) -( - leftfreq = max(leftfreq, 10); - bellfreq = min(max(bellfreq, 10), 20000); - rightfreq = min(rightfreq, 20000); - - // Butterworth 24db for the sides - this.update_splane(3); - - // The main bell filter that we're listening too - this._svf_eq(bellfreq, bellq, bellgain); - - cas1.svf_single_hp(leftfreq, q0); - cas2.svf_single_hp(leftfreq, q1); - - cas3.svf_single_lp(rightfreq, q0); - cas4.svf_single_lp(rightfreq, q1); - - nlp = 9; - onepole = 0; -); - -/* - * Listen filter for notch - */ -function svf_listen_bs(leftfreq, rightfreq, bellfreq, bellq) - instance(nlp, onepole, cas1, cas2, cas3, cas4, cas5, cas6, cas7, cas8, cas9, q0, q1) -( - leftfreq = max(leftfreq, 10); - bellfreq = min(max(bellfreq, 10), 44000); - rightfreq = min(rightfreq, 44000); - - // Butterworth 24db for the sides - this.update_splane(3); - - // The main bell filter that we're listening too - this._svf_bs(bellfreq, bellq); - - cas1.svf_single_hp(leftfreq, q0); - cas2.svf_single_hp(leftfreq, q1); - - cas3.svf_single_lp(rightfreq, q0); - cas4.svf_single_lp(rightfreq, q1); - - nlp = 9; - onepole = 0; -); - -/* - * Bypass - */ -function svf_bypass() - instance(nlp, onepole, cas1, cas2, cas3, cas4, cas5, cas6, cas7, cas8, cas9) -( - nlp < 1 ? nlp = 1; - onepole = 0; - - this.svf_set_coeffs(0, 0, 0, 0, 0, 1, 0, 0); - cas1.svf_set_coeffs(0, 0, 1, 0, 0, 1, 0, 0); - cas2.svf_set_coeffs(0, 0, 1, 0, 0, 1, 0, 0); - cas3.svf_set_coeffs(0, 0, 1, 0, 0, 1, 0, 0); - cas4.svf_set_coeffs(0, 0, 1, 0, 0, 1, 0, 0); - cas5.svf_set_coeffs(0, 0, 1, 0, 0, 1, 0, 0); - cas6.svf_set_coeffs(0, 0, 1, 0, 0, 1, 0, 0); - cas7.svf_set_coeffs(0, 0, 1, 0, 0, 1, 0, 0); - cas8.svf_set_coeffs(0, 0, 1, 0, 0, 1, 0, 0); - cas9.svf_set_coeffs(0, 0, 1, 0, 0, 1, 0, 0); -); - -/* - * Mute - */ -function svf_mute() - instance(nlp, onepole, cas1, cas2, cas3, cas4, cas5, cas6, cas7, cas8, cas9) -( - nlp < 1 ? nlp = 1; - onepole = 0; - - this.svf_set_coeffs(0, 0, 0, 0, 0, 0, 0, 0); - cas1.svf_set_coeffs(0, 0, 0, 0, 0, 0, 0, 0); - cas2.svf_set_coeffs(0, 0, 0, 0, 0, 0, 0, 0); - cas3.svf_set_coeffs(0, 0, 0, 0, 0, 0, 0, 0); - cas4.svf_set_coeffs(0, 0, 0, 0, 0, 0, 0, 0); - cas5.svf_set_coeffs(0, 0, 0, 0, 0, 0, 0, 0); - cas6.svf_set_coeffs(0, 0, 0, 0, 0, 0, 0, 0); - cas7.svf_set_coeffs(0, 0, 0, 0, 0, 0, 0, 0); - cas8.svf_set_coeffs(0, 0, 0, 0, 0, 0, 0, 0); - cas9.svf_set_coeffs(0, 0, 0, 0, 0, 0, 0, 0); -); - -/* - * Apply full cascade filter to sample v0 for channel 0 - * Returns an appropriate linear combination of the 3 outputs [lowpass, - * bandpass, highpass] of the core SVF in order to achieve various filter - * modes. - */ -function svf_svf0(v0) - instance(ic1eq0, ic2eq0, a1, a2, a3, m0, m1, m2, nlp, cas1, cas2, cas3, cas4, cas5, cas6, cas7, cas8, cas9, onepole, cutoff, op0, op1) - local(v1, v2, v3) -( - nlp > 0 ? ( - - v3 = v0 - ic2eq0; - v1 = a1 * ic1eq0 + a2 * v3; - v2 = ic2eq0 + a2 * ic1eq0 + a3 * v3; - - ic1eq0 = 2 * v1 - ic1eq0; - ic2eq0 = 2 * v2 - ic2eq0; - - v0 = m0 * v0 + m1 * v1 + m2 * v2; - - nlp > 2 ? ( - v3 = v0 - cas1.ic2eq0; - v1 = cas1.a1 * cas1.ic1eq0 + cas1.a2 * v3; - v2 = cas1.ic2eq0 + cas1.a2 * cas1.ic1eq0 + cas1.a3 * v3; - - cas1.ic1eq0 = 2 * v1 - cas1.ic1eq0; - cas1.ic2eq0 = 2 * v2 - cas1.ic2eq0; - - v0 = cas1.m0 * v0 + cas1.m1 * v1 + cas1.m2 * v2; - - nlp > 4 ? ( - v3 = v0 - cas2.ic2eq0; - v1 = cas2.a1 * cas2.ic1eq0 + cas2.a2 * v3; - v2 = cas2.ic2eq0 + cas2.a2 * cas2.ic1eq0 + cas2.a3 * v3; - - cas2.ic1eq0 = 2 * v1 - cas2.ic1eq0; - cas2.ic2eq0 = 2 * v2 - cas2.ic2eq0; - - v0 = cas2.m0 * v0 + cas2.m1 * v1 + cas2.m2 * v2; - - nlp > 6 ? ( - v3 = v0 - cas3.ic2eq0; - v1 = cas3.a1 * cas3.ic1eq0 + cas3.a2 * v3; - v2 = cas3.ic2eq0 + cas3.a2 * cas3.ic1eq0 + cas3.a3 * v3; - - cas3.ic1eq0 = 2 * v1 - cas3.ic1eq0; - cas3.ic2eq0 = 2 * v2 - cas3.ic2eq0; - - v0 = cas3.m0 * v0 + cas3.m1 * v1 + cas3.m2 * v2; - - nlp > 8 ? ( - v3 = v0 - cas4.ic2eq0; - v1 = cas4.a1 * cas4.ic1eq0 + cas4.a2 * v3; - v2 = cas4.ic2eq0 + cas4.a2 * cas4.ic1eq0 + cas4.a3 * v3; - - cas4.ic1eq0 = 2 * v1 - cas4.ic1eq0; - cas4.ic2eq0 = 2 * v2 - cas4.ic2eq0; - - v0 = cas4.m0 * v0 + cas4.m1 * v1 + cas4.m2 * v2; - - nlp > 10 ? ( - v3 = v0 - cas5.ic2eq0; - v1 = cas5.a1 * cas5.ic1eq0 + cas5.a2 * v3; - v2 = cas5.ic2eq0 + cas5.a2 * cas5.ic1eq0 + cas5.a3 * v3; - - cas5.ic1eq0 = 2 * v1 - cas5.ic1eq0; - cas5.ic2eq0 = 2 * v2 - cas5.ic2eq0; - - v0 = cas5.m0 * v0 + cas5.m1 * v1 + cas5.m2 * v2; - - nlp > 12 ? ( - v3 = v0 - cas6.ic2eq0; - v1 = cas6.a1 * cas6.ic1eq0 + cas6.a2 * v3; - v2 = cas6.ic2eq0 + cas6.a2 * cas6.ic1eq0 + cas6.a3 * v3; - - cas6.ic1eq0 = 2 * v1 - cas6.ic1eq0; - cas6.ic2eq0 = 2 * v2 - cas6.ic2eq0; - - v0 = cas6.m0 * v0 + cas6.m1 * v1 + cas6.m2 * v2; - - nlp > 14 ? ( - v3 = v0 - cas7.ic2eq0; - v1 = cas7.a1 * cas7.ic1eq0 + cas7.a2 * v3; - v2 = cas7.ic2eq0 + cas7.a2 * cas7.ic1eq0 + cas7.a3 * v3; - - cas7.ic1eq0 = 2 * v1 - cas7.ic1eq0; - cas7.ic2eq0 = 2 * v2 - cas7.ic2eq0; - - v0 = cas7.m0 * v0 + cas7.m1 * v1 + cas7.m2 * v2; - - nlp > 16 ? ( - v3 = v0 - cas8.ic2eq0; - v1 = cas8.a1 * cas8.ic1eq0 + cas8.a2 * v3; - v2 = cas8.ic2eq0 + cas8.a2 * cas8.ic1eq0 + cas8.a3 * v3; - - cas8.ic1eq0 = 2 * v1 - cas8.ic1eq0; - cas8.ic2eq0 = 2 * v2 - cas8.ic2eq0; - - v0 = cas8.m0 * v0 + cas8.m1 * v1 + cas8.m2 * v2; - - nlp > 18 ? ( - v3 = v0 - cas9.ic2eq0; - v1 = cas9.a1 * cas9.ic1eq0 + cas9.a2 * v3; - v2 = cas9.ic2eq0 + cas9.a2 * cas9.ic1eq0 + cas9.a3 * v3; - - cas9.ic1eq0 = 2 * v1 - cas9.ic1eq0; - cas9.ic2eq0 = 2 * v2 - cas9.ic2eq0; - - v0 = cas9.m0 * v0 + cas9.m1 * v1 + cas9.m2 * v2; - ); - ); - ); - ); - ); - ); - ); - ); - ); - ); - - onepole ? ( - v0 = op0.svf_onepole_do(v0); - ); - - v0; -); - -/* - * Apply full cascade filter to sample v0 for channel 1 - * Returns an appropriate linear combination of the 3 outputs [lowpass, - * bandpass, highpass] of the core SVF in order to achieve various filter - * modes. - */ -function svf_svf1(v0) - instance(ic1eq1, ic2eq1, a1, a2, a3, m0, m1, m2, nlp, cas1, cas2, cas3, cas4, cas5, cas6, cas7, cas8, cas9, onepole, op0, op1) - local(v1, v2, v3) -( - nlp > 0 ? ( - v3 = v0 - ic2eq1; - v1 = a1 * ic1eq1 + a2 * v3; - v2 = ic2eq1 + a2 * ic1eq1 + a3 * v3; - - ic1eq1 = 2 * v1 - ic1eq1; - ic2eq1 = 2 * v2 - ic2eq1; - - v0 = m0 * v0 + m1 * v1 + m2 * v2; - - nlp > 2 ? ( - v3 = v0 - cas1.ic2eq1; - v1 = cas1.a1 * cas1.ic1eq1 + cas1.a2 * v3; - v2 = cas1.ic2eq1 + cas1.a2 * cas1.ic1eq1 + cas1.a3 * v3; - - cas1.ic1eq1 = 2 * v1 - cas1.ic1eq1; - cas1.ic2eq1 = 2 * v2 - cas1.ic2eq1; - - v0 = cas1.m0 * v0 + cas1.m1 * v1 + cas1.m2 * v2; - - nlp > 4 ? ( - v3 = v0 - cas2.ic2eq1; - v1 = cas2.a1 * cas2.ic1eq1 + cas2.a2 * v3; - v2 = cas2.ic2eq1 + cas2.a2 * cas2.ic1eq1 + cas2.a3 * v3; - - cas2.ic1eq1 = 2 * v1 - cas2.ic1eq1; - cas2.ic2eq1 = 2 * v2 - cas2.ic2eq1; - - v0 = cas2.m0 * v0 + cas2.m1 * v1 + cas2.m2 * v2; - - nlp > 6 ? ( - v3 = v0 - cas3.ic2eq1; - v1 = cas3.a1 * cas3.ic1eq1 + cas3.a2 * v3; - v2 = cas3.ic2eq1 + cas3.a2 * cas3.ic1eq1 + cas3.a3 * v3; - - cas3.ic1eq1 = 2 * v1 - cas3.ic1eq1; - cas3.ic2eq1 = 2 * v2 - cas3.ic2eq1; - - v0 = cas3.m0 * v0 + cas3.m1 * v1 + cas3.m2 * v2; - - nlp > 8 ? ( - v3 = v0 - cas4.ic2eq1; - v1 = cas4.a1 * cas4.ic1eq1 + cas4.a2 * v3; - v2 = cas4.ic2eq1 + cas4.a2 * cas4.ic1eq1 + cas4.a3 * v3; - - cas4.ic1eq1 = 2 * v1 - cas4.ic1eq1; - cas4.ic2eq1 = 2 * v2 - cas4.ic2eq1; - - v0 = cas4.m0 * v0 + cas4.m1 * v1 + cas4.m2 * v2; - - nlp > 10 ? ( - v3 = v0 - cas5.ic2eq1; - v1 = cas5.a1 * cas5.ic1eq1 + cas5.a2 * v3; - v2 = cas5.ic2eq1 + cas5.a2 * cas5.ic1eq1 + cas5.a3 * v3; - - cas5.ic1eq1 = 2 * v1 - cas5.ic1eq1; - cas5.ic2eq1 = 2 * v2 - cas5.ic2eq1; - - v0 = cas5.m0 * v0 + cas5.m1 * v1 + cas5.m2 * v2; - - nlp > 12 ? ( - v3 = v0 - cas6.ic2eq1; - v1 = cas6.a1 * cas6.ic1eq1 + cas6.a2 * v3; - v2 = cas6.ic2eq1 + cas6.a2 * cas6.ic1eq1 + cas6.a3 * v3; - - cas6.ic1eq1 = 2 * v1 - cas6.ic1eq1; - cas6.ic2eq1 = 2 * v2 - cas6.ic2eq1; - - v0 = cas6.m0 * v0 + cas6.m1 * v1 + cas6.m2 * v2; - - nlp > 14 ? ( - v3 = v0 - cas7.ic2eq1; - v1 = cas7.a1 * cas7.ic1eq1 + cas7.a2 * v3; - v2 = cas7.ic2eq1 + cas7.a2 * cas7.ic1eq1 + cas7.a3 * v3; - - cas7.ic1eq1 = 2 * v1 - cas7.ic1eq1; - cas7.ic2eq1 = 2 * v2 - cas7.ic2eq1; - - v0 = cas7.m0 * v0 + cas7.m1 * v1 + cas7.m2 * v2; - - nlp > 16 ? ( - v3 = v0 - cas8.ic2eq1; - v1 = cas8.a1 * cas8.ic1eq1 + cas8.a2 * v3; - v2 = cas8.ic2eq1 + cas8.a2 * cas8.ic1eq1 + cas8.a3 * v3; - - cas8.ic1eq1 = 2 * v1 - cas8.ic1eq1; - cas8.ic2eq1 = 2 * v2 - cas8.ic2eq1; - - v0 = cas8.m0 * v0 + cas8.m1 * v1 + cas8.m2 * v2; - - nlp > 18 ? ( - v3 = v0 - cas9.ic2eq1; - v1 = cas9.a1 * cas9.ic1eq1 + cas9.a2 * v3; - v2 = cas9.ic2eq1 + cas9.a2 * cas9.ic1eq1 + cas9.a3 * v3; - - cas9.ic1eq1 = 2 * v1 - cas9.ic1eq1; - cas9.ic2eq1 = 2 * v2 - cas9.ic2eq1; - - v0 = cas9.m0 * v0 + cas9.m1 * v1 + cas9.m2 * v2; - ); - ); - ); - ); - ); - ); - ); - ); - ); - ); - - onepole ? ( - v0 = op1.svf_onepole_do(v0); - ); - - v0; -); - -/* - * Reset the SVF filter state for all channels - */ -function svf_reset() - instance(ic1eq0, ic2eq0, ic1eq1, ic2eq1) -( - ic1eq0 = ic2eq0 = 0.0; - ic1eq1 = ic2eq1 = 0.0; -); - -/* - * Get magnitude response for single filter - */ -function svf_mag(freq) - instance(g, k, m0, m1, m2, a1, a2, a3) - local(zr, zi, zrr, gsq, gm1, gk, twogsq, a, zsq_i, zsq_r, twoz_r, twoz_i, nr, ni, dr, di, norm, ddi, ddr, x, y, s) -( - // exp(complex(0.0, -2.0 * pi) * frequency / sampleRate) - zr = 0.0; - zi = -2.0 * $pi; - - zr = zr * freq * ONE_OVER_SAMPLE_RATE; - zi = zi * freq * ONE_OVER_SAMPLE_RATE; - zr = exp(zr); - - zrr = zr; - zr = zrr * cos(zi); - zi = zrr * sin(zi); - - gsq = g * g; - gm1 = g * m1; - gk = g * k; - twogsq = gsq * 2.0; - - // z * z - a = zr * zr - zi * zi; - zsq_i = zi * zr + zr * zi; - zsq_r = a; - - // z * 2.0 - twoz_r = zr * 2; - twoz_i = zi * 2; - - // Numerator complex - nr = gsq * m2 * (zsq_r + twoz_r + 1.0) - gm1 * (zsq_r - 1.0); - ni = gsq * m2 * (zsq_i + twoz_i) - gm1 * (zsq_i); - - // Denominator complex - dr = gsq + gk + zsq_r * (gsq - gk + 1.0) + zr * (twogsq - 2.0) + 1.0; - di = zsq_i * (gsq - gk + 1.0) + zi * (twogsq - 2.0); - - // Numerator / Denominator - norm = dr * dr + di * di; - a = (nr * dr + ni * di) / norm; - ddi = (ni * dr - nr * di) / norm; - ddr = a; - - // abs(m0_ + (Numerator / Denominator) - x = m0 + ddr; - y = ddi; - s = max(abs(x), abs(y)); - x /= s; - y /= s; - - // Return magnitude - s * sqrt(x * x + y * y); -); - -/* - * Get phase response for single filter - */ -function svf_phase(freq) - instance(g, k, m0, m1, m2, a1, a2, a3) - local(zr, zi, zrr, gsq, gm1, gk, twogsq, a, zsq_i, zsq_r, twoz_r, twoz_i, nr, ni, dr, di, norm, ddi, ddr, x, y, s) -( - // exp(complex(0.0, -2.0 * pi) * frequency / sampleRate) - zr = 0.0; - zi = -2.0 * $pi; - - zr = zr * freq * ONE_OVER_SAMPLE_RATE; - zi = zi * freq * ONE_OVER_SAMPLE_RATE; - zr = exp(zr); - - zrr = zr; - zr = zrr * cos(zi); - zi = zrr * sin(zi); - - gsq = g * g; - gm1 = g * m1; - gk = g * k; - twogsq = gsq * 2.0; - - // z * z - a = zr * zr - zi * zi; - zsq_i = zi * zr + zr * zi; - zsq_r = a; - - // z * 2.0 - twoz_r = zr * 2; - twoz_i = zi * 2; - - // Numerator complex - nr = gsq * m2 * (zsq_r + twoz_r + 1.0) - gm1 * (zsq_r - 1.0); - ni = gsq * m2 * (zsq_i + twoz_i) - gm1 * (zsq_i); - - // Denominator complex - dr = gsq + gk + zsq_r * (gsq - gk + 1.0) + zr * (twogsq - 2.0) + 1.0; - di = zsq_i * (gsq - gk + 1.0) + zi * (twogsq - 2.0); - - // Numerator / Denominator - norm = dr * dr + di * di; - a = (nr * dr + ni * di) / norm; - ddi = (ni * dr - nr * di) / norm; - ddr = a; - - // arg(m0_ + (Numerator / Denominator) - x = m0 + ddr; - y = ddi; - - atan2(y, x); -); - -/* - * Get the magnitude of the filters for the given frequency - */ -function svf_magnitude(freq) - instance(a2, t_k, g, k, nlp, onepole, cas1, cas2, cas3, cas4, cas5, cas6, cas7, cas8, cas9, cutoff, op0, op1) - local(m) -( - // Our svf magnitude maps to the same magnitude z transfer function as biquad - - m = 1.0; - - // Apply two pole (12dB steps) - nlp > 0 ? m *= this.svf_mag(freq); //12 - nlp > 2 ? m *= cas1.svf_mag(freq); //24 - nlp > 4 ? m *= cas2.svf_mag(freq); //36 - nlp > 6 ? m *= cas3.svf_mag(freq); //48 - nlp > 8 ? m *= cas4.svf_mag(freq); //60 - nlp > 10 ? m *= cas5.svf_mag(freq); //72 - nlp > 12 ? m *= cas6.svf_mag(freq); //84 - nlp > 14 ? m *= cas7.svf_mag(freq); //96 - nlp > 16 ? m *= cas8.svf_mag(freq); //108 - nlp > 18 ? m *= cas9.svf_mag(freq); //120 - - // Apply one pole (6dB) -// nlp * 0.5 == floor(nlp * 0.5) ? ( - onepole == 1 ? ( - // TODO: optimize! - wdcutoff = $pi * (cutoff * ONE_OVER_SAMPLE_RATE); - coff = tan(wdcutoff); - - wdeval = $pi * (freq * ONE_OVER_SAMPLE_RATE); - svalue = tan(wdeval); - - op0.passtype == 0 ? ( - // lp - m *= 1.0 / sqrt(1 + ((svalue/coff)^2)); - ) : ( - // hp - m *= 1.0 / sqrt(1 + ((coff/svalue)^2)); - ); - ); - - m; -);