Skip to content

Commit

Permalink
Add pages for code snippets & example projects
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiashienzsch committed Apr 30, 2020
1 parent 90e226d commit 8518988
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
2 changes: 2 additions & 0 deletions SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
- [DSP](chapters/working_with_juce/dsp.md)
- [Misc](chapters/working_with_juce/misc.md)
- [JUCE Modules](chapters/working_with_juce/juce_modules.md)
- [Example Projects](chapters/working_with_juce/example_projects.md)
- [Code snippets](chapters/working_with_juce/code_snippets.md)
- [Testing](chapters/testing.md)
- [Unit tests](chapters/testing/unit_test.md)
- [pluginval](chapters/testing/pluginval.md)
Expand Down
23 changes: 23 additions & 0 deletions chapters/working_with_juce/code_snippets.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Code snippets

## Plug-in recall

Variable `parameters_` is of type `juce::AudioProcessorValueTreeState`:

```cpp
void YourPluginProcessor::getStateInformation(juce::MemoryBlock& destData)
{
juce::MemoryOutputStream stream(destData, false);
parameters_.state.writeToStream(stream);
}

void YourPluginProcessor::setStateInformation(const void* data, int sizeInBytes)
{
juce::ValueTree tree = juce::ValueTree::readFromData(data, static_cast<size_t>(sizeInBytes));
jassert(tree.isValid());
if (tree.isValid())
{
parameters_.state = tree;
}
}
```
7 changes: 7 additions & 0 deletions chapters/working_with_juce/example_projects.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Example Projects

## OpenGL

- [OpenGL Basic](https://github.com/tobanteAudio/juce-cookbook/tree/master/examples/opengl/opengl-basic)
- [OpenGL Model](https://github.com/tobanteAudio/juce-cookbook/tree/master/examples/opengl/opengl-model)
- [OpenGL Shader](https://github.com/tobanteAudio/juce-cookbook/tree/master/examples/opengl/opengl-shader)

0 comments on commit 8518988

Please sign in to comment.