Skip to content

Simulator crashes when loading faust module #601

@niektb

Description

@niektb

With the default sample it doesn't happen but with my own projects it does... The preview in the library looks correct but the moment I try loading the module, VCVRack crashes instantly. This is the call stack from the debugger in Visual Studio Code:

ntdll.dll!ntdll!RtlIsZeroMemory (Unknown Source:0)
ntdll.dll!ntdll!.misaligned_access (Unknown Source:0)
ntdll.dll!ntdll!.misaligned_access (Unknown Source:0)
ntdll.dll!ntdll!.misaligned_access (Unknown Source:0)
ntdll.dll!ntdll!RtlGetCurrentServiceSessionId (Unknown Source:0)
ntdll.dll!ntdll!RtlFreeHeap (Unknown Source:0)
msvcrt.dll!msvcrt!free (Unknown Source:0)
plugin.dll!dsp_memory_manager::destroy(dsp_memory_manager * const this, void * ptr) (c:\Users\niekt\eurorack-blocks\Projects\fmsynth\artifacts\FmSynth_erbb.hpp:65)
plugin.dll!deletemydspSIG0(mydspSIG0 * dsp, dsp_memory_manager * manager) (c:\Users\niekt\eurorack-blocks\Projects\fmsynth\artifacts\module_faust.h:57)
plugin.dll!mydsp::classInit(int sample_rate) (c:\Users\niekt\eurorack-blocks\Projects\fmsynth\artifacts\module_faust.h:128)
plugin.dll!FmSynth::init(FmSynth * const this) (c:\Users\niekt\eurorack-blocks\Projects\fmsynth\artifacts\FmSynth_erbb.hpp:101)
plugin.dll!erb::module_init<FmSynth>(FmSynth & t) (c:\Users\niekt\eurorack-blocks\include\erb\module_init.h:41)
plugin.dll!ErbModule::ErbModule(ErbModule * const this) (c:\Users\niekt\eurorack-blocks\Projects\fmsynth\artifacts\plugin_vcvrack.cpp:148)
plugin.dll!rack::createModel<ErbModule, ErbWidget>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)::TModel::createModule()(rack::TModel * const this) (c:\Users\niekt\eurorack-blocks\submodules\vcv-rack-sdk\include\helpers.hpp:27)
libRack.dll!libRack!_ZN4rack3app11AudioButton8onActionERKNS_6widget6Widget11ActionEventE (Unknown Source:0)
libRack.dll!libRack!_ZN4rack3app7browser8ModelBox8onButtonERKNS_6widget6Widget11ButtonEventE (Unknown Source:0)
libRack.dll!libRack!_ZN4rack6widget6Widget8onButtonERKNS1_11ButtonEventE (Unknown Source:0)
libRack.dll!libRack!_ZN4rack6widget6Widget8onButtonERKNS1_11ButtonEventE (Unknown Source:0)
libRack.dll!libRack!_ZN4rack6widget6Widget8onButtonERKNS1_11ButtonEventE (Unknown Source:0)
libRack.dll!libRack!_ZN4rack2ui12ScrollWidget8onButtonERKNS_6widget6Widget11ButtonEventE (Unknown Source:0)
libRack.dll!libRack!_ZN4rack3app7browser7Browser8onButtonERKNS_6widget6Widget11ButtonEventE (Unknown Source:0)
libRack.dll!libRack!_ZN4rack2ui11MenuOverlay8onButtonERKNS_6widget6Widget11ButtonEventE (Unknown Source:0)
libRack.dll!libRack!_ZN4rack6widget12OpaqueWidget8onButtonERKNS0_6Widget11ButtonEventE (Unknown Source:0)
libRack.dll!libRack!_ZN4rack6widget10EventState12handleButtonENS_4math3VecEiii (Unknown Source:0)
libRack.dll!libRack!_ZN4rack6window3Svg4loadERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE (Unknown Source:0)
libRack.dll!libRack!glfwGetWin32Monitor (Unknown Source:0)
user32.dll!USER32!DispatchMessageW (Unknown Source:0)
user32.dll!USER32!CallWindowProcW (Unknown Source:0)
opengl32.dll!wglSwapBuffers (Unknown Source:0)
user32.dll!USER32!DispatchMessageW (Unknown Source:0)
user32.dll!USER32!DispatchMessageW (Unknown Source:0)
libRack.dll!libRack!_glfwPollEventsWin32 (Unknown Source:0)
libRack.dll!libRack!_ZN4rack6window6Window4stepEv (Unknown Source:0)
libRack.dll!libRack!_ZN4rack6window6Window3runEv (Unknown Source:0)
[Unknown/Just-In-Time compiled code] (Unknown Source:0)
kernel32.dll!KERNEL32!BaseThreadInitThunk (Unknown Source:0)
ntdll.dll!ntdll!RtlUserThreadStart (Unknown Source:0)
[Unknown/Just-In-Time compiled code] (Unknown Source:0)

My faust code was tried and tested in the Faust IDE:

// FmSynth.dsp

import("stdfaust.lib");

freq = nentry("key",60,36,96,1) : midikey2hz 
with {
    // quarter tone tuning
    midikey2hz(mk) = 440.0*pow(2.0, (mk-69.0)/48.0); 
}; 

fm = hgroup("FM", os.osc(freq + os.osc(freq * ratio) * index))
with{
    ratio = hslider("Ratio[style:knob]", 2,1,10,1);
    index = hslider("Index[style:knob]", 100, 0, 1000, 0.01);
};

envelope = hgroup("Envelope", en.adsr(attack,decay,sustain, release, gate) * gain * 0.3)
with {
    attack = hslider("Envelope[style:knob]", 50,1,499,1)*0.001;
    decay = 0.1;
    sustain = 1;
    release = (500*0.001)-attack;
    gain = 1;
    gate = button("gate");
};

process = hgroup("Synth", fm * envelope <: _,_); 

My erbui file:

// FmSynth.erbui

module FmSynth {
   // The width of your module (don't make it smaller than back board width!)
   width 10hp

   // The back board to use
   board kivu12

   // The front panel material
   material aluminum
   // put "material aluminum black" if you want it black

   // Header to put your module name
   header { label "FmSynth" }

   // Put your controls here
   control pot1 Pot {
      faust { bind { address "/Synth/FM/Ratio" } }
      position 2.5hp, 18mm
      label "RATIO"
   }

   control pot2 Pot {
      faust { bind { address "/Synth/FM/Index" } }
      position 7.5hp, 18mm
      label "DEPTH"
   }

   control pot3 Pot {
      faust { bind { address "/Synth/Envelope/Envelope" } }
      position 2.5hp, 40mm
      label "ENV"
   }

   control gate_in GateIn {
      faust { bind { address "/Synth/Envelope/gate" } }
      position 2hp, 81mm
      label "GI1"
   }

   control cv_in CvIn {
      faust { bind { address "/Synth/FM/key" } }
      position 2hp, 96mm
      label "CV5"
   }

   control audio_out AudioOut {
      position 6hp, 111mm
      label "OUT L"
   }

   control audio_out2 AudioOut {
      position 8hp, 111mm
      label "OUT R"
   }

   // Available controls and styles are documented here:
   // https://eurorack-blocks.readthedocs.io/en/latest/controls/README.html

   // erbui grammar reference is here:
   // https://eurorack-blocks.readthedocs.io/en/latest/erbui/grammar.html
}

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions