mirror of
https://github.com/vsariola/sointu.git
synced 2025-07-22 23:14:59 -04:00
refactor(asm&go4k): Remove special treatment from stereo parameters; it's now just one parameter in the Unit map.
This commit is contained in:
@ -100,18 +100,18 @@ func Synth(patch go4k.Patch) (*C.Synth, error) {
|
||||
for unitid, unit := range instr.Units {
|
||||
if val, ok := opcodeTable[unit.Type]; ok {
|
||||
opCode := val.opcode
|
||||
if unit.Stereo {
|
||||
if unit.Parameters["stereo"] == 1 {
|
||||
opCode++
|
||||
}
|
||||
commands = append(commands, byte(opCode))
|
||||
for _, paramname := range val.parameterList {
|
||||
if unit.Type == "delay" && paramname == "delaycount" {
|
||||
if unit.Stereo && len(unit.DelayTimes)%2 != 0 {
|
||||
if unit.Parameters["stereo"] == 1 && len(unit.DelayTimes)%2 != 0 {
|
||||
return nil, errors.New("Stereo delays should have even number of delaytimes")
|
||||
}
|
||||
values = append(values, byte(delayIndices[insid][unitid]))
|
||||
count := len(unit.DelayTimes)
|
||||
if unit.Stereo {
|
||||
if unit.Parameters["stereo"] == 1 {
|
||||
count /= 2
|
||||
}
|
||||
count = count*2 - 1
|
||||
|
@ -24,9 +24,9 @@ const su_max_samples = SAMPLES_PER_ROW * TOTAL_ROWS
|
||||
func TestBridge(t *testing.T) {
|
||||
patch := []go4k.Instrument{
|
||||
go4k.Instrument{1, []go4k.Unit{
|
||||
go4k.Unit{"envelope", false, map[string]int{"attack": 64, "decay": 64, "sustain": 64, "release": 80, "gain": 128}, []int{}},
|
||||
go4k.Unit{"envelope", false, map[string]int{"attack": 95, "decay": 64, "sustain": 64, "release": 80, "gain": 128}, []int{}},
|
||||
go4k.Unit{"out", true, map[string]int{"gain": 128}, []int{}},
|
||||
go4k.Unit{"envelope", map[string]int{"stereo": 0, "attack": 64, "decay": 64, "sustain": 64, "release": 80, "gain": 128}, []int{}},
|
||||
go4k.Unit{"envelope", map[string]int{"stereo": 0, "attack": 95, "decay": 64, "sustain": 64, "release": 80, "gain": 128}, []int{}},
|
||||
go4k.Unit{"out", map[string]int{"stereo": 1, "gain": 128}, []int{}},
|
||||
}}}
|
||||
synth, err := bridge.Synth(patch)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user