├── Source ├── Util.cpp ├── CompileSwitches.h ├── PluginEditor.h ├── PluginProcessor.h ├── Util.h ├── TeensyJuce.h ├── TeensyJuce.cpp ├── PluginEditor.cpp ├── GlitchDelayEffect.h ├── PluginProcessor.cpp └── GlitchDelayEffect.cpp ├── README.md └── TeensyJuce.jucer /Source/Util.cpp: -------------------------------------------------------------------------------- 1 | #include "Util.h" 2 | 3 | #ifdef DEBUG_OUTPUT 4 | bool serial_port_initialised = false; 5 | #endif // DEBUG_OUTPUT 6 | -------------------------------------------------------------------------------- /Source/CompileSwitches.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define DEBUG_OUTPUT 4 | //#define STANDALONE_AUDIO 5 | #define PERF_CHECK 6 | //#define SET_TEMPO 7 | 8 | //#define TARGET_TEENSY 9 | #define TARGET_JUCE -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TeensyJuce 2 | 3 | TeensyJuce is intended as a way to prototype Teensy effects in a more fully featured dev environment, to make debugging possible. It uses the JUCE API, so can be compiled on Mac, PC and Linux. It will allow you to compile your Teensy effects as VSTs or Audio Units. 4 | 5 | First, install Juce from here https://www.juce.com/get-juce 6 | 7 | Simply derive your effect from `TEENSY_AUDIO_STREAM_WRAPPER` rather than `AudioStream`. This parent class handles the internal audio_block_t queue data, so you don't need to define that. Then, rather than making any Teensy audio library calls in your code, call 8 | 9 | ``` 10 | bool process_audio_in( int channel ) 11 | bool process_audio_out( int channel ) 12 | ``` 13 | 14 | This will then do the Teensy or Juce based audio handling, and call the functions below that you can override with your audio code. 15 | 16 | ``` 17 | // add audio processing code in these 2 functions 18 | virtual void process_audio_in_impl( int channel, const int16_t* sample_data, int num_samples ) = 0; 19 | virtual void process_audio_out_impl( int channel, int16_t* sample_data, int num_samples ) = 0; 20 | ``` 21 | 22 | Then simply add one of the following defines to switch between Teensy and Juce 23 | 24 | ``` 25 | //#define TARGET_TEENSY 26 | #define TARGET_JUCE 27 | ``` 28 | 29 | I've ported my Glitch Delay Effect to this system, so have a look at the source code for an example of how to use it. I use ProJucer to create a project file for my compiler/IDE (xcode in my case). 30 | 31 | NOTE: You will pay the cost of a handful more virtual function calls. I was happy with that for prototyping purposes, but once the code is working it would be straightforward to remove them. 32 | -------------------------------------------------------------------------------- /Source/PluginEditor.h: -------------------------------------------------------------------------------- 1 | /* 2 | ============================================================================== 3 | 4 | This file was auto-generated! 5 | 6 | It contains the basic framework code for a JUCE plugin editor. 7 | 8 | ============================================================================== 9 | */ 10 | 11 | #pragma once 12 | 13 | #include "../JuceLibraryCode/JuceHeader.h" 14 | #include "PluginProcessor.h" 15 | 16 | 17 | //============================================================================== 18 | /** 19 | */ 20 | 21 | // forward declarations 22 | 23 | /////////////////////////////////////////////////////////////////////////// 24 | 25 | class TeensyJuceAudioProcessorEditor : public AudioProcessorEditor, 26 | public Slider::Listener, 27 | private Timer 28 | { 29 | public: 30 | TeensyJuceAudioProcessorEditor (TeensyJuceAudioProcessor&, const GLITCH_DELAY_EFFECT&); 31 | ~TeensyJuceAudioProcessorEditor(); 32 | 33 | AudioParameterFloat* get_parameter_for_slider( Slider* slider ); 34 | 35 | //============================================================================== 36 | void paint (Graphics&) override; 37 | void resized() override; 38 | 39 | //// Slider::Listener //// 40 | void sliderValueChanged (Slider* slider) override; 41 | void sliderDragStarted (Slider* slider) override; 42 | void sliderDragEnded (Slider* slider) override; 43 | ///////////////////////// 44 | 45 | private: 46 | // This reference is provided as a quick way for your editor to 47 | // access the processor object that created it. 48 | 49 | static const int DIAL_ROW_COUNT; 50 | static const int DIAL_SIZE; 51 | static const int DIAL_SEPARATION; 52 | static const int LABEL_HEIGHT; 53 | static const int BORDER; 54 | 55 | TeensyJuceAudioProcessor& m_processor; 56 | const GLITCH_DELAY_EFFECT& m_effect; 57 | 58 | OwnedArray m_param_sliders; 59 | OwnedArray