osc.js 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. /*
  2. The MIT License (MIT)
  3. Copyright (c) 2014-2020 Nikolai Suslov and the Krestianstvo.org project contributors. (https://github.com/NikolaySuslov/livecodingspace/blob/master/LICENSE.md)
  4. */
  5. // VWF & OSC model driver
  6. import { Fabric } from '/core/vwf/fabric.js';
  7. class OSCModel extends Fabric {
  8. constructor(module) {
  9. console.log("OSCModel constructor");
  10. super(module, "Model");
  11. }
  12. factory() {
  13. let _self_ = this;
  14. return this.load( this.module,
  15. {
  16. // == Module Definition ====================================================================
  17. // -- pipeline -----------------------------------------------------------------------------
  18. // pipeline: [ log ], // vwf <=> log <=> scene
  19. // -- initialize ---------------------------------------------------------------------------
  20. initialize: function() {
  21. this.objects = {}; // maps id => { property: value, ... }
  22. self = this;
  23. this.osc = null;
  24. //window._OSCModel = this;
  25. },
  26. // == Model API ============================================================================
  27. // -- creatingNode -------------------------------------------------------------------------
  28. creatingNode: function( nodeID, childID, childExtendsID, childImplementsIDs,
  29. childSource, childType, childURI, childName, callback /* ( ready ) */ ) {
  30. },
  31. // -- deletingNode -------------------------------------------------------------------------
  32. deletingNode: function( nodeID ) {
  33. },
  34. // -- addingChild --------------------------------------------------------------------------
  35. addingChild: function( nodeID, childID, childName ) {
  36. },
  37. // -- removingChild ------------------------------------------------------------------------
  38. removingChild: function( nodeID, childID ) {
  39. },
  40. // -- parenting ----------------------------------------------------------------------------
  41. parenting: function( nodeID ) {
  42. },
  43. // -- childrening --------------------------------------------------------------------------
  44. childrening: function( nodeID ) {
  45. },
  46. // -- naming -------------------------------------------------------------------------------
  47. naming: function( nodeID ) {
  48. },
  49. // -- creatingProperty ---------------------------------------------------------------------
  50. creatingProperty: function( nodeID, propertyName, propertyValue ) {
  51. // var object = this.objects[nodeID] || ( this.objects[nodeID] = {} );
  52. // return object[propertyName] = propertyValue;
  53. },
  54. // -- initializingProperty -----------------------------------------------------------------
  55. initializingProperty: function( nodeID, propertyName, propertyValue ) {
  56. // var object = this.objects[nodeID] || ( this.objects[nodeID] = {} );
  57. // return object[propertyName] = propertyValue;
  58. },
  59. // TODO: deletingProperty
  60. // -- settingProperty ----------------------------------------------------------------------
  61. settingProperty: function( nodeID, propertyName, propertyValue ) {
  62. // var object = this.objects[nodeID] || ( this.objects[nodeID] = {} );
  63. // return object[propertyName] = propertyValue;
  64. },
  65. // -- gettingProperty ----------------------------------------------------------------------
  66. gettingProperty: function( nodeID, propertyName, propertyValue ) {
  67. // var object = this.objects[nodeID];
  68. // return object && object[propertyName];
  69. },
  70. // -- creatingMethod -----------------------------------------------------------------------
  71. creatingMethod: function( nodeID, methodName, methodParameters, methodBody ) {
  72. },
  73. // TODO: deletingMethod
  74. // -- callingMethod ------------------------------------------------------------------------
  75. callingMethod: function( nodeID, methodName, methodParameters ) {
  76. // if (methodName == 'sendOSC') {
  77. // if (this.osc == null) {
  78. // this.osc = _OSCManager;
  79. // }
  80. // // var msg = {
  81. // // address: "/hello/from/oscjs",
  82. // // args: [Math.random()]
  83. // // };
  84. // this.osc.port.send(methodParameters);
  85. // console.log('send: ' + methodParameters);
  86. // }
  87. },
  88. // -- creatingEvent ------------------------------------------------------------------------
  89. creatingEvent: function( nodeID, eventName, eventParameters ) {
  90. },
  91. // TODO: deletingEvent
  92. // -- firingEvent --------------------------------------------------------------------------
  93. firingEvent: function( nodeID, eventName, eventParameters ) {
  94. },
  95. // -- executing ----------------------------------------------------------------------------
  96. executing: function( nodeID, scriptText, scriptType ) {
  97. }
  98. } );
  99. }
  100. }
  101. export {
  102. OSCModel as default
  103. }