vorbis.go 896 B

1234567891011121314151617181920212223242526272829303132333435
  1. // Copyright 2016 The G3N Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. /*
  5. Package vorbis implements the Go bindings of a subset (only one function) of the functions of the libvorbis library
  6. It also implements a loader so the library can be dynamically loaded
  7. See API reference at: https://xiph.org/vorbis/doc/libvorbis/reference.html
  8. */
  9. package vorbis
  10. // #include "loader.h"
  11. import "C"
  12. import (
  13. "fmt"
  14. )
  15. // Load tries to load dinamically libvorbis share library/dll
  16. func Load() error {
  17. // Loads libvorbis
  18. cres := C.vorbis_load()
  19. if cres != 0 {
  20. return fmt.Errorf("Error loading libvorbis shared library/dll")
  21. }
  22. return nil
  23. }
  24. // VersionString returns a string giving version information for libvorbis
  25. func VersionString() string {
  26. cstr := C.vorbis_version_string()
  27. return C.GoString(cstr)
  28. }