my music is cut off first few seconds

edited August 2017 in Library Questions

first, I'm sorry that I'm not good at English.

When I start program, and push play button, music(the mp3 file) plays well.

However, a few seconds in first(appromaximately 0.5 seconds) did not play.

My program environment is eclipse Neon.3 Release (4.6.3).

Also, I found that same code in processing, it has no problem!

I think the problem is relative to eclipse.

Anyone knows this problem?

-- add I tried to processing with JPanel.

`

public MinimSettings(UI frame) {
    this.frame = frame;
    ps = this.initSurface();
    ps.setSize(435, 96);
    SmoothCanvas smoothCanvas = (SmoothCanvas) ps.getNative();
    frame.ps.getSvPn().add(smoothCanvas);
    ps.startThread();
}
@ Override
public void settings(){ 
    size(435, 96); 
}

@ Override
public void setup() {
    minim = new Minim(this);
    player = minim.loadFile("/music/"+list[num].getName());
    background(246, 129, 129);
    stroke(246, 223, 223);
    fill(246, 129, 129, 200);
    frameRate(60);
    font = createFont("font/font.ttf", 36);
    textFont(font);
    delay(2000);
}

@ Override
public void draw() {
    fill(246,129,129, 160);
    noStroke();

    if (player.isPlaying()) {
        rect(0, 0, width, height);
        stroke(246, 223, 223);
        for (int i = 0; i < ms.getPlayer().bufferSize() - 6; i += 5) {
            float x1 = map(i, 0, ms.getPlayer().bufferSize(), 0, width);
            float x2 = map(i + 5, 0, ms.getPlayer().bufferSize(), 0, width);
            line(x1, height / 4 - ms.getPlayer().mix.get(i) * height / 4, x2,
                    height / 4 - ms.getPlayer().mix.get(i + 5) * height / 4);
        }
    }
    else rect(0, 0, width, height);

    fill(246,233,233);
    text(ms.getText(), x--, 80);
    if(x<-ms.getText().length()*36) x = 436;
    frame.ps.getSvPn().repaint();
}`
Tagged:

Answers

Sign In or Register to comment.