From 39a8b5aca5adf2974721dda809e9c08dc6c28290 Mon Sep 17 00:00:00 2001 From: Jeremy Salwen Date: Fri, 25 May 2012 04:50:35 -0400 Subject: [PATCH] Working on ttl --- src/Makefile | 28 +++++++ src/manifest.ttl | 2 +- src/minicomputer.c | 22 +++-- src/minicomputer.h | 7 +- src/minicomputer.ttl | 104 +++++++----------------- src/portgroupplans.txt | 177 +++++++++++++++++++++++++++++++++++++++++ 6 files changed, 246 insertions(+), 94 deletions(-) create mode 100644 src/Makefile create mode 100644 src/portgroupplans.txt diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000..50e3d57 --- /dev/null +++ b/src/Makefile @@ -0,0 +1,28 @@ +OBJECTS = minicomputer.o +LIBRARY = libminicomputer.so +TTLS = minicomputer manifest.ttl +CC = gcc +CFLAGS += -std=c99 -Wall -Wextra -fPIC +INSTALLDIR = $(DESTDIR)/usr/lib/lv2/ +INSTALLNAME = minicomputer.lv2/ +$(LIBRARY) : $(OBJECTS) + $(CC) $(CFLAGS) $(OBJECTS) -shared -o $@ + +.SUFFIXES : .c .o + +.c.o: + $(CC) $(CFLAGS) -c $< + +minicomputer.o: minicomputer.c +.PHONY : clean install uninstall + +clean : + rm -f $(LIBRARY) $(OBJECTS) + +install : + mkdir -p $(INSTALLDIR)$(INSTALLNAME) + install $(LIBRARY) $(INSTALLDIR)$(INSTALLNAME) + install -m 644 $(TTLS) $(INSTALLDIR)$(INSTALLNAME) + +uninstall : + rm -rf $(INSTALLDIR)$(INSTALLNAME) diff --git a/src/manifest.ttl b/src/manifest.ttl index 2f80be8..05f1418 100644 --- a/src/manifest.ttl +++ b/src/manifest.ttl @@ -1,6 +1,6 @@ @prefix lv2: . @prefix rdfs: . - a lv2:Plugin; + a lv2:Plugin; lv2:binary ; rdfs:seeAlso . diff --git a/src/minicomputer.c b/src/minicomputer.c index e1c1e17..afdd924 100644 --- a/src/minicomputer.c +++ b/src/minicomputer.c @@ -262,7 +262,6 @@ static inline void handlemidi(minicomputer* mini, unsigned int maxindex) { { engine* use=use_note_minicomputer(mini,evt[1]); if(use) { - use->lastnote=evt[1]; use->midif=midi2freq[evt[1]];// lookup the frequency use->mod_midi_note=evt[1]*0.007874f;// fill the value in as normalized modulator use->mod_midi_velocity=(float)1.f-(evt[2]*0.007874f);// fill in the velocity as modulator @@ -444,10 +443,19 @@ void clear_filters(minicomputer* mini) { voice->phase1 = 0.f; voice->phase2 = 0.f; memset(voice->delayBuffer,0,sizeof(voice->delayBuffer)); + + for (int i=0;i<7;i++) // i is the number of envelope + { + voice->envelope_generator[i].EGtrigger=0; + voice->envelope_generator[i].EGstate=4; // released + } } mini->mod_osc_phase = 0.f; } +void activateMinicomputer (LV2_Handle instance) { + clear_filters((minicomputer*)instance); +} static void run_minicomputer(LV2_Handle instance, uint32_t nframes) { minicomputer* mini= (minicomputer*)instance; @@ -638,17 +646,7 @@ static void run_minicomputer(LV2_Handle instance, uint32_t nframes) { static void initEngine(engine* voice,int delayBufferSize) { voice->delayBuffer=malloc(delayBufferSize); - for (int i=0;i<7;i++) // i is the number of envelope - { - voice->envelope_generator[i].EGtrigger=0; - voice->envelope_generator[i].EGstate=4; // released - } - for (unsigned int i=0;i<3;++i) - { - voice->filt[i].low=0; - voice->filt[i].high=0; - voice->filt[i].band=0; - } + } static void initEngines(minicomputer* mini) { diff --git a/src/minicomputer.h b/src/minicomputer.h index 5a933d2..4b5c100 100644 --- a/src/minicomputer.h +++ b/src/minicomputer.h @@ -146,8 +146,6 @@ typedef struct _engine { float midif __attribute__((aligned (16))); float *port; // _multitemp * ports + 2 mix and 2 aux - - unsigned int lastnote; } engine; @@ -228,14 +226,13 @@ static void connect_port_minicomputer(LV2_Handle instance, uint32_t port, void * static LV2_Handle instantiateMinicomputer(const LV2_Descriptor *descriptor, double s_rate, const char *path, const LV2_Feature * const* features); static void run_minicomputer(LV2_Handle instance, uint32_t nframes); static void cleanupMinicomputer(LV2_Handle instance); - +static void activateMinicomputer(LV2_Handle instance); const LV2_Descriptor miniDescriptor ={ .URI=MINICOMPUTER_URI, - .activate=NULL, .cleanup=cleanupMinicomputer, .connect_port=connect_port_minicomputer, + .activate=activateMinicomputer, .deactivate=NULL, - .activate=NULL, .instantiate=instantiateMinicomputer, .run=run_minicomputer, .extension_data=NULL diff --git a/src/minicomputer.ttl b/src/minicomputer.ttl index 4005787..f8a71a0 100644 --- a/src/minicomputer.ttl +++ b/src/minicomputer.ttl @@ -9,7 +9,7 @@ doap:developer [ foaf:name "Malte Steiner"; ] ; - doap maintainer [ + doap:maintainer [ foaf:name "Jeremy Salwen"; foaf:mbox ; ] ; @@ -20,106 +20,58 @@ a lv2:AudioPort ; a lv2:OutputPort ; lv2:index 0 ; - lv2:symbol "lmix" ; - lv2:name "Mix Left" ; - ], [ - a lv2:AudioPort ; - a lv2:OutputPort ; - lv2:index 1 ; - lv2:symbol "rmix" ; - lv2:name "Mix Right" ; - ],[ - a lv2:AudioPort ; - a lv2:OutputPort ; - lv2:index 2 ; - lv2:symbol "laux" ; - lv2:name "Aux Left" ; - ],[ - a lv2:AudioPort ; - a lv2:OutputPort ; - lv2:index 3 ; - lv2:symbol "raux" ; - lv2:name "Aux Right" ; + lv2:symbol "out" ; + lv2:name "Audio Out" ; ],[ a lv2:InputPort; a ev:EventPort; - lv2:index 4 ; + lv2:index 1 ; ev:supportsEvent ; lv2:symbol "midi"; lv2:name "MIDI Input"; ],[ a lv2:InputPort; a lv2:ControlPort; - lv2:index 3; - lv2:symbol "controlmode"; - lv2:name "Control Mode"; - lv2:portProperty lv2:toggled; - lv2:portProperty lv2:enumeration; - lv2:default 0; - lv2:scalePoint [ rdfs:label "Control Ports"; rdf:value 1 ]; - lv2:scalePoint [ rdfs:label "OSC"; rdf:value 0 ]; + lv2:index 2; + lv2:symbol "volume"; + lv2:name "Volume"; + lv2:default 1; + lv2:minimum 0; + lv2:maximum 2; ],[ a lv2:InputPort; a lv2:ControlPort; lv2:index 3; - lv2:symbol "volume"; - lv2:name "Volume"; - lv2:default 100; - lv2:minimum 0; - lv2:maximum 127; + lv2:symbol "osc1_fix_freq"; + lv2:name "Fix Osc1 frequency"; + lv2:portProperty lv2:toggled; + lv2:default 0; ],[ a lv2:InputPort; a lv2:ControlPort; lv2:index 4; - lv2:symbol "cutoff"; - lv2:name "Filter Cutoff"; - lv2:default 50; + lv2:symbol "osc1_fixed_freq"; + lv2:name "Osc 1 Fixed Frequency"; + lv2:default 0; lv2:minimum 0; - lv2:maximum 127; + lv2:maximum 1000; ],[ a lv2:InputPort; a lv2:ControlPort; lv2:index 5; - lv2:symbol "resonance"; - lv2:name "Filter Resonance"; - lv2:default 100; + lv2:symbol "osc1_tuned_freq"; + lv2:name "Osc 1 Transposition"; + lv2:default 1; lv2:minimum 0; - lv2:maximum 127; + lv2:maximum 17; ],[ a lv2:InputPort; a lv2:ControlPort; lv2:index 6; - lv2:symbol "envelope"; - lv2:name "Filter Envelope"; - lv2:default 80; - lv2:minimum 0; - lv2:maximum 127; - ],[ - a lv2:InputPort; - a lv2:ControlPort; - lv2:index 7; - lv2:symbol "portamento"; - lv2:name "Portamento Time"; - lv2:default 64; - lv2:minimum 0; - lv2:maximum 127; - ], [ - a lv2:InputPort; - a lv2:ControlPort; - lv2:index 8; - lv2:symbol "release"; - lv2:name "Release Time"; - lv2:default 100; + lv2:symbol "osc1_tuned_freq"; + lv2:name "Osc 1 Transposition"; + lv2:default 1; lv2:minimum 0; - lv2:maximum 127; - ],[ - a lv2:InputPort; - a lv2:ControlPort; - lv2:index 9; - lv2:symbol "polyphony"; - lv2:name "Polyphony"; - lv2:portProperty lv2:integer; - lv2:default 8; - lv2:minimum 1; - lv2:maximum 48; - ]. + lv2:maximum 17; + ] + . diff --git a/src/portgroupplans.txt b/src/portgroupplans.txt new file mode 100644 index 0000000..44cf534 --- /dev/null +++ b/src/portgroupplans.txt @@ -0,0 +1,177 @@ +midi_out; +audio_out; +clear; +osc1 { + volume; + waveform; + fm_output_volume; + pitch { + fix; + fixed; + tuned; + } + boost_modulation; + freqmod1 { + modulator; + amount; + } + freqmod2 { + modulator; + amount; + } + ampmod1 { + modulator; + amount; + } + ampmod2 { + modulator; + amount; + } +} +osc2 { + volume; + waveform; + fm_output_volume; + sync_to_osc1; + pitch { + fix; + fixed; + tuned; + } + boost_modulation; + freqmod1 { + modulator; + amount; + } + freqmod2 { + modulator; + amount; + } + ampmod1 { + modulator; + amount; + } + fm_out_ampmod { + modulator; + amount; + } +} +filters { + filter1 { + leftsettings { + frequency; + resonance; + volume; + } + rightsettings { + frequency; + resonance; + volume; + } + } + filter2 { + leftsettings { + frequency; + resonance; + volume; + } + rightsettings { + frequency; + resonance; + volume; + } + } + filter3 { + leftsettings { + frequency; + resonance; + volume; + } + rightsettings { + frequency; + resonance; + volume; + } + } + morph; + morph_mod1 { + modulator; + amount; + } + morph_mod2 { + modulator; + amount; + } +} +modulators { + envelope1 { + attack; + decay; + sustain; + release; + repeat; + } + envelope2 { + attack; + decay; + sustain; + release; + repeat; + } + envelope3 { + attack; + decay; + sustain; + release; + repeat; + } + envelope4 { + attack; + decay; + sustain; + release; + repeat; + } + envelope5 { + attack; + decay; + sustain; + release; + repeat; + } + envelope6 { + attack; + decay; + sustain; + release; + repeat; + } + modulation_oscillator { + frequency; + waveform; + } +} +volume { + volume_modulator { + modulator; + amount; + } + volume_envelope { + attack; + decay; + sustain; + release; + repeat; + } + volume; +} +delay { + input_volume; + time; + time_modulator { + modulator; + amount; + } + feedback; + output_volume; +}