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

Update with new API #7

Closed
lissyx opened this issue Apr 5, 2019 · 9 comments
Closed

Update with new API #7

lissyx opened this issue Apr 5, 2019 · 9 comments
Assignees

Comments

@lissyx
Copy link
Contributor

lissyx commented Apr 5, 2019

We recently merged a PR that exposes new information, via new API calls: mozilla/DeepSpeech@a009361#diff-0317a0e76ece10e0dba742af310a2362

This allows access to timing information. We have not yet updated our own bindings by exposing this, I can likely try and take care of that here as well.

@asticode
Copy link
Owner

asticode commented Apr 5, 2019

Your PR would be most welcome!

@lissyx
Copy link
Contributor Author

lissyx commented Apr 24, 2019

@asticode I should be able to start working on that tomorrow, but I'd welcome any pointers / docs on how to properly expose structures and structures holding pointers to structures in Go, given my lack of knowledge in that language, any example / doc is useful :)

@asticode asticode self-assigned this Apr 25, 2019
@asticode
Copy link
Owner

Thing is, structures containing C attributes should be handled differently than structures containing Go attributes as far as I'm concerned.

I'd simply recommend using getters/setters to access/write C attributes withing Go structs.

You can also check out this link or this one to learn more about native Go structs.

If anyone else have ideas, we're all ears.

@lissyx
Copy link
Contributor Author

lissyx commented Apr 25, 2019

Thing is, structures containing C attributes should be handled differently than structures containing Go attributes as far as I'm concerned.

I'd simply recommend using getters/setters to access/write C attributes withing Go structs.

Sounds like what I did for Rust bindings: RustAudio/deepspeech-rs@023dd85

@asticode
Copy link
Owner

Yeah, sounds like the safest route!

@lissyx
Copy link
Contributor Author

lissyx commented Apr 25, 2019

@asticode I'll first fix FreeString

@lissyx
Copy link
Contributor Author

lissyx commented Apr 26, 2019

@asticode https://stackoverflow.com/questions/28925179/cgo-how-to-pass-struct-array-from-c-to-go I've found that, trying to use however does not lead to something working. Code is available at https://github.com/lissyx/go-astideepspeech/commits/expose-metadata

This slicing "seems" to work, in the sense that it compiles and runs, but trying to range over it, I always get the first item, and looking at pointers it is always the same.

@lissyx
Copy link
Contributor Author

lissyx commented Apr 26, 2019

I always get the first item

That seems not true, I sometime get garbage, but always the same garbage value.

@lissyx
Copy link
Contributor Author

lissyx commented Apr 26, 2019

Okay, nevermind, it seems like this was because there was no C defintion being included for C.struct_MetadataItem

lissyx pushed a commit to lissyx/go-astideepspeech that referenced this issue Apr 26, 2019
lissyx pushed a commit to lissyx/go-astideepspeech that referenced this issue Apr 29, 2019
lissyx pushed a commit to lissyx/go-astideepspeech that referenced this issue Apr 29, 2019
lissyx pushed a commit to lissyx/go-astideepspeech that referenced this issue Apr 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants