Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (521)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (589)
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-17 23: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]
 

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

The first screenshot will be displayed as a thumbnail.

xFryIx (52 views)
2014-11-13 12:34:49

digdugdiggy (34 views)
2014-11-12 21:11:50

digdugdiggy (29 views)
2014-11-12 21:10:15

digdugdiggy (23 views)
2014-11-12 21:09:33

kovacsa (46 views)
2014-11-07 19:57:14

TehJavaDev (50 views)
2014-11-03 22:04:50

BurntPizza (49 views)
2014-11-03 18:54:52

moogie (65 views)
2014-11-03 06:22:04

CopyableCougar4 (63 views)
2014-11-01 23:36:41

DarkCart (148 views)
2014-11-01 14:51:03
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org 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‑gaming.org
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!