MacOS [5.61] Error with sample 3d sound program

All bugs related to the 3D engine
crabou
New User
New User
Posts: 6
Joined: Mon Jan 29, 2018 4:54 am

MacOS [5.61] Error with sample 3d sound program

Post by crabou »

I am evaluating Purebasic and so far am pretty happy, except the 3d sound program example (sound3d.pb from help file) doesn't work on my Mac. I tried it in Windows and it works OK. I have narrowed down the issue to the statement on line 45:

If LoadSound3D(0, "Roar.ogg")

This line returns a fail return code, causing a further line that references sound #0 to fail. BTW, I found that Roar.ogg does indeed exist. I also copied that file into another directory and changed line 45 to the full file name with the same results. I am running the latest version of pb and osx. Please help. Thanks!
User avatar
Shardik
Addict
Addict
Posts: 1989
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: [5.61] Error with sample 3d sound program

Post by Shardik »

I can confirm the failure of LoadSound3D() on MacOS 10.6.8 with PB 5.61 x86. The following test code demonstrates that LoadSound() is working fine while LoadSound3D() always fails with return code 0:

Code: Select all

UseOGGSoundDecoder()

If InitEngine3D() And InitSprite() And InitSound()
  OpenWindow(0, 0, 0, 1024, 768, "Engine3D",
    #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  OpenWindowedScreen(WindowID(0), 0, 0, 1024, 768)

  If FileSize(#PB_Compiler_Home + "examples/3d/Data/Roar.ogg") <= 0
    MessageRequester("Error", "File Roar.ogg was not found!")
    End
  Else
    Debug "LoadSound3D: " +
      LoadSound3D(0, #PB_Compiler_Home + "examples/3d/Data/Roar.ogg")
    Debug "LoadSound: " +  
      LoadSound(0, #PB_Compiler_Home + "examples/3d/Data/Roar.ogg")
  EndIf

  Repeat
    If WindowEvent() = #PB_Event_CloseWindow
      Break
    EndIf

    FlipBuffers() 
    Delay(1)
  ForEver
EndIf
I have also tested this example on MacOS 10.6.8 with these older PB versions (in ASCII and Unicode mode) and in no older version did LoadSound3D() work:
- PB 5.46
- PB 5.31 x86 and x64
- PB 5.24 x86 and x64
- PB 5.11 x86 and x64 (.ogg changed to .wav because this version contained Roar.wav instead of Roar.ogg, so even the loading of a .wav file didn't work!)

In PB's example Sound3D.pb the command UseOGGSoundDecoder() is missing. Nevertheless the example doesn't work because LoadSound3D() always fails.
#NULL
Addict
Addict
Posts: 1440
Joined: Thu Aug 30, 2007 11:54 pm
Location: right here

Re: [5.61] Error with sample 3d sound program

Post by #NULL »

The 3d LoadSomething()s need Add3DArchive(), which is mentioned in the help doc of Add3DArchive() but not in the actual load commands.

Code: Select all

    Debug Add3DArchive(#PB_Compiler_Home + "examples/3d/Data", #PB_3DArchive_FileSystem)
    Debug "LoadSound3D: " + LoadSound3D(0, "Roar.ogg")
    Debug "LoadSound: " + LoadSound(0, #PB_Compiler_Home + "examples/3d/Data/Roar.ogg")
crabou
New User
New User
Posts: 6
Joined: Mon Jan 29, 2018 4:54 am

Re: [5.61] Error with sample 3d sound program

Post by crabou »

#NULL-
FYI my understanding is that the LoadSound3D only requires the Add3DArchive if you need to look for a file at additional locations if the file name does not include a path. As Shardik's program specifies a full path, there should be no need for the Add3DArchive for this statement.

Shardik-
I had trouble getting your code to work, so I made my own attempt to take out some unnecessary code from the sound3d.pb demo program. I also had to add some initializations for 2d sound. Here are my results:

Windows 10:
LoadSound and both flavors of LoadSound3d are successful.
Mac High Sierra:
LoadSound is successful, while both flavors of LoadSound3 fail.

All-
Can anyone get either the original sound3d.pb or my code below to work on a Mac?. If so, what version of OSX are you using?

Thanks!

Code: Select all

InitSound()
UseOGGSoundDecoder()
IncludeFile #PB_Compiler_Home + "examples/3d/Screen3DRequester.pb"
If InitEngine3D()
  Add3DArchive(#PB_Compiler_Home + "examples/3d/Data", #PB_3DArchive_FileSystem)
  Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Textures", #PB_3DArchive_FileSystem)
  Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Models", #PB_3DArchive_FileSystem)
  Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Scripts", #PB_3DArchive_FileSystem)
  Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Packs/desert.zip", #PB_3DArchive_Zip)
  Parse3DScripts()
  InitSprite()
  InitKeyboard()
  InitMouse()
  If Screen3DRequester()
    CreateCube(0, 100)
    GetScriptMaterial(0, "Color/Blue")
    CreateEntity(0, MeshID(0), MaterialID(0))        
    Debug "LoadSound:" + LoadSound(0, #PB_Compiler_Home + "examples/3d/Data/Roar.ogg")
    Debug "LoadSound3d#1:" + LoadSound3D(0, #PB_Compiler_Home + "examples/3d/Data/Roar.ogg")
    Debug "LoadSound3d#2:" + LoadSound3D(0,"Roar.ogg")
  EndIf
EndIf
End
#NULL
Addict
Addict
Posts: 1440
Joined: Thu Aug 30, 2007 11:54 pm
Location: right here

Re: [5.61] Error with sample 3d sound program

Post by #NULL »

I don't know the 3d library well enough so you could be right. :) Unfortunately the PB documentation often leaves you with a lot of guessing.
BTW LoadSound3D(..ogg) (with Add3DArchive()) returns non-zero here even without UseOGGSoundDecoder(), but i can't test the Mac side of things.
User avatar
Shardik
Addict
Addict
Posts: 1989
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: [5.61] Error with sample 3d sound program

Post by Shardik »

crabou wrote:Can anyone get either the original sound3d.pb or my code below to work on a Mac?. If so, what version of OSX are you using?
I have done some tests (all on identical hardware running natively on my iMac 11,2 from summer 2010, always selecting a windowed screen with 1024x768 in Sound3D.pb):

Code: Select all

Operating system      PB version     Sound3D.pb   crabou's test code
-------------------   ------------   ----------   ----------------
MacOS 10.6.8          5.61 x86            -               -
MacOS 10.9.5          5.61 x86+x64        -               -
MacOS 10.12.5         5.61 x86+x64        -               -
Linux Mint 18.1 x64   5.61 x64           +/-              +
Windows 7 SP1 x64     5.61 x86+x64        +               +
On MacOS 3D sound seems to be broken independant from OS version, PB version (tested back to PB 5.11 / see my posting above) and 32 bit or 64 bit. I even tested Sound3D.pb with PB 5.11 x86 with Subsystem Carbon and it crashed with "The debugged executable quit unexpectedly.".

Running Sound3D.pb on Linux Mint with Cinnamon the 3D sound was mute although it has been loaded successfully. Running the help example from LoadSound() proved that the sound playback worked so it seems to be a problem with the playback of 3D sound on Linux.
crabou
New User
New User
Posts: 6
Joined: Mon Jan 29, 2018 4:54 am

Re: [5.61] Error with sample 3d sound program

Post by crabou »

Shardik,

Thanks for the tests! :D

All,

Being a newcomer, how likely is it that someone from the development staff will respond or address the problem? Is there a better method of contacting support? Frankly, if this issue isn't at least recognized officially as a problem to be addressed, I won't be purchasing purebasic. :(
infratec
Always Here
Always Here
Posts: 6818
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: [5.61] Error with sample 3d sound program

Post by infratec »

Hi,

if you are a software developer, you will know that when no one reports a bug it will not fixed.
Now you found it and reported it, so it will be fixed. (sooner or later)

Since the team is not as big as Apple or Microsoft and has not the budget as those companies
the man power is limited. And if you don't want to buy it, the budget is even smaller :wink:

Have you bought any software from a big company?
Have they ever fixed a bug that you found in 2 days?

Every developer wants a perfect product.
Fred is a good developer, so he will do what he can to fix this error. For sure.

Bernd
crabou
New User
New User
Posts: 6
Joined: Mon Jan 29, 2018 4:54 am

Re: [5.61] Error with sample 3d sound program

Post by crabou »

Hi Infratec,

Thank you for your reply.

Just to be clear, I was NOT expecting the bug to be fixed in a day or two. What I was expecting was some type of acknowledgment by the developer. Even a response such as "your problem will be looked at, but is being ranked as extremely low priority and will likely never be addressed" would be preferable to silence. As a newbie, I have no idea as to whether the developer has a track record of acknowledging receipt of **all** problems or has accidentally overlooked my support request. I am glad you relayed your positive experience of Fred solving problems...that will make it more likely that I may overlook his lack of response and indeed purchase the product.
Post Reply