@grame/faustwasm 0.13.4 → 0.13.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grame/faustwasm",
3
- "version": "0.13.4",
3
+ "version": "0.13.5",
4
4
  "description": "WebAssembly version of Faust Compiler",
5
5
  "main": "dist/cjs/index.js",
6
6
  "types": "dist/esm/index.d.ts",
package/sound.cpp DELETED
@@ -1,163 +0,0 @@
1
- /* ------------------------------------------------------------
2
- name: "sound"
3
- Code generated with Faust 2.82.1 (https://faust.grame.fr)
4
- Compilation options: -lang cpp -ct 1 -es 1 -mcd 16 -mdd 1024 -mdy 33 -single -ftz 0
5
- ------------------------------------------------------------ */
6
-
7
- #ifndef __mydsp_H__
8
- #define __mydsp_H__
9
-
10
- #ifndef FAUSTFLOAT
11
- #define FAUSTFLOAT float
12
- #endif
13
-
14
- #include <algorithm>
15
- #include <cmath>
16
- #include <cstdint>
17
- #include <math.h>
18
-
19
- #ifndef FAUSTCLASS
20
- #define FAUSTCLASS mydsp
21
- #endif
22
-
23
- #ifdef __APPLE__
24
- #define exp10f __exp10f
25
- #define exp10 __exp10
26
- #endif
27
-
28
- #if defined(_WIN32)
29
- #define RESTRICT __restrict
30
- #else
31
- #define RESTRICT __restrict__
32
- #endif
33
-
34
-
35
- class mydsp : public dsp {
36
-
37
- private:
38
-
39
- Soundfile* fSoundfile0;
40
- int fSampleRate;
41
- float fConst0;
42
- int iVec0[2];
43
- float fRec0[2];
44
- float fRec1[2];
45
-
46
- void allocate() {
47
- fSoundfile0 = 0;
48
- }
49
-
50
- public:
51
- mydsp() {
52
- allocate();
53
- }
54
-
55
- void metadata(Meta* m) {
56
- m->declare("compile_options", "-lang cpp -ct 1 -es 1 -mcd 16 -mdd 1024 -mdy 33 -single -ftz 0");
57
- m->declare("filename", "sound.dsp");
58
- m->declare("interpolators.lib/name", "Faust Interpolator Library");
59
- m->declare("interpolators.lib/version", "1.4.0");
60
- m->declare("maths.lib/author", "GRAME");
61
- m->declare("maths.lib/copyright", "GRAME");
62
- m->declare("maths.lib/license", "LGPL with exception");
63
- m->declare("maths.lib/name", "Faust Math Library");
64
- m->declare("maths.lib/version", "2.9.0");
65
- m->declare("name", "sound");
66
- m->declare("platform.lib/name", "Generic Platform Library");
67
- m->declare("platform.lib/version", "1.3.0");
68
- m->declare("signals.lib/name", "Faust Signal Routing Library");
69
- m->declare("signals.lib/version", "1.6.0");
70
- m->declare("soundfiles.lib/name", "Faust Soundfile Library");
71
- m->declare("soundfiles.lib/version", "1.7.0");
72
- }
73
-
74
- virtual int getNumInputs() {
75
- return 0;
76
- }
77
- virtual int getNumOutputs() {
78
- return 1;
79
- }
80
-
81
- static void classInit(int sample_rate) {
82
- }
83
-
84
- virtual void instanceConstants(int sample_rate) {
85
- fSampleRate = sample_rate;
86
- fConst0 = 1.0f / std::min<float>(1.92e+05f, std::max<float>(1.0f, static_cast<float>(fSampleRate)));
87
- }
88
-
89
- virtual void instanceResetUserInterface() {
90
- if (reinterpret_cast<uintptr_t>(fSoundfile0) == 0) {
91
- fSoundfile0 = defaultsound;
92
- }
93
- }
94
-
95
- virtual void instanceClear() {
96
- for (int l0 = 0; l0 < 2; l0 = l0 + 1) {
97
- iVec0[l0] = 0;
98
- }
99
- for (int l1 = 0; l1 < 2; l1 = l1 + 1) {
100
- fRec0[l1] = 0.0f;
101
- }
102
- for (int l2 = 0; l2 < 2; l2 = l2 + 1) {
103
- fRec1[l2] = 0.0f;
104
- }
105
- }
106
-
107
- virtual void init(int sample_rate) {
108
- classInit(sample_rate);
109
- instanceInit(sample_rate);
110
- }
111
-
112
- virtual void instanceInit(int sample_rate) {
113
- instanceConstants(sample_rate);
114
- instanceResetUserInterface();
115
- instanceClear();
116
- }
117
-
118
- virtual mydsp* clone() {
119
- return new mydsp();
120
- }
121
-
122
- virtual int getSampleRate() {
123
- return fSampleRate;
124
- }
125
-
126
- virtual void buildUserInterface(UI* ui_interface) {
127
- ui_interface->openVerticalBox("sound");
128
- ui_interface->addSoundfile("sound", "{'toto'}", &fSoundfile0);
129
- ui_interface->closeBox();
130
- }
131
-
132
- virtual void compute(int count, FAUSTFLOAT** RESTRICT inputs, FAUSTFLOAT** RESTRICT outputs) {
133
- FAUSTFLOAT* output0 = outputs[0];
134
- Soundfile* fSoundfile0ca = fSoundfile0;
135
- int* fSoundfile0ca_ra0 = fSoundfile0ca->fSR;
136
- float fSlow0 = fConst0 * static_cast<float>(fSoundfile0ca_ra0[0]);
137
- float fSlow1 = std::floor(fSlow0);
138
- float fSlow2 = static_cast<float>(static_cast<int>(fSlow0));
139
- int* fSoundfile0ca_le0 = fSoundfile0ca->fLength;
140
- int iSlow3 = fSoundfile0ca_le0[0];
141
- float fSlow4 = static_cast<float>(iSlow3);
142
- float fSlow5 = static_cast<float>(iSlow3 + -1);
143
- int* fSoundfile0ca_of0 = fSoundfile0ca->fOffset;
144
- float** fSoundfile0ca_bu0 = static_cast<float**>(fSoundfile0ca->fBuffers);
145
- float* fSoundfile0ca_bu_ch0 = fSoundfile0ca_bu0[0];
146
- for (int i0 = 0; i0 < count; i0 = i0 + 1) {
147
- iVec0[0] = 1;
148
- float fTemp0 = fSlow0 + (fRec0[1] - fSlow1);
149
- int iRec2 = 1;
150
- float fTemp1 = static_cast<float>((1 <= iVec0[1]) * iRec2);
151
- fRec0[0] = (fSlow0 + (fRec0[1] - std::floor(fTemp0) - fSlow1)) * fTemp1;
152
- fRec1[0] = fTemp1 * std::fmod(fSlow2 + fRec1[1] + static_cast<float>(static_cast<int>(fTemp0)), fSlow4);
153
- output0[i0] = static_cast<FAUSTFLOAT>(fSoundfile0ca_bu_ch0[fSoundfile0ca_of0[0] + static_cast<int>(std::max<float>(0.0f, std::min<float>(fRec1[0], fSlow5)))]);
154
- iVec0[1] = iVec0[0];
155
- fRec0[1] = fRec0[0];
156
- fRec1[1] = fRec1[0];
157
- }
158
- fSoundfile0 = fSoundfile0ca;
159
- }
160
-
161
- };
162
-
163
- #endif
package/sound.dsp DELETED
@@ -1,4 +0,0 @@
1
- import("stdfaust.lib");
2
- import("soundfiles.lib");
3
- s = soundfile("sound [url:{'toto'}]", 1);
4
- process = so.sound(s, 0).loop;
package/sound.json DELETED
@@ -1 +0,0 @@
1
- {"name": "sound","filename": "sound.dsp","version": "2.82.1","compile_options": "-lang wasm -ct 1 -es 1 -mcd 16 -mdd 1024 -mdy 33 -single -ftz 0","library_list": ["/usr/local/share/faust/soundfiles.lib","/usr/local/share/faust/stdfaust.lib","/usr/local/share/faust/interpolators.lib","/usr/local/share/faust/signals.lib","/usr/local/share/faust/maths.lib","/usr/local/share/faust/platform.lib"],"include_pathnames": ["/usr/local/share/faust","/usr/local/share/faust","/usr/share/faust",".","/Users/letz/Developpements/faust-wasm/faustwasm"],"size": 36,"code": "aW1wb3J0KCJzdGRmYXVzdC5saWIiKTsKaW1wb3J0KCJzb3VuZGZpbGVzLmxpYiIpOwpzID0gc291bmRmaWxlKCJzb3VuZCBbdXJsOnsndG90byd9XSIsIDEpOwpwcm9jZXNzID0gc28uc291bmQocywgMCkubG9vcDsK","inputs": 0,"outputs": 1,"meta": [ { "compile_options": "-lang wasm -ct 1 -es 1 -mcd 16 -mdd 1024 -mdy 33 -single -ftz 0" },{ "filename": "sound.dsp" },{ "interpolators.lib/name": "Faust Interpolator Library" },{ "interpolators.lib/version": "1.4.0" },{ "maths.lib/author": "GRAME" },{ "maths.lib/copyright": "GRAME" },{ "maths.lib/license": "LGPL with exception" },{ "maths.lib/name": "Faust Math Library" },{ "maths.lib/version": "2.9.0" },{ "name": "sound" },{ "platform.lib/name": "Generic Platform Library" },{ "platform.lib/version": "1.3.0" },{ "signals.lib/name": "Faust Signal Routing Library" },{ "signals.lib/version": "1.6.0" },{ "soundfiles.lib/name": "Faust Soundfile Library" },{ "soundfiles.lib/version": "1.7.0" }],"ui": [ {"type": "vgroup","label": "sound","items": [ {"type": "soundfile","label": "sound","varname": "fSoundfile0","shortname": "sound","url": "{-toto-}","address": "/sound/sound","index": 0}]}]}
package/sound.wasm DELETED
Binary file