zoia

package module
v0.0.0-...-66e505e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2020 License: GPL-3.0 Imports: 8 Imported by: 0

README

Zoia

GoDoc

Patch parser for the Empress Effects ZOIA. It takes binary patch and parses its content as structured Golang struct.

Lots of module are still not implemented, any help is appreciated to create module parsers.

Example

This graph has been generated with the script in _example and the patch 005_zoia_Clown_Shoes.bin:

005_zoia_Clown_Shoes.bin

Usage

package main

import (
	"fmt"
	"io/ioutil"

	"github.com/mdouchement/zoia"
	"gopkg.in/yaml.v2"
)

func main() {
	data, err := ioutil.ReadFile("011_zoia_Crunch_Time.bin")
	check(err)

	patch := zoia.Parse(data)

	payload, err := yaml.Marshal(patch)
	check(err)
	fmt.Println(string(payload))

	// fmt.Println(patch[:patch.Header.PatchLength])
}

func check(err error) {
	if err != nil {
		panic(err)
	}
}

Module position

+----+----+----+----+----+----+----+----+
| 0  | 1  | 2  | 3  | 4  | 5  | 6  | 7  |
| 8  | 9  | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
| 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 |
| 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 |
+----+----+----+----+----+----+----+----+

Patch structure format

Firmwares < 1.10
[header][module#0][module#1][#patch_cables][patch_cables][#pages][page#1][page#2][padding]
^-------------------------------- Patch length ---------------------------------^
Firmwares >= 1.10
  • Extended Colours has been added
[header][module#0][module#1][#patch_cables][patch_cables][#pages][page#1][page#2][module#0_extra][module#1_extra][padding]
^--------------------------------------------------- Patch length ----------------------------------------------^

License

GPLv3

Contributing

All PRs are welcome.

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Documentation

Index

Constants

View Source
const Version = "1.11"

Version of Zoia firmware.

Variables

This section is empty.

Functions

func Generate

func Generate(patch *Patch) []byte

Generate generates the binary patch. Non-destructive generation base on Raw modifications only.

func ParseModule

func ParseModule(module binary.Raw) (m modulepkg.Module)

ParseModule returns a new Module.

Types

type Header struct {
	Raw             binary.Raw
	Name            string
	PatchLength     int
	NumberOfModules int
}

Header of a patch.

func ParseHeader

func ParseHeader(header binary.Raw) *Header

ParseHeader returns a new Header.

func (*Header) SetName

func (h *Header) SetName(name string)

SetName set the name of the patch. Invalid character are trimmed and the name is limited to 15 characters.

type Page

type Page struct {
	Raw  binary.Raw
	Name string
}

A Page holds details about page of a patch.

func ParsePage

func ParsePage(page binary.Raw) *Page

ParsePage returns a new Header.

type Patch

type Patch struct {
	Version     string
	Header      *Header
	Pages       []*Page
	Modules     []module.Module
	PatchCables []*PatchCable
}

A Patch is a set of synthesizer modules.

func Parse

func Parse(patch []byte) *Patch

Parse parses the given binary patch.

type PatchCable

type PatchCable struct {
	Raw               binary.Raw
	Gain              datatype.Decibel
	SourceModule      int
	SourceSignal      datatype.PatchCableSignal
	DestinationModule int
	DestinationSignal datatype.PatchCableSignal
}

A PatchCable reprents a patch cable between 2 modules.

func ParsePatchCable

func ParsePatchCable(cable binary.Raw) *PatchCable

ParsePatchCable returns a new PatchCable.

Directories

Path Synopsis
io

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL