You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
NoiseTorch/scripts/embedlibrnnoise.go

29 lines
555 B
Go

4 years ago
package main
import (
"fmt"
"io/ioutil"
"os"
"strconv"
)
func main() {
b, err := ioutil.ReadFile("librnnoise_ladspa/bin/ladspa/librnnoise_ladspa.so")
4 years ago
if err != nil {
fmt.Printf("Couldn't read librnnoise_ladspa.so: %v\n", err)
os.Exit(1)
}
out, _ := os.Create("librnnoise.go")
defer out.Close()
out.Write([]byte("package main \n\nvar libRNNoise = []byte{\n"))
for i, c := range b {
out.Write([]byte(strconv.Itoa(int(c))))
out.Write([]byte(","))
if i%32 == 0 && i != 0 {
out.Write([]byte("\n"))
}
}
out.Write([]byte("}\n"))
}