- refactored

This commit is contained in:
2025-08-03 10:57:01 +02:00
parent d801ce21e8
commit c0e651bf68
77 changed files with 78326 additions and 88 deletions
+302
View File
@@ -0,0 +1,302 @@
/*
==============================================================================
This is an automatically generated file created by the Jucer!
Creation date: 10 Aug 2012 1:11:16pm
Be careful when adding custom code to these files, as only the code within
the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded
and re-saved.
Jucer version: 1.12
------------------------------------------------------------------------------
The Jucer is part of the JUCE library - "Jules' Utility Class Extensions"
Copyright 2004-6 by Raw Material Software ltd.
==============================================================================
*/
//[Headers] You can add your own extra header files here...
//[/Headers]
#include "ButtonLED.h"
//[MiscUserDefs] You can add your own user definitions and misc code here...
//[/MiscUserDefs]
//==============================================================================
ButtonLED::ButtonLED (const String& name)
: Button (name),
cachedImage_led_23_red_png (0),
cachedImage_led_23_red1_png (0),
triggeredOnMouseDown(0),
clickingTogglesState(0),
clickingLeftMouseButtonTogglesState(1),
clickingMiddleMouseButtonTogglesState(0),
clickingRightMouseButtonTogglesState(0)
{
cachedImage_led_23_red_png = ImageCache::getFromMemory (led_23_red_png, led_23_red_pngSize);
cachedImage_led_23_red1_png = ImageCache::getFromMemory (led_23_red1_png, led_23_red1_pngSize);
//[UserPreSize]
//[/UserPreSize]
setSize (32, 32);
//[Constructor] You can add your own custom stuff here..
//[/Constructor]
}
ButtonLED::~ButtonLED()
{
//[Destructor_pre]. You can add your own custom destruction code here..
//[/Destructor_pre]
//[Destructor]. You can add your own custom destruction code here..
//[/Destructor]
}
//==============================================================================
void ButtonLED::resized()
{
//[UserResized] Add your own custom resize handling here..
//[/UserResized]
}
/*
void ButtonLED::paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown)
{
if (getToggleState())
{
g.setColour (Colours::black);
g.drawImageWithin (cachedImage_led_23_red1_png,
0, 0, 32, 32,
RectanglePlacement::centred,
false);
}
else
{
g.setColour (Colours::black);
g.drawImageWithin (cachedImage_led_23_red_png,
0, 0, 32, 32,
RectanglePlacement::centred,
false);
}
}
*/
void ButtonLED::clicked()
{
//[UserCode_clicked] -- Add your code here...
//[/UserCode_clicked]
}
void ButtonLED::buttonStateChanged()
{
//[UserCode_buttonStateChanged] -- Add your code here...
//[/UserCode_buttonStateChanged]
}
void ButtonLED::mouseWheelMove(const MouseEvent &/*event*/, const MouseWheelDetails &/*wheel*/)
{
}
//[MiscUserCode] You can add your own definitions of your custom methods or any other code here...
bool ButtonLED::getClickingLeftMouseButtonTogglesState (void)
{
return clickingLeftMouseButtonTogglesState;
}
bool ButtonLED::getClickingMiddleMouseButtonTogglesState (void)
{
return clickingMiddleMouseButtonTogglesState;
}
bool ButtonLED::getClickingRightMouseButtonTogglesState (void)
{
return clickingRightMouseButtonTogglesState;
}
void ButtonLED::setClickingLeftMouseButtonTogglesState (bool value)
{
this ->clickingLeftMouseButtonTogglesState = value;
}
void ButtonLED::setClickingMiddleMouseButtonTogglesState (bool value)
{
this ->clickingMiddleMouseButtonTogglesState = value;
}
void ButtonLED::setClickingRightMouseButtonTogglesState (bool value)
{
this ->clickingRightMouseButtonTogglesState = value;
}
void ButtonLED::setTriggeredOnMouseDown (bool triggeredOnMouseDown)
{
Button::setTriggeredOnMouseDown(triggeredOnMouseDown);
}
void ButtonLED::setClickingTogglesState(bool clickingTogglesState)
{
this->clickingTogglesState = clickingTogglesState;
}
bool ButtonLED::getClickingTogglesState(void)
{
return this->clickingTogglesState;
}
void ButtonLED::clicked(const ModifierKeys &modifiers)
{
bool state;
state = getToggleState();
if (modifiers.isLeftButtonDown())
if (!clickingLeftMouseButtonTogglesState)
return;
if (modifiers.isMiddleButtonDown())
if (!clickingMiddleMouseButtonTogglesState)
return;
if (modifiers.isRightButtonDown())
if (!clickingRightMouseButtonTogglesState)
return;
if (clickingTogglesState)
setToggleState(!state, juce::NotificationType::dontSendNotification);
}
void ButtonLED::paintButton (Graphics& g, bool /*isMouseOverButton*/, bool /*isButtonDown*/)
{
if (getToggleState())
{
g.setColour (Colours::black);
g.drawImageWithin (cachedImage_led_23_red1_png,
0, 0, getWidth(), getHeight(),
RectanglePlacement::centred,
false);
}
else
{
g.setColour (Colours::black);
g.drawImageWithin (cachedImage_led_23_red_png,
0, 0, getWidth(), getHeight(),
RectanglePlacement::centred,
false);
}
}
void ButtonLED::flash(uint32_t duration_ms, uint32_t brighness)
{
setToggleState(true, juce::NotificationType::dontSendNotification);
startTimer((uint32_t)duration_ms);
}
void ButtonLED::timerCallback()
{
setToggleState(false, juce::NotificationType::dontSendNotification);
}
//[/MiscUserCode]
//==============================================================================
#if 0
/* -- Jucer information section --
This is where the Jucer puts all of its metadata, so don't change anything in here!
BEGIN_JUCER_METADATA
<JUCER_COMPONENT documentType="Button" className="ButtonLED" componentName="Button LED"
parentClasses="public Button" constructorParams="const String&amp; name"
variableInitialisers="" snapPixels="8" snapActive="1" snapShown="1"
overlayOpacity="0.330000013" fixedSize="0" initialWidth="32"
initialHeight="32">
<METHODS>
<METHOD name="clicked()"/>
<METHOD name="buttonStateChanged()"/>
</METHODS>
<BACKGROUND backgroundColour="0" buttonState="normal" enabled="1">
<IMAGE pos="0 0 32 32" resource="led_23_red_png" opacity="1" mode="1"/>
</BACKGROUND>
<BACKGROUND backgroundColour="0" buttonState="over" enabled="0"/>
<BACKGROUND backgroundColour="0" buttonState="down" enabled="0"/>
<BACKGROUND backgroundColour="0" buttonState="normal on" enabled="1">
<IMAGE pos="0 0 32 32" resource="led_23_red1_png" opacity="1" mode="1"/>
</BACKGROUND>
<BACKGROUND backgroundColour="0" buttonState="over on" enabled="0"/>
<BACKGROUND backgroundColour="0" buttonState="down on" enabled="0"/>
<BACKGROUND backgroundColour="0" buttonState="common background" enabled="1"/>
</JUCER_COMPONENT>
END_JUCER_METADATA
*/
#endif
//==============================================================================
// Binary resources - be careful not to edit any of these sections!
// JUCER_RESOURCE: led_23_red_png, 820, "C:/Users/jens/Pictures/led_23_red.png"
static const unsigned char resource_ButtonLED_led_23_red_png[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,32,0,0,0,32,8,6,0,0,0,115,122,122,244,0,0,0,1,115,82,71,66,0,174,206,28,233,0,0,0,
4,103,65,77,65,0,0,177,143,11,252,97,5,0,0,0,9,112,72,89,115,0,0,14,195,0,0,14,195,1,199,111,168,100,0,0,2,201,73,68,65,84,88,71,237,84,77,79,26,81,20,125,51,128,56,200,48,10,242,49,45,6,148,50,72,45,
137,74,213,64,210,16,43,196,208,32,154,74,109,218,212,29,38,74,237,166,11,235,166,254,0,22,46,92,179,169,174,26,211,96,93,117,221,244,159,116,103,210,29,173,216,152,156,222,59,66,226,162,59,199,38,77,
120,201,201,187,51,239,222,123,206,189,239,67,136,222,232,117,160,215,129,94,7,254,215,14,36,18,9,111,50,153,124,96,24,70,238,159,214,80,169,84,222,44,46,46,54,106,181,218,175,157,157,29,108,111,111,131,
190,207,253,126,255,161,162,40,183,43,38,151,203,45,111,109,109,181,26,141,6,154,205,38,78,78,154,56,58,58,66,189,94,71,181,90,133,174,235,63,169,27,43,183,210,145,124,62,159,221,216,216,104,29,28,28,
224,248,248,35,90,173,31,56,59,251,142,201,201,73,238,0,214,215,215,81,40,20,160,170,42,139,120,111,181,8,185,88,44,30,238,238,238,98,111,111,15,167,167,159,112,121,217,194,254,126,29,195,195,195,112,
58,157,112,187,221,72,167,211,136,70,163,32,242,15,4,217,74,17,246,181,181,181,246,230,230,38,150,150,150,48,59,59,131,233,233,105,208,190,131,246,29,146,36,193,227,81,77,17,154,166,241,119,155,200,251,
173,18,32,5,131,65,163,84,42,161,92,46,155,196,99,99,99,8,4,2,112,185,92,144,108,14,24,70,2,153,204,44,188,222,33,174,190,139,123,100,75,86,136,112,208,190,38,178,217,44,166,166,166,16,139,197,64,130,
224,86,61,144,6,52,40,129,48,50,243,5,100,30,229,232,16,222,185,46,96,142,200,29,86,8,112,201,178,60,154,74,165,218,76,30,10,133,160,122,60,176,15,250,209,63,18,135,158,158,67,118,245,41,50,165,34,84,
22,208,215,199,34,46,8,35,4,197,10,1,78,74,18,165,170,63,155,228,170,10,89,113,195,17,140,32,52,147,65,120,225,49,178,47,159,35,62,159,131,208,117,8,218,22,242,255,194,49,4,142,189,241,232,227,100,118,
187,125,153,200,207,109,202,0,132,234,131,8,142,64,142,39,32,167,82,38,132,97,116,5,240,1,92,237,8,224,216,27,15,62,205,119,9,51,66,150,223,9,215,96,91,120,67,16,209,81,136,241,113,136,137,137,171,153,
175,159,207,119,97,250,176,239,85,140,37,91,96,167,68,94,194,4,161,64,4,175,133,170,125,19,225,240,111,17,137,64,140,146,16,182,53,237,43,173,213,76,159,43,95,142,225,216,27,15,126,80,184,146,48,225,33,
225,9,225,25,225,133,176,217,222,154,130,132,120,213,249,199,107,236,195,190,28,99,217,99,100,163,100,30,66,164,67,144,167,185,68,88,233,128,237,133,206,26,251,176,175,37,213,119,219,199,15,10,39,228,
196,92,221,125,66,154,192,119,157,193,118,146,192,251,222,37,183,228,17,234,10,224,153,19,114,39,184,181,67,4,157,192,119,157,193,54,255,227,53,246,177,156,252,111,66,248,142,51,33,131,237,91,39,190,46,
162,103,247,58,96,89,7,254,0,38,229,208,224,232,174,221,11,0,0,0,0,73,69,78,68,174,66,96,130,0,0};
const char* ButtonLED::led_23_red_png = (const char*) resource_ButtonLED_led_23_red_png;
const int ButtonLED::led_23_red_pngSize = 820;
// JUCER_RESOURCE: led_23_red1_png, 1556, "C:/Users/jens/Pictures/led_23_red1.png"
static const unsigned char resource_ButtonLED_led_23_red1_png[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,32,0,0,0,32,8,6,0,0,0,115,122,122,244,0,0,0,1,115,82,71,66,0,174,206,28,233,0,0,
0,4,103,65,77,65,0,0,177,143,11,252,97,5,0,0,0,9,112,72,89,115,0,0,14,195,0,0,14,195,1,199,111,168,100,0,0,5,169,73,68,65,84,88,71,197,87,11,80,148,85,20,62,139,15,18,36,205,23,246,82,18,199,28,84,124,
101,78,22,154,142,212,48,105,54,49,162,77,106,84,44,67,142,137,174,38,141,137,173,248,66,69,99,65,217,101,97,5,97,137,76,5,241,177,147,47,124,84,12,96,234,16,249,200,199,84,128,89,12,54,129,153,186,66,
167,243,237,254,59,187,12,168,187,232,232,206,124,243,223,189,247,124,223,61,247,156,123,207,127,127,162,182,252,204,172,34,51,123,9,218,43,64,91,213,22,41,247,57,206,9,189,101,50,31,129,159,160,139,2,
180,209,135,49,56,229,229,190,240,189,44,157,19,119,82,38,237,38,79,127,193,83,130,103,21,160,141,62,140,193,25,216,62,0,71,204,220,78,132,58,10,58,11,158,80,38,121,70,158,207,9,158,23,12,82,128,54,250,
48,6,71,96,11,14,184,237,238,181,198,150,227,246,28,99,114,132,20,43,234,46,120,82,208,87,48,64,48,88,48,66,240,162,2,180,209,135,49,216,192,22,28,112,161,1,45,15,246,136,61,236,32,98,21,8,43,4,3,4,88,
105,176,96,148,224,21,193,4,5,104,163,15,99,176,129,45,56,224,66,3,90,110,238,11,251,228,29,4,216,84,93,5,8,105,31,1,86,135,9,176,234,177,130,80,193,36,5,104,163,15,99,176,129,45,56,224,66,3,90,208,188,
135,19,45,67,223,67,72,200,107,127,1,66,140,85,134,8,94,19,188,41,152,170,0,109,244,97,12,54,176,5,7,92,104,184,153,10,187,3,174,171,239,45,255,145,211,129,130,225,130,49,130,137,130,201,202,196,51,229,
9,192,17,244,97,12,54,176,5,7,92,104,184,70,225,14,123,193,89,92,28,187,30,155,232,105,65,160,178,34,132,247,85,65,152,32,92,149,125,235,189,246,250,63,230,119,72,253,45,78,254,207,64,159,50,6,27,216,
34,10,224,66,3,90,142,83,113,135,162,213,60,252,143,11,161,167,0,231,28,249,28,166,172,108,98,39,99,109,100,96,252,206,67,225,171,205,214,168,141,5,60,107,195,87,60,70,163,179,250,168,211,143,169,82,170,
163,92,162,0,14,184,208,128,22,52,239,114,34,236,14,160,120,60,38,64,133,235,37,112,132,127,164,180,67,186,166,94,212,76,209,26,111,36,237,40,102,243,225,147,156,127,172,130,51,247,31,231,21,249,7,57,
114,195,86,238,253,238,202,155,180,230,140,6,182,2,112,28,105,128,22,52,161,141,57,90,73,67,243,138,135,156,33,119,40,46,65,130,81,157,13,191,79,157,188,56,245,70,66,174,133,179,246,151,242,181,127,235,
249,207,134,191,57,104,237,81,126,93,119,128,103,164,236,226,80,109,14,251,69,44,191,73,186,234,8,112,20,46,52,28,251,224,46,21,178,249,6,68,37,195,57,238,39,24,76,57,77,163,135,44,48,238,139,94,151,205,
115,245,5,188,253,196,69,110,108,186,206,73,37,85,220,99,77,57,251,45,59,202,221,227,10,121,228,146,124,14,152,99,98,138,249,250,27,112,108,92,187,6,180,160,233,56,142,173,70,192,245,4,192,24,245,29,155,
104,8,25,235,95,158,16,187,214,26,161,53,240,248,181,22,30,170,175,224,96,253,143,220,99,221,9,246,91,85,206,222,203,75,185,95,82,9,251,125,178,151,187,104,138,88,165,206,179,82,90,237,56,27,215,174,1,
45,143,28,64,5,179,59,176,229,118,176,111,66,201,180,49,177,201,28,178,40,93,66,126,132,251,126,113,130,123,38,157,100,223,245,167,217,75,247,11,79,179,92,102,109,73,13,7,233,79,49,105,15,49,45,42,100,
250,188,100,42,184,46,14,64,211,237,8,56,29,48,93,31,214,241,211,125,211,131,230,108,226,192,185,153,220,119,213,17,246,151,149,251,232,46,178,42,163,150,123,110,187,202,218,74,65,197,21,126,169,232,28,
83,198,247,76,73,22,166,184,61,31,146,112,219,234,128,51,5,134,186,225,180,96,247,219,1,243,54,91,123,47,200,99,255,101,7,217,87,119,129,189,179,235,56,192,210,192,227,203,235,57,225,82,29,107,207,95,
230,62,187,43,152,204,135,153,210,10,111,211,66,203,20,50,92,69,65,106,83,10,156,155,48,165,102,4,205,43,120,171,91,108,206,119,254,241,22,246,75,252,129,85,250,106,238,181,243,47,142,168,104,224,119,
42,235,120,197,133,43,28,94,122,129,41,79,86,111,148,213,47,205,42,3,135,192,245,96,19,58,174,88,56,42,206,99,152,82,51,140,98,119,76,105,23,101,252,204,119,245,113,171,215,198,159,153,114,107,88,181,
187,150,125,14,93,225,78,251,126,229,142,69,103,152,190,44,99,202,60,192,148,188,205,74,234,180,120,112,196,1,164,192,163,99,216,178,16,25,174,14,150,20,132,209,7,233,106,138,49,153,200,120,214,74,5,85,
76,7,4,123,46,49,21,96,242,114,38,83,49,83,202,206,219,20,157,106,18,219,104,210,236,10,35,67,29,142,33,138,153,91,133,200,245,18,226,44,197,166,235,3,41,254,219,113,20,179,101,6,205,212,197,81,148,222,
64,169,71,206,81,209,233,70,218,46,57,207,147,201,51,138,27,73,155,127,150,222,215,25,108,54,176,5,7,92,15,75,49,210,208,252,101,148,211,216,159,146,206,191,64,11,247,78,38,245,230,24,154,149,186,148,
34,211,214,83,84,230,38,250,56,103,43,205,222,146,39,109,189,173,15,99,176,129,45,56,224,186,253,50,194,197,236,78,175,227,140,134,65,180,242,84,136,8,135,83,76,206,108,82,155,226,41,58,43,145,62,50,39,
219,128,182,122,243,18,138,201,157,109,179,129,173,177,30,247,69,15,94,199,78,7,92,239,130,246,11,73,110,83,127,210,203,113,76,172,28,79,139,139,195,73,83,164,166,249,133,26,201,243,98,27,236,237,40,219,
24,108,96,11,142,199,23,18,187,19,173,95,201,114,155,6,80,230,181,225,164,171,10,161,213,149,147,40,161,124,58,45,43,139,180,1,237,196,159,222,176,141,153,254,193,228,109,188,146,57,238,199,119,187,148,
230,254,55,148,178,111,141,150,13,54,86,28,10,181,1,109,244,97,236,190,47,165,173,167,226,33,95,203,157,145,120,68,31,38,174,159,42,143,244,211,172,117,71,30,242,199,105,107,31,118,15,240,243,252,127,
1,108,76,65,198,225,150,95,0,0,0,0,73,69,78,68,174,66,96,130,0,0};
const char* ButtonLED::led_23_red1_png = (const char*) resource_ButtonLED_led_23_red1_png;
const int ButtonLED::led_23_red1_pngSize = 1556;
+102
View File
@@ -0,0 +1,102 @@
/*
==============================================================================
This is an automatically generated file created by the Jucer!
Creation date: 10 Aug 2012 1:11:16pm
Be careful when adding custom code to these files, as only the code within
the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded
and re-saved.
Jucer version: 1.12
------------------------------------------------------------------------------
The Jucer is part of the JUCE library - "Jules' Utility Class Extensions"
Copyright 2004-6 by Raw Material Software ltd.
==============================================================================
*/
#ifndef __JUCER_HEADER_BUTTONLED_BUTTONLED_B8510B75__
#define __JUCER_HEADER_BUTTONLED_BUTTONLED_B8510B75__
//[Headers] -- You can add your own extra header files here --
#include <JuceHeader.h>
//[/Headers]
//==============================================================================
/**
//[Comments]
An auto-generated component, created by the Jucer.
Describe your class and how it works here!
//[/Comments]
*/
class ButtonLED : public Button, public Timer
{
public:
//==============================================================================
ButtonLED (const String& name);
~ButtonLED();
//==============================================================================
//[UserMethods] -- You can add your own custom methods in this section.
void paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown);
void clicked(const ModifierKeys &modifiers);
void mouseWheelMove(const MouseEvent &event, const MouseWheelDetails &wheel);
void timerCallback();
void flash(uint32_t duration_ms, uint32_t brightness);
void setTriggeredOnMouseDown (bool triggeredOnMouseDown);
bool getClickingTogglesState (void);
void setClickingTogglesState (bool clickingTogglesState);
bool getClickingLeftMouseButtonTogglesState (void);
bool getClickingMiddleMouseButtonTogglesState (void);
bool getClickingRightMouseButtonTogglesState (void);
void setClickingLeftMouseButtonTogglesState (bool value);
void setClickingMiddleMouseButtonTogglesState (bool value);
void setClickingRightMouseButtonTogglesState (bool value);
//[/UserMethods]
void resized();
void clicked();
void buttonStateChanged();
// Binary resources:
static const char* led_23_red_png;
static const int led_23_red_pngSize;
static const char* led_23_red1_png;
static const int led_23_red1_pngSize;
//==============================================================================
juce_UseDebuggingNewOperator
private:
//[UserVariables] -- You can add your own custom variables in this section.
bool triggeredOnMouseDown;
bool clickingTogglesState;
bool clickingLeftMouseButtonTogglesState;
bool clickingMiddleMouseButtonTogglesState;
bool clickingRightMouseButtonTogglesState;
//[/UserVariables]
//==============================================================================
Image cachedImage_led_23_red_png;
Image cachedImage_led_23_red1_png;
//==============================================================================
// (prevent copy constructor and operator= being generated..)
ButtonLED (const ButtonLED&);
const ButtonLED& operator= (const ButtonLED&);
};
#endif // __JUCER_HEADER_BUTTONLED_BUTTONLED_B8510B75__
+189
View File
@@ -0,0 +1,189 @@
/*
//#######################################################################################
//Class to insert Midiclock messages into a given MidiBuffer, suitable for block
//based audio callbacks. The class can act on position jumps e.g. "Loops" by sending a
//positioning message.
//NOTE: No ballistik came in to play so I wouldn't recommend using it to drive a mechanical
//tape deck!!!
//
//solar3d-software, April- 10- 2012
//#######################################################################################
*/
#include "JK_MidiClock.h"
JK_MidiClock::JK_MidiClock()
:wasPlaying(false),
syncPpqPosition(-999.0),
posChangeThreshold(0.001),
ppqToStartSyncAt(0.0),
followSongPosition(true),
syncFlag(0),
ppqOffset(0)
{
//Prepare Midi messages to avoid blocking the caller of generateMidiclock()!
continueMessage = new MidiMessage(MidiMessage::midiContinue());
stopMessage = new MidiMessage(MidiMessage::midiStop());
clockMessage = new MidiMessage(MidiMessage::midiClock());
songPositionMessage = new MidiMessage(MidiMessage::songPositionPointer(0));
}
//=================================================================================================
void JK_MidiClock::generateMidiclock(AudioPlayHead::CurrentPositionInfo &lastPosInfo,
MidiBuffer* midiBuffer, const int bufferSize, const double sampleRate)
{
//###################################Some explanation about musical tempo #################
//A Time Signature, is two numbers, one on top of the other. The numerator describes the #
//number of Beats in a Bar, while the denominator describes of what note value a Beat is. #
//So 4/4 would be four quarter-notes per Bar, while 4/2 would be four half-notes per Bar, #
//4/8 would be four eighth-notes per Bar, and 2/4 would be two quarter-notes per Bar. #
//#########################################################################################
if (midiBuffer != nullptr)
{
//PPQ value of one sample
const double ppqPerSample = (lastPosInfo.bpm / 60.0) / sampleRate;
//PPQ offset to compensate Midi interface latency
double hostPpqPosition = lastPosInfo.ppqPosition + ppqOffset * ppqPerSample;;
if (lastPosInfo.isPlaying || lastPosInfo.isRecording)
{
if (! wasPlaying)
{
//set the point where to start the slave
ppqToStartSyncAt = getNearestSixteenthInPPQ(hostPpqPosition);
//Special case: Master is set to always start playback from the previous start position...
if (positionJumped(syncPpqPosition, hostPpqPosition, sampleRate, ppqPerSample))
{
//Cue Midiclock slave to the nearest sixteenth note to new start position
//because the one calculated in stop mode isn't valid anymore.
sendSongPositionPointerMessage(ppqToStartSyncAt, 0, midiBuffer);
}
}
else
{
//Position jump (loop or manually position change while playing)
if (positionJumped(syncPpqPosition, hostPpqPosition, sampleRate, ppqPerSample))
{
//set the point where to start the slave
ppqToStartSyncAt = getNearestSixteenthInPPQ(hostPpqPosition);
//User has changed position manually while playing
if (syncFlag == 0)
{
midiBuffer->addEvent(*stopMessage, 0);
sendSongPositionPointerMessage(hostPpqPosition, 0, midiBuffer);
syncFlag = startSlave_;
}
else
{
if (followSongPosition)
{
sendSongPositionPointerMessage(hostPpqPosition, 0, midiBuffer);
syncFlag = startSlave_;
}
else
syncFlag = 0;
}
}
}
for (int posInBuffer = 0; posInBuffer < bufferSize; ++posInBuffer)
{
syncPpqPosition = hostPpqPosition + (posInBuffer * ppqPerSample);
const int clockDistanceInSamples = roundToInt((60.0 * sampleRate) / (lastPosInfo.bpm * 24.0));
const int64 hostSamplePos = roundToInt64((hostPpqPosition * (60.0 / lastPosInfo.bpm)) * sampleRate);
const int64 syncSamplePos = hostSamplePos + posInBuffer;
//Some hosts like Cubase come up with a wacky ppqPosition
//that could break the timing! Best is to "wait"
//here for the right ppqPosition to jump on.
if (syncPpqPosition >= ppqToStartSyncAt)
{
if ((syncFlag & startSlave_) == startSlave_)
{
midiBuffer->addEvent(*continueMessage, posInBuffer);
syncFlag &= cycleEnd_;
}
//Cycle mode on
if (lastPosInfo.isLooping && lastPosInfo.ppqLoopStart != lastPosInfo.ppqLoopEnd)
{
const double ppqToCycleEnd = fabs(lastPosInfo.ppqLoopEnd - syncPpqPosition);
const int64 samplesToCycleEnd = roundToInt64(ppqToCycleEnd * (60.0 / lastPosInfo.bpm) * sampleRate);
if ((syncFlag & cycleEnd_) == 0)
{
if (samplesToCycleEnd <= clockDistanceInSamples) //For fine tuning tweak here
{
//We have reached the cycle- end position
//and must stop the Midiclock slave here
if (followSongPosition)
midiBuffer->addEvent(*stopMessage, posInBuffer);
syncFlag |= cycleEnd_;
}
}
}
}
//For best timing we should never interupt Midiclock messages!
//Seems that some slaves constantly adjusting their internal clock
//to Midiclock even if they are in stop mode.
if (syncSamplePos % clockDistanceInSamples == 0)
midiBuffer->addEvent(*clockMessage, posInBuffer);
}
wasPlaying = true;
}
else
{
//Send positioning message if the user has stopped or if he changed the playhead position
//manually in stop mode! This will also initially cue slave after loading plugin instance.
if (wasPlaying || positionJumped(syncPpqPosition, hostPpqPosition, sampleRate, ppqPerSample))
{
midiBuffer->addEvent(*stopMessage, 0);
sendSongPositionPointerMessage(hostPpqPosition, 0, midiBuffer);
}
syncPpqPosition = hostPpqPosition;
syncFlag = startSlave_;
wasPlaying = false;
}
}
}
//=================================================================================================
bool JK_MidiClock::positionJumped(const double lastPosInPPQ, const double currentPosInPPQ,
const double sampleRate, const double ppqPerSample)
{
//This returns true if the user has changed the playhead position manually or if
//a jump has occured! The comperator's default threshold is lastPosInPPQ +- 10ms.
if (currentPosInPPQ < lastPosInPPQ - ((posChangeThreshold * sampleRate) * ppqPerSample) ||
currentPosInPPQ > lastPosInPPQ + ((posChangeThreshold * sampleRate) * ppqPerSample))
return true;
return false;
}
//=================================================================================================
void JK_MidiClock::sendSongPositionPointerMessage(const double ppqPosition, const int posInBuffer, MidiBuffer* buffer)
{
//This will cue the slave to the NEAREST
//16th note to the given ppqPosition.
int intBeat = int(ceil(ppqPosition * 4));
uint8* pSongPositionTime((uint8*)(songPositionMessage->getRawData()));
*(pSongPositionTime + 1) = (uint8)(intBeat & 0x7f);
*(pSongPositionTime + 2) = (uint8)((intBeat & 0x3f80)>>7);
buffer->addEvent(*songPositionMessage, posInBuffer);
}
+73
View File
@@ -0,0 +1,73 @@
/*
//#######################################################################################
//Class to insert Midiclock messages into a given MidiBuffer, suitable for block
//based audio callbacks. The class can act on position jumps e.g. "Loops" by sending a
//positioning message.
//NOTE: No ballistik came in to play so I wouldn't recommend using it to drive a mechanical
//tape deck!!!
//
//solar3d-software, April- 10- 2012
//#######################################################################################
*/
#ifndef __JK_MIDICLOCK
#define __JK_MIDICLOCK
#include <JuceHeader.h>
//#include "Includes.h"
class JK_MidiClock
{
public:
JK_MidiClock();
void setPositionJumpThreshold(const double ms) {posChangeThreshold = ms / 1000.0;}
double getPositionJumpThreshold() {return posChangeThreshold;}
void setFollowSongPosition(const bool shouldFollow) {followSongPosition = shouldFollow;}
bool getFollowSongPosition() {return followSongPosition;}
void setOffset(const int offset) {ppqOffset = offset;}
int getOffset() {return ppqOffset;}
void generateMidiclock(AudioPlayHead::CurrentPositionInfo &lastPosInfo,
MidiBuffer* midiBuffer,
const int bufferSize,
const double sampleRate);
//=================================================================================================
juce_UseDebuggingNewOperator
private:
inline int64 roundToInt64 (const double val) noexcept
{
return (val - floor(val) >= 0.5) ? (int64)(ceil(val)) : (int64)(floor(val));
}
bool wasPlaying;
double syncPpqPosition;
double posChangeThreshold;
double ppqToStartSyncAt;
bool followSongPosition;
uint8 syncFlag;
int ppqOffset;
static const int cycleEnd_ = 1;
static const int startSlave_ = 2;
ScopedPointer <MidiMessage> clockMessage;
ScopedPointer <MidiMessage> continueMessage;
ScopedPointer <MidiMessage> stopMessage;
ScopedPointer <MidiMessage> songPositionMessage;
void sendSongPositionPointerMessage(const double ppqPosition, const int posInBuffer, MidiBuffer* buffer);
bool positionJumped(const double lastPosInPPQ, const double currentPosInPPQ,
const double sampleRate, const double ppqPerSample);
double getNearestSixteenthInPPQ(const double ppqPosition) {return ceil(ppqPosition * 4.0) / 4.0;}
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(JK_MidiClock);
};
#endif
File diff suppressed because it is too large Load Diff
+268
View File
@@ -0,0 +1,268 @@
/*
==============================================================================
This file was generated by user!
==============================================================================
*/
#ifndef _JAYSYNTH_H_
#define _JAYSYNTH_H_
#include <synth/synth_defs.h>
#include <synth/param_scale.h>
#include <JuceHeader.h>
#include "JaySynthVoice.h"
#include "JaySynthMonophonicMGR.h"
#define GET_NUM_VOICES max_num_voices
class JaySynthListener
{
public:
virtual void synthChanged(int /*type*/, void* /*pData*/) {};
};
class JaySynthThread : public Thread
{
public:
JaySynthThread(WaitableEvent *pEventRdy, voice_t *pVoices, int num_voices, int offset, int step);
~JaySynthThread();
void go(int len);
AudioSampleBuffer& getBuffer(void);
void run(void);
private:
ScopedPointer<AudioSampleBuffer> m_buffer;
voice_t *m_pVoices;
int m_num_voices;
int m_voice_offset, m_voice_step;
int m_sample_len;
WaitableEvent *m_pEventRdy;
};
class JaySynth : public Synthesiser
{
public:
JaySynth(int num_voices, String pathToWaves);
~JaySynth();
void setSampleRate (synth_float_t sampleRate);
void setBufsize (int bufsize);
void setParam(int paramID, int voice);
void ClearControls(void);
void setControl(int paramID, synth_float_t value);
void setParameter(int paramID, synth_float_t value);
void setPerVoiceControl(int voice, int channel, int paramID, synth_float_t param);
synth_float_t getParameter(int paramID);
synth_float_t getVolume(void);
int lastPitchWheelValue, lastmidiChannel;
void handlePitchWheel (int midiChannel, int wheelValue);
void handleController (int midiChannel, int controllerNumber, int controllerValue);
void updateParameters(void);
void updateParameter(int paramID);
void humanizeModeChanged(void);
void humanizeVarianceChanged_VCO(void);
void humanizeVarianceChanged_VCF(void);
void humanizeVarianceChanged_ENV(void);
void unisonoModeChanged(void);
void humanizeParam (int paramID, bool useRandom, UINT32 random_seed, synth_float_t spread_min, synth_float_t variance);
bool isUnison(void)
{
return m_isUnison;
}
int getUnisonNumberOfVoices(void)
{
return unison_num_voices;
}
// ========================================================================
void advanceNextPossibleVoice(void);
int getNextPossibleVoice(void);
void advanceOldestVoice(void);
int getOldestVoice(void);
void Voicestart (JaySynthVoice* const voice,
SynthesiserSound* const sound,
const int midiChannel,
const int midiNoteNumber,
const float velocity, bool doTrigger);
void Voicestop (JaySynthVoice* voice, const bool allowTailOff);
synth_float_t voiceSetMidiBeat(int quarterBeatCount);
int getNumVoicesPlaying (SynthesiserSound* soundToPlay);
void clearKeysPressed(void);
void setKeyPressed(int key, float vel);
void noteOn (int midiChannel, int midiNoteNumber, float velocity);
void noteOff (int midiChannel, int midiNoteNumber, bool allowTailOff);
void allNotesOff (int midiChannel, bool allowTailOff);
JaySynthVoice* getFreeVoice (SynthesiserSound* soundToPlay,
const bool stealIfNoneAvailable);
void handleMidiEvent (const MidiMessage& m);
void handleSustainPedal (int midiChannel, bool isDown);
void handleSostenutoPedal (int midiChannel, bool isDown);
void handleSoftPedal (int midiChannel, bool isDown);
void renderNextBlock (AudioSampleBuffer& outputAudio,
const MidiBuffer& inputMidi,
int startSample,
int numSamples);
int getNumVoices() const
{
return max_num_voices;
}
JaySynthVoice* getVoice (const int index) const
{
const ScopedLock sl (lock);
return voices [index];
}
void clearVoices()
{
const ScopedLock sl (lock);
voices.clear();
}
void addVoice (JaySynthVoice* const newVoice)
{
const ScopedLock sl (lock);
voices.add (newVoice);
}
void removeVoice (const int index)
{
const ScopedLock sl (lock);
voices.remove (index);
}
// ========================================================================
void addListener(JaySynthListener *listener)
{
listeners.add (listener);
}
enum
{
SYNTH_PER_VOICE_CONTROL_VELKEY = 0,
SYNTH_PER_VOICE_CONTROL_SIZE
};
enum
{
SYNTH_CHANGED_PARAM = 0,
SYNTH_CHANGED_MIDICC,
SYNTH_CHANGED_NUM_VOICES_PLAYING,
SYNTH_CHANGED_NOTE_PRESSED,
SYNTH_CHANGED_NOTE_RELEASED,
SYNTH_CHANGED_MIDICLOCK,
SYNTH_CHANGED_SIZE
};
typedef struct _smidiCC_info_t
{
int channel;
int ID;
synth_float_t value;
} midiCC_info_t;
typedef struct _smidi_note_info_t
{
int note;
synth_float_t velocity;
} midi_note_info_t;
typedef struct _smidi_quarter_clock_info_t
{
uint32_t type;
uint32_t bpm;
} midi_quarter_clock_info_t;
midiCC_info_t* getLastMidiCC_infos(void)
{
return last_midiCC_info;
}
midiCC_info_t* getLastMidiCC_info(int controllerID)
{
if (controllerID < NUM_MIDI_CONTROLLERS)
return &last_midiCC_info[controllerID];
return NULL;
}
midi_note_info_t* getLastMidiNote_infos()
{
return &last_midi_note_info;
}
void setMidiCC_editBuffer(JaySynthMidiCC *pMidiCC)
{
pMidCC_editBuffer = pMidiCC;
}
typedef struct _sper_voice_control_t
{
synth_float_t ctrl[SYNTH_PER_VOICE_CONTROL_SIZE][SYNTH_NUM_PARAMS];
} per_voice_control_t;
//==============================================================================
private:
int m_num_audiothreads;
BigInteger sustainPedalsDown;
int paramID_changed, next_possible_voice, oldest_voice;
JaySynthMidiCC *pMidCC_editBuffer;
midiCC_info_t last_midiCC_info[NUM_MIDI_CONTROLLERS];
midiCC_info_t midiCC_info;
synth_float_t params[SYNTH_NUM_PARAMS];
synth_float_t controls[SYNTH_NUM_PARAMS];
per_voice_control_t *pPer_voice_controls;
synth_float_t master_volume;
synth_float_t humanize_var_vco;
synth_float_t humanize_var_vcf;
synth_float_t humanize_var_env;
voice_common_t synth_common;
param_info_t pb_range[VOICE_NUM_OSC];
bool m_doVcoRestartOnTrigger;
bool doHumanize, isHumanize;
bool m_doMonophon, m_isMonophon;
bool m_doUnison, m_isUnison;
bool m_doMonophonRetrigger;
int m_num_keys_pressed;
int m_num_keys_pressed_last;
int m_highest_key;
int m_highest_key_last;
int m_latest_key;
int m_latest_key_last;
int unison_num_voices;
int max_num_voices, total_num_voices;
param_info_t **humanize_voice_param;
synth_float_t **ppHumanizedSliders;
ListenerList <JaySynthListener> listeners;
OwnedArray <JaySynthVoice> voices;
synth_float_t m_unisonGain;
midi_note_info_t *pCurrNoteInfos;
midi_note_info_t last_midi_note_info;
voice_t *m_pVoices;
JaySynthThread **m_ppAudioThread;
WaitableEvent **m_ppEventAudioThreadRdy;
JaySynthMonophonicMGR m_monoMGR;
const int m_numMidiclocksPerQuarterNote = 24;
const int m_numMidiclocksPerFourQuarterBeats = 4*m_numMidiclocksPerQuarterNote;
int m_clock_cnt_bar;
int m_numMidiClocksPerBeat;
int m_numMidiClocksPerBar;
bool m_isMidiClockStarted;
void updateMidiTiming(const MidiMessage& m);
};
#endif // _JAYSYNTH_H_
File diff suppressed because it is too large Load Diff
+335
View File
@@ -0,0 +1,335 @@
/*
==============================================================================
This is an automatically generated GUI class created by the Introjucer!
Be careful when adding custom code to these files, as only the code within
the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded
and re-saved.
Created with Introjucer version: 3.1.0
------------------------------------------------------------------------------
The Introjucer is part of the JUCE library - "Jules' Utility Class Extensions"
Copyright 2004-13 by Raw Material Software Ltd.
==============================================================================
*/
#ifndef __JUCE_HEADER_AD3FF14AD0EF4DBE__
#define __JUCE_HEADER_AD3FF14AD0EF4DBE__
//[Headers] -- You can add your own extra header files here --
#include <JuceHeader.h>
#include "PluginProcessor.h"
#include "ButtonLED.h"
#include "MidiCC_PopUp.h"
#include "VelKey_PopUp.h"
//[/Headers]
#include "ButtonLED.h"
//==============================================================================
/**
//[Comments]
An auto-generated component, created by the Jucer.
Describe your class and how it works here!
//[/Comments]
*/
class JaySynthAudioProcessorEditor : public AudioProcessorEditor,
public Timer,
public ButtonListener,
public ActionListener,
public MidiCC_PopUp_Listener,
public VelKey_PopUp_Listener,
public SliderListener,
public LabelListener,
public ComboBoxListener
{
public:
//==============================================================================
JaySynthAudioProcessorEditor (JaySynthAudioProcessor* ownerFilter, bool has_wt);
~JaySynthAudioProcessorEditor();
//==============================================================================
//[UserMethods] -- You can add your own custom methods in this section.
void timerCallback();
void update_sliders();
void paramUpdate(int paramID, bool doHostUpdate);
void buttonClicked (Button* buttonThatWasClicked);
void mouseDoubleClick (const MouseEvent &m);
void mouseDown (const MouseEvent &m);
void changeListenerCallback (ChangeBroadcaster* source);
void actionListenerCallback (const String &message);
void MidiCC_PopUp_event(int event);
void VelKey_PopUp_event(int event);
void MidiCC_PopUp_show(Component *componentThatWasClicked);
void VelKey_PopUp_show(Component *componentThatWasClicked);
int ModSrc0_findByName(String name);
int ModSrc1_findByName(String name);
int ModSrcOP_findByName(String name);
int ModSrc1_CB_getIndex(int srcID, int opID);
//[/UserMethods]
void paint (Graphics& g);
void resized();
void sliderValueChanged (Slider* sliderThatWasMoved);
void labelTextChanged (Label* labelThatHasChanged);
void comboBoxChanged (ComboBox* comboBoxThatHasChanged);
// Binary resources:
static const char* led_23_red_png;
static const int led_23_red_pngSize;
static const char* led_23_red1_png;
static const int led_23_red1_pngSize;
private:
//[UserVariables] -- You can add your own custom variables in this section.
JaySynthAudioProcessor* getProcessor() const
{
return static_cast <JaySynthAudioProcessor*> (getAudioProcessor());
}
TooltipWindow *m_tooltipWindow;
MidiCC_PopUp *m_MidiCC_PopUp;
VelKey_PopUp *m_VelKey_PopUp;
String m_mod_src0_names[VOICE_NUM_MOD_SOURCES_0];
String m_mod_src1_names[VOICE_NUM_MOD_SOURCES_1];
String m_mod_src_op_names[VOICE_NUM_MOD_OPS];
String m_mod_src0_cb_names[VOICE_NUM_MOD_SOURCES_0];
String m_mod_src1_cb_names[(VOICE_NUM_MOD_SOURCES_1-1)*VOICE_NUM_MOD_OPS + 1];
File m_fileChooserDirectory;
//[/UserVariables]
//==============================================================================
ScopedPointer<Label> m_label_colon;
ScopedPointer<Slider> m_slider_master_volume;
ScopedPointer<Slider> m_slider_vcf_f;
ScopedPointer<Slider> m_slider_vcf_q;
ScopedPointer<Slider> m_slider_osc0_det;
ScopedPointer<Slider> m_slider_osc1_det;
ScopedPointer<Slider> m_slider_osc0_transpose;
ScopedPointer<Slider> m_slider_osc1_transpose;
ScopedPointer<Slider> m_slider_vca_env_attack;
ScopedPointer<Slider> m_slider_vca_env_decay;
ScopedPointer<Slider> m_slider_vca_env_release;
ScopedPointer<Slider> m_slider_vca_env_sustain;
ScopedPointer<Slider> m_slider_vcf_env_attack;
ScopedPointer<Slider> m_slider_vcf_env_decay;
ScopedPointer<Slider> m_slider_vcf_env_release;
ScopedPointer<Slider> m_slider_vcf_env_sustain;
ScopedPointer<Slider> m_slider_vcf_env_amount;
ScopedPointer<Label> m_label_vcf_env_attack;
ScopedPointer<Label> m_label_vcf_f;
ScopedPointer<Label> m_label_vca_env_attack;
ScopedPointer<Label> m_label_vca_env_decay;
ScopedPointer<Label> m_label_vca_env_sustain;
ScopedPointer<Label> m_label_vca_env_release;
ScopedPointer<Label> m_label_vcf_env_decay;
ScopedPointer<Label> m_label_vcf_env_sustain;
ScopedPointer<Label> m_label_vcf_env_release;
ScopedPointer<Label> m_label_vcf_q;
ScopedPointer<Label> m_label_vcf_env_amount;
ScopedPointer<Label> m_label_master_volume;
ScopedPointer<Label> m_label_osc0_transpose;
ScopedPointer<Label> m_label_osc1_transpose;
ScopedPointer<Label> m_label_osc0_det;
ScopedPointer<Label> m_label_osc1_det;
ScopedPointer<Slider> m_slider_vca_env_amount;
ScopedPointer<Label> m_label_vca_env_amount;
ScopedPointer<Slider> m_slider_osc0_dutycycle;
ScopedPointer<Slider> m_slider_osc1_dutycycle;
ScopedPointer<Label> m_label_osc0_dutycycle;
ScopedPointer<Label> m_label_osc1_dutycycle;
ScopedPointer<Slider> m_slider_lfo0_speed;
ScopedPointer<Slider> m_slider_osc1_fm_amt0;
ScopedPointer<Slider> m_slider_osc0_fm_amt0;
ScopedPointer<Label> m_label_lfo0_speed;
ScopedPointer<Label> m_label_osc0_fm_amt0;
ScopedPointer<Label> m_label_osc1_fm_amt0;
ScopedPointer<Slider> m_slider_vcf_f_amt0;
ScopedPointer<Label> m_label_vcf_f_amt0;
ScopedPointer<Slider> m_slider_lfo1_speed;
ScopedPointer<Label> m_label_lfo1_speed;
ScopedPointer<ComboBox> m_comboBox_osc0_shape;
ScopedPointer<ComboBox> m_comboBox_osc1_shape;
ScopedPointer<ComboBox> m_comboBox_lfo0_shape;
ScopedPointer<ComboBox> m_comboBox_lfo1_shape;
ScopedPointer<Slider> m_slider_lfo2_speed;
ScopedPointer<Slider> m_slider_lfo3_speed;
ScopedPointer<ComboBox> m_comboBox_lfo2_shape;
ScopedPointer<ComboBox> m_comboBox_lfo3_shape;
ScopedPointer<Label> m_label_lfo2_speed;
ScopedPointer<Label> m_label_lfo3_speed;
ScopedPointer<ComboBox> m_comboBox_vcf_f_src0;
ScopedPointer<ComboBox> m_comboBox_osc0_fm_src0;
ScopedPointer<ComboBox> m_comboBox_osc1_fm_src0;
ScopedPointer<Slider> m_slider_vca_am_amt0;
ScopedPointer<Label> m_label_vca_am_amt0;
ScopedPointer<ComboBox> m_comboBox_vca_am_src0;
ScopedPointer<Slider> m_slider_vca_pan_amt0;
ScopedPointer<Label> m_label_vca_pan_amt0;
ScopedPointer<ComboBox> m_comboBox_vca_pan_src0;
ScopedPointer<Label> m_label_synth_name;
ScopedPointer<Label> m_label_synth_version;
ScopedPointer<ComboBox> m_comboBox_vcf_type;
ScopedPointer<Slider> m_slider_lfo1_smooth;
ScopedPointer<Label> m_label_lfo1_smooth;
ScopedPointer<Slider> m_slider_lfo0_smooth;
ScopedPointer<Label> m_label_lfo0_smooth;
ScopedPointer<Slider> m_slider_lfo2_smooth;
ScopedPointer<Label> m_label_lfo2_smooth;
ScopedPointer<Slider> m_slider_lfo3_smooth;
ScopedPointer<Label> m_label_lfo3_smooth;
ScopedPointer<Slider> m_slider_osc0_pwm_amt0;
ScopedPointer<Label> m_label_osc0_pwm_amt0;
ScopedPointer<Slider> m_slider_osc1_pwm_amt0;
ScopedPointer<Label> m_label_osc1_pwm_amt0;
ScopedPointer<ComboBox> m_comboBox_osc0_pwm_src0;
ScopedPointer<ComboBox> m_comboBox_osc1_pwm_src0;
ScopedPointer<Slider> m_slider_osc0_level;
ScopedPointer<Label> m_label_osc0_level;
ScopedPointer<Slider> m_slider_osc1_level;
ScopedPointer<Label> m_label_osc1_level;
ScopedPointer<Slider> m_slider_noise_level;
ScopedPointer<Label> m_label_noise_level;
ScopedPointer<ComboBox> m_comboBox_noise_shape;
ScopedPointer<ButtonLED> m_btn_noise_enable_led;
ScopedPointer<ButtonLED> m_btn_osc0_enable;
ScopedPointer<ButtonLED> m_btn_osc1_enable;
ScopedPointer<Label> m_label_patch_name;
ScopedPointer<TextButton> m_button_patch_incr;
ScopedPointer<TextButton> m_button_patch_decr;
ScopedPointer<Label> m_label_patch_number;
ScopedPointer<Label> m_label_osc1_pb_min;
ScopedPointer<Label> m_label_osc1_pb_max;
ScopedPointer<Label> m_label_osc0_pb_max;
ScopedPointer<Label> m_label_osc0_pb_min;
ScopedPointer<Slider> m_slider_master_tune;
ScopedPointer<Label> m_label_master_tune;
ScopedPointer<ToggleButton> m_button_humanize_enable;
ScopedPointer<ComboBox> m_comboBox_vcf_order;
ScopedPointer<Slider> m_slider_portamento_time;
ScopedPointer<Label> m_label_portamento_time;
ScopedPointer<ToggleButton> m_button_unisono_enable;
ScopedPointer<Slider> m_slider_humanize_var_vco;
ScopedPointer<Slider> m_slider_voice_pan_spread;
ScopedPointer<Label> m_label_voice_pan_spread;
ScopedPointer<Slider> m_slider_humanize_var_vcf;
ScopedPointer<Slider> m_slider_humanize_var_env;
ScopedPointer<Label> m_label_unisono_num_voices;
ScopedPointer<ToggleButton> m_button_osc0_restart_enable;
ScopedPointer<ToggleButton> m_button_osc1_restart_enable;
ScopedPointer<ToggleButton> m_button_mono_enable;
ScopedPointer<ComboBox> m_comboBox_osc1_fm_src1;
ScopedPointer<ComboBox> m_comboBox_osc1_pwm_src1;
ScopedPointer<ComboBox> m_comboBox_osc0_fm_src1;
ScopedPointer<ComboBox> m_comboBox_osc0_pwm_src1;
ScopedPointer<ComboBox> m_comboBox_osc1_am_src0;
ScopedPointer<ComboBox> m_comboBox_osc1_am_src1;
ScopedPointer<Slider> m_slider_osc1_am_amt0;
ScopedPointer<Label> m_label_osc1_am_amt0;
ScopedPointer<ComboBox> m_comboBox_osc0_am_src0;
ScopedPointer<ComboBox> m_comboBox_osc0_am_src1;
ScopedPointer<Slider> m_slider_osc0_am_amt0;
ScopedPointer<Label> m_label_osc0_am_amt0;
ScopedPointer<Slider> m_slider_env2_attack;
ScopedPointer<Slider> m_slider_env2_decay;
ScopedPointer<Slider> m_slider_env2_release;
ScopedPointer<Slider> m_slider_env2_sustain;
ScopedPointer<Label> m_label_env2_attack;
ScopedPointer<Label> m_label_env2_decay;
ScopedPointer<Label> m_label_env2_sustain;
ScopedPointer<Label> m_label_env2_release;
ScopedPointer<Slider> m_slider_env3_attack;
ScopedPointer<Slider> m_slider_env3_decay;
ScopedPointer<Slider> m_slider_env3_release;
ScopedPointer<Slider> m_slider_env3_sustain;
ScopedPointer<Label> m_label_env3_attack;
ScopedPointer<Label> m_label_env3_decay;
ScopedPointer<Label> m_label_env3_sustain;
ScopedPointer<Label> m_label_env3_release;
ScopedPointer<ComboBox> m_comboBox_vcf_f_src1;
ScopedPointer<Slider> m_slider_vcf_q_amt0;
ScopedPointer<Label> m_label_vcf_q_amt0;
ScopedPointer<ComboBox> m_comboBox_vcf_q_src0;
ScopedPointer<ComboBox> m_comboBox_vcf_q_src1;
ScopedPointer<Label> m_label_humanize_var_vco;
ScopedPointer<Label> m_label_humanize_var_vcf;
ScopedPointer<Label> m_label_humanize_var_env;
ScopedPointer<ButtonLED> m_btn_limiter_led;
ScopedPointer<Label> m_label_limiter_led;
ScopedPointer<Slider> m_slider_lfo0_delay;
ScopedPointer<Label> m_label_lfo0_delay;
ScopedPointer<Slider> m_slider_lfo0_attack;
ScopedPointer<Label> m_label_lfo0_attack;
ScopedPointer<Slider> m_slider_lfo1_delay;
ScopedPointer<Label> m_label_lfo1_delay;
ScopedPointer<Slider> m_slider_lfo1_attack;
ScopedPointer<Label> m_label_lfo1_attack;
ScopedPointer<Slider> m_slider_lfo2_delay;
ScopedPointer<Label> m_label_lfo2_delay;
ScopedPointer<Slider> m_slider_lfo2_attack;
ScopedPointer<Label> m_label_lfo2_attack;
ScopedPointer<Slider> m_slider_lfo3_delay;
ScopedPointer<Label> m_label_lfo3_delay;
ScopedPointer<Slider> m_slider_lfo3_attack;
ScopedPointer<Label> m_label_lfo3_attack;
ScopedPointer<ToggleButton> m_button_lfo0_restart_enable;
ScopedPointer<ToggleButton> m_button_lfo0_individual_enable;
ScopedPointer<Slider> m_slider_lfo0_symmetry;
ScopedPointer<Label> m_label_lfo0_symmetry;
ScopedPointer<Slider> m_slider_lfo1_symmetry;
ScopedPointer<Label> m_label_lfo1_symmetry;
ScopedPointer<ToggleButton> m_button_lfo1_restart_enable;
ScopedPointer<ToggleButton> m_button_lfo1_individual_enable;
ScopedPointer<ToggleButton> m_button_lfo2_restart_enable;
ScopedPointer<ToggleButton> m_button_lfo2_individual_enable;
ScopedPointer<Slider> m_slider_lfo2_symmetry;
ScopedPointer<Label> m_label_lfo2_symmetry;
ScopedPointer<Slider> m_slider_lfo3_symmetry;
ScopedPointer<Label> m_label_lfo3_symmetry;
ScopedPointer<ToggleButton> m_button_lfo3_restart_enable;
ScopedPointer<ToggleButton> m_button_lfo3_individual_enable;
ScopedPointer<Slider> m_slider_osc0_fm_amt1;
ScopedPointer<Label> m_label_osc0_fm_amt1;
ScopedPointer<Slider> m_slider_osc0_pwm_amt1;
ScopedPointer<Label> m_label_osc0_pwm_amt1;
ScopedPointer<Slider> m_slider_osc0_am_amt1;
ScopedPointer<Label> m_label_osc0_am_amt1;
ScopedPointer<Slider> m_slider_osc1_fm_amt1;
ScopedPointer<Label> m_label_osc1_fm_amt1;
ScopedPointer<Slider> m_slider_osc1_pwm_amt1;
ScopedPointer<Label> m_label_osc1_pwm_amt1;
ScopedPointer<Slider> m_slider_osc1_am_amt1;
ScopedPointer<Label> m_label_osc1_am_amt1;
ScopedPointer<Slider> m_slider_vcf_f_amt1;
ScopedPointer<Label> m_label_vcf_f_amt1;
ScopedPointer<Slider> m_slider_vcf_q_amt1;
ScopedPointer<Label> m_label_vcf_q_amt1;
ScopedPointer<ToggleButton> m_button_mono_retrigger;
ScopedPointer<Label> m_label_max_num_voices;
ScopedPointer<Label> m_label_num_voices_playing;
ScopedPointer<Label> m_labelDebug;
ScopedPointer<ButtonLED> m_btn_midiClockLed;
ScopedPointer<Label> m_label_lfo0_midisync_factor;
ScopedPointer<Slider> m_slider_lfo0_midisync_divisor;
ScopedPointer<ComboBox> m_comboBox_lfo0_midisync_mode;
ScopedPointer<TextButton> m_button_bank_load;
ScopedPointer<TextButton> m_button_bank_save;
ScopedPointer<TextButton> m_button_patch_load;
ScopedPointer<TextButton> m_button_patch_save;
//==============================================================================
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (JaySynthAudioProcessorEditor)
};
//[EndFile] You can add extra defines here...
//[/EndFile]
#endif // __JUCE_HEADER_AD3FF14AD0EF4DBE__
+739
View File
@@ -0,0 +1,739 @@
/*
==============================================================================
This file was auto-generated!
It contains the basic startup code for a Juce application.
==============================================================================
*/
#include <synth/synth_defs.h>
#include <JuceHeader.h>
#include "JaySynthMidiCC.h"
//==============================================================================
JaySynthMidiCC::JaySynthMidiCC()
{
int i;
param_info_t *pConstraints;
for (i=0; i < SYNTH_NUM_PARAMS; i++)
{
pConstraints = getParamInfo(i);
// Constraints
paramInfoInit(&midiCC_containers[i].constraints, i, pConstraints->pName);
paramInfoSet(&midiCC_containers[i].constraints,
/*base*/pConstraints->base,
/*kexp*/pConstraints->kexp,
/*scenter*/pConstraints->scenter,
/*pmin*/pConstraints->pmin,
/*pcenter*/pConstraints->pcenter,
/*pmax*/pConstraints->pmax,
/*pinterval*/pConstraints->pinterval);
// Control
paramInfoInit(&midiCC_containers[i].control, i, pConstraints->pName);
paramInfoSet(&midiCC_containers[i].control,
/*base*/1,
/*kexp*/1,
/*scenter*/0.5,
/*pmin*/0,
/*pcenter*/-1E18,
/*pmax*/pConstraints->pmax,
/*pinterval*/pConstraints->pinterval);
// Parameters
paramInfoInit(&midiCC_containers[i].param, i, pConstraints->pName);
paramInfoSet(&midiCC_containers[i].param,
/*base*/pConstraints->base,
/*kexp*/pConstraints->kexp,
/*scenter*/pConstraints->scenter,
/*pmin*/pConstraints->pmin,
/*pcenter*/-1E18,
/*pmax*/pConstraints->pmax,
/*pinterval*/pConstraints->pinterval);
midiCC_containers[i].doChangeParameter = false;
midiCC_containers[i].controllerID = 0;
midiCC_containers[i].isAssigned = false;
midiCC_containers[i].doApplyOnPatchInit = false;
// Velocity
paramInfoInit(&midiCC_containers[i].curve_vel, i, pConstraints->pName);
paramInfoSet(&midiCC_containers[i].curve_vel,
/*base*/exp(1.0),
/*kexp*/0,
/*scenter*/0.0,
/*pmin*/0,
/*pcenter*/-1E18,
/*pmax*/1,
/*pinterval*/0);
// Key follow
paramInfoInit(&midiCC_containers[i].curve_key, i, pConstraints->pName);
paramInfoSet(&midiCC_containers[i].curve_key,
/*base*/exp(1.0),
/*kexp*/0,
/*scenter*/0.0,
/*pmin*/0,
/*pcenter*/-1E18,
/*pmax*/1,
/*pinterval*/0);
midiCC_containers[i].isVelAssigned = false;
midiCC_containers[i].isKeyAssigned = false;
midiCC_containers[i].velKeyCombineOP = VELKEY_OP_ADD;
isModified = false;
paramNamedValueSet.set(toParameterNameXML(String(pConstraints->pName)), var(i));
}
}
JaySynthMidiCC::~JaySynthMidiCC()
{
int i;
for (i=0; i < SYNTH_NUM_PARAMS; i++)
{
paramInfoFree(&midiCC_containers[i].constraints);
paramInfoFree(&midiCC_containers[i].control);
paramInfoFree(&midiCC_containers[i].param);
paramInfoFree(&midiCC_containers[i].curve_vel);
paramInfoFree(&midiCC_containers[i].curve_key);
}
for (i=0; i < NUM_MIDI_CONTROLLERS; i++)
removeDestinations(i);
}
JaySynthMidiCC& JaySynthMidiCC::operator= (JaySynthMidiCC& other)
{
if (this != &other)
{
this->copyMidiCC(&other);
}
return *this;
}
void JaySynthMidiCC::copyMidiCC(JaySynthMidiCC const *pSrc)
{
int i;
midiCC_container_t const *pMidiContainerSrc;
midiCC_container_t *pMidiContainerDst;
for (i=0; i < NUM_MIDI_CONTROLLERS; i++)
removeDestinations(i);
pMidiContainerSrc = pSrc->midiCC_containers;
pMidiContainerDst = this->midiCC_containers;
for (i=0; i < SYNTH_NUM_PARAMS; i++)
{
paramInfoCopy(&pMidiContainerDst[i].constraints, &pMidiContainerSrc[i].constraints);
paramInfoCopy(&pMidiContainerDst[i].control, &pMidiContainerSrc[i].control);
paramInfoCopy(&pMidiContainerDst[i].param, &pMidiContainerSrc[i].param);
pMidiContainerDst[i].doChangeParameter = pMidiContainerSrc[i].doChangeParameter;
pMidiContainerDst[i].doApplyOnPatchInit = pMidiContainerSrc[i].doApplyOnPatchInit;
pMidiContainerDst[i].controllerID = pMidiContainerSrc[i].controllerID;
pMidiContainerDst[i].isAssigned = 0;
if (pMidiContainerSrc[i].isAssigned)
{
add(&pMidiContainerDst[i], pMidiContainerSrc[i].controllerID);
}
}
for (i=0; i < SYNTH_NUM_PARAMS; i++)
{
paramInfoCopy(&pMidiContainerDst[i].curve_vel, &pMidiContainerSrc[i].curve_vel);
paramInfoCopy(&pMidiContainerDst[i].curve_key, &pMidiContainerSrc[i].curve_key);
pMidiContainerDst[i].isVelAssigned = pMidiContainerSrc[i].isVelAssigned;
pMidiContainerDst[i].isKeyAssigned = pMidiContainerSrc[i].isKeyAssigned;
pMidiContainerDst[i].velKeyCombineOP = pMidiContainerSrc[i].velKeyCombineOP;
}
isModified = false;
}
bool JaySynthMidiCC::isMidiCCmodified(void) const
{
return isModified;
}
String JaySynthMidiCC::toParameterNameXML (String const &name) const
{
String result;
result = name.removeCharacters (String("."));
result = result.replaceCharacter (' ','_');
return result;
}
int JaySynthMidiCC::findParamID_byName(String name)
{
return (int)paramNamedValueSet.getWithDefault (toParameterNameXML(name), var(-1));
}
void JaySynthMidiCC::exportXML(String name)
{
File file(name);
XmlElement xml ("JSYNTH_MIDICC_TABLE_FILE");
exportXML(&xml);
file.create();
xml.writeToFile (/*const File &destinationFile*/file, /*const String &dtdToUse*/"JSYNTH_MIDICC_TABLE_FILE" /*, const String &encodingType="UTF-8", int lineWrapLength=60*/);
}
void JaySynthMidiCC::exportXML(XmlElement *pXML_doc) const
{
int paramID;
midiCC_container_t const *pMidiContainer;
XmlElement *pXML, *pXML_root, *pXML_PARAM, *pXML_PARAM_INFO;
// Store controller and slider infos
pXML_root = pXML_doc->createNewChildElement (String("JSYNTH_MIDICONTROLLER_TABLE"));
pXML = pXML_root->createNewChildElement (String("TARGETS"));
for (paramID=0; paramID < SYNTH_NUM_PARAMS; paramID++)
{
pMidiContainer = &midiCC_containers[paramID];
pXML_PARAM = pXML->createNewChildElement (String("PARAM_") + String(paramID));
pXML_PARAM->setAttribute ("NAME", toParameterNameXML(pMidiContainer->constraints.pName));
pXML_PARAM->setAttribute ("IS_ASSIGNED", pMidiContainer->isAssigned);
pXML_PARAM->setAttribute ("IS_ABSOLUTE", pMidiContainer->doChangeParameter);
pXML_PARAM->setAttribute ("DO_APPLY_ON_PATCH_INIT", pMidiContainer->doApplyOnPatchInit);
pXML_PARAM->setAttribute ("CONTROLLER_ID", pMidiContainer->controllerID);
pXML_PARAM->setAttribute ("IS_VELOCITY_ASSIGNED", pMidiContainer->isVelAssigned);
pXML_PARAM->setAttribute ("IS_KEYFOLLOW_ASSIGNED", pMidiContainer->isKeyAssigned);
pXML_PARAM->setAttribute ("VELKEY_COMBINE_OP", pMidiContainer->velKeyCombineOP);
pXML_PARAM_INFO = pXML_PARAM->createNewChildElement (String("RELATIVE"));
// pXML_PARAM_INFO->setAttribute ("BASE", String(pMidiContainer->control.base, 10));
// pXML_PARAM_INFO->setAttribute ("KEXP", String(pMidiContainer->control.kexp, 10));
// pXML_PARAM_INFO->setAttribute ("SCENTER", String(pMidiContainer->control.scenter, 10));
pXML_PARAM_INFO->setAttribute ("PMIN", String(pMidiContainer->control.pmin, 10));
pXML_PARAM_INFO->setAttribute ("PMAX", String(pMidiContainer->control.pmax, 10));
// pXML_PARAM_INFO->setAttribute ("PINTERVAL", String(pMidiContainer->control.pinterval, 10));
pXML_PARAM_INFO = pXML_PARAM->createNewChildElement (String("ABSOLUTE"));
// pXML_PARAM_INFO->setAttribute ("BASE", String(pMidiContainer->param.base, 10));
// pXML_PARAM_INFO->setAttribute ("KEXP", String(pMidiContainer->param.kexp, 10));
// pXML_PARAM_INFO->setAttribute ("SCENTER", String(pMidiContainer->param.scenter, 10));
pXML_PARAM_INFO->setAttribute ("PMIN", String(pMidiContainer->param.pmin, 10));
pXML_PARAM_INFO->setAttribute ("PMAX", String(pMidiContainer->param.pmax, 10));
// pXML_PARAM_INFO->setAttribute ("PINTERVAL", String(pMidiContainer->param.pinterval, 10));
pXML_PARAM_INFO = pXML_PARAM->createNewChildElement (String("VELOCITY_CURVE"));
// pXML_PARAM_INFO->setAttribute ("BASE", String(pMidiContainer->curve_vel.base, 10));
pXML_PARAM_INFO->setAttribute ("KEXP", String(pMidiContainer->curve_vel.kexp, 10));
pXML_PARAM_INFO->setAttribute ("SCENTER", String(pMidiContainer->curve_vel.scenter, 10));
pXML_PARAM_INFO->setAttribute ("PMIN", String(pMidiContainer->curve_vel.pmin, 10));
pXML_PARAM_INFO->setAttribute ("PMAX", String(pMidiContainer->curve_vel.pmax, 10));
pXML_PARAM_INFO->setAttribute ("PINTERVAL", String(pMidiContainer->curve_vel.pinterval, 10));
pXML_PARAM_INFO = pXML_PARAM->createNewChildElement (String("KEYFOLLOW_CURVE"));
// pXML_PARAM_INFO->setAttribute ("BASE", String(pMidiContainer->curve_key.base, 10));
pXML_PARAM_INFO->setAttribute ("KEXP", String(pMidiContainer->curve_key.kexp, 10));
pXML_PARAM_INFO->setAttribute ("SCENTER", String(pMidiContainer->curve_key.scenter, 10));
pXML_PARAM_INFO->setAttribute ("PMIN", String(pMidiContainer->curve_key.pmin, 10));
pXML_PARAM_INFO->setAttribute ("PMAX", String(pMidiContainer->curve_key.pmax, 10));
pXML_PARAM_INFO->setAttribute ("PINTERVAL", String(pMidiContainer->curve_key.pinterval, 10));
}
/*
{
int i, controllerID, numDst;
XmlElement *pXML_dst, *pXML_MIDICC;
// todo: romove that in future versions
pXML = pXML_root->createNewChildElement (String("CONTROLLERS"));
// Store MIDI controller assignments
for (controllerID=0; controllerID < NUM_MIDI_CONTROLLERS; controllerID++)
{
pXML_MIDICC = pXML->createNewChildElement (String("MIDICC_") + String(controllerID));
pXML_MIDICC->setAttribute ("ID", controllerID);
pXML_dst = pXML_MIDICC->createNewChildElement (String("TARGETS"));
numDst = getNumDestinations(controllerID);
for (i=0; i < numDst; i++)
{
pMidiContainer = getDestination(controllerID, i);
pXML_dst->setAttribute (String("PARAM") + String(pMidiContainer->constraints.id), pMidiContainer->constraints.pName);
}
}
}
// todo: romove that in future versions
*/
}
int JaySynthMidiCC::importXML(String name)
{
File file(name);
XmlDocument xml(file);
ScopedPointer<XmlElement> pXML_root (xml.getDocumentElement());
return importXML(pXML_root);
}
int JaySynthMidiCC::importXML(XmlElement const *pXML_doc)
{
int i, paramID;
midiCC_container_t *pMidiContainer;
XmlElement *pXML, *pXML_root, *pXML_PARAM, *pXML_PARAM_INFO;
for (i=0; i < NUM_MIDI_CONTROLLERS; i++)
removeDestinations(i);
pXML_root = pXML_doc->getChildByName ("JSYNTH_MIDICONTROLLER_TABLE");
// make sure that it's actually our type of XML object..
if (pXML_root)
{
pXML = pXML_root->getFirstChildElement();
while(pXML)
{
pXML_PARAM = pXML->getFirstChildElement();
while(pXML_PARAM)
{
paramID = findParamID_byName(pXML_PARAM->getStringAttribute("NAME"));
if (paramID < 0)
{
pXML_PARAM = pXML_PARAM->getNextElement();
continue;
}
pMidiContainer = &midiCC_containers[paramID];
pMidiContainer->doChangeParameter = pXML_PARAM->getIntAttribute("IS_ABSOLUTE", pXML_PARAM->getIntAttribute("DO_CHANGE_PARAMETER", 0)) != 0;
pMidiContainer->doApplyOnPatchInit = pXML_PARAM->getIntAttribute("DO_APPLY_ON_PATCH_INIT", 0) != 0;
pMidiContainer->isVelAssigned = pXML_PARAM->getIntAttribute("IS_VELOCITY_ASSIGNED", 0) != 0;
pMidiContainer->isKeyAssigned = pXML_PARAM->getIntAttribute("IS_KEYFOLLOW_ASSIGNED", 0) != 0;
pMidiContainer->velKeyCombineOP = pXML_PARAM->getIntAttribute("VELKEY_COMBINE_OP", VELKEY_OP_ADD);
pXML_PARAM_INFO = pXML_PARAM->getChildByName(String("RELATIVE"));
if (pXML_PARAM_INFO)
{
// pMidiContainer->control.base = pXML_PARAM_INFO->getDoubleAttribute("BASE", pMidiContainer->constraints.base);
// pMidiContainer->control.kexp = pXML_PARAM_INFO->getDoubleAttribute("KEXP", pMidiContainer->constraints.kexp);
// pMidiContainer->control.scenter = pXML_PARAM_INFO->getDoubleAttribute("SCENTER", pMidiContainer->constraints.scenter);
pMidiContainer->control.pmin = pXML_PARAM_INFO->getDoubleAttribute("PMIN", pMidiContainer->constraints.pmin);
pMidiContainer->control.pmax = pXML_PARAM_INFO->getDoubleAttribute("PMAX", pMidiContainer->constraints.pmax);
// pMidiContainer->control.pinterval = pXML_PARAM_INFO->getDoubleAttribute("PINTERVAL", pMidiContainer->constraints.pinterval);
}
pXML_PARAM_INFO = pXML_PARAM->getChildByName(String("ABSOLUTE"));
if (pXML_PARAM_INFO)
{
// pMidiContainer->param.base = pXML_PARAM_INFO->getDoubleAttribute("BASE", pMidiContainer->constraints.base);
// pMidiContainer->param.kexp = pXML_PARAM_INFO->getDoubleAttribute("KEXP", pMidiContainer->constraints.kexp);
// pMidiContainer->param.scenter = pXML_PARAM_INFO->getDoubleAttribute("SCENTER", pMidiContainer->constraints.scenter);
pMidiContainer->param.pmin = pXML_PARAM_INFO->getDoubleAttribute("PMIN", pMidiContainer->constraints.pmin);
pMidiContainer->param.pmax = pXML_PARAM_INFO->getDoubleAttribute("PMAX", pMidiContainer->constraints.pmax);
// pMidiContainer->param.pinterval = pXML_PARAM_INFO->getDoubleAttribute("PINTERVAL", pMidiContainer->constraints.pinterval);
}
pXML_PARAM_INFO = pXML_PARAM->getChildByName(String("VELOCITY_CURVE"));
if (pXML_PARAM_INFO)
{
// pMidiContainer->curve_vel.base = pXML_PARAM_INFO->getDoubleAttribute("BASE", exp(1.0));
pMidiContainer->curve_vel.kexp = pXML_PARAM_INFO->getDoubleAttribute("KEXP", 0);
pMidiContainer->curve_vel.scenter = pXML_PARAM_INFO->getDoubleAttribute("SCENTER", 0.5);
pMidiContainer->curve_vel.pmin = pXML_PARAM_INFO->getDoubleAttribute("PMIN", 0);
pMidiContainer->curve_vel.pmax = pXML_PARAM_INFO->getDoubleAttribute("PMAX", 1);
// pMidiContainer->curve_vel.pinterval = pXML_PARAM_INFO->getDoubleAttribute("PINTERVAL", 0);
}
pXML_PARAM_INFO = pXML_PARAM->getChildByName(String("KEYFOLLOW_CURVE"));
if (pXML_PARAM_INFO)
{
// pMidiContainer->curve_key.base = pXML_PARAM_INFO->getDoubleAttribute("BASE", exp(1.0));
pMidiContainer->curve_key.kexp = pXML_PARAM_INFO->getDoubleAttribute("KEXP", 0);
pMidiContainer->curve_key.scenter = pXML_PARAM_INFO->getDoubleAttribute("SCENTER", 0.5);
pMidiContainer->curve_key.pmin = pXML_PARAM_INFO->getDoubleAttribute("PMIN", 0);
pMidiContainer->curve_key.pmax = pXML_PARAM_INFO->getDoubleAttribute("PMAX", 1);
// pMidiContainer->curve_key.pinterval = pXML_PARAM_INFO->getDoubleAttribute("PINTERVAL", 0);
}
if (pXML_PARAM->getIntAttribute("IS_ASSIGNED", 0))
add(pMidiContainer, pXML_PARAM->getIntAttribute("CONTROLLER_ID", 0));
pXML_PARAM = pXML_PARAM->getNextElement();
}
// todo: romove that in future versions
{
int controllerID;
XmlElement *pXML_MIDICC, *pXML_DST;
pXML = pXML->getNextElement();
while(pXML)
{
pXML_MIDICC = pXML->getFirstChildElement();
while(pXML_MIDICC)
{
controllerID = pXML_MIDICC->getIntAttribute("ID");
pXML_DST = pXML_MIDICC->getFirstChildElement();
if (pXML_DST)
{
for (i=0; i < pXML_DST->getNumAttributes(); i++)
{
paramID = findParamID_byName(pXML_DST->getAttributeValue(i));
if (paramID < 0)
break;
pMidiContainer = &midiCC_containers[paramID];
add(pMidiContainer, controllerID);
}
}
pXML_MIDICC = pXML_MIDICC->getNextElement();
}
pXML = pXML->getNextElement();
}
}
// todo: romove that in future versions
}
}
isModified = false;
return 0;
}
void JaySynthMidiCC::add(midiCC_container_t *pObj, int controllerID)
{
if (controllerID >= NUM_MIDI_CONTROLLERS)
return;
remove(pObj, pObj->controllerID);
if (midiCC_dest[controllerID].contains(pObj))
return;
pObj->isAssigned = 1;
pObj->controllerID = controllerID;
midiCC_dest[controllerID].append(pObj);
isModified = true;
}
void JaySynthMidiCC::remove(midiCC_container_t *pObj, int controllerID)
{
if (controllerID >= NUM_MIDI_CONTROLLERS)
return;
pObj->isAssigned = 0;
if (midiCC_dest[controllerID].contains(pObj))
{
midiCC_dest[controllerID].remove(pObj);
}
isModified = true;
}
struct midiCC_container_t* JaySynthMidiCC::getAtParamID(int paramID)
{
if (paramID >= SYNTH_NUM_PARAMS)
return NULL;
return &midiCC_containers[paramID];
}
int JaySynthMidiCC::getNumDestinations(int controllerID)
{
if (controllerID >= NUM_MIDI_CONTROLLERS)
return 0;
return midiCC_dest[controllerID].size();
}
void JaySynthMidiCC::removeDestinations(int controllerID)
{
int i;
if (controllerID >= NUM_MIDI_CONTROLLERS)
return;
int numDst = getNumDestinations(controllerID);
midiCC_container_t *pDst;
for (i=0; i < numDst; i++)
{
pDst = getDestination(controllerID, 0);
remove(pDst, controllerID);
}
midiCC_dest[controllerID].deleteAll();
isModified = true;
}
midiCC_container_t* JaySynthMidiCC::getDestination(int controllerID, int index)
{
if (controllerID >= NUM_MIDI_CONTROLLERS)
return NULL;
midiCC_container_t *pDst;
if (index >= getNumDestinations(controllerID))
return NULL;
pDst = midiCC_dest[controllerID][index].get();
return pDst;
}
int JaySynthMidiCC::getParamID(midiCC_container_t *pObj)
{
return pObj->constraints.id;
}
int JaySynthMidiCC::getControllerID(midiCC_container_t *pObj)
{
return pObj->controllerID;
}
void JaySynthMidiCC::setControllerID(midiCC_container_t *pObj, int controllerID)
{
if (controllerID >= NUM_MIDI_CONTROLLERS)
return;
if(isAssigned(pObj))
{
remove(pObj, pObj->controllerID);
add(pObj, controllerID);
}
pObj->controllerID = controllerID;
isModified = true;
}
bool JaySynthMidiCC::isAssigned(midiCC_container_t *pObj)
{
return pObj->isAssigned;
}
void JaySynthMidiCC::setDoChangeParameter(midiCC_container_t *pObj, bool doChangeParameter)
{
pObj->doChangeParameter = doChangeParameter;
isModified = true;
}
bool JaySynthMidiCC::doChangeParameter(midiCC_container_t *pObj)
{
return pObj->doChangeParameter;
}
void JaySynthMidiCC::setDoApplyOnPatchInit(midiCC_container_t *pObj, bool doApplyOnPatchInit)
{
pObj->doApplyOnPatchInit = doApplyOnPatchInit;
isModified = true;
}
bool JaySynthMidiCC::doApplyOnPatchInit(midiCC_container_t *pObj)
{
return pObj->doApplyOnPatchInit;
}
synth_float_t JaySynthMidiCC::getConstraintsMin(midiCC_container_t *pObj)
{
return pObj->constraints.pmin;
}
synth_float_t JaySynthMidiCC::getConstraintsMax(midiCC_container_t *pObj)
{
return pObj->constraints.pmax;
}
param_info_t* JaySynthMidiCC::getConstraints(midiCC_container_t *pObj)
{
return &pObj->constraints;
}
synth_float_t JaySynthMidiCC::getControlMin(midiCC_container_t *pObj)
{
return pObj->control.pmin;
}
void JaySynthMidiCC::setControlMin(midiCC_container_t *pObj, synth_float_t value)
{
pObj->control.pmin = value;
isModified = true;
}
synth_float_t JaySynthMidiCC::getControlMax(midiCC_container_t *pObj)
{
return pObj->control.pmax;
}
void JaySynthMidiCC::setControlMax(midiCC_container_t *pObj, synth_float_t value)
{
pObj->control.pmax = value;
isModified = true;
}
param_info_t* JaySynthMidiCC::getControl(midiCC_container_t *pObj)
{
return &pObj->control;
}
synth_float_t JaySynthMidiCC::getParamMin(midiCC_container_t *pObj)
{
return pObj->param.pmin;
}
void JaySynthMidiCC::setParamMin(midiCC_container_t *pObj, synth_float_t value)
{
pObj->param.pmin = value;
isModified = true;
}
synth_float_t JaySynthMidiCC::getParamMax(midiCC_container_t *pObj)
{
return pObj->param.pmax;
}
void JaySynthMidiCC::setParamMax(midiCC_container_t *pObj, synth_float_t value)
{
pObj->param.pmax = value;
isModified = true;
}
param_info_t* JaySynthMidiCC::getParam(midiCC_container_t *pObj)
{
return &pObj->param;
}
param_info_t* JaySynthMidiCC::getVelCurve(midiCC_container_t *pObj)
{
return &pObj->curve_vel;
}
void JaySynthMidiCC::setVelCurveMin(midiCC_container_t *pObj, synth_float_t value)
{
pObj->curve_vel.pmin = value;
isModified = true;
}
void JaySynthMidiCC::setVelCurveMax(midiCC_container_t *pObj, synth_float_t value)
{
pObj->curve_vel.pmax = value;
isModified = true;
}
void JaySynthMidiCC::setVelCurveSkew(midiCC_container_t *pObj, synth_float_t value)
{
pObj->curve_vel.scenter = value;
isModified = true;
}
void JaySynthMidiCC::setVelCurveShape(midiCC_container_t *pObj, synth_float_t value)
{
pObj->curve_vel.kexp = value;
isModified = true;
}
param_info_t* JaySynthMidiCC::getKeyCurve(midiCC_container_t *pObj)
{
return &pObj->curve_key;
}
void JaySynthMidiCC::setKeyCurveMin(midiCC_container_t *pObj, synth_float_t value)
{
pObj->curve_key.pmin = value;
isModified = true;
}
void JaySynthMidiCC::setKeyCurveMax(midiCC_container_t *pObj, synth_float_t value)
{
pObj->curve_key.pmax = value;
isModified = true;
}
void JaySynthMidiCC::setKeyCurveSkew(midiCC_container_t *pObj, synth_float_t value)
{
pObj->curve_key.scenter = value;
isModified = true;
}
void JaySynthMidiCC::setKeyCurveShape(midiCC_container_t *pObj, synth_float_t value)
{
pObj->curve_key.kexp = value;
isModified = true;
}
bool JaySynthMidiCC::isAssignedVel(midiCC_container_t *pObj)
{
return pObj->isVelAssigned;
}
bool JaySynthMidiCC::isAssignedKey(midiCC_container_t *pObj)
{
return pObj->isKeyAssigned;
}
void JaySynthMidiCC::setAssignedVel(midiCC_container_t *pObj, bool active)
{
pObj->isVelAssigned = active;
isModified = true;
}
void JaySynthMidiCC::setAssignedKey(midiCC_container_t *pObj, bool active)
{
pObj->isKeyAssigned = active;
isModified = true;
}
int JaySynthMidiCC::getVelKeyCombineOP(midiCC_container_t *pObj)
{
return pObj->velKeyCombineOP;
}
void JaySynthMidiCC::setVelKeyCombineOP(midiCC_container_t *pObj, int combineOP)
{
if (combineOP >= VELKEY_NUM_OPS)
return;
pObj->velKeyCombineOP = combineOP;
isModified = true;
}
bool JaySynthMidiCC::isAssignedVelKeyControl(int paramID)
{
return isAssignedVel(&midiCC_containers[paramID]) || isAssignedKey(&midiCC_containers[paramID]);
}
synth_float_t JaySynthMidiCC::getVelKeyControl(int paramID, synth_float_t vel, synth_float_t key)
{
synth_float_t result, result_vel, result_key;
result_vel = 0;
result_key = 0;
result = 0;
if (isAssignedVel(&midiCC_containers[paramID]))
result_vel = toParam(&midiCC_containers[paramID].curve_vel, vel);
if (isAssignedKey(&midiCC_containers[paramID]))
result_key = toParam(&midiCC_containers[paramID].curve_key, key/127);
switch (midiCC_containers[paramID].velKeyCombineOP)
{
case VELKEY_OP_ADD:
result = jsy_min(1, jsy_max(-1, result_vel + result_key));
break;
case VELKEY_OP_SUB:
result = jsy_min(1, jsy_max(-1, result_vel - result_key));
break;
case VELKEY_OP_MUL:
if (!isAssignedVel(&midiCC_containers[paramID]))
{
result = result_key;
break;
}
if (!isAssignedKey(&midiCC_containers[paramID]))
{
result = result_vel;
break;
}
result = result_vel * result_key;
break;
default:
break;
}
return midiCC_containers[paramID].constraints.pmax*result;
}
+124
View File
@@ -0,0 +1,124 @@
/*
==============================================================================
This file was auto-generated!
It contains the basic startup code for a Juce application.
==============================================================================
*/
#ifndef _JAYSYNTH_MIDICC_
#define _JAYSYNTH_MIDICC_
#include <JuceHeader.h>
#include <synth/synth_defs.h>
#include <synth/voice.h>
#include <synth/vco.h>
#include <synth/noise.h>
#include <synth/smooth.h>
#include <synth/vcf.h>
#include <synth/lfo.h>
#include <synth/env.h>
#include <synth/param_scale.h>
//==============================================================================
#define MIDICONTROLLER_TYPE_VELKEY 0x00000080
typedef struct midiCC_container_t
{
int controllerID;
bool isAssigned;
bool doChangeParameter;
bool doApplyOnPatchInit;
param_info_t constraints;
param_info_t control;
param_info_t param;
bool isVelAssigned;
bool isKeyAssigned;
param_info_t curve_vel;
param_info_t curve_key;
int velKeyCombineOP;
LinkedListPointer<midiCC_container_t> nextListItem;
} midiCC_container_t;
class JaySynthMidiCC
{
public:
JaySynthMidiCC();
~JaySynthMidiCC();
JaySynthMidiCC& operator= (JaySynthMidiCC& other);
void copyMidiCC(JaySynthMidiCC const *pSrc);
bool isMidiCCmodified(void) const;
String toParameterNameXML (String const &name) const;
int findParamID_byName(String name);
void exportXML(String name);
void exportXML(XmlElement *pXML_doc) const;
int importXML(String name);
int importXML(XmlElement const *pXML_doc);
void add(midiCC_container_t *pObj, int controllerID);
void remove(midiCC_container_t *pObj, int controllerID);
struct midiCC_container_t* getAtParamID(int paramID);
int getNumDestinations(int controllerID);
void removeDestinations(int controllerID);
midiCC_container_t* getDestination(int controllerID, int index);
int getParamID(midiCC_container_t *pObj);
int getControllerID(midiCC_container_t *pObj);
void setControllerID(midiCC_container_t *pObj, int controllerID);
bool isAssigned(midiCC_container_t *pObj);
void setDoChangeParameter(midiCC_container_t *pObj, bool doChangeParameter);
bool doChangeParameter(midiCC_container_t *pObj);
void setDoApplyOnPatchInit(midiCC_container_t *pObj, bool doApplyOnPatchInit);
bool doApplyOnPatchInit(midiCC_container_t *pObj);
synth_float_t getConstraintsMin(midiCC_container_t *pObj);
synth_float_t getConstraintsMax(midiCC_container_t *pObj);
param_info_t* getConstraints(midiCC_container_t *pObj);
synth_float_t getControlMin(midiCC_container_t *pObj);
void setControlMin(midiCC_container_t *pObj, synth_float_t value);
synth_float_t getControlMax(midiCC_container_t *pObj);
void setControlMax(midiCC_container_t *pObj, synth_float_t value);
param_info_t* getControl(midiCC_container_t *pObj);
synth_float_t getParamMin(midiCC_container_t *pObj);
void setParamMin(midiCC_container_t *pObj, synth_float_t value);
synth_float_t getParamMax(midiCC_container_t *pObj);
void setParamMax(midiCC_container_t *pObj, synth_float_t value);
param_info_t* getParam(midiCC_container_t *pObj);
param_info_t* getVelCurve(midiCC_container_t *pObj);
void setVelCurveMin(midiCC_container_t *pObj, synth_float_t value);
void setVelCurveMax(midiCC_container_t *pObj, synth_float_t value);
void setVelCurveSkew(midiCC_container_t *pObj, synth_float_t value);
void setVelCurveShape(midiCC_container_t *pObj, synth_float_t value);
param_info_t* getKeyCurve(midiCC_container_t *pObj);
void setKeyCurveMin(midiCC_container_t *pObj, synth_float_t value);
void setKeyCurveMax(midiCC_container_t *pObj, synth_float_t value);
void setKeyCurveSkew(midiCC_container_t *pObj, synth_float_t value);
void setKeyCurveShape(midiCC_container_t *pObj, synth_float_t value);
bool isAssignedVel(midiCC_container_t *pObj);
bool isAssignedKey(midiCC_container_t *pObj);
void setAssignedVel(midiCC_container_t *pObj, bool active);
void setAssignedKey(midiCC_container_t *pObj, bool active);
int getVelKeyCombineOP(midiCC_container_t *pObj);
void setVelKeyCombineOP(midiCC_container_t *pObj, int combineOP);
bool isAssignedVelKeyControl(int paramID);
synth_float_t getVelKeyControl(int paramID, synth_float_t vel, synth_float_t key);
enum
{
VELKEY_OP_ADD = 0,
VELKEY_OP_SUB,
VELKEY_OP_MUL,
VELKEY_NUM_OPS
};
private:
midiCC_container_t midiCC_containers[SYNTH_NUM_PARAMS];
LinkedListPointer <midiCC_container_t> midiCC_dest[NUM_MIDI_CONTROLLERS];
NamedValueSet paramNamedValueSet;
bool isModified;
};
#endif // _JAYSYNTH_MIDICC_
+136
View File
@@ -0,0 +1,136 @@
/*
==============================================================================
This file was generated by user!
==============================================================================
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <synth/synth_defs.h>
#include "JaySynthMonophonicMGR.h"
/** A JaySynth voice that just plays incredible sounds.. */
JaySynthMonophonicMGR::JaySynthMonophonicMGR()
{
init();
}
JaySynthMonophonicMGR::~JaySynthMonophonicMGR()
{
}
void JaySynthMonophonicMGR::init(void)
{
int i;
memset (keys, 0, sizeof(keys));
for (i=0; i < 128; i++)
keys[i].note = i;
pLatest = NULL;
}
void JaySynthMonophonicMGR::add(int note, float vel)
{
if ((note < 0) || (note > 127))
return;
// Delete if velocity == 0
if (vel == 0)
{
del(note);
return;
}
// Delete first if note already exists
if (keys[note].vel > 0)
del(note);
// Add key
keys[note].vel = vel;
keys[note].pPrev = NULL;
keys[note].pNext = pLatest;
if (pLatest)
pLatest->pPrev = &keys[note];
pLatest = &keys[note];
}
void JaySynthMonophonicMGR::del(int note)
{
if ((note < 0) || (note > 127))
return;
if (keys[note].pPrev)
keys[note].pPrev->pNext = keys[note].pNext;
if (keys[note].pNext)
keys[note].pNext->pPrev = keys[note].pPrev;
// Do I delete the newest note
if (!keys[note].pPrev)
pLatest = keys[note].pNext;
keys[note].vel = 0;
keys[note].pPrev = NULL;
keys[note].pNext = NULL;
}
int JaySynthMonophonicMGR::getNumNotes(void)
{
key_linkedlist_t *pKey = pLatest;
int num_notes = 0;
while(pKey)
{
num_notes++;
pKey = pKey->pNext;
}
return num_notes;
}
int JaySynthMonophonicMGR::getLatestNote(void)
{
if (!pLatest)
return -1;
return pLatest->note;
}
int JaySynthMonophonicMGR::getHighestNote(void)
{
key_linkedlist_t *pKey = pLatest;
int note = -1;
while(pKey)
{
if (note < pKey->note)
note = pKey->note;
pKey = pKey->pNext;
}
if (note < 0)
return -1;
return keys[note].note;
}
float JaySynthMonophonicMGR::getVel(int note)
{
if ((note < 0) || (note > 127))
return 0;
return keys[note].vel;
}
+38
View File
@@ -0,0 +1,38 @@
/*
==============================================================================
This file was generated by user!
==============================================================================
*/
#ifndef _JAYSYNTHMONOPHONICMGR_H_
#define _JAYSYNTHMONOPHONICMGR_H_
class JaySynthMonophonicMGR
{
public:
JaySynthMonophonicMGR();
~JaySynthMonophonicMGR();
void init(void);
void add(int note, float vel);
void del(int note);
int getNumNotes(void);
int getLatestNote(void);
int getHighestNote(void);
float getVel(int note);
private:
typedef struct _skey_linkedlist_t
{
int note;
float vel;
struct _skey_linkedlist_t *pPrev, *pNext;
} key_linkedlist_t;
key_linkedlist_t keys[128];
key_linkedlist_t *pLatest;
};
#endif // _JAYSYNTHMONOPHONICMGR_H_
+182
View File
@@ -0,0 +1,182 @@
/*
==============================================================================
This file was generated by user!
==============================================================================
*/
#include <math.h>
#include <synth/synth_defs.h>
#include "JaySynthSound.h"
JaySynthSound::JaySynthSound()
{
name = String("Default");
// Default is "Jump" sound
setParameter(SYNTH_PARAM_VOLUME, 100);
setParameter(SYNTH_PARAM_VOICE_PAN_SPREAD, 50);
setParameter(SYNTH_PARAM_TUNE, 0);
setParameter(SYNTH_PARAM_TOTAL_NUM_VOICES, MAX_POLYPHONY);
setParameter(SYNTH_PARAM_HUMANIZE_ENABLE, 0);
setParameter(SYNTH_PARAM_HUMANIZE_VAR_VCO, 0);
setParameter(SYNTH_PARAM_HUMANIZE_VAR_VCF, 0);
setParameter(SYNTH_PARAM_HUMANIZE_VAR_ENV, 0);
setParameter(SYNTH_PARAM_MONOPHONIC_ENABLE, 0);
setParameter(SYNTH_PARAM_MONOPHONIC_RETRIGGER_ENABLE, 0);
setParameter(SYNTH_PARAM_UNISONO_ENABLE, 0);
setParameter(SYNTH_PARAM_UNISONO_NUM_VOICES, 8);
setParameter(SYNTH_PARAM_PORTAMENTO_TIME, 0.0);
setParameter(SYNTH_PARAM_OSC_0_ENABLE, 1);
setParameter(SYNTH_PARAM_OSC_1_ENABLE, 1);
setParameter(SYNTH_PARAM_OSC_0_RESTART_ON_TRIGGER, 0);
setParameter(SYNTH_PARAM_OSC_1_RESTART_ON_TRIGGER, 0);
setParameter(SYNTH_PARAM_OSC_0_LEVEL, 100);
setParameter(SYNTH_PARAM_OSC_1_LEVEL, 100);
setParameter(SYNTH_PARAM_OSC_0_DUTYCYCLE, 50);
setParameter(SYNTH_PARAM_OSC_1_DUTYCYCLE, 50);
setParameter(SYNTH_PARAM_OSC_0_DETUNE, -4);
setParameter(SYNTH_PARAM_OSC_1_DETUNE, +4);
setParameter(SYNTH_PARAM_OSC_0_TRANSPOSE, 0);
setParameter(SYNTH_PARAM_OSC_1_TRANSPOSE, 0);
setParameter(SYNTH_PARAM_OSC_0_WAVEFORM, 0);
setParameter(SYNTH_PARAM_OSC_1_WAVEFORM, 0);
setParameter(SYNTH_PARAM_OSC_0_PB_RANGE_MIN, -12);
setParameter(SYNTH_PARAM_OSC_1_PB_RANGE_MIN, -12);
setParameter(SYNTH_PARAM_OSC_0_PB_RANGE_MAX, +12);
setParameter(SYNTH_PARAM_OSC_1_PB_RANGE_MAX, +12);
setParameter(SYNTH_PARAM_OSC_0_FM_AMT_0, 0);
setParameter(SYNTH_PARAM_OSC_1_FM_AMT_0, 0);
setParameter(SYNTH_PARAM_OSC_0_FM_AMT_1, 0);
setParameter(SYNTH_PARAM_OSC_1_FM_AMT_1, 0);
setParameter(SYNTH_PARAM_OSC_0_FM_SRC_0, 0);
setParameter(SYNTH_PARAM_OSC_1_FM_SRC_0, 0);
setParameter(SYNTH_PARAM_OSC_0_FM_SRC_1, 0);
setParameter(SYNTH_PARAM_OSC_1_FM_SRC_1, 0);
setParameter(SYNTH_PARAM_OSC_0_FM_SRC_OP, VOICE_MOD_SRC_OP_ADD);
setParameter(SYNTH_PARAM_OSC_1_FM_SRC_OP, VOICE_MOD_SRC_OP_ADD);
setParameter(SYNTH_PARAM_OSC_0_AM_AMT_0, 0);
setParameter(SYNTH_PARAM_OSC_1_AM_AMT_0, 0);
setParameter(SYNTH_PARAM_OSC_0_AM_AMT_1, 0);
setParameter(SYNTH_PARAM_OSC_1_AM_AMT_1, 0);
setParameter(SYNTH_PARAM_OSC_0_AM_SRC_0, 0);
setParameter(SYNTH_PARAM_OSC_1_AM_SRC_0, 0);
setParameter(SYNTH_PARAM_OSC_0_AM_SRC_1, 0);
setParameter(SYNTH_PARAM_OSC_1_AM_SRC_1, 0);
setParameter(SYNTH_PARAM_OSC_0_AM_SRC_OP, VOICE_MOD_SRC_OP_ADD);
setParameter(SYNTH_PARAM_OSC_1_AM_SRC_OP, VOICE_MOD_SRC_OP_ADD);
setParameter(SYNTH_PARAM_OSC_0_PWM_AMT_0, 0);
setParameter(SYNTH_PARAM_OSC_1_PWM_AMT_0, 0);
setParameter(SYNTH_PARAM_OSC_0_PWM_AMT_1, 0);
setParameter(SYNTH_PARAM_OSC_1_PWM_AMT_1, 0);
setParameter(SYNTH_PARAM_OSC_0_PWM_SRC_0, 0);
setParameter(SYNTH_PARAM_OSC_1_PWM_SRC_0, 0);
setParameter(SYNTH_PARAM_OSC_0_PWM_SRC_1, 0);
setParameter(SYNTH_PARAM_OSC_1_PWM_SRC_1, 0);
setParameter(SYNTH_PARAM_OSC_0_PWM_SRC_OP, VOICE_MOD_SRC_OP_ADD);
setParameter(SYNTH_PARAM_OSC_1_PWM_SRC_OP, VOICE_MOD_SRC_OP_ADD);
setParameter(SYNTH_PARAM_NOISE_ENABLE, 0);
setParameter(SYNTH_PARAM_NOISE_LEVEL, 50);
setParameter(SYNTH_PARAM_NOISE_SHAPE, VOICE_NOISE_SHAPE_WHITE);
setParameter(SYNTH_PARAM_VCA_ENV_AMT, 100);
setParameter(SYNTH_PARAM_VCA_ENV_A, 1);
setParameter(SYNTH_PARAM_VCA_ENV_D, 1000);
setParameter(SYNTH_PARAM_VCA_ENV_S, 0);
setParameter(SYNTH_PARAM_VCA_ENV_R, 150);
setParameter(SYNTH_PARAM_VCF_ENV_A, 1);
setParameter(SYNTH_PARAM_VCF_ENV_D, 1000);
setParameter(SYNTH_PARAM_VCF_ENV_S, 0);
setParameter(SYNTH_PARAM_VCF_ENV_R, 500);
setParameter(SYNTH_PARAM_ENV_2_A, 1);
setParameter(SYNTH_PARAM_ENV_2_D, 1000);
setParameter(SYNTH_PARAM_ENV_2_S, 0);
setParameter(SYNTH_PARAM_ENV_2_R, 500);
setParameter(SYNTH_PARAM_ENV_3_A, 1);
setParameter(SYNTH_PARAM_ENV_3_D, 1000);
setParameter(SYNTH_PARAM_ENV_3_S, 0);
setParameter(SYNTH_PARAM_ENV_3_R, 500);
setParameter(SYNTH_PARAM_VCF_TYPE, VCF_FILTERTYPE_LOWPASS);
setParameter(SYNTH_PARAM_VCF_ORDER, VCF_FILTERORDER_4);
setParameter(SYNTH_PARAM_VCF_F, FILTER_F_MAX);
setParameter(SYNTH_PARAM_VCF_Q, 1.0);
setParameter(SYNTH_PARAM_VCF_ENV_AMT, 0);
setParameter(SYNTH_PARAM_LFO_0_SPEED, 1.f);
setParameter(SYNTH_PARAM_LFO_1_SPEED, 1.f);
setParameter(SYNTH_PARAM_LFO_2_SPEED, 1.f);
setParameter(SYNTH_PARAM_LFO_3_SPEED, 1.f);
setParameter(SYNTH_PARAM_LFO_0_SMOOTH, 0.0);
setParameter(SYNTH_PARAM_LFO_1_SMOOTH, 0.0);
setParameter(SYNTH_PARAM_LFO_2_SMOOTH, 0.0);
setParameter(SYNTH_PARAM_LFO_3_SMOOTH, 0.0);
setParameter(SYNTH_PARAM_LFO_0_DELAY, 0.0);
setParameter(SYNTH_PARAM_LFO_1_DELAY, 0.0);
setParameter(SYNTH_PARAM_LFO_2_DELAY, 0.0);
setParameter(SYNTH_PARAM_LFO_3_DELAY, 0.0);
setParameter(SYNTH_PARAM_LFO_0_ATTACK, 0.0);
setParameter(SYNTH_PARAM_LFO_1_ATTACK, 0.0);
setParameter(SYNTH_PARAM_LFO_2_ATTACK, 0.0);
setParameter(SYNTH_PARAM_LFO_3_ATTACK, 0.0);
setParameter(SYNTH_PARAM_LFO_0_SHAPE, LFO_WAVEFORM_SINE);
setParameter(SYNTH_PARAM_LFO_1_SHAPE, LFO_WAVEFORM_SINE);
setParameter(SYNTH_PARAM_LFO_2_SHAPE, LFO_WAVEFORM_SINE);
setParameter(SYNTH_PARAM_LFO_3_SHAPE, LFO_WAVEFORM_SINE);
setParameter(SYNTH_PARAM_LFO_0_MODE, VOICE_LFO_MODE_GLOBAL);
setParameter(SYNTH_PARAM_LFO_1_MODE, VOICE_LFO_MODE_GLOBAL);
setParameter(SYNTH_PARAM_LFO_2_MODE, VOICE_LFO_MODE_GLOBAL);
setParameter(SYNTH_PARAM_LFO_3_MODE, VOICE_LFO_MODE_GLOBAL);
setParameter(SYNTH_PARAM_LFO_0_SYNC, VOICE_LFO_SYNC_FREE);
setParameter(SYNTH_PARAM_LFO_1_SYNC, VOICE_LFO_SYNC_FREE);
setParameter(SYNTH_PARAM_LFO_2_SYNC, VOICE_LFO_SYNC_FREE);
setParameter(SYNTH_PARAM_LFO_3_SYNC, VOICE_LFO_SYNC_FREE);
setParameter(SYNTH_PARAM_LFO_0_SYMMETRY, 0);
setParameter(SYNTH_PARAM_LFO_1_SYMMETRY, 0);
setParameter(SYNTH_PARAM_LFO_2_SYMMETRY, 0);
setParameter(SYNTH_PARAM_LFO_3_SYMMETRY, 0);
setParameter(SYNTH_PARAM_VCF_F_AMT_0, 0);
setParameter(SYNTH_PARAM_VCF_F_AMT_1, 0);
setParameter(SYNTH_PARAM_VCF_F_SRC_0, 0);
setParameter(SYNTH_PARAM_VCF_F_SRC_1, 0);
setParameter(SYNTH_PARAM_VCF_F_SRC_OP, 0);
setParameter(SYNTH_PARAM_VCF_Q_AMT_0, 0);
setParameter(SYNTH_PARAM_VCF_Q_AMT_1, 0);
setParameter(SYNTH_PARAM_VCF_Q_SRC_0, 0);
setParameter(SYNTH_PARAM_VCF_Q_SRC_1, 0);
setParameter(SYNTH_PARAM_VCF_Q_SRC_OP, 0);
setParameter(SYNTH_PARAM_VCA_AM_AMT_0, 0);
setParameter(SYNTH_PARAM_VCA_AM_SRC_0, 0);
setParameter(SYNTH_PARAM_VCA_PAN_AMT_0, 0);
setParameter(SYNTH_PARAM_VCA_PAN_SRC_0, 0);
}
JaySynthSound::~JaySynthSound()
{
}
const JaySynthMidiCC* JaySynthSound::getMidiCC() const
{
return &m_midiCC;
}
void JaySynthSound::setName(String ProgramName)
{
name = ProgramName;
}
String JaySynthSound::getName(void) const
{
return name;
}
void JaySynthSound::setParameter(int index, synth_float_t param)
{
parameter[index] = param;
}
synth_float_t JaySynthSound::getParameter(int index) const
{
return parameter[index];
}
+48
View File
@@ -0,0 +1,48 @@
/*
==============================================================================
This file was generated by user!
==============================================================================
*/
#ifndef _JAYSYNTHSOUND_H_
#define _JAYSYNTHSOUND_H_
#include <JuceHeader.h>
#include <synth/synth_defs.h>
#include <synth/voice.h>
#include <synth/vco.h>
#include <synth/noise.h>
#include <synth/smooth.h>
#include <synth/vcf.h>
#include <synth/lfo.h>
#include <synth/env.h>
#include <synth/param_scale.h>
#include "JaySynthMidiCC.h"
//==============================================================================
/** A synth sound that's just a bunch of parameters that makes an incredible sound.. */
class JaySynthSound : public SynthesiserSound
{
public:
synth_float_t parameter[SYNTH_NUM_PARAMS];
String name;
JaySynthSound();
~JaySynthSound();
JaySynthMidiCC m_midiCC;
const JaySynthMidiCC* getMidiCC() const;
void setName(String ProgramName);
String getName(void) const;
void setParameter(int index, synth_float_t param);
synth_float_t getParameter(int index) const;
void initParameter(int index, synth_float_t param);
bool appliesToNote (const int /*midiNoteNumber*/) { return true; }
bool appliesToChannel (const int /*midiChannel*/) { return true; }
};
#endif // _JAYSYNTHSOUND_H_
+104
View File
@@ -0,0 +1,104 @@
/*
==============================================================================
This file was generated by user!
==============================================================================
*/
#include <math.h>
#include "JaySynthSound.h"
#include "JaySynthVoice.h"
/** A JaySynth voice that just plays incredible sounds.. */
JaySynthVoice::JaySynthVoice(voice_t *pVoice, int id, voice_common_t *pCom)
{
m_pVoice = pVoice;
VoiceInit(pVoice, pCom, id, 44100);
}
JaySynthVoice::~JaySynthVoice()
{
VoiceFree(m_pVoice);
}
void JaySynthVoice::setSampleRate (synth_float_t sampleRate)
{
VoiceSetFS(m_pVoice, sampleRate);
}
void JaySynthVoice::setBufsize (int bufsize)
{
VoiceSetBufsize(m_pVoice, bufsize);
}
bool JaySynthVoice::canPlaySound (SynthesiserSound* sound)
{
return dynamic_cast <JaySynthSound*> (sound) != 0;
}
void JaySynthVoice::startNote (const int midiNoteNumber, const float velocity,
SynthesiserSound* sound, const int /*currentPitchWheelPosition*/)
{
VoiceEvent(m_pVoice, voice_event_trigger);
return;
/*
if (m_pVoice->state == note_state_idle)
{
VoiceEvent(m_pVoice, voice_event_trigger);
}
else
{
VoiceEvent(m_pVoice, voice_event_retrigger);
}
*/
}
void JaySynthVoice::stopNote (const bool allowTailOff)
{
if (allowTailOff)
{
VoiceEvent(m_pVoice, voice_event_release);
}
else
{
// we're being told to stop playing immediately, so reset everything..
VoiceEvent(m_pVoice, voice_event_release);
clearCurrentNote();
}
}
void JaySynthVoice::pitchWheelMoved (const int /*newValue*/)
{
}
void JaySynthVoice::controllerMoved (const int /*controllerNumber*/, const int /*newValue*/)
{
}
void JaySynthVoice::renderNextBlock (AudioSampleBuffer& outputBuffer, int startSample, int numSamples)
{
/* Done in JaySynth::renderNextBlock()
float *buf1 = outputBuffer.getSampleData (0, startSample);
float *buf2 = outputBuffer.getSampleData (1, startSample);
VoiceProcessDataV_Common(m_pVoice, buf1, buf2, numSamples);
if (m_pVoice->state == note_state_idle)
return;
VoiceProcessDataV(m_pVoice, buf1, buf2, numSamples);
if (m_pVoice->state == note_state_idle)
clearCurrentNote();
*/
}
void JaySynthVoice::setParameter(int index, synth_float_t value)
{
VoiceParam2Set(m_pVoice, index, value);
}
+83
View File
@@ -0,0 +1,83 @@
/*
==============================================================================
This file was generated by user!
==============================================================================
*/
#ifndef _JAYSYNTHVOICE_H_
#define _JAYSYNTHVOICE_H_
#include <JuceHeader.h>
#include <synth/synth_defs.h>
class JaySynthVoice
{
public:
JaySynthVoice(voice_t *pVoice, int id, voice_common_t *pCom);
~JaySynthVoice();
void setSampleRate (synth_float_t sampleRate);
void setBufsize (int bufsize);
bool canPlaySound (SynthesiserSound* sound);
void startNote (const int midiNoteNumber, const float velocity,
SynthesiserSound* /*sound*/, const int /*currentPitchWheelPosition*/);
void stopNote (const bool allowTailOff);
void pitchWheelMoved (const int newValue);
void controllerMoved (const int controllerNumber, const int newValue);
void renderNextBlock (AudioSampleBuffer& outputBuffer, int startSample, int numSamples);
void setParameter(int index, synth_float_t value);
int getCurrentlyPlayingNote() const
{
return currentlyPlayingNote;
}
SynthesiserSound::Ptr getCurrentlyPlayingSound() const
{
return currentlyPlayingSound;
}
bool isPlayingChannel (int midiChannel) const
{
return currentlyPlayingSound != nullptr
&& currentlyPlayingSound->appliesToChannel (midiChannel);
}
void setCurrentPlaybackSampleRate (double newRate)
{
currentSampleRate = newRate;
}
double getSampleRate() const
{
return currentSampleRate;
}
void clearCurrentNote()
{
currentlyPlayingNote = -1;
currentlyPlayingSound = nullptr;
}
void setMidiBeat(int beatCounter)
{
}
private:
friend class JaySynth;
voice_t *m_pVoice;
synth_float_t note_on_time;
double currentSampleRate;
int currentlyPlayingNote;
uint32 noteOnTime;
SynthesiserSound::Ptr currentlyPlayingSound;
bool keyIsDown; // the voice may still be playing when the key is not down (i.e. sustain pedal)
bool sostenutoPedalDown;
};
#endif // _JAYSYNTHVOICE_H_
+2
View File
@@ -0,0 +1,2 @@
include ./config.mk
include $(MAKE_HOME)/compile.mk
+11
View File
@@ -0,0 +1,11 @@
include $(MAKE_HOME)/defaults.win.mk
LIBSRC_PATH ?= $(realpath ../../../libsrc)
JUCE_PATH ?= $(realpath ../sdk/juce/JUCE-3.1.1)
VST2_SDK_PATH ?= $(realpath ../sdk/vst/vstsdk2.4)
include config.mk
INCLUDES += -I $(LIBSRC_PATH) -I $(JUCE_PATH) -I $(VST2_SDK_PATH)
include $(MAKE_HOME)/compile.mk
+618
View File
@@ -0,0 +1,618 @@
/*
==============================================================================
This is an automatically generated file created by the Jucer!
Creation date: 19 Aug 2012 10:54:59am
Be careful when adding custom code to these files, as only the code within
the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded
and re-saved.
Jucer version: 1.12
------------------------------------------------------------------------------
The Jucer is part of the JUCE library - "Jules' Utility Class Extensions"
Copyright 2004-6 by Raw Material Software ltd.
==============================================================================
*/
//[Headers] You can add your own extra header files here...
#include <synth/param_scale.h>
//[/Headers]
#include "MidiCC_PopUp.h"
//[MiscUserDefs] You can add your own user definitions and misc code here...
//[/MiscUserDefs]
//==============================================================================
MidiCC_PopUp::MidiCC_PopUp (JaySynthMidiCC *pMidiCC, int paramID, synth_float_t currParamValue, JaySynth::midiCC_info_t *pCurrMidiCCinfo, String name, MidiCC_PopUp_Listener *listener)
: Component (L"MidiCC PopUp"),
textButton_OK (0),
label_MidiCC_ID (0),
label_control_min (0),
label_control_max (0),
slider_test (0),
button_move_sliders_enable (0),
button_assign_enable (0),
button_midi_learn (0),
label_parameter_name (0),
button_apply_on_patch_init (0)
{
addAndMakeVisible (textButton_OK = new TextButton (L"OK"));
textButton_OK->addListener (this);
addAndMakeVisible (label_MidiCC_ID = new Label (L"MidiCC ID",
L"0"));
label_MidiCC_ID->setTooltip (L"This is the Midi-Controller Number");
label_MidiCC_ID->setFont (Font (15.0000f, Font::plain));
label_MidiCC_ID->setJustificationType (Justification::centredRight);
label_MidiCC_ID->setEditable (true, true, false);
label_MidiCC_ID->setColour (Label::textColourId, Colours::white);
label_MidiCC_ID->setColour (TextEditor::textColourId, Colours::black);
label_MidiCC_ID->setColour (TextEditor::backgroundColourId, Colour (0x0));
label_MidiCC_ID->setColour (TextEditor::highlightColourId, Colours::yellow);
label_MidiCC_ID->addListener (this);
addAndMakeVisible (label_control_min = new Label (L"Control Min",
L"0"));
label_control_min->setTooltip (L"Parameter minimum value");
label_control_min->setFont (Font (15.0000f, Font::plain));
label_control_min->setJustificationType (Justification::centredRight);
label_control_min->setEditable (true, true, false);
label_control_min->setColour (Label::textColourId, Colours::white);
label_control_min->setColour (TextEditor::textColourId, Colours::black);
label_control_min->setColour (TextEditor::backgroundColourId, Colour (0x0));
label_control_min->setColour (TextEditor::highlightColourId, Colours::yellow);
label_control_min->addListener (this);
addAndMakeVisible (label_control_max = new Label (L"Control Max",
L"0"));
label_control_max->setTooltip (L"Parameter maximum value");
label_control_max->setFont (Font (15.0000f, Font::plain));
label_control_max->setJustificationType (Justification::centredRight);
label_control_max->setEditable (true, true, false);
label_control_max->setColour (Label::textColourId, Colours::white);
label_control_max->setColour (TextEditor::textColourId, Colours::black);
label_control_max->setColour (TextEditor::backgroundColourId, Colour (0x0));
label_control_max->setColour (TextEditor::highlightColourId, Colours::yellow);
label_control_max->addListener (this);
addAndMakeVisible (slider_test = new Slider (L"Test Slider"));
slider_test->setTooltip (L"Test Slider");
slider_test->setRange (0, 1, 0);
slider_test->setSliderStyle (Slider::LinearHorizontal);
slider_test->setTextBoxStyle (Slider::NoTextBox, true, 80, 20);
slider_test->addListener (this);
addAndMakeVisible (button_move_sliders_enable = new ToggleButton (L"MoveParams Enable"));
button_move_sliders_enable->setTooltip (L"If \'Absolute = no\', the parameter is alterered relatively from the given slider position on the main window in the specified range. If \'\'Absolute = yes\', the midi controller alters parameter absolutely in the specified range. In this mode sliders really move on the main window.");
button_move_sliders_enable->setButtonText (String::empty);
button_move_sliders_enable->addListener (this);
addAndMakeVisible (button_assign_enable = new ToggleButton (L"Assign Enable"));
button_assign_enable->setTooltip (L"Set this to make MIDI-Controller assignment active");
button_assign_enable->setButtonText (String::empty);
button_assign_enable->addListener (this);
addAndMakeVisible (button_midi_learn = new ToggleButton (L"Midi Learn Button"));
button_midi_learn->setTooltip (L"Set this to learn MIDI-Controller number from MIDI-controller movement");
button_midi_learn->setButtonText (String::empty);
button_midi_learn->addListener (this);
button_midi_learn->setColour (ToggleButton::textColourId, Colours::white);
addAndMakeVisible (label_parameter_name = new Label (L"Parameter Name",
L"Parameter Name"));
label_parameter_name->setFont (Font (20.0000f, Font::plain));
label_parameter_name->setJustificationType (Justification::centred);
label_parameter_name->setEditable (false, false, false);
label_parameter_name->setColour (Label::textColourId, Colours::white);
label_parameter_name->setColour (TextEditor::textColourId, Colours::black);
label_parameter_name->setColour (TextEditor::backgroundColourId, Colour (0x0));
addAndMakeVisible (button_apply_on_patch_init = new ToggleButton (L"Apply on Patch Init Enable"));
button_apply_on_patch_init->setTooltip (L"Set this to apply current Midi-Controller position on initialization of this patch (e.g. Program change)");
button_apply_on_patch_init->setButtonText (String::empty);
button_apply_on_patch_init->addListener (this);
//[UserPreSize]
//[/UserPreSize]
setSize (248, 280);
//[Constructor] You can add your own custom stuff here..
this->pMidiCC = pMidiCC;
pSavedMidiCCinfo = pCurrMidiCCinfo;
pMidiCC_container = pMidiCC->getAtParamID(paramID);
savedParamValue = currParamValue;
lastMidiCCvalue = pSavedMidiCCinfo[pMidiCC->getControllerID(pMidiCC_container)].value;
this->currentParamValue = savedParamValue;
this->currentControlValue = 0;
if (isEnabled())
{
this->currentParamValue = toParam(pMidiCC->getParam(pMidiCC_container), (synth_float_t)lastMidiCCvalue);
this->currentControlValue = toParam(pMidiCC->getControl(pMidiCC_container), (synth_float_t)lastMidiCCvalue);
}
lastParamValue = this->currentParamValue;
lastControlValue = this->currentControlValue;
GetMin();
GetMax();
restoreTestSlider();
label_MidiCC_ID->setText(String(pMidiCC->getControllerID(pMidiCC_container)), juce::NotificationType::dontSendNotification);
label_parameter_name->setText(name, juce::NotificationType::dontSendNotification);
button_assign_enable->setToggleState(pMidiCC->isAssigned(pMidiCC_container), juce::NotificationType::dontSendNotification);
button_move_sliders_enable->setToggleState(pMidiCC->doChangeParameter(pMidiCC_container), juce::NotificationType::dontSendNotification);
button_apply_on_patch_init->setToggleState(pMidiCC->doApplyOnPatchInit(pMidiCC_container), juce::NotificationType::dontSendNotification);
button_assign_enable->setTriggeredOnMouseDown (true);
button_assign_enable->setClickingTogglesState(true);
button_move_sliders_enable->setTriggeredOnMouseDown (true);
button_move_sliders_enable->setClickingTogglesState(true);
button_midi_learn->setTriggeredOnMouseDown (true);
button_midi_learn->setClickingTogglesState(true);
button_apply_on_patch_init->setTriggeredOnMouseDown (true);
button_apply_on_patch_init->setClickingTogglesState(true);
addListener(listener);
listeners.call (&MidiCC_PopUp_Listener::MidiCC_PopUp_event, POPUP_CREATED);
//[/Constructor]
}
MidiCC_PopUp::~MidiCC_PopUp()
{
//[Destructor_pre]. You can add your own custom destruction code here..
//[/Destructor_pre]
deleteAndZero (textButton_OK);
deleteAndZero (label_MidiCC_ID);
deleteAndZero (label_control_min);
deleteAndZero (label_control_max);
deleteAndZero (slider_test);
deleteAndZero (button_move_sliders_enable);
deleteAndZero (button_assign_enable);
deleteAndZero (button_midi_learn);
deleteAndZero (label_parameter_name);
deleteAndZero (button_apply_on_patch_init);
//[Destructor]. You can add your own custom destruction code here..
//[/Destructor]
}
//==============================================================================
void MidiCC_PopUp::paint (Graphics& g)
{
//[UserPrePaint] Add your own custom painting code here..
//[/UserPrePaint]
g.setColour (Colour (0xff2a64a5));
g.fillRoundedRectangle (0.0f, 4.0f, 244.0f, 274.0f, 10.0000f);
g.setColour (Colours::white);
g.drawRoundedRectangle (2.0f, 3.0f, 243.0f, 274.0f, 7.0000f, 4.0000f);
g.setColour (Colours::white);
g.setFont (Font (15.0000f, Font::plain));
g.drawText (L"Midi Controller",
16, 122, 94, 20,
Justification::centredLeft, true);
g.setColour (Colours::white);
g.setFont (Font (15.0000f, Font::plain));
g.drawText (L"Active",
16, 48, 62, 20,
Justification::centredLeft, true);
g.setColour (Colours::white);
g.setFont (Font (15.0000f, Font::plain));
g.drawText (L"Absolute",
16, 68, 59, 20,
Justification::centredLeft, true);
g.setColour (Colours::white);
g.setFont (Font (15.0000f, Font::plain));
g.drawText (L"Minimum",
16, 142, 75, 20,
Justification::centredLeft, true);
g.setColour (Colours::white);
g.setFont (Font (15.0000f, Font::plain));
g.drawText (L"Maximum",
16, 162, 75, 20,
Justification::centredLeft, true);
g.setColour (Colours::white);
g.setFont (Font (15.0000f, Font::plain));
g.drawText (L"Test it",
18, 194, 46, 20,
Justification::centredLeft, true);
g.setColour (Colours::white);
g.setFont (Font (15.0000f, Font::plain));
g.drawText (L"Learn",
192, 122, 38, 20,
Justification::centredLeft, true);
g.setColour (Colours::white);
g.setFont (Font (15.0000f, Font::plain));
g.drawText (L"Apply on patch init",
16, 88, 120, 20,
Justification::centredLeft, true);
//[UserPaint] Add your own custom painting code here..
//[/UserPaint]
}
void MidiCC_PopUp::resized()
{
textButton_OK->setBounds (22, 238, 202, 22);
label_MidiCC_ID->setBounds (135, 122, 32, 20);
label_control_min->setBounds (103, 144, 64, 20);
label_control_max->setBounds (103, 166, 64, 20);
slider_test->setBounds (64, 192, 168, 26);
button_move_sliders_enable->setBounds (148, 68, 20, 20);
button_assign_enable->setBounds (148, 48, 20, 20);
button_midi_learn->setBounds (172, 122, 20, 20);
label_parameter_name->setBounds (12, 12, 212, 24);
button_apply_on_patch_init->setBounds (148, 88, 20, 20);
//[UserResized] Add your own custom resize handling here..
//[/UserResized]
}
void MidiCC_PopUp::buttonClicked (Button* buttonThatWasClicked)
{
//[UserbuttonClicked_Pre]
bool state;
//[/UserbuttonClicked_Pre]
if (buttonThatWasClicked == textButton_OK)
{
//[UserButtonCode_textButton_OK] -- add your button handler code here..
currentControlValue = 0;
if (isEnabled() && !doChangeParameter())
currentControlValue = toParam(pMidiCC->getControl(pMidiCC_container), (synth_float_t)lastMidiCCvalue);
currentParamValue = savedParamValue;
if (isEnabled() && doChangeParameter())
currentParamValue = toParam(pMidiCC->getParam(pMidiCC_container), (synth_float_t)lastMidiCCvalue);
listeners.call (&MidiCC_PopUp_Listener::MidiCC_PopUp_event, POPUP_OK);
//[/UserButtonCode_textButton_OK]
}
else if (buttonThatWasClicked == button_move_sliders_enable)
{
//[UserButtonCode_button_move_sliders_enable] -- add your button handler code here..
state = buttonThatWasClicked->getToggleState();
pMidiCC->setDoChangeParameter(pMidiCC_container, state);
if (state)
{
currentParamValue = lastParamValue;
lastControlValue = currentControlValue;
}
else
{
currentControlValue = lastControlValue;
lastParamValue = currentParamValue;
}
GetMin();
GetMax();
restoreTestSlider();
TestValueUpdate();
//[/UserButtonCode_button_move_sliders_enable]
}
else if (buttonThatWasClicked == button_assign_enable)
{
//[UserButtonCode_button_assign_enable] -- add your button handler code here..
if (buttonThatWasClicked->getToggleState())
pMidiCC->add(pMidiCC_container, label_MidiCC_ID->getText().getIntValue());
else
pMidiCC->remove(pMidiCC_container, label_MidiCC_ID->getText().getIntValue());
if (isEnabled())
{
currentParamValue = toParam(pMidiCC->getParam(pMidiCC_container), (synth_float_t)lastMidiCCvalue);
currentControlValue = toParam(pMidiCC->getControl(pMidiCC_container), (synth_float_t)lastMidiCCvalue);
}
restoreTestSlider();
TestValueUpdate();
//[/UserButtonCode_button_assign_enable]
}
else if (buttonThatWasClicked == button_midi_learn)
{
//[UserButtonCode_button_midi_learn] -- add your button handler code here..
//[/UserButtonCode_button_midi_learn]
}
else if (buttonThatWasClicked == button_apply_on_patch_init)
{
//[UserButtonCode_button_apply_on_patch_init] -- add your button handler code here..
state = buttonThatWasClicked->getToggleState();
pMidiCC->setDoApplyOnPatchInit(pMidiCC_container, state);
restoreTestSlider();
TestValueUpdate();
//[/UserButtonCode_button_apply_on_patch_init]
}
//[UserbuttonClicked_Post]
//[/UserbuttonClicked_Post]
}
void MidiCC_PopUp::labelTextChanged (Label* labelThatHasChanged)
{
//[UserlabelTextChanged_Pre]
//[/UserlabelTextChanged_Pre]
if (labelThatHasChanged == label_MidiCC_ID)
{
//[UserLabelCode_label_MidiCC_ID] -- add your label text handling code here..
pMidiCC->setControllerID(pMidiCC_container, label_MidiCC_ID->getText().getIntValue());
label_MidiCC_ID->setText(String(pMidiCC->getControllerID(pMidiCC_container)), juce::NotificationType::dontSendNotification);
button_midi_learn->setToggleState(false, juce::NotificationType::dontSendNotification);
lastMidiCCvalue = pSavedMidiCCinfo[pMidiCC->getControllerID(pMidiCC_container)].value;
if (isEnabled())
{
currentParamValue = toParam(pMidiCC->getParam(pMidiCC_container), (synth_float_t)lastMidiCCvalue);
currentControlValue = toParam(pMidiCC->getControl(pMidiCC_container), (synth_float_t)lastMidiCCvalue);
}
restoreTestSlider();
TestValueUpdate();
//[/UserLabelCode_label_MidiCC_ID]
}
else if (labelThatHasChanged == label_control_min)
{
//[UserLabelCode_label_control_min] -- add your label text handling code here..
SetMin();
restoreTestSlider();
TestValueUpdate();
//[/UserLabelCode_label_control_min]
}
else if (labelThatHasChanged == label_control_max)
{
//[UserLabelCode_label_control_max] -- add your label text handling code here..
SetMax();
restoreTestSlider();
TestValueUpdate();
//[/UserLabelCode_label_control_max]
}
//[UserlabelTextChanged_Post]
//[/UserlabelTextChanged_Post]
}
void MidiCC_PopUp::sliderValueChanged (Slider* sliderThatWasMoved)
{
//[UsersliderValueChanged_Pre]
//[/UsersliderValueChanged_Pre]
if (sliderThatWasMoved == slider_test)
{
//[UserSliderCode_slider_test] -- add your slider handling code here..
if (doChangeParameter())
{
slider_test->setTooltip (String(toParam(pMidiCC->getParam(pMidiCC_container), (synth_float_t)slider_test->getValue())));
}
else
{
if (lastControlValue == 0)
slider_test->setTooltip (L"0.0");
else
slider_test->setTooltip (String(toParam(pMidiCC->getControl(pMidiCC_container), (synth_float_t)slider_test->getValue())));
}
TestValueUpdate();
//[/UserSliderCode_slider_test]
}
//[UsersliderValueChanged_Post]
//[/UsersliderValueChanged_Post]
}
//[MiscUserCode] You can add your own definitions of your custom methods or any other code here...
void MidiCC_PopUp::mouseWheelMove(const MouseEvent &/*event*/, const MouseWheelDetails &/*wheel*/)
{
}
void MidiCC_PopUp::GetMin()
{
if (doChangeParameter())
{
label_control_min->setText(String(pMidiCC->getParamMin(pMidiCC_container)), juce::NotificationType::dontSendNotification);
}
else
{
label_control_min->setText(String(pMidiCC->getControlMin(pMidiCC_container)), juce::NotificationType::dontSendNotification);
}
}
void MidiCC_PopUp::GetMax()
{
if (doChangeParameter())
{
label_control_max->setText(String(pMidiCC->getParamMax(pMidiCC_container)), juce::NotificationType::dontSendNotification);
}
else
{
label_control_max->setText(String(pMidiCC->getControlMax(pMidiCC_container)), juce::NotificationType::dontSendNotification);
}
}
void MidiCC_PopUp::SetMin()
{
synth_float_t value;
param_info_t *pConstraints = pMidiCC->getConstraints(pMidiCC_container);
param_info_t *pInfo = NULL;
value = (synth_float_t)label_control_min->getText().getFloatValue();
while (doChangeParameter())
{
pInfo = pMidiCC->getParam(pMidiCC_container);
if (value < pConstraints->pmin)
value = pConstraints->pmin;
if (value > pInfo->pmax)
value = pInfo->pmax;
// Min == Max => crash
if (value == pMidiCC->getParamMax(pMidiCC_container))
break;
pMidiCC->setParamMin(pMidiCC_container, value);
break;
}
while (!doChangeParameter())
{
pInfo = pMidiCC->getControl(pMidiCC_container);
if (fabs(value) > fabs(pConstraints->pmax))
value = pConstraints->pmax*fabs(value)/value;
// Min == Max => crash
if (value == pMidiCC->getControlMax(pMidiCC_container))
break;
pMidiCC->setControlMin(pMidiCC_container, value);
break;
}
label_control_min->setText(String(pInfo->pmin), juce::NotificationType::dontSendNotification);
}
void MidiCC_PopUp::SetMax()
{
synth_float_t value;
param_info_t *pConstraints = pMidiCC->getConstraints(pMidiCC_container);
param_info_t *pInfo = NULL;
value = (synth_float_t)label_control_max->getText().getFloatValue();
while (doChangeParameter())
{
pInfo = pMidiCC->getParam(pMidiCC_container);
if (value > pConstraints->pmax)
value = pConstraints->pmax;
if (value < pInfo->pmin)
value = pInfo->pmin;
// Min == Max => crash
if (value == pMidiCC->getParamMin(pMidiCC_container))
break;
pMidiCC->setParamMax(pMidiCC_container, value);
break;
}
while (!doChangeParameter())
{
pInfo = pMidiCC->getControl(pMidiCC_container);
value = (synth_float_t)label_control_max->getText().getFloatValue();
if (fabs(value) > fabs(pConstraints->pmax))
value = pConstraints->pmax*fabs(value)/value;
// Min == Max => crash
if (value == pMidiCC->getControlMin(pMidiCC_container))
break;
pMidiCC->setControlMax(pMidiCC_container, value);
break;
}
label_control_max->setText(String(pInfo->pmax), juce::NotificationType::dontSendNotification);
}
//[/MiscUserCode]
//==============================================================================
#if 0
/* -- Jucer information section --
This is where the Jucer puts all of its metadata, so don't change anything in here!
BEGIN_JUCER_METADATA
<JUCER_COMPONENT documentType="Component" className="MidiCC_PopUp" componentName="MidiCC PopUp"
parentClasses="public Component" constructorParams="JaySynthMidiCC *pMidiCC, int paramID, synth_float_t currParamValue, JaySynth::midiCC_info_t *pCurrMidiCCinfo, String name, MidiCC_PopUp_Listener *listener"
variableInitialisers="" snapPixels="2" snapActive="1" snapShown="1"
overlayOpacity="0.330000013" fixedSize="1" initialWidth="248"
initialHeight="280">
<BACKGROUND backgroundColour="ffffff">
<ROUNDRECT pos="0 4 244 274" cornerSize="10" fill="solid: ff2a64a5" hasStroke="0"/>
<ROUNDRECT pos="2 3 243 274" cornerSize="7" fill="solid: 2a98a5" hasStroke="1"
stroke="4, mitered, butt" strokeColour="solid: ffffffff"/>
<TEXT pos="16 122 94 20" fill="solid: ffffffff" hasStroke="0" text="Midi Controller"
fontname="Default font" fontsize="15" bold="0" italic="0" justification="33"/>
<TEXT pos="16 48 62 20" fill="solid: ffffffff" hasStroke="0" text="Active"
fontname="Default font" fontsize="15" bold="0" italic="0" justification="33"/>
<TEXT pos="16 68 59 20" fill="solid: ffffffff" hasStroke="0" text="Absolute"
fontname="Default font" fontsize="15" bold="0" italic="0" justification="33"/>
<TEXT pos="16 142 75 20" fill="solid: ffffffff" hasStroke="0" text="Minimum"
fontname="Default font" fontsize="15" bold="0" italic="0" justification="33"/>
<TEXT pos="16 162 75 20" fill="solid: ffffffff" hasStroke="0" text="Maximum"
fontname="Default font" fontsize="15" bold="0" italic="0" justification="33"/>
<TEXT pos="18 194 46 20" fill="solid: ffffffff" hasStroke="0" text="Test it"
fontname="Default font" fontsize="15" bold="0" italic="0" justification="33"/>
<TEXT pos="192 122 38 20" fill="solid: ffffffff" hasStroke="0" text="Learn"
fontname="Default font" fontsize="15" bold="0" italic="0" justification="33"/>
<TEXT pos="16 88 120 20" fill="solid: ffffffff" hasStroke="0" text="Apply on patch init"
fontname="Default font" fontsize="15" bold="0" italic="0" justification="33"/>
</BACKGROUND>
<TEXTBUTTON name="OK" id="267da4575448eb96" memberName="textButton_OK" virtualName=""
explicitFocusOrder="0" pos="22 238 202 22" buttonText="OK" connectedEdges="0"
needsCallback="1" radioGroupId="0"/>
<LABEL name="MidiCC ID" id="9e3707850116f781" memberName="label_MidiCC_ID"
virtualName="" explicitFocusOrder="0" pos="135 122 32 20" tooltip="This is the Midi-Controller Number"
textCol="ffffffff" edTextCol="ff000000" edBkgCol="0" hiliteCol="ffffff00"
labelText="0" editableSingleClick="1" editableDoubleClick="1"
focusDiscardsChanges="0" fontname="Default font" fontsize="15"
bold="0" italic="0" justification="34"/>
<LABEL name="Control Min" id="21f18ed07994e110" memberName="label_control_min"
virtualName="" explicitFocusOrder="0" pos="103 144 64 20" tooltip="Parameter minimum value"
textCol="ffffffff" edTextCol="ff000000" edBkgCol="0" hiliteCol="ffffff00"
labelText="0" editableSingleClick="1" editableDoubleClick="1"
focusDiscardsChanges="0" fontname="Default font" fontsize="15"
bold="0" italic="0" justification="34"/>
<LABEL name="Control Max" id="3ee0f72a9b303f9e" memberName="label_control_max"
virtualName="" explicitFocusOrder="0" pos="103 166 64 20" tooltip="Parameter maximum value"
textCol="ffffffff" edTextCol="ff000000" edBkgCol="0" hiliteCol="ffffff00"
labelText="0" editableSingleClick="1" editableDoubleClick="1"
focusDiscardsChanges="0" fontname="Default font" fontsize="15"
bold="0" italic="0" justification="34"/>
<SLIDER name="Test Slider" id="f0f88072fbe8ebb6" memberName="slider_test"
virtualName="" explicitFocusOrder="0" pos="64 192 168 26" tooltip="Test Slider"
min="0" max="1" int="0" style="LinearHorizontal" textBoxPos="NoTextBox"
textBoxEditable="0" textBoxWidth="80" textBoxHeight="20" skewFactor="1"/>
<TOGGLEBUTTON name="MoveParams Enable" id="fbf5e58207823635" memberName="button_move_sliders_enable"
virtualName="" explicitFocusOrder="0" pos="148 68 20 20" tooltip="If 'Absolute = no', the parameter is alterered relatively from the given slider position on the main window in the specified range. If ''Absolute = yes', the midi controller alters parameter absolutely in the specified range. In this mode sliders really move on the main window."
buttonText="" connectedEdges="0" needsCallback="1" radioGroupId="0"
state="0"/>
<TOGGLEBUTTON name="Assign Enable" id="ef80c20aeccf72e1" memberName="button_assign_enable"
virtualName="" explicitFocusOrder="0" pos="148 48 20 20" tooltip="Set this to make MIDI-Controller assignment active"
buttonText="" connectedEdges="0" needsCallback="1" radioGroupId="0"
state="0"/>
<TOGGLEBUTTON name="Midi Learn Button" id="df893ef1c6251377" memberName="button_midi_learn"
virtualName="" explicitFocusOrder="0" pos="172 122 20 20" tooltip="Set this to learn MIDI-Controller number from MIDI-controller movement"
txtcol="ffffffff" buttonText="" connectedEdges="0" needsCallback="1"
radioGroupId="0" state="0"/>
<LABEL name="Parameter Name" id="7bc54e014ee69b2f" memberName="label_parameter_name"
virtualName="" explicitFocusOrder="0" pos="12 12 212 24" textCol="ffffffff"
edTextCol="ff000000" edBkgCol="0" labelText="Parameter Name"
editableSingleClick="0" editableDoubleClick="0" focusDiscardsChanges="0"
fontname="Default font" fontsize="20" bold="0" italic="0" justification="36"/>
<TOGGLEBUTTON name="Apply on Patch Init Enable" id="2783ab3e54887ccc" memberName="button_apply_on_patch_init"
virtualName="" explicitFocusOrder="0" pos="148 88 20 20" tooltip="Set this to apply current Midi-Controller position on initialization of this patch (e.g. Program change)"
buttonText="" connectedEdges="0" needsCallback="1" radioGroupId="0"
state="0"/>
</JUCER_COMPONENT>
END_JUCER_METADATA
*/
#endif
+203
View File
@@ -0,0 +1,203 @@
/*
==============================================================================
This is an automatically generated file created by the Jucer!
Creation date: 19 Aug 2012 10:54:59am
Be careful when adding custom code to these files, as only the code within
the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded
and re-saved.
Jucer version: 1.12
------------------------------------------------------------------------------
The Jucer is part of the JUCE library - "Jules' Utility Class Extensions"
Copyright 2004-6 by Raw Material Software ltd.
==============================================================================
*/
#ifndef __JUCER_HEADER_MIDICCPOPUP_MIDICCPOPUP_EA70576__
#define __JUCER_HEADER_MIDICCPOPUP_MIDICCPOPUP_EA70576__
//[Headers] -- You can add your own extra header files here --
#include <JuceHeader.h>
#include "PluginProcessor.h"
//#include "juce.h"
class MidiCC_PopUp_Listener
{
public:
virtual void MidiCC_PopUp_event(int /*event*/) {};
};
//[/Headers]
//==============================================================================
/**
//[Comments]
An auto-generated component, created by the Jucer.
Describe your class and how it works here!
//[/Comments]
*/
class MidiCC_PopUp : public Component,
public ButtonListener,
public LabelListener,
public SliderListener
{
public:
//==============================================================================
MidiCC_PopUp (JaySynthMidiCC *pMidiCC, int paramID, synth_float_t currParamValue, JaySynth::midiCC_info_t *pCurrMidiCCinfo, String name, MidiCC_PopUp_Listener *listener);
~MidiCC_PopUp();
//==============================================================================
//[UserMethods] -- You can add your own custom methods in this section.
enum
{
POPUP_DELETED = 0,
POPUP_CREATED,
POPUP_SHOW,
POPUP_PARAM_CHANGED,
POPUP_OK
};
void addListener(MidiCC_PopUp_Listener *listener)
{
listeners.add (listener);
}
void show(void)
{
this->setVisible(true);
listeners.call (&MidiCC_PopUp_Listener::MidiCC_PopUp_event, POPUP_SHOW);
}
bool isEnabled(void)
{
return pMidiCC->isAssigned(pMidiCC_container);
}
bool doChangeParameter(void)
{
return pMidiCC->doChangeParameter(pMidiCC_container);
}
void setControllerID(int controllerID)
{
lastMidiCCvalue = pSavedMidiCCinfo[pMidiCC->getControllerID(pMidiCC_container)].value;
if (isEnabled())
{
currentParamValue = toParam(pMidiCC->getParam(pMidiCC_container), (synth_float_t)lastMidiCCvalue);
currentControlValue = toParam(pMidiCC->getControl(pMidiCC_container), (synth_float_t)lastMidiCCvalue);
}
restoreTestSlider();
TestValueUpdate();
if (!button_midi_learn->getToggleState())
return;
label_MidiCC_ID->setText(String(controllerID), juce::NotificationType::sendNotification);
}
synth_float_t getCurrentControlValue(void)
{
return currentControlValue;
}
synth_float_t getCurrentParamValue(void)
{
return currentParamValue;
}
int getParamID(void)
{
return pMidiCC->getParamID(pMidiCC_container);
}
void TestValueUpdate()
{
if (doChangeParameter())
{
currentControlValue = 0;
currentParamValue = toParam(pMidiCC->getParam(pMidiCC_container), (synth_float_t)slider_test->getValue());
}
else
{
currentParamValue = savedParamValue;
currentControlValue = toParam(pMidiCC->getControl(pMidiCC_container), (synth_float_t)slider_test->getValue());
}
listeners.call (&MidiCC_PopUp_Listener::MidiCC_PopUp_event, POPUP_PARAM_CHANGED);
}
void restoreTestSlider()
{
if (doChangeParameter())
{
slider_test->setValue(toSlider(pMidiCC->getParam(pMidiCC_container), (synth_float_t)currentParamValue), juce::NotificationType::sendNotification);
}
else
{
slider_test->setValue(toSlider(pMidiCC->getControl(pMidiCC_container), (synth_float_t)currentControlValue), juce::NotificationType::sendNotification);
}
}
void GetMin();
void GetMax();
void SetMin();
void SetMax();
ComponentDragger myDragger;
void mouseDown (const MouseEvent& e)
{
myDragger.startDraggingComponent (this, e);
}
void mouseDrag (const MouseEvent& e)
{
myDragger.dragComponent (this, e, nullptr);
}
void mouseWheelMove(const MouseEvent &event, const MouseWheelDetails &wheel);
//[/UserMethods]
void paint (Graphics& g);
void resized();
void buttonClicked (Button* buttonThatWasClicked);
void labelTextChanged (Label* labelThatHasChanged);
void sliderValueChanged (Slider* sliderThatWasMoved);
//==============================================================================
juce_UseDebuggingNewOperator
private:
//[UserVariables] -- You can add your own custom variables in this section.
JaySynthMidiCC *pMidiCC;
midiCC_container_t *pMidiCC_container;
ListenerList <MidiCC_PopUp_Listener> listeners;
JaySynth::midiCC_info_t *pSavedMidiCCinfo;
synth_float_t lastMidiCCvalue;
synth_float_t savedParamValue;
synth_float_t currentParamValue;
synth_float_t currentControlValue;
synth_float_t lastControlValue;
synth_float_t lastParamValue;
//[/UserVariables]
//==============================================================================
TextButton* textButton_OK;
Label* label_MidiCC_ID;
Label* label_control_min;
Label* label_control_max;
Slider* slider_test;
ToggleButton* button_move_sliders_enable;
ToggleButton* button_assign_enable;
ToggleButton* button_midi_learn;
Label* label_parameter_name;
ToggleButton* button_apply_on_patch_init;
//==============================================================================
// (prevent copy constructor and operator= being generated..)
MidiCC_PopUp (const MidiCC_PopUp&);
const MidiCC_PopUp& operator= (const MidiCC_PopUp&);
};
#endif // __JUCER_HEADER_MIDICCPOPUP_MIDICCPOPUP_EA70576__
File diff suppressed because it is too large Load Diff
+407
View File
@@ -0,0 +1,407 @@
/*
==============================================================================
This file was auto-generated!
It contains the basic startup code for a Juce application.
==============================================================================
*/
#ifndef __PLUGINPROCESSOR_H_20F201CA__
#define __PLUGINPROCESSOR_H_20F201CA__
#include <JuceHeader.h>
#include <synth/synth_defs.h>
#include "JaySynthSound.h"
#include "JaySynth.h"
#include "JK_MidiClock.h"
#include <pluginterfaces/vst2.x/vstfxstore.h>
//==============================================================================
/**
*/
class JaySynthActionListener : public ActionBroadcaster
{
public:
enum
{
JAYSYNTH_CHANGED_PARAM = 0,
JAYSYNTH_CHANGED_MIDICC,
JAYSYNTH_CHANGED_NOTE_PRESSED,
JAYSYNTH_CHANGED_NOTE_RELEASED,
JAYSYNTH_CHANGED_NUM_VOICES_PLAYING,
JAYSYNTH_CHANGED_MIDICLOCK,
JAYSYNTH_CHANGED_PROGRAM,
JAYSYNTH_CHANGED_LIMITER,
JAYSYNTH_CHANGED_SIZE
};
void callParamChanged (int paramID)
{
String s;
s = String("type=") + String(JAYSYNTH_CHANGED_PARAM);
s = s + String(" ");
s = s + String("paramID=") + String(paramID);
s = s + String(" ");
sendActionMessage(s);
}
void callMidiControllerChanged (int channel, int controllerID, float value)
{
String s;
s = String("type=") + String(JAYSYNTH_CHANGED_MIDICC);
s = s + String(" ");
s = s + String("ch=") + String(channel);
s = s + String(" ");
s = s + String("id=") + String(controllerID);
s = s + String(" ");
s = s + String("value=") + String((float)value);
s = s + String(" ");
sendActionMessage(s);
}
void callMidiNotePressed (int midi_note, float velocity)
{
String s;
s = String("type=") + String(JAYSYNTH_CHANGED_NOTE_PRESSED);
s = s + String(" ");
s = s + String("note=") + String(midi_note);
s = s + String(" ");
s = s + String("velocity=") + String((float)velocity);
s = s + String(" ");
sendActionMessage(s);
}
void callMidiNoteReleased (int midi_note, float velocity)
{
String s;
s = String("type=") + String(JAYSYNTH_CHANGED_NOTE_RELEASED);
s = s + String(" ");
s = s + String("note=") + String(midi_note);
s = s + String(" ");
s = s + String("velocity=") + String((float)velocity);
s = s + String(" ");
sendActionMessage(s);
}
void callProgramChanged(void)
{
String s;
s = String("type=") + String(JAYSYNTH_CHANGED_PROGRAM);
s = s + String(" ");
sendActionMessage(s);
}
void callLimiterChanged (int value)
{
String s;
s = String("type=") + String(JAYSYNTH_CHANGED_LIMITER);
s = s + String(" ");
s = s + String("value=") + String(value);
s = s + String(" ");
sendActionMessage(s);
}
void callNumVoicesPlaying (int value)
{
String s;
s = String("type=") + String(JAYSYNTH_CHANGED_NUM_VOICES_PLAYING);
s = s + String(" ");
s = s + String("value=") + String(value);
s = s + String(" ");
sendActionMessage(s);
}
void callMidiClock (uint32_t bpm, uint32_t type)
{
String s;
s = String("type=") + String(JAYSYNTH_CHANGED_MIDICLOCK);
s = s + String(" ");
s = s + String("bpm=") + String(bpm);
s = s + String(" ");
s = s + String("brightness=") + String(type);
s = s + String(" ");
sendActionMessage(s);
}
void callBinary(void *pData, int size)
{
String s;
s.createStringFromData(pData, size);
sendActionMessage(s);
}
void add (ActionListener *listener)
{
addActionListener((ActionListener*)listener);
}
void remove (ActionListener *listener)
{
removeActionListener((ActionListener*)listener);
}
private:
};
class JaySynthAudioProcessor :
public Timer,
public AudioProcessor,
public JaySynthSound,
public JaySynthListener
{
public:
//==============================================================================
JaySynthAudioProcessor();
~JaySynthAudioProcessor();
//==============================================================================
void prepareToPlay (double sampleRate, int samplesPerBlock);
void releaseResources();
void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages);
//==============================================================================
AudioProcessorEditor* createEditor();
bool hasEditor() const;
//==============================================================================
const String getName() const;
int getNumParameters();
void setParameter (int index, float newValue);
float getParameter (int index);
void setParam(int index, synth_float_t param, bool doModifyPatch, bool doNotifyHost);
synth_float_t getParam(int index);
void controlParam(int index, synth_float_t newValue);
const String getParameterName (int index);
const String getParameterText (int index);
const String getInputChannelName (int channelIndex) const;
const String getOutputChannelName (int channelIndex) const;
bool isInputChannelStereoPair (int index) const;
bool isOutputChannelStereoPair (int index) const;
bool silenceInProducesSilenceOut() const
{
return false;
}
double getTailLengthSeconds() const
{
return 0;
}
bool acceptsMidi() const;
bool producesMidi() const;
//==============================================================================
int getNumPrograms();
int getCurrentProgram();
void setCurrentProgram (int index);
const String getProgramName (int index);
void changeProgramName (int index, const String& newName);
//==============================================================================
void copyXmlToBinary (const XmlElement& xml, juce::MemoryBlock& destData);
XmlElement* getXmlFromBinary (const void* data, const int sizeInBytes);
const String getParameterNameXML (int index);
// Patch encode
void patchEncodeXml(XmlElement *xml, JaySynthSound const *patch);
// Bank encode
void bankEncodeXml(XmlElement *xml);
// Patch decode
void patchDecodeXml(const XmlElement *xml, JaySynthSound *patch);
void patchDecodeXml_legacy(const XmlElement& xml, JaySynthSound *patch);
// Bank decode
void bankDecodeXml(const XmlElement *xml);
void bankDecodeXml_legacy(const XmlElement& xml);
// Patch import, main entry
void patchImportXml (const XmlElement *xml, JaySynthSound *patch);
// Bank import, main entry
void bankImportXml (const XmlElement *xml);
// Patch import VST 2.4
void setCurrentProgramStateInformation (const void* data, int sizeInBytes);
// Bank import VST 2.4
void setStateInformation (const void* data, int sizeInBytes);
// Patch export VST 2.4
void getCurrentProgramStateInformation (MemoryBlock& destData);
// Bank export VST 2.4
void getStateInformation (MemoryBlock& destData);
// Patch load from file
void loadPatchFromFile (const File &file, int index);
// Bank load from file
void loadBankFromFile (const File &file);
// Patch save to file
void savePatchToFile (const File &file, int index);
// Bank save to file
void saveBankToFile (const File &file);
void commitEditBuffer();
//==============================================================================
// These properties are public so that our editor component can access them
// A bit of a hacky way to do it, but it's only a demo! Obviously in your own
// code you'll do this much more neatly..
// this is kept up to date with the midi messages that arrive, and the UI component
// registers with it so it can represent the incoming messages
MidiKeyboardState keyboardState;
// this keeps a copy of the last set of time info that was acquired during an audio
// callback - the UI component will read this and display it.
AudioPlayHead::CurrentPositionInfo lastPosInfo;
// these are used to persist the UI's size - the values are stored along with the
// filter's other parameters, and the UI component will update them when it gets
// resized.
void synthChanged(int type, void *pData);
void addActionListener(ActionListener* listener)
{
actionListener.add(listener);
}
void removeActionListener(ActionListener* listener)
{
actionListener.remove(listener);
}
void sendParamChangeToHost(int index, float value)
{
AudioProcessor::sendParamChangeMessageToListeners(index, value);
}
JaySynth::midiCC_info_t* getLastMidiControllers(void)
{
return pSynth->getLastMidiCC_infos();
}
JaySynth::midi_note_info_t* getLastMidiNoteInfos(void)
{
return pSynth->getLastMidiNote_infos();
}
void setCurrentProgramName (String name)
{
changeProgramName(getCurrentProgram(), name);
updateHostDisplay();
}
const String getCurrentProgramName (void)
{
String s;
if (isPatchModified() || getMidiCC_editBuffer()->isMidiCCmodified())
{
s = getProgramName(getCurrentProgram()) + String(" [edited]");
}
else
{
s = getProgramName(getCurrentProgram());
}
return s;
};
bool isPatchModified(void)
{
return isModified;
}
void clearPatchModified(void)
{
isModified = false;
}
void setPatchModified(void)
{
isModified = true;
}
JaySynthMidiCC *getMidiCC_editBuffer(void)
{
return &midCC_editBuffer;
}
void applyMidiController(JaySynth::midiCC_info_t *pMidiCC_info, bool forceApply);
void applyCurrentMidiControllers(void);
void humanizeModeChanged(void)
{
pSynth->humanizeModeChanged();
}
void unisonoModeChanged(void)
{
pSynth->unisonoModeChanged();
}
void humanizeVarianceChanged_VCO(void)
{
pSynth->humanizeVarianceChanged_VCO();
}
void humanizeVarianceChanged_VCF(void)
{
pSynth->humanizeVarianceChanged_VCF();
}
void humanizeVarianceChanged_ENV(void)
{
pSynth->humanizeVarianceChanged_ENV();
}
void perVoiceControlChanged(int paramID)
{
pSynth->updateParameter(paramID);
}
void perVoiceControlsChanged(void)
{
pSynth->updateParameters();
}
String wavesGetPath();
bool isWavesAvailable();
void timerCallback();
private:
// the synth!
bool isModified;
bool m_isWavesAvailable;
int lastUIWidth, lastUIHeight;
synth_float_t master_volume, m_fs;
int currProgram;
JaySynthSound patches[NUM_PROGRAMS];
JaySynthSound *currpatch;
JaySynthActionListener actionListener;
JaySynth *pSynth;
void *the_editor;
JaySynthMidiCC midCC_editBuffer;
int m_limiter_active;
synth_float_t m_limiter_env;
JK_MidiClock m_JK_MidiClock;
//==============================================================================
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (JaySynthAudioProcessor);
};
//typedef JaySynthAudioProcessor::Listener JaySynthAudioProcessorListener;
#endif // __PLUGINPROCESSOR_H_20F201CA__
File diff suppressed because it is too large Load Diff
+194
View File
@@ -0,0 +1,194 @@
/*
==============================================================================
This is an automatically generated file created by the Jucer!
Creation date: 30 Sep 2012 11:31:53am
Be careful when adding custom code to these files, as only the code within
the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded
and re-saved.
Jucer version: 1.12
------------------------------------------------------------------------------
The Jucer is part of the JUCE library - "Jules' Utility Class Extensions"
Copyright 2004-6 by Raw Material Software ltd.
==============================================================================
*/
#ifndef __JUCER_HEADER_VELKEYPOPUP_VELKEYPOPUP_9719552A__
#define __JUCER_HEADER_VELKEYPOPUP_VELKEYPOPUP_9719552A__
//[Headers] -- You can add your own extra header files here --
#include <JuceHeader.h>
#include <synth/synth_defs.h>
#include "PluginProcessor.h"
class VelKey_PopUp_Listener
{
public:
virtual void VelKey_PopUp_event(int /*event*/) {};
};
//[/Headers]
#include "graph_window.h"
//==============================================================================
/**
//[Comments]
An auto-generated component, created by the Jucer.
Describe your class and how it works here!
//[/Comments]
*/
class VelKey_PopUp : public Component,
public SliderListener,
public ButtonListener,
public LabelListener,
public ComboBoxListener
{
public:
//==============================================================================
VelKey_PopUp (JaySynthMidiCC *pMidiCC, int paramID, synth_float_t currParamValue, JaySynth::midi_note_info_t *pCurrentMidiNoteInfo, String name, VelKey_PopUp_Listener *listener);
~VelKey_PopUp();
//==============================================================================
//[UserMethods] -- You can add your own custom methods in this section.
enum
{
POPUP_DELETED = 0,
POPUP_CREATED,
POPUP_SHOW,
POPUP_PARAM_CHANGED,
POPUP_OK
};
void setKeyVel(int note, float velocity);
void addListener(VelKey_PopUp_Listener *listener)
{
listeners.add (listener);
}
void show(void)
{
this->setVisible(true);
listeners.call (&VelKey_PopUp_Listener::VelKey_PopUp_event, POPUP_SHOW);
}
int getParamID(void)
{
return m_paramID;
}
ComponentDragger myDragger;
void mouseDown (const MouseEvent& e)
{
myDragger.startDraggingComponent (this, e);
}
void mouseDrag (const MouseEvent& e)
{
myDragger.dragComponent (this, e, nullptr);
}
void createNoteNameTbl(void);
const String getNoteName(int midinotnumber);
void displayUpdate(void);
void setCurrParam(int paramID, float param);
//[/UserMethods]
void paint (Graphics& g);
void resized();
void sliderValueChanged (Slider* sliderThatWasMoved);
void buttonClicked (Button* buttonThatWasClicked);
void labelTextChanged (Label* labelThatHasChanged);
void comboBoxChanged (ComboBox* comboBoxThatHasChanged);
//==============================================================================
juce_UseDebuggingNewOperator
private:
//[UserVariables] -- You can add your own custom variables in this section.
param_info_t m_velKey_constraints;
param_info_t m_shape_xform, m_skew_xform;
JaySynthMidiCC *pMidiCC;
midiCC_container_t *pMidiCC_container;
ListenerList <VelKey_PopUp_Listener> listeners;
synth_float_t m_currParamValue;
int m_paramID;
int m_label_prec, m_label_shape_prec, m_label_skew_prec;
JaySynth::midi_note_info_t m_currentMidiNoteInfo;
bool m_isFlipped_vel, m_isFlipped_key;
String m_text_vel_min, m_text_vel_max;
String m_text_key_min, m_text_key_max;
String notename_tbl[128];
//[/UserVariables]
//==============================================================================
Label* label_parameter_name;
GroupComponent* groupComponent3;
GroupComponent* groupComponent;
GroupComponent* groupComponent2;
GraphWindow* m_graph_vel;
Slider* slider_vel_kexp;
Slider* slider_vel_scenter;
Label* label_vel_kexp;
Label* label_vel_scenter;
Label* label_vel_min;
Slider* slider_vel_min;
TextButton* textButton_OK;
ToggleButton* button_vel_assign_enable;
Label* label_vel_ymin;
Label* label_vel_ymax;
Label* label_vel_x100;
Label* label_vel_x0;
GraphWindow* m_graph_key;
Slider* slider_key_kexp;
Slider* slider_key_scenter;
Label* label_key_kexp;
Label* label_vel_scenter2;
Label* label_key_min;
Slider* slider_key_min;
ToggleButton* button_key_assign_enable;
Label* label_key_ymin;
Label* label_key_ymax;
Label* label_key_x100;
Label* label_key_x0;
ComboBox* comboBoxOPSel;
Label* label_key;
Label* label_vel;
Slider* slider_vel_max;
Label* label_vel_max;
Label* label_key_max;
Slider* slider_key_max;
Label* label_vel_shape;
Label* label_vel_skew;
Label* label_key_shape;
Label* label_key_skew;
Label* label_vel_skew_text;
Label* label_key_skew_text;
Label* label_vel_shape_text;
Label* label_key_shape_text;
Label* label_vel_max_text;
Label* label_vel_min_text;
Label* label_key_min_text;
Label* label_key_max_text;
Label* label_vel_y;
Label* label_key_y;
Label* label_vel_x;
Label* label_key_x;
TextButton* m_btn_flip_vel;
TextButton* m_btn_flip_key;
//==============================================================================
// (prevent copy constructor and operator= being generated..)
VelKey_PopUp (const VelKey_PopUp&);
const VelKey_PopUp& operator= (const VelKey_PopUp&);
};
#endif // __JUCER_HEADER_VELKEYPOPUP_VELKEYPOPUP_9719552A__
+15
View File
@@ -0,0 +1,15 @@
NAME := plug
CXX_SRCS := ButtonLED.cpp
CXX_SRCS += graph_window.cpp
CXX_SRCS += JaySynth.cpp
CXX_SRCS += JaySynthAudioProcessorEditor.cpp
CXX_SRCS += JaySynthMidiCC.cpp
CXX_SRCS += JaySynthMonophonicMGR.cpp
CXX_SRCS += JaySynthSound.cpp
CXX_SRCS += JaySynthVoice.cpp
CXX_SRCS += MidiCC_PopUp.cpp
CXX_SRCS += PluginProcessor.cpp
CXX_SRCS += VelKey_PopUp.cpp
CXX_SRCS += JaySynth.cpp
CXX_SRCS += JK_MidiClock.cpp
+172
View File
@@ -0,0 +1,172 @@
/*
==============================================================================
This is an automatically generated file created by the Jucer!
Creation date: 18 Sep 2012 6:24:20am
Be careful when adding custom code to these files, as only the code within
the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded
and re-saved.
Jucer version: 1.12
------------------------------------------------------------------------------
The Jucer is part of the JUCE library - "Jules' Utility Class Extensions"
Copyright 2004-6 by Raw Material Software ltd.
==============================================================================
*/
//[Headers] You can add your own extra header files here...
//[/Headers]
#include "graph_window.h"
//[MiscUserDefs] You can add your own user definitions and misc code here...
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
//[/MiscUserDefs]
//==============================================================================
GraphWindow::GraphWindow ()
: Component (L"graph_window")
{
//[UserPreSize]
//[/UserPreSize]
setSize (160, 120);
//[Constructor] You can add your own custom stuff here..
frame_width = 1;
m_markerX = 0;
paramInfoInit(&curve, 0, NULL);
paramInfoSet(&curve, 1, 1, 0.5, -1, 0, +1, 0);
//[/Constructor]
}
GraphWindow::~GraphWindow()
{
//[Destructor_pre]. You can add your own custom destruction code here..
//[/Destructor_pre]
//[Destructor]. You can add your own custom destruction code here..
paramInfoFree(&curve);
//[/Destructor]
}
//==============================================================================
void GraphWindow::paint (Graphics& g)
{
//[UserPrePaint] Add your own custom painting code here..
goto skip;
//[/UserPrePaint]
g.setColour (Colours::white);
g.drawRoundedRectangle (3.0f, 3.0f, 156.0f, 116.0f, 1.0000f, 2.0000f);
//[UserPaint] Add your own custom painting code here..
skip:
int minX = 0;
int minY = frame_width;
int maxX = getWidth();
int maxY = getHeight()-frame_width;
int sizeX = maxX-minX;
int sizeY = maxY-minY;
g.setColour (Colour(0xFFB0B0B0));
g.drawLine(minX, (int)((1-evalCurve(m_markerX))*sizeY) + 1.5*minY, maxX, (int)((1-evalCurve(m_markerX))*sizeY) + 1.5*minY);
g.drawLine(m_markerX*sizeX, minY, m_markerX*sizeX, maxY);
g.setColour (Colours::white);
float dx = 1.0/sizeX;
float x0 = 0;
float x1 = dx;
float y0, y1;
for (int i=minX+1; i <= maxX; i++)
{
y0 = evalCurve(x0);
y1 = evalCurve(x1);
x0 = x1;
x1 += dx;
g.drawLine(i-1, /*(1-0.5*(1+y0))*sizeY*/(1-y0)*sizeY + minY, i, /*(1-0.5*(1+y1))*sizeY*/(1-y1)*sizeY + minY);
}
g.setColour (Colours::white);
g.drawRect (0.0, 0.0, (float)getWidth(), (float)getHeight(), frame_width);
//[/UserPaint]
}
void GraphWindow::resized()
{
//[UserResized] Add your own custom resize handling here..
repaint();
//[/UserResized]
}
float GraphWindow::evalCurve(float x)
{
// return min(m_max, max(m_min, toParam(&curve, x)));
if (m_max > m_min)
return (toParam(&curve, x)-m_min)/(m_max - m_min);
else
return (toParam(&curve, x)-m_max)/(m_min - m_max);
}
//[MiscUserCode] You can add your own definitions of your custom methods or any other code here...
void GraphWindow::Draw(float minimum, float maximum, param_info_t *pParamInfo)
{
m_min = minimum;
m_max = maximum;
paramInfoCopy(&curve, pParamInfo);
repaint();
}
void GraphWindow::SetMarkerX(float x)
{
m_markerX = x;
repaint();
}
//[/MiscUserCode]
//==============================================================================
#if 0
/* -- Jucer information section --
This is where the Jucer puts all of its metadata, so don't change anything in here!
BEGIN_JUCER_METADATA
<JUCER_COMPONENT documentType="Component" className="GraphWindow" componentName="graph_window"
parentClasses="public Component" constructorParams="" variableInitialisers=""
snapPixels="4" snapActive="1" snapShown="1" overlayOpacity="0.330000013"
fixedSize="1" initialWidth="160" initialHeight="120">
<BACKGROUND backgroundColour="ffffff">
<ROUNDRECT pos="3 3 156 116" cornerSize="1" fill="solid: ffffff" hasStroke="1"
stroke="2, mitered, butt" strokeColour="solid: ffffffff"/>
</BACKGROUND>
</JUCER_COMPONENT>
END_JUCER_METADATA
*/
#endif
+91
View File
@@ -0,0 +1,91 @@
/*
==============================================================================
This is an automatically generated file created by the Jucer!
Creation date: 18 Sep 2012 6:24:20am
Be careful when adding custom code to these files, as only the code within
the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded
and re-saved.
Jucer version: 1.12
------------------------------------------------------------------------------
The Jucer is part of the JUCE library - "Jules' Utility Class Extensions"
Copyright 2004-6 by Raw Material Software ltd.
==============================================================================
*/
#ifndef __JUCER_HEADER_GRAPHWINDOW_GRAPHWINDOW_E0AFC61E__
#define __JUCER_HEADER_GRAPHWINDOW_GRAPHWINDOW_E0AFC61E__
//[Headers] -- You can add your own extra header files here --
#include <JuceHeader.h>
#include <synth/voice.h>
#include <synth/vco.h>
#include <synth/noise.h>
#include <synth/smooth.h>
#include <synth/vcf.h>
#include <synth/lfo.h>
#include <synth/env.h>
#include <synth/param_scale.h>
//[/Headers]
//==============================================================================
/**
//[Comments]
An auto-generated component, created by the Jucer.
Describe your class and how it works here!
//[/Comments]
*/
class GraphWindow : public Component
{
public:
//==============================================================================
GraphWindow ();
~GraphWindow();
//==============================================================================
//[UserMethods] -- You can add your own custom methods in this section.
void Draw(float minimum, float maximum, param_info_t *pParamInfo);
void SetMarkerX(float x);
float evalCurve(float x);
//[/UserMethods]
void paint (Graphics& g);
void resized();
//==============================================================================
juce_UseDebuggingNewOperator
private:
//[UserVariables] -- You can add your own custom variables in this section.
float frame_width;
float m_min;
float m_max;
float m_markerX;
param_info_t curve;
//[/UserVariables]
//==============================================================================
//==============================================================================
// (prevent copy constructor and operator= being generated..)
GraphWindow (const GraphWindow&);
const GraphWindow& operator= (const GraphWindow&);
};
#endif // __JUCER_HEADER_GRAPHWINDOW_GRAPHWINDOW_E0AFC61E__
Binary file not shown.

After

Width:  |  Height:  |  Size: 820 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 830 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB