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

x/mobile/exp/audio/al: add missing generic accessors and setters #13912

Open
rakyll opened this Issue Jan 11, 2016 · 3 comments

Comments

Projects
None yet
3 participants
@rakyll
Copy link
Member

rakyll commented Jan 11, 2016

Continuing the discussion started at #11298 (comment)...

Source offset setters are missing from the package and the offset must represented in float32 for more precision. Suggested APIs are below.

// OffsetSeconds returns the current playback position of the source in seconds.
func (s Source) OffsetSeconds() float32 {
return getSourcef(s, paramSecOffset)
}

// SetOffsetSeconds sets the current playback position of the source in seconds.
func (s Source) SetOffsetSeconds(sec float32){
setSourcef(s, paramSecOffset,sec)
}

// OffsetSample returns the sample offset of the current playback position.
func (s Source) OffsetSample() int32 {
return getSourcei(s, paramSampleOffset)
}

// SetOffsetSample sets the sample offset of the current playback position.
func (s Source) SetOffsetSample(i int32){
setSourcei(s, paramSampleOffset,i)
}

// OffsetByte returns the byte offset of the current playback position.
func (s Source) OffsetByte() int32 {
return getSourcei(s, paramByteOffset)
}

// SetOffsetByte sets the byte offset of the current playback position.
func (s Source) SetOffsetByte(i int32){
setSourcei(s, paramByteOffset,i)
}

/cc @splace

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Jan 12, 2016

CL https://golang.org/cl/18541 mentions this issue.

@splace

This comment has been minimized.

Copy link

splace commented Jan 12, 2016

i think it must be because openal is dynamically extensible, that it makes everything accessible via only a few general functions, that only vary by parameter type, and then uses another parameter to indicate the actual thing being set/read.
which is how offset could be int or float, when float includes the same functionality.

i did look through the spec briefly, looking for other omissions that might be sensibly added, and didn't find any more, but i guess there will be others that are effectively only present because of this extensibility.
the approach seems to have been to have anything that possibly makes sense, maybe also to lessen type conversions?

but, the Go wrapper's current approach of hiding the parametrised calls, by sending each through a separate function, stops the dynamic extension mechanism, in that, it means any extensions would require functions to be added statically.

gopherbot pushed a commit to golang/mobile that referenced this issue Jan 27, 2016

exp/audio/al: export generic getters/setters
Updates golang/go#13912.

Change-Id: I2dadbba0c155c1f4b53663031069098d3f3b156a
Reviewed-on: https://go-review.googlesource.com/18541
Reviewed-by: David Crawshaw <crawshaw@golang.org>
@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Feb 11, 2016

CL https://golang.org/cl/19472 mentions this issue.

@rakyll rakyll changed the title x/mobile/exp/audio/al: offset setters are missing x/mobile/exp/audio/al: add missing generic accessors and setters Feb 13, 2016

gopherbot pushed a commit to golang/mobile that referenced this issue Feb 18, 2016

exp/audio/al: add more generic getters
Updates golang/go#13912.

Change-Id: I0eb017513872c9d44364b8c96e632ce3d08c6e10
Reviewed-on: https://go-review.googlesource.com/19472
Reviewed-by: David Crawshaw <crawshaw@golang.org>

@gopherbot gopherbot added the mobile label Jul 20, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment