flsndobj.h
Go to the documentation of this file.
/*
flext - C++ layer for Max and Pure Data externals
Copyright (c) 2001-2015 Thomas Grill (gr@grrrr.org)
For information on usage and redistribution, and for a DISCLAIMER OF ALL
WARRANTIES, see the file, "license.txt," in this distribution.
*/
#ifndef __FLEXT_SNDOBJ_H
#define __FLEXT_SNDOBJ_H
#include "flext.h"
// PI is defined in the Max/MSP SDK, but clashes with SndObj.h
#ifdef PI
#undef PI
#endif
// SndObj needs WIN symbol when compiled under Windows
#if FLEXT_OS == FLEXT_OS_WIN && !defined(WIN)
#define WIN
#endif
#ifndef FLEXT_THREADS
#define NOPTHREAD
#endif
#include <SndObj/SndObj.h>
#include <SndObj/SndIO.h>
#undef NOPTHREAD
#include "flpushns.h"
class FLEXT_SHARE flext_sndobj:
public flext_dsp
{
FLEXT_HEADER(flext_sndobj,flext_dsp)
public:
flext_sndobj();
// these have to be overridden in child classes
virtual bool NewObjs() { return true; }
virtual void FreeObjs() {}
virtual void ProcessObjs() {}
// inputs and outputs
SndObj &InObj(int i) { return *tmpobj[i]; }
SndIO &OutObj(int i) { return *outobj[i]; }
protected:
virtual bool Init();
virtual void Exit();
private:
class Inlet:
public SndIO
{
public:
Inlet(const t_sample *b,int vecsz,float sr);
virtual short Read();
virtual short Write();
void SetBuf(const t_sample *b) { buf = b; }
private:
const t_sample *buf;
};
class Outlet:
public SndIO
{
public:
Outlet(t_sample *b,int vecsz,float sr);
virtual short Read();
virtual short Write();
void SetBuf(t_sample *b) { buf = b; }
private:
t_sample *buf;
};
virtual bool CbDsp();
virtual void CbSignal();
void ClearObjs();
int inobjs,outobjs;
SndObj **tmpobj;
Inlet **inobj;
Outlet **outobj;
float smprt;
int blsz;
};
#include "flpopns.h"
#ifdef FLEXT_INLINE
# include "flsndobj.cpp"
#endif
#endif
flext_base::Init
virtual bool Init()
Set up inlets and outlets, method and attribute lists.
Definition flext.cpp:69
flext_dsp::Exit
virtual void Exit()
Deallocate all kinds of stuff.
Definition fldsp.cpp:44
flext_dsp::flext_dsp
flext_dsp()
Definition fldsp.cpp:32
flext_sndobj::Inlet
SndObj for reading from inlet buffer.
Definition flsndobj.h:60
flext_sndobj::Inlet::Read
virtual short Read()
Definition flsndobj.cpp:104
flext_sndobj::Inlet::buf
const t_sample * buf
Definition flsndobj.h:69
flext_sndobj::Inlet::Write
virtual short Write()
Definition flsndobj.cpp:114
flext_sndobj::Inlet::Inlet
Inlet(const t_sample *b, int vecsz, float sr)
Definition flsndobj.cpp:100
flext_sndobj::Inlet::SetBuf
void SetBuf(const t_sample *b)
Definition flsndobj.h:66
flext_sndobj::Outlet
SndObj for writing to outlet buffer.
Definition flsndobj.h:75
flext_sndobj::Outlet::Outlet
Outlet(t_sample *b, int vecsz, float sr)
Definition flsndobj.cpp:117
flext_sndobj::Outlet::buf
t_sample * buf
Definition flsndobj.h:84
flext_sndobj::Outlet::Read
virtual short Read()
Definition flsndobj.cpp:121
flext_sndobj::Outlet::SetBuf
void SetBuf(t_sample *b)
Definition flsndobj.h:81
flext_sndobj::Outlet::Write
virtual short Write()
Definition flsndobj.cpp:123
flext_sndobj::InObj
SndObj & InObj(int i)
Definition flsndobj.h:49
flext_sndobj::OutObj
SndIO & OutObj(int i)
Definition flsndobj.h:50
flext_sndobj::NewObjs
virtual bool NewObjs()
Definition flsndobj.h:44
flext_sndobj::tmpobj
SndObj ** tmpobj
Definition flsndobj.h:93
flext_sndobj::blsz
int blsz
Definition flsndobj.h:98
flext_sndobj::outobj
Outlet ** outobj
Definition flsndobj.h:95
flext_sndobj::outobjs
int outobjs
Definition flsndobj.h:92
flext_sndobj::FreeObjs
virtual void FreeObjs()
Definition flsndobj.h:45
flext_sndobj::inobj
Inlet ** inobj
Definition flsndobj.h:94
flext_sndobj::smprt
float smprt
Definition flsndobj.h:97
flext_sndobj::flext_sndobj
flext_sndobj()
Definition flsndobj.cpp:17
flext_sndobj::ClearObjs
void ClearObjs()
Definition flsndobj.cpp:37
flext_sndobj::ProcessObjs
virtual void ProcessObjs()
Definition flsndobj.h:46
flext_sndobj::inobjs
int inobjs
Definition flsndobj.h:92
flext.h
This is the main flext include file.
flpopns.h
FLEXT_SHARE
#define FLEXT_SHARE
Definition flprefix.h:416
flpushns.h
flsndobj.cpp
flext_dsp::CbDsp
virtual bool CbDsp()
Called on every dsp init.
Definition fldsp.cpp:139
flext_dsp::CbSignal
virtual void CbSignal()
Called with every signal vector - here you do the dsp calculation flext_dsp::CbSignal fills all outpu...
Definition fldsp.cpp:153
FLEXT_HEADER
#define FLEXT_HEADER(NEW_CLASS, PARENT_CLASS)
Plain flext class header.
Definition fldefs_hdr.h:29