Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

windows: Crash at launching #836

Closed
hajimehoshi opened this issue Mar 28, 2019 · 12 comments
Closed

windows: Crash at launching #836

hajimehoshi opened this issue Mar 28, 2019 · 12 comments

Comments

@hajimehoshi
Copy link
Owner

Borja Clemente reported:

panic: winmm error at waveOutOpen: WAVEERR_BADFORMAT

Windows 10 (64bit, intel i7 processor)

@clebs
Copy link

clebs commented Mar 28, 2019

Further details:

  • After opening the binary several times in a row eventually it works.
  • Happens for both 386 and amd64 binaries.
  • Happens on both intel and AMD processors.
  • Build commands used:
    CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o game-win64.exe
    CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -o game-win32.exe

@clebs
Copy link

clebs commented Mar 29, 2019

Just tested on a Virtualbox Windows 10 VM with the same error.

The error does not come from the game loop function, I wrapped all errors returned with context to better trace them. This error comes directly from the ebiten RUN func.

@hajimehoshi
Copy link
Owner Author

I think there is an issue in your audio device (that is used by both your host machine and VM). I am not sure.

The error does not come from the game loop function, I wrapped all errors returned with context to better trace them. This error comes directly from the ebiten RUN func.

The low-layer device is created and initialized lazily, and Run initializes the device.

@clebs
Copy link

clebs commented Mar 30, 2019

I tested in 3 different machines with the same result:

  • Windows 10 PC with Intel processor
  • Windows 10 PC with AMD processor
  • MacBook Pro 2014 with Windows 10 VM

I am still trying to reproduce this with a minimal example.

@hajimehoshi
Copy link
Owner Author

Oh that's interesting... Thank you for testing.

@hajimehoshi
Copy link
Owner Author

So the audio device should not matter. I'm looking forward the minimal example to reproduce this issue.

@clebs
Copy link

clebs commented Mar 31, 2019

Hello again,
I finally found the root cause of the issue:

  • It happens when creating several players with the same audio file, for example different entities that use the same sound effect.

I also have created an example project to reproduce it. How can I send it to you @hajimehoshi?
Thanks!

@hajimehoshi
Copy link
Owner Author

hajimehoshi commented Mar 31, 2019

Hi, thank you for investigating!

It happens when creating several players with the same audio file, for example different entities that use the same sound effect.

As io.Reader should not be shared by multiple players, you'd need to create players from bytes instead of io.Reader:

https://godoc.org/github.com/hajimehoshi/ebiten/audio#NewPlayer says:

Note that the given src can't be shared with other Player objects.

I'm not sure why the lower device complains in such situation, but I think I can create a better error message.

I also have created an example project to reproduce it. How can I send it to you @hajimehoshi?
Thanks!

I appreciate it! Could you mail to hajimehoshi@gmail.com, or share that on GitHub or something?

@clebs
Copy link

clebs commented Apr 1, 2019

Hi,
Hmmm... I do create a new reader every time I create a player by using ebiten's audio.BytesReadSeekCloser().
In the example I sent, you can see exactly how I create players, so maybe you see what I am doing wrong.

It is also strange that on mac OS X and Linux this is not a problem.

Thanks for looking into it.

@hajimehoshi hajimehoshi modified the milestones: v1.10.0, v1.9.1 Apr 2, 2019
@hajimehoshi
Copy link
Owner Author

I think this was fixed by ebitengine/oto#73

hajimehoshi added a commit that referenced this issue Apr 2, 2019
This is a temporary fix for #836.

After relasing Oto v0.3.3, update go.mod again and cherry-pick
this onto 1.9 branch.
@hajimehoshi
Copy link
Owner Author

I let this issue open until releasing a new version of Oto and cherry-picking the fix onto 1.9 branch.

@clebs
Copy link

clebs commented Apr 2, 2019

Tested again in different Windows machines and it fixed in all of them!

hajimehoshi added a commit that referenced this issue Apr 9, 2019
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants