Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (495)
Games in Android Showcase (114)
games submitted by our members
Games in WIP (563)
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] 2 3 ... 6
1  Java Game APIs & Engines / Java Sound & OpenAL / Re: 3D Sound Engine on: 2012-09-25 15:29:26
Hey, teletubo, sorry I have been busy with other projects lately and haven't been on the forum here for some time.  I tend to start too many projects to keep up with, and some end up taking a back burner for a while.

Anyway, this problem is caused by the fact that Oracle decided to remove the built-in Java Sound software mixer.  At some point when I have time to finish my own mixer I started a while back, I'll be able to fix the problem.  If someone has already completed a similar project let me know, and I'll look into creating a new plug-in to use it.
2  Java Game APIs & Engines / Java Sound & OpenAL / Re: 3D Sound Engine on: 2012-01-21 04: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)?
3  Java Game APIs & Engines / Java Sound & OpenAL / Re: 3D Sound Engine on: 2011-11-30 11: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?)
4  Java Game APIs & Engines / Java Sound & OpenAL / Re: 3D Sound Engine on: 2011-11-29 02: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.
5  Java Game APIs & Engines / Java Sound & OpenAL / Re: 3D Sound Engine on: 2011-11-28 00: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)
6  Java Game APIs & Engines / Java Sound & OpenAL / Re: Simple Line Mixer on: 2011-10-19 15:28:34
Hi

Thanks.  I haven't actually done much work on this project since my last post, because I've been busy with my N64 emulator for Android project.  I'll cycle back around to this project eventually  Grin
Sorry for the off topic. I tried to use JArio to play with Goldeneye 007 but some required op codes are not yet supported. Is your own emulator open source? I would like to make a nice demo of Goldeneye 007 with JOGL 2.0  Grin
Yes it is open source, but mainly written in native c/c++ using the Android NDK, so not really suitable for porting to Java.
7  Java Game APIs & Engines / Java Sound & OpenAL / Re: Simple Line Mixer on: 2011-10-18 21:34:58
Thanks.  I haven't actually done much work on this project since my last post, because I've been busy with my N64 emulator for Android project.  I'll cycle back around to this project eventually  Grin
8  Java Game APIs & Engines / Java Sound & OpenAL / Re: 3D Sound Engine on: 2011-10-10 01: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.
9  Java Game APIs & Engines / Java Sound & OpenAL / Re: 3D Sound Engine on: 2011-09-24 03: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.
10  Java Game APIs & Engines / Java Sound & OpenAL / Re: 3D Sound Engine on: 2011-09-10 12: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)
11  Java Game APIs & Engines / Java Sound & OpenAL / Re: 3D Sound Engine on: 2011-09-09 20:04:50
Yes, same out of both sides.
12  Java Game APIs & Engines / Java Sound & OpenAL / Re: 3D Sound Engine on: 2011-09-09 18:14:45
If they're not "monotone", would there be an easy way with audacity or something to correct the issue with the file?
In Audacity, I believe it is an option in the Tracks menu (something like "convert stereo to mono").  Note: monotone is only required for point sources (ones you want to pan and attenuate).  For ambient sources like music, use stereo instead.
13  Java Game APIs & Engines / Java Sound & OpenAL / Re: 3D Sound Engine on: 2011-09-09 15:55:41
For attenuation to work, be sure to use monotone files (can't remember if that just affected the OpenAL plug-ins only or also the JavaSound plug-in).  If that doesn't help, if you post a link to one of the problem files, I'll take a look to see if there is anything "special" about it.
14  Java Game APIs & Engines / Java Sound & OpenAL / Re: 3D Sound Engine on: 2011-09-09 14:34:16
The left-right thing is due to the way I calculate the panning (it's just a simple cosine formula).  In a 2D situation where you want to utilize panning based on position on the screen, the way you are doing it is the way a number of others have done it as well - by playing with the z value (closer values pan faster, further values less).  You can also change the attenuation to zero if you are having a problem with the sounds being too quiet at the distance you are listening from.  It is a 3D sound library, so you sometimes have to get a little creative when you use it for 2D.
15  Java Game APIs & Engines / Java Sound & OpenAL / Re: 3D Sound Engine on: 2011-09-09 11:24:29
Oh, well that applet uses the LibraryJavaSound plug-in.  Make sure you are using the latest version in your project:

LibraryJavaSound.jar

If that doesn't work, could you put together a simple test case that experiences the problem, and post the code?  Could be a bug I haven't encountered yet.
16  Java Game APIs & Engines / Java Sound & OpenAL / Re: 3D Sound Engine on: 2011-09-08 20:42:20
I will actually say that something strange has happened.  When running the compatibility check, I found that my SoundSystem was actually not compatible with JavaSound.  It's weird since this is considered a "backup" library.  JOAL worked just fine... But this is still kind of strange to me as I (think?) use Javasound to play sound effects right now in some way.  Wondering if anyone had thoughts.

Which version of Java are you running, and what operating system?

Could you provide the console output from after running the following applet:
Bullet / Target Collision Applet
(I feel silly pushing this dumb applet, but it's the easiest test-case for LibraryJavaSound I have at the moment)
17  Java Game APIs & Engines / Java Sound & OpenAL / Re: JavaSound on Linux on: 2011-09-08 17:36:47
Interesting idea on reading what's in ~/pulse.  I'll look into this..
18  Java Game APIs & Engines / Java Sound & OpenAL / Re: JavaSound on Linux on: 2011-09-08 11:19:40
JavaSound has bugs for sure, but maybe you should actually come down to Earth and realise that not every bug you see has anything to do with Java.  This webcam issue is probably a well known problem with ALSA, and the way it iterates soundcards - webcams will often end up at index 0.  I've fixed this on a project myself in the past, and it took a few minutes to Google how - I've also suggested this to you in the past.  You need to either blacklist the webcam audio driver (if you don't need the mic on it) or force the webcam not to be at index 0.  Unfortunately, some distributions don't have a GUI to set this.
From the perspective of an average amateur developer, we don't want to require the end user to have to screw around with their system (or brick it if they are dumb***'s).  Whether the problems are Java's fault or not, the solutions we want need to be programmable into our own code.  For example, this is why gouessej has switched to JOAL and AL-soft, due to the difficulty (and even incapability in the subject of this particular thread) to control various problems from his own code.
19  Java Game APIs & Engines / Java Sound & OpenAL / Re: Simple Line Mixer on: 2011-09-08 01:22:02
The mixer itself is independent of Java Sound, and could be used with JOAL.  There is a class that provides the linkage with Java Sound (chooses a device, opens a line, etc), and it can be removed easily enough.  As for how this mixer will fit into my SoundSystem library, it will be part of a new library plug-in (something along the lines of LibrarySimpleMixer or the like), and will link with Java Sound.  The LibraryJOAL plug-in will not be affected.
20  Java Game APIs & Engines / Java Sound & OpenAL / Re: Simple Line Mixer on: 2011-09-06 17:56:49
I've actually learned quite a bit by starting over from scratch with a new project and a new infrastructure.  I'm really not experiencing the latency issues that I'm getting with my other mixer project (even with as low as 32 total lines, it is complete garbage for anything I'd use it for)

Anyway, I'm going to just scrap that project and turn this one into the base that I'll use in my 3D Sound System.  I can add per-line pitch/ pan/ gain capabilities without damaging the optimized pipeline, simply by having the mixer check if those features are requested, and if not simply don't do the calculations.  That way, there would be no performance hit as long as the user used the same format for the output and all inputs, and didn't change the pitch, pan, or gain.  This should give the capability to mix hundreds of lines at a decent speed.

21  Java Game APIs & Engines / Java Sound & OpenAL / Re: Java Theremin on: 2011-09-06 17:46:07
He mentions using latest Oracle Java (which I assume means 6u27 not 7?)
Right.  I hadn't notice that 7 was out.  I'll have to give it a try when I have some time.

Depends exactly where and how you're setting the "default" device.  The mixers in JavaSound should be in the same index order as alsa, so you need to force your headphones to be at position 0 (ie. plughw:0,0).
Right, I meant from within Java  Grin
22  Java Game APIs & Engines / Java Sound & OpenAL / Re: Java Theremin on: 2011-09-06 11:24:01
Both applets work well on my netbook (dual core Atom, 64-bit Ubuntu Linux, latest Oracle Java).  The only problems with the sound were expected: some of the low-pitched audio is too low for the speakers to play correctly, and the audio for the test tone applet starts and ends with a click due to the lack of cushioning.

Interestingly, the sound plays out of the netbook's internal speakers, rather than the USB headphones (which are set as the audio output device in the OS settings).  This isn't a problem with your code, it's actually due to the fact that the Java Sound Audio Engine is missing on this machine, so there is no way (that I'm aware of) to determine which is the "correct" audio device to pick from the list of available hardware mixers.
23  Java Game APIs & Engines / Java Sound & OpenAL / Re: How to deploy OpenALSoft with Java Web Start? on: 2011-09-05 20:08:25
One idea I just had would be to try and create an AL context first, to see if OpenAL is on the user's system.  If all goes well, then use that, but if it fails, then load the AL-soft library (basically using Al-soft as a fall-back option).  I'll run some tests when I get home in a few days (this deployment is finally almost over!)  That way I'll have access to my test machines so I can try out various combinations of OS's and OpenAL installed or not.
24  Java Game APIs & Engines / Java Sound & OpenAL / Re: Java sound, only plays once on: 2011-09-04 01:24:19
You might try calling stop before you call start.  I seem to recall that being the solution to similar behavior some time ago (although I've never actually used these particular classes before)
25  Java Game APIs & Engines / Java Sound & OpenAL / Re: Simple Line Mixer on: 2011-09-03 01:46:29
Thanks, I'll take a look at the code you linked to.  I like the basic infrastructure as I understand it, because whether or not it improves performance, it does clean up the code in the mixing loop.

Also, what I'm calling a "buffer" is any arbitrary size divisible by the sample size.  I may very well use the sample size if a reasonable number of lines can be mixed on my crappy Netbook without having any skipping in the output.  I do still need to determine the most efficient way to handle format differences between input and output that result in different sample sizes between the two, but that's just a matter of trying things out to see what works the fastest (I currently have the mixer reading until it has enough data, and telling the lines to store any "leftovers" until the next iteration).
26  Java Game APIs & Engines / Java Sound & OpenAL / Re: Simple Line Mixer on: 2011-09-02 11:40:18
I am using similar algorithms to whats in that library (also working with float buffers.  This is fairly straightforward as long as you are dealing only with PCM data).  I just realized my previous post sounded like I was asking how to do format conversions - I actually have this part coded from my other mixer project.  That being said, I'll definitely take a look through that link you posted see if there is anything useful that I could learn from it for optimizing my own code (although I personally shy away from anything GPL, even with those convoluted lawyer-speak "classpath exception" or "lesser" clauses - I don't like the controls that the designers of these licenses try to place on the developer.  I much prefer to give people a "do whatever you want, just don't come crying to me if you screw up your sh**" type of license).  Anyway, what I meant to say is that I need to work format conversions into this system, decide how many formats I want to support, and spend some time testing and debugging.

It would seem to me you would want to bring in some defined amount of data into the inner loop from each line, at the "same time," then do a single operation that includes each buffer's i-th element. In other words, progress by frames, not by tracks or channels.
How would that work, though, since each line is going to have its own unique set of transformations to be applied?  Even if you do it at the line level to present a pre-defined amount of transformed data to the mixer thread, you are just pushing the same operation to another class - in the end you are still performing transformations to each line in a linear fashion (that's the only way a CPU can operate).  So whether it is done by the mixer after it draws the data from the line, or done by the line before it is drawn by the mixer, it is the same performance-wise, right?  Perhaps I'm not understanding the process you are describing (I sometimes need unfamiliar concepts to be "dumbed down" for me).  Since cylab mentioned that is what he was suggesting as well, I'm probably just on the wrong wave-length so to speak Cheesy
27  Java Game APIs & Engines / Java Sound & OpenAL / Re: 3D Sound Engine on: 2011-09-01 19:41:02
Yes, my current plan is to go with a 3-phase process:

1) Overall logarithmic attenuation based on distance from the listener, plus Doppler effect if enabled (the normal way of doing 3D audio, minus the panning)

2) Phase and attenuation adjustments per side (as described earlier) based on the direction vector, using average values for speed of sound, attenuation, and distance between the ears

3) Additional filtering per side to simulate echoing (either by using a formula derived from "audio ray tracing" a high-poly model of the ears and skull, or by doing the ray-tracing and mixing real time if fast enough)
28  Java Game APIs & Engines / Java Sound & OpenAL / Re: Simple Line Mixer on: 2011-09-01 18:25:04
Progress update:

I've got the basic project put together.  Attaching lines, starting, stopping, and mixing works nicely.  I've been borrowing most of the code from my other mixer project, so nothing much new as of yet.  There is a little more to complete on this part, such as drain and flush, as well as gain changes.

The next big component is the format conversion code.  Currently, the mixer is assuming a particular input (and output) audio format, which of course is not all that adaptable.  I need to be able to let the user specify the output format, and to mix a variety of input formats.  Obviously format conversion impacts performance, but this is certainly a feature that people will need.  For folks who need ultra optimization, they just have to make sure all their input data is in the same audio format, and use the same for the output audio format as well (thus bypassing all the format conversion steps)
29  Java Game APIs & Engines / Java Sound & OpenAL / Re: Simple Line Mixer on: 2011-09-01 16:24:28
Yes, will be open source (as will my other mixer with the additional features)
30  Java Game APIs & Engines / Java Sound & OpenAL / Re: Simple Line Mixer on: 2011-09-01 16:19:23
I totally get your points, but when I set my mind to efficiency I stick to it.  All the "bloat" of this project will be in the surrounding easy-to-use interface.  The core of the mixer where all the heavy lifting is being done is going to be as efficient as I can make it while still accomplishing its purpose: mixing of inputs into a single output.
Pages: [1] 2 3 ... 6
 

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

The first screenshot will be displayed as a thumbnail.

Dwinin (23 views)
2014-09-12 09:08:26

Norakomi (56 views)
2014-09-10 13:57:51

TehJavaDev (69 views)
2014-09-10 06:39:09

Tekkerue (34 views)
2014-09-09 02:24:56

mitcheeb (56 views)
2014-09-08 06:06:29

BurntPizza (40 views)
2014-09-07 01:13:42

Longarmx (26 views)
2014-09-07 01:12:14

Longarmx (32 views)
2014-09-07 01:11:22

Longarmx (31 views)
2014-09-07 01:10:19

mitcheeb (39 views)
2014-09-04 23:08:59
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

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!