--- a/src/FingersDance.Control.UserPanel/UserControlUserPanel.xaml.cs Thu Nov 19 18:37:26 2009 +0100
+++ b/src/FingersDance.Control.UserPanel/UserControlUserPanel.xaml.cs Thu Nov 19 18:05:52 2009 +0100
@@ -35,6 +35,8 @@
double lastdeltaOrientation = 0;
int lastSoundlevel = 0;
bool rise = true; //rise is true if the curse of the volume is positive
+ int LastElipseNB = 0;
+
#endregion
#region Properties
@@ -73,7 +75,7 @@
private void InitializeDefinitions()
{
- for (byte k = 1; k <= 5; k++)
+ for (byte k = 1; k <= 25; k++)
{
ByteTagVisualizationDefinition tagDef = new ByteTagVisualizationDefinition();
// The tag value that this definition will respond to.
@@ -107,17 +109,20 @@
TagVisuSoundControl tagsoundcontrol = (TagVisuSoundControl)e.TagVisualization;
deltaOrientation = (tagsoundcontrol.Orientation - baseOrientation) % 360;
+
if (deltaOrientation < 0)
deltaOrientation = 360 + deltaOrientation;
int niveau = (int)(deltaOrientation / 36);
+
+
//if (((niveau == 9) || (niveau == 8) || (niveau == 7)) && lastSoundlevel == 0)
if (((niveau == 9) || (niveau == 8)) && lastSoundlevel == 0)
rise = false;
//else if (((niveau == 1) || (niveau == 2) || (niveau == 3)) && lastSoundlevel == 0)
else if (((niveau == 1) || (niveau == 2)) && lastSoundlevel == 0)
rise = true;
-
+
if (!rise)
{
niveau = (niveau - 10) % 10;
@@ -125,21 +130,30 @@
//--Elipse visibility
int elipseNB = tagsoundcontrol.TagVisuSoundLevelUpdate(niveau);
//Set the Sound of the Player.
- if(elipseNB != -1)
+ if ((LastElipseNB <1 && deltaOrientation - lastdeltaOrientation < 0) || (LastElipseNB > 9 && deltaOrientation - lastdeltaOrientation > 0))
+ baseOrientation += deltaOrientation - lastdeltaOrientation;
+ else
{
- UserControlSyncSource.setUserPlayerVolume(elipseNB/10.0);
+ if (elipseNB != -1)
+ {
+ UserControlSyncSource.setUserPlayerVolume(elipseNB / 10.0);
+ lastSoundlevel = niveau;
+ LastElipseNB = elipseNB;
+ tagsoundcontrol.volumeModel.Content = (elipseNB / 10.0).ToString();
+ lastdeltaOrientation = deltaOrientation;
+ }
}
- lastSoundlevel = niveau;
- tagsoundcontrol.volumeModel.Content = elipseNB;//deltaOrientation.ToString();
+ }
- }
private void OnVisualizationAdded(object sender, TagVisualizerEventArgs e)
{
TagVisuSoundControl tagsoundcontrol = (TagVisuSoundControl)e.TagVisualization;
-
+ LastElipseNB = 5;
+ lastdeltaOrientation = 0;
+
switch (tagsoundcontrol.VisualizedTag.Byte.Value)
{
- case 1:
+ case 24:
try
{
/*