Browse Source

Very preliminary tests to allow reacting to incoming MIDI notes

master
xenakios 6 years ago
parent
commit
cf3c26989e
3 changed files with 26 additions and 1 deletions
  1. +23
    -0
      Source/PluginProcessor.cpp
  2. +1
    -0
      Source/PluginProcessor.h
  3. +2
    -1
      paulstretchplugin.jucer

+ 23
- 0
Source/PluginProcessor.cpp View File

@@ -777,6 +777,29 @@ void PaulstretchpluginAudioProcessor::processBlock (AudioSampleBuffer& buffer, M
m_stretch_source->setFreezing(getParameter(cpi_freeze));
m_stretch_source->setPaused(getParameter(cpi_pause_enabled));
MidiBuffer::Iterator midi_it(midiMessages);
MidiMessage midi_msg;
int midi_msg_pos;
while (true)
{
if (midi_it.getNextEvent(midi_msg, midi_msg_pos) == false)
break;
if (midi_msg.isNoteOn())
{
m_midinote_to_use = midi_msg.getNoteNumber();
break;
}
if (midi_msg.isNoteOff())
{
m_midinote_to_use = -1;
}
}
if (m_midinote_to_use >= 0)
{
int note_offset = m_midinote_to_use - 60;
m_ppar.pitch_shift.cents += 100.0*note_offset;
}
m_stretch_source->setProcessParameters(&m_ppar);
AudioSourceChannelInfo aif(buffer);
if (isNonRealtime() || m_use_backgroundbuffering == false)


+ 1
- 0
Source/PluginProcessor.h View File

@@ -273,6 +273,7 @@ private:
AudioFilePreviewComponent* m_previewcomponent = nullptr;
void saveCaptureBuffer();
SharedResourcePointer<MyThreadPool> m_threadpool;
int m_midinote_to_use = -1;
//==============================================================================
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PaulstretchpluginAudioProcessor)
};

+ 2
- 1
paulstretchplugin.jucer View File

@@ -11,7 +11,8 @@
pluginWantsMidiIn="0" pluginProducesMidiOut="0" pluginIsMidiEffectPlugin="0"
pluginEditorRequiresKeys="0" pluginAUExportPrefix="paulxstretchAU"
aaxIdentifier="com.yourcompany.paulstretchplugin" pluginAAXCategory="2"
jucerVersion="5.4.1" headerPath="&#10;&#10;" pluginFormats="buildVST,buildVST3,buildAU,buildStandalone">
jucerVersion="5.4.1" headerPath="&#10;&#10;" pluginFormats="buildVST,buildVST3,buildAU,buildStandalone"
pluginCharacteristicsValue="pluginWantsMidiIn">
<MAINGROUP id="nozXHl" name="PaulXStretch">
<GROUP id="{03DA6B32-F666-FF60-F168-4385D0847058}" name="Source">
<FILE id="RanaVV" name="RenderSettingsComponent.cpp" compile="1" resource="0"


Loading…
Cancel
Save