Permalink
Browse files

Merge branch 'newPdParser'

  • Loading branch information...
2 parents 0671082 + 4196bf7 commit 63786a0663c25a86954997a3f74d9c42f41bf990 @mhroth committed Sep 12, 2011
Showing with 1,508 additions and 885 deletions.
  1. +1 −0 .gitignore
  2. +14 −0 Xcode/ZenGarden.xcodeproj/project.pbxproj
  3. +4 −0 src/DspAdc.cpp
  4. +2 −1 src/DspAdc.h
  5. +4 −1 src/DspAdd.cpp
  6. +2 −1 src/DspAdd.h
  7. +4 −2 src/DspBandpassFilter.cpp
  8. +2 −1 src/DspBandpassFilter.h
  9. +4 −0 src/DspBang.cpp
  10. +2 −1 src/DspBang.h
  11. +4 −0 src/DspCatch.cpp
  12. +2 −1 src/DspCatch.h
  13. +10 −29 src/DspClip.cpp
  14. +2 −1 src/DspClip.h
  15. +4 −0 src/DspCosine.cpp
  16. +2 −1 src/DspCosine.h
  17. +10 −5 src/DspDac.cpp
  18. +3 −3 src/DspDac.h
  19. +4 −1 src/DspDelayRead.cpp
  20. +2 −1 src/DspDelayRead.h
  21. +4 −0 src/DspDelayWrite.cpp
  22. +2 −1 src/DspDelayWrite.h
  23. +4 −1 src/DspDivide.cpp
  24. +2 −1 src/DspDivide.h
  25. +4 −0 src/DspEnvelope.cpp
  26. +3 −1 src/DspEnvelope.h
  27. +5 −3 src/DspHighpassFilter.cpp
  28. +2 −1 src/DspHighpassFilter.h
  29. +5 −1 src/DspInlet.cpp
  30. +2 −1 src/DspInlet.h
  31. +5 −3 src/DspLine.cpp
  32. +3 −2 src/DspLine.h
  33. +4 −1 src/DspLog.cpp
  34. +2 −1 src/DspLog.h
  35. +4 −3 src/DspLowpassFilter.cpp
  36. +2 −1 src/DspLowpassFilter.h
  37. +4 −1 src/DspMinimum.cpp
  38. +2 −1 src/DspMinimum.h
  39. +4 −2 src/DspMultiply.cpp
  40. +2 −1 src/DspMultiply.h
  41. +4 −0 src/DspNoise.cpp
  42. +2 −1 src/DspNoise.h
  43. +3 −1 src/DspObject.cpp
  44. +6 −0 src/DspObject.h
  45. +4 −1 src/DspOsc.cpp
  46. +2 −1 src/DspOsc.h
  47. +5 −1 src/DspOutlet.cpp
  48. +2 −1 src/DspOutlet.h
  49. +4 −1 src/DspPhasor.cpp
  50. +2 −1 src/DspPhasor.h
  51. +4 −0 src/DspPrint.cpp
  52. +2 −1 src/DspPrint.h
  53. +4 −0 src/DspReceive.cpp
  54. +2 −1 src/DspReceive.h
  55. +4 −0 src/DspReciprocalSqrt.cpp
  56. +2 −1 src/DspReciprocalSqrt.h
  57. +4 −0 src/DspRfft.cpp
  58. +2 −1 src/DspRfft.h
  59. +4 −0 src/DspRifft.cpp
  60. +2 −1 src/DspRifft.h
  61. +4 −0 src/DspSend.cpp
  62. +2 −1 src/DspSend.h
  63. +4 −1 src/DspSignal.cpp
  64. +6 −5 src/DspSignal.h
  65. +4 −0 src/DspSnapshot.cpp
  66. +2 −1 src/DspSnapshot.h
  67. +4 −0 src/DspSqrt.cpp
  68. +2 −1 src/DspSqrt.h
  69. +4 −1 src/DspSubtract.cpp
  70. +2 −1 src/DspSubtract.h
  71. +4 −3 src/DspTablePlay.cpp
  72. +2 −1 src/DspTablePlay.h
  73. +4 −1 src/DspTableRead.cpp
  74. +2 −1 src/DspTableRead.h
  75. +4 −1 src/DspTableRead4.cpp
  76. +2 −1 src/DspTableRead4.h
  77. +4 −0 src/DspThrow.cpp
  78. +2 −1 src/DspThrow.h
  79. +4 −1 src/DspVCF.cpp
  80. +2 −1 src/DspVCF.h
  81. +4 −0 src/DspVariableDelay.cpp
  82. +2 −1 src/DspVariableDelay.h
  83. +4 −0 src/DspWrap.cpp
  84. +2 −1 src/DspWrap.h
  85. +1 −0 src/Makefile.sourcefiles
  86. +4 −0 src/MessageAbsoluteValue.cpp
  87. +2 −1 src/MessageAbsoluteValue.h
  88. +4 −0 src/MessageAdd.cpp
  89. +2 −1 src/MessageAdd.h
  90. +4 −0 src/MessageArcTangent.cpp
  91. +2 −1 src/MessageArcTangent.h
  92. +4 −0 src/MessageArcTangent2.cpp
  93. +2 −1 src/MessageArcTangent2.h
  94. +4 −0 src/MessageBang.cpp
  95. +2 −1 src/MessageBang.h
  96. +4 −0 src/MessageChange.cpp
  97. +2 −1 src/MessageChange.h
  98. +4 −0 src/MessageClip.cpp
  99. +2 −1 src/MessageClip.h
  100. +4 −0 src/MessageCosine.cpp
  101. +2 −1 src/MessageCosine.h
  102. +4 −0 src/MessageCputime.cpp
  103. +2 −1 src/MessageCputime.h
  104. +4 −0 src/MessageDbToPow.cpp
  105. +2 −1 src/MessageDbToPow.h
  106. +4 −0 src/MessageDbToRms.cpp
  107. +2 −1 src/MessageDbToRms.h
  108. +4 −0 src/MessageDeclare.cpp
  109. +2 −1 src/MessageDeclare.h
  110. +4 −0 src/MessageDelay.cpp
  111. +2 −1 src/MessageDelay.h
  112. +4 −0 src/MessageDivide.cpp
  113. +2 −1 src/MessageDivide.h
  114. +5 −1 src/MessageEqualsEquals.cpp
  115. +2 −1 src/MessageEqualsEquals.h
  116. +4 −0 src/MessageExp.cpp
  117. +2 −1 src/MessageExp.h
  118. +4 −0 src/MessageFloat.cpp
  119. +2 −1 src/MessageFloat.h
  120. +4 −0 src/MessageFrequencyToMidi.cpp
  121. +2 −1 src/MessageFrequencyToMidi.h
  122. +4 −0 src/MessageGreaterThan.cpp
  123. +2 −1 src/MessageGreaterThan.h
  124. +4 −0 src/MessageGreaterThanOrEqualTo.cpp
  125. +2 −1 src/MessageGreaterThanOrEqualTo.h
  126. +5 −1 src/MessageInlet.cpp
  127. +2 −1 src/MessageInlet.h
  128. +4 −0 src/MessageInteger.cpp
  129. +2 −1 src/MessageInteger.h
  130. +4 −0 src/MessageLessThan.cpp
  131. +2 −1 src/MessageLessThan.h
  132. +4 −0 src/MessageLessThanOrEqualTo.cpp
  133. +2 −1 src/MessageLessThanOrEqualTo.h
  134. +4 −0 src/MessageLine.cpp
  135. +2 −1 src/MessageLine.h
  136. +36 −0 src/MessageListAppend.cpp
  137. +2 −1 src/MessageListAppend.h
  138. +1 −1 src/MessageListLength.h
  139. +1 −1 src/MessageListPrepend.h
  140. +1 −1 src/MessageListSplit.h
  141. +1 −1 src/MessageListTrim.h
  142. +4 −0 src/MessageLoadbang.cpp
  143. +2 −1 src/MessageLoadbang.h
  144. +4 −0 src/MessageLog.cpp
  145. +2 −1 src/MessageLog.h
  146. +4 −0 src/MessageLogicalAnd.cpp
  147. +2 −1 src/MessageLogicalAnd.h
  148. +4 −0 src/MessageLogicalOr.cpp
  149. +2 −1 src/MessageLogicalOr.h
  150. +4 −0 src/MessageMaximum.cpp
  151. +2 −1 src/MessageMaximum.h
  152. +4 −0 src/MessageMessageBox.cpp
  153. +2 −1 src/MessageMessageBox.h
  154. +4 −0 src/MessageMetro.cpp
  155. +2 −1 src/MessageMetro.h
  156. +5 −1 src/MessageMidiToFrequency.cpp
  157. +3 −2 src/MessageMidiToFrequency.h
  158. +4 −0 src/MessageMinimum.cpp
  159. +2 −1 src/MessageMinimum.h
  160. +4 −0 src/MessageModulus.cpp
  161. +2 −1 src/MessageModulus.h
  162. +4 −0 src/MessageMoses.cpp
  163. +2 −1 src/MessageMoses.h
  164. +4 −0 src/MessageMultiply.cpp
  165. +2 −1 src/MessageMultiply.h
  166. +4 −0 src/MessageNotEquals.cpp
  167. +2 −1 src/MessageNotEquals.h
  168. +4 −0 src/MessageNotein.cpp
  169. +2 −1 src/MessageNotein.h
  170. +1 −1 src/MessageObject.h
  171. +4 −0 src/MessageOpenPanel.cpp
  172. +2 −1 src/MessageOpenPanel.h
  173. +5 −1 src/MessageOutlet.cpp
  174. +3 −2 src/MessageOutlet.h
  175. +4 −0 src/MessagePack.cpp
  176. +2 −1 src/MessagePack.h
  177. +4 −0 src/MessagePipe.cpp
  178. +2 −1 src/MessagePipe.h
  179. +4 −0 src/MessagePow.cpp
  180. +2 −1 src/MessagePow.h
  181. +5 −1 src/MessagePowToDb.cpp
  182. +3 −2 src/MessagePowToDb.h
  183. +4 −0 src/MessagePrint.cpp
  184. +2 −1 src/MessagePrint.h
  185. +4 −0 src/MessageRandom.cpp
  186. +2 −1 src/MessageRandom.h
  187. +4 −0 src/MessageReceive.cpp
  188. +2 −1 src/MessageReceive.h
  189. +4 −0 src/MessageRemainder.cpp
  190. +2 −1 src/MessageRemainder.h
  191. +5 −1 src/MessageRmsToDb.cpp
  192. +3 −2 src/MessageRmsToDb.h
  193. +4 −0 src/MessageRoute.cpp
  194. +2 −1 src/MessageRoute.h
  195. +4 −0 src/MessageSamplerate.cpp
  196. +2 −1 src/MessageSamplerate.h
  197. +4 −0 src/MessageSelect.cpp
  198. +2 −1 src/MessageSelect.h
  199. +4 −0 src/MessageSend.cpp
  200. +2 −1 src/MessageSend.h
  201. +1 −1 src/MessageSendController.h
  202. +4 −0 src/MessageSine.cpp
  203. +2 −1 src/MessageSine.h
  204. +4 −0 src/MessageSoundfiler.cpp
  205. +2 −1 src/MessageSoundfiler.h
  206. +4 −0 src/MessageSpigot.cpp
  207. +2 −1 src/MessageSpigot.h
  208. +4 −0 src/MessageSqrt.cpp
  209. +2 −1 src/MessageSqrt.h
  210. +4 −0 src/MessageStripNote.cpp
  211. +2 −1 src/MessageStripNote.h
  212. +4 −0 src/MessageSubtract.cpp
  213. +2 −1 src/MessageSubtract.h
  214. +4 −0 src/MessageSwap.cpp
  215. +2 −1 src/MessageSwap.h
  216. +4 −0 src/MessageSwitch.cpp
  217. +2 −1 src/MessageSwitch.h
  218. +4 −0 src/MessageSymbol.cpp
  219. +2 −1 src/MessageSymbol.h
  220. +4 −0 src/MessageTable.cpp
  221. +2 −1 src/MessageTable.h
  222. +4 −0 src/MessageTableRead.cpp
  223. +2 −1 src/MessageTableRead.h
  224. +4 −0 src/MessageTableWrite.cpp
  225. +2 −1 src/MessageTableWrite.h
  226. +4 −0 src/MessageTangent.cpp
  227. +2 −1 src/MessageTangent.h
  228. +6 −2 src/MessageText.cpp
  229. +3 −2 src/MessageText.h
  230. +4 −0 src/MessageTimer.cpp
  231. +2 −1 src/MessageTimer.h
  232. +4 −0 src/MessageToggle.cpp
  233. +2 −1 src/MessageToggle.h
  234. +4 −0 src/MessageTrigger.cpp
  235. +2 −1 src/MessageTrigger.h
  236. +4 −0 src/MessageUnpack.cpp
  237. +2 −1 src/MessageUnpack.h
  238. +5 −1 src/MessageUntil.cpp
  239. +3 −2 src/MessageUntil.h
  240. +4 −0 src/MessageValue.cpp
  241. +2 −1 src/MessageValue.h
  242. +4 −0 src/MessageWrap.cpp
  243. +2 −1 src/MessageWrap.h
  244. +304 −0 src/ObjectFactoryMap.cpp
  245. +47 −0 src/ObjectFactoryMap.h
  246. +53 −605 src/PdContext.cpp
  247. +20 −12 src/PdContext.h
  248. +188 −5 src/PdFileParser.cpp
  249. +10 −3 src/PdFileParser.h
  250. +6 −6 src/PdGraph.cpp
  251. +1 −1 src/PdGraph.h
  252. +3 −7 src/PdMessage.cpp
  253. +1 −1 src/StaticUtils.cpp
  254. +1 −1 src/StaticUtils.h
  255. +8 −1 src/ZGCallbackFunction.h
  256. +37 −16 src/ZenGarden.cpp
  257. +20 −7 src/ZenGarden.h
  258. +7 −7 src/main.cpp
  259. +5 −4 src/me/rjdj/zengarden/zgcontext.cpp
View
@@ -16,3 +16,4 @@ Mersenne-1.1.zip
demo/
libs/
ZenGarden.jar
+src/main.cpp
@@ -675,6 +675,11 @@
90EC947E120EDF2A00F65F49 /* MessageValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 90EC947B120EDF2A00F65F49 /* MessageValue.cpp */; };
90EC947F120EDF2A00F65F49 /* MessageValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 90EC947A120EDF2A00F65F49 /* MessageValue.h */; };
90EC9480120EDF2A00F65F49 /* MessageValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 90EC947B120EDF2A00F65F49 /* MessageValue.cpp */; };
+ 90F3D68813F82F5F0058E68D /* ObjectFactoryMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 90F3D68713F82F5E0058E68D /* ObjectFactoryMap.cpp */; };
+ 90F3D68913F82F5F0058E68D /* ObjectFactoryMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 90F3D68713F82F5E0058E68D /* ObjectFactoryMap.cpp */; };
+ 90F3D68A13F82F5F0058E68D /* ObjectFactoryMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 90F3D68713F82F5E0058E68D /* ObjectFactoryMap.cpp */; };
+ 90F3D68C13F82F700058E68D /* ObjectFactoryMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 90F3D68B13F82F6E0058E68D /* ObjectFactoryMap.h */; };
+ 90F3D68D13F82F700058E68D /* ObjectFactoryMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 90F3D68B13F82F6E0058E68D /* ObjectFactoryMap.h */; };
90F4C18D12328AC1001182CF /* MessageLogicalAnd.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 90F4C18B12328AC1001182CF /* MessageLogicalAnd.cpp */; };
90F4C18E12328AC1001182CF /* MessageLogicalAnd.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 90F4C18B12328AC1001182CF /* MessageLogicalAnd.cpp */; };
90F4C18F12328AC1001182CF /* MessageLogicalAnd.h in Headers */ = {isa = PBXBuildFile; fileRef = 90F4C18C12328AC1001182CF /* MessageLogicalAnd.h */; };
@@ -983,6 +988,8 @@
90E90A041208EF8600A48B72 /* TableReceiverInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TableReceiverInterface.h; path = ../src/TableReceiverInterface.h; sourceTree = SOURCE_ROOT; };
90EC947A120EDF2A00F65F49 /* MessageValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MessageValue.h; path = ../src/MessageValue.h; sourceTree = SOURCE_ROOT; };
90EC947B120EDF2A00F65F49 /* MessageValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MessageValue.cpp; path = ../src/MessageValue.cpp; sourceTree = SOURCE_ROOT; };
+ 90F3D68713F82F5E0058E68D /* ObjectFactoryMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ObjectFactoryMap.cpp; path = ../src/ObjectFactoryMap.cpp; sourceTree = "<group>"; };
+ 90F3D68B13F82F6E0058E68D /* ObjectFactoryMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ObjectFactoryMap.h; path = ../src/ObjectFactoryMap.h; sourceTree = "<group>"; };
90F4C18B12328AC1001182CF /* MessageLogicalAnd.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MessageLogicalAnd.cpp; path = ../src/MessageLogicalAnd.cpp; sourceTree = SOURCE_ROOT; };
90F4C18C12328AC1001182CF /* MessageLogicalAnd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MessageLogicalAnd.h; path = ../src/MessageLogicalAnd.h; sourceTree = SOURCE_ROOT; };
90F4C19812328CFC001182CF /* MessageLogicalOr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MessageLogicalOr.cpp; path = ../src/MessageLogicalOr.cpp; sourceTree = SOURCE_ROOT; };
@@ -1297,6 +1304,8 @@
90EC947A120EDF2A00F65F49 /* MessageValue.h */,
90337C4011D0D847009FCC01 /* MessageWrap.cpp */,
90337C4111D0D847009FCC01 /* MessageWrap.h */,
+ 90F3D68713F82F5E0058E68D /* ObjectFactoryMap.cpp */,
+ 90F3D68B13F82F6E0058E68D /* ObjectFactoryMap.h */,
90BB31C811FE3F62008A0628 /* ObjectType.h */,
90337C4311D0D847009FCC01 /* OrderedMessageQueue.cpp */,
90337C4411D0D847009FCC01 /* OrderedMessageQueue.h */,
@@ -1495,6 +1504,7 @@
907B1F52129965D900B263E2 /* DspBang.h in Headers */,
90CCEBE31299CD7D009D36DF /* DspReciprocalSqrt.h in Headers */,
9086906C129AC67B00D3BD5D /* DspSqrt.h in Headers */,
+ 90F3D68C13F82F700058E68D /* ObjectFactoryMap.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1644,6 +1654,7 @@
907B1F55129965D900B263E2 /* DspBang.h in Headers */,
90CCEBE61299CD7D009D36DF /* DspReciprocalSqrt.h in Headers */,
9086906E129AC67B00D3BD5D /* DspSqrt.h in Headers */,
+ 90F3D68D13F82F700058E68D /* ObjectFactoryMap.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1870,6 +1881,7 @@
90869070129AC67B00D3BD5D /* DspSqrt.cpp in Sources */,
9099A82C13D0437E0091E9FF /* MessageCputime.cpp in Sources */,
9099A82F13D043D60091E9FF /* DspVCF.cpp in Sources */,
+ 90F3D68813F82F5F0058E68D /* ObjectFactoryMap.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -2010,6 +2022,7 @@
9086906D129AC67B00D3BD5D /* DspSqrt.cpp in Sources */,
9099A82D13D0437E0091E9FF /* MessageCputime.cpp in Sources */,
9099A83013D043D70091E9FF /* DspVCF.cpp in Sources */,
+ 90F3D68913F82F5F0058E68D /* ObjectFactoryMap.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -2150,6 +2163,7 @@
9086906F129AC67B00D3BD5D /* DspSqrt.cpp in Sources */,
9099A82E13D0437F0091E9FF /* MessageCputime.cpp in Sources */,
9099A83113D043D80091E9FF /* DspVCF.cpp in Sources */,
+ 90F3D68A13F82F5F0058E68D /* ObjectFactoryMap.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
@@ -23,6 +23,10 @@
#include "DspAdc.h"
#include "PdGraph.h"
+MessageObject *DspAdc::newObject(PdMessage *initMessage, PdGraph *graph) {
+ return new DspAdc(graph);
+}
+
DspAdc::DspAdc(PdGraph *graph) : DspObject(0, 0, 0, graph->getNumInputChannels(), graph) {
/* In order to avoid lots of <code>memcpy</code>ing to separate input buffers, all ADCs refer to
* the same input buffers.
View
@@ -28,10 +28,11 @@
class DspAdc : public DspObject {
public:
+ static MessageObject *newObject(PdMessage *initMessage, PdGraph *graph);
DspAdc(PdGraph *graph);
~DspAdc();
- const char *getObjectLabel();
+ static const char *getObjectLabel();
bool doesProcessAudio();
};
View
@@ -24,6 +24,10 @@
#include "DspAdd.h"
#include "PdGraph.h"
+MessageObject *DspAdd::newObject(PdMessage *initMessage, PdGraph *graph) {
+ return new DspAdd(initMessage, graph);
+}
+
DspAdd::DspAdd(PdMessage *initMessage, PdGraph *graph) : DspObject(2, 2, 0, 1, graph) {
constant = initMessage->isFloat(0) ? initMessage->getFloat(0) : 0.0f;
}
@@ -71,7 +75,6 @@ void DspAdd::onInletConnectionUpdate() {
void DspAdd::processMessage(int inletIndex, PdMessage *message) {
if (inletIndex == 1) {
if (message->isFloat(0)) {
- processDspWithIndex(blockIndexOfLastMessage, graph->getBlockIndex(message));
constant = message->getFloat(0);
}
}
View
@@ -39,10 +39,11 @@ enum DspAddCodePath {
class DspAdd : public DspObject {
public:
+ static MessageObject *newObject(PdMessage *initMessage, PdGraph *graph);
DspAdd(PdMessage *initMessage, PdGraph *graph);
~DspAdd();
- const char *getObjectLabel();
+ static const char *getObjectLabel();
string toString();
void processDsp();
@@ -23,6 +23,10 @@
#include "DspBandpassFilter.h"
#include "PdGraph.h"
+MessageObject *DspBandpassFilter::newObject(PdMessage *initMessage, PdGraph *graph) {
+ return new DspBandpassFilter(initMessage, graph);
+}
+
DspBandpassFilter::DspBandpassFilter(PdMessage *initMessage, PdGraph *graph) : DspObject(3, 1, 0, 1, graph) {
sampleRate = graph->getSampleRate();
tap_0 = 0.0f;
@@ -77,14 +81,12 @@ void DspBandpassFilter::processMessage(int inletIndex, PdMessage *message) {
}
case 1: {
if (message->isFloat(0)) {
- processDspWithIndex(blockIndexOfLastMessage, graph->getBlockIndex(message));
calculateFilterCoefficients(message->getFloat(0), q);
}
break;
}
case 2: {
if (message->isFloat(0)) {
- processDspWithIndex(blockIndexOfLastMessage, graph->getBlockIndex(message));
calculateFilterCoefficients(centerFrequency, message->getFloat(0));
}
break;
View
@@ -32,10 +32,11 @@
class DspBandpassFilter : public DspObject {
public:
+ static MessageObject *newObject(PdMessage *initMessage, PdGraph *graph);
DspBandpassFilter(PdMessage *initMessage, PdGraph *graph);
~DspBandpassFilter();
- const char *getObjectLabel();
+ static const char *getObjectLabel();
private:
void processMessage(int inletIndex, PdMessage *message);
View
@@ -23,6 +23,10 @@
#include "DspBang.h"
#include "PdGraph.h"
+MessageObject *DspBang::newObject(PdMessage *initMessage, PdGraph *graph) {
+ return new DspBang(initMessage, graph);
+}
+
DspBang::DspBang(PdMessage *initMessage, PdGraph *graph) : DspObject(1, 0, 1, 0, graph) {
// nothing to do
}
View
@@ -29,10 +29,11 @@
class DspBang : public DspObject {
public:
+ static MessageObject *newObject(PdMessage *initMessage, PdGraph *graph);
DspBang(PdMessage *initMessage, PdGraph *graph);
~DspBang();
- const char *getObjectLabel();
+ static const char *getObjectLabel();
ConnectionType getConnectionType(int outletIndex);
View
@@ -25,6 +25,10 @@
#include "DspThrow.h"
#include "PdGraph.h"
+MessageObject *DspCatch::newObject(PdMessage *initMessage, PdGraph *graph) {
+ return new DspCatch(initMessage, graph);
+}
+
DspCatch::DspCatch(PdMessage *initMessage, PdGraph *graph) : DspObject(0, 0, 0, 1, graph) {
if (initMessage->isSymbol(0)) {
name = StaticUtils::copyString(initMessage->getSymbol(0));
View
@@ -34,14 +34,15 @@ class DspThrow;
class DspCatch : public DspObject {
public:
+ static MessageObject *newObject(PdMessage *initMessage, PdGraph *graph);
DspCatch(PdMessage *initMessage, PdGraph *graph);
~DspCatch();
void addThrow(DspThrow *dspThrow);
void removeThrow(DspThrow *dspThrow);
char *getName();
- const char *getObjectLabel();
+ static const char *getObjectLabel();
ObjectType getObjectType();
string toString();
View
@@ -24,6 +24,10 @@
#include "DspClip.h"
#include "PdGraph.h"
+MessageObject *DspClip::newObject(PdMessage *initMessage, PdGraph *graph) {
+ return new DspClip(initMessage, graph);
+}
+
DspClip::DspClip(PdMessage *initMessage, PdGraph *graph) : DspObject(3, 1, 0, 1, graph) {
lowerBound = initMessage->isFloat(0) ? initMessage->getFloat(0) : -1.0f;
upperBound = initMessage->isFloat(1) ? initMessage->getFloat(1) : 1.0f;
@@ -60,40 +64,17 @@ void DspClip::onInletConnectionUpdate() {
void DspClip::processMessage(int inletIndex, PdMessage *message) {
switch (inletIndex) {
- case 1: {
- if (message->isFloat(0)) {
- processDspWithIndex(blockIndexOfLastMessage, graph->getBlockIndex(message));
- lowerBound = message->getFloat(0); // set the lower bound
- }
- break;
- }
- case 2: {
- if (message->isFloat(0)) {
- processDspWithIndex(blockIndexOfLastMessage, graph->getBlockIndex(message));
- upperBound = message->getFloat(0); // set the upper bound
- }
- break;
- }
- default: {
- break;
- }
+ case 1: if (message->isFloat(0)) lowerBound = message->getFloat(0); break; // set the lower bound
+ case 2: if (message->isFloat(0)) upperBound = message->getFloat(0); break; // set the upper bound
+ default: break;
}
}
void DspClip::processDsp() {
switch (codePath) {
- case DSP_CLIP_DSPX_MESSAGE0: {
- resolveInputBuffers(0, dspBufferAtInlet0);
- // allow fallthrough
- }
- case DSP_CLIP_DSP1_MESSAGE0: {
- processDspWithIndex(0, blockSizeInt);
- break;
- }
- default: {
- DspObject::processDsp();
- break;
- }
+ case DSP_CLIP_DSPX_MESSAGE0: resolveInputBuffers(0, dspBufferAtInlet0); // allow fallthrough
+ case DSP_CLIP_DSP1_MESSAGE0: processDspWithIndex(0, blockSizeInt); break;
+ default: DspObject::processDsp(); break;
}
}
View
@@ -36,10 +36,11 @@ enum DspClipCodePath {
class DspClip : public DspObject {
public:
+ static MessageObject *newObject(PdMessage *initMessage, PdGraph *graph);
DspClip(PdMessage *initMessage, PdGraph *graph);
~DspClip();
- const char *getObjectLabel();
+ static const char *getObjectLabel();
string toString();
void processDsp();
View
@@ -28,6 +28,10 @@
float *DspCosine::cos_table = NULL;
int DspCosine::refCount = 0;
+MessageObject *DspCosine::newObject(PdMessage *initMessage, PdGraph *graph) {
+ return new DspCosine(initMessage, graph);
+}
+
DspCosine::DspCosine(PdMessage *initMessage, PdGraph *graph) : DspObject(0, 1, 0, 1, graph) {
this->sampleRate = graph->getSampleRate();
refCount++;
View
@@ -29,10 +29,11 @@
class DspCosine : public DspObject {
public:
+ static MessageObject *newObject(PdMessage *initMessage, PdGraph *graph);
DspCosine(PdMessage *initMessage, PdGraph *graph);
~DspCosine();
- const char *getObjectLabel();
+ static const char *getObjectLabel();
void processDsp();
View
@@ -24,6 +24,10 @@
#include "DspDac.h"
#include "PdGraph.h"
+MessageObject *DspDac::newObject(PdMessage *initMessage, PdGraph *graph) {
+ return new DspDac(graph);
+}
+
DspDac::DspDac(PdGraph *graph) : DspObject(0, graph->getNumOutputChannels(), 0, 0, graph) {
// nothing to do
}
@@ -36,25 +40,26 @@ const char *DspDac::getObjectLabel() {
return "dac~";
}
-void DspDac::processDspWithIndex(int fromIndex, int toIndex) {
- float *globalOutputBuffer;
+void DspDac::processDsp() {
switch (incomingDspConnections.size()) {
default: {
/* TODO(mhroth): fit this into the new buffer reference architecture
for (int i = 2; i < numDspInlets; i++) {
- globalOutputBuffer = graph->getGlobalDspBufferAtOutlet(i);
+ float *globalOutputBuffer = graph->getGlobalDspBufferAtOutlet(i);
ArrayArithmetic::add(globalOutputBuffer, localDspBufferAtInlet[i], globalOutputBuffer, 0, blockSizeInt);
}
*/
// allow fallthrough
}
case 2: {
- globalOutputBuffer = graph->getGlobalDspBufferAtOutlet(1);
+ RESOLVE_DSPINLET1_IF_NECESSARY();
+ float *globalOutputBuffer = graph->getGlobalDspBufferAtOutlet(1);
ArrayArithmetic::add(globalOutputBuffer, dspBufferAtInlet1, globalOutputBuffer, 0, blockSizeInt);
// allow fallthrough
}
case 1: {
- globalOutputBuffer = graph->getGlobalDspBufferAtOutlet(0);
+ RESOLVE_DSPINLET0_IF_NECESSARY();
+ float *globalOutputBuffer = graph->getGlobalDspBufferAtOutlet(0);
ArrayArithmetic::add(globalOutputBuffer, dspBufferAtInlet0, globalOutputBuffer, 0, blockSizeInt);
// allow fallthrough
}
View
@@ -28,13 +28,13 @@
class DspDac : public DspObject {
public:
+ static MessageObject *newObject(PdMessage *initMessage, PdGraph *graph);
DspDac(PdGraph *graph);
~DspDac();
- const char *getObjectLabel();
+ static const char *getObjectLabel();
- private:
- void processDspWithIndex(int fromIndex, int toIndex);
+ void processDsp();
};
#endif // _DSP_DAC_H_
View
@@ -25,6 +25,10 @@
#include "DspDelayWrite.h"
#include "PdGraph.h"
+MessageObject *DspDelayRead::newObject(PdMessage *initMessage, PdGraph *graph) {
+ return new DspDelayRead(initMessage, graph);
+}
+
DspDelayRead::DspDelayRead(PdMessage *initMessage, PdGraph *graph) : DelayReceiver(1, 0, 0, 1, graph) {
if (initMessage->isSymbol(0) && initMessage->isFloat(1)) {
name = StaticUtils::copyString(initMessage->getSymbol(0));
@@ -51,7 +55,6 @@ ObjectType DspDelayRead::getObjectType() {
void DspDelayRead::processMessage(int inletIndex, PdMessage *message) {
if (message->isFloat(0)) {
// update the delay time
- processDspWithIndex(blockIndexOfLastMessage, graph->getBlockIndex(message));
delayInSamples = StaticUtils::millisecondsToSamples(message->getFloat(0), graph->getSampleRate());
delayInSamplesInt = (int) delayInSamples;
}
Oops, something went wrong.

0 comments on commit 63786a0

Please sign in to comment.