This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int bufsize = m_aman.getCurrentAudioDevice()->getCurrentBufferSizeSamples(); | |
// need to stop the realtime playback so we don't get conflicts while offline rendering | |
m_aman.removeAudioCallback(&m_aeng); | |
m_aeng.seekToSeconds(0.0); | |
juce::WavAudioFormat wavformat; | |
juce::File f = juce::File::getSpecialLocation(juce::File::userDocumentsDirectory); | |
auto outfile = f.getNonexistentChildFile("upic_renders/upic_out",".wav"); | |
auto ostream = outfile.createOutputStream(); | |
auto writer = wavformat.createWriterFor(ostream.release(),m_aeng.m_sr,2,32,{},0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void test_noise_generation() | |
{ | |
std::default_random_engine rng; | |
std::uniform_real_distribution<float> distrib{-1.0f,1.0f}; | |
/* | |
auto gener = [&rng,&distrib]() | |
{ | |
return distrib(rng); | |
}; | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<typename RNG=std::default_random_engine, typename ResultType=float> | |
struct RandomDistributionGenerator | |
{ | |
RNG rng; | |
std::uniform_real_distribution<ResultType> distrib_uniform; | |
std::normal_distribution<ResultType> distrib_normal; | |
std::exponential_distribution<ResultType> distrib_expo; | |
std::cauchy_distribution<ResultType> distrib_cauchy; | |
RandomDistributionGenerator() {} | |
RandomDistributionGenerator(unsigned int seed) : rng(seed) {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct ConcreteCM : sst::jucegui::data::ContinunousModulatable, juce::AudioParameterFloat::Listener, | |
juce::AsyncUpdater | |
{ | |
juce::AudioParameterFloat* parToControl = nullptr; | |
void parameterValueChanged (int parameterIndex, float newValue) override | |
{ | |
value = newValue; | |
triggerAsyncUpdate(); | |
} | |
void handleAsyncUpdate() override |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void AdditiveVoice::step() | |
{ | |
float outputs[2] = {0.0f,0.0f}; | |
#ifdef JUCE_WINDOWSA | |
// calculate SIMD sines with AVX | |
for (int i=0;i<m_num_partials;i+=8) | |
{ | |
alignas(32) v8sf temp = _mm256_loadu_ps(&m_partial_phases[i]); | |
temp = sin256_ps(temp); | |
_mm256_storeu_ps(&m_output_samples[i],temp); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void AdditiveSynth::processBlock(juce::AudioBuffer<float>& buffer, juce::MidiBuffer& midiMessages) | |
{ | |
// might want to avoid doing this for voices that are not active or | |
// if parameters have not changed, but this will have to do for now | |
for(auto& v : m_voices) | |
{ | |
v.updateState(); | |
} | |
auto bufptrs = buffer.getArrayOfWritePointers(); | |
auto it = midiMessages.begin(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Animator : public Timer | |
{ | |
public: | |
enum class State | |
{ | |
Started, | |
Running, | |
Finished | |
}; | |
Animator(int updateinterval = 40) : m_update_interval(updateinterval) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// for plugins without custom GUI | |
class GenericParameterComponent : public juce::Component | |
{ | |
public: | |
GenericParameterComponent(ClapProcessor* proc, clap_id param_id) | |
: m_proc(proc), m_param_id(param_id) | |
{ | |
m_slider.setSliderStyle(juce::Slider::SliderStyle::LinearBar); | |
m_slider.setRange(proc->paramInfo[param_id].min_value,proc->paramInfo[param_id].max_value); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Surge XT.exe!std::array<float,8192>::operator[](unsigned __int64 _Pos) Line 534 (c:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\array:534) | |
Surge XT.exe!sst::cpputils::StereoRingBuffer<float,8192,0>::popall() Line 245 (c:\develop\surge\libs\sst\sst-cpputils\include\sst\cpputils\ring_buffer.h:245) | |
Surge XT.exe!Surge::Overlays::Oscilloscope::pullData() Line 190 (c:\develop\surge\src\surge-xt\gui\overlays\Oscilloscope.cpp:190) | |
Surge XT.exe!std::invoke<void (__cdecl Surge::Overlays::Oscilloscope::*const &)(void),Surge::Overlays::Oscilloscope * &>(void(Surge::Overlays::Oscilloscope::*)() & _Obj, Surge::Overlays::Oscilloscope * & _Arg1) Line 1573 (c:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\type_traits:1573) | |
Surge XT.exe!std::_Mem_fn<void (__cdecl Surge::Overlays::Oscilloscope::*)(void)>::operator()<Surge::Overlays::Oscilloscope * &>(Surge::Overlays::Oscilloscope * & <_Args_0>) Line 578 (c:\Program Files\Microsoft Visual Studio\ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SimpleDelay2 | |
{ | |
public: | |
SimpleDelay2() {} | |
void prepare(float samplerate, int numchans, float delaytime_ramp_dur_seconds, float maxdelaytime_seconds) | |
{ | |
mDelayTime.reset(samplerate, delaytime_ramp_dur_seconds); | |
mWetDryMix.reset(samplerate, 0.05f); // 50 millisecond ramps for the wet dry | |
mFeedBackAmount.reset(samplerate, 0.05f); // likewise for feedback gain | |
mDelayLine.setMaximumDelayInSamples(maxdelaytime_seconds*samplerate); |