Commit 19aca938 authored by thomas's avatar thomas
Browse files

no message


git-svn-id: https://svn.grrrr.org/ext/trunk@208 4d9ac71a-51e6-0310-8455-cad1006bcd31
parent af934746
No preview for this file type
......@@ -26,8 +26,8 @@ PPCCPlusOptions = {Includes} {Sym-PPC} {Defines} {Flags} {WarnOff}
### Source Files ###
Headers = flstdc.h flbase.h fldefs.h flext.h flmspbuffer.h
SrcFiles = flbase.cpp flbuf.cpp flext.cpp fllib.cpp fldsp.cpp
Headers = flstdc.h flbase.h fldefs.h flext.h flclass.h fldsp.h flthr.h flmspbuffer.h flinternal.h
SrcFiles = flbase.cpp flbuf.cpp flext.cpp fllib.cpp fldsp.cpp flatom.cpp flsetup.cpp flthr.cpp flutil.cpp flxlet.cpp
### Object Files ###
......@@ -36,7 +36,12 @@ ObjFiles-PPC =
"{ObjDir}flbuf.cpp.x"
"{ObjDir}flext.cpp.x"
"{ObjDir}fllib.cpp.x"
"{ObjDir}fldsp.cpp.x"
"{ObjDir}fldsp.cpp.x"
"{ObjDir}flatom.cpp.x"
"{ObjDir}flsetup.cpp.x"
"{ObjDir}flthr.cpp.x"
"{ObjDir}flutil.cpp.x"
"{ObjDir}flxlet.cpp.x"
### Libraries ###
......
......@@ -18,6 +18,11 @@ Package files:
- flstdc.h: Basic definitions in classic C - some common vocabulary for the different platforms
- flbase.h,flbase.cpp: GEM-like C++ interface
- flclass.h,flext.cpp: actual base classes for message (flext_base) and dsp (flext_dsp) processing
- fldsp.h,fldsp.cpp: code for signal externals
- flthr.h,flthr.cpp: code for threaded methods
- flatom.cpp: code fpr functions dealing with lists of atoms
- flutil.cpp: additional utility functions
- flxlet.cpp: code for variable inlet/outlet stuff
- flinternals.h: internal definitions for flext library
- flbuf.cpp: buffer object handling for base classes
- fllib.cpp: code for handling external libraries in MaxMSP
......@@ -39,6 +44,8 @@ o Borland C++ 5.5 (free): edit & run "make -f makefile.bcc"
o Microsoft Visual C++ 6: use the "flext.dsp" project file
> you have to edit the pd path in the project properties/C-C++/preprocessor tab!
o Cygwin: edit & run "make -f makefile.cygwin" and "make -f makefile.cygwin install"
pd - linux:
-----------
o GCC: edit & run "make -f makefile.pd-linux" and as root "make -f makefile.pd-linux install"
......@@ -58,6 +65,7 @@ pros:
- faster development, more robust coding
- sharing of common methods and data by using base classes
- any input to any inlet (with the exception of signal streams)
- transparent use of threads for methods
- libraries of externals in MaxMSP
cons:
......@@ -72,6 +80,8 @@ see flext.h for the documented base classes
Version history:
0.3.0:
- added CYGWIN support
- added threaded methods along with a message queue for ToOut* functions (very unstable for MaxMSP!)
to use threads compile flext with FLEXT_THREADS definition
- check/update function for buffer change (resize etc.)
......
......@@ -20,7 +20,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
//! flext version number
#define FLEXT_VERSION 300
//! flext version string
#define FLEXT_VERSTR "0.3.0pre"
#define FLEXT_VERSTR "0.3.0"
// include all the flext interface definitions
#include <fldefs.h>
......
// pan~ - a flext tutorial external written by Frank Barknecht
//
// This is a commented port of the pan~ example from the PD-Externals-Howto to
// illustrate the usage of flext. You can get the original code at
// http://iem.kug.ac.at/pd/externals-HOWTO/
#include <flext.h>
#include <math.h>
#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 202)
#error You need at least flext version 0.2.2
#endif
// A flext dsp external ("tilde object") inherits from the class flext_dsp
class pan:
public flext_dsp
{
// Each external that is written in C++ needs to use #defines
// from flbase.h
//
// The define
//
// FLEXT_HEADER(NEW_CLASS, PARENT_CLASS)
//
// should be somewhere in your dsp file.
// A good place is here:
FLEXT_HEADER(pan, flext_dsp)
public:
pan()
{
// The constructor of your class is responsible for
// setting up inlets and outlets and for registering
// inlet-methods:
AddInSignal(2); // 2 audio ins
AddInFloat(); // 1 float in
AddOutSignal(); // 1 audio out [ == AddOutSignal(1) ]
SetupInOut(); // set up inlets and outlets.
// Must be called once!
// Now we need to bind the handler function to our
// panning inlet, which is inlet 2 (counting all inlets
// from 0). We want the function "setPan" to get
// called on incoming float messages:
FLEXT_ADDMETHOD(2,setPan);
// We're done constructing:
post("-- pan~ with flext ---");
} // end of constructor
protected:
// here we declare the virtual DSP function
virtual void m_signal(int n, float *const *in, float *const *out);
private:
float f_pan; // holds our panning factor
// Before we can use "setPan" as a handler, we must register this
// function as a callback to PD or Max. This is done using the
// FLEXT_CALLBACK* macros. There are several of them.
//
// FLEXT_CALLBACK_F is a shortcut, that registers a function
// expecting one float arg (thus ending in "_F"). There are
// other shortcuts that register other types of functions. Look
// into flext.h. No semicolon at the end of line!!!
FLEXT_CALLBACK_F(setPan)
// Now setPan can get declared and defined here.
void setPan(float f)
{
// set our private panning factor "f_pan" to the inlet
// value float "f" in the intervall [0,1]
f_pan = (f<0) ? 0.0 : (f>1) ? 1.0 : f ;
// if you want to debug if this worked, comment out the
// following line:
//post("Set panning to %.2f, maybe clipped from %.2f", f_pan,f);
} // end setPan
}; // end of class deklaration for pan
// Before we can run our pan-class in PD, the object has to be registered as a
// PD object. Otherwise it would be a simple C++-class, and what good would
// that be for? Registering is made easy with the FLEXT_NEW_* macros defined
// in flext.h. For tilde objects without argguments call:
FLEXT_NEW_TILDE("pan~", pan)
// Now we define our DSP function. It gets this arguments:
//
// int n: length of signal vector. Loop over this for your signal processing.
// float *const *in, float *const *out:
// These are arrays of the signals in the objects signal inlets rsp.
// oulets. We come to that later inside the function.
void pan::m_signal(int n, float *const *in, float *const *out)
{
const float *ins1 = in[0];
const float *ins2 = in[1];
// As said above "in" holds a list of the signal vectors in all inlets.
// After these two lines, ins1 holds the signal vector ofthe first
// inlet, index 0, and ins2 holds the signal vector of the second
// inlet, with index 1.
float *outs = out[0];
// Now outs holds the signal vector at the one signal outlet we have.
// We are now ready for the main signal loop
while (n--)
{
// The "++" after the pointers outs, ins1 and ins2 walks us
// through the signal vector with each n, of course. Before
// each step we change the signal value in the outlet *outs
// according to our panning factor "f_pan" and according to the
// signals at the two signal inlets, *ins1 and *ins2
*outs++ = (*ins1++) * (1-f_pan) + (*ins2++) * f_pan;
}
} // end m_signal
# pan~ - tutorial example (by Frank Barknecht)
#
# Makefile for gcc
#
# usage: make -f makefile.pd-cygwin
#
# ---------------------------------------------
NAME=pan~
# where to build
TARGDIR=./pd-cygwin
# where to install ### EDIT! ###
INSTDIR=c:/programme/audio/pd/extra
# flext stuff ### EDIT! ###
FLEXTPATH=../..
FLEXTLIB=$(FLEXTPATH)/pd-cygwin/flext.lib
# compiler+linker stuff ### EDIT! ###
INCLUDES=c:/programme/audio/pd/src
LIBPATH=c:/programme/audio/pd/bin
FLAGS=-DPD
CFLAGS=-O6 -mpentium
LIBS=m pd
# the rest can stay untouched
# ----------------------------------------------
# all the source files from the package
SRCS=main.cpp
HDRS=
TARGET=$(TARGDIR)/$(NAME).dll
# default target
all: $(TARGDIR) $(TARGET)
$(SRCS): $(HDRS)
touch $@
$(TARGDIR):
mkdir $(TARGDIR)
$(TARGDIR)/%.o : %.cpp
$(CXX) -c $(CFLAGS) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(FLEXTPATH)) $< -o $@
$(TARGET) : $(patsubst %.cpp,$(TARGDIR)/%.o,$(SRCS)) $(FLEXTLIB)
$(CXX) $(LDFLAGS) -shared $(patsubst %,-L%,$(LIBPATH)) $^ $(patsubst %,-l%,$(LIBS)) -o $@
chmod 755 $@
$(INSTDIR):
mkdir $(INSTDIR)
install:: $(INSTDIR)
install:: $(TARGET)
cp $^ $(INSTDIR)
chown root.root $(patsubst %,$(INSTDIR)/%,$(notdir $^))
.PHONY: clean
clean:
rm -f $(TARGDIR)/*.o $(TARGET)
# Microsoft Developer Studio Project File - Name="signal1" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** NICHT BEARBEITEN **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=signal1 - Win32 Debug
!MESSAGE Dies ist kein gltiges Makefile. Zum Erstellen dieses Projekts mit NMAKE
!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und fhren Sie den Befehl
!MESSAGE
!MESSAGE NMAKE /f "signal1.mak".
!MESSAGE
!MESSAGE Sie knnen beim Ausfhren von NMAKE eine Konfiguration angeben
!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:
!MESSAGE
!MESSAGE NMAKE /f "signal1.mak" CFG="signal1 - Win32 Debug"
!MESSAGE
!MESSAGE Fr die Konfiguration stehen zur Auswahl:
!MESSAGE
!MESSAGE "signal1 - Win32 Release" (basierend auf "Win32 (x86) Dynamic-Link Library")
!MESSAGE "signal1 - Win32 Debug" (basierend auf "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "signal1 - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "msvc"
# PROP Intermediate_Dir "msvc"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "..\.." /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "NT" /D "PD" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0xc07 /d "NDEBUG"
# ADD RSC /l 0xc07 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib /nologo /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib pd.lib flext-pdwin.lib /nologo /dll /machine:I386 /out:"../signal1~.dll" /libpath:"..\msvc" /libpath:"..\..\msvc-debug"
!ELSEIF "$(CFG)" == "signal1 - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "msvc-debug"
# PROP Intermediate_Dir "msvc-debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GR /GX /ZI /Od /I "..\.." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "NT" /D "PD" /Fr /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0xc07 /d "_DEBUG"
# ADD RSC /l 0xc07 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib pd.lib flext-pdwin.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"..\msvc-debug" /libpath:"..\..\msvc-debug"
!ENDIF
# Begin Target
# Name "signal1 - Win32 Release"
# Name "signal1 - Win32 Debug"
# Begin Source File
SOURCE=.\main.cpp
# End Source File
# End Target
# End Project
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment