de en es fr
Let the machine help
Light teasing, exhibition, BDSM, sissyfication, watersports... with sounds and pictures


Post new topic Reply to topic  [ 1 post ] 
Author Message
 Metronome Function
PostPosted: Fri Sep 26, 2014 10:23 pm 
Offline
Active member
Hey so I just wanted to add some code that works as a BPM based metronome that can be added to a script via a class. I've called it using "ss.playMetronome(this);". Any new functions you create for your script could also live within that class file as long as you refrence ss.functionetc();

Only use the import class code once in your main script. I'm thinking of rolling up my functions into a func_beta.groovy file so they can be shared with everyone writing repeat code (like metronomes). Instead of working out how to code a metronome, you just call ss.playMetronome(this);

myscript.groovy
Code:
// IMPORT CLASS
def si = new groovy.lang.GroovyClassLoader(); si.addClasspath("scripts/myscript/");
def ss = si.loadClass("Functions");

// PLAY METRONOME ... for 10 secs at 240BPM
int sCount = ss.playMetronome(this, 10, 240);
show("You just stroked " +sCount+" times."); wait(5);


scripts/myscript/Functions.groovy
Code:
class Functions {
   
   // Metronome method speed in BPM, runtime in seconds ...
   def static playMetronome(main, ON = 30, BPM = 60) {
      
      def BPS = BPM / 60;
      def strokes = BPS * ON;
      int speed = ((60 / BPM) * 1000);
      
      (1..strokes).each {
         main.playBackgroundSound("tom.wav");
         main.sleep(speed);
      }
      
      return strokes;
   }
}


The more I think about the thuddy sound of metronomes for stroking the more I think there should be a "swooshy beat" sound file for girls. Less thud .. thud .. thud, more swoosh from side to side.


Top
 Profile Send private message 
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Maroon Fusion theme created by Oxydo
Software, theme modifications, phpBB modification by Doti 2010 - 2020
This website uses session cookies only.