Permalink
Browse files

Merge pull request #52 from Kyew/header-functions

Rewrote header functions as inline, add toString to all objects
  • Loading branch information...
2 parents f7cb126 + b7419c4 commit 82cb13a7c1bb227104a0c9f7994b1a65733fc20e @mhroth committed Nov 3, 2014
Showing with 1,262 additions and 489 deletions.
  1. +11 −3 src/DspAdc.h
  2. +2 −2 src/DspAdd.cpp
  3. +6 −2 src/DspAdd.h
  4. +11 −2 src/DspBandpassFilter.h
  5. +10 −2 src/DspBang.h
  6. +2 −2 src/DspClip.cpp
  7. +50 −47 src/DspClip.h
  8. +10 −2 src/DspCosine.h
  9. +10 −2 src/DspDac.h
  10. +15 −2 src/DspDelayRead.h
  11. +21 −4 src/DspDelayWrite.h
  12. +6 −2 src/DspDivide.h
  13. +6 −2 src/DspEnvelope.h
  14. +10 −1 src/DspHighpassFilter.h
  15. +10 −2 src/DspImplicitAdd.h
  16. +25 −5 src/DspInlet.h
  17. +11 −2 src/DspLine.h
  18. +10 −1 src/DspLog.h
  19. +10 −1 src/DspLowpassFilter.h
  20. +6 −2 src/DspMinimum.h
  21. +6 −2 src/DspMultiply.h
  22. +10 −1 src/DspNoise.h
  23. +6 −2 src/DspOsc.h
  24. +30 −6 src/DspOutlet.h
  25. +6 −3 src/DspPhasor.h
  26. +10 −1 src/DspPrint.h
  27. +26 −5 src/DspReceive.h
  28. +10 −1 src/DspReciprocalSqrt.h
  29. +10 −1 src/DspRfft.h
  30. +0 −4 src/DspRifft.cpp
  31. +10 −0 src/DspRifft.h
  32. +21 −4 src/DspSend.h
  33. +6 −2 src/DspSignal.h
  34. +10 −2 src/DspSnapshot.h
  35. +10 −2 src/DspSqrt.h
  36. +6 −2 src/DspSubtract.h
  37. +0 −12 src/DspTablePlay.cpp
  38. +17 −0 src/DspTablePlay.h
  39. +0 −12 src/DspTableRead.cpp
  40. +17 −0 src/DspTableRead.h
  41. +0 −12 src/DspTableRead4.cpp
  42. +17 −0 src/DspTableRead4.h
  43. +5 −0 src/DspVCF.h
  44. +16 −3 src/DspVariableDelay.h
  45. +15 −3 src/DspVariableLine.h
  46. +10 −2 src/DspWrap.h
  47. +0 −4 src/MessageAbsoluteValue.cpp
  48. +9 −0 src/MessageAbsoluteValue.h
  49. +0 −4 src/MessageArcTangent.cpp
  50. +9 −0 src/MessageArcTangent.h
  51. +0 −4 src/MessageArcTangent2.cpp
  52. +9 −0 src/MessageArcTangent2.h
  53. +0 −4 src/MessageBang.cpp
  54. +9 −0 src/MessageBang.h
  55. +0 −4 src/MessageChange.cpp
  56. +9 −0 src/MessageChange.h
  57. +0 −4 src/MessageClip.cpp
  58. +9 −0 src/MessageClip.h
  59. +0 −4 src/MessageCosine.cpp
  60. +9 −0 src/MessageCosine.h
  61. +0 −4 src/MessageCputime.cpp
  62. +9 −0 src/MessageCputime.h
  63. +0 −4 src/MessageDbToPow.cpp
  64. +9 −0 src/MessageDbToPow.h
  65. +0 −4 src/MessageDbToRms.cpp
  66. +9 −0 src/MessageDbToRms.h
  67. +0 −4 src/MessageDeclare.cpp
  68. +9 −0 src/MessageDeclare.h
  69. +0 −4 src/MessageDelay.cpp
  70. +9 −0 src/MessageDelay.h
  71. +10 −2 src/MessageDiv.h
  72. +0 −4 src/MessageEqualsEquals.cpp
  73. +9 −0 src/MessageEqualsEquals.h
  74. +0 −4 src/MessageExp.cpp
  75. +9 −0 src/MessageExp.h
  76. +0 −4 src/MessageFloat.cpp
  77. +9 −0 src/MessageFloat.h
  78. +0 −4 src/MessageFrequencyToMidi.cpp
  79. +9 −0 src/MessageFrequencyToMidi.h
  80. +6 −4 src/MessageGreaterThan.cpp
  81. +6 −0 src/MessageGreaterThan.h
  82. +6 −4 src/MessageGreaterThanOrEqualTo.cpp
  83. +5 −0 src/MessageGreaterThanOrEqualTo.h
  84. +11 −1 src/MessageInlet.h
  85. +0 −4 src/MessageInteger.cpp
  86. +9 −0 src/MessageInteger.h
  87. +6 −4 src/MessageLessThan.cpp
  88. +5 −0 src/MessageLessThan.h
  89. +6 −4 src/MessageLessThanOrEqualTo.cpp
  90. +5 −0 src/MessageLessThanOrEqualTo.h
  91. +15 −2 src/MessageLine.h
  92. +0 −4 src/MessageListAppend.cpp
  93. +9 −0 src/MessageListAppend.h
  94. +0 −4 src/MessageListLength.cpp
  95. +9 −0 src/MessageListLength.h
  96. +0 −4 src/MessageListPrepend.cpp
  97. +9 −0 src/MessageListPrepend.h
  98. +0 −4 src/MessageListSplit.cpp
  99. +9 −0 src/MessageListSplit.h
  100. +0 −4 src/MessageListTrim.cpp
  101. +9 −0 src/MessageListTrim.h
  102. +0 −4 src/MessageLoadbang.cpp
  103. +9 −0 src/MessageLoadbang.h
  104. +0 −4 src/MessageLog.cpp
  105. +10 −1 src/MessageLog.h
  106. +0 −4 src/MessageLogicalAnd.cpp
  107. +9 −0 src/MessageLogicalAnd.h
  108. +0 −4 src/MessageLogicalOr.cpp
  109. +9 −0 src/MessageLogicalOr.h
  110. +10 −2 src/MessageMakefilename.h
  111. +0 −4 src/MessageMaximum.cpp
  112. +9 −0 src/MessageMaximum.h
  113. +11 −2 src/MessageMessageBox.h
  114. +0 −4 src/MessageMetro.cpp
  115. +5 −1 src/MessageMetro.h
  116. +0 −4 src/MessageMidiToFrequency.cpp
  117. +9 −0 src/MessageMidiToFrequency.h
  118. +0 −4 src/MessageMinimum.cpp
  119. +9 −0 src/MessageMinimum.h
  120. +6 −4 src/MessageModulus.cpp
  121. +5 −0 src/MessageModulus.h
  122. +0 −4 src/MessageMoses.cpp
  123. +9 −0 src/MessageMoses.h
  124. +6 −4 src/MessageNotEquals.cpp
  125. +5 −0 src/MessageNotEquals.h
  126. +0 −8 src/MessageNotein.cpp
  127. +13 −0 src/MessageNotein.h
  128. +0 −4 src/MessageOpenPanel.cpp
  129. +9 −0 src/MessageOpenPanel.h
  130. +0 −4 src/MessageOutlet.cpp
  131. +10 −0 src/MessageOutlet.h
  132. +1 −5 src/MessagePack.cpp
  133. +5 −1 src/MessagePack.h
  134. +0 −4 src/MessagePipe.cpp
  135. +9 −0 src/MessagePipe.h
  136. +0 −4 src/MessagePowToDb.cpp
  137. +9 −0 src/MessagePowToDb.h
  138. +0 −4 src/MessagePrint.cpp
  139. +9 −0 src/MessagePrint.h
  140. +10 −1 src/MessageRandom.h
  141. +15 −2 src/MessageReceive.h
  142. +6 −4 src/MessageRemainder.cpp
  143. +5 −0 src/MessageRemainder.h
  144. +0 −4 src/MessageRmsToDb.cpp
  145. +9 −0 src/MessageRmsToDb.h
  146. +0 −4 src/MessageRoute.cpp
  147. +9 −0 src/MessageRoute.h
  148. +0 −4 src/MessageSamplerate.cpp
  149. +9 −0 src/MessageSamplerate.h
  150. +0 −4 src/MessageSelect.cpp
  151. +9 −0 src/MessageSelect.h
  152. +15 −2 src/MessageSend.h
  153. +0 −4 src/MessageSendController.cpp
  154. +9 −0 src/MessageSendController.h
  155. +0 −4 src/MessageSine.cpp
  156. +9 −0 src/MessageSine.h
  157. +0 −4 src/MessageSoundfiler.cpp
  158. +9 −0 src/MessageSoundfiler.h
  159. +0 −4 src/MessageSpigot.cpp
  160. +9 −0 src/MessageSpigot.h
  161. +0 −4 src/MessageSqrt.cpp
  162. +9 −0 src/MessageSqrt.h
  163. +0 −4 src/MessageStripNote.cpp
  164. +9 −0 src/MessageStripNote.h
  165. +0 −4 src/MessageSwap.cpp
  166. +9 −0 src/MessageSwap.h
  167. +0 −4 src/MessageSwitch.cpp
  168. +9 −0 src/MessageSwitch.h
  169. +11 −3 src/MessageSymbol.h
  170. +0 −8 src/MessageTable.cpp
  171. +13 −0 src/MessageTable.h
  172. +0 −8 src/MessageTableRead.cpp
  173. +13 −0 src/MessageTableRead.h
  174. +0 −8 src/MessageTableWrite.cpp
  175. +13 −0 src/MessageTableWrite.h
  176. +0 −4 src/MessageTangent.cpp
  177. +9 −0 src/MessageTangent.h
  178. +0 −6 src/MessageText.cpp
  179. +13 −2 src/MessageText.h
  180. +0 −4 src/MessageTimer.cpp
  181. +9 −0 src/MessageTimer.h
  182. +1 −5 src/MessageTrigger.cpp
  183. +5 −1 src/MessageTrigger.h
  184. +1 −5 src/MessageUnpack.cpp
  185. +6 −1 src/MessageUnpack.h
  186. +0 −4 src/MessageUntil.cpp
  187. +9 −0 src/MessageUntil.h
  188. +0 −4 src/MessageValue.cpp
  189. +10 −2 src/MessageValue.h
  190. +0 −4 src/MessageWrap.cpp
  191. +9 −0 src/MessageWrap.h
View
@@ -32,8 +32,8 @@ class DspAdc : public DspObject {
DspAdc(PdGraph *graph);
~DspAdc();
- static const char *getObjectLabel() { return "adc~"; }
- string toString() { return string(DspAdc::getObjectLabel()); }
+ static const char *getObjectLabel();
+ std::string toString();
// This object doesn't do anything with audio, it only provides buffers. It should not be included
// in the dsp list
@@ -44,4 +44,12 @@ class DspAdc : public DspObject {
float *getDspBufferAtOutlet(int outletIndex);
};
-#endif // _DSP_ADC_H_
+inline const char *DspAdc::getObjectLabel() {
+ return "adc~";
+}
+
+inline std::string DspAdc::toString() {
+ return DspAdc::getObjectLabel();
+}
+
+#endif // _DSP_ADC_H_
View
@@ -43,11 +43,11 @@ void DspAdd::onInletConnectionUpdate(unsigned int inletIndex) {
? &processSignal : &processScalar;
}
-string DspAdd::toString() {
+std::string DspAdd::toString() {
const char *fmt = (constant == 0.0f) ? "%s" : "%s %g";
char str[snprintf(NULL, 0, fmt, getObjectLabel(), constant)+1];
snprintf(str, sizeof(str), fmt, getObjectLabel(), constant);
- return string(str);
+ return str;
}
void DspAdd::processMessage(int inletIndex, PdMessage *message) {
View
@@ -33,8 +33,8 @@ class DspAdd : public DspObject {
DspAdd(PdMessage *initMessage, PdGraph *graph);
~DspAdd();
- static const char *getObjectLabel() { return "+~"; }
- string toString();
+ static const char *getObjectLabel();
+ std::string toString();
void onInletConnectionUpdate(unsigned int inletIndex);
@@ -46,4 +46,8 @@ class DspAdd : public DspObject {
float constant;
};
+inline const char *DspAdd::getObjectLabel() {
+ return "+~";
+}
+
#endif // _DSP_ADD_H_
@@ -36,8 +36,9 @@ class DspBandpassFilter : public DspFilter {
DspBandpassFilter(PdMessage *initMessage, PdGraph *graph);
~DspBandpassFilter();
- static const char *getObjectLabel() { return "bp~"; }
-
+ static const char *getObjectLabel();
+ std::string toString();
+
private:
void processMessage(int inletIndex, PdMessage *message);
void calcFiltCoeff(float fc, float q);
@@ -46,4 +47,12 @@ class DspBandpassFilter : public DspFilter {
float q;
};
+inline std::string DspBandpassFilter::toString() {
+ return DspBandpassFilter::getObjectLabel();
+}
+
+inline const char *DspBandpassFilter::getObjectLabel() {
+ return "bp~";
+}
+
#endif // _DSP_BAND_PASS_FILTER_H_
View
@@ -33,13 +33,21 @@ class DspBang : public DspObject {
DspBang(PdMessage *initMessage, PdGraph *graph);
~DspBang();
- static const char *getObjectLabel() { return "bang~"; }
- string toString() { return string(getObjectLabel()); }
+ static const char *getObjectLabel();
+ std::string toString();
ConnectionType getConnectionType(int outletIndex) { return MESSAGE; }
private:
static void processDsp(DspObject *dspObject, int fromIndex, int toIndex);
};
+inline std::string DspBang::toString() {
+ return DspBang::getObjectLabel();
+}
+
+inline const char *DspBang::getObjectLabel() {
+ return "bang~";
+}
+
#endif // _DSP_BANG_H_
View
@@ -40,10 +40,10 @@ DspClip::~DspClip() {
// nothing to do
}
-string DspClip::toString() {
+std::string DspClip::toString() {
char str[snprintf(NULL, 0, "%s %g %g", getObjectLabel(), lowerBound, upperBound)+1];
snprintf(str, sizeof(str), "%s %g %g", getObjectLabel(), lowerBound, upperBound);
- return string(str);
+ return str;
}
void DspClip::processMessage(int inletIndex, PdMessage *message) {
View
@@ -1,47 +1,50 @@
-/*
- * Copyright 2009,2010,2011,2012 Reality Jockey, Ltd.
- * info@rjdj.me
- * http://rjdj.me/
- *
- * This file is part of ZenGarden.
- *
- * ZenGarden is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * ZenGarden 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with ZenGarden. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef _DSP_CLIP_H_
-#define _DSP_CLIP_H_
-
-#include "DspObject.h"
-
-/** [clip~ float float] */
-class DspClip : public DspObject {
-
- public:
- static MessageObject *newObject(PdMessage *initMessage, PdGraph *graph);
- DspClip(PdMessage *initMessage, PdGraph *graph);
- ~DspClip();
-
- static const char *getObjectLabel() { return "clip~"; }
- string toString();
-
- private:
- static void processScalar(DspObject *dspObject, int fromIndex, int toIndex);
- void processMessage(int inletIndex, PdMessage *message);
-
- float lowerBound;
- float upperBound;
-};
-
-#endif // _DSP_CLIP_H_
+/*
+ * Copyright 2009,2010,2011,2012 Reality Jockey, Ltd.
+ * info@rjdj.me
+ * http://rjdj.me/
+ *
+ * This file is part of ZenGarden.
+ *
+ * ZenGarden is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * ZenGarden 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with ZenGarden. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef _DSP_CLIP_H_
+#define _DSP_CLIP_H_
+
+#include "DspObject.h"
+
+/** [clip~ float float] */
+class DspClip : public DspObject {
+ public:
+ static MessageObject *newObject(PdMessage *initMessage, PdGraph *graph);
+ DspClip(PdMessage *initMessage, PdGraph *graph);
+ ~DspClip();
+
+ static const char *getObjectLabel();
+ std::string toString();
+
+ private:
+ static void processScalar(DspObject *dspObject, int fromIndex, int toIndex);
+ void processMessage(int inletIndex, PdMessage *message);
+
+ float lowerBound;
+ float upperBound;
+};
+
+inline const char *DspClip::getObjectLabel() {
+ return "clip~";
+}
+
+#endif // _DSP_CLIP_H_
View
@@ -33,8 +33,8 @@ class DspCosine : public DspObject {
DspCosine(PdMessage *initMessage, PdGraph *graph);
~DspCosine();
- static const char *getObjectLabel() { return "cos~"; }
- string toString() { return string(getObjectLabel()); }
+ static const char *getObjectLabel();
+ std::string toString();
private:
static void procesSignal(DspObject *dspObject, int fromIndex, int toIndex);
@@ -44,4 +44,12 @@ class DspCosine : public DspObject {
static int refCount; // a reference counter for Cosine table. Now we know when to free it.
};
+inline std::string DspCosine::toString() {
+ return DspCosine::getObjectLabel();
+}
+
+inline const char *DspCosine::getObjectLabel() {
+ return "cos~";
+}
+
#endif // _DSP_COSINE_H_
View
@@ -32,11 +32,19 @@ class DspDac : public DspObject {
DspDac(PdGraph *graph);
~DspDac();
- static const char *getObjectLabel() { return "dac~"; }
- string toString() { return string(DspDac::getObjectLabel()); }
+ static const char *getObjectLabel();
+ std::string toString();
private:
static void processSignal(DspObject *dspObject, int fromIndex, int toIndex);
};
+inline std::string DspDac::toString() {
+ return DspDac::getObjectLabel();
+}
+
+inline const char *DspDac::getObjectLabel() {
+ return "dac~";
+}
+
#endif // _DSP_DAC_H_
View
@@ -38,8 +38,9 @@ class DspDelayRead : public DelayReceiver {
DspDelayRead(PdMessage *initString, PdGraph *graph);
~DspDelayRead();
- static const char *getObjectLabel() { return "delread~"; }
- ObjectType getObjectType() { return DSP_DELAY_READ; }
+ static const char *getObjectLabel();
+ std::string toString();
+ ObjectType getObjectType();
void onInletConnectionUpdate(unsigned int inletIndex);
@@ -50,4 +51,16 @@ class DspDelayRead : public DelayReceiver {
float delayInSamples;
};
+inline std::string DspDelayRead::toString() {
+ return DspDelayRead::getObjectLabel();
+}
+
+inline const char *DspDelayRead::getObjectLabel() {
+ return "delread~";
+}
+
+inline ObjectType DspDelayRead::getObjectType() {
+ return DSP_DELAY_READ;
+}
+
#endif // _DSP_DELAY_READ_H_
View
@@ -32,11 +32,11 @@ class DspDelayWrite : public DspObject {
DspDelayWrite(PdMessage *initMessage, PdGraph *graph);
~DspDelayWrite();
- static const char *getObjectLabel() { return "delwrite~"; }
- string toString() { return string(getObjectLabel()) + " " + string(name); }
- ObjectType getObjectType() { return DSP_DELAY_WRITE; }
+ static const char *getObjectLabel();
+ std::string toString();
+ ObjectType getObjectType();
- const char *getName() { return name; }
+ const char *getName();
inline float *getBuffer(int *index, int *length) {
*index = headIndex;
@@ -52,4 +52,21 @@ class DspDelayWrite : public DspObject {
int headIndex;
};
+inline std::string DspDelayWrite::toString() {
+ return string(getObjectLabel()) + " " + string(name);
+}
+
+inline const char *DspDelayWrite::getObjectLabel() {
+ return "delwrite~";
+}
+
+inline ObjectType DspDelayWrite::getObjectType() {
+ return DSP_DELAY_WRITE;
+}
+
+inline const char *DspDelayWrite::getName() {
+ return name;
+}
+
+
#endif // _DSP_DELAY_WRITE_H_
View
@@ -32,8 +32,8 @@ class DspDivide : public DspObject {
DspDivide(PdMessage *initMessage, PdGraph *graph);
~DspDivide();
- static const char *getObjectLabel() { return "/~"; }
- string toString();
+ static const char *getObjectLabel();
+ std::string toString();
private:
static void processSignal(DspObject *dspObject, int fromIndex, int toIndex);
@@ -45,4 +45,8 @@ class DspDivide : public DspObject {
float constant;
};
+inline const char *DspDivide::getObjectLabel() {
+ return "/~";
+}
+
#endif // _DSP_DIVIDE_H_
View
@@ -40,8 +40,8 @@ class DspEnvelope : public DspObject {
DspEnvelope(PdMessage *initMessage, PdGraph *graph);
~DspEnvelope();
- static const char *getObjectLabel() { return "env~"; }
- string toString();
+ static const char *getObjectLabel();
+ std::string toString();
ConnectionType getConnectionType(int outletIndex) { return MESSAGE; }
@@ -62,4 +62,8 @@ class DspEnvelope : public DspObject {
float *hanningCoefficients;
};
+inline const char *DspEnvelope::getObjectLabel() {
+ return "env~";
+}
+
#endif // _DSP_ENVELOPE_H_
@@ -36,11 +36,20 @@ class DspHighpassFilter : public DspFilter {
DspHighpassFilter(PdMessage *initMessage, PdGraph *graph);
~DspHighpassFilter();
- static const char *getObjectLabel() { return "hip~"; }
+ static const char *getObjectLabel();
+ std::string toString();
private:
void processMessage(int inletIndex, PdMessage *message);
void calcFiltCoeff(float cutoffFrequency);
};
+inline std::string DspHighpassFilter::toString() {
+ return DspHighpassFilter::getObjectLabel();
+}
+
+inline const char *DspHighpassFilter::getObjectLabel() {
+ return "hip~";
+}
+
#endif // _DSP_HIGH_PASS_FILTER_H_
Oops, something went wrong.

0 comments on commit 82cb13a

Please sign in to comment.