Processing 如何在处理中自动启动另一首背景歌曲?

Processing 如何在处理中自动启动另一首背景歌曲?,processing,Processing,当歌曲(同意的年龄)结束时,我如何在歌曲结束后开始另一首歌曲?这就是我目前所拥有的 import processing.sound.*; SoundFile file; void setup() { file = new SoundFile(this, "neworder.mp3"); file.play(); file.amp(0.25); } setup()方法在处理过程中只调用一次。当处理开始运行时,它会在循环中连续调用内置的draw()方法 在这里,您需要检查歌曲是否已

当歌曲(同意的年龄)结束时,我如何在歌曲结束后开始另一首歌曲?这就是我目前所拥有的

import processing.sound.*;
SoundFile file; 

void setup() {
  file = new SoundFile(this, "neworder.mp3");
  file.play();
  file.amp(0.25);
}
setup()方法在处理过程中只调用一次。当处理开始运行时,它会在循环中连续调用内置的draw()方法

在这里,您需要检查歌曲是否已完成并加载新歌曲

void draw() {
    background(200, 100, 50,255);

     // YOUR CODE HERE TO CHECK IF SONG HAS FINISHED AND PLAY A BETTER SONG LIKE PO BOYDs - BLUE THREE ;)
}
setup()方法在处理过程中只调用一次。当处理开始运行时,它会在循环中连续调用内置的draw()方法

在这里,您需要检查歌曲是否已完成并加载新歌曲

void draw() {
    background(200, 100, 50,255);

     // YOUR CODE HERE TO CHECK IF SONG HAS FINISHED AND PLAY A BETTER SONG LIKE PO BOYDs - BLUE THREE ;)
}
不幸的是,这个类中有一些有用的功能,比如or

你可以这样说:

import processing.sound.*;
SoundFile file; 

void setup() {
  file = new SoundFile(this, "neworder.mp3");
  file.play();
  file.amp(0.25);
}

void draw(){
   if(file.percent() >= 99.8){
      println("track pretty close to done: cue out / cross fade here");
      file.stop();
   }

   background(0);
   text(file.percent(),5,15);
}
然后,您可以加载/播放其他曲目,或者更好:

  • setup()
    中加载两首曲目,但只播放一首
  • 当第一首曲目接近完成时,以0音量开始第二首曲目
  • 用于插值第一个轨迹的体积向下和反转的体积值,以使第二个轨迹具有良好的交叉淡入度
  • 玩得开心

    不幸的是,该类的一些有用功能,如或

    你可以这样说:

    import processing.sound.*;
    SoundFile file; 
    
    void setup() {
      file = new SoundFile(this, "neworder.mp3");
      file.play();
      file.amp(0.25);
    }
    
    void draw(){
       if(file.percent() >= 99.8){
          println("track pretty close to done: cue out / cross fade here");
          file.stop();
       }
    
       background(0);
       text(file.percent(),5,15);
    }
    
    然后,您可以加载/播放其他曲目,或者更好:

  • setup()
    中加载两首曲目,但只播放一首
  • 当第一首曲目接近完成时,以0音量开始第二首曲目
  • 用于插值第一个轨迹的体积向下和反转的体积值,以使第二个轨迹具有良好的交叉淡入度
  • 玩得开心