-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c607e3d
commit 522a1bb
Showing
7 changed files
with
328 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
/* | ||
code is Public Domain and written by Peter Semiletov, 2023 | ||
*/ | ||
|
||
#include "lv2/core/lv2.h" | ||
|
||
|
||
#include <cmath> | ||
#include <stdint.h> | ||
#include <stdlib.h> | ||
#include <iostream> | ||
|
||
#include "dsp.h" | ||
#include "fx-resofilter.h" | ||
|
||
#define METALLUGA_URI "https://github.com/psemiletov/charm" | ||
|
||
typedef enum { PORT_IN_LEFT = 0, PORT_IN_RIGHT = 1, PORT_OUT_LEFT = 2, PORT_OUT_RIGHT = 3, PORT_CHARM = 4} PortIndex; | ||
|
||
|
||
|
||
class CCharm | ||
{ | ||
public: | ||
|
||
int samplerate; | ||
|
||
|
||
const float* charm; | ||
|
||
const float* input_l; | ||
const float* input_r; | ||
|
||
float *output_l; | ||
float *output_r; | ||
|
||
//CCharm(); | ||
}; | ||
|
||
|
||
|
||
|
||
static void | ||
activate(LV2_Handle instance) | ||
{} | ||
|
||
|
||
static LV2_Handle | ||
instantiate(const LV2_Descriptor* descriptor, | ||
double rate, | ||
const char* bundle_path, | ||
const LV2_Feature* const* features) | ||
{ | ||
init_db(); | ||
CCharm *instance = new CCharm; | ||
instance->samplerate = rate; | ||
|
||
return (LV2_Handle)instance; | ||
} | ||
|
||
|
||
static void | ||
connect_port(LV2_Handle instance, uint32_t port, void* data) | ||
{ | ||
CCharm *inst = (CCharm*)instance; | ||
|
||
switch ((PortIndex)port) | ||
{ | ||
case PORT_IN_LEFT: | ||
inst->input_l = (const float*)data; | ||
break; | ||
|
||
case PORT_IN_RIGHT: | ||
inst->input_r = (const float*)data; | ||
break; | ||
|
||
case PORT_OUT_LEFT: | ||
inst->output_l = (float*)data; | ||
break; | ||
|
||
case PORT_OUT_RIGHT: | ||
inst->output_r = (float*)data; | ||
break; | ||
|
||
case PORT_CHARM: | ||
inst->charm = (const float*)data; | ||
break; | ||
|
||
|
||
} | ||
} | ||
|
||
|
||
static void | ||
run(LV2_Handle instance, uint32_t n_samples) | ||
{ | ||
CCharm *inst = (CCharm*)instance; | ||
|
||
//const float* const input = inst->input; | ||
//float* const output = inst->output; | ||
|
||
for (uint32_t pos = 0; pos < n_samples; pos++) | ||
{ | ||
float fl = inst->input_l[pos]; | ||
float fr = inst->input_r[pos]; | ||
|
||
fl = warmify (fl, *(inst->charm)); | ||
fr = warmify (fr, *(inst->charm)); | ||
|
||
inst->output_l[pos] = fl; | ||
inst->output_r[pos] = fr; | ||
} | ||
} | ||
|
||
|
||
static void deactivate (LV2_Handle instance) | ||
{ | ||
} | ||
|
||
|
||
static void cleanup(LV2_Handle instance) | ||
{ | ||
delete (CCharm*)instance; | ||
} | ||
|
||
|
||
static const void* extension_data (const char* uri) | ||
{ | ||
return NULL; | ||
} | ||
|
||
|
||
static const LV2_Descriptor descriptor = {METALLUGA_URI, | ||
instantiate, | ||
connect_port, | ||
activate, | ||
run, | ||
deactivate, | ||
cleanup, | ||
extension_data}; | ||
|
||
|
||
LV2_SYMBOL_EXPORT | ||
const LV2_Descriptor* lv2_descriptor (uint32_t index) | ||
{ | ||
return index == 0 ? &descriptor : NULL; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# The full description of the plugin is in this file, which is linked to from | ||
# `manifest.ttl`. This is done so the host only needs to scan the relatively | ||
# small `manifest.ttl` files to quickly discover all plugins. | ||
|
||
@prefix doap: <http://usefulinc.com/ns/doap#> . | ||
@prefix foaf: <http://xmlns.com/foaf/0.1/> . | ||
@prefix lv2: <http://lv2plug.in/ns/lv2core#> . | ||
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | ||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | ||
@prefix units: <http://lv2plug.in/ns/extensions/units#> . | ||
|
||
<https://github.com/psemiletov/charm> | ||
a lv2:Plugin , | ||
lv2:DistortionPlugin ; | ||
|
||
doap:shortdesc "Warm sound saturator" ; | ||
doap:programming-language "C++" ; | ||
doap:name "Charm", | ||
"Шарм"@ru , | ||
"Charme"@fr; | ||
|
||
doap:maintainer [ | ||
foaf:name "Bedroom Studio" ; | ||
foaf:homepage <https://github.com/psemiletov/bedroomstudio> ; | ||
foaf:mbox <[email protected]> | ||
] ; | ||
|
||
doap:license <https://creativecommons.org/publicdomain/mark/1.0/> ; | ||
|
||
lv2:optionalFeature lv2:hardRTCapable ; | ||
|
||
lv2:port [ | ||
a lv2:AudioPort , | ||
lv2:InputPort ; | ||
lv2:index 0 ; | ||
lv2:symbol "in_l" ; | ||
lv2:name "In_Left" | ||
] , | ||
|
||
[ | ||
a lv2:AudioPort , | ||
lv2:InputPort ; | ||
lv2:index 1 ; | ||
lv2:symbol "in_r" ; | ||
lv2:name "In_Right" | ||
] , | ||
|
||
[ | ||
a lv2:AudioPort , | ||
lv2:OutputPort ; | ||
lv2:index 2 ; | ||
lv2:symbol "out_l" ; | ||
lv2:name "Out_Left" | ||
], | ||
|
||
[ | ||
a lv2:AudioPort , | ||
lv2:OutputPort ; | ||
lv2:index 3 ; | ||
lv2:symbol "out_r" ; | ||
lv2:name "Out_Right" | ||
], | ||
|
||
[ | ||
a lv2:InputPort , | ||
lv2:ControlPort ; | ||
lv2:index 4 ; | ||
lv2:symbol "charm" ; | ||
lv2:name "Charm" , | ||
"Charme"@fr , | ||
"Шарм"@ru ; | ||
lv2:default 0.50 ; | ||
lv2:minimum 0.0 ; | ||
lv2:maximum 1.0 ; | ||
units:unit units:coef ; | ||
]. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
@prefix lv2: <http://lv2plug.in/ns/lv2core#> . | ||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | ||
|
||
<https://github.com/psemiletov/charm> a lv2:Plugin . | ||
|
||
<https://github.com/psemiletov/charm> lv2:binary <charm.so> . | ||
|
||
|
||
<https://github.com/psemiletov/charm> rdfs:seeAlso <charm.ttl> . | ||
|
||
|
||
|
||
<https://github.com/psemiletov/charm> | ||
a lv2:Plugin ; | ||
lv2:binary <charm.so> ; | ||
rdfs:seeAlso <charm.ttl> . |