Commit 101d2a40 authored by Jaromír Mikeš's avatar Jaromír Mikeš

Imported Upstream version 20160823

parent 1bc405ef
......@@ -16,7 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#define GL_GLEXT_PROTOTYPES
#include <stdio.h>
......
......@@ -494,7 +494,7 @@ errout:
}
int clv_is_active (LV2convolv *clv) {
if (!clv || !clv->convproc) {
if (!clv || !clv->convproc || !clv->ir_fn) {
return 0;
}
return 1;
......
......@@ -359,13 +359,17 @@ run(LV2_Handle instance, uint32_t n_samples)
self->output_gain += .08f * (self->output_gain_target - self->output_gain);
/* Set up forge to write directly to notify output port. */
const uint32_t notify_capacity = self->notify_port->atom.size;
lv2_atom_forge_set_buffer(&self->forge,
(uint8_t*)self->notify_port,
notify_capacity);
if (self->notify_port) {
const uint32_t notify_capacity = self->notify_port->atom.size;
lv2_atom_forge_set_buffer(&self->forge,
(uint8_t*)self->notify_port,
notify_capacity);
/* Start a sequence in the notify output port. */
lv2_atom_forge_sequence_head(&self->forge, &self->notify_frame, 0);
}
/* Start a sequence in the notify output port. */
lv2_atom_forge_sequence_head(&self->forge, &self->notify_frame, 0);
bool silent = false;
/* re-init engine if block-size has changed */
if (self->bufsize != n_samples) {
......@@ -377,22 +381,21 @@ run(LV2_Handle instance, uint32_t n_samples)
for (i=0; i < self->chn_out; i++ ) {
memset(output[i], 0, sizeof(float) * n_samples);
}
// TODO: notify user (once)
return;
}
if (!self->flag_reinit_in_progress) {
self->flag_reinit_in_progress = 1;
self->bufsize = n_samples;
int d = CMD_APPLY;
self->schedule->schedule_work(self->schedule->handle, sizeof(int), &d);
silent = true;
} else {
if (!self->flag_reinit_in_progress && clv_is_active(self->clv_online)) {
self->flag_reinit_in_progress = 1;
self->bufsize = n_samples;
int d = CMD_APPLY;
self->schedule->schedule_work(self->schedule->handle, sizeof(int), &d);
}
}
}
/* don't touch any settings if re-init is scheduled or in progress
* TODO re-queue them ?
*/
if (!self->flag_reinit_in_progress) {
if (!self->flag_reinit_in_progress && self->control_port && self->notify_port) {
/* Read incoming events */
LV2_ATOM_SEQUENCE_FOREACH(self->control_port, ev) {
const LV2_Atom_Object* obj = (LV2_Atom_Object*)&ev->body;
......@@ -408,11 +411,14 @@ run(LV2_Handle instance, uint32_t n_samples)
}
/* send current setting to UI */
if (self->flag_notify_ui) {
if (self->flag_notify_ui && self->notify_port) {
self->flag_notify_ui = 0;
inform_ui(instance);
}
if (silent) {
return;
}
clv_convolve(self->clv_online, input, output,
self->chn_in,
self->chn_out,
......@@ -517,6 +523,7 @@ restore(LV2_Handle instance,
const void* value = retrieve(handle, self->uris.clv2_state, &size, &type, &valflags);
bool ok = true;
if (value) {
const char* cfg = (const char*)value;
const char *te,*ts = cfg;
......@@ -532,6 +539,8 @@ restore(LV2_Handle instance,
}
ts=te+1;
}
} else {
ok = false;
}
value = retrieve(handle, self->uris.clv2_impulse, &size, &type, &valflags);
......@@ -540,6 +549,16 @@ restore(LV2_Handle instance,
const char* path = (const char*)value;
DEBUG_printf("PTH: convolution.ir.file=%s\n", path);
clv_configure(self->clv_offline, "convolution.ir.file", path);
} else {
ok = false;
}
if (!ok) {
DEBUG_printf("State: incomplete state. Free offline instance\n");
clv_free(self->clv_offline);
self->clv_offline = 0;
self->flag_reinit_in_progress = 0;
return LV2_STATE_ERR_NO_PROPERTY;
}
#if 0
......
export balance_VERSION=0.6.4
export balance_VERSION=0.6.5
export controlfilter_VERSION=0.3.1
export convoLV2_VERSION=0.5.0
export convoLV2_VERSION=0.5.2
export fat1_VERSION=0.3.0
export fil4_VERSION=0.5.2
export meters_VERSION=0.9.2
export midifilter_VERSION=0.4.5
export midigen_VERSION=0.2.1
export midigen_VERSION=0.2.2
export midimap_VERSION=0.2.3
export mixtri_VERSION=0.2.7
export nodelay_VERSION=0.2.2
export onsettrigger_VERSION=0.2.3
export robtk_VERSION=0.5.1
export sisco_VERSION=0.7.0
export stepseq_VERSION=0.3.2
export stepseq_VERSION=0.3.3
export stereoroute_VERSION=0.1.1
export testsignal_VERSION=0.3.1
export testsignal_VERSION=0.3.2
export tuna_VERSION=0.4.0
export xfade_VERSION=0.2.3
......@@ -43,15 +43,6 @@ typedef struct {
#define N_MIDI_SEQ (sizeof (sequences) / sizeof(MIDISequence*))
typedef struct {
LV2_URID atom_Blank;
LV2_URID atom_Object;
LV2_URID atom_Sequence;
LV2_URID midi_MidiEvent;
LV2_URID atom_URID;
} MidiGenURIs;
typedef struct {
/* ports */
LV2_Atom_Sequence* midiout;
......@@ -60,10 +51,9 @@ typedef struct {
float* p_prog;
/* atom-forge and URI mapping */
LV2_URID_Map* map;
MidiGenURIs uris;
LV2_Atom_Forge forge;
LV2_Atom_Forge_Frame frame;
LV2_URID midi_MidiEvent;
/* LV2 Output */
LV2_Log_Log* log;
......@@ -83,22 +73,10 @@ typedef struct {
} MidiGen;
/* *****************************************************************************
* helper functions
*/
/** map uris */
static void
map_mem_uris (LV2_URID_Map* map, MidiGenURIs* uris)
{
uris->atom_Blank = map->map (map->handle, LV2_ATOM__Blank);
uris->atom_Object = map->map (map->handle, LV2_ATOM__Object);
uris->midi_MidiEvent = map->map (map->handle, LV2_MIDI__MidiEvent);
uris->atom_Sequence = map->map (map->handle, LV2_ATOM__Sequence);
uris->atom_URID = map->map (map->handle, LV2_ATOM__URID);
}
/**
* add a midi message to the output port
*/
......@@ -109,7 +87,7 @@ forge_midimessage (MidiGen* self,
uint32_t size)
{
LV2_Atom midiatom;
midiatom.type = self->uris.midi_MidiEvent;
midiatom.type = self->midi_MidiEvent;
midiatom.size = size;
if (0 == lv2_atom_forge_frame_time (&self->forge, tme)) return;
......@@ -148,26 +126,27 @@ instantiate (const LV2_Descriptor* descriptor,
const LV2_Feature* const* features)
{
MidiGen* self = (MidiGen*)calloc (1, sizeof (MidiGen));
LV2_URID_Map* map = NULL;
int i;
for (i=0; features[i]; ++i) {
if (!strcmp (features[i]->URI, LV2_URID__map)) {
self->map = (LV2_URID_Map*)features[i]->data;
map = (LV2_URID_Map*)features[i]->data;
} else if (!strcmp (features[i]->URI, LV2_LOG__log)) {
self->log = (LV2_Log_Log*)features[i]->data;
}
}
lv2_log_logger_init (&self->logger, self->map, self->log);
lv2_log_logger_init (&self->logger, map, self->log);
if (!self->map) {
if (!map) {
lv2_log_error (&self->logger, "MidiGen.lv2 error: Host does not support urid:map\n");
free (self);
return NULL;
}
lv2_atom_forge_init (&self->forge, self->map);
map_mem_uris (self->map, &self->uris);
lv2_atom_forge_init (&self->forge, map);
self->midi_MidiEvent = map->map (map->handle, LV2_MIDI__MidiEvent);
self->sample_rate = rate;
self->bpm = 120;
......
balance.lv2 v0.6.4
balance.lv2 v0.6.5
controlfilter.lv2 v0.3.1
convoLV2 v0.5.0
convoLV2 v0.5.2
fat1.lv2 v0.3.0
fil4.lv2 v0.5.2
meters.lv2 v0.9.2
midifilter.lv2 v0.4.5
midigen.lv2 v0.2.1
midigen.lv2 v0.2.2
midimap.lv2 v0.2.3
mixtri.lv2 v0.2.7
nodelay.lv2 v0.2.2
onsettrigger.lv2 v0.2.3
robtk v0.5.1
sisco.lv2 v0.7.0
stepseq.lv2 v0.3.2
stepseq.lv2 v0.3.3
stereoroute.lv2 v0.1.1
testsignal.lv2 v0.3.1
testsignal.lv2 v0.3.2
tuna.lv2 v0.4.0
xfade.lv2 v0.2.3
......@@ -16,7 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <stdio.h>
#include <string.h>
......
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.4.
.TH X42-STEPSEQ "1" "August 2016" "x42-stepseq version 0.3.2" "User Commands"
.TH X42-STEPSEQ "1" "August 2016" "x42-stepseq version 0.3.3" "User Commands"
.SH NAME
x42-stepseq \- x42 Step Sequencer
.SH SYNOPSIS
......
......@@ -4,7 +4,7 @@ testsignal.lv2
testsignal.lv2 is an audio-plugin for generating test-signals
in [LV2](http://lv2plug.in) format.
It has 7 operation modes:
It has 9 operation modes:
* Sine Wave 1kHz
* Square Wave 1kHz
* Sine Sweep 20Hz to 20KHz (at most to samplerate / 2) in 10 seconds
......@@ -12,6 +12,8 @@ It has 7 operation modes:
* Gaussian Shaped White Noise
* Pink Noise
* Impulses (1 sample spike) 100Hz, 0dBFS
* Impulses (1 sample spike) 1Hz, 0dBFS
* Impulses (1 sample spike) 5s (0.2Hz), 0dBFS
The signal level can be varied between -24dBFS and -9dBFS and defaults to -18dBFS.
......
......@@ -55,7 +55,9 @@ typedef struct {
// impulse period counters
uint32_t k_cnt;
uint32_t k_period;
uint32_t k_period100;
uint32_t k_period1;
uint32_t k_period5s;
// sweep settings
double swp_log_a, swp_log_b;
......@@ -215,17 +217,16 @@ gen_pink (TestSignal *self, uint32_t n_samples)
}
static void
gen_kroneker_delta (TestSignal *self, uint32_t n_samples)
gen_kroneker_delta (TestSignal *self, uint32_t n_samples, const uint32_t period)
{
float *out = self->output;
memset (out, 0, n_samples * sizeof (float));
uint32_t k_cnt = self->k_cnt;
const uint32_t k_period = self->k_period;
while (n_samples > k_cnt) {
out[k_cnt] = 1.0f;
k_cnt += k_period;
k_cnt += period;
}
self->k_cnt = k_cnt - n_samples;
......@@ -263,9 +264,10 @@ instantiate (const LV2_Descriptor* descriptor,
TestSignal* self = (TestSignal*)calloc (1, sizeof (TestSignal));
// impulse 100Hz
self->phase_inc = 1000 / rate;
self->k_period = rate / 100;
self->k_period100 = rate / 100;
self->k_period1 = rate;
self->k_period5s = rate * 5;
// log frequency sweep
const double f_min = 20.;
......@@ -320,8 +322,10 @@ run (LV2_Handle instance, uint32_t n_samples)
else if (mode <= 2) { gen_uniform_white (self, n_samples); }
else if (mode <= 3) { gen_gaussian_white (self, n_samples); }
else if (mode <= 4) { gen_pink (self, n_samples); }
else if (mode <= 5) { gen_kroneker_delta (self, n_samples); }
else { gen_sine_log_sweep (self, n_samples); }
else if (mode <= 5) { gen_kroneker_delta (self, n_samples, self->k_period100); }
else if (mode <= 6) { gen_sine_log_sweep (self, n_samples); }
else if (mode <= 7) { gen_kroneker_delta (self, n_samples, self->k_period1); }
else { gen_kroneker_delta (self, n_samples, self->k_period5s); }
}
static void
......
......@@ -26,7 +26,7 @@
lv2:name "Mode";
lv2:default 0 ;
lv2:minimum 0 ;
lv2:maximum 6 ;
lv2:maximum 8 ;
lv2:portProperty lv2:integer, lv2:enumeration;
lv2:scalePoint [
rdfs:label "1KHz Sine Wave" ;
......@@ -49,6 +49,12 @@
] , [
rdfs:label "Sine Sweep, 20Hz to 20kHz in 10sec" ;
rdf:value 6;
] , [
rdfs:label "Impulses 0dBFS, 1Hz" ;
rdf:value 7;
] , [
rdfs:label "Impulses 0dBFS, 5s (0.2Hz)" ;
rdf:value 8;
];
] , [
a lv2:InputPort ,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment