Skip to content

Commit

Permalink
implements #17: if a voice is being viewed, turning on voicing mode w…
Browse files Browse the repository at this point in the history
…ill use that voice rather than the empty default
  • Loading branch information
chinenual committed Nov 14, 2020
1 parent 2fbe2fa commit c4a2581
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 13 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
VERSION=2.2.1
VERSION=2.2.1-beta1

5 changes: 3 additions & 2 deletions message.go
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,7 @@ func handleMessages(_ *astilectron.Window, m bootstrap.MessageIn) (payload inter
case "toggleVoicingMode":
var args struct {
Mode bool
Vce *data.VCE
ZeroconfSynergy *zeroconf.Service
ZeroconfCs *zeroconf.Service
}
Expand All @@ -817,7 +818,6 @@ func handleMessages(_ *astilectron.Window, m bootstrap.MessageIn) (payload inter
logger.Infof("ZEROCONF: config Control Surface selected by user: %#v\n", *args.ZeroconfCs)
osc.SetControlSurface((*args.ZeroconfCs).InstanceName, (*args.ZeroconfCs).HostName, (*args.ZeroconfCs).Port)
}
var vce data.VCE
payload = nil
csEnabled := osc.ControlSurfaceConfigured()
csName := osc.ControlSurfaceName()
Expand All @@ -829,7 +829,8 @@ func handleMessages(_ *astilectron.Window, m bootstrap.MessageIn) (payload inter
}
}
if payload == nil {
if vce, err = synio.EnableVoicingMode(); err != nil {
var vce data.VCE
if vce, err = synio.EnableVoicingMode(args.Vce); err != nil {
payload = err.Error()
return
}
Expand Down
2 changes: 1 addition & 1 deletion resources/app/static/js/viewVCE.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
let vce = {};
let vce = null;
let vceFilterNames = null;

// https://www.color-hex.com/color-palette/89750
Expand Down
3 changes: 3 additions & 0 deletions resources/app/static/js/viewVCE_voice.js
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,7 @@ ${freqDAG}
"name": "toggleVoicingMode",
"payload": {
"Mode": false,
"Vce" : null,
"ZeroconfSynergy": null, // optional param - null unless user just selected from a menu
"ZeroconfCs": null, // optional param - null unless user just selected from a menu
}
Expand All @@ -879,6 +880,7 @@ ${freqDAG}
$('#disableControlSurfaceMenuItem').addClass('disabled');
viewVCE_voice.csEnabled = false;
}
vce = null;
viewVCE_voice.voicingModeVisuals();
index.infoNotification(`Voicing mode disabled.`);
index.refreshConnectionStatus();
Expand All @@ -891,6 +893,7 @@ ${freqDAG}
"name": "toggleVoicingMode",
"payload": {
"Mode": true,
"Vce" : vce,
"ZeroconfSynergy": synergyZeroconfChoice, // optional param - null unless user just selected from a menu
"ZeroconfCs": csZeroconfChoice // optional param - null unless user just selected from a menu
}
Expand Down
23 changes: 15 additions & 8 deletions synio/synio_voice.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func initMaps() {
oscOffsetMap["AmpPoints"] = offsetMapEle{data.Off_EOSC_AmpPoints, true}
}

func EnableVoicingMode() (vce data.VCE, err error) {
func EnableVoicingMode(useVce *data.VCE) (vce data.VCE, err error) {
c.Lock()
defer c.Unlock()
if synioVerbose {
Expand All @@ -84,13 +84,20 @@ func EnableVoicingMode() (vce data.VCE, err error) {
if err = initVRAM(); err != nil {
return
}
data.ClearLocalEDATA()
if err = loadCRTBytes(data.VRAM_EDATA[:]); err != nil {
return
}
rdr := bytes.NewReader(data.VRAM_EDATA[data.Off_VRAM_EDATA:])
if vce, err = data.ReadVce(rdr, false); err != nil {
return
if useVce != nil {
vce = *useVce
if err = LoadVceVoicingMode(vce); err != nil {
return
}
} else {
data.ClearLocalEDATA()
if err = loadCRTBytes(data.VRAM_EDATA[:]); err != nil {
return
}
rdr := bytes.NewReader(data.VRAM_EDATA[data.Off_VRAM_EDATA:])
if vce, err = data.ReadVce(rdr, false); err != nil {
return
}
}

// though not documented, some features (e.g., OSCSOLO) of the voicing mode are conditional
Expand Down
2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package main

const Version = "2.2.1"
const Version = "2.2.1-beta1"

0 comments on commit c4a2581

Please sign in to comment.