Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (843)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Sound Looping  (Read 1175 times)
0 Members and 1 Guest are viewing this topic.
Offline new@java

Senior Newbie

Java games rock!

« Posted 2004-03-25 13:22:28 »


Can somebody please help me, i've got some code so that it plays a background sound, its working but i cannot get it to loop, it must be something simple, but any help will be appreciated.

thanks in advance


     protected void addBackgroundSound (BranchGroup b,String soundFile) {
         //Create a media container to load the file
           MediaContainer droneContainer = new MediaContainer(soundFile);
           //Create the background sound from the media container
           BackgroundSound drone = new BackgroundSound(droneContainer,1.0f);
           //Activate the sound
           //Set the sound to loop forever
           //Add it to the group

                 protected void addObjectSound(TransformGroup tg, PointSound sound,
                                         String soundFile, float edge) {
                       //First we get the current transform so that we can
                       //position the sound in the same place
                       Transform3D objXfm = new Transform3D();
                       Vector3f objPosition = new Vector3f();
                       //Create the media container to load the sound
                       MediaContainer soundContainer = new MediaContainer(soundFile);
                       //Use the loaded data in the sound
                       //Set the position to that of the given transform
                       sound.setPosition(new Point3f(objPosition));
                       //Allow use to switch the sound on and off

                       //Set it off to start with
                       //Set it to loop forever
                       //Use the edge value to set to extent of the sound
                       Point2f[] attenuation = {new Point2f(0.0f,1.0f),
                                         new Point2f(edge,0.1f)};
                       //Add the sound to the transform group
Offline Ifadolai

Junior Devvie

Java forever!!

« Reply #1 - Posted 2004-04-13 08:03:31 »

It is a bug:

Nikolai V. Christensen, Computer Engineer,
Simulation and Training department
IFAD, Forskerparken 10A, DK-5230 Odense M
Denmark, EU
Phone: +45 63 15 71 31  Fax: +45 65 93 29 99
Offline Herkules

Senior Devvie

Friendly fire isn't friendly!

« Reply #2 - Posted 2004-04-13 12:19:02 »

Somehow we did it ..... but I agree it wasn't a 'solution'...

look for  createAmbientSound()

HARDCODE    --     DRTS/FlyingGuns/JPilot/JXInput  --    skype me: joerg.plewe
Pages: [1]
  ignore  |  Print  

EgonOlsen (37 views)
2018-06-10 19:43:48

EgonOlsen (20 views)
2018-06-10 19:43:44

EgonOlsen (39 views)
2018-06-10 19:43:20

DesertCoockie (186 views)
2018-05-13 18:23:11

nelsongames (122 views)
2018-04-24 18:15:36

nelsongames (121 views)
2018-04-24 18:14:32

ivj94 (861 views)
2018-03-24 14:47:39

ivj94 (122 views)
2018-03-24 14:46:31

ivj94 (758 views)
2018-03-24 14:43:53

Solater (139 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!