Author Topic: LibraryLWJGLOpenAL does not allow Listener to Function  (Read 426 times)

Offline Nummie

  • Cyan Team
  • bit
  • *
  • Posts: 3
    • View Profile
LibraryLWJGLOpenAL does not allow Listener to Function
« on: January 21, 2018, 12:34:48 PM »
So I'm at a loss. I have a basic setup where LibraryJavaSound is a backup from OpenAL. LibraryJavaSound works perfectly for Listener positions and fading, but not pitch. OpenAL is JUST the opposite.

I have a method called repositionListener which passes arguments for a Player object, float x, float y. This method is called in a step method every time the player moves. It works only for LibraryJavaSound and I have spent hours trying to figure this out. All it contains is setListenerPosition and setListenerOrientation. Why won't it work for OpenAL specifically?

Any help would be appreciated.

Offline Paul

  • Administrator
  • double
  • *****
  • Posts: 3487
  • Developer
    • View Profile
    • PaulsCode.Com
Re: LibraryLWJGLOpenAL does not allow Listener to Function
« Reply #1 on: January 22, 2018, 07:13:55 PM »
Do you have a simplified bit of code that has the problem with OpenAL?  My initial guess is that you are using a stereo sound file instead of mono, but that is pure speculation.

As far as missing pitch in JavaSound, that may be due to a control missing on your specific system (not all controls are available on every system)
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 Nummie

  • Cyan Team
  • bit
  • *
  • Posts: 3
    • View Profile
Re: LibraryLWJGLOpenAL does not allow Listener to Function
« Reply #2 on: January 25, 2018, 07:55:41 PM »
Ohhh, the JavaSound bit does make perfect sense. Have any idea of how I could "emulate" this? I know Java was smart and removed support for the default mixer...

As for the code, sorry I didn't post it originally. You, seemingly, are one of the few people alive who still employ anti-spam. Here it is...
public void playSound(boolean priority, String identifier, boolean loop, float x, float y, float z, float pitch) {
      sound.newSource(priority, identifier, identifier, loop, x, y, z, SoundSystemConfig.ATTENUATION_ROLLOFF, SoundSystemConfig.getDefaultRolloff());
      if(LibraryLWJGLOpenAL.alPitchSupported()) sound.setPitch(identifier, pitch);
      sound.setVolume(identifier,getSoundVolume());
      sound.play(identifier);
   }

...and for moving my player...
public void repositionListener(EntityPlayer player, float x, float y) {
      sound.setListenerPosition(x, y, 0F);
      sound.setListenerOrientation(Mineblock.getSingleplayerGame().getPlayerController().getPlayer().getEyeLocation().getX(), Mineblock.getSingleplayerGame().getPlayerController().getPlayer().getEyeLocation().getY(), 0F, x, y, 0F);
      sound.checkFadeVolumes();
   }
...this method, which gets called every player step.

Really appreciate your help, Paul.

Offline Paul

  • Administrator
  • double
  • *****
  • Posts: 3487
  • Developer
    • View Profile
    • PaulsCode.Com
Re: LibraryLWJGLOpenAL does not allow Listener to Function
« Reply #3 on: January 27, 2018, 09:46:13 AM »
Hmm.. that seems like it should work.  Do you mind sending me one of the sound files you are using which has the problem, so I can run some tests?
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 Nummie

  • Cyan Team
  • bit
  • *
  • Posts: 3
    • View Profile
Re: LibraryLWJGLOpenAL does not allow Listener to Function
« Reply #4 on: January 28, 2018, 09:07:57 PM »
newbielink:https://www.dropbox.com/s/gm3t3czshcizvbq/explode3.ogg?dl=0 [nonactive]

This is one I'm using out of many.