Very preliminary tests to allow reacting to incoming MIDI notes
This commit is contained in:
		@@ -777,6 +777,29 @@ void PaulstretchpluginAudioProcessor::processBlock (AudioSampleBuffer& buffer, M
 | 
				
			|||||||
	
 | 
						
 | 
				
			||||||
	m_stretch_source->setFreezing(getParameter(cpi_freeze));
 | 
						m_stretch_source->setFreezing(getParameter(cpi_freeze));
 | 
				
			||||||
	m_stretch_source->setPaused(getParameter(cpi_pause_enabled));
 | 
						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);
 | 
						m_stretch_source->setProcessParameters(&m_ppar);
 | 
				
			||||||
	AudioSourceChannelInfo aif(buffer);
 | 
						AudioSourceChannelInfo aif(buffer);
 | 
				
			||||||
	if (isNonRealtime() || m_use_backgroundbuffering == false)
 | 
						if (isNonRealtime() || m_use_backgroundbuffering == false)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -273,6 +273,7 @@ private:
 | 
				
			|||||||
	AudioFilePreviewComponent* m_previewcomponent = nullptr;
 | 
						AudioFilePreviewComponent* m_previewcomponent = nullptr;
 | 
				
			||||||
	void saveCaptureBuffer();
 | 
						void saveCaptureBuffer();
 | 
				
			||||||
	SharedResourcePointer<MyThreadPool> m_threadpool;
 | 
						SharedResourcePointer<MyThreadPool> m_threadpool;
 | 
				
			||||||
 | 
						int m_midinote_to_use = -1;
 | 
				
			||||||
	//==============================================================================
 | 
						//==============================================================================
 | 
				
			||||||
    JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PaulstretchpluginAudioProcessor)
 | 
					    JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PaulstretchpluginAudioProcessor)
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,7 +11,8 @@
 | 
				
			|||||||
              pluginWantsMidiIn="0" pluginProducesMidiOut="0" pluginIsMidiEffectPlugin="0"
 | 
					              pluginWantsMidiIn="0" pluginProducesMidiOut="0" pluginIsMidiEffectPlugin="0"
 | 
				
			||||||
              pluginEditorRequiresKeys="0" pluginAUExportPrefix="paulxstretchAU"
 | 
					              pluginEditorRequiresKeys="0" pluginAUExportPrefix="paulxstretchAU"
 | 
				
			||||||
              aaxIdentifier="com.yourcompany.paulstretchplugin" pluginAAXCategory="2"
 | 
					              aaxIdentifier="com.yourcompany.paulstretchplugin" pluginAAXCategory="2"
 | 
				
			||||||
              jucerVersion="5.4.1" headerPath="

" pluginFormats="buildVST,buildVST3,buildAU,buildStandalone">
 | 
					              jucerVersion="5.4.1" headerPath="

" pluginFormats="buildVST,buildVST3,buildAU,buildStandalone"
 | 
				
			||||||
 | 
					              pluginCharacteristicsValue="pluginWantsMidiIn">
 | 
				
			||||||
  <MAINGROUP id="nozXHl" name="PaulXStretch">
 | 
					  <MAINGROUP id="nozXHl" name="PaulXStretch">
 | 
				
			||||||
    <GROUP id="{03DA6B32-F666-FF60-F168-4385D0847058}" name="Source">
 | 
					    <GROUP id="{03DA6B32-F666-FF60-F168-4385D0847058}" name="Source">
 | 
				
			||||||
      <FILE id="RanaVV" name="RenderSettingsComponent.cpp" compile="1" resource="0"
 | 
					      <FILE id="RanaVV" name="RenderSettingsComponent.cpp" compile="1" resource="0"
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user