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

32 lines
787 B
Go

4 years ago
package main
import (
"fmt"
"io/ioutil"
"os"
"strconv"
)
func main() {
b, err := ioutil.ReadFile("librnnoise_ladspa/librnnoise_ladspa.so")
if err != nil {
fmt.Printf("Couldn't read librnnoise_ladspa.so: %v\n", err)
fmt.Println("Drop a compiled librnnoise_ladspa.so in at librnnoise_ladspa/librnnoise_ladspa.so,\n" +
"it will is required for compilation so we can embed it.\n\n" +
"You can find out more information in the README in that folder\n\n")
4 years ago
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"))
}