| 1 |
/* |
| 2 |
* C S O U N D |
| 3 |
* |
| 4 |
* L I C E N S E |
| 5 |
* |
| 6 |
* This software is free software; you can redistribute it and/or |
| 7 |
* modify it under the terms of the GNU Lesser General Public |
| 8 |
* License as published by the Free Software Foundation; either |
| 9 |
* version 2.1 of the License, or (at your option) any later version. |
| 10 |
* |
| 11 |
* This software is distributed in the hope that it will be useful, |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 |
* Lesser General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU Lesser General Public |
| 17 |
* License along with this software; if not, write to the Free Software |
| 18 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 19 |
*/ |
| 20 |
#ifndef CSND_CPPSOUND_H |
| 21 |
#define CSND_CPPSOUND_H |
| 22 |
|
| 23 |
#ifndef __MYFLT_DEF |
| 24 |
#define __MYFLT_DEF |
| 25 |
#ifdef USE_DOUBLE |
| 26 |
#define MYFLT double |
| 27 |
#else |
| 28 |
#define MYFLT float |
| 29 |
#endif |
| 30 |
#endif |
| 31 |
|
| 32 |
#ifdef SWIG |
| 33 |
%module csnd |
| 34 |
%include "std_string.i" |
| 35 |
%include "std_vector.i" |
| 36 |
%apply std::vector<double> *INPUT { std::vector<double> const & }; |
| 37 |
%{ |
| 38 |
#include "csound.hpp" |
| 39 |
#include "CsoundFile.hpp" |
| 40 |
#include <string> |
| 41 |
#include <vector> |
| 42 |
%} |
| 43 |
%template(MyfltVector) std::vector<MYFLT>; |
| 44 |
#else |
| 45 |
#include "csound.hpp" |
| 46 |
#include "CsoundFile.hpp" |
| 47 |
#include <string> |
| 48 |
#include <vector> |
| 49 |
#endif |
| 50 |
|
| 51 |
class PUBLIC CppSound : public Csound, public CsoundFile |
| 52 |
{ |
| 53 |
bool go; |
| 54 |
bool isCompiled; |
| 55 |
bool isPerforming; |
| 56 |
size_t spoutSize; |
| 57 |
std::string renderedSoundfile; |
| 58 |
public: |
| 59 |
CppSound() : Csound(), |
| 60 |
go(false), |
| 61 |
isCompiled(false), |
| 62 |
isPerforming(false), |
| 63 |
spoutSize(0) |
| 64 |
{ |
| 65 |
|
| 66 |
//SetHostData((CSOUND *)0); |
| 67 |
|
| 68 |
} |
| 69 |
|
| 70 |
virtual ~CppSound(); |
| 71 |
virtual CSOUND *getCsound(); |
| 72 |
virtual long getThis(); |
| 73 |
virtual CsoundFile *getCsoundFile(); |
| 74 |
virtual int compile(int argc, char **argv); |
| 75 |
virtual int compile(); |
| 76 |
virtual size_t getSpoutSize() const; |
| 77 |
virtual std::string getOutputSoundfileName() const; |
| 78 |
virtual int perform(int argc, char **argv); |
| 79 |
virtual int perform(); |
| 80 |
virtual int performKsmps(bool absolute); |
| 81 |
virtual void cleanup(); |
| 82 |
virtual void inputMessage(const char *istatement); |
| 83 |
virtual void write(const char *text); |
| 84 |
virtual bool getIsCompiled() const; |
| 85 |
virtual void setIsPerforming(bool isPerforming); |
| 86 |
virtual bool getIsPerforming() const; |
| 87 |
virtual bool getIsGo(); |
| 88 |
virtual void stop(); |
| 89 |
}; |
| 90 |
|
| 91 |
#endif |
| 92 |
|