Skip to content

Commit 4d84b8f

Browse files
committed
faust 2.79.3
1 parent b719fc4 commit 4d84b8f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+131384
-0
lines changed

external/faust/architecture/faust/au/AUUI.h

Lines changed: 404 additions & 0 deletions
Large diffs are not rendered by default.

external/faust/architecture/faust/audio/alsa-dsp.h

Lines changed: 693 additions & 0 deletions
Large diffs are not rendered by default.

external/faust/architecture/faust/audio/android-dsp.h

Lines changed: 583 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
/************************** BEGIN audio.h *****************************
2+
FAUST Architecture File
3+
Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
4+
---------------------------------------------------------------------
5+
This program is free software; you can redistribute it and/or modify
6+
it under the terms of the GNU Lesser General Public License as published by
7+
the Free Software Foundation; either version 2.1 of the License, or
8+
(at your option) any later version.
9+
10+
This program is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
GNU Lesser General Public License for more details.
14+
15+
You should have received a copy of the GNU Lesser General Public License
16+
along with this program; if not, write to the Free Software
17+
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18+
19+
EXCEPTION : As a special exception, you may create a larger work
20+
that contains this FAUST architecture section and distribute
21+
that work under terms of your choice, so long as this FAUST
22+
architecture section is not modified.
23+
***********************************************************************/
24+
25+
#ifndef __audio__
26+
#define __audio__
27+
28+
#include <set>
29+
#include <utility>
30+
31+
class dsp;
32+
33+
typedef void (* shutdown_callback)(const char* message, void* arg);
34+
35+
typedef void (* compute_callback)(void* arg);
36+
37+
class audio {
38+
39+
protected:
40+
41+
shutdown_callback fShutdown; // Shutdown callback
42+
void* fShutdownArg; // Shutdown callback data
43+
44+
std::set<std::pair<compute_callback, void*> > fComputeCallbackList;
45+
46+
public:
47+
48+
audio():fShutdown(nullptr), fShutdownArg(nullptr) {}
49+
virtual ~audio() {}
50+
51+
/**
52+
* Init the DSP.
53+
* @param name - the DSP name to be given to the audio driven
54+
* (could appear as a JACK client for instance)
55+
* @param dsp - the dsp that will be initialized with the driver sample rate
56+
*
57+
* @return true is sucessful, false in case of driver failure.
58+
**/
59+
virtual bool init(const char* name, ::dsp* dsp) = 0;
60+
61+
/**
62+
* Start audio processing.
63+
* @return true is sucessful, false if case of driver failure.
64+
**/
65+
virtual bool start() = 0;
66+
67+
/**
68+
* Stop audio processing.
69+
**/
70+
virtual void stop() = 0;
71+
72+
void setShutdownCallback(shutdown_callback cb, void* arg)
73+
{
74+
fShutdown = cb;
75+
fShutdownArg = arg;
76+
}
77+
78+
void addControlCallback(compute_callback cb, void* arg)
79+
{
80+
fComputeCallbackList.insert(std::make_pair(cb, arg));
81+
}
82+
83+
bool removeControlCallback(compute_callback cb, void* arg)
84+
{
85+
return (fComputeCallbackList.erase(std::make_pair(cb, arg)) == 1);
86+
}
87+
88+
void runControlCallbacks()
89+
{
90+
for (const auto& it : fComputeCallbackList) {
91+
it.first(it.second);
92+
}
93+
}
94+
95+
// Return buffer size in frames.
96+
virtual int getBufferSize() = 0;
97+
98+
// Return the driver sample rate in Hz.
99+
virtual int getSampleRate() = 0;
100+
101+
// Return the driver hardware inputs number.
102+
virtual int getNumInputs() = 0;
103+
104+
// Return the driver hardware outputs number.
105+
virtual int getNumOutputs() = 0;
106+
107+
/**
108+
* @return Returns the average proportion of available CPU
109+
* being spent inside the audio callbacks (between 0.0 and 1.0).
110+
**/
111+
virtual float getCPULoad() { return 0.f; }
112+
};
113+
114+
#endif
115+
/************************** END audio.h **************************/
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
/************************** BEGIN channels.h **************************
2+
FAUST Architecture File
3+
Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
4+
---------------------------------------------------------------------
5+
This program is free software; you can redistribute it and/or modify
6+
it under the terms of the GNU Lesser General Public License as published by
7+
the Free Software Foundation; either version 2.1 of the License, or
8+
(at your option) any later version.
9+
10+
This program is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
GNU Lesser General Public License for more details.
14+
15+
You should have received a copy of the GNU Lesser General Public License
16+
along with this program; if not, write to the Free Software
17+
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18+
19+
EXCEPTION : As a special exception, you may create a larger work
20+
that contains this FAUST architecture section and distribute
21+
that work under terms of your choice, so long as this FAUST
22+
architecture section is not modified.
23+
************************************************************************/
24+
25+
#ifndef __audio_channels__
26+
#define __audio_channels__
27+
28+
#include <string.h>
29+
#include <assert.h>
30+
31+
#ifndef FAUSTFLOAT
32+
#define FAUSTFLOAT float
33+
#endif
34+
35+
template <class REAL>
36+
class real_channels
37+
{
38+
private:
39+
40+
int fNumFrames;
41+
int fNumChannels;
42+
REAL** fBuffers;
43+
REAL** fSliceBuffers;
44+
45+
public:
46+
47+
real_channels(int nframes, int nchannels)
48+
{
49+
fBuffers = new REAL*[nchannels];
50+
fSliceBuffers = new REAL*[nchannels];
51+
fNumFrames = nframes;
52+
fNumChannels = nchannels;
53+
54+
// allocate audio channels
55+
for (int chan = 0; chan < fNumChannels; chan++) {
56+
fBuffers[chan] = new FAUSTFLOAT[fNumFrames];
57+
}
58+
59+
zero();
60+
}
61+
62+
void zero()
63+
{
64+
// clear audio channels
65+
for (int chan = 0; chan < fNumChannels; chan++) {
66+
memset(fBuffers[chan], 0, sizeof(REAL) * fNumFrames);
67+
}
68+
}
69+
70+
void impulse()
71+
{
72+
// set first sample to 1 for all channels
73+
for (int chan = 0; chan < fNumChannels; chan++) {
74+
fBuffers[chan][0] = FAUSTFLOAT(1.0);
75+
for (int frame = 1; frame < fNumFrames; frame++) {
76+
fBuffers[chan][frame] = REAL(0.0);
77+
}
78+
}
79+
}
80+
81+
void display()
82+
{
83+
for (int chan = 0; chan < fNumChannels; chan++) {
84+
for (int frame = 0; frame < fNumFrames; frame++) {
85+
std::cout << "chan = " << chan << " frame = " << frame << " value = " << fBuffers[chan][frame] << std::endl;
86+
}
87+
}
88+
}
89+
90+
virtual ~real_channels()
91+
{
92+
// free separate input channels
93+
for (int chan = 0; chan < fNumChannels; chan++) {
94+
delete [] fBuffers[chan];
95+
}
96+
delete [] fBuffers;
97+
delete [] fSliceBuffers;
98+
}
99+
100+
REAL** buffers() { return fBuffers; }
101+
102+
REAL** buffers(int index)
103+
{
104+
assert(index < fNumFrames);
105+
for (int chan = 0; chan < fNumChannels; chan++) {
106+
fSliceBuffers[chan] = &fBuffers[chan][index];
107+
}
108+
return fSliceBuffers;
109+
}
110+
111+
};
112+
113+
class channels : public real_channels<FAUSTFLOAT> {
114+
115+
public:
116+
117+
channels(int nframes, int nchannels):real_channels<FAUSTFLOAT>(nframes, nchannels) {}
118+
};
119+
120+
#endif
121+
122+
/************************** END channels.h **************************/

0 commit comments

Comments
 (0)