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

Make audio funcs return errors instead of ints; add tests #135

Merged
merged 3 commits into from
Jul 22, 2015

Conversation

jangler
Copy link
Contributor

@jangler jangler commented Jul 22, 2015

I was going to add tests for ConvertAudio(), but I noticed that the AudioCVT struct's Buf field uses a *uint8 instead of a []byte as well. Not sure what the best fix for that is, since the current code relies on the struct being binary-compatible with C.SDL_AudioCVT.

aqiank pushed a commit that referenced this pull request Jul 22, 2015
Make audio funcs return errors instead of ints; add tests
@aqiank aqiank merged commit def2514 into veandco:master Jul 22, 2015
@aqiank
Copy link

aqiank commented Jul 22, 2015

I changed AudioCVT.Buf into a method returning a slice. The length is equal to AudioCVT.LenCVT while the capacity is equal to AudioCVT.Len * AudioCVT.LenMult. Hopefully it works for everyone.

@jangler
Copy link
Contributor Author

jangler commented Jul 22, 2015

OK, I'll look into testing that.

@jangler
Copy link
Contributor Author

jangler commented Jul 22, 2015

Hm, there needs to be a way to set the buffer. There aren't any API functions that return an AudioCVT; the typical workflow involving that struct looks like the example at https://wiki.libsdl.org/SDL_AudioCVT.

@aqiank
Copy link

aqiank commented Jul 22, 2015

You should be able to set it normally as you would on a slice.

neputevshina pushed a commit to neputevshina/go-sdl2 that referenced this pull request Nov 13, 2024
Make audio funcs return errors instead of ints; add tests
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

Successfully merging this pull request may close these issues.

2 participants