MCPcopy Create free account
hub / github.com/TheWaveWarden/odin2 / processBlock

Method processBlock

Source/PluginProcessorProcess.cpp:20–502  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18#include "PluginProcessor.h"
19
20void OdinAudioProcessor::processBlock(AudioBuffer<float> &buffer, MidiBuffer &midiMessages) {
21
22 //avoid denormals
23 juce::ScopedNoDenormals snd;
24
25 // get BPM info from host
26 if (AudioPlayHead *playhead = getPlayHead()) {
27 AudioPlayHead::CurrentPositionInfo current_position_info;
28 playhead->getCurrentPosition(current_position_info);
29 if (m_BPM != current_position_info.bpm) {
30 m_value_tree.state.getChildWithName("misc").setProperty("BPM", m_BPM, nullptr);
31 }
32 m_BPM = current_position_info.bpm;
33 }
34 setBPM(m_BPM);
35
36 ScopedNoDenormals noDenormals;
37 //auto totalNumInputChannels = getTotalNumInputChannels();
38 //auto totalNumOutputChannels = getTotalNumOutputChannels();
39
40 MidiMessage midi_message;
41 int midi_message_sample = -1;
42 MidiBufferIterator midi_iterator = midiMessages.begin();
43 bool midi_message_remaining = !midiMessages.isEmpty();
44 if (midi_message_remaining) {
45 midi_message = (*midi_iterator).getMessage();
46 midi_message_sample = (*midi_iterator).samplePosition;
47 }
48
49 // loop over samples
50 for (int sample = 0; sample < buffer.getNumSamples(); ++sample) {
51
52 // do Arpeggiator
53 if (m_arpeggiator_on) {
54 int step_active;
55 auto note = m_arpeggiator.getNoteOns(step_active);
56 m_step_led_active.set(step_active);
57 if (std::get<0>(note) != -1) {
58 midiNoteOn(std::get<0>(note), std::get<1>(note), std::get<2>(note), std::get<3>(note));
59 }
60 auto off_notes = m_arpeggiator.getNoteOffs();
61 for (auto note_to_kill : off_notes) {
62 midiNoteOff(note_to_kill);
63 }
64 }
65
66 //============================================================
67 //======================= SMOOTHING ==========================
68 //============================================================
69 for (int i = 0; i < 3; ++i) {
70 m_osc_vol_smooth[i] =
71 m_osc_vol_smooth[i] * GAIN_SMOOTHIN_FACTOR + (1.f - GAIN_SMOOTHIN_FACTOR) * m_osc_vol_control[i];
72 m_fil_gain_smooth[i] =
73 m_fil_gain_smooth[i] * GAIN_SMOOTHIN_FACTOR + (1.f - GAIN_SMOOTHIN_FACTOR) * m_fil_gain_control[i];
74
75 m_fil_freq_smooth[i] = m_fil_freq_smooth[i] * FILTER_FREQ_SMOOTHING_FACTOR +
76 (1.f - FILTER_FREQ_SMOOTHING_FACTOR) * m_fil_freq_control[i];
77 }

Callers

nothing calls this directly

Calls 15

getNoteOnsMethod · 0.80
getNoteOffsMethod · 0.80
zeroAllDestinationsMethod · 0.80
applyModulationMethod · 0.80
doEnvelopeMethod · 0.80
doOscillateWithSyncMethod · 0.80
setPosModValueMethod · 0.80
doNoiseMethod · 0.80
setFilterEnvValueMethod · 0.80
setCombFreqMethod · 0.80
doRingModulatorMethod · 0.80

Tested by

no test coverage detected