just a test

Dependencies:   mbed

Fork of scoreLight_Advanced by Alvaro Cassinelli

Revision:
30:d8af03f01cd4
Parent:
25:74cb85b85fd2
Child:
31:5f039cbddee8
--- a/soundSpot.cpp	Wed Jun 20 03:25:49 2012 +0000
+++ b/soundSpot.cpp	Fri Sep 21 10:02:35 2012 +0000
@@ -1,94 +1,94 @@
-#include "soundSpot.h"
-
-// Constructor:
-soundSpot::soundSpot() { // by default, the child constructor call the parameterless default constructor (we could force another by doing: soundSpot::soundSpot : LivingSpot (params...) { ..}
- 
-// DEFAULT sending mode will be all off:
-stopAllSending();
-resetAllSendingModes();
-
-initCommonVariables();
-
-// initialize timer for sending OSC data:
-periodSendingData=25;// by default, we send the data every 25 ms. Note: the "data" to send will of course depend on the kind of blob. That will be therefore re-set when 
-// instantiating the kind of blob. 
-measureSendPeriod.start();
-}
-
-// IMPORTANT: the destructor of the base class is virtual, but it won't be implemented with the same name in the child class; therefore, it 
-// must be implemented in the base class (and it will be called when using delete of the child, first the delete child, then delete base)
-soundSpot::~soundSpot() {
-}
-    
-void soundSpot::setColor(unsigned char c) {
-    blobColor=0x07&c; // we will use the first three bits to set the RGB colors.
-    // NOTE: it may be better to have always the red on?
-}
-
-void soundSpot::initCommonVariables() {
-   firstTimeNoTouch=true;
-    // randomForce.set(1,0);// first time there won't be any force, or random force
-    // randomForce=randomForce.getRotatedDeg(1.0*(rand()%360));
-    // randomForce.normalize();
-
-    noTouchedCounter=0;
-    wallCounter=0;
-    blobWallCollision=false;
-    //slidingDirection=true; //  (will change when touching wall)
-    
-    gravity.set(0,0);
-    
-     render=true;
-     standByMode=false;
-}
-
- void soundSpot::resetAllSendingModes() {
-  // RESET SENDING DATA:
-  sendingOnlyWhenTouch=false;
- // (a) anchor mass data: 
-  sendingAnchorPosition=false;
-  sendingAnchorForce=false; // this is the total force on the anchor mass, not just the recentering force
-  sendingAnchorTouchWall=false;
-  // (b) data from blob points:
-  sendingLoopPositions=false;
-  sendingLoopForces=false;// this is not just the forces from light, but all the forces in each particle
-  sendingLoopForcesLight=false;// forces only from light
-  sendingLoopRegions=false; // from this we can detect "hits"
-  sendingLoopTouchWall=false;
-  // (c) Blob geometry:
-  sendingBlobArea=false;
-  sendingBlobNormals=false;
-  sendingBlobAngles=false; // redundant with sendingBlobNormals, but simplified (only angle of normal)
-  sendingKineticEnergy=false;
-  // (d) Light sensing statistics: 
-  sendingBlobMaxMin=false;
-  sendingLightForce=false; // the total light force
-  sendingTouched=false;
-  // (e) Recentering vector: (note: redundant with sendingLightForce, IF the correction angle is known). 
-  sendingRecenteringVector=false;
-  sendingRecenteringAngle=false;
-  sendingRecenteringNorm=false;
- }
-
- void soundSpot::stopAllSending() {
- // STOP HARDWARE SENDING MODE (per spot):
- sendSerial=false;
- sendOSC=true;
- }
-  
- void soundSpot::sendData(void) { // send data common to all kind of blobs 
-    // send common things, such as testing if it is the right time to send data:
-   
-    if (measureSendPeriod.read_ms()>periodSendingData) {
-            measureSendPeriod.stop();
-            measureSendPeriod.reset();
-
-          // Send data specific to the derived class:
-           if ((sendingOnlyWhenTouch==false)||(blobWallCollision==true)||(displaySensingBuffer.lightTouched==true))
-            sendDataSpecific(); // this will depend on the kind of blob
-        
-            measureSendPeriod.start();
-        }
-   
-} 
-
+#include "soundSpot.h"
+
+// Constructor:
+soundSpot::soundSpot() { // by default, the child constructor call the parameterless default constructor (we could force another by doing: soundSpot::soundSpot : LivingSpot (params...) { ..}
+ 
+// DEFAULT sending mode will be all off:
+stopAllSending();
+resetAllSendingModes();
+
+initCommonVariables();
+
+// initialize timer for sending OSC data:
+periodSendingData=25;// by default, we send the data every 25 ms. Note: the "data" to send will of course depend on the kind of blob. That will be therefore re-set when 
+// instantiating the kind of blob. 
+measureSendPeriod.start();
+}
+
+// IMPORTANT: the destructor of the base class is virtual, but it won't be implemented with the same name in the child class; therefore, it 
+// must be implemented in the base class (and it will be called when using delete of the child, first the delete child, then delete base)
+soundSpot::~soundSpot() {
+}
+    
+void soundSpot::setColor(unsigned char c) {
+    blobColor=0x07&c; // we will use the first three bits to set the RGB colors.
+    // NOTE: it may be better to have always the red on?
+}
+
+void soundSpot::initCommonVariables() {
+   firstTimeNoTouch=true;
+    // randomForce.set(1,0);// first time there won't be any force, or random force
+    // randomForce=randomForce.getRotatedDeg(1.0*(rand()%360));
+    // randomForce.normalize();
+
+    noTouchedCounter=0;
+    wallCounter=0;
+    blobWallCollision=false;
+    //slidingDirection=true; //  (will change when touching wall)
+    
+    gravity.set(0,0);
+    
+     render=true;
+     standByMode=false;
+}
+
+ void soundSpot::resetAllSendingModes() {
+  // RESET SENDING DATA:
+  sendingOnlyWhenTouch=false;
+ // (a) anchor mass data: 
+  sendingAnchorPosition=false;
+  sendingAnchorForce=false; // this is the total force on the anchor mass, not just the recentering force
+  sendingAnchorTouchWall=false;
+  // (b) data from blob points:
+  sendingLoopPositions=false;
+  sendingLoopForces=false;// this is not just the forces from light, but all the forces in each particle
+  sendingLoopForcesLight=false;// forces only from light
+  sendingLoopRegions=false; // from this we can detect "hits"
+  sendingLoopTouchWall=false;
+  // (c) Blob geometry:
+  sendingBlobArea=false;
+  sendingBlobNormals=false;
+  sendingBlobAngles=false; // redundant with sendingBlobNormals, but simplified (only angle of normal)
+  sendingKineticEnergy=false;
+  // (d) Light sensing statistics: 
+  sendingBlobMaxMin=false;
+  sendingLightForce=false; // the total light force
+  sendingTouched=false;
+  // (e) Recentering vector: (note: redundant with sendingLightForce, IF the correction angle is known). 
+  sendingRecenteringVector=false;
+  sendingRecenteringAngle=false;
+  sendingRecenteringNorm=false;
+ }
+
+ void soundSpot::stopAllSending() {
+ // STOP HARDWARE SENDING MODE (per spot):
+ sendSerial=false;
+ sendOSC=true;
+ }
+  
+ void soundSpot::sendData(void) { // send data common to all kind of blobs 
+    // send common things, such as testing if it is the right time to send data:
+   
+    if (measureSendPeriod.read_ms()>periodSendingData) {
+            measureSendPeriod.stop();
+            measureSendPeriod.reset();
+
+          // Send data specific to the derived class:
+           if ((sendingOnlyWhenTouch==false)||(blobWallCollision==true)||(displaySensingBuffer.lightTouched==true))
+            sendDataSpecific(); // this will depend on the kind of blob
+        
+            measureSendPeriod.start();
+        }
+   
+} 
+