Author Topic: 3D Sound System issue with .ogg  (Read 2514 times)

Offline the_daen

  • bit
  • Posts: 2
    • View Profile
3D Sound System issue with .ogg
« on: June 01, 2012, 01:23:46 AM »
Hello Paul!

I seem to be experiencing a bit of an issue playing any OGG file in 3D space whether I move the source or the listener. Currently I'm using the LWJGLOpenAL library and the JOrbis codec. WAV files seem to have no issue playing in 3D space with the JavaSound library and WAV codec. Could it be the library?

Here's the code I'm testing with (Just a modified version of your example #2):
Code: newbielink:javascript:void(0); [nonactive]
import paulscode.sound.SoundSystem;
import paulscode.sound.SoundSystemConfig;
import paulscode.sound.SoundSystemException;
import paulscode.sound.libraries.LibraryLWJGLOpenAL;
import paulscode.sound.codecs.CodecJOrbis;

/**
 *  Plays background music and explosions in 3D.
 **/
public class Example_2
{
    public static void main( String[] args )
    {
        new Example_2();
    }

    public Example_2()
    {
        try
        {
            SoundSystemConfig.addLibrary( LibraryLWJGLOpenAL.class );
            SoundSystemConfig.setCodec( "ogg", CodecJOrbis.class );
        }
        catch( SoundSystemException e )
        {
            System.err.println("error linking with the pluggins" );
        }
        // Instantiate the SoundSystem:
        SoundSystem mySoundSystem = new SoundSystem();

        // wait a bit before playing the explosions:
        sleep( 2000 );
        // play 15 explosions, right and left:
        for( int x = 0; x < 15; x++ )
        {
            // If x is divisible by 2, play to the right:
            if( x % 2 == 0 )
                mySoundSystem.quickPlay( false, "explosion.ogg", false,
                                         20, 0, 0,
                                         SoundSystemConfig.ATTENUATION_ROLLOFF,
                                         SoundSystemConfig.getDefaultRolloff()
                                        );
            // Otherwise play to the left:
            else
                mySoundSystem.quickPlay( false, "explosion.ogg", false,
                                         -20, 0, 0,
                                         SoundSystemConfig.ATTENUATION_ROLLOFF,
                                         SoundSystemConfig.getDefaultRolloff()
                                        );

            // wait a bit so the explosions don't all start at once
            sleep( 500 );
        }
        // Wait a few seconds:
        sleep( 10000 );

        // Shut down:
        mySoundSystem.cleanup();
    }

    public void sleep( long milliseconds )
    {
        try
        {
            Thread.sleep( milliseconds );
        }
        catch( Exception e )
        {}
    }
}

Offline the_daen

  • bit
  • Posts: 2
    • View Profile
Re: 3D Sound System issue with .ogg
« Reply #1 on: June 01, 2012, 01:32:08 AM »
Nevermind.....my bad. Turns out the audio converter I used turned the ogg files into stereo. Forcing them back to mono in audacity worked just fine. ^^