Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Remove oto.NewPlayer #76

Closed
hajimehoshi opened this issue Apr 26, 2019 · 7 comments
Closed

Remove oto.NewPlayer #76

hajimehoshi opened this issue Apr 26, 2019 · 7 comments

Comments

@hajimehoshi
Copy link
Member

oto.NewPlayer (not (*otoContext).NewPlayer exists for backward compatibility, but this is confusing (e.g. oto.NewPlayer cannot be called multiple times). I started to think this should be removed.

Any thoughts? @faiface @Noofbiz

@Asday
Copy link

Asday commented Apr 27, 2019

Possible you could have it keep a reference to the returned player, and return that each time? That way people can still have an easy way to do things, but it removes a gun pointed at their feet.

@hajimehoshi
Copy link
Member Author

Thanks. The problem of returning the singleton player is that we cannot expect what should happen when a different sample rate is given.

@Asday
Copy link

Asday commented Apr 27, 2019

You're for sure right, please ignore me. 😅

@faiface
Copy link
Contributor

faiface commented Apr 28, 2019

If you search GitHub, you find that quite a few people are still using it: https://github.com/search?q=%22oto.NewPlayer%22&type=Code . So I'm not sure if it's a good idea to remove it. But perhaps deprecate it, wait some time until people switch and then remove it?

@hajimehoshi
Copy link
Member Author

Ah good point... I think removing this is not feasible until everyone uses Go modules.

@hajimehoshi
Copy link
Member Author

hajimehoshi commented Apr 10, 2020

CC @DianeLooney

This API is problematic since calling oto.NewPlayer multiple times causes an error (NewContext cannot be called multiple times), even though Oto allows to call NewContext multiple times as long as the context is closed correctly. The context created by oto.NewPlayer internally can never be closed.

It is hard to use oto.NewPlayer correctly. Then, I'll remove this function, maybe this weekend.

@hajimehoshi
Copy link
Member Author

Ah good point... I think removing this is not feasible until everyone uses Go modules.

It's already one year ago. Everyone should use Go modules :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants