@@ -1,65 +0,0 @@ | |||
#!/bin/bash | |||
ZYN_URI="http://kxstudio.sf.net/carla/plugins/zynaddsubfx" | |||
rm -rf carla-zyn-presets.lv2 | |||
mkdir carla-zyn-presets.lv2 | |||
cd carla-zyn-presets.lv2 | |||
echo "\ | |||
@prefix lv2: <http://lv2plug.in/ns/lv2core#> . | |||
@prefix pset: <http://lv2plug.in/ns/ext/presets#> . | |||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>. | |||
" > manifest.ttl | |||
ls "/usr/share/zynaddsubfx/banks/" | while read i; do | |||
BANK_NAME=$i | |||
BANK_URI=`echo $BANK_NAME | awk '{ sub(" ","%20"); print }' | awk '{ sub(" ","%20"); print }'` | |||
echo "\ | |||
<$ZYN_URI#bank_$BANK_URI> | |||
a pset:Bank ; | |||
rdfs:label \"$BANK_NAME\" . | |||
" >> manifest.ttl | |||
echo "\ | |||
@prefix lv2: <http://lv2plug.in/ns/lv2core#> . | |||
@prefix pset: <http://lv2plug.in/ns/ext/presets#> . | |||
@prefix state: <http://lv2plug.in/ns/ext/state#> . | |||
" > "bank-$BANK_NAME.ttl" | |||
ls "/usr/share/zynaddsubfx/banks/$i" | while read j; do | |||
if [ "$j"x != "README"x ]; then | |||
PROG_NAME=$j | |||
PROG_URI=`echo $PROG_NAME | awk '{ sub(".xiz",""); print }' | awk '{ sub(" ","%20"); print }' | awk '{ sub(" ","%20"); print }' | awk '{ sub(" ","%20"); print }' | awk '{ sub(" ","%20"); print }'` | |||
echo "\ | |||
<$ZYN_URI#preset_"$BANK_URI"_"$PROG_URI"> | |||
a pset:Preset ; | |||
lv2:appliesTo <$ZYN_URI> ; | |||
rdfs:label \"$BANK_NAME: $PROG_NAME\" ; | |||
rdfs:seeAlso <bank-$BANK_URI.ttl> . | |||
" >> manifest.ttl | |||
echo "\ | |||
<$ZYN_URI#preset_"$BANK_URI"_"$PROG_URI"> | |||
a pset:Preset ; | |||
lv2:appliesTo <$ZYN_URI> ; | |||
pset:bank <$ZYN_URI#bank_$BANK_URI> ; | |||
state:state [ | |||
<http://kxstudio.sf.net/ns/carla/chunk> | |||
\"\"\"" >> "bank-$BANK_NAME.ttl" | |||
echo $j | |||
cat "/usr/share/zynaddsubfx/banks/$i/$j" | gzip -d >> "bank-$BANK_NAME.ttl" | |||
echo "\"\"\" | |||
] . | |||
" >> "bank-$BANK_NAME.ttl" | |||
fi | |||
done | |||
done |
@@ -64,112 +64,391 @@ extern "C" { | |||
#include "zynaddsubfx/rtosc/cpp/subtree-serialize.cpp" | |||
#include "zynaddsubfx/rtosc/cpp/thread-link.cpp" | |||
#undef off_t | |||
#undef static | |||
#include "zynaddsubfx/rtosc/cpp/undo-history.cpp" | |||
// zynaddsubfx includes | |||
#include "zynaddsubfx/Containers/MultiPseudoStack.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/Containers/NotePool.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/DSP/AnalogFilter.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/DSP/FFTwrapper.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/DSP/Filter.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/DSP/FormantFilter.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/DSP/SVFilter.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/DSP/Unison.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/Effects/Alienwah.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/Effects/Chorus.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/Effects/Distorsion.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/Effects/DynamicFilter.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/Effects/Echo.cpp" | |||
#undef MAX_DELAY | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/Effects/Effect.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/Effects/EffectLFO.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/Effects/EffectMgr.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/Effects/EQ.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/Effects/Phaser.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#undef PHASER_LFO_SHAPE | |||
#undef ONE_ | |||
#undef ZERO_ | |||
#include "zynaddsubfx/Effects/Reverb.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/Misc/Allocator.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/Misc/Bank.cpp" | |||
#undef INSTRUMENT_EXTENSION | |||
#undef FORCE_BANK_DIR_FILE | |||
#include "zynaddsubfx/Misc/Config.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/Misc/Config.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/Misc/Master.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/Misc/Microtonal.cpp" | |||
#undef MAX_LINE_SIZE | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/Misc/MiddleWare.cpp" | |||
#undef rObject | |||
#include "zynaddsubfx/Misc/Part.cpp" | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#undef rObject | |||
#include "zynaddsubfx/Misc/Part.cpp" | |||
#undef CLONE | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/Misc/PresetExtractor.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/Misc/Recorder.cpp" | |||
//#include "zynaddsubfx/Misc/Stereo.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/Misc/Util.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/Misc/WavFile.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/Misc/WaveShapeSmps.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/Misc/XMLwrapper.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/Params/ADnoteParameters.cpp" | |||
#undef EXPAND | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/Params/Controller.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/Params/EnvelopeParams.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/Params/FilterParams.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/Params/LFOParams.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/Params/PADnoteParameters.cpp" | |||
#undef rObject | |||
#undef PC | |||
#undef P_C | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/Params/Presets.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/Params/PresetsArray.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/Params/PresetsStore.cpp" | |||
#include "zynaddsubfx/Params/SUBnoteParameters.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/Params/SUBnoteParameters.cpp" | |||
#undef doPaste | |||
#undef doPPaste | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/Synth/ADnote.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/Synth/Envelope.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/Synth/LFO.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/Synth/OscilGen.cpp" | |||
#undef rObject | |||
#undef PC | |||
#undef DIFF | |||
#undef PRESERVE | |||
#undef RESTORE | |||
#undef FUNC | |||
#undef FILTER | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/Synth/PADnote.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/Synth/Resonance.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/Synth/SUBnote.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/Synth/SynthNote.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/UI/ConnectionDummy.cpp" | |||
#undef rObject | |||
#undef rStdString | |||
#undef rStdStringCb | |||
#undef rChangeCb | |||
#define rChangeCb | |||
#include "zynaddsubfx/globals.cpp" | |||
// Dummy variables and functions for linking purposes | |||
// const char* instance_name = nullptr; | |||
// SYNTH_T* synth = nullptr; | |||
class WavFile; | |||
namespace Nio { | |||
void masterSwap(Master*){} | |||
// bool start(void){return 1;} | |||
// void stop(void){} | |||
bool setSource(std::string){return true;} | |||
bool setSink(std::string){return true;} | |||
std::set<std::string> getSources(void){return std::set<std::string>();} | |||
@@ -179,5 +458,4 @@ namespace Nio { | |||
void waveNew(WavFile*){} | |||
void waveStart(){} | |||
void waveStop(){} | |||
// void waveEnd(void){} | |||
} |
@@ -41,6 +41,8 @@ static CarlaString getResourceDir() | |||
} | |||
CarlaString gUiPixmapPath(getResourceDir()); | |||
const char* embedId = nullptr; | |||
#endif | |||
// base c-style headers | |||
@@ -38,14 +38,11 @@ constexpr int sizeof_pvowels = sizeof(FilterParams::Pvowels); | |||
#define rObject FilterParams::Pvowels_t::formants_t | |||
#undef rChangeCb | |||
#define rChangeCb if (obj->time) { obj->last_update_timestamp = obj->time->time(); } | |||
static const rtosc::Ports subsubports = { | |||
rParamZyn(freq, "Formant frequency"), | |||
rParamZyn(amp, "Strength of formant"), | |||
rParamZyn(q, "Quality Factor"), | |||
}; | |||
#undef rChangeCb | |||
#undef rObject | |||
static const rtosc::Ports subports = { | |||
@@ -59,13 +56,12 @@ static const rtosc::Ports subports = { | |||
FilterParams::Pvowels_t *obj = (FilterParams::Pvowels_t *) d.obj; | |||
d.obj = (void*) &obj->formants[idx]; | |||
subsubports.dispatch(msg, d); | |||
if (obj->time) { obj->last_update_timestamp = obj->time->time(); } | |||
}}, | |||
}; | |||
#define rObject FilterParams | |||
#undef rChangeCb | |||
#define rChangeCb obj->changed = true; if ( obj->time) { \ | |||
#define rChangeCb obj->changed = true; if ( obj->time) { \ | |||
obj->last_update_timestamp = obj->time->time(); } | |||
const rtosc::Ports FilterParams::ports = { | |||
rSelf(FilterParams), | |||
@@ -189,13 +185,10 @@ void FilterParams::defaults(int n) | |||
{ | |||
int j = n; | |||
Pvowels[j].time = time; | |||
for(int i = 0; i < FF_MAX_FORMANTS; ++i) { | |||
Pvowels[j].formants[i].freq = (int)(RND * 127.0f); //some random freqs | |||
Pvowels[j].formants[i].q = 64; | |||
Pvowels[j].formants[i].amp = 127; | |||
Pvowels[j].formants[i].time = time; | |||
} | |||
} | |||
@@ -68,20 +68,11 @@ class FilterParams:public PresetsArray | |||
unsigned char Pcenterfreq, Poctavesfreq; //the center frequency of the res. func., and the number of octaves | |||
struct Pvowels_t { | |||
Pvowels_t() : last_update_timestamp(0) {} | |||
struct formants_t { | |||
formants_t() : last_update_timestamp(0) {} | |||
unsigned char freq, amp, q; //frequency,amplitude,Q | |||
const AbsTime *time; | |||
int64_t last_update_timestamp; | |||
} formants[FF_MAX_FORMANTS]; | |||
const AbsTime *time; | |||
int64_t last_update_timestamp; | |||
} Pvowels[FF_MAX_VOWELS]; | |||
unsigned char Psequencesize; //how many vowels are in the sequence | |||
unsigned char Psequencestretch; //how the sequence is stretched (how the input from filter envelopes/LFOs/etc. is "stretched") | |||
unsigned char Psequencereversed; //if the input from filter envelopes/LFOs/etc. is reversed(negated) | |||
@@ -104,7 +95,8 @@ class FilterParams:public PresetsArray | |||
bool changed; | |||
const AbsTime *time; | |||
int64_t last_update_timestamp; | |||
int64_t last_update_timestamp; // timestamp of last update to this structure, | |||
// including any change to the vowels/formats | |||
static const rtosc::Ports ports; | |||
private: | |||
@@ -180,9 +180,9 @@ static const rtosc::Ports non_realtime_ports = | |||
rOptions(Harmonic, ShiftU, ShiftL, PowerU, PowerL, Sine, | |||
Power, Shift), | |||
"Harmonic Overtone shifting mode"), | |||
rParamZyn(Phrpos.par1, "Harmonic position parameter"), | |||
rParamZyn(Phrpos.par2, "Harmonic position parameter"), | |||
rParamZyn(Phrpos.par3, "Harmonic position parameter"), | |||
rParamI(Phrpos.par1, rLinear(0,255), "Harmonic position parameter"), | |||
rParamI(Phrpos.par2, rLinear(0,255), "Harmonic position parameter"), | |||
rParamI(Phrpos.par3, rLinear(0,255), "Harmonic position parameter"), | |||
//Quality | |||
rOption(Pquality.samplesize, | |||
@@ -321,8 +321,8 @@ void PADnoteParameters::defaults() | |||
oscilgen->defaults(); | |||
Phrpos.type = 0; | |||
Phrpos.par1 = 64; | |||
Phrpos.par2 = 64; | |||
Phrpos.par1 = 0; | |||
Phrpos.par2 = 0; | |||
Phrpos.par3 = 0; | |||
Pquality.samplesize = 3; | |||
@@ -45,10 +45,11 @@ Envelope::Envelope(EnvelopeParams &pars, float basefreq, float bufferdt) | |||
if((mode == 2) && linearenvelope) | |||
mode = 1; //change to linear | |||
for(int i = 0; i < MAX_ENVELOPE_POINTS; ++i) { | |||
for(int i = 0; i < envpoints; ++i) { | |||
const float tmp = pars.getdt(i) / 1000.0f * envstretch; | |||
if(tmp > bufferdt) | |||
envdt[i] = bufferdt / tmp; | |||
envdt[i] = | |||
i == envpoints ? bufferdt / tmp : 1 / ceil(tmp / bufferdt); | |||
else | |||
envdt[i] = 2.0f; //any value larger than 1 | |||
@@ -1265,6 +1265,7 @@ void OscilGen::add2XML(XMLwrapper& xml) | |||
xml.addpar("adaptive_harmonics", Padaptiveharmonics); | |||
xml.addpar("adaptive_harmonics_base_frequency", Padaptiveharmonicsbasefreq); | |||
xml.addpar("adaptive_harmonics_power", Padaptiveharmonicspower); | |||
xml.addpar("adaptive_harmonics_par", Padaptiveharmonicspar); | |||
xml.beginbranch("HARMONICS"); | |||
for(int n = 0; n < MAX_AD_HARMONICS; ++n) { | |||
@@ -1356,6 +1357,10 @@ void OscilGen::getfromXML(XMLwrapper& xml) | |||
Padaptiveharmonicspower, | |||
0, | |||
200); | |||
Padaptiveharmonicspar = xml.getpar("adaptive_harmonics_par", | |||
Padaptiveharmonicspar, | |||
0, | |||
100); | |||
if(xml.enterbranch("HARMONICS")) { | |||
@@ -87,17 +87,21 @@ int EnvelopeFreeEdit::getpointy(int n) const | |||
return (1.0-Penvval[n]/127.0)*ly; | |||
} | |||
static inline int distance_fn(int dx, int dy) { | |||
return dx*dx+dy*dy; | |||
} | |||
int EnvelopeFreeEdit::getnearest(int x,int y) const | |||
{ | |||
x-=5;y-=5; | |||
int nearestpoint=0; | |||
int nearestval=1000000;//a big value | |||
for(int i=0; i<Penvpoints; ++i){ | |||
int distance=abs(x-getpointx(i))+abs(y-getpointy(i)); | |||
if (distance<nearestval) { | |||
int nearest_distance_sq=distance_fn(x-getpointx(0), y-getpointy(0)); | |||
for(int i=1; i<Penvpoints; ++i){ | |||
int distance_sq=distance_fn(x-getpointx(i), y-getpointy(i)); | |||
if (distance_sq<nearest_distance_sq) { | |||
nearestpoint=i; | |||
nearestval=distance; | |||
nearest_distance_sq=distance_sq; | |||
} | |||
} | |||
@@ -114,7 +118,7 @@ float EnvelopeFreeEdit::getdt(int i) const | |||
return dt(Penvdt[i]); | |||
} | |||
static bool ctrldown; | |||
static bool ctrldown, altdown; | |||
void EnvelopeFreeEdit::draw(void) | |||
{ | |||
@@ -135,8 +139,9 @@ void EnvelopeFreeEdit::draw(void) | |||
//draw the lines | |||
fl_color(FL_GRAY); | |||
const int midline = oy+ly*(1-64.0/127); | |||
fl_line_style(FL_SOLID); | |||
fl_line(ox+2,oy+ly/2,ox+lx-2,oy+ly/2); | |||
fl_line(ox+2,midline,ox+lx-2,midline); | |||
//draws the evelope points and lines | |||
Fl_Color alb=FL_WHITE; | |||
@@ -180,14 +185,18 @@ void EnvelopeFreeEdit::draw(void) | |||
time=getdt(lastpoint); | |||
} | |||
char tmpstr[20]; | |||
if (time<1000.0) | |||
snprintf((char *)&tmpstr,20,"%.1fms",time); | |||
else | |||
snprintf((char *)&tmpstr,20,"%.2fs",time/1000.0); | |||
fl_draw(tmpstr,ox+lx-20,oy+ly-10,20,10,FL_ALIGN_RIGHT,NULL,0); | |||
if (lastpoint>=0){ | |||
snprintf((char *)&tmpstr,20,"%d", Penvval[lastpoint]); | |||
fl_draw(tmpstr,ox+lx-20,oy+ly-23,20,10,FL_ALIGN_RIGHT,NULL,0); | |||
if (!altdown || ctrldown) { | |||
if (time<1000.0) | |||
snprintf((char *)&tmpstr,20,"%.1fms",time); | |||
else | |||
snprintf((char *)&tmpstr,20,"%.2fs",time/1000.0); | |||
fl_draw(tmpstr,ox+lx-20,oy+ly-10,20,10,FL_ALIGN_RIGHT,NULL,0); | |||
} | |||
if (!altdown || !ctrldown) { | |||
if (lastpoint>=0){ | |||
snprintf((char *)&tmpstr,20,"%d", Penvval[lastpoint]); | |||
fl_draw(tmpstr,ox+lx-20,oy+ly-23,20,10,FL_ALIGN_RIGHT,NULL,0); | |||
} | |||
} | |||
} | |||
@@ -196,7 +205,7 @@ int EnvelopeFreeEdit::handle(int event) | |||
const int x_=Fl::event_x()-x(); | |||
const int y_=Fl::event_y()-y(); | |||
static Fl_Widget *old_focus; | |||
int key; | |||
int key, old_mod_state; | |||
switch(event) { | |||
case FL_ENTER: | |||
@@ -211,6 +220,11 @@ int EnvelopeFreeEdit::handle(int event) | |||
case FL_KEYDOWN: | |||
case FL_KEYUP: | |||
key = Fl::event_key(); | |||
if (key==FL_Alt_L || key==FL_Alt_R) { | |||
altdown = (event==FL_KEYDOWN); | |||
redraw(); | |||
if (pair!=NULL) pair->redraw(); | |||
} | |||
if (key==FL_Control_L || key==FL_Control_R){ | |||
ctrldown = (event==FL_KEYDOWN); | |||
redraw(); | |||
@@ -220,7 +234,9 @@ int EnvelopeFreeEdit::handle(int event) | |||
case FL_PUSH: | |||
currentpoint=getnearest(x_,y_); | |||
cpx=x_; | |||
cpy=y_; | |||
cpdt=Penvdt[currentpoint]; | |||
cpval=Penvval[currentpoint]; | |||
lastpoint=currentpoint; | |||
redraw(); | |||
if (pair) | |||
@@ -233,15 +249,18 @@ int EnvelopeFreeEdit::handle(int event) | |||
pair->redraw(); | |||
return 1; | |||
case FL_MOUSEWHEEL: | |||
if (Fl::event_buttons()) | |||
return 1; | |||
if (lastpoint>=0) { | |||
int delta = Fl::event_dy() * (Fl::event_shift() ? 4 : 1); | |||
if (!ctrldown) { | |||
int ny = Penvval[lastpoint] - Fl::event_dy(); | |||
int ny = Penvval[lastpoint] - delta; | |||
ny = ny < 0 ? 0 : ny > 127 ? 127 : ny; | |||
Penvval[lastpoint] = ny; | |||
oscWrite(to_s("Penvval")+to_s(lastpoint), "c", ny); | |||
oscWrite("Penvval",""); | |||
} else if (lastpoint > 0) { | |||
int newdt = Fl::event_dy() + Penvdt[lastpoint]; | |||
int newdt = Penvdt[lastpoint] - delta; | |||
newdt = newdt < 0 ? 0 : newdt > 127 ? 127 : newdt; | |||
Penvdt[lastpoint] = newdt; | |||
oscWrite(to_s("Penvdt")+to_s(lastpoint), "c", newdt); | |||
@@ -253,22 +272,37 @@ int EnvelopeFreeEdit::handle(int event) | |||
} | |||
case FL_DRAG: | |||
if (currentpoint>=0){ | |||
int ny=limit(127-(int) (y_*127.0/h()), 0, 127); | |||
old_mod_state = mod_state; | |||
mod_state = ctrldown << 1 | altdown; | |||
if (old_mod_state != mod_state) { | |||
cpx=x_; | |||
cpy=y_; | |||
cpdt=Penvdt[currentpoint]; | |||
cpval=Penvval[currentpoint]; | |||
old_mod_state = mod_state; | |||
} | |||
if (!altdown || !ctrldown) { | |||
const int dy=(int)((cpy-y_)/3.0); | |||
const int newval=limit(cpval+dy, 0, 127); | |||
Penvval[currentpoint]=ny; | |||
Penvval[currentpoint]=newval; | |||
oscWrite(to_s("Penvval")+to_s(currentpoint), "c", newval); | |||
oscWrite("Penvval",""); | |||
} | |||
const int dx=(int)((x_-cpx)*0.1); | |||
const int newdt=limit(cpdt+dx,0,127); | |||
if (!altdown || ctrldown) { | |||
const int dx=(int)((x_-cpx)*0.1); | |||
const int newdt=limit(cpdt+dx,0,127); | |||
if(currentpoint!=0) | |||
Penvdt[currentpoint]=newdt; | |||
else | |||
Penvdt[currentpoint]=0; | |||
if(currentpoint!=0) | |||
Penvdt[currentpoint]=newdt; | |||
else | |||
Penvdt[currentpoint]=0; | |||
oscWrite(to_s("Penvdt")+to_s(currentpoint), "c", newdt); | |||
oscWrite("Penvdt",""); | |||
} | |||
oscWrite(to_s("Penvval")+to_s(currentpoint), "c", ny); | |||
oscWrite(to_s("Penvdt")+to_s(currentpoint), "c", newdt); | |||
oscWrite("Penvdt",""); | |||
oscWrite("Penvval",""); | |||
redraw(); | |||
if(pair) | |||
@@ -40,11 +40,13 @@ class EnvelopeFreeEdit : public Fl_Box, public Fl_Osc_Widget | |||
Fl_Box *pair; //XXX what the heck is this? | |||
//cursor state | |||
int currentpoint, cpx, cpdt; | |||
int currentpoint, cpx, cpy, cpdt, cpval; | |||
//The Points | |||
char Penvdt[MAX_ENVELOPE_POINTS]; | |||
char Penvval[MAX_ENVELOPE_POINTS]; | |||
//The Sustain point | |||
char Penvsustain; | |||
int button_state; | |||
int mod_state; | |||
}; |
@@ -146,14 +146,12 @@ sustaincounter->update(); | |||
label frcR | |||
tooltip {Forced Release} xywh {410 165 40 15} down_box DOWN_BOX labelsize 10 | |||
code0 {o->init("Pforcedrelease");} | |||
code1 {//TODO if (Pfreemode==0) o->hide();} | |||
class Fl_Osc_Check | |||
} | |||
Fl_Dial envstretchdial { | |||
label {Str.} | |||
tooltip {Envelope stretch (on lower notes make the envelope longer)} xywh {380 155 25 25} box ROUND_UP_BOX labelsize 10 align 4 maximum 127 step 1 | |||
code0 {o->init("Penvstretch");} | |||
code1 {//TODO if (Pfreemode==0) o->hide();} | |||
class Fl_Osc_Dial | |||
} | |||
Fl_Button {} { | |||
@@ -165,7 +163,6 @@ sustaincounter->update(); | |||
label L | |||
tooltip {Linear Envelope} xywh {410 151 30 15} down_box DOWN_BOX labelsize 10 | |||
code0 {o->init("Plinearenvelope");} | |||
code1 {//TODO if ((Pfreemode==0)||(Envmode>2)) o->hide();} | |||
class Fl_Osc_Check | |||
} | |||
Fl_Counter sustaincounter { | |||
@@ -616,8 +613,12 @@ refresh_display();} {} | |||
envstretchdial->value(Penvstretch); | |||
linearenvelopecheck->value(Plinearenvelope); | |||
linearenvelopecheck->show(); | |||
if (Envmode > 2) | |||
linearenvelopecheck->hide(); | |||
else { | |||
linearenvelopecheck->value(Plinearenvelope); | |||
linearenvelopecheck->show(); | |||
} | |||
forcedreleasecheck->value(Pforcedrelease); | |||
@@ -386,7 +386,7 @@ cbwidget->do_callback();}} | |||
callback {opui->update(); | |||
hpui->update(); | |||
cbwidget->do_callback();} | |||
xywh {425 310 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 | |||
xywh {425 310 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 255 step 1 | |||
code0 {o->init("Phrpos.par1");o->reset_value=64;} | |||
class Fl_Osc_Dial | |||
} | |||
@@ -394,7 +394,7 @@ cbwidget->do_callback();} | |||
label Par2 | |||
callback {opui->update(); | |||
cbwidget->do_callback();} | |||
xywh {460 310 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 | |||
xywh {460 310 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 255 step 1 | |||
code0 {o->init("Phrpos.par2");o->reset_value=64;} | |||
class Fl_Osc_Dial | |||
} | |||
@@ -402,7 +402,7 @@ cbwidget->do_callback();} | |||
label ForceH | |||
callback {opui->update(); | |||
cbwidget->do_callback();} | |||
xywh {495 310 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 | |||
xywh {495 310 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 255 step 1 | |||
code0 {o->init("Phrpos.par3");} | |||
class Fl_Osc_Dial | |||
} | |||
@@ -31,7 +31,8 @@ | |||
#include <sys/stat.h> | |||
GUI::ui_handle_t gui = 0; | |||
#if USE_NSM | |||
NSM_Client *nsm = 0; | |||
NSM_Client *nsm = NULL; | |||
const char *embedId = NULL; | |||
#endif | |||
lo_server server; | |||
std::string sendtourl; | |||
@@ -75,6 +76,7 @@ int Pexitprogram = 0; | |||
#include <FL/Fl_Shared_Image.H> | |||
#include <FL/Fl_Tiled_Image.H> | |||
#include <FL/Fl_Dial.H> | |||
#include <FL/x.H> | |||
#include <err.h> | |||
#endif // NTK_GUI | |||
@@ -187,7 +189,21 @@ ui_handle_t GUI::createUi(Fl_Osc_Interface *osc, void *exit) | |||
//midi_win->show(); | |||
Fl::add_handler(kb_shortcut_handler); | |||
return (void*) (ui = new MasterUI((int*)exit, osc)); | |||
ui = new MasterUI((int*)exit, osc); | |||
#ifdef NTK_GUI | |||
if (embedId != NULL) | |||
{ | |||
if (long long winId = atoll(embedId)) | |||
{ | |||
fl_embed(ui->masterwindow, winId); | |||
ui->masterwindow->show(); | |||
} | |||
} | |||
#endif | |||
return (void*) ui; | |||
} | |||
void GUI::destroyUi(ui_handle_t ui) | |||
{ | |||
@@ -571,6 +587,10 @@ int main(int argc, char *argv[]) | |||
help = true; | |||
else if(!strcmp("--no-uri", argv[i])) | |||
no_uri = true; | |||
#if USE_NSM | |||
else if(!strcmp("--embed", argv[i])) | |||
embedId = argv[++i]; | |||
#endif | |||
else | |||
uri = argv[i]; | |||
} | |||
@@ -586,7 +606,7 @@ int main(int argc, char *argv[]) | |||
if(uri) { | |||
server = lo_server_new_with_proto(NULL, LO_UDP, liblo_error_cb); | |||
lo_server_add_method(server, NULL, NULL, handler_function, 0); | |||
sendtourl = argv[1]; | |||
sendtourl = uri; | |||
} | |||
fprintf(stderr, "ext client running on %d\n", lo_server_get_port(server)); | |||
std::thread lo_watch(watch_lo); | |||
@@ -69,6 +69,7 @@ struct PluginListManager { | |||
if (std::strcmp(desc->label, "bypass" ) == 0 || | |||
std::strcmp(desc->label, "3bandeq" ) == 0 || | |||
std::strcmp(desc->label, "3bandsplitter") == 0 || | |||
std::strcmp(desc->label, "kars" ) == 0 || | |||
std::strcmp(desc->label, "mverb" ) == 0 || | |||
std::strcmp(desc->label, "nekobi" ) == 0 || | |||
std::strcmp(desc->label, "pingpongpan" ) == 0 || | |||