[jmsl] oops, nutha thing

jmsl at music.columbia.edu jmsl at music.columbia.edu
Wed Jul 16 00:20:01 EDT 2008


Hello J

I think you've uncovered a bug in Player. Thanks for reporting it!  I 
can verify that a MusicShape's startDelay is indeed not properly 
scheduled by Player, and I will fix it.

Meanwhile you can easily make a SequentialCollection act like a Player 
by overriding its start() method, iterating through its children, and 
setting the Instrument of each to it own Instrument. 

Here's a fully functional example:

/*
 * Created on Jul 15, 2008 by Nick
 *
 */
package misc;

import java.util.Enumeration;

import com.softsynth.jmsl.*;

public class DelayTest {
    public static void main(String[] args) {
        SequentialCollection player = new SequentialCollection() {
            public double start(double playTime) throws 
InterruptedException {
                super.start(playTime);
                for (Enumeration e = getChildren().elements(); 
e.hasMoreElements();) {
                    ((MusicJob) 
e.nextElement()).setInstrument(getInstrument());
                }
                return playTime;
            }
        };
        player.setInstrument(new PrintIns());
        MusicShape s = new MusicShape(4);
        s.prefab(4);
        player.add(s);
        s.setStartDelay(2.0);
        System.out.println("launch time: " + JMSL.now());
        player.launch(JMSL.now());
    }
}

class PrintIns extends InstrumentAdapter {
    public double play(double playTime, double timestretch, double[] dar) {
        System.out.println("playing " + JMSL.realTime());
        return playTime + dar[0] * timestretch;
    }
}

Thanks
Nick Didkovsky


jmsl at music.columbia.edu wrote:
> I've just noticed something strange.
>
> In the following snippet:
>
> shape.setStartDelay(2.5);
> player.add(shape);
> player.launch(JMSL.now());
>
>
> "shape" is just a MusicShape and "player" is a Player, but when I 
> launch the player, it seems to ignore the startDelay setting, and 
> plays the shape right away. Does the Player somehow change the 
> MusicShape's startDelay, or just ignore it? I'll probably be wanting 
> the Player to play a sequence of MusicShapes, some of which may have 
> different startDelays... Am I missing something?
>
> J.
> _______________________________________________
> jmsl mailing list
> jmsl at music.columbia.edu
> http://music.columbia.edu/mailman/listinfo/jmsl


More information about the jmsl mailing list