Commit 5d7ed1e6 by Jacob Vosmaer

delete obsolete file

parent e3b0e89f
package dx7
import (
"bufio"
"bytes"
"fmt"
"io"
"io/ioutil"
"os"
"strings"
)
const (
syxEnd = 0xf7
)
func main() {
in := bufio.NewReader(os.Stdin)
var msg []byte
var err error
for err != io.EOF {
msg, err = in.ReadBytes(syxEnd)
l := len(msg)
if err != nil || l == 0 {
break
}
prefix := 10
if l < prefix {
prefix = l
}
isMk1 := dx7mk1(msg)
var sum byte
if isMk1 {
offset := 6
sum = dx7sum(msg[offset : offset+dx7len(msg[4], msg[5])])
}
fmt.Printf("% x ... % x (%d bytes, sum %x)\n", msg[:prefix], msg[l-2:l], l, sum)
if dx7IsPackedVoices(msg) {
for i := 0; i < 32; i++ {
o := 6 + i*128
v := msg[o : o+128]
name := strings.Replace(fmt.Sprintf("%02d-%s.d7v", i+1, v[118:128]), "/", "_", -1)
if err := ioutil.WriteFile(name, v, 0644); err != nil {
fmt.Println(err)
os.Exit(1)
}
}
}
}
if err != nil && err != io.EOF {
fmt.Println(err)
os.Exit(1)
}
}
func dx7IsPackedVoices(msg []byte) bool {
return bytes.Equal([]byte{0xf0, 0x43, 0x00, 0x09, 0x20, 0x00}, msg[0:6])
}
func dx7mk1(b []byte) bool {
if len(b) < 4 {
return false
}
if !bytes.Equal(b[0:3], []byte{0xf0, 0x43, 0x00}) {
return false
}
return bytes.Contains([]byte{0x00, 0x05, 0x06, 0x09}, b[3:4])
}
func dx7len(msb, lsb byte) int {
return (int(msb>>1) << 8) + int(lsb)
}
func dx7sum(data []byte) byte {
var sum byte
for _, b := range data {
sum = sum + b
}
return (128 - sum) & 0x7f
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment