-
Notifications
You must be signed in to change notification settings - Fork 63
/
platform.lib
64 lines (55 loc) · 3.43 KB
/
platform.lib
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//#################################### platform.lib ########################################
// A library to handle platform specific code in Faust. Its official prefix is `pl`.
//
// #### References
// * <https://github.com/grame-cncm/faustlibraries/blob/master/platform.lib>
//########################################################################################
// It can be reimplemented to globally change the SR and the tablesize definitions
/************************************************************************
************************************************************************
FAUST library file
Copyright (C) 2020 GRAME, Centre National de Creation Musicale
----------------------------------------------------------------------
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
EXCEPTION TO THE LGPL LICENSE : As a special exception, you may create a
larger FAUST program which directly or indirectly imports this library
file and still distribute the compiled code generated by the FAUST
compiler, or a modified version of this compiled code, under your own
copyright and license. This EXCEPTION TO THE LGPL LICENSE explicitly
grants you the right to freely choose the license for the resulting
compiled code. In particular the resulting compiled code has no obligation
to be LGPL or GPL. For example you are free to choose a commercial or
closed source license or any other license if you decide so.
************************************************************************
************************************************************************/
declare name "Generic Platform Library";
declare version "1.3.0";
//---------------------------------`(pl.)SR`-----------------------------------
// Current sampling rate (between 1 and 192000Hz). Constant during
// program execution. Setting this value to a constant will allow the
// compiler to optimize the code by computing constant expressions at
// compile time, and can be valuable for performance, especially on
// embedded systems.
//-----------------------------------------------------------------------------
SR = min(192000.0, max(1.0, fconstant(int fSamplingFreq, <math.h>)));
//---------------------------------`(pl.)BS`---------------------------------------
// Current block-size (between 1 and 16384 frames). Can change during the execution.
//-----------------------------------------------------------------------------
BS = min(16384.0, max(1.0, fvariable(int count, <math.h>)));
//---------------------------------`(pl.)tablesize`----------------------------
// Oscillator table size. This value is used to define the size of the
// table used by the oscillators. It is usually a power of 2 and can be lowered
// to save memory. The default value is 65536.
//-----------------------------------------------------------------------------
tablesize = 1 << 16;