Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
171 changes: 171 additions & 0 deletions architecture/minimal.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
/************************************************************************
IMPORTANT NOTE : this file contains two clearly delimited sections :
the ARCHITECTURE section (in two parts) and the USER section. Each section
is governed by its own copyright and license. Please check individually
each section for license and copyright information.
*************************************************************************/

/*******************BEGIN ARCHITECTURE SECTION (part 1/2)****************/

/************************************************************************
FAUST Architecture File
Copyright (C) 2003-2019 GRAME, Centre National de Creation Musicale
---------------------------------------------------------------------
This Architecture section is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 3 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 General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; If not, see <http://www.gnu.org/licenses/>.

EXCEPTION : As a special exception, you may create a larger work
that contains this FAUST architecture section and distribute
that work under terms of your choice, so long as this FAUST
architecture section is not modified.

************************************************************************
************************************************************************/

// faust -a minimal.d -lang dlang noise.dsp -o noise.d

/******************************************************************************
*******************************************************************************

VECTOR INTRINSICS

*******************************************************************************
*******************************************************************************/

<<includeIntrinsic>>

/********************END ARCHITECTURE SECTION (part 1/2)****************/

/**************************BEGIN USER SECTION **************************/

<<includeclass>>

/***************************END USER SECTION ***************************/

/*******************BEGIN ARCHITECTURE SECTION (part 2/2)***************/
import std.stdio;
import std.conv;
import dplug.core.vec;

class Meta {
nothrow:
@nogc:
void declare(string name, string value) {}
}

class UI {
nothrow:
@nogc:
void declare(string id, string key, string value) {}
void declare(int id, string key, string value) {}
void declare(float* id, string key, string value) {}

// -- layout groups

void openTabBox(string label) {}
void openHorizontalBox(string label) {}
void openVerticalBox(string label) {}
void closeBox() {}

// -- active widgets

void addButton(string label, float* val) {}
void addCheckButton(string label, float* val) {}
void addVerticalSlider(string label, float* val, float init, float min, float max, float step) {}
void addHorizontalSlider(string label, float* val, float init, float min, float max, float step) {}
void addNumEntry(string label, float* val, float init, float min, float max, float step) {}

// -- passive display widgets

void addHorizontalBargraph(string label, float* val, float min, float max) {}
void addVerticalBargraph(string label, float* val, float min, float max) {}

}

/**
* Implements and overrides the methods that would provide parameters for use in
* a plug-in or GUI. These parameters are stored in a vector which can be accesed via
* `readParams()`
*/
class FaustParamAccess : UI {
nothrow:
@nogc:
this()
{
_faustParams = makeVec!FaustParam();
}

override void addButton(string label, float* val)
{
_faustParams.pushBack(FaustParam(label, val, 0, 0, 0, 0, true));
}

override void addCheckButton(string label, float* val)
{
_faustParams.pushBack(FaustParam(label, val, 0, 0, 0, 0, true));
}

override void addVerticalSlider(string label, float* val, float init, float min, float max, float step)
{
_faustParams.pushBack(FaustParam(label, val, init, min, max, step));
}

override void addHorizontalSlider(string label, float* val, float init, float min, float max, float step)
{
_faustParams.pushBack(FaustParam(label, val, init, min, max, step));
}

override void addNumEntry(string label, float* val, float init, float min, float max, float step)
{
_faustParams.pushBack(FaustParam(label, val, init, min, max, step));
}

FaustParam[] readParams()
{
return _faustParams.releaseData();
}

FaustParam readParam(int index)
{
return _faustParams[index];
}

ulong length()
{
return _faustParams.length();
}

private:
Vec!FaustParam _faustParams;
}

struct FaustParam
{
string label;
float* val;
float initial;
float min;
float max;
float step;
bool isButton = false;
}

class dsp {
nothrow:
@nogc:
public:
int fSamplingFreq;
}

/********************END ARCHITECTURE SECTION (part 2/2)****************/

2 changes: 2 additions & 0 deletions build/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ set (FAUST_INC ${SRCDIR}
${SRCDIR}/generator/interpreter
${SRCDIR}/generator/rust
${SRCDIR}/generator/soul
${SRCDIR}/generator/dlang
${SRCDIR}/normalize ${SRCDIR}/parallelize ${SRCDIR}/parser
${SRCDIR}/patternmatcher ${SRCDIR}/propagate ${SRCDIR}/signals
${SRCDIR}/tlib ${SRCDIR}/transform ${SRCDIR}/utils
Expand Down Expand Up @@ -366,6 +367,7 @@ file (GLOB FAUSTDPSEMB ${ROOT}/libraries/embedded/*.lib)
file (GLOB FAUSTARCHS ${ARCHDIR}/*.cpp ${ARCHDIR}/*.c
${ARCHDIR}/*.rs ${ARCHDIR}/*.js
${ARCHDIR}/*.java ${ARCHDIR}/*.h
${ARCHDIR}/*.d ${ARCHDIR}/*.d
${ARCHDIR}/mathdoctexts-*.txt ${ARCHDIR}/latexheader.tex)
install (
FILES ${FAUSTDSPLIBS} ${FAUSTARCHS} ${ROOT}/tools/faust2appls/Info.plist DESTINATION ${CMAKE_INSTALL_PREFIX}/share/faust
Expand Down
2 changes: 1 addition & 1 deletion build/backends/all.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ set ( OLDCPP_BACKEND COMPILER STATIC DYNAMIC CACHE STRING "Include old C
set ( RUST_BACKEND COMPILER STATIC DYNAMIC CACHE STRING "Include RUST backend" FORCE )
set ( SOUL_BACKEND COMPILER STATIC DYNAMIC CACHE STRING "Include SOUL backend" FORCE )
set ( WASM_BACKEND COMPILER STATIC DYNAMIC WASM CACHE STRING "Include WASM backend" FORCE )

set ( DLANG_BACKEND COMPILER STATIC DYNAMIC CACHE STRING "Include DLANG backend" FORCE )
2 changes: 1 addition & 1 deletion build/backends/backends.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ set ( LLVM_BACKEND STATIC DYNAMIC CACHE STRING "Include LLVM
set ( OLDCPP_BACKEND COMPILER STATIC DYNAMIC CACHE STRING "Include old CPP backend" FORCE )
set ( RUST_BACKEND COMPILER STATIC DYNAMIC CACHE STRING "Include RUST backend" FORCE )
set ( WASM_BACKEND COMPILER STATIC DYNAMIC WASM CACHE STRING "Include WASM backend" FORCE )

set ( DLANG_BACKEND COMPILER STATIC DYNAMIC CACHE STRING "Include DLANG backend" FORCE )
2 changes: 1 addition & 1 deletion build/backends/interp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ set ( OLDCPP_BACKEND OFF CACHE STRING "Include old CPP backend" FORCE )
set ( RUST_BACKEND OFF CACHE STRING "Include RUST backend" FORCE )
set ( SOUL_BACKEND OFF CACHE STRING "Include SOUL backend" FORCE )
set ( WASM_BACKEND OFF CACHE STRING "Include WASM backend" FORCE )

set ( DLANG_BACKEND COMPILER STATIC DYNAMIC CACHE STRING "Include DLANG backend" FORCE )
2 changes: 1 addition & 1 deletion build/backends/most.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ set ( OLDCPP_BACKEND COMPILER STATIC DYNAMIC CACHE STRING "Include old C
set ( RUST_BACKEND COMPILER STATIC DYNAMIC CACHE STRING "Include RUST backend" FORCE )
set ( SOUL_BACKEND COMPILER STATIC DYNAMIC CACHE STRING "Include SOUL backend" FORCE )
set ( WASM_BACKEND COMPILER STATIC DYNAMIC WASM CACHE STRING "Include WASM backend" FORCE )

set ( DLANG_BACKEND COMPILER STATIC DYNAMIC CACHE STRING "Include DLANG backend" FORCE )
2 changes: 1 addition & 1 deletion build/backends/regular.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ set ( OLDCPP_BACKEND COMPILER STATIC DYNAMIC CACHE STRING "Include old CPP back
set ( RUST_BACKEND COMPILER STATIC DYNAMIC CACHE STRING "Include RUST backend" FORCE )
set ( SOUL_BACKEND COMPILER STATIC DYNAMIC CACHE STRING "Include SOUL backend" FORCE )
set ( WASM_BACKEND WASM COMPILER STATIC DYNAMIC CACHE STRING "Include WASM backend" FORCE )

set ( DLANG_BACKEND COMPILER STATIC DYNAMIC CACHE STRING "Include DLANG backend" FORCE )
1 change: 1 addition & 0 deletions build/faustgen/setup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ set ( LLVM_BACKEND COMPILER STATIC CACHE STRING "Include LLVM backend" F
set ( OLDCPP_BACKEND OFF CACHE STRING "Include old CPP backend" FORCE )
set ( RUST_BACKEND OFF CACHE STRING "Include RUST backend" FORCE )
set ( WASM_BACKEND OFF WASM CACHE STRING "Include WASM backend" FORCE )
set ( DLANG_BACKEND OFF CACHE STRING "Include DLANG backend" FORCE )

set ( INCLUDE_EXECUTABLE ON CACHE STRING "Include faust compiler" FORCE )
set ( INCLUDE_STATIC ON CACHE STRING "Include static faust library" FORCE )
Expand Down
4 changes: 4 additions & 0 deletions build/misc/llvm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ function (scan_backends TARGET FLAG)
if (${POS} GREATER -1)
backend (WASM wasm ${TARGET})
endif()
string (FIND "${DLANG_BACKEND}" ${FLAG} POS)
if (${POS} GREATER -1)
backend (DLANG dlang ${TARGET})
endif()
string (FIND "${LLVM_BACKEND}" ${FLAG} POS)
if (${POS} GREATER -1)
backend (LLVM llvm ${TARGET})
Expand Down
Loading