finnkuusisto / TinySound

Simple library for playing sounds and music in Java
http://finnkuusisto.github.com/TinySound
BSD 2-Clause "Simplified" License
99 stars 26 forks source link

Sound stops #13

Closed madster456 closed 10 years ago

madster456 commented 11 years ago

Hey, So I have used this in a few different projects, and in all of them when I run the game or what ever it is im running, it will load with no errors, or anything, will load the song, and will only play X amount of time in the song/sound. Any idea? I have not tried to use any other sound file, only .wav files

finnkuusisto commented 11 years ago

Hmm, could you post some code? I haven't heard of this problem before. Ideally, it would be some minimum amount of code to reproduce the error.

SanatKeys commented 11 years ago

Yes, I have this same problem too. I tried it on two computers, one desktop running Windows Vista, and one laptop running Windows 7. Both had exactly the same problem. I even tried reverting to TinySound 1.0 instead of the newest version 1.1.0, but I still had the same problem. I'm using Eclipse as my IDE, and I loaded the tinysound.jar to the build path of my project, and importing and everything works fine, there's no errors or anything. I used your example code exactly as written (with the exception of the wav file names). I ran the program, everything worked fine for about 10 seconds, and then the program terminated suddenly.

Also, I tried to load just a music file, and that fared even worse. The program ran for about a second, and then it stopped, without playing the wav file. Here is the code I used:

import kuusisto.tinysound.Music;
import kuusisto.tinysound.TinySound;

public class TinySoundTest {

    public static void main(String[] args) {
        //initialize TinySound
        TinySound.init();
        //load a sound and music
        //note: you can also load with Files, URLs and InputStreams
        Music song = TinySound.loadMusic("NewYorkSixty.wav");
        //start playing the music on loop
        song.play(true);
        //be sure to shutdown TinySound when done
        TinySound.shutdown();
    }

}

This is the example code without the sound effect component. I hope this makes the problem clearer! If you need any clarifications just let me know.

madster456 commented 11 years ago

SanatKeys, I was able to fix my problem. I will pull up my code(need to find it) and show you the way I did it.

finnkuusisto commented 11 years ago

Cool. If you post your solution, @madster456, it may help me figure out what was going on in the first place.

madster456 commented 11 years ago

Sure thing. I need to dig around for it. Will try to get it this week

finnkuusisto commented 10 years ago

I just came back to look at this. @SanatKeys, are you sure it isn't just terminating properly? You said that the example code that I provide stops working after ~10 seconds. If you look at the loop logic, it's only supposed to run for 20 seconds anyway.

madster456 commented 10 years ago

Looking back at my code for my game.. Thats exactly what happened. It was running for 20 seconds, why I didn't pay attention to that, I have no clue, but I hope that fixes your issue @SanatKeys

finnkuusisto commented 10 years ago

I'm going to close this issue since the original problem was resolved.