Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (534)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 ... 5 6 [7] 8
  ignore  |  Print  
  3D Sound Engine  (Read 78262 times)
0 Members and 1 Guest are viewing this topic.
Offline paulscode

Senior Member


Medals: 11


Staff Sergeant


« Reply #180 - Posted 2011-09-09 22:04:50 »

Yes, same out of both sides.

We love death.  The US loves life.  That is the difference between us.  -Osama bin Laden, mass murderer
Offline Rejechted

Senior Member


Medals: 1
Projects: 1


Just a guy making some indie games :D


« Reply #181 - Posted 2011-09-09 22:42:22 »

Yes, same out of both sides.

Do you have any experience with converting stereo to mono, I've read that it gives you two half-volume tracks.  I guess this is just a natural side effect of how the wav was initially designed.

I actually got everything to work just fine.  Is a No-attenuation (ambient) sample required to have a stereo track?  I tried playing my death sound as an ambient sound at position 0,0,0 attenuation_none, but it would still be position-based for some reason.  When I made the track stereo, it worked.

Blog for our project (Codenamed Lead Crystal): http://silvergoblet.tumblr.com
Offline paulscode

Senior Member


Medals: 11


Staff Sergeant


« Reply #182 - Posted 2011-09-10 14:52:26 »

I believe for OpenAL that ambient sounds should be stereo (I'd have to verify that).  Alternately you can position them wherever the listener is at (which can be problematic if the listener moves).  I'll have to look at the code for LibraryJavaSound (I thought I was checking for ATTENUATION_NONE, and not panning in that case, but it's been a while since I looked at that part of the code)

We love death.  The US loves life.  That is the difference between us.  -Osama bin Laden, mass murderer
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Rejechted

Senior Member


Medals: 1
Projects: 1


Just a guy making some indie games :D


« Reply #183 - Posted 2011-09-24 01:54:41 »

Hey, paul.  So far everything is working great!

Question though.  I like how I can name my BGM source, and then fade it out.  My question though.  I have a bunch of Scene objects that are the different "states" the game can be in (main menu, map editor, game), and we want them to have different background music.  Scenes have an "entered" and a "exited" method, and currently it looks like this (example shown is gamescene)

1  
2  
3  
4  
5  
6  
7  
8  
9  
    
public void sceneEntered() {
    OpenGLGameWindow.getInstance().setCursor(OpenGLGameWindow.CursorType.RETICULE);
    Game.sound.backgroundMusic("GameBGM", "gameBGM.ogg", true);
}

public void sceneExited() {
    Game.sound.fadeOut("GameBGM", null, "gameBGM.ogg", 1000);
}


This results in a clipping though when we start the new Game.sound.background music in the main menu (using a different source name.  The disadvantage though is that if we were to use Game.sound.fadeOutIn() in sceneExited, we'd have to know the scene we are switching to (probably a useful feature we'll eventually have anyway).  But for now, is there a way you know of that we'd be able to fade IN the background music source, short of some weird hack?

Blog for our project (Codenamed Lead Crystal): http://silvergoblet.tumblr.com
Offline paulscode

Senior Member


Medals: 11


Staff Sergeant


« Reply #184 - Posted 2011-09-24 05:02:20 »

One option, with your current setup, could be to start up a temporary thread from new scene's sceneEntered() method, which checks if the music source is still playing (from a while loop, with say 30ms sleep in each iteration in order not to peg the CPU).  When you leave the previous scene in sceneExited(), do a fadeOut like you have now.  Once the source is finished playing, the thread can do a fadeIn with the new music file, and then kill itself.

A more efficient way that might work if it can fit into your infrastructure, would be to do a fadeOutIn from the new scene's sceneEntered() method, rather than doing the fadeOut from the previous scene's sceneExited() method.

We love death.  The US loves life.  That is the difference between us.  -Osama bin Laden, mass murderer
Offline Rejechted

Senior Member


Medals: 1
Projects: 1


Just a guy making some indie games :D


« Reply #185 - Posted 2011-09-24 16:02:18 »

FadeOutIn only requires the new source name and sample name, if I recall, so I think this would be a bit more elegant.

Blog for our project (Codenamed Lead Crystal): http://silvergoblet.tumblr.com
Offline davedes
« Reply #186 - Posted 2011-10-10 00:24:46 »

Hi Paul,

Something I noticed you haven't taken into consideration is OpenAL's AL_SOURCE_RELATIVE feature. A RELATIVE (as opposed to ABSOLUTE) source will always be positioned relative to the listener's position. So if your mono file is at <0,0,0> and you move your listener, as long as the source position is RELATIVE instead of ABSOLUTE, the sound will be played as if it were an ambient sound (i.e. with no 3D effects, since it's being played at the same spot as the listener). e.g. With default listener orientation, a relative source at <5,0,0> will always pan to the right speaker, even if the listener moves about.

In my own extension of your library I've done a little something like this for SourceLWJGLOpenAL:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
    public void setRelative(boolean relative) {
        this.relative = relative;
        // make sure we are assigned to a channel:
       if (channel != null && channel.attachedSource == this
                && channelOpenAL != null && channelOpenAL.ALSource != null) {
            AL10.alSourcei(channelOpenAL.ALSource.get(0),
                    AL10.AL_SOURCE_RELATIVE,
                    relative ? AL10.AL_TRUE : AL10.AL_TRUE);
            checkALError();
        }
    }

    public boolean isRelative() {
        return relative;
    }


And inside play()...
1  
2  
3  
... as we are initializing the source information ...
                AL10.alSourcei(id, AL10.AL_SOURCE_RELATIVE, isRelative() ? AL10.AL_TRUE : AL10.AL_FALSE);
                checkALError();



To add the same functionality to SourceJavaSound, I adjusted the values used when calculating pan/pitch/gain based on whether isRelative() returns true.

I also extended your sound system with other features such as seeking and acquiring the length of a non-streamed sound, playing multiple sources simultaneously, etc. Soon I hope to include effects (reverb, lowpass, etc) and other goodies.

Offline paulscode

Senior Member


Medals: 11


Staff Sergeant


« Reply #187 - Posted 2011-10-10 03:24:11 »

For ambient sources, most folks just use Stereo files and set attenuation to ATTENUATION_NONE.  Your way works too though.  When you finish, if you post your source code, I'll incorporate some of your work into the official library if you find it works well and has equivalents that work in both OpenAL and JavaSound.

We love death.  The US loves life.  That is the difference between us.  -Osama bin Laden, mass murderer
Offline msiggy

Senior Newbie





« Reply #188 - Posted 2011-11-25 19:59:00 »

Hi Paul,

I seem to be experiencing a bug with the SoundSystem.libraryCompatible() method.

If I call 'SoundSystem.libraryCompatible( LibraryJavaSound.class );' it always returns false.
But 'sound = new SoundSystem( LibraryJavaSound.class );' instantiates without errors, and sound will play just fine.

Im using Windows 7 64-bit, with JRE 7 64-bit.
Offline paulscode

Senior Member


Medals: 11


Staff Sergeant


« Reply #189 - Posted 2011-11-28 01:05:48 »

Could you post the console output after calling 'SoundSystem.libraryCompatible( LibraryJavaSound.class );' to see what it says is wrong?

Also, could you run the following after doing it the other way 'sound = new SoundSystem( LibraryJavaSound.class );'


--EDIT-- Never mind, I figured out what the problem is.  I never updated the libraryCompatible() method after I added the mixer profiling code.  So it is still checking for the "Java Sound Audio Engine", which has been removed from recent versions of Java, so the method will always return false.  I'll fix this at some point (in the mean time, just do it the way you are doing it)

We love death.  The US loves life.  That is the difference between us.  -Osama bin Laden, mass murderer
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline teletubo
« League of Dukes »

JGO Ninja


Medals: 48
Projects: 4
Exp: 8 years



« Reply #190 - Posted 2011-11-29 02:35:51 »

hey Paul, I'm having some problems loading sounds with SoundSystem.newSource();

I'm loading all my sounds in a loop, and for the first N sounds I have this error :
1  
2  
Error in class 'LibraryJavaSound'
    Unable to open file 'sounds/sword1.ogg' in method 'loadSound'


The problem are not the ogg files, if I reverse the loop, the sounds that are the end of the list (that is, the first ones to be loaded) fail, and the rest (including the ones which failed before) load successfully.

This is how I'm starting the SoundSystem :

1  
2  
3  
4  
5  
6  
SoundSystemConfig.addLibrary( LibraryJavaSound.class );
SoundSystemConfig.setCodec( "ogg", CodecJOrbis.class );
SoundSystemConfig.setDefaultFadeDistance(100);
SoundSystemConfig.setNumberStreamingBuffers(3);
SoundSystemConfig.setNumberNormalChannels(3);
 mySoundSystem = new SoundSystem( LibraryJavaSound.class );


If I play all my sounds using quickPlay, they all work perfectly.

Any clues ?

Thanks in advance.

Offline paulscode

Senior Member


Medals: 11


Staff Sergeant


« Reply #191 - Posted 2011-11-29 03:38:09 »

That is really strange.  The only place where that message gets printed:
1  
2  
3  
4  
5  
6  
        URL url = filenameURL.getURL();

        if( errorCheck( url == null, "Unable to open file '" +
                                     filenameURL.getFilename() +
                                     "' in method 'loadSound'" ) )
            return false;


And the code for FilenameURL.getURL():
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  
        if( url == null )
        {
            // Check if the file is online or inside the JAR:
           if( filename.matches( SoundSystemConfig.PREFIX_URL ) )
            {
                // Online
               try
                {
                    url = new URL( filename );
                }
                catch( Exception e )
                {
                    errorMessage( "Unable to access online URL in " +
                                  "method 'getURL'" );
                    printStackTrace( e );
                    return null;
                }
            }
            else
            {
                // Inside the JAR
               url = getClass().getClassLoader().getResource(
                      SoundSystemConfig.getSoundFilesPackage() + filename );
            }
        }
        return url;


Therefore, the only way this message could occur is if the following returned 'null':
1  
2  
                url = getClass().getClassLoader().getResource(
                      SoundSystemConfig.getSoundFilesPackage() + filename );


From the Java API, the only way this would happen:
Quote
   A URL object for reading the resource, or null if the resource could not be found or the invoker doesn't have adequate privileges to get the resource.

Since the resource exists, this must mean the invoker doesn't have adequate privileges to get the resource??  That doesn't sound right..  I'll have to think about this some more.

We love death.  The US loves life.  That is the difference between us.  -Osama bin Laden, mass murderer
Offline philfrei
« Reply #192 - Posted 2011-11-30 00:45:23 »

Just a thought. Could this be a concurrency problem? For example: when there's a lot going on in a Constructor, and the code which makes the resource call executes before the Constructor is guaranteed to have completed.

What is the class referred to in the .getClass() part? Is it possible it hasn't finished instantiation?

"Greetings my friends! We are all interested in the future, for that is where you and I are going to spend the rest of our lives!" -- The Amazing Criswell
Offline paulscode

Senior Member


Medals: 11


Staff Sergeant


« Reply #193 - Posted 2011-11-30 12:06:52 »

The class referenced by getClass() is FilenameURL.  I don't think there is a concurrency problem, though.  First off, the constructors are quite simple:

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  
/**
 * Constructor: Saves handles to the url and identifier.  The identifier should
 * look like a filename, and it must have the correct extension so SoundSystem
 * knows what format to use for the file referenced by the URL instance.
 * @param url URL interface to a file.
 * @param identifier Identifier (filename) for the file.
 */

    public FilenameURL( URL url, String identifier )
    {
        // grab a handle to the message logger:
       logger = SoundSystemConfig.getLogger();

        filename = identifier;
        this.url = url;
    }

/**
 * Constructor: Saves a handle to the filename (used later to generate a URL
 * instance).  The file may either be located within the
 * JAR or at an online location.  If the file is online, filename must begin
 * with "http://", since that is how SoundSystem recognizes URL names.
 * @param filename Name of the file.
 */

    public FilenameURL( String filename )
    {
        // grab a handle to the message logger:
       logger = SoundSystemConfig.getLogger();

        this.filename = filename;
        url = null;
    }


And then the getURL() method, where the resource is accessed, can only be called after it is instantiated, because both the instantiation and the call to getURL() are done in sequence on a single thread (I could post the relevant code trace to demonstrate, but it would get a bit long).

I'll try and recreate the problem so I can track down the cause.  Teletubo, do you have a simple test-case that I could use? (does this happen any time you create lots of new sources in a loop?  If so, how many?)

We love death.  The US loves life.  That is the difference between us.  -Osama bin Laden, mass murderer
Offline teletubo
« League of Dukes »

JGO Ninja


Medals: 48
Projects: 4
Exp: 8 years



« Reply #194 - Posted 2011-11-30 13:15:39 »

Damn, my bad, Paul. Sorry.  Emo

The thing is that I was looping thru the filenames, and AFTER the loop setting SoundSystemConfig.setSoundFilesPackage(path);
I just realized that when writing a test case.

That explains why the first few failed: The ones queued for later loading got the new path settings and loaded successfully.

Thanks for the attention and the great lib anyway.


Offline gouessej
« Reply #195 - Posted 2011-12-08 09:09:14 »

Hi

I'm going to switch to JOAL in a few hours, I will use JavaSound as a fallback. I cross my fingers  Grin Thank you so much for your nice libraries.

Offline gouessej
« Reply #196 - Posted 2011-12-24 10:49:31 »

Hi

LibraryJOAL works fine with JOAL 1.1.3. Thank you very much  Grin

Offline duindain

Innocent Bystander





« Reply #197 - Posted 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?
Offline gouessej
« Reply #198 - Posted 2012-01-18 12:11:13 »

@duindain Are you sure you use the latest version of the codecs? Have you tried to convert your files into ogg format?

Offline paulscode

Senior Member


Medals: 11


Staff Sergeant


« Reply #199 - Posted 2012-01-21 05:25:37 »

Mp3 format doesn't currently have a codec plug-in (use ogg instead).  Could you post a link to one of the wav files that has the problem (so I can run some tests)?

We love death.  The US loves life.  That is the difference between us.  -Osama bin Laden, mass murderer
Offline StonePickaxes

JGO Coder


Medals: 4
Projects: 2


Nathan Kramber


« Reply #200 - Posted 2012-03-01 15:55:38 »

EDIT -

I am having some problems implementing this. I can't seem to find any documentation on the problem I'm having, so hopefully someone can help.

Here's my stack trace-

Starting up SoundSystem...
Initializing No Sound
    (Silent Mode)


SoundSystem shutting down...
Caught InterruptedException while attempting to open the default MIDI sequencer.  Trying again.
Error in class 'MidiChannel'
    Unable to load Midi file in method 'setSequence'.
Error in class 'MidiChannel'
    Exception in method 'play'
    ERROR MESSAGE:
        sequence not set
    STACK TRACE:
        com.sun.media.sound.RealTimeSequencer.start(Unknown Source)
        paulscode.sound.MidiChannel.play(MidiChannel.java:650)
        paulscode.sound.Library.play(Library.java:665)
        paulscode.sound.SoundSystem.CommandPlay(SoundSystem.java:2076)
        paulscode.sound.SoundSystem.CommandQueue(SoundSystem.java:2599)
        paulscode.sound.CommandThread.run(CommandThread.java:121)
    Author: Paul Lamb, www.paulscode.com

Here's my sound class:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
package com.natekramber.main;

import paulscode.sound.SoundSystem;

public class Sound extends SoundSystem {
   
   Main main;
   
   public Sound(Main main)
   {
      this.main = main;
     
      backgroundMusic("m", "snd/song.mid", true);
      cleanup();
   }
}


Seems fairly simple enough. I don't know what could be causing it to do this.

Also, this happens no matter what I set the filepath to. I could set it to "oldcorn.poop" and the error doesn't change.

p.s. Sometimes I don't get an error, it just initialized then shuts down like this-

Starting up SoundSystem...
Initializing No Sound
    (Silent Mode)


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

Thanks,
-Nathan

Check out my website!
Offline ra4king

JGO Kernel


Medals: 337
Projects: 2
Exp: 5 years


I'm the King!


« Reply #201 - Posted 2012-03-04 03:24:32 »

Look at the javadocs, i don't think you should be calling "cleanup" after you start the music? Wink

Offline StonePickaxes

JGO Coder


Medals: 4
Projects: 2


Nathan Kramber


« Reply #202 - Posted 2012-03-04 04:15:52 »

Ah you are correct. However, I still get that InterruptedException when I try to load it (see stack trace in previous post).

(Sorry if this is a simple error; this is my first foray into using sound Tongue)

-Nathan

Check out my website!
Offline gouessej
« Reply #203 - Posted 2012-06-11 21:37:14 »

Hi

I have a small problem. I use an in-memory sound, I get its source name, I can play it only if it is not yet already played. This is problematic because it is a gun shot, the second bullet should start making some noise before the first one ends doing so. I don't want to create several sources for a single sound sample. How can I make it work? The only workaround I know consists in shortening sound samples to avoid overlaps but it is annoying and crappy, it won't be fine when an opponent shoots me while I shoot him. I use JOAL 1.1.3 and the codec for Ogg Vorbis. The sound sample is in mono, 48 Khz.

Thank you for your good library. Best regards.

Edit.: When I play different sounds at the same time, it works like a charm. The problem only occurs when I try to play the same sample.

Offline gouessej
« Reply #204 - Posted 2012-06-12 11:14:08 »

Hi

I should use loadSound() to load each sound once for all and quickPlay() because bullets are at different locations, I should not use the same source, that was my fault. Best regards.

Offline msiggy

Senior Newbie





« Reply #205 - Posted 2012-07-28 22:45:52 »

I pre cache all the sounds in my game using SoundSystem.loadSound(String). I find that when loading .ogg files it takes several seconds to load each file, and the memory usage is huge (something like 100mb for each file). Is this some kindof bug in the JOrbis codec? Or can it be attributed to something else?
Offline philfrei
« Reply #206 - Posted 2012-07-29 04:44:43 »

@msiggy:

How long are your sounds? A standard decompression is 44100 samples per second, and 4 bytes per sample. At that rate, RAM gets consumed pretty quickly.

That's...let's see...176,400 bytes per second...
10,584,000 bytes per minute...

So, are you trying to put about 9 to 10 minutes worth of sound and music into memory? If so, 100MB sounds about right.

Of course, if you leave the sound in Ogg format, it consumes a LOT more cpu to play the sounds back at game time.

My quickie rule of thumb is that each minute of SFX requires roughly 10MB of memory as PCM (16-bit encoding, stereo).

"Greetings my friends! We are all interested in the future, for that is where you and I are going to spend the rest of our lives!" -- The Amazing Criswell
Offline msiggy

Senior Newbie





« Reply #207 - Posted 2012-07-29 08:34:24 »

My .ogg sounds are only a few second long each. When i load comparable .wav files they load instantly and take up a small amount of memory. I'm not really a sound guy so i may be oblivious to something obvious. Tomorrow i'm going to take a closer look at my situation and try to provide more details.
Offline philfrei
« Reply #208 - Posted 2012-07-29 09:27:42 »

That short? wav's are fine? Hmmm.

I don't think the problem you are describing comes from JOrbis itself, as many people use it and rely on it. The one time I used it, it pretty much worked as advertised (didn't cause the problem you describe).

So, yes, more info.

"Greetings my friends! We are all interested in the future, for that is where you and I are going to spend the rest of our lives!" -- The Amazing Criswell
Offline teletubo
« League of Dukes »

JGO Ninja


Medals: 48
Projects: 4
Exp: 8 years



« Reply #209 - Posted 2012-09-19 23:23:55 »

Hey Paul,
I switched my computer and now I'm having a problem in which the sound plays only once. It won't play more than the first time.

My old system was Windows XP, with Java 6. It worked fine.

New one is a Windows 7 with Java 7 and it's where the problem occurs.

This is how I load a sound effect:
1  
2  
        mySoundSystem.newSource(true, fname, "sounds/"+fname,  false, 0, 0, 0, SoundSystemConfig.ATTENUATION_ROLLOFF,
            SoundSystemConfig.getDefaultRolloff());


and then, each time I play it:
1  
2  
3  
 
        mySoundSystem.setPosition(fname, 0, 0, 0);
        mySoundSystem.play(fname);


I tried the applet bug testing you posted on your forums, but nothing happened when I pressed 1-3 keys (although it worked perfectly on my old laptop).

Any clues ?

Pages: 1 ... 5 6 [7] 8
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

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

The first screenshot will be displayed as a thumbnail.

pw (35 views)
2014-07-24 01:59:36

Riven (33 views)
2014-07-23 21:16:32

Riven (21 views)
2014-07-23 21:07:15

Riven (24 views)
2014-07-23 20:56:16

ctomni231 (55 views)
2014-07-18 06:55:21

Zero Volt (47 views)
2014-07-17 23:47:54

danieldean (38 views)
2014-07-17 23:41:23

MustardPeter (43 views)
2014-07-16 23:30:00

Cero (59 views)
2014-07-16 00:42:17

Riven (56 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!