Author Topic: 3D Sound System  (Read 322989 times)

Offline Paul

  • Administrator
  • double
  • *****
  • Posts: 3499
  • Developer
    • View Profile
    • PaulsCode.Com
Re: 3D Sound System
« Reply #105 on: January 04, 2015, 10:08:57 AM »
HI
Iv got a problem with the queuesound function.
I simply dont know how to use it  ;D
Can anybody help me ?

queueSound is called on a streaming source or the MIDI source.  It queues up the next sound to play when the previous playback ends.  There are two versions of the method, with parameters that are similar to the first couple parameters of newStreamingSource (so if you know how to create a streaming source, you should have no problem using queueSound). As stated in the JavaDoc, this method has no effect on non-streaming sources.
Device: Samsung Galaxy Nexus i515
CPU: TI OMAP4460, 1.2 GHz (dual core, ARM Cortex-A9)
GPU: PowerVR SGX540, 307 MHz
RAM: 1 GB
Resolution: 720 x 1280
Rom: omni-4.4.4-20141014-toro-FML KitKat 4.4.4, rooted

Device: Eee PC 1015PEM
CPU: Intel Atom N550, 1.5 GHz (dual core, x86)
GPU: Intel GMA 3150, 200 MHz (dual core)
RAM: 2GB
Resolution: 1024 x 600
Rom: android-x86-4.3-20130725 Jelly Bean 4.3, rooted

Offline SOGKiller10

  • bit
  • Posts: 2
    • View Profile
Re: 3D Sound System
« Reply #106 on: January 04, 2015, 07:48:13 PM »
Hi,
I've got a problem on how to add the 3D Sound System into my project. The problem is that I don't know where to put it so it is going to work. I am using Eclipse Luna. I already tried to put it into my project and then import it with the following:
Code: newbielink:javascript:void(0); [nonactive]
import paulscode.sound.SoundSystem;
import paulscode.sound.SoundSystemConfig;
import paulscode.sound.SoundSystemException;
import paulscode.sound.libraries.LibraryJavaSound;
import paulscode.sound.codecs.CodecJOrbis;
Can you help me with this?
Thanks,

SOGKiller10

Offline Paul

  • Administrator
  • double
  • *****
  • Posts: 3499
  • Developer
    • View Profile
    • PaulsCode.Com
Re: 3D Sound System
« Reply #107 on: January 05, 2015, 01:21:01 AM »
Put the source files into a package with the specified name/path as in the import statements.  paulscode/sound, paulscode/sound/libraries, and paulscode/sound/codecs are the three you have listed below.  Or if you are using the compiled JARs, include them like any other JAR you would add to a Java project.
Device: Samsung Galaxy Nexus i515
CPU: TI OMAP4460, 1.2 GHz (dual core, ARM Cortex-A9)
GPU: PowerVR SGX540, 307 MHz
RAM: 1 GB
Resolution: 720 x 1280
Rom: omni-4.4.4-20141014-toro-FML KitKat 4.4.4, rooted

Device: Eee PC 1015PEM
CPU: Intel Atom N550, 1.5 GHz (dual core, x86)
GPU: Intel GMA 3150, 200 MHz (dual core)
RAM: 2GB
Resolution: 1024 x 600
Rom: android-x86-4.3-20130725 Jelly Bean 4.3, rooted

Offline SOGKiller10

  • bit
  • Posts: 2
    • View Profile
Re: 3D Sound System
« Reply #108 on: January 05, 2015, 09:54:40 AM »
Ok, thanks, but I have still got one problem. The last import doesn't work. (import paulscode.sound.codecs.CodecJOrbis;) What is wrong with that? (And yes, I have that codec JAR)

Thanks,

SOGKiller10
« Last Edit: January 05, 2015, 09:58:04 AM by SOGKiller10 »

Offline Paul

  • Administrator
  • double
  • *****
  • Posts: 3499
  • Developer
    • View Profile
    • PaulsCode.Com
Re: 3D Sound System
« Reply #109 on: January 05, 2015, 11:02:44 AM »
Not sure.  That is the correct path.  The other four imports work?
Device: Samsung Galaxy Nexus i515
CPU: TI OMAP4460, 1.2 GHz (dual core, ARM Cortex-A9)
GPU: PowerVR SGX540, 307 MHz
RAM: 1 GB
Resolution: 720 x 1280
Rom: omni-4.4.4-20141014-toro-FML KitKat 4.4.4, rooted

Device: Eee PC 1015PEM
CPU: Intel Atom N550, 1.5 GHz (dual core, x86)
GPU: Intel GMA 3150, 200 MHz (dual core)
RAM: 2GB
Resolution: 1024 x 600
Rom: android-x86-4.3-20130725 Jelly Bean 4.3, rooted

Offline jakethesnake

  • bit
  • Posts: 1
    • View Profile
Re: 3D Sound System
« Reply #110 on: April 25, 2015, 07:52:12 AM »
Hello! nice library you've got going here!

I was wondering if you're planning on making the OpenAL plugin compatable with lwjgl 3.0?

As far as I know, the lwjgl-team hasn't changed the openAl interface very much, and I think there's only a few lines of code that needs changing. It would be great if you did!

Offline gouessej

  • byte
  • *
  • Posts: 17
    • View Profile
    • TUER (first person shooter written in Java by Julien Gouesse)
Re: 3D Sound System
« Reply #111 on: September 08, 2015, 03:37:09 PM »
Hi

Maybe you should update the few lines about the JOAL plugin because it uses both OpenAL and OpenAL-Soft under the hood which drives it more compatible.

I'd like to build your library with the profile "compact1" but there is only one class preventing me from doing it: javax.sound.sampled.AudioFormat. As this class is just a bean (there is no intelligence in it, it contains only some fields and some accessors), maybe it would be acceptable to replace it by a more simple class or by the implementation of this class in Apache Harmony so that I can use your library even under Android.

Finally, I see that you're on Github. Why not putting the source code of your sound system into it? It would help me to contribute.

Keep up the good work as usual :)

Offline r2range

  • bit
  • Posts: 2
    • View Profile
Re: 3D Sound System
« Reply #112 on: January 25, 2016, 03:56:01 PM »
Ey Paul,

Nice Sound system a friend of mine implemented it into a game and it worked prefect until i upgraded to windows 10

it seems that  windows 10 doesnt have the "Microsoft GS Wavetable synth"

Code: newbielink:javascript:void(0); [nonactive]
javax.sound.midi.MidiUnavailableException: Undefined external error.
at com.sun.media.sound.MidiOutDevice.nOpen(Native Method)
at com.sun.media.sound.MidiOutDevice.implOpen(MidiOutDevice.java:54)
at com.sun.media.sound.AbstractMidiDevice.doOpen(AbstractMidiDevice.java:154)
at com.sun.media.sound.AbstractMidiDevice.openInternal(AbstractMidiDevice.java:144)
at com.sun.media.sound.AbstractMidiDevice.getReceiverReferenceCounting(AbstractMidiDevice.java:350)
at javax.sound.midi.MidiSystem.getReceiver(MidiSystem.java:273)
at MidiPlayer.<init>(MidiPlayer.java:9)
at Client.<init>(Client.java:16382)
at Client.main(Client.java:5499)

Code: newbielink:javascript:void(0); [nonactive]
Starting up SoundSystem...
Exception in thread "Thread-7" java.lang.NoClassDefFoundError: org/lwjgl/LWJGLException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at paulscode.sound.SoundSystemConfig.runMethod(SoundSystemConfig.java:900)
at paulscode.sound.SoundSystemConfig.getLibraryTitle(SoundSystemConfig.java:321)
at paulscode.sound.SoundSystem.CommandNewLibrary(SoundSystem.java:1524)
at paulscode.sound.SoundSystem.CommandQueue(SoundSystem.java:2572)
at paulscode.sound.CommandThread.run(CommandThread.java:121)
Caused by: java.lang.ClassNotFoundException: org.lwjgl.LWJGLException
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 10 more
« Last Edit: January 26, 2016, 01:07:18 AM by r2range »

Offline Paul

  • Administrator
  • double
  • *****
  • Posts: 3499
  • Developer
    • View Profile
    • PaulsCode.Com
Re: 3D Sound System
« Reply #113 on: February 01, 2016, 06:15:23 PM »
The solution to this will likely be the same solution as the problem with only having one line on Linux, which is to write my own software mixer.  Been meaning to do that, but haven't had much time for programming in a while.
Device: Samsung Galaxy Nexus i515
CPU: TI OMAP4460, 1.2 GHz (dual core, ARM Cortex-A9)
GPU: PowerVR SGX540, 307 MHz
RAM: 1 GB
Resolution: 720 x 1280
Rom: omni-4.4.4-20141014-toro-FML KitKat 4.4.4, rooted

Device: Eee PC 1015PEM
CPU: Intel Atom N550, 1.5 GHz (dual core, x86)
GPU: Intel GMA 3150, 200 MHz (dual core)
RAM: 2GB
Resolution: 1024 x 600
Rom: android-x86-4.3-20130725 Jelly Bean 4.3, rooted

Offline r2range

  • bit
  • Posts: 2
    • View Profile
Re: 3D Sound System
« Reply #114 on: February 02, 2016, 02:51:21 PM »
well if you could find the time to update the libs it would be awesome other wise i need to ask my friend to redo the entire sound system  :-\

Offline nicymike (Michael)

  • bit
  • Posts: 1
    • View Profile
Re: 3D Sound System
« Reply #115 on: June 01, 2016, 05:22:56 AM »
Hi Paul,

First, thank you for your work on the 3D Sound System. It must be quite popular since Minecraft is using it.

I started a remake of Settlers 1 and I am using your library. Because the music is in MIDI format I am using the MIDI system and found a bug:

In class MidiChannel in method meta(MetaMessage message) line 1030:
sequenceQueue is null if you are not using it before and that means a NullPointerException is stopping the loop from working.

If you are interested in the game check out:
newbielink:https://www.simpleguide.net/sg/serflings.jsf [nonactive]

EDIT:
Two more things to optimize MIDI playback:

1. In MidiChannel always add parameter false when fetching the Sequencer (MidiSystem.getSequencer(false)). False means to not connect to a Synthesizer, which is done later anyway. If not given this parameter the output is terrible, at least in java 8. I guess this is because there is more than one Synthesizer connected.

2. I found out that on my system the volume control is not on controller 7 but on controller 11. I don't know if this is always the case but it worked for me. Now I set the volume on both controllers (method resetGain).

Best regards,
Michael
« Last Edit: June 18, 2016, 06:00:07 AM by nicymike (Michael) »

Offline NullNoname

  • bit
  • Posts: 1
    • View Profile
Re: 3D Sound System
« Reply #116 on: September 03, 2016, 10:38:27 AM »
Hello. Thanks for your great library. I've created a preliminary Android port using Android's AudioTrack class. This is still very early state but it can play some music.
The main library has some API changes required for Android, like adding the clone of JavaSound's AudioFormat class and adding the ability to override how InputStreams are obtained from URLs (useful for Android asset).

Main Library: newbielink:https://github.com/NullNoname/Paulscode-SoundSystem/tree/droid [nonactive]
LibraryAudioTrack: newbielink:https://github.com/NullNoname/paudiotrack [nonactive]
Example App: newbielink:https://github.com/NullNoname/pc3dssdemo [nonactive]

Any suggestions, forks, bug reports and fixes are welcome.

Offline regice202

  • bit
  • Posts: 5
    • View Profile
Re: 3D Sound System
« Reply #117 on: July 28, 2018, 06:57:13 PM »
Hey Paul!

Love the library system you have going, it's very cool. But I'm having and issue at the moment. I can play sound in my IDE, but as soon as I package the jar and try to run it, I get a stacktrace. Please help?




Thanks in advance!

- regice202

Offline Paul

  • Administrator
  • double
  • *****
  • Posts: 3499
  • Developer
    • View Profile
    • PaulsCode.Com
Re: 3D Sound System
« Reply #118 on: July 29, 2018, 12:22:11 PM »
Hm, weird that it works in the IDE but not outside of it.  Are there different versions of Java between the two runtimes?
Device: Samsung Galaxy Nexus i515
CPU: TI OMAP4460, 1.2 GHz (dual core, ARM Cortex-A9)
GPU: PowerVR SGX540, 307 MHz
RAM: 1 GB
Resolution: 720 x 1280
Rom: omni-4.4.4-20141014-toro-FML KitKat 4.4.4, rooted

Device: Eee PC 1015PEM
CPU: Intel Atom N550, 1.5 GHz (dual core, x86)
GPU: Intel GMA 3150, 200 MHz (dual core)
RAM: 2GB
Resolution: 1024 x 600
Rom: android-x86-4.3-20130725 Jelly Bean 4.3, rooted

Offline regice202

  • bit
  • Posts: 5
    • View Profile
Re: 3D Sound System
« Reply #119 on: July 30, 2018, 05:35:03 AM »
Hey Paul!

Good call, I didn't think about that, but as soon as you said it, it made sense. I'm running java 10 on my system I guess. Is their a way you could update the lib to make it compatible? Or where would I start for a work around? Thanks again!

- regice202