mirror of https://github.com/dcoredump/dexed.git
parent
a2ae4a70da
commit
28fb4417b0
@ -1,2 +1,3 @@ |
||||
*.o |
||||
*.so |
||||
*.gch |
||||
|
@ -0,0 +1,23 @@ |
||||
BUNDLE = lv2pftci-beep.lv2
|
||||
INSTALL_DIR = /usr/local/lib/lv2
|
||||
|
||||
|
||||
$(BUNDLE): manifest.ttl beep.ttl beep.so |
||||
rm -rf $(BUNDLE)
|
||||
mkdir $(BUNDLE)
|
||||
cp $^ $(BUNDLE)
|
||||
|
||||
beep.so: beep.cpp beep.peg |
||||
g++ -shared -fPIC -DPIC beep.cpp `pkg-config --cflags --libs lv2-plugin` -o beep.so
|
||||
|
||||
beep.peg: beep.ttl |
||||
lv2peg beep.ttl beep.peg
|
||||
|
||||
install: $(BUNDLE) |
||||
mkdir -p $(INSTALL_DIR)
|
||||
rm -rf $(INSTALL_DIR)/$(BUNDLE)
|
||||
cp -R $(BUNDLE) $(INSTALL_DIR)
|
||||
|
||||
clean: |
||||
rm -rf $(BUNDLE) beep.so beep.peg
|
||||
|
@ -0,0 +1,59 @@ |
||||
#include <lv2synth.hpp> |
||||
#include "beep.peg" |
||||
|
||||
|
||||
class BeepVoice : public LV2::Voice { |
||||
public: |
||||
|
||||
BeepVoice(double rate)
|
||||
: m_key(LV2::INVALID_KEY), m_rate(rate), m_period(10), m_counter(0) { |
||||
|
||||
} |
||||
|
||||
void on(unsigned char key, unsigned char velocity) {
|
||||
m_key = key; |
||||
m_period = m_rate * 4.0 / LV2::key2hz(m_key); |
||||
} |
||||
|
||||
void off(unsigned char velocity) {
|
||||
m_key = LV2::INVALID_KEY; |
||||
} |
||||
|
||||
unsigned char get_key() const {
|
||||
return m_key;
|
||||
} |
||||
|
||||
void render(uint32_t from, uint32_t to) { |
||||
if (m_key == LV2::INVALID_KEY) |
||||
return; |
||||
for (uint32_t i = from; i < to; ++i) { |
||||
float s = -0.25 + 0.5 * (m_counter > m_period / 2); |
||||
m_counter = (m_counter + 1) % m_period; |
||||
p(p_left)[i] += s; |
||||
p(p_right)[i] += s; |
||||
} |
||||
} |
||||
|
||||
protected: |
||||
|
||||
unsigned char m_key; |
||||
double m_rate; |
||||
uint32_t m_period; |
||||
uint32_t m_counter; |
||||
|
||||
}; |
||||
|
||||
|
||||
class Beep : public LV2::Synth<BeepVoice, Beep> { |
||||
public: |
||||
|
||||
Beep(double rate) |
||||
: LV2::Synth<BeepVoice, Beep>(p_n_ports, p_midi) { |
||||
add_voices(new BeepVoice(rate), new BeepVoice(rate), new BeepVoice(rate)); |
||||
add_audio_outputs(p_left, p_right); |
||||
} |
||||
|
||||
}; |
||||
|
||||
|
||||
static int _ = Beep::register_class(p_uri); |
@ -0,0 +1,35 @@ |
||||
#ifndef beep_peg |
||||
#define beep_peg |
||||
|
||||
|
||||
#ifndef PEG_STRUCT |
||||
#define PEG_STRUCT |
||||
typedef struct { |
||||
float min; |
||||
float max; |
||||
float default_value; |
||||
char toggled; |
||||
char integer; |
||||
char logarithmic; |
||||
} peg_data_t; |
||||
#endif |
||||
|
||||
/* <http://ll-plugins.nongnu.org/lv2/lv2pftci/beep> */ |
||||
|
||||
static const char p_uri[] = "http://ll-plugins.nongnu.org/lv2/lv2pftci/beep"; |
||||
|
||||
enum p_port_enum { |
||||
p_midi, |
||||
p_left, |
||||
p_right, |
||||
p_n_ports |
||||
}; |
||||
|
||||
static const peg_data_t p_ports[] = { |
||||
{ -3.40282e+38, 3.40282e+38, -3.40282e+38, 0, 0, 0 }, |
||||
{ -3.40282e+38, 3.40282e+38, -3.40282e+38, 0, 0, 0 }, |
||||
{ -3.40282e+38, 3.40282e+38, -3.40282e+38, 0, 0, 0 }, |
||||
}; |
||||
|
||||
|
||||
#endif /* beep_peg */ |
@ -0,0 +1,46 @@ |
||||
@prefix lv2: <http://lv2plug.in/ns/lv2core#>. |
||||
@prefix doap: <http://usefulinc.com/ns/doap#>. |
||||
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>. |
||||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>. |
||||
@prefix ll: <http://ll-plugins.nongnu.org/lv2/namespace#>. |
||||
@prefix pg: <http://ll-plugins.nongnu.org/lv2/ext/portgroups#>. |
||||
@prefix ev: <http://lv2plug.in/ns/ext/event#>. |
||||
|
||||
<http://ll-plugins.nongnu.org/lv2/lv2pftci/beep/out> a pg:StereoGroup. |
||||
|
||||
<http://ll-plugins.nongnu.org/lv2/lv2pftci/beep> |
||||
a lv2:Plugin, lv2:InstrumentPlugin; |
||||
lv2:binary <beep.so>; |
||||
doap:name "Beep"; |
||||
doap:license <http://usefulinc.com/doap/licenses/gpl>; |
||||
ll:pegName "p"; |
||||
|
||||
lv2:port [ |
||||
a ev:EventPort, lv2:InputPort; |
||||
lv2:index 0; |
||||
ev:supportsEvent <http://lv2plug.in/ns/ext/midi#MidiEvent>; |
||||
lv2:symbol "midi"; |
||||
lv2:name "MIDI"; |
||||
], |
||||
|
||||
[ |
||||
a lv2:AudioPort, lv2:OutputPort; |
||||
lv2:index 1; |
||||
lv2:symbol "left"; |
||||
lv2:name "Left"; |
||||
pg:membership [ |
||||
pg:group <http://ll-plugins.nongnu.org/lv2/lv2pftci/beep/out>; |
||||
pg:role pg:leftChannel; |
||||
]; |
||||
], |
||||
|
||||
[ |
||||
a lv2:AudioPort, lv2:OutputPort; |
||||
lv2:index 2; |
||||
lv2:symbol "right"; |
||||
lv2:name "Right"; |
||||
pg:membership [ |
||||
pg:group <http://ll-plugins.nongnu.org/lv2/lv2pftci/beep/out>; |
||||
pg:role pg:rightChannel; |
||||
]; |
||||
]. |
@ -0,0 +1,46 @@ |
||||
@prefix lv2: <http://lv2plug.in/ns/lv2core#>. |
||||
@prefix doap: <http://usefulinc.com/ns/doap#>. |
||||
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>. |
||||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>. |
||||
@prefix ll: <http://ll-plugins.nongnu.org/lv2/namespace#>. |
||||
@prefix pg: <http://ll-plugins.nongnu.org/lv2/ext/portgroups#>. |
||||
@prefix ev: <http://lv2plug.in/ns/ext/event#>. |
||||
|
||||
<http://ll-plugins.nongnu.org/lv2/lv2pftci/beep/out> a pg:StereoGroup. |
||||
|
||||
<http://ll-plugins.nongnu.org/lv2/lv2pftci/beep> |
||||
a lv2:Plugin, lv2:InstrumentPlugin; |
||||
lv2:binary <beep.so>; |
||||
doap:name "Beep"; |
||||
doap:license <http://usefulinc.com/doap/licenses/gpl>; |
||||
ll:pegName "p"; |
||||
|
||||
lv2:port [ |
||||
a ev:EventPort, lv2:InputPort; |
||||
lv2:index 0; |
||||
ev:supportsEvent <http://lv2plug.in/ns/ext/midi#MidiEvent>; |
||||
lv2:symbol "midi"; |
||||
lv2:name "MIDI"; |
||||
], |
||||
|
||||
[ |
||||
a lv2:AudioPort, lv2:OutputPort; |
||||
lv2:index 1; |
||||
lv2:symbol "left"; |
||||
lv2:name "Left"; |
||||
pg:membership [ |
||||
pg:group <http://ll-plugins.nongnu.org/lv2/lv2pftci/beep/out>; |
||||
pg:role pg:leftChannel; |
||||
]; |
||||
], |
||||
|
||||
[ |
||||
a lv2:AudioPort, lv2:OutputPort; |
||||
lv2:index 2; |
||||
lv2:symbol "right"; |
||||
lv2:name "Right"; |
||||
pg:membership [ |
||||
pg:group <http://ll-plugins.nongnu.org/lv2/lv2pftci/beep/out>; |
||||
pg:role pg:rightChannel; |
||||
]; |
||||
]. |
@ -0,0 +1,5 @@ |
||||
@prefix lv2: <http://lv2plug.in/ns/lv2core#>. |
||||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>. |
||||
<http://ll-plugins.nongnu.org/lv2/lv2pftci/beep> |
||||
a lv2:Plugin; |
||||
rdfs:seeAlso <beep.ttl>. |
@ -0,0 +1,5 @@ |
||||
@prefix lv2: <http://lv2plug.in/ns/lv2core#>. |
||||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>. |
||||
<http://ll-plugins.nongnu.org/lv2/lv2pftci/beep> |
||||
a lv2:Plugin; |
||||
rdfs:seeAlso <beep.ttl>. |
Binary file not shown.
@ -1,27 +0,0 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<projectDescription> |
||||
<name>Source</name> |
||||
<comment></comment> |
||||
<projects> |
||||
</projects> |
||||
<buildSpec> |
||||
<buildCommand> |
||||
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name> |
||||
<triggers>clean,full,incremental,</triggers> |
||||
<arguments> |
||||
</arguments> |
||||
</buildCommand> |
||||
<buildCommand> |
||||
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name> |
||||
<triggers>full,incremental,</triggers> |
||||
<arguments> |
||||
</arguments> |
||||
</buildCommand> |
||||
</buildSpec> |
||||
<natures> |
||||
<nature>org.eclipse.cdt.core.cnature</nature> |
||||
<nature>org.eclipse.cdt.core.ccnature</nature> |
||||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature> |
||||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature> |
||||
</natures> |
||||
</projectDescription> |
Loading…
Reference in new issue