StateViewJuceDemo
Different ways of mutating and representing state in JUCE apps
Install / Use
/learn @Normalised/StateViewJuceDemoREADME
State -> View Notification Juce Demo Apps
This is a collection of small demo apps to show the basics of State Change Notification and how to decouple the UI from the other parts of the application.
Each app is based around a single technique or library and is buildable via CMake on its own.
There is a youtube video recorded with The Audio Programmer which goes through most of the examples in detail.
- Juce Starting Point
Level Zero. You have a view, you have a processor, wire them together directly. The structure of this is different to all the other later demos because it has no intermediate AudioPlayer object.
- Juce Change Broadcaster - Processor
This uses the JUCE Change Broadcaster class and makes the Processor the broadcaster.
- Juce Change Broadcaster - State
This uses the JUCE Change Broadcaster class and makes the State broadcast changes.
- Juce Listener List
This uses a JUCE Listener List and a Listener / Broadcaster pair of interfaces.
- Rocket Library
This uses the rocket library which is a signals / slots implementation.
- RxCpp Library
This uses the rxcpp library which is an RX / Reactive Streams implementation.
- TypePipe Library
This uses the TypePipe library which is my own simple library similar to signals / slots and based around value type based event channels.
App Structure
The 4 objects involved are
- AudioPlayerProcessor
This is where the DSP happens. (There is no actual DSP code, but it would be here if there was)
- AudioPlayerView
The UI. Contains buttons and labels. Button click actions are used to invoke named lambdas such as onPlay which another object can bind to.
- AudioPlayerState
The state of the Processor but made into its own external state object. Owned by the Processor.
- AudioPlayer
This owns both the Processor and View and glues them together. View events become actions which act on the processor.
Notes
The Main.cpp and MainComponent files are just JUCE setup and are identical in every demo app.
