commit 106ae28df5eb2c320588e4cb7569d3dd417317bc
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Tue May 7 23:35:23 2019 +0100

    Progress with DistortedCube.

diff --git a/src/main/java/org/distorted/library/effectqueue/EffectQueue.java b/src/main/java/org/distorted/library/effectqueue/EffectQueue.java
index 467e716..5b09cc2 100644
--- a/src/main/java/org/distorted/library/effectqueue/EffectQueue.java
+++ b/src/main/java/org/distorted/library/effectqueue/EffectQueue.java
@@ -361,6 +361,13 @@ public abstract class EffectQueue implements InternalMaster.Slave
     return false;
     }
 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public int getNumEffects()
+    {
+    return mNumEffects;
+    }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
   public void doWork()
@@ -395,11 +402,12 @@ public abstract class EffectQueue implements InternalMaster.Slave
                          mCurrentDuration[mNumEffects] = 0;
                          mEffects[mNumEffects] = job.effect;
                          mName[mNumEffects] = job.effect.getName().ordinal();
+
+                         mNumEffects++;
+                         changed = true;
                          }
                        else if( position>=0 && position<=mNumEffects )
                          {
-                         //android.util.Log.e("queue", "adding new effect to pos "+position);
-
                          for(int j=mNumEffects; j>position; j--)
                            {
                            mCurrentDuration[j] = mCurrentDuration[j-1];
@@ -410,10 +418,10 @@ public abstract class EffectQueue implements InternalMaster.Slave
                          mCurrentDuration[position] = 0;
                          mEffects[position] = job.effect;
                          mName[position] = job.effect.getName().ordinal();
-                         }
 
-                       mNumEffects++;
-                       changed = true;
+                         mNumEffects++;
+                         changed = true;
+                         }
                        }
                      else
                        {
diff --git a/src/main/java/org/distorted/library/main/DistortedEffects.java b/src/main/java/org/distorted/library/main/DistortedEffects.java
index fc1d0ac..cf62b8b 100644
--- a/src/main/java/org/distorted/library/main/DistortedEffects.java
+++ b/src/main/java/org/distorted/library/main/DistortedEffects.java
@@ -218,4 +218,17 @@ public class DistortedEffects
     int num = effect.getType().ordinal();
     return mQueues[num].add(effect,position);
     }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/**
+ * Return number of effects of the given type currently in the Queue.
+ *
+ * @param type The EffectType.
+ * @return Number of effects of the given type currently in the Queue.
+ */
+  public int getNumEffects(EffectType type)
+    {
+    int num = type.ordinal();
+    return mQueues[num].getNumEffects();
+    }
   }
