Debian Codegraph @

src/CsoundHtmlOnlyWrapper.h

raw symbols SCIP
1 /*
2 Copyright (C) 2008-2016 Andres Cabrera
3 [email protected]
4
5 This file is part of CsoundQt.
6
7 CsoundQt is free software; you can redistribute it
8 and/or modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
11
12 CsoundQt is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with Csound; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 02111-1307 USA
21 */
22
23 #ifndef CsoundHtmlOnlyWrapper_H
24 #define CsoundHtmlOnlyWrapper_H
25
26 #include <QObject>
27 #include <QDebug>
28 #include <csound_threaded.hpp>
29 #include "csoundengine.h"
30
31 class CsoundHtmlView;
32
33 class CsoundHtmlOnlyWrapper : public QObject
34 {
35 Q_OBJECT
36 public:
37 explicit CsoundHtmlOnlyWrapper(QObject *parent = 0);
38 virtual ~CsoundHtmlOnlyWrapper();
39 void setCsoundHtmlView(CsoundHtmlView *csoundHtmlView);
40 public slots:
41 void registerConsole(ConsoleWidget *console);
42 int compileCsd(const QString &filename);
43 // Uppercase aliases to comply with Webaudio Csound, see https://vlazzarini.github.io/paw/examples/docs/Csound.html
44 // NB! midi related methods not implemented yet
45 int CompileCsd(const QString &filename) { return compileCsd(filename);}
46 int compileCsdText(const QString &text);
47 int CompileCsdText(const QString &text) { return compileCsdText(text);}
48 int compileOrc(const QString &text);
49 int CompileOrc(const QString &text) { return compileOrc(text);}
50 double evalCode(const QString &text);
51 double EvalCode(const QString &text) { return evalCode(text); }
52 double get0dBFS();
53 double Get0dBFS() {return get0dBFS();}
54 int getApiVersion();
55 double getControlChannel(const QString &name);
56 //double RequestChannel(const QString &name) { return getControlChannel(const QString &name) } // NB! this works differently, better do not provide this alias!
57 qint64 getCurrentTimeSamples();
58 QString getEnv(const QString &name);
59 int getKsmps();
60 int getNchnls();
61 int getNchnlsInput();
62 QString getOutputName();
63 double getScoreOffsetSeconds();
64 double getScoreTime();
65 double GetScoreTime() {return getScoreTime();}
66 int getSr();
67 QString getStringChannel(const QString &name);
68 int getVersion();
69 bool isPlaying();
70 int isScorePending();
71 void message(const QString &text);
72 int perform();
73 int readScore(const QString &text);
74 int ReadScore(const QString &text) {return readScore(text);}
75 int Event(const QString &text) {return readScore(text);}
76 void reset();
77 void Reset() {reset();}
78 void rewindScore();
79 int runUtility(const QString &command, int argc, char **argv);
80 int scoreEvent(char type, const double *pFields, long numFields);
81 void setControlChannel(const QString &name, double value);
82 void SetChannel(const QString &name, double value) {setControlChannel(name, value);}
83 int setGlobalEnv(const QString &name, const QString &value);
84 void setInput(const QString &name);
85 // Dummy for now.
86 void setMessageCallback(QObject *callback);
87 int setOption(const QString &name);
88 void setOutput(const QString &name, const QString &type, const QString &format);
89 void setScoreOffsetSeconds(double value);
90 void setScorePending(bool value);
91 void setStringChannel(const QString &name, const QString &value);
92 void SetStringChannel(const QString &name, const QString &value) { setStringChannel(name, value); }
93 int start();
94 int Start(); // NB! Start() does not require have to call for perform separately!
95 void Play() {start(); perform();}
96 void PlayCsd(const QString &csd) { compileCsd(csd); Play(); } // untested
97 void stop();
98 void Stop() { stop();}
99 //TODO: void Pause();
100 double tableGet(int table_number, int index);
101 int tableLength(int table_number);
102 void tableSet(int table_number, int index, double value);
103 void SetTable(int table_number, int index, double value) { tableSet(table_number, index, value); }
104 void setOptions(CsoundOptions * options);
105 signals:
106 void passMessages(QString message);
107 private:
108 static void csoundMessageCallback_(CSOUND *csound,
109 int attributes,
110 const char *format,
111 va_list args);
112 void csoundMessageCallback(int attributes,
113 const char *format,
114 va_list args);
115 QObject *message_callback;
116 ConsoleWidget *console;
117 CsoundThreaded csound;
118 CsoundHtmlView *csoundHtmlView;
119 private:
120 CsoundOptions *m_options;
121 QString csoundMessageBuffer;
122 };
123
124 #endif // CsoundHtmlWrapper_H