@@ -457,7 +457,7 @@ bool Bank::isPADsynth_used(unsigned int ninstrument) | |||
void Bank::deletefrombank(int pos) | |||
{ | |||
if((pos < 0) || (pos >= (int) banks.size())) | |||
if((pos < 0) || (pos >= BANK_SIZE)) | |||
return; | |||
ins[pos] = ins_t(); | |||
} | |||
@@ -87,14 +87,22 @@ void Config::init() | |||
cfg.bankRootDirList[1] = "./"; | |||
cfg.bankRootDirList[2] = "/usr/share/zynaddsubfx/banks"; | |||
cfg.bankRootDirList[3] = "/usr/local/share/zynaddsubfx/banks"; | |||
#ifdef __APPLE__ | |||
cfg.bankRootDirList[4] = "../Resources/banks"; | |||
#else | |||
cfg.bankRootDirList[4] = "../banks"; | |||
#endif | |||
cfg.bankRootDirList[5] = "banks"; | |||
} | |||
if(cfg.presetsDirList[0].empty()) { | |||
//presets | |||
cfg.presetsDirList[0] = "./"; | |||
#ifdef __APPLE__ | |||
cfg.presetsDirList[1] = "../Resources/presets"; | |||
#else | |||
cfg.presetsDirList[1] = "../presets"; | |||
#endif | |||
cfg.presetsDirList[2] = "presets"; | |||
cfg.presetsDirList[3] = "/usr/share/zynaddsubfx/presets"; | |||
cfg.presetsDirList[4] = "/usr/local/share/zynaddsubfx/presets"; | |||
@@ -98,7 +98,7 @@ XMLwrapper::XMLwrapper() | |||
{ | |||
version.Major = 2; | |||
version.Minor = 4; | |||
version.Revision = 3; | |||
version.Revision = 4; | |||
minimal = true; | |||
@@ -44,13 +44,12 @@ InMgr::InMgr() | |||
:queue(100), master(Master::getInstance()) | |||
{ | |||
current = NULL; | |||
sem_init(&work, PTHREAD_PROCESS_PRIVATE, 0); | |||
work.init(PTHREAD_PROCESS_PRIVATE, 0); | |||
} | |||
InMgr::~InMgr() | |||
{ | |||
//lets stop the consumer thread | |||
sem_destroy(&work); | |||
} | |||
void InMgr::putEvent(MidiEvent ev) | |||
@@ -58,17 +57,17 @@ void InMgr::putEvent(MidiEvent ev) | |||
if(queue.push(ev)) //check for error | |||
cerr << "ERROR: Midi Ringbuffer is FULL" << endl; | |||
else | |||
sem_post(&work); | |||
work.post(); | |||
} | |||
void InMgr::flush(unsigned frameStart, unsigned frameStop) | |||
{ | |||
MidiEvent ev; | |||
while(!sem_trywait(&work)) { | |||
while(!work.trywait()) { | |||
queue.peak(ev); | |||
if(ev.time < (int)frameStart || ev.time > (int)frameStop) { | |||
//Back out of transaction | |||
sem_post(&work); | |||
work.post(); | |||
//printf("%d vs [%d..%d]\n",ev.time, frameStart, frameStop); | |||
break; | |||
} | |||
@@ -102,8 +101,7 @@ void InMgr::flush(unsigned frameStart, unsigned frameStop) | |||
bool InMgr::empty(void) const | |||
{ | |||
int semvalue = 0; | |||
sem_getvalue(&work, &semvalue); | |||
int semvalue = work.getvalue(); | |||
return semvalue <= 0; | |||
} | |||
@@ -2,7 +2,7 @@ | |||
#define INMGR_H | |||
#include <string> | |||
#include <semaphore.h> | |||
#include "ZynSema.h" | |||
#include "SafeQueue.h" | |||
enum midi_type { | |||
@@ -45,7 +45,7 @@ class InMgr | |||
InMgr(); | |||
class MidiIn *getIn(std::string name); | |||
SafeQueue<MidiEvent> queue; | |||
mutable sem_t work; | |||
mutable ZynSema work; | |||
class MidiIn * current; | |||
/**the link to the rest of zyn*/ | |||
@@ -67,10 +67,14 @@ bool OssEngine::openAudio() | |||
int snd_format = AFMT_S16_LE; | |||
int snd_samplerate = synth->samplerate; | |||
audio.handle = open(config.cfg.LinuxOSSWaveOutDev, O_WRONLY, 0); | |||
const char *device = config.cfg.LinuxOSSWaveOutDev; | |||
if(getenv("DSP_DEVICE")) | |||
device = getenv("DSP_DEVICE"); | |||
audio.handle = open(device, O_WRONLY, 0); | |||
if(audio.handle == -1) { | |||
cerr << "ERROR - I can't open the " | |||
<< config.cfg.LinuxOSSWaveOutDev << '.' << endl; | |||
<< device << '.' << endl; | |||
return false; | |||
} | |||
ioctl(audio.handle, SNDCTL_DSP_RESET, NULL); | |||
@@ -3,16 +3,14 @@ template<class T> | |||
SafeQueue<T>::SafeQueue(size_t maxlen) | |||
:writePtr(0), readPtr(0), bufSize(maxlen) | |||
{ | |||
sem_init(&w_space, PTHREAD_PROCESS_PRIVATE, maxlen - 1); | |||
sem_init(&r_space, PTHREAD_PROCESS_PRIVATE, 0); | |||
w_space.init(PTHREAD_PROCESS_PRIVATE, maxlen - 1); | |||
r_space.init(PTHREAD_PROCESS_PRIVATE, 0); | |||
buffer = new T[maxlen]; | |||
} | |||
template<class T> | |||
SafeQueue<T>::~SafeQueue() | |||
{ | |||
sem_destroy(&w_space); | |||
sem_destroy(&r_space); | |||
delete [] buffer; | |||
} | |||
@@ -25,17 +23,13 @@ unsigned int SafeQueue<T>::size() const | |||
template<class T> | |||
unsigned int SafeQueue<T>::rSpace() const | |||
{ | |||
int space = 0; | |||
sem_getvalue(&r_space, &space); | |||
return space; | |||
return r_space.getvalue(); | |||
} | |||
template<class T> | |||
unsigned int SafeQueue<T>::wSpace() const | |||
{ | |||
int space = 0; | |||
sem_getvalue(&w_space, &space); | |||
return space; | |||
return w_space.getvalue(); | |||
} | |||
template<class T> | |||
@@ -50,8 +44,8 @@ int SafeQueue<T>::push(const T &in) | |||
writePtr = w; | |||
//adjust ranges | |||
sem_wait(&w_space); //guaranteed not to wait | |||
sem_post(&r_space); | |||
w_space.wait(); //guaranteed not to wait | |||
r_space.post(); | |||
return 0; | |||
} | |||
@@ -80,8 +74,8 @@ int SafeQueue<T>::pop(T &out) | |||
readPtr = r; | |||
//adjust ranges | |||
sem_wait(&r_space); //guaranteed not to wait | |||
sem_post(&w_space); | |||
r_space.wait(); //guaranteed not to wait | |||
w_space.post(); | |||
return 0; | |||
} | |||
@@ -89,7 +83,7 @@ template<class T> | |||
void SafeQueue<T>::clear() | |||
{ | |||
//thread unsafe | |||
while(!sem_trywait(&r_space)) | |||
sem_post(&w_space); | |||
while(!r_space.trywait()) | |||
w_space.post(); | |||
readPtr = writePtr; | |||
} |
@@ -2,7 +2,7 @@ | |||
#ifndef SAFEQUEUE_H | |||
#define SAFEQUEUE_H | |||
#include <cstdlib> | |||
#include <semaphore.h> | |||
#include "ZynSema.h" | |||
#include <pthread.h> | |||
/** | |||
@@ -32,9 +32,9 @@ class SafeQueue | |||
unsigned int rSpace() const; | |||
//write space | |||
mutable sem_t w_space; | |||
mutable ZynSema w_space; | |||
//read space | |||
mutable sem_t r_space; | |||
mutable ZynSema r_space; | |||
//next writing spot | |||
size_t writePtr; | |||
@@ -28,13 +28,12 @@ using namespace std; | |||
WavEngine::WavEngine() | |||
:AudioOut(), file(NULL), buffer(synth->samplerate * 4), pThread(NULL) | |||
{ | |||
sem_init(&work, PTHREAD_PROCESS_PRIVATE, 0); | |||
work.init(PTHREAD_PROCESS_PRIVATE, 0); | |||
} | |||
WavEngine::~WavEngine() | |||
{ | |||
Stop(); | |||
sem_destroy(&work); | |||
destroyFile(); | |||
} | |||
@@ -65,7 +64,7 @@ void WavEngine::Stop() | |||
pthread_t *tmp = pThread; | |||
pThread = NULL; | |||
sem_post(&work); | |||
work.post(); | |||
pthread_join(*tmp, NULL); | |||
delete pThread; | |||
} | |||
@@ -81,7 +80,7 @@ void WavEngine::push(Stereo<float *> smps, size_t len) | |||
buffer.push(*smps.l++); | |||
buffer.push(*smps.r++); | |||
} | |||
sem_post(&work); | |||
work.post(); | |||
} | |||
void WavEngine::newFile(WavFile *_file) | |||
@@ -113,7 +112,7 @@ void *WavEngine::AudioThread() | |||
{ | |||
short *recordbuf_16bit = new short[2 * synth->buffersize]; | |||
while(!sem_wait(&work) && pThread) { | |||
while(!work.wait() && pThread) { | |||
for(int i = 0; i < synth->buffersize; ++i) { | |||
float left = 0.0f, right = 0.0f; | |||
buffer.pop(left); | |||
@@ -25,7 +25,7 @@ | |||
#include "AudioOut.h" | |||
#include <string> | |||
#include <pthread.h> | |||
#include <semaphore.h> | |||
#include "ZynSema.h" | |||
#include "SafeQueue.h" | |||
class WavFile; | |||
@@ -53,7 +53,7 @@ class WavEngine:public AudioOut | |||
private: | |||
WavFile *file; | |||
sem_t work; | |||
ZynSema work; | |||
SafeQueue<float> buffer; | |||
pthread_t *pThread; | |||
@@ -0,0 +1,112 @@ | |||
#ifndef ZYNSEMA_H | |||
#define ZYNSEMA_H | |||
#if defined __APPLE__ || defined WIN32 | |||
#include <pthread.h> | |||
class ZynSema | |||
{ | |||
public: | |||
ZynSema (void) : _count (0) | |||
{ | |||
} | |||
~ZynSema (void) | |||
{ | |||
pthread_mutex_destroy (&_mutex); | |||
pthread_cond_destroy (&_cond); | |||
} | |||
int init (int, int v) | |||
{ | |||
_count = v; | |||
return pthread_mutex_init (&_mutex, 0) || pthread_cond_init (&_cond, 0); | |||
} | |||
int post (void) | |||
{ | |||
pthread_mutex_lock (&_mutex); | |||
if (++_count == 1) pthread_cond_signal (&_cond); | |||
pthread_mutex_unlock (&_mutex); | |||
return 0; | |||
} | |||
int wait (void) | |||
{ | |||
pthread_mutex_lock (&_mutex); | |||
while (_count < 1) pthread_cond_wait (&_cond, &_mutex); | |||
--_count; | |||
pthread_mutex_unlock (&_mutex); | |||
return 0; | |||
} | |||
int trywait (void) | |||
{ | |||
if (pthread_mutex_trylock (&_mutex)) return -1; | |||
if (_count < 1) | |||
{ | |||
pthread_mutex_unlock (&_mutex); | |||
return -1; | |||
} | |||
--_count; | |||
pthread_mutex_unlock (&_mutex); | |||
return 0; | |||
} | |||
int getvalue (void) const | |||
{ | |||
return _count; | |||
} | |||
private: | |||
int _count; | |||
pthread_mutex_t _mutex; | |||
pthread_cond_t _cond; | |||
}; | |||
#else // POSIX sempahore | |||
#include <semaphore.h> | |||
class ZynSema | |||
{ | |||
public: | |||
ZynSema (void) | |||
{ | |||
} | |||
~ZynSema (void) | |||
{ | |||
sem_destroy (&_sema); | |||
} | |||
int init (int s, int v) | |||
{ | |||
return sem_init (&_sema, s, v); | |||
} | |||
int post (void) | |||
{ | |||
return sem_post (&_sema); | |||
} | |||
int wait (void) | |||
{ | |||
return sem_wait (&_sema); | |||
} | |||
int trywait (void) | |||
{ | |||
return sem_trywait (&_sema); | |||
} | |||
int getvalue(void) | |||
{ | |||
int v = 0; | |||
sem_getvalue(&_sema, &v); | |||
return v; | |||
} | |||
private: | |||
sem_t _sema; | |||
}; | |||
#endif // POSIX semapore | |||
#endif // ZYNSEMA_H |
@@ -127,6 +127,7 @@ void ADnoteVoiceParam::defaults() | |||
Unison_vibratto = 64; | |||
Unison_vibratto_speed = 64; | |||
Unison_invert_phase = 0; | |||
Unison_phase_randomness = 127; | |||
Type = 0; | |||
Pfixedfreq = 0; | |||
@@ -351,6 +352,7 @@ void ADnoteVoiceParam::add2XML(XMLwrapper *xml, bool fmoscilused) | |||
xml->addpar("unison_vibratto", Unison_vibratto); | |||
xml->addpar("unison_vibratto_speed", Unison_vibratto_speed); | |||
xml->addpar("unison_invert_phase", Unison_invert_phase); | |||
xml->addpar("unison_phase_randomness", Unison_phase_randomness); | |||
xml->addpar("delay", PDelay); | |||
xml->addparbool("resonance", Presonance); | |||
@@ -664,6 +666,8 @@ void ADnoteVoiceParam::getfromXML(XMLwrapper *xml, unsigned nvoice) | |||
Unison_vibratto_speed); | |||
Unison_invert_phase = xml->getpar127("unison_invert_phase", | |||
Unison_invert_phase); | |||
Unison_phase_randomness = xml->getpar127("unison_phase_randomness", | |||
Unison_phase_randomness); | |||
Type = xml->getpar127("type", Type); | |||
PDelay = xml->getpar127("delay", PDelay); | |||
@@ -133,6 +133,9 @@ struct ADnoteVoiceParam { | |||
/** How subvoices are spread */ | |||
unsigned char Unison_frequency_spread; | |||
/** How much phase randomization */ | |||
unsigned char Unison_phase_randomness; | |||
/** Stereo spread of the subvoices*/ | |||
unsigned char Unison_stereo_spread; | |||
@@ -364,6 +364,9 @@ float PADnoteParameters::getNhr(int n) | |||
tmp = powf(par2 * 2.0f, 2.0f) + 0.1f; | |||
result = n0 * powf(1.0f + par1 * powf(n0 * 0.8f, tmp), tmp) + 1.0f; | |||
break; | |||
case 7: | |||
result = (n + Phrpos.par1 / 255.0f) / (Phrpos.par1 / 255.0f + 1); | |||
break; | |||
default: | |||
result = n; | |||
break; | |||
@@ -560,7 +563,7 @@ void PADnoteParameters::applyparameters(bool lockmutex) | |||
{ | |||
const int samplesize = (((int) 1) << (Pquality.samplesize + 14)); | |||
int spectrumsize = samplesize / 2; | |||
float spectrum[spectrumsize]; | |||
float *spectrum = new float[spectrumsize]; | |||
int profilesize = 512; | |||
float profile[profilesize]; | |||
@@ -649,6 +652,7 @@ void PADnoteParameters::applyparameters(bool lockmutex) | |||
} | |||
delete (fft); | |||
delete[] fftfreqs; | |||
delete[] spectrum; | |||
//delete the additional samples that might exists and are not useful | |||
if(lockmutex) { | |||
@@ -23,6 +23,7 @@ | |||
#include "../globals.h" | |||
#include "SUBnoteParameters.h" | |||
#include <stdio.h> | |||
#include <cmath> | |||
SUBnoteParameters::SUBnoteParameters():Presets() | |||
{ | |||
@@ -63,6 +64,12 @@ void SUBnoteParameters::defaults() | |||
PFreqEnvelopeEnabled = 0; | |||
PBandWidthEnvelopeEnabled = 0; | |||
POvertoneSpread.type = 0; | |||
POvertoneSpread.par1 = 0; | |||
POvertoneSpread.par2 = 0; | |||
POvertoneSpread.par3 = 0; | |||
updateFrequencyMultipliers(); | |||
for(int n = 0; n < MAX_SUB_HARMONICS; ++n) { | |||
Phmag[n] = 0; | |||
Phrelbw[n] = 64; | |||
@@ -127,6 +134,10 @@ void SUBnoteParameters::add2XML(XMLwrapper *xml) | |||
xml->addpar("detune", PDetune); | |||
xml->addpar("coarse_detune", PCoarseDetune); | |||
xml->addpar("overtone_spread_type", POvertoneSpread.type); | |||
xml->addpar("overtone_spread_par1", POvertoneSpread.par1); | |||
xml->addpar("overtone_spread_par2", POvertoneSpread.par2); | |||
xml->addpar("overtone_spread_par3", POvertoneSpread.par3); | |||
xml->addpar("detune_type", PDetuneType); | |||
xml->addpar("bandwidth", Pbandwidth); | |||
@@ -166,6 +177,66 @@ void SUBnoteParameters::add2XML(XMLwrapper *xml) | |||
xml->endbranch(); | |||
} | |||
void SUBnoteParameters::updateFrequencyMultipliers(void) { | |||
float par1 = POvertoneSpread.par1 / 255.0f; | |||
float par1pow = powf(10.0f, | |||
-(1.0f - POvertoneSpread.par1 / 255.0f) * 3.0f); | |||
float par2 = POvertoneSpread.par2 / 255.0f; | |||
float par3 = 1.0f - POvertoneSpread.par3 / 255.0f; | |||
float result; | |||
float tmp = 0.0f; | |||
int thresh = 0; | |||
for(int n = 0; n < MAX_SUB_HARMONICS; ++n) { | |||
float n1 = n + 1.0f; | |||
switch(POvertoneSpread.type) { | |||
case 1: | |||
thresh = (int)(100.0f * par2 * par2) + 1; | |||
if (n1 < thresh) | |||
result = n1; | |||
else | |||
result = n1 + 8.0f * (n1 - thresh) * par1pow; | |||
break; | |||
case 2: | |||
thresh = (int)(100.0f * par2 * par2) + 1; | |||
if (n1 < thresh) | |||
result = n1; | |||
else | |||
result = n1 + 0.9f * (thresh - n1) * par1pow; | |||
break; | |||
case 3: | |||
tmp = par1pow * 100.0f + 1.0f; | |||
result = powf(n / tmp, 1.0f - 0.8f * par2) * tmp + 1.0f; | |||
break; | |||
case 4: | |||
result = n * (1.0f - par1pow) + | |||
powf(0.1f * n, 3.0f * par2 + 1.0f) * | |||
10.0f * par1pow + 1.0f; | |||
break; | |||
case 5: | |||
result = n1 + 2.0f * sinf(n * par2 * par2 * PI * 0.999f) * | |||
sqrt(par1pow); | |||
break; | |||
case 6: | |||
tmp = powf(2.0f * par2, 2.0f) + 0.1f; | |||
result = n * powf(par1 * powf(0.8f * n, tmp) + 1.0f, tmp) + | |||
1.0f; | |||
break; | |||
case 7: | |||
result = (n1 + par1) / (par1 + 1); | |||
break; | |||
default: | |||
result = n1; | |||
} | |||
float iresult = floor(result + 0.5f); | |||
POvertoneFreqMult[n] = iresult + par3 * (result - iresult); | |||
} | |||
} | |||
void SUBnoteParameters::getfromXML(XMLwrapper *xml) | |||
{ | |||
Pnumstages = xml->getpar127("num_stages", Pnumstages); | |||
@@ -203,6 +274,15 @@ void SUBnoteParameters::getfromXML(XMLwrapper *xml) | |||
PDetune = xml->getpar("detune", PDetune, 0, 16383); | |||
PCoarseDetune = xml->getpar("coarse_detune", PCoarseDetune, 0, 16383); | |||
POvertoneSpread.type = | |||
xml->getpar127("overtone_spread_type", POvertoneSpread.type); | |||
POvertoneSpread.par1 = | |||
xml->getpar("overtone_spread_par1", POvertoneSpread.par1, 0, 255); | |||
POvertoneSpread.par2 = | |||
xml->getpar("overtone_spread_par2", POvertoneSpread.par2, 0, 255); | |||
POvertoneSpread.par3 = | |||
xml->getpar("overtone_spread_par3", POvertoneSpread.par3, 0, 255); | |||
updateFrequencyMultipliers(); | |||
PDetuneType = xml->getpar127("detune_type", PDetuneType); | |||
Pbandwidth = xml->getpar127("bandwidth", Pbandwidth); | |||
@@ -38,6 +38,7 @@ class SUBnoteParameters:public Presets | |||
void add2XML(XMLwrapper *xml); | |||
void defaults(); | |||
void getfromXML(XMLwrapper *xml); | |||
void updateFrequencyMultipliers(void); | |||
//Parameters | |||
//AMPLITUDE PARAMETRERS | |||
@@ -74,6 +75,14 @@ class SUBnoteParameters:public Presets | |||
if this parameter is 64, 1 MIDI halftone -> 1 frequency halftone */ | |||
unsigned char PfixedfreqET; | |||
// Overtone spread parameters | |||
struct { | |||
unsigned char type; | |||
unsigned char par1; | |||
unsigned char par2; | |||
unsigned char par3; | |||
} POvertoneSpread; | |||
float POvertoneFreqMult[MAX_SUB_HARMONICS]; | |||
//how many times the filters are applied | |||
unsigned char Pnumstages; | |||
@@ -302,7 +302,10 @@ ADnote::ADnote(ADnoteParameters *pars, | |||
for(int k = 0; k < unison; ++k) { | |||
oscposhi[nvoice][k] = oscposhi_start; | |||
oscposhi_start = (int)(RND * (synth->oscilsize - 1)); //put random starting point for other subvoices | |||
//put random starting point for other subvoices | |||
oscposhi_start = | |||
(int)(RND * pars->VoicePar[nvoice].Unison_phase_randomness / | |||
127.0f * (synth->oscilsize - 1)); | |||
} | |||
NoteVoicePar[nvoice].FreqLfo = NULL; | |||
@@ -159,6 +159,14 @@ float Envelope::envout() | |||
return out; | |||
} | |||
inline float Envelope::env_dB2rap(float db) { | |||
return (powf(10.0f, db / 20.0f) - 0.01)/.99f; | |||
} | |||
inline float Envelope::env_rap2dB(float rap) { | |||
return 20.0f * log10f(rap * 0.99f + 0.01); | |||
} | |||
/* | |||
* Envelope Output (dB) | |||
*/ | |||
@@ -169,8 +177,8 @@ float Envelope::envout_dB() | |||
return envout(); | |||
if((currentpoint == 1) && (!keyreleased || (forcedrelase == 0))) { //first point is always lineary interpolated | |||
float v1 = dB2rap(envval[0]); | |||
float v2 = dB2rap(envval[1]); | |||
float v1 = env_dB2rap(envval[0]); | |||
float v2 = env_dB2rap(envval[1]); | |||
out = v1 + (v2 - v1) * t; | |||
t += inct; | |||
@@ -182,12 +190,12 @@ float Envelope::envout_dB() | |||
} | |||
if(out > 0.001f) | |||
envoutval = rap2dB(out); | |||
envoutval = env_rap2dB(out); | |||
else | |||
envoutval = MIN_ENVELOPE_DB; | |||
} | |||
else | |||
out = dB2rap(envout()); | |||
out = env_dB2rap(envout()); | |||
return out; | |||
} | |||
@@ -42,6 +42,8 @@ class Envelope | |||
* @return returns 1 if the envelope is finished*/ | |||
bool finished() const; | |||
private: | |||
float env_rap2dB(float rap); | |||
float env_dB2rap(float db); | |||
int envpoints; | |||
int envsustain; //"-1" means disabled | |||
float envdt[MAX_ENVELOPE_POINTS]; //millisecons | |||
@@ -504,10 +504,10 @@ void OscilGen::spectrumadjust() | |||
par = powf(8.0f, par); | |||
break; | |||
case 2: | |||
par = powf(10.0f, (1.0f - par) * 3.0f) * 0.25f; | |||
par = powf(10.0f, (1.0f - par) * 3.0f) * 0.001f; | |||
break; | |||
case 3: | |||
par = powf(10.0f, (1.0f - par) * 3.0f) * 0.25f; | |||
par = powf(10.0f, (1.0f - par) * 3.0f) * 0.001f; | |||
break; | |||
} | |||
@@ -516,7 +516,7 @@ void OscilGen::spectrumadjust() | |||
for(int i = 0; i < synth->oscilsize / 2; ++i) { | |||
float mag = abs(oscilFFTfreqs, i); | |||
float phase = arg(oscilFFTfreqs, i); | |||
float phase = M_PI_2 - arg(oscilFFTfreqs, i); | |||
switch(Psatype) { | |||
case 1: | |||
@@ -101,13 +101,12 @@ void SUBnote::setup(float freq, | |||
GlobalFilterEnvelope = NULL; | |||
} | |||
//select only harmonics that desire to compute | |||
int harmonics = 0; | |||
//select only harmonics that desire to compute | |||
for(int n = 0; n < MAX_SUB_HARMONICS; ++n) { | |||
if(pars->Phmag[n] == 0) | |||
continue; | |||
if(n * basefreq > synth->samplerate_f / 2.0f) | |||
break; //remove the freqs above the Nyquist freq | |||
pos[harmonics++] = n; | |||
} | |||
if(!legato) | |||
@@ -136,7 +135,9 @@ void SUBnote::setup(float freq, | |||
float reduceamp = 0.0f; | |||
for(int n = 0; n < numharmonics; ++n) { | |||
float freq = basefreq * (pos[n] + 1); | |||
float freq = basefreq * pars->POvertoneFreqMult[pos[n]]; | |||
overtone_freq[n] = freq; | |||
overtone_rolloff[n] = computerolloff(freq); | |||
//the bandwidth is not absolute(Hz); it is relative to frequency | |||
float bw = | |||
@@ -387,6 +388,25 @@ void SUBnote::initparameters(float freq) | |||
computecurrentparameters(); | |||
} | |||
/* | |||
* Compute how much to reduce amplitude near nyquist or subaudible frequencies. | |||
*/ | |||
float SUBnote::computerolloff(float freq) | |||
{ | |||
const float lower_limit = 10.0f; | |||
const float lower_width = 10.0f; | |||
const float upper_width = 200.0f; | |||
float upper_limit = synth->samplerate / 2.0f; | |||
if (freq > lower_limit + lower_width && | |||
freq < upper_limit - upper_width) | |||
return 1.0f; | |||
if (freq <= lower_limit || freq >= upper_limit) | |||
return 0.0f; | |||
if (freq <= lower_limit + lower_width) | |||
return (1.0f - cosf(M_PI * (freq - lower_limit) / lower_width)) / 2.0f; | |||
return (1.0f - cosf(M_PI * (freq - upper_limit) / upper_width)) / 2.0f; | |||
} | |||
/* | |||
* Compute Parameters of SUBnote for each tick | |||
@@ -421,6 +441,9 @@ void SUBnote::computecurrentparameters() | |||
float tmpgain = 1.0f / sqrt(envbw * envfreq); | |||
for(int n = 0; n < numharmonics; ++n) { | |||
overtone_rolloff[n] = computerolloff(overtone_freq[n] * envfreq); | |||
} | |||
for(int n = 0; n < numharmonics; ++n) | |||
for(int nph = 0; nph < numstages; ++nph) { | |||
if(nph == 0) | |||
@@ -488,11 +511,12 @@ int SUBnote::noteout(float *outl, float *outr) | |||
for(int i = 0; i < synth->buffersize; ++i) | |||
tmprnd[i] = RND * 2.0f - 1.0f; | |||
for(int n = 0; n < numharmonics; ++n) { | |||
float rolloff = overtone_rolloff[n]; | |||
memcpy(tmpsmp, tmprnd, synth->bufferbytes); | |||
for(int nph = 0; nph < numstages; ++nph) | |||
filter(lfilter[nph + n * numstages], tmpsmp); | |||
for(int i = 0; i < synth->buffersize; ++i) | |||
outl[i] += tmpsmp[i]; | |||
outl[i] += tmpsmp[i] * rolloff; | |||
} | |||
if(GlobalFilterL != NULL) | |||
@@ -503,11 +527,12 @@ int SUBnote::noteout(float *outl, float *outr) | |||
for(int i = 0; i < synth->buffersize; ++i) | |||
tmprnd[i] = RND * 2.0f - 1.0f; | |||
for(int n = 0; n < numharmonics; ++n) { | |||
float rolloff = overtone_rolloff[n]; | |||
memcpy(tmpsmp, tmprnd, synth->bufferbytes); | |||
for(int nph = 0; nph < numstages; ++nph) | |||
filter(rfilter[nph + n * numstages], tmpsmp); | |||
for(int i = 0; i < synth->buffersize; ++i) | |||
outr[i] += tmpsmp[i]; | |||
outr[i] += tmpsmp[i] * rolloff; | |||
} | |||
if(GlobalFilterR != NULL) | |||
GlobalFilterR->filterout(&outr[0]); | |||
@@ -91,6 +91,7 @@ class SUBnote:public SynthNote | |||
float bw, | |||
float amp, | |||
float mag); | |||
float computerolloff(float freq); | |||
void computefiltercoefs(bpfilter &filter, | |||
float freq, | |||
float bw, | |||
@@ -99,6 +100,9 @@ class SUBnote:public SynthNote | |||
bpfilter *lfilter, *rfilter; | |||
float overtone_rolloff[MAX_SUB_HARMONICS]; | |||
float overtone_freq[MAX_SUB_HARMONICS]; | |||
Controller *ctl; | |||
int oldpitchwheel, oldbandwidth; | |||
float globalfiltercenterq; | |||
@@ -117,7 +117,7 @@ detunevalueoutput->do_callback();} | |||
voicelfofreq->deactivate(); | |||
voiceoscil->deactivate(); | |||
};} | |||
xywh {65 5 20 20} labelfont 1 labelsize 13 labelcolor 7 | |||
xywh {65 5 20 20} labelfont 1 labelsize 13 labelcolor 53 | |||
code0 {if (pars->VoicePar[nvoice].Type==0) o->hide();} | |||
} | |||
} | |||
@@ -178,15 +178,15 @@ class ADvoiceUI {open : {public Fl_Group} | |||
} { | |||
Fl_Window ADnoteVoiceParameters { | |||
label Voice open | |||
xywh {84 305 765 590} type Double box NO_BOX | |||
xywh {863 89 765 595} type Double box NO_BOX | |||
class Fl_Group visible | |||
} { | |||
Fl_Group voiceparametersgroup {open | |||
xywh {0 0 765 595} color 48 | |||
xywh {0 0 770 590} color 48 | |||
code0 {if (pars->VoicePar[nvoice].Enabled==0) o->deactivate();} | |||
} { | |||
Fl_Group voicemodegroup {open | |||
xywh {0 5 765 590} color 64 | |||
xywh {0 5 770 585} color 64 | |||
} { | |||
Fl_Group voiceFMparametersgroup { | |||
label MODULATOR open | |||
@@ -549,12 +549,12 @@ voiceonbutton->redraw();} open | |||
code3 {o->value(pars->VoicePar[nvoice].Pextoscil+1);} | |||
} {} | |||
Fl_Group {} {open | |||
xywh {5 540 515 45} box UP_FRAME | |||
xywh {5 540 520 50} box UP_FRAME | |||
} { | |||
Fl_Dial {} { | |||
label Stereo | |||
callback {pars->VoicePar[nvoice].Unison_stereo_spread=(int)o->value();} | |||
tooltip {Stereo Spread} xywh {285 555 25 30} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 | |||
tooltip {Stereo Spread} xywh {322 555 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 | |||
code0 {o->value(pars->VoicePar[nvoice].Unison_stereo_spread);} | |||
class WidgetPDial | |||
} | |||
@@ -568,7 +568,7 @@ voiceonbutton->redraw();} open | |||
Fl_Dial {} { | |||
label Vibrato | |||
callback {pars->VoicePar[nvoice].Unison_vibratto=(int)o->value();} | |||
tooltip Vibrato xywh {340 555 25 30} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 | |||
tooltip Vibrato xywh {364 555 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 | |||
code0 {o->value(pars->VoicePar[nvoice].Unison_vibratto);} | |||
class WidgetPDial | |||
} | |||
@@ -593,12 +593,19 @@ unisonspreadoutput->do_callback();} | |||
code0 {o->value(pars->getUnisonFrequencySpreadCents(nvoice));} | |||
} | |||
Fl_Dial {} { | |||
label {Vib.speed} | |||
callback {pars->VoicePar[nvoice].Unison_vibratto_speed=(int)o->value();} | |||
tooltip {Vibrato Average Speed} xywh {390 555 25 30} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 | |||
label {V.speed} | |||
callback {pars->VoicePar[nvoice].Unison_vibratto_speed=(int)o->value();} selected | |||
tooltip {Vibrato Average Speed} xywh {406 555 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 | |||
code0 {o->value(pars->VoicePar[nvoice].Unison_vibratto_speed);} | |||
class WidgetPDial | |||
} | |||
Fl_Dial {} { | |||
label {Ph.rand} | |||
callback {pars->VoicePar[nvoice].Unison_phase_randomness=(int)o->value();} | |||
tooltip {Phase randomness} xywh {280 555 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 | |||
code0 {o->value(pars->VoicePar[nvoice].Unison_phase_randomness);} | |||
class WidgetPDial | |||
} | |||
} | |||
} | |||
Fl_Group {} { | |||
@@ -760,7 +767,7 @@ bypassfiltercheckbutton->redraw();} | |||
Fl_Box noiselabel { | |||
label {White Noise} | |||
callback {if (pars->VoicePar[nvoice].Type==0) o->hide(); else o->show();} | |||
xywh {150 430 300 65} labelfont 1 labelsize 50 labelcolor 7 | |||
xywh {150 430 300 65} labelfont 1 labelsize 50 labelcolor 53 | |||
code0 {if (pars->VoicePar[nvoice].Type==0) o->hide(); else o->show();} | |||
} | |||
} | |||
@@ -1011,20 +1018,20 @@ resui->resonancewindow->show();} | |||
Fl_Button {} { | |||
label C | |||
callback {presetsui->copyArray(pars);} | |||
xywh {405 405 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 | |||
xywh {405 405 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 | |||
} | |||
Fl_Button {} { | |||
label P | |||
callback {presetsui->pasteArray(pars,this);} | |||
xywh {435 405 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 | |||
xywh {435 405 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 | |||
} | |||
} | |||
Fl_Window ADnoteVoice { | |||
label {ADsynth Voice Parameters} open | |||
xywh {512 361 765 620} type Double visible | |||
xywh {1142 229 765 630} type Double visible | |||
} { | |||
Fl_Group advoice { | |||
xywh {0 0 765 585} | |||
Fl_Group advoice {open | |||
xywh {0 0 765 595} | |||
code0 {o->init(pars,nvoice,master);} | |||
code1 {o->show();} | |||
class ADvoiceUI | |||
@@ -1032,7 +1039,7 @@ resui->resonancewindow->show();} | |||
Fl_Button {} { | |||
label {Close Window} | |||
callback {ADnoteVoice->hide();} | |||
xywh {305 590 195 25} box THIN_UP_BOX labelfont 1 | |||
xywh {305 601 195 25} box THIN_UP_BOX labelfont 1 | |||
} | |||
Fl_Counter currentvoicecounter { | |||
label {Current Voice} | |||
@@ -1040,23 +1047,23 @@ resui->resonancewindow->show();} | |||
advoice->hide(); | |||
ADnoteVoice->remove(advoice); | |||
delete advoice; | |||
advoice=new ADvoiceUI(0,0,765,585); | |||
advoice=new ADvoiceUI(0,0,765,590); | |||
ADnoteVoice->add(advoice); | |||
advoice->init(pars,nvoice,master); | |||
advoice->show(); | |||
ADnoteVoice->redraw();} | |||
xywh {10 590 130 25} type Simple labelfont 1 align 8 minimum 0 maximum 2 step 1 value 1 textfont 1 textsize 13 | |||
xywh {10 601 130 25} type Simple labelfont 1 align 8 minimum 0 maximum 2 step 1 value 1 textfont 1 textsize 13 | |||
code0 {o->bounds(1,NUM_VOICES);} | |||
} | |||
Fl_Button {} { | |||
label C | |||
callback {presetsui->copy(pars,nvoice);} | |||
xywh {705 595 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 | |||
xywh {705 609 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 | |||
} | |||
Fl_Button {} { | |||
label P | |||
callback {presetsui->paste(pars,this,nvoice);} | |||
xywh {735 595 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 | |||
xywh {735 609 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 | |||
} | |||
} | |||
Fl_Window ADnoteVoiceList { | |||
@@ -89,7 +89,7 @@ refresh();} {} | |||
code {if (bank->emptyslot(nslot)) | |||
color(46); | |||
else if (bank->isPADsynth_used(nslot)) | |||
color(26); | |||
color(124); | |||
else | |||
color(51); | |||
@@ -152,32 +152,32 @@ class BankUI {open : {public BankProcess_} | |||
Fl_Group modeselect { | |||
xywh {5 528 425 42} box ENGRAVED_BOX | |||
} { | |||
Fl_Light_Button writebutton { | |||
Fl_Check_Button writebutton { | |||
label WRITE | |||
callback {if (o->value()>0.5) mode=2; | |||
removeselection();} | |||
xywh {116 534 99 30} type Radio down_box THIN_DOWN_BOX selection_color 1 labeltype ENGRAVED_LABEL labelfont 1 labelsize 13 | |||
xywh {116 534 99 30} type Radio box UP_BOX down_box DOWN_BOX labelfont 1 labelsize 13 | |||
code0 {if (bank->locked()) o->deactivate();} | |||
} | |||
Fl_Light_Button readbutton { | |||
label READ | |||
Fl_Check_Button readbutton { | |||
label READ selected | |||
callback {if (o->value()>0.5) mode=1; | |||
removeselection();} | |||
xywh {11 534 99 30} type Radio down_box THIN_DOWN_BOX selection_color 101 labeltype ENGRAVED_LABEL labelfont 1 labelsize 13 | |||
xywh {11 534 99 30} type Radio box UP_BOX down_box DOWN_BOX labelfont 1 labelsize 13 | |||
code0 {o->value(1);} | |||
} | |||
Fl_Light_Button clearbutton { | |||
Fl_Check_Button clearbutton { | |||
label CLEAR | |||
callback {if (o->value()>0.5) mode=3; | |||
removeselection();} | |||
xywh {221 534 99 30} type Radio down_box THIN_DOWN_BOX selection_color 0 labeltype ENGRAVED_LABEL labelfont 1 labelsize 13 | |||
xywh {221 534 99 30} type Radio box UP_BOX down_box DOWN_BOX labelfont 1 labelsize 13 | |||
code0 {if (bank->locked()) o->deactivate();} | |||
} | |||
Fl_Light_Button swapbutton { | |||
Fl_Check_Button swapbutton { | |||
label SWAP | |||
callback {if (o->value()>0.5) mode=4; | |||
removeselection();} | |||
xywh {325 534 99 30} type Radio down_box THIN_DOWN_BOX selection_color 227 labeltype ENGRAVED_LABEL labelfont 1 labelsize 13 | |||
xywh {325 534 99 30} type Radio box UP_BOX down_box DOWN_BOX labelfont 1 labelsize 13 | |||
code0 {if (bank->locked()) o->deactivate();} | |||
} | |||
} | |||
@@ -1,5 +1,5 @@ | |||
# data file for the Fltk User Interface Designer (fluid) | |||
version 1.0300 | |||
version 1.0302 | |||
header_name {.h} | |||
code_name {.cc} | |||
decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {private local | |||
@@ -112,10 +112,10 @@ config.cfg.SoundBufferSize=strtoul(o->value(),&tmp,10);} | |||
code1 {snprintf(tmpbuf,100,"%d",config.cfg.SoundBufferSize);o->insert(tmpbuf);} | |||
code2 {delete []tmpbuf;} | |||
} | |||
Fl_Light_Button {} { | |||
Fl_Check_Button {} { | |||
label {Swap Stereo } | |||
callback {config.cfg.SwapStereo=(int) o->value();} | |||
xywh {20 80 85 20} box THIN_UP_BOX labelsize 10 | |||
xywh {15 80 95 20} box NO_BOX labelsize 11 | |||
code0 {o->value(config.cfg.SwapStereo);} | |||
} | |||
Fl_Choice {} { | |||
@@ -178,7 +178,7 @@ config.cfg.SoundBufferSize=strtoul(o->value(),&tmp,10);} | |||
label {Dump notes} | |||
callback {config.cfg.DumpNotesToFile=(int) o->value(); | |||
dump.startnow();//this has effect only if this option was disabled} | |||
xywh {20 130 100 20} down_box DOWN_BOX | |||
xywh {20 130 110 20} down_box DOWN_BOX | |||
code0 {o->value(config.cfg.DumpNotesToFile);} | |||
} | |||
Fl_Check_Button {} { | |||
@@ -188,49 +188,6 @@ dump.startnow();//this has effect only if this option was disabled} | |||
code0 {o->value(config.cfg.DumpAppend);} | |||
} | |||
} | |||
Fl_Group {} { | |||
xywh {255 45 245 260} box ENGRAVED_FRAME | |||
} { | |||
Fl_Box {} { | |||
label {Note: Not all the following settings are used (this depends on the operating system, etc..)} | |||
xywh {260 50 235 45} labelfont 1 labelsize 11 align 128 | |||
} | |||
Fl_Group {} { | |||
label Linux | |||
xywh {260 110 235 115} box ENGRAVED_BOX labelfont 1 labelsize 13 align 5 | |||
} { | |||
Fl_File_Input {} { | |||
label {OSS Sequencer Device (/dev/...)} | |||
callback {snprintf(config.cfg.LinuxOSSSeqInDev,config.maxstringsize,"%s",o->value());} | |||
xywh {265 180 225 35} align 5 | |||
code0 {o->insert(config.cfg.LinuxOSSSeqInDev);} | |||
} | |||
Fl_File_Input {} { | |||
label {OSS Wave Out Device (/dev/...)} | |||
callback {snprintf(config.cfg.LinuxOSSWaveOutDev,config.maxstringsize,"%s",o->value());} | |||
xywh {265 130 225 35} align 5 | |||
code0 {o->insert(config.cfg.LinuxOSSWaveOutDev);} | |||
} | |||
} | |||
Fl_Group {} { | |||
label Windows | |||
xywh {260 250 235 50} box ENGRAVED_BOX labelfont 1 labelsize 13 align 5 | |||
} { | |||
Fl_Counter {} { | |||
label {Midi In Dev} | |||
callback {config.cfg.WindowsMidiInId=(int) o->value(); | |||
midiinputnamebox->label(config.winmididevices[config.cfg.WindowsMidiInId].name);} | |||
xywh {270 270 65 20} type Simple labelsize 11 align 1 minimum 0 maximum 100 step 1 | |||
code0 {o->maximum(config.winmidimax-1);} | |||
code1 {o->value(config.cfg.WindowsMidiInId);} | |||
} | |||
Fl_Box midiinputnamebox { | |||
label {Midi input device name} | |||
xywh {340 260 150 35} labelfont 1 labelsize 11 align 212 | |||
code0 {o->label(config.winmididevices[config.cfg.WindowsMidiInId].name);} | |||
} | |||
} | |||
} | |||
Fl_Counter {} { | |||
label {XML compression level} | |||
callback {config.cfg.GzipCompression=(int) o->value();} | |||
@@ -282,7 +239,7 @@ midiinputnamebox->label(config.winmididevices[config.cfg.WindowsMidiInId].name); | |||
Fl_Check_Button {} { | |||
label {Ignore MIDI Program Change} | |||
callback {config.cfg.IgnoreProgramChange=(int) o->value();} | |||
xywh {10 255 230 20} down_box DOWN_BOX | |||
xywh {10 255 220 20} down_box DOWN_BOX | |||
code0 {o->value(config.cfg.IgnoreProgramChange);} | |||
} | |||
} | |||
@@ -50,7 +50,8 @@ pair=NULL;} {} | |||
oldx=-1; | |||
currentpoint=-1; | |||
cpx=0; | |||
lastpoint=-1;} {} | |||
lastpoint=-1; | |||
ctrldown=false;} {} | |||
} | |||
Function {setpair(Fl_Box *pair_)} {} { | |||
code {pair=pair_;} {} | |||
@@ -140,23 +141,52 @@ if (env->Penvsustain>0){ | |||
//Show the envelope duration and the current line duration | |||
fl_font(FL_HELVETICA|FL_BOLD,10); | |||
float time=0.0; | |||
if (currentpoint<=0){ | |||
if (currentpoint<=0 && (!ctrldown||lastpoint <= 0)){ | |||
fl_color(alb); | |||
for (int i=1;i<npoints;i++) time+=env->getdt(i); | |||
} else { | |||
fl_color(255,0,0); | |||
time=env->getdt(currentpoint); | |||
time=env->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);} {} | |||
fl_draw(tmpstr,ox+lx-20,oy+ly-10,20,10,FL_ALIGN_RIGHT,NULL,0); | |||
if (lastpoint>=0){ | |||
snprintf((char *)&tmpstr,20,"%d", env->Penvval[lastpoint]); | |||
fl_draw(tmpstr,ox+lx-20,oy+ly-23,20,10,FL_ALIGN_RIGHT,NULL,0); | |||
}} {} | |||
} | |||
Function {handle(int event)} {return_type int | |||
} { | |||
code {int x_=Fl::event_x()-x(); | |||
int y_=Fl::event_y()-y(); | |||
// Some window magic makes us lose focus, so reassert it. | |||
if (event==FL_ENTER) | |||
Fl::focus(this); | |||
if ((event==FL_KEYDOWN || event==FL_KEYUP)){ | |||
int key = Fl::event_key(); | |||
if (key==FL_Control_L || key==FL_Control_R){ | |||
ctrldown = (event==FL_KEYDOWN); | |||
redraw(); | |||
if (pair!=NULL) pair->redraw(); | |||
} | |||
} | |||
if (event==FL_MOUSEWHEEL && lastpoint>=0) { | |||
if (!ctrldown) { | |||
int ny=env->Penvval[lastpoint] - Fl::event_dy(); | |||
env->Penvval[lastpoint]=ny < 0 ? 0 : ny > 127 ? 127 : ny; | |||
} else if (lastpoint > 0) { | |||
int newdt = Fl::event_dy() + env->Penvdt[lastpoint]; | |||
env->Penvdt[lastpoint] = newdt < 0 ? 0 : newdt > 127 ? 127 : newdt; | |||
} | |||
redraw(); | |||
if (pair!=NULL) pair->redraw(); | |||
} | |||
if (event==FL_PUSH) { | |||
currentpoint=getnearest(x_,y_); | |||
cpx=x_; | |||
@@ -196,6 +226,7 @@ return(1);} {} | |||
decl {int currentpoint,cpx,cpdt;} {} | |||
decl {int lastpoint;} {public | |||
} | |||
decl {bool ctrldown;} {} | |||
} | |||
class EnvelopeUI {open : {public Fl_Group,PresetsUI_} | |||
@@ -281,7 +312,7 @@ sustaincounter->maximum(env->Penvpoints-2);} | |||
xywh {200 155 80 20} box THIN_UP_BOX labelsize 11 | |||
code0 {if (env->Pfreemode==0) o->hide();} | |||
} | |||
Fl_Light_Button freemodebutton { | |||
Fl_Check_Button freemodebutton { | |||
label FreeMode | |||
callback {reinit(); | |||
@@ -329,12 +360,12 @@ envfree->redraw();} | |||
Fl_Button {} { | |||
label C | |||
callback {presetsui->copy(env);} | |||
xywh {465 160 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7 | |||
xywh {465 160 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55 | |||
} | |||
Fl_Button {} { | |||
label P | |||
callback {presetsui->paste(env,this);} | |||
xywh {482 160 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7 | |||
xywh {482 160 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55 | |||
} | |||
} | |||
} | |||
@@ -408,12 +439,12 @@ freeedit->redraw();} | |||
Fl_Button {} { | |||
label C | |||
callback {presetsui->copy(env);} | |||
xywh {150 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7 | |||
xywh {150 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55 | |||
} | |||
Fl_Button {} { | |||
label P | |||
callback {presetsui->paste(env,this);} | |||
xywh {167 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7 | |||
xywh {167 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55 | |||
} | |||
} | |||
} | |||
@@ -477,12 +508,12 @@ freeedit->redraw();} | |||
Fl_Button {} { | |||
label C | |||
callback {presetsui->copy(env);} | |||
xywh {155 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7 | |||
xywh {155 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55 | |||
} | |||
Fl_Button {} { | |||
label P | |||
callback {presetsui->paste(env,this);} | |||
xywh {172 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7 | |||
xywh {172 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55 | |||
} | |||
} | |||
Fl_Button {} { | |||
@@ -572,12 +603,12 @@ freeedit->redraw();} | |||
Fl_Button {} { | |||
label C | |||
callback {presetsui->copy(env);} | |||
xywh {220 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7 | |||
xywh {220 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55 | |||
} | |||
Fl_Button {} { | |||
label P | |||
callback {presetsui->paste(env,this);} | |||
xywh {237 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7 | |||
xywh {237 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55 | |||
} | |||
} | |||
} | |||
@@ -642,12 +673,12 @@ freeedit->redraw();} | |||
Fl_Button {} { | |||
label C | |||
callback {presetsui->copy(env);} | |||
xywh {155 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7 | |||
xywh {155 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55 | |||
} | |||
Fl_Button {} { | |||
label P | |||
callback {presetsui->paste(env,this);} | |||
xywh {172 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7 | |||
xywh {172 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55 | |||
} | |||
} | |||
Fl_Button {} { | |||
@@ -684,12 +715,12 @@ freeedit->redraw();} | |||
Fl_Button {} { | |||
label C | |||
callback {presetsui->copy(env);} | |||
xywh {150 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7 | |||
xywh {150 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55 | |||
} | |||
Fl_Button {} { | |||
label P | |||
callback {presetsui->paste(env,this);} | |||
xywh {167 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7 | |||
xywh {167 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55 | |||
} | |||
} | |||
} | |||
@@ -781,9 +812,17 @@ if ((env->Pfreemode==0)||(env->Envmode>2)) linearenvelopecheck->hide(); | |||
forcedreleasecheck->value(env->Pforcedrelease); | |||
if (env->Pfreemode==0) forcedreleasecheck->hide(); | |||
else forcedreleasecheck->show(); | |||
freeedit->redraw(); | |||
if (env->Pfreemode==0){ | |||
addpoint->hide(); | |||
deletepoint->hide(); | |||
} else { | |||
addpoint->show(); | |||
deletepoint->show(); | |||
} | |||
freeedit->redraw(); | |||
if (env->Pfreemode==0){ | |||
switch(env->Envmode){ | |||
@@ -333,12 +333,12 @@ pars->changed=true;} open | |||
Fl_Button {} { | |||
label C | |||
callback {presetsui->copyArray(pars);} | |||
xywh {186 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7 | |||
xywh {186 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55 | |||
} | |||
Fl_Button {} { | |||
label P | |||
callback {presetsui->pasteArray(pars,this);} | |||
xywh {203 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7 | |||
xywh {203 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55 | |||
} | |||
} | |||
} | |||
@@ -508,12 +508,12 @@ pars->changed=true;} | |||
Fl_Button {} { | |||
label C | |||
callback {presetsui->copy(pars,nvowel);} | |||
xywh {635 25 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 | |||
xywh {635 25 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 | |||
} | |||
Fl_Button {} { | |||
label P | |||
callback {presetsui->paste(pars,this,nvowel);} | |||
xywh {665 25 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 | |||
xywh {665 25 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 | |||
} | |||
Fl_Box {} { | |||
label Vowel | |||
@@ -539,8 +539,8 @@ vowel_counter->value(pars->Psequence[nseqpos].nvowel);} {} | |||
code {update_formant_window(); | |||
formantfiltergraph->redraw(); | |||
if (pars->Pcategory==0) svfiltertypechoice->value(pars->Ptype); | |||
if (pars->Pcategory==2) analogfiltertypechoice->value(pars->Ptype); | |||
if (pars->Pcategory==2) svfiltertypechoice->value(pars->Ptype); | |||
if (pars->Pcategory==0) analogfiltertypechoice->value(pars->Ptype); | |||
filtertype->value(pars->Pcategory); | |||
@@ -144,12 +144,12 @@ hide(); | |||
Fl_Button {} { | |||
label C | |||
callback {presetsui->copy(pars);} | |||
xywh {145 10 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7 | |||
xywh {145 10 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55 | |||
} | |||
Fl_Button {} { | |||
label P | |||
callback {presetsui->paste(pars,this);} | |||
xywh {162 10 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7 | |||
xywh {162 10 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55 | |||
} | |||
} | |||
} | |||
@@ -803,14 +803,14 @@ syseffectui->refresh(master->sysefx[nsyseff]);} | |||
Fl_Button {} { | |||
label C | |||
callback {presetsui->copy(master->sysefx[nsyseff]);} | |||
xywh {180 187 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 | |||
xywh {180 187 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 | |||
} | |||
Fl_Button {} { | |||
label P | |||
callback {pthread_mutex_lock(&master->mutex); | |||
presetsui->paste(master->sysefx[nsyseff],syseffectui); | |||
pthread_mutex_unlock(&master->mutex);} | |||
xywh {210 187 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 | |||
xywh {210 187 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 | |||
} | |||
} | |||
Fl_Group {} { | |||
@@ -916,14 +916,14 @@ master->insefx[ninseff]->cleanup();} open | |||
Fl_Button {} { | |||
label C | |||
callback {presetsui->copy(master->insefx[ninseff]);} | |||
xywh {180 185 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 | |||
xywh {180 185 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 | |||
} | |||
Fl_Button {} { | |||
label P | |||
callback {pthread_mutex_lock(&master->mutex); | |||
presetsui->paste(master->insefx[ninseff],inseffectui); | |||
pthread_mutex_unlock(&master->mutex);} | |||
xywh {210 185 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 | |||
xywh {210 185 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 | |||
} | |||
} | |||
} | |||
@@ -1438,7 +1438,7 @@ simplesyseffectui->refresh(master->sysefx[nsyseff]);} | |||
callback {pthread_mutex_lock(&master->mutex); | |||
presetsui->paste(master->sysefx[nsyseff],simplesyseffectui); | |||
pthread_mutex_unlock(&master->mutex);} | |||
xywh {560 65 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 | |||
xywh {560 65 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 | |||
} | |||
} | |||
Fl_Group {} { | |||
@@ -1546,7 +1546,7 @@ master->insefx[ninseff]->cleanup();} open | |||
callback {pthread_mutex_lock(&master->mutex); | |||
presetsui->paste(master->insefx[ninseff],simpleinseffectui); | |||
pthread_mutex_unlock(&master->mutex);} | |||
xywh {560 65 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 | |||
xywh {560 65 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 | |||
} | |||
} | |||
} | |||
@@ -551,7 +551,7 @@ if ((oscil->Pcurrentbasefunc==0)||(oscil->Pcurrentbasefunc==127)) basefuncmodula | |||
callback {oscil->Pbasefuncmodulation=(int) o->value(); | |||
basefuncdisplaygroup->redraw(); | |||
redrawoscil();} | |||
tooltip {Base function modulation} xywh {599 281 50 15} down_box BORDER_BOX labelsize 10 textsize 10 | |||
tooltip {Base function modulation} xywh {601 281 50 15} down_box BORDER_BOX labelsize 10 textsize 10 | |||
} { | |||
MenuItem {} { | |||
label None | |||
@@ -691,14 +691,14 @@ redrawoscil();} | |||
xywh {670 505 55 15} box THIN_UP_BOX labelfont 1 labelsize 11 | |||
} | |||
Fl_Group {} { | |||
xywh {135 308 150 30} box UP_FRAME | |||
xywh {136 308 150 30} box UP_FRAME | |||
} { | |||
Fl_Choice wshbutton { | |||
label {Wsh.} | |||
callback {oscil->Pwaveshapingfunction=(int) o->value(); | |||
basefuncdisplaygroup->redraw(); | |||
redrawoscil();} open | |||
tooltip {Waveshaping function} xywh {165 313 55 20} down_box BORDER_BOX labelsize 10 textsize 10 | |||
tooltip {Waveshaping function} xywh {166 313 55 20} down_box BORDER_BOX labelsize 10 textsize 10 | |||
} { | |||
MenuItem {} { | |||
label None | |||
@@ -765,26 +765,26 @@ redrawoscil();} open | |||
callback {oscil->Pwaveshaping=(int)o->value()+64; | |||
wsparval->value(oscil->Pwaveshaping-64); | |||
redrawoscil();} | |||
tooltip {Waveshaping Parameter} xywh {260 313 20 20} minimum -64 maximum 63 step 1 | |||
tooltip {Waveshaping Parameter} xywh {261 313 20 20} minimum -64 maximum 63 step 1 | |||
class WidgetPDial | |||
} | |||
Fl_Value_Output wsparval { | |||
xywh {228 316 25 15} labelsize 12 minimum -63 maximum 63 step 1 | |||
xywh {229 316 25 15} labelsize 12 minimum -63 maximum 63 step 1 | |||
} | |||
} | |||
Fl_Light_Button autoclearbutton { | |||
Fl_Check_Button autoclearbutton { | |||
label {Clr.} | |||
tooltip {Auto clear when using the oscillator as base function} xywh {95 313 35 20} box THIN_UP_BOX value 1 labelfont 1 labelsize 10 | |||
tooltip {Auto clear when using the oscillator as base function} xywh {94 313 38 20} box THIN_UP_BOX value 1 labelfont 1 labelsize 10 | |||
} | |||
Fl_Group {} { | |||
xywh {285 308 155 30} box UP_FRAME | |||
xywh {287 308 155 30} box UP_FRAME | |||
} { | |||
Fl_Choice fltbutton { | |||
label Filter | |||
callback {oscil->Pfiltertype=(int) o->value(); | |||
redrawoscil();} | |||
tooltip {Oscillator's filter type} xywh {315 313 50 20} down_box BORDER_BOX labelsize 10 textsize 10 | |||
tooltip {Oscillator's filter type} xywh {317 313 50 20} down_box BORDER_BOX labelsize 10 textsize 10 | |||
} { | |||
MenuItem {} { | |||
label None | |||
@@ -847,7 +847,7 @@ redrawoscil();} | |||
callback {oscil->Pfilterpar1=(int)o->value(); | |||
redrawoscil();} | |||
tooltip {Oscillator's filter parameter1} xywh {367 313 20 20} maximum 127 step 1 | |||
tooltip {Oscillator's filter parameter1} xywh {369 313 20 20} maximum 127 step 1 | |||
class WidgetPDial | |||
} | |||
Fl_Check_Button filterpref { | |||
@@ -855,24 +855,24 @@ redrawoscil();} | |||
callback {oscil->Pfilterbeforews=(int)o->value(); | |||
redrawoscil();} | |||
tooltip {Apply the filter before the waveshaping} xywh {415 313 20 20} down_box DOWN_BOX labelsize 10 align 24 | |||
tooltip {Apply the filter before the waveshaping} xywh {417 313 20 20} down_box DOWN_BOX labelsize 10 align 24 | |||
} | |||
Fl_Dial filtervalue2 { | |||
callback {oscil->Pfilterpar2=(int)o->value(); | |||
redrawoscil();} | |||
tooltip {Oscillator's filter parameter2} xywh {392 313 20 20} maximum 127 step 1 | |||
tooltip {Oscillator's filter parameter2} xywh {394 313 20 20} maximum 127 step 1 | |||
class WidgetPDial | |||
} | |||
} | |||
Fl_Group {} { | |||
xywh {590 308 135 30} box UP_FRAME | |||
xywh {594 308 135 30} box UP_FRAME | |||
} { | |||
Fl_Choice sabutton { | |||
label {Sp.adj.} | |||
callback {oscil->Psatype=(int) o->value(); | |||
redrawoscil();} | |||
tooltip {Oscillator's spectrum adjust} xywh {630 313 60 20} down_box BORDER_BOX labelsize 10 textsize 10 | |||
tooltip {Oscillator's spectrum adjust} xywh {635 313 60 20} down_box BORDER_BOX labelsize 10 textsize 10 | |||
} { | |||
MenuItem {} { | |||
label None | |||
@@ -894,7 +894,7 @@ redrawoscil();} | |||
Fl_Dial sadjpar { | |||
callback {oscil->Psapar=(int)o->value(); | |||
redrawoscil();} | |||
tooltip {Oscillator's spectrum adjust parameter} xywh {695 313 20 20} maximum 127 step 1 | |||
tooltip {Oscillator's spectrum adjust parameter} xywh {702 313 20 20} maximum 127 step 1 | |||
class WidgetPDial | |||
} | |||
} | |||
@@ -988,14 +988,14 @@ redrawoscil();} | |||
} | |||
} | |||
Fl_Group {} { | |||
xywh {440 308 150 30} box UP_FRAME | |||
xywh {443 308 150 30} box UP_FRAME | |||
} { | |||
Fl_Choice modtype { | |||
label {Mod.} | |||
callback {oscil->Pmodulation=(int) o->value(); | |||
redrawoscil();} | |||
tooltip modulation xywh {470 315 50 15} down_box BORDER_BOX labelsize 10 textsize 10 | |||
tooltip modulation xywh {476 315 50 15} down_box BORDER_BOX labelsize 10 textsize 10 | |||
} { | |||
MenuItem {} { | |||
label None | |||
@@ -1018,20 +1018,20 @@ redrawoscil();} | |||
callback {oscil->Pmodulationpar1=(int)o->value(); | |||
redrawoscil();} | |||
tooltip {Oscillator's modulation parameter 1} xywh {530 315 15 15} maximum 127 step 1 | |||
tooltip {Oscillator's modulation parameter 1} xywh {534 315 15 15} maximum 127 step 1 | |||
class WidgetPDial | |||
} | |||
Fl_Dial modpar2 { | |||
callback {oscil->Pmodulationpar2=(int)o->value(); | |||
redrawoscil();} | |||
tooltip {Oscillator's modulation parameter 2} xywh {550 315 15 15} maximum 127 step 1 | |||
tooltip {Oscillator's modulation parameter 2} xywh {554 315 15 15} maximum 127 step 1 | |||
class WidgetPDial | |||
} | |||
Fl_Dial modpar3 { | |||
callback {oscil->Pmodulationpar3=(int)o->value(); | |||
redrawoscil();} | |||
tooltip {Oscillator's modulation parameter 3} xywh {570 315 15 15} maximum 127 step 1 | |||
tooltip {Oscillator's modulation parameter 3} xywh {574 315 15 15} maximum 127 step 1 | |||
class WidgetPDial | |||
} | |||
} | |||
@@ -1050,12 +1050,12 @@ refresh();} | |||
Fl_Button {} { | |||
label C | |||
callback {presetsui->copy(oscil);} | |||
xywh {670 545 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 | |||
xywh {670 545 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 | |||
} | |||
Fl_Button {} { | |||
label P | |||
callback {presetsui->paste(oscil,this);} | |||
xywh {700 545 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 | |||
xywh {700 545 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 | |||
} | |||
Fl_Scroll _this_has_to_be_the_last { | |||
xywh {5 340 660 250} type HORIZONTAL box FLAT_BOX | |||
@@ -242,7 +242,7 @@ make_window();} {} | |||
} { | |||
Fl_Window padnotewindow { | |||
label {PAD synth Parameters} open | |||
xywh {294 392 535 435} type Double visible | |||
xywh {288 386 535 435} type Double visible | |||
} { | |||
Fl_Tabs {} { | |||
callback {if (o->value()!=harmonicstructuregroup) applybutton->hide(); | |||
@@ -503,6 +503,10 @@ cbwidget->do_callback();} | |||
label Power | |||
xywh {120 120 100 20} labelfont 1 labelsize 11 | |||
} | |||
MenuItem {} { | |||
label Shift selected | |||
xywh {130 130 100 20} labelfont 1 labelsize 11 | |||
} | |||
} | |||
Fl_Dial hrpospar1 { | |||
label Par1 | |||
@@ -753,7 +757,7 @@ if (pars->Pmode==0){ | |||
bwdial->activate(); | |||
bwcents->activate(); | |||
hprofile->activate(); | |||
hprofile->color(54); | |||
hprofile->color(51); | |||
bwscale->activate(); | |||
} else { | |||
bwprofilegroup->deactivate(); | |||
@@ -982,12 +986,12 @@ if (resui!=NULL) { | |||
Fl_Button {} { | |||
label C | |||
callback {presetsui->copy(pars);} | |||
xywh {65 400 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 | |||
xywh {65 400 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 | |||
} | |||
Fl_Button {} { | |||
label P | |||
callback {presetsui->paste(pars,this);} | |||
xywh {95 400 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 | |||
xywh {95 400 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 | |||
} | |||
Fl_Button {} { | |||
label export | |||
@@ -1065,7 +1069,7 @@ if (pars->Pmode==0){ | |||
bwdial->activate(); | |||
bwcents->activate(); | |||
hprofile->activate(); | |||
hprofile->color(54); | |||
hprofile->color(51); | |||
bwscale->activate(); | |||
} else { | |||
bwprofilegroup->deactivate(); | |||
@@ -744,14 +744,14 @@ if (x==2) part->partefx[ninseff]->setdryonly(true); | |||
Fl_Button {} { | |||
label C | |||
callback {presetsui->copy(part->partefx[ninseff]);} | |||
xywh {90 127 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 | |||
xywh {90 127 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 | |||
} | |||
Fl_Button {} { | |||
label P | |||
callback {pthread_mutex_lock(&master->mutex); | |||
presetsui->paste(part->partefx[ninseff],inseffectui); | |||
pthread_mutex_unlock(&master->mutex);} | |||
xywh {120 127 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 | |||
xywh {120 127 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 | |||
} | |||
} | |||
Fl_Window instrumentkitlist { | |||
@@ -858,12 +858,12 @@ if (part->Pkitmode==0) { | |||
part->kit[0].Ppadenabled=x; | |||
if (x==0) padeditbutton->deactivate(); | |||
else padeditbutton->activate();} | |||
tooltip {enable/disable PADsynth} xywh {215 255 80 20} box UP_BOX down_box DOWN_BOX color 51 selection_color 51 labelfont 1 labelsize 11 | |||
tooltip {enable/disable PADsynth} xywh {215 255 80 20} box UP_BOX down_box DOWN_BOX color 51 selection_color 0 labelfont 1 labelsize 11 | |||
code1 {o->value(part->kit[0].Ppadenabled);} | |||
} | |||
} | |||
Fl_Group {} { | |||
label ADDsynth | |||
label ADsynth | |||
xywh {5 245 100 80} box ENGRAVED_FRAME labelfont 1 | |||
} { | |||
Fl_Check_Button adsynenabledcheck { | |||
@@ -872,7 +872,7 @@ if (x==0) padeditbutton->deactivate(); | |||
part->kit[0].Padenabled=x; | |||
if (x==0) adeditbutton->deactivate(); | |||
else adeditbutton->activate();} | |||
tooltip {enable/disable ADsynth} xywh {15 255 80 20} box UP_BOX down_box DOWN_BOX color 51 selection_color 51 labelfont 1 labelsize 11 | |||
tooltip {enable/disable ADsynth} xywh {15 255 80 20} box UP_BOX down_box DOWN_BOX color 51 selection_color 0 labelfont 1 labelsize 11 | |||
code1 {o->value(part->kit[0].Padenabled);} | |||
} | |||
Fl_Button adeditbutton { | |||
@@ -892,7 +892,7 @@ if (x==0) adeditbutton->deactivate(); | |||
part->kit[0].Psubenabled=x; | |||
if (x==0) subeditbutton->deactivate(); | |||
else subeditbutton->activate();} | |||
tooltip {enable/disable SUBsynth} xywh {115 255 80 20} box UP_BOX down_box DOWN_BOX color 51 selection_color 51 labelfont 1 labelsize 11 | |||
tooltip {enable/disable SUBsynth} xywh {115 255 80 20} box UP_BOX down_box DOWN_BOX color 51 selection_color 0 labelfont 1 labelsize 11 | |||
code1 {o->value(part->kit[0].Psubenabled);} | |||
} | |||
Fl_Button subeditbutton { | |||
@@ -919,14 +919,14 @@ if (x==0) subeditbutton->deactivate(); | |||
Fl_Input {} { | |||
label {Author and Copyright} | |||
callback {snprintf((char *)part->info.Pauthor,MAX_INFO_TEXT_SIZE,"%s",o->value());} | |||
xywh {5 60 385 50} type Multiline color 26 labelsize 10 align 5 | |||
xywh {5 60 385 50} type Multiline color 124 labelsize 10 align 5 | |||
code0 {o->maximum_size(MAX_INFO_TEXT_SIZE);} | |||
code1 {o->value((char *) &part->info.Pauthor);} | |||
} | |||
Fl_Input {} { | |||
label Comments | |||
callback {snprintf((char *)part->info.Pcomments,MAX_INFO_TEXT_SIZE,"%s",o->value());} | |||
xywh {5 125 385 90} type Multiline color 26 labelsize 11 align 5 | |||
xywh {5 125 385 90} type Multiline color 124 labelsize 11 align 5 | |||
code0 {o->maximum_size(MAX_INFO_TEXT_SIZE);} | |||
code1 {o->value((char *) &part->info.Pcomments);} | |||
} | |||
@@ -330,12 +330,12 @@ redrawPADnoteApply();} | |||
Fl_Button {} { | |||
label C | |||
callback {presetsui->copy(respar);} | |||
xywh {625 275 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 | |||
xywh {625 275 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 | |||
} | |||
Fl_Button {} { | |||
label P | |||
callback {presetsui->paste(respar,this);} | |||
xywh {655 275 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 | |||
xywh {655 275 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 | |||
} | |||
Fl_Button applybutton { | |||
label Apply | |||
@@ -41,35 +41,35 @@ class SUBnoteharmonic {: {public Fl_Group} | |||
Function {make_window()} {private | |||
} { | |||
Fl_Window harmonic { | |||
xywh {329 403 90 225} type Double hide | |||
xywh {1257 22 90 305} type Double hide | |||
class Fl_Group | |||
} { | |||
Fl_Slider mag { | |||
callback {int x=0; | |||
if (Fl::event_button1()) x=127-(int)o->value(); | |||
if (Fl::event_button1() || Fl::event() == FL_MOUSEWHEEL) x=127-(int)o->value(); | |||
else o->value(127-x); | |||
pars->Phmag[n]=x; | |||
if (pars->Phmag[n]==0) o->selection_color(0); | |||
else o->selection_color(222);} | |||
tooltip {harmonic's magnitude} xywh {0 15 10 115} type {Vert Knob} box FLAT_BOX selection_color 222 maximum 127 step 1 value 127 | |||
tooltip {harmonic's magnitude} xywh {0 15 10 135} type {Vert Knob} box FLAT_BOX selection_color 222 maximum 127 step 1 value 127 | |||
code0 {o->value(127-pars->Phmag[n]);} | |||
code1 {if (pars->Phmag[n]==0) o->selection_color(0);} | |||
} | |||
Fl_Slider bw { | |||
callback {int x=64; | |||
if (Fl::event_button1()) x=127-(int)o->value(); | |||
if (Fl::event_button1() || Fl::event() == FL_MOUSEWHEEL) x=127-(int)o->value(); | |||
else o->value(x); | |||
pars->Phrelbw[n]=x;} | |||
tooltip {harmonic's bandwidth} xywh {0 135 10 75} type {Vert Knob} box FLAT_BOX selection_color 222 maximum 127 step 1 value 64 | |||
tooltip {harmonic's bandwidth} xywh {0 157 10 130} type {Vert Knob} box FLAT_BOX selection_color 222 maximum 127 step 1 value 64 | |||
code0 {o->value(127-pars->Phrelbw[n]);} | |||
} | |||
Fl_Box {} { | |||
xywh {10 170 5 5} box FLAT_BOX color 45 | |||
xywh {10 219 5 5} box FLAT_BOX color 45 | |||
code0 {if (n+1==MAX_SUB_HARMONICS) o->hide();} | |||
} | |||
Fl_Box {} { | |||
label 01 | |||
xywh {0 210 10 15} labelfont 1 labelsize 9 align 20 | |||
xywh {0 288 10 15} labelfont 1 labelsize 9 align 20 | |||
code0 {char tmp[10];snprintf(tmp,10,"%d",n+1);o->label(strdup(tmp));} | |||
} | |||
Fl_Box {} { | |||
@@ -109,24 +109,24 @@ class SUBnoteUI {open : {public PresetsUI_} | |||
} { | |||
Fl_Window SUBparameters { | |||
label {SUBsynth Parameters} open | |||
xywh {542 489 735 390} type Double visible | |||
xywh {213 147 735 470} type Double visible | |||
} { | |||
Fl_Scroll {} { | |||
label scroll open | |||
xywh {5 140 435 245} type HORIZONTAL box FLAT_BOX labeltype NO_LABEL | |||
xywh {5 140 434 325} type HORIZONTAL box FLAT_BOX labeltype NO_LABEL | |||
} { | |||
Fl_Pack harmonics {open | |||
xywh {10 145 425 235} type HORIZONTAL | |||
Fl_Pack harmonics { | |||
xywh {5 145 430 325} type HORIZONTAL | |||
code0 {for (int i=0;i<MAX_SUB_HARMONICS;i++){h[i]=new SUBnoteharmonic(0,0,15,o->h(),"");h[i]->init(pars,i);}} | |||
} {} | |||
} | |||
Fl_Button {} { | |||
label Close | |||
callback {SUBparameters->hide();} | |||
xywh {625 365 105 20} box THIN_UP_BOX labelfont 1 labelsize 11 | |||
xywh {625 446 105 20} box THIN_UP_BOX labelfont 1 labelsize 11 | |||
} | |||
Fl_Group {} { | |||
label AMPLITUDE | |||
label AMPLITUDE open | |||
xywh {5 5 215 135} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 align 17 | |||
} { | |||
Fl_Value_Slider vol { | |||
@@ -156,18 +156,18 @@ class SUBnoteUI {open : {public PresetsUI_} | |||
} {} | |||
} | |||
Fl_Group {} { | |||
xywh {495 325 235 35} box UP_FRAME | |||
xywh {495 406 235 35} box UP_FRAME | |||
} { | |||
Fl_Counter filterstages { | |||
label {Filter Stages} | |||
callback {pars->Pnumstages=(int) o->value();} | |||
tooltip {How many times the noise is filtered} xywh {515 340 45 15} type Simple labelfont 1 labelsize 10 align 1 minimum 1 maximum 5 step 1 textsize 10 | |||
tooltip {How many times the noise is filtered} xywh {515 421 45 15} type Simple labelfont 1 labelsize 10 align 1 minimum 1 maximum 5 step 1 textsize 10 | |||
code0 {o->value(pars->Pnumstages);} | |||
} | |||
Fl_Choice magtype { | |||
label {Mag.Type} | |||
callback {pars->Phmagtype=(int) o->value();} | |||
xywh {585 340 65 15} down_box BORDER_BOX labelfont 1 labelsize 10 align 1 textsize 11 | |||
xywh {585 421 65 15} down_box BORDER_BOX labelfont 1 labelsize 10 align 1 textsize 11 | |||
code0 {o->value(pars->Phmagtype);} | |||
} { | |||
MenuItem {} { | |||
@@ -194,7 +194,7 @@ class SUBnoteUI {open : {public PresetsUI_} | |||
Fl_Choice start { | |||
label Start | |||
callback {pars->Pstart=(int) o->value();} open | |||
xywh {670 340 50 15} down_box BORDER_BOX labelfont 1 labelsize 10 align 1 textsize 11 | |||
xywh {670 421 50 15} down_box BORDER_BOX labelfont 1 labelsize 10 align 1 textsize 11 | |||
code0 {o->value(pars->Pstart);} | |||
} { | |||
MenuItem {} { | |||
@@ -212,12 +212,12 @@ class SUBnoteUI {open : {public PresetsUI_} | |||
} | |||
} | |||
Fl_Group freqsettingsui { | |||
label FREQUENCY | |||
xywh {440 5 290 135} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 align 17 | |||
label FREQUENCY open | |||
xywh {440 5 295 146} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 align 17 | |||
} { | |||
Fl_Group freqenvelopegroup { | |||
label {SUBsynth - Frequency Envelope} open | |||
xywh {445 65 205 70} box FLAT_BOX color 51 align 144 | |||
xywh {445 75 205 70} box FLAT_BOX color 51 align 144 | |||
code0 {o->init(pars->FreqEnvelope);} | |||
code1 {if (pars->PFreqEnvelopeEnabled==0) o->deactivate();} | |||
class EnvelopeUI | |||
@@ -229,7 +229,7 @@ if (o->value()==0) freqenvelopegroup->deactivate(); | |||
else freqenvelopegroup->activate(); | |||
o->show(); | |||
freqsettingsui->redraw();} | |||
xywh {445 68 55 15} down_box DOWN_BOX labelfont 1 labelsize 10 | |||
xywh {445 77 55 15} down_box DOWN_BOX labelfont 1 labelsize 10 | |||
code0 {o->value(pars->PFreqEnvelopeEnabled);} | |||
} | |||
Fl_Counter octave { | |||
@@ -238,7 +238,7 @@ freqsettingsui->redraw();} | |||
if (k<0) k+=16; | |||
pars->PCoarseDetune = k*1024+ | |||
pars->PCoarseDetune%1024;} | |||
tooltip Octave xywh {670 50 45 15} type Simple labelsize 10 align 1 minimum -8 maximum 7 step 1 textfont 1 textsize 11 | |||
tooltip Octave xywh {670 58 45 15} type Simple labelsize 10 align 1 minimum -8 maximum 7 step 1 textfont 1 textsize 11 | |||
code0 {int k=pars->PCoarseDetune/1024;if (k>=8) k-=16;} | |||
code2 {o->value(k);} | |||
} | |||
@@ -248,7 +248,7 @@ pars->PCoarseDetune = k*1024+ | |||
if (k<0) k+=1024; | |||
pars->PCoarseDetune = k+ | |||
(pars->PCoarseDetune/1024)*1024;} | |||
tooltip {Coarse Detune} xywh {655 115 60 20} labelsize 10 align 1 minimum -64 maximum 63 step 1 textfont 1 textsize 11 | |||
tooltip {Coarse Detune} xywh {655 125 60 20} labelsize 10 align 1 minimum -64 maximum 63 step 1 textfont 1 textsize 11 | |||
code0 {int k=pars->PCoarseDetune%1024;if (k>=512) k-=1024;} | |||
code2 {o->value(k);} | |||
code3 {o->lstep(10);} | |||
@@ -256,13 +256,13 @@ pars->PCoarseDetune = k+ | |||
Fl_Slider detune { | |||
callback {pars->PDetune=(int)o->value()+8192; | |||
detunevalueoutput->do_callback();} | |||
tooltip {Fine Detune (cents)} xywh {495 25 230 15} type {Horz Knob} box NO_BOX minimum -8192 maximum 8191 step 1 | |||
tooltip {Fine Detune (cents)} xywh {495 27 230 15} type {Horz Knob} box NO_BOX minimum -8192 maximum 8191 step 1 | |||
code0 {o->value(pars->PDetune-8192);} | |||
} | |||
Fl_Value_Output detunevalueoutput { | |||
label Detune | |||
callback {o->value(getdetune(pars->PDetuneType,0,pars->PDetune));} | |||
xywh {448 25 45 15} labelsize 10 align 5 minimum -5000 maximum 5000 step 0.01 textfont 1 textsize 10 | |||
xywh {448 27 45 15} labelsize 10 align 5 minimum -5000 maximum 5000 step 0.01 textfont 1 textsize 10 | |||
code0 {o->value(getdetune(pars->PDetuneType,0,pars->PDetune));} | |||
} | |||
Fl_Check_Button hz440 { | |||
@@ -271,13 +271,13 @@ detunevalueoutput->do_callback();} | |||
pars->Pfixedfreq=x; | |||
if (x==0) fixedfreqetdial->deactivate(); | |||
else fixedfreqetdial->activate();} | |||
tooltip {set the base frequency to 440Hz} xywh {555 45 50 15} down_box DOWN_BOX labelfont 1 labelsize 10 | |||
tooltip {set the base frequency to 440Hz} xywh {555 53 50 15} down_box DOWN_BOX labelfont 1 labelsize 10 | |||
code0 {o->value(pars->Pfixedfreq);} | |||
} | |||
Fl_Dial fixedfreqetdial { | |||
label {Eq.T.} | |||
callback {pars->PfixedfreqET=(int) o->value();} | |||
tooltip {How the frequency varies acording to the keyboard (leftmost for fixed frequency)} xywh {610 45 15 15} box ROUND_UP_BOX labelsize 10 align 8 maximum 127 step 1 | |||
tooltip {How the frequency varies acording to the keyboard (leftmost for fixed frequency)} xywh {610 53 15 15} box ROUND_UP_BOX labelsize 10 align 8 maximum 127 step 1 | |||
code0 {o->value(pars->PfixedfreqET);} | |||
code1 {if (pars->Pfixedfreq==0) o->deactivate();} | |||
class WidgetPDial | |||
@@ -286,15 +286,15 @@ if (x==0) fixedfreqetdial->deactivate(); | |||
label {Detune Type} | |||
callback {pars->PDetuneType=(int) o->value()+1; | |||
detunevalueoutput->do_callback();} open | |||
xywh {655 85 70 15} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10 | |||
xywh {655 94 70 15} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10 | |||
code0 {o->add("L35cents");o->add("L10cents");o->add("E100cents");o->add("E1200cents");} | |||
code1 {o->value(pars->PDetuneType-1);} | |||
} {} | |||
} | |||
Fl_Check_Button stereo { | |||
label Stereo | |||
callback {pars->Pstereo=(int) o->value();} selected | |||
xywh {440 325 55 35} box THIN_UP_BOX down_box DOWN_BOX labelsize 10 | |||
callback {pars->Pstereo=(int) o->value();} | |||
xywh {440 406 55 35} box THIN_UP_BOX down_box DOWN_BOX labelsize 10 | |||
code0 {o->value(pars->Pstereo);} | |||
} | |||
Fl_Button {} { | |||
@@ -308,7 +308,7 @@ detunevalueoutput->do_callback();} open | |||
pars->Phmag[0]=127; | |||
h[0]->mag->value(0); | |||
SUBparameters->redraw();} | |||
tooltip {Clear the harmonics} xywh {445 365 70 20} box THIN_UP_BOX labelfont 1 labelsize 11 | |||
tooltip {Clear the harmonics} xywh {445 446 70 20} box THIN_UP_BOX labelfont 1 labelsize 11 | |||
} | |||
Fl_Group bandwidthsettingsui { | |||
label BANDWIDTH | |||
@@ -346,18 +346,18 @@ bandwidthsettingsui->redraw();} | |||
} | |||
Fl_Group globalfiltergroup { | |||
label FILTER | |||
xywh {440 140 290 185} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17 | |||
xywh {440 221 290 185} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 align 17 | |||
code0 {if (pars->PGlobalFilterEnabled==0) o->deactivate();} | |||
} { | |||
Fl_Group filterenv { | |||
label {SUBsynth - Filter Envelope} open | |||
xywh {445 250 275 70} box FLAT_BOX color 51 align 144 | |||
xywh {445 331 275 70} box FLAT_BOX color 51 align 144 | |||
code0 {o->init(pars->GlobalFilterEnvelope);} | |||
class EnvelopeUI | |||
} {} | |||
Fl_Group filterui { | |||
label {SUBsynthl - Filter} open | |||
xywh {445 165 275 75} box FLAT_BOX color 50 align 144 | |||
xywh {445 246 275 75} box FLAT_BOX color 50 align 144 | |||
code0 {o->init(pars->GlobalFilter,&pars->PGlobalFilterVelocityScale,&pars->PGlobalFilterVelocityScaleFunction);} | |||
class FilterUI | |||
} {} | |||
@@ -369,18 +369,87 @@ if (o->value()==0) globalfiltergroup->deactivate(); | |||
else globalfiltergroup->activate(); | |||
o->show(); | |||
globalfiltergroup->redraw();} | |||
xywh {445 145 85 20} down_box DOWN_BOX labelfont 1 labelsize 11 | |||
xywh {445 226 85 20} down_box DOWN_BOX labelfont 1 labelsize 11 | |||
code0 {o->value(pars->PGlobalFilterEnabled);} | |||
} | |||
Fl_Button {} { | |||
label C | |||
callback {presetsui->copy(pars);} | |||
xywh {540 370 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 | |||
xywh {540 451 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 | |||
} | |||
Fl_Button {} { | |||
label P | |||
callback {presetsui->paste(pars,this);} | |||
xywh {570 370 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 | |||
xywh {570 451 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 | |||
} | |||
Fl_Group {} { | |||
label OVERTONES open | |||
xywh {440 151 220 70} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 align 17 | |||
} { | |||
Fl_Choice spreadtype { | |||
label OvertonesPosition | |||
callback {pars->POvertoneSpread.type = (int)o->value(); | |||
pars->updateFrequencyMultipliers();} open | |||
xywh {450 190 80 20} down_box BORDER_BOX labelsize 10 align 5 textsize 10 | |||
code0 {o->value(pars->POvertoneSpread.type);} | |||
} { | |||
MenuItem {} { | |||
label Harmonic | |||
xywh {0 0 34 20} labelfont 1 labelsize 11 | |||
} | |||
MenuItem {} { | |||
label ShiftU | |||
xywh {10 10 34 20} labelfont 1 labelsize 11 | |||
} | |||
MenuItem {} { | |||
label ShiftL | |||
xywh {20 20 34 20} labelfont 1 labelsize 11 | |||
} | |||
MenuItem {} { | |||
label PowerU | |||
xywh {20 20 34 20} labelfont 1 labelsize 11 | |||
} | |||
MenuItem {} { | |||
label PowerL | |||
xywh {30 30 34 20} labelfont 1 labelsize 11 | |||
} | |||
MenuItem {} { | |||
label Sine | |||
xywh {40 40 34 20} labelfont 1 labelsize 11 | |||
} | |||
MenuItem {} { | |||
label Power | |||
xywh {50 50 34 20} labelfont 1 labelsize 11 | |||
} | |||
MenuItem {} { | |||
label Shift selected | |||
xywh {20 20 34 20} labelfont 1 labelsize 11 | |||
} | |||
} | |||
Fl_Dial spreadpar1 { | |||
label Par1 | |||
callback {pars->POvertoneSpread.par1 = o->value(); | |||
pars->updateFrequencyMultipliers();} | |||
xywh {548 173 30 30} box ROUND_UP_BOX labelsize 10 maximum 255 step 1 | |||
code0 {o->value(pars->POvertoneSpread.par1);} | |||
class WidgetPDial | |||
} | |||
Fl_Dial spreadpar2 { | |||
label Par2 | |||
callback {pars->POvertoneSpread.par2 = o->value(); | |||
pars->updateFrequencyMultipliers();} | |||
xywh {583 173 30 30} box ROUND_UP_BOX labelsize 10 maximum 255 step 1 | |||
code0 {o->value(pars->POvertoneSpread.par2);} | |||
class WidgetPDial | |||
} | |||
Fl_Dial spreadpar3 { | |||
label ForceH | |||
callback {pars->POvertoneSpread.par3 = o->value(); | |||
pars->updateFrequencyMultipliers();} | |||
xywh {618 173 30 30} box ROUND_UP_BOX labelsize 10 maximum 255 step 1 | |||
code0 {o->value(pars->POvertoneSpread.par3);} | |||
class WidgetPDial | |||
} | |||
} | |||
} | |||
} | |||
@@ -400,6 +469,11 @@ bwee->show(); | |||
bandwidthsettingsui->redraw(); | |||
detunevalueoutput->value(getdetune(pars->PDetuneType,0,pars->PDetune)); | |||
spreadtype->value(pars->POvertoneSpread.type); | |||
spreadpar1->value(pars->POvertoneSpread.par1); | |||
spreadpar2->value(pars->POvertoneSpread.par2); | |||
spreadpar3->value(pars->POvertoneSpread.par3); | |||
freqee->value(pars->PFreqEnvelopeEnabled); | |||
if (pars->PFreqEnvelopeEnabled==0) freqenvelopegroup->deactivate(); | |||
else freqenvelopegroup->activate(); | |||
@@ -86,7 +86,8 @@ rndvelocity=0;} {} | |||
Fl_Image *white_down = Fl_Shared_Image::get( PIXMAP_PATH "white_key_pressed.png" ); | |||
Fl_Image *black_up = Fl_Shared_Image::get( PIXMAP_PATH "black_key.png" ); | |||
Fl_Image *black_down = Fl_Shared_Image::get( PIXMAP_PATH "black_key_pressed.png" ); | |||
\#endif | |||
\#endif | |||
//On error fetch everything from source directory | |||
if(!(white_up&&white_down&&black_up&&black_down)) { | |||
@@ -126,7 +126,6 @@ int WidgetPDial::handle(int event) | |||
oldvalue = value(); | |||
case FL_DRAG: | |||
getPos(); | |||
tipwin->showValue(value()); | |||
my = -(Fl::event_y() - y() - h() / 2); | |||
dragsize = 200.0f; | |||
@@ -134,6 +133,22 @@ int WidgetPDial::handle(int event) | |||
dragsize *= 10; | |||
value(limit(oldvalue + my / dragsize * (max - min), min, max)); | |||
tipwin->showValue(value()); | |||
value_damage(); | |||
if(this->when() != 0) | |||
do_callback(); | |||
return 1; | |||
case FL_MOUSEWHEEL: | |||
if (Fl::belowmouse() != this) | |||
return 1; | |||
my = - Fl::event_dy(); | |||
dragsize = 200.0f; | |||
if(Fl::event_state(FL_CTRL) != 0) | |||
dragsize *= 10; | |||
value(limit(value() + my / dragsize * (max - min), min, max)); | |||
tipwin->showValue(value()); | |||
value_damage(); | |||
if(this->when() != 0) | |||
do_callback(); | |||
@@ -159,22 +174,6 @@ int WidgetPDial::handle(int event) | |||
//#endif | |||
} | |||
void WidgetPDial::drawgradient(int cx, int cy, int sx, double m1, double m2) | |||
{ | |||
#ifdef NTK_GUI | |||
return; | |||
#else | |||
for(int i = (int)(m1 * sx); i < (int)(m2 * sx); i++) { | |||
double tmp = 1.0f - powf(i * 1.0f / sx, 2.0f); | |||
pdialcolor(140 | |||
+ (int) (tmp | |||
* 90), 140 | |||
+ (int)(tmp * 90), 140 + (int) (tmp * 100)); | |||
fl_arc(cx + sx / 2 - i / 2, cy + sx / 2 - i / 2, i, i, 0, 360 ); | |||
} | |||
#endif | |||
} | |||
void WidgetPDial::draw() | |||
{ | |||
#ifdef NTK_GUI | |||
@@ -184,59 +183,56 @@ void WidgetPDial::draw() | |||
return; | |||
#else | |||
int cx = x(), cy = y(), sx = w(), sy = h(); | |||
//clears the button face | |||
pdialcolor(190, 190, 200); | |||
fl_pie(cx - 1, cy - 1, sx + 2, sy + 2, 0, 360); | |||
/* //Draws the button face (gradinet) */ | |||
drawgradient(cx, cy, sx, 0.5f, 1.0f); | |||
double val = (value() - minimum()) / (maximum() - minimum()); | |||
//draws the scale | |||
pdialcolor(220, 220, 250); | |||
double a1 = angle1(), a2 = angle2(); | |||
for(int i = 0; i < 12; i++) { | |||
double a = -i / 12.0f * 360.0f - val * (a2 - a1) - a1; | |||
fl_pie(cx, cy, sx, sy, a + 270 - 3, a + 3 + 270); | |||
const int cx = x(), cy = y(), sx = w(), sy = h(); | |||
const double a1 = angle1(), a2 = angle2(); | |||
const double val = (value() - minimum()) / (maximum() - minimum()); | |||
// even radius produces less artifacts if no antialiasing is avail | |||
const int rad = (sx > sy ? sy : sx) &~1; | |||
/* clears the button background */ | |||
pdialcolor(160, 160, 160); | |||
fl_pie(cx - 2, cy - 2, rad + 4, rad + 4, 0, 360); | |||
/* dark outline */ | |||
fl_color(60, 60, 60); | |||
fl_pie(cx - 1, cy - 1, rad + 2, rad + 2, 0, 360); | |||
/* Draws the button faceplate, min/max */ | |||
pdialcolor(110, 110, 115); | |||
fl_pie(cx, cy, rad, rad, 270 - a2, 270 - a1); | |||
/* knob center */ | |||
if (rad > 8) { | |||
pdialcolor(140, 140, 145); | |||
fl_pie(cx + 4, cy + 4, rad - 8, rad - 8, 0, 360); | |||
} | |||
drawgradient(cx, cy, sx, 0.0f, 0.75f); | |||
//draws the value | |||
/* value circle */ | |||
double a = -(a2 - a1) * val - a1; | |||
fl_line_style(0, 2, 0); | |||
pdialcolor(0, 200, 0); | |||
fl_arc(cx + 1, cy + 1, rad - 2, rad - 2, a - 90, a1 - 180); | |||
fl_line_style(0); | |||
//draws the max and min points | |||
pdialcolor(0, 100, 200); | |||
int xp = | |||
(int)(cx + sx / 2.0f + sx / 2.0f * sinf(angle1() / 180.0f * 3.141592f)); | |||
int yp = | |||
(int)(cy + sy / 2.0f + sy / 2.0f * cosf(angle1() / 180.0f * 3.141592f)); | |||
fl_pie(xp - 2, yp - 2, 4, 4, 0, 360); | |||
xp = (int)(cx + sx / 2.0f + sx / 2.0f * sinf(angle2() / 180.0f * 3.141592f)); | |||
yp = (int)(cy + sy / 2.0f + sy / 2.0f * cosf(angle2() / 180.0f * 3.141592f)); | |||
fl_pie(xp - 2, yp - 2, 4, 4, 0, 360); | |||
/* draw value line */ | |||
int ll = rad/4; | |||
if (ll < 2) ll = 2; | |||
fl_push_matrix(); | |||
fl_translate(cx + sx / 2, cy + sy / 2); | |||
fl_translate(cx + rad / 2, cy + rad / 2); | |||
fl_rotate(a - 90.0f); | |||
fl_translate(sx / 2, 0); | |||
fl_translate(rad / 2, 0); | |||
fl_begin_polygon(); | |||
pdialcolor(0, 0, 0); | |||
fl_vertex(-10, -4); | |||
fl_vertex(-10, 4); | |||
fl_vertex(-ll, 0); | |||
fl_vertex(0, 0); | |||
fl_end_polygon(); | |||
fl_pop_matrix(); | |||
#endif | |||
} | |||
@@ -11,7 +11,6 @@ class WidgetPDial:public Fl_Dial | |||
WidgetPDial(int x, int y, int w, int h, const char *label = 0); | |||
~WidgetPDial(); | |||
int handle(int event); | |||
void drawgradient(int cx, int cy, int sx, double m1, double m2); | |||
void draw(); | |||
void pdialcolor(int r, int g, int b); | |||
void tooltip(const char *c); | |||
@@ -3,7 +3,7 @@ | |||
main.cpp - Main file of the synthesizer | |||
Copyright (C) 2002-2005 Nasca Octavian Paul | |||
Author: Nasca Octavian Paul | |||
Copyright (C) 2012-2014 Mark McCurry | |||
This program is free software; you can redistribute it and/or modify | |||
it under the terms of version 2 of the GNU General Public License | |||
@@ -179,6 +179,9 @@ int main(int argc, char *argv[]) | |||
cerr | |||
<< "\nZynAddSubFX - Copyright (c) 2002-2011 Nasca Octavian Paul and others" | |||
<< endl; | |||
cerr | |||
<< " Copyright (c) 2009-2014 Mark McCurry [active maintainer]" | |||
<< endl; | |||
cerr << "Compiled: " << __DATE__ << " " << __TIME__ << endl; | |||
cerr << "This program is free software (GNU GPL v.2 or later) and \n"; | |||
cerr << "it comes with ABSOLUTELY NO WARRANTY.\n" << endl; | |||