Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (408)
games submitted by our members
Games in WIP (293)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Java Game APIs & Engines / Java Sound & OpenAL / Re: 3D Sound Engine on: 2012-01-18 00:17:35
Hi I was hoping you could lend some clarity in why I cant get this to play wav's and mp3's?

Its playing midi files fine but wav's and mp3's from free wav sites seem to not work(Just using for testing atm) Ive tried about 5 different wav's from different sites and a few different mp3's so far

Im currently using the SoundSystemJPCT implementation as i dont need the sound in 3d so much as just a library that can play lots of formats

This is how im using your library
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
public class Sound 
{
    SoundSystemJPCT soundSystem = new SoundSystemJPCT();
   
    public static void main(String args[])
    {
        Sound sound = new Sound();
    }
    public Sound()
    {
        // Load some library and codec plug-ins:
       try
        {
            SoundSystemConfig.addLibrary( LibraryLWJGLOpenAL.class );
            SoundSystemConfig.addLibrary( LibraryJavaSound.class );
            SoundSystemConfig.setCodec( "wav", CodecWav.class );
            SoundSystemConfig.setCodec( "ogg", CodecJOgg.class );
            //SoundSystemConfig.setCodec( "ogg", CodecIBXM.class );
           //SoundSystemConfig.setCodec( "ogg", CodecJSpeex.class );
           //SoundSystemConfig.setCodec( "ogg", CodecJOrbis.class );
       }
        catch( SoundSystemException e )
        {
            System.err.println("error linking with the plug-ins" );
        }
        String filename[] = {"wonderland.wav","blind.wav","T Bird - Diggin' in the Dirt.mp3"};
       
        for(int i = 0; i < filename.length; i++)
        {  
            soundSystem.newSource( "Source "+i, filename[i], false );
            soundSystem.play( "Source "+i );
            sleep( 10000 );
        }
       
        soundSystem.cleanup();
}

This is the output I get from the debug window
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
Starting up SoundSystemJPCT...
Initializing LWJGL OpenAL
    (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
OpenAL initialized.

Error in class 'CodecWav'
    Unsupported audio format in method 'initialize'
    ERROR MESSAGE:
        could not get audio input stream from input stream
    STACK TRACE:
        javax.sound.sampled.AudioSystem.getAudioInputStream(AudioSystem.java:1102)
        paulscode.sound.codecs.CodecWav.initialize(CodecWav.java:128)
        paulscode.sound.libraries.LibraryLWJGLOpenAL.loadSound(LibraryLWJGLOpenAL.java:392)
        paulscode.sound.libraries.LibraryLWJGLOpenAL.newSource(LibraryLWJGLOpenAL.java:640)
        paulscode.sound.SoundSystem.CommandNewSource(SoundSystem.java:1800)
        paulscode.sound.SoundSystem.CommandQueue(SoundSystem.java:2415)
        paulscode.sound.CommandThread.run(CommandThread.java:121)
Error in class 'CodecWav'
    Audio input stream null in method 'readAll'
Error in class 'LibraryLWJGLOpenAL'
    Sound buffer null in method 'loadSound'
Error in class 'LibraryLWJGLOpenAL'
    Source 'Source 0' was not created because an error occurred while loading wonderland.wav
Error in class 'LibraryLWJGLOpenAL'
    Source 'Source 0' not found in method 'play'
Error in class 'CodecWav'
    Unsupported audio format in method 'initialize'
    ERROR MESSAGE:
        could not get audio input stream from input stream
    STACK TRACE:
        javax.sound.sampled.AudioSystem.getAudioInputStream(AudioSystem.java:1102)
        paulscode.sound.codecs.CodecWav.initialize(CodecWav.java:128)
        paulscode.sound.libraries.LibraryLWJGLOpenAL.loadSound(LibraryLWJGLOpenAL.java:392)
        paulscode.sound.libraries.LibraryLWJGLOpenAL.newSource(LibraryLWJGLOpenAL.java:640)
        paulscode.sound.SoundSystem.CommandNewSource(SoundSystem.java:1800)
        paulscode.sound.SoundSystem.CommandQueue(SoundSystem.java:2415)
        paulscode.sound.CommandThread.run(CommandThread.java:121)
Error in class 'CodecWav'
    Audio input stream null in method 'readAll'
Error in class 'LibraryLWJGLOpenAL'
    Sound buffer null in method 'loadSound'
Error in class 'LibraryLWJGLOpenAL'
    Source 'Source 1' was not created because an error occurred while loading blind.wav
Error in class 'LibraryLWJGLOpenAL'
    Source 'Source 1' not found in method 'play'
Error in class 'LibraryLWJGLOpenAL'
    No codec found for file 'T Bird - Diggin' in the Dirt.mp3' in method 'loadSound'
Error in class '
LibraryLWJGLOpenAL'
    Source '
Source 2' was not created because an error occurred while loading T Bird - Diggin' in the Dirt.mp3
Error in class 'LibraryLWJGLOpenAL'
    Source 'Source 2' not found in method 'play'

SoundSystemJPCT shutting down...
    Author: Paul Lamb, www.paulscode.com

How do i use the other codecs that are commented out? they arent in import paulscode.sound.codecs to import
also what should i use for mp3's?
Pages: [1]
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Browse for soundtracks for your game!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (131 views)
2013-05-17 21:29:12

alaslipknot (140 views)
2013-05-16 21:24:48

gouessej (170 views)
2013-05-16 00:53:38

gouessej (163 views)
2013-05-16 00:17:58

theagentd (174 views)
2013-05-15 15:01:13

theagentd (159 views)
2013-05-15 15:00:54

StreetDoggy (203 views)
2013-05-14 15:56:26

kutucuk (227 views)
2013-05-12 17:10:36

kutucuk (227 views)
2013-05-12 15:36:09

UnluckyDevil (230 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
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!
Page created in 0.073 seconds with 21 queries.