mirror of
https://github.com/AquaMorph/Droplets.git
synced 2025-04-29 17:35:33 +00:00
Documentation for creating new droplets
This commit is contained in:
parent
618ada7a3c
commit
f00479c725
52
README.md
52
README.md
@ -18,3 +18,55 @@ make lib && make
|
||||
```sh
|
||||
make deploy
|
||||
```
|
||||
|
||||
## Creating Droplets
|
||||
|
||||
The Droplets firmware is based around writing modular code blocks called droplets. A droplet needs to support three states (full, left, right). Droplets should have an animated title bar that ideally interacts with the current state of the droplet.
|
||||
|
||||
### Hardware Allocation
|
||||
|
||||
#### Full Mode
|
||||
|
||||
CTRL [1-4]
|
||||
GATE IN [1-2]
|
||||
GATE OUT 1
|
||||
AUDIO IN [1-4]
|
||||
AUDIO OUT [1-4]
|
||||
MIDI IN
|
||||
MIDI OUT
|
||||
CV OUT [1-2]
|
||||
|
||||
#### Left Mode
|
||||
|
||||
CTRL [1-2]
|
||||
GATE IN 1
|
||||
GATE OUT 1
|
||||
AUDIO IN [1-2]
|
||||
AUDIO OUT [1-2]
|
||||
MIDI IN
|
||||
MIDI OUT
|
||||
CV OUT 1
|
||||
|
||||
#### Right Mode
|
||||
|
||||
CTRL [3-4]
|
||||
GATE IN 2
|
||||
AUDIO IN [3-4]
|
||||
AUDIO OUT [3-4]
|
||||
CV OUT 2
|
||||
|
||||
### Setting Up Code
|
||||
|
||||
1. Create new c++ program and header file from the Droplet template.
|
||||
|
||||
```sh
|
||||
create-new-droplet.sh [Droplet Name]
|
||||
```
|
||||
|
||||
2. Add a MenuState enum for the new droplet in the `menu_item.h` with the format of k[Droplet Name].
|
||||
|
||||
3. Add menu to the `menu.cpp` by creating a new AddItemEnd to the list with the MenuState and droplet name.
|
||||
|
||||
4. Include the droplet header in the `main.h` file.
|
||||
|
||||
5. In the GetDroplet function in `main.cpp` add a case for the new droplet to return a constructor.
|
||||
|
33
create-new-droplet.sh
Executable file
33
create-new-droplet.sh
Executable file
@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
function printHelp {
|
||||
echo 'This bash script will create a new droplet. Please input the name for the droplet in PascalCase as a command line argument.'
|
||||
}
|
||||
|
||||
# Check for arguments
|
||||
if [ $# -eq 0 ]
|
||||
then
|
||||
printHelp
|
||||
fi
|
||||
|
||||
# Setup Droplet names
|
||||
dropletName=$1
|
||||
dropletNameWords=$(echo $dropletName | sed 's/\([A-Z][^A-Z]\)/ \1/g')
|
||||
upper=$(echo ${dropletNameWords} | tr '[:lower:]' '[:upper:]')
|
||||
upper="${upper// /_}"
|
||||
lower=$(echo ${upper} | tr '[:upper:]' '[:lower:]')
|
||||
|
||||
# Create copy from template
|
||||
folder=$(dirname "$0")
|
||||
headerFile="${folder}/src/droplets/${lower}_droplet.h"
|
||||
cppFile="${folder}/src/droplets/${lower}_droplet.cpp"
|
||||
cp ${folder}/src/droplets/template_droplet.cpp ${cppFile}
|
||||
cp ${folder}/src/droplets/template_droplet.h ${headerFile}
|
||||
|
||||
# Replace
|
||||
sed -i "s/Template/${dropletName}/g" ${headerFile}
|
||||
sed -i "s/Template/${dropletName}/g" ${cppFile}
|
||||
sed -i "s/template/${lower}/g" ${headerFile}
|
||||
sed -i "s/template/${lower}/g" ${cppFile}
|
||||
sed -i "s/TEMPLATE/${upper}/g" ${headerFile}
|
||||
sed -i "s/TEMPLATE/${upper}/g" ${cppFile}
|
20
src/droplets/template_droplet.cpp
Normal file
20
src/droplets/template_droplet.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
#include "template_droplet.h"
|
||||
|
||||
TemplateDroplet::TemplateDroplet(DaisyPatch* m_patch,
|
||||
DropletState m_state) :
|
||||
Droplet(m_patch,
|
||||
m_state) {
|
||||
}
|
||||
|
||||
void TemplateDroplet::Control() {}
|
||||
|
||||
void TemplateDroplet::Process(AudioHandle::InputBuffer in,
|
||||
AudioHandle::OutputBuffer out,
|
||||
size_t size) {
|
||||
}
|
||||
|
||||
void TemplateDroplet::Draw() {
|
||||
DrawName("Template");
|
||||
}
|
||||
|
||||
void TemplateDroplet::UpdateStateCallback() {}
|
50
src/droplets/template_droplet.h
Normal file
50
src/droplets/template_droplet.h
Normal file
@ -0,0 +1,50 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef DROPLETS_TEMPLATE_DROPLET_H_
|
||||
#define DROPLETS_TEMPLATE_DROPLET_H_
|
||||
|
||||
#include "daisysp.h"
|
||||
#include "daisy_patch.h"
|
||||
|
||||
#include "droplet.h"
|
||||
#include "../util.h"
|
||||
|
||||
class TemplateDroplet: public Droplet {
|
||||
private:
|
||||
public:
|
||||
/*
|
||||
* Constructor for a droplet.
|
||||
*
|
||||
* @param m_patch pointer to patch
|
||||
* @param m_state droplet position
|
||||
*/
|
||||
TemplateDroplet(DaisyPatch*, DropletState);
|
||||
|
||||
/*
|
||||
* Processes user controls and inputs.
|
||||
*/
|
||||
void Control();
|
||||
|
||||
/*
|
||||
* Processes audio input and outputs.
|
||||
*
|
||||
* @param in the audio inputs for the patch
|
||||
* @param out the audio outputs for the patch
|
||||
* @param size the number of inputs and outputs
|
||||
*/
|
||||
void Process(AudioHandle::InputBuffer in,
|
||||
AudioHandle::OutputBuffer out,
|
||||
size_t size);
|
||||
|
||||
/*
|
||||
* Processes information to be shown on the display.
|
||||
*/
|
||||
void Draw();
|
||||
|
||||
/*
|
||||
* Runs when droplet state is updated.
|
||||
*/
|
||||
void UpdateStateCallback();
|
||||
};
|
||||
|
||||
#endif // DROPLETS_TEMPLATE_DROPLET_H_
|
@ -139,8 +139,10 @@ void Menu::Select() {
|
||||
}
|
||||
|
||||
void Menu::Select(MenuItem* item) {
|
||||
if (selected->GetState() != MenuState::kSplit) {
|
||||
if (selected->GetState() != MenuState::kSplit ||
|
||||
selected->GetState() != MenuState::kChange) {
|
||||
buffer = selected;
|
||||
}
|
||||
|
||||
selected = item;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user