From 8f2bd2bc27c106503d6fce9705e6a963c622113c Mon Sep 17 00:00:00 2001 From: Steve Tynor Date: Mon, 17 Jun 2024 13:03:36 -0400 Subject: [PATCH 1/4] fix #82 - grow Voices array if necessary --- data/crt.go | 4 ++-- message.go | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/data/crt.go b/data/crt.go index 1fb457a..3d33b41 100644 --- a/data/crt.go +++ b/data/crt.go @@ -34,7 +34,7 @@ type CRT struct { } func ReadCrtFile(filename string) (crt CRT, err error) { - // A CRT file is a long header containing filter info, followed by a list of CCE fragments (each voice missing the filter params since they are concatenated elsewhere in the file). + // A CRT file is a long header containing filter info, followed by a list of VCE fragments (each voice missing the filter params since they are concatenated elsewhere in the file). var b []byte @@ -50,7 +50,7 @@ func ReadCrtFile(filename string) (crt CRT, err error) { } func ReadCrt(buf io.ReadSeeker) (crt CRT, err error) { - // A CRT file is a long header containing filter info, followed by a list of CCE fragments (each voice missing the filter params since they are concatenated elsewhere in the file). + // A CRT file is a long header containing filter info, followed by a list of VCE fragments (each voice missing the filter params since they are concatenated elsewhere in the file). if err = binary.Read(buf, binary.LittleEndian, &crt.Head); err != nil { logger.Error("binary.Read failed:", err) diff --git a/message.go b/message.go index a2b4f71..08464e9 100644 --- a/message.go +++ b/message.go @@ -115,7 +115,13 @@ func handleMessages(_ *astilectron.Window, m bootstrap.MessageIn) (payload inter return } else { logger.Infof("Add vce %s to CRT at slot %d\n", args.VcePath, args.Slot) - args.Crt.Voices[args.Slot-1] = &vce + if len(args.Crt.Voices) < args.Slot { + // grow the slice + newVoices := make([]*data.VCE, args.Slot) + copy(newVoices, args.Crt.Voices) + args.Crt.Voices = newVoices + } + args.Crt.Voices[args.Slot-1] = &vce payload = args.Crt } From a2d271ff10b0b8672f17c520c6c8f97dcd71e1a9 Mon Sep 17 00:00:00 2001 From: Steve Tynor Date: Mon, 17 Jun 2024 15:26:46 -0400 Subject: [PATCH 2/4] fix #83: Info dialogs auto-hide --- resources/app/static/js/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/resources/app/static/js/index.js b/resources/app/static/js/index.js index ff6cb89..93c33ec 100644 --- a/resources/app/static/js/index.js +++ b/resources/app/static/js/index.js @@ -95,7 +95,11 @@ let index = { } console.log("INFO NOTIFICATION: " + message) document.getElementById("alertTitle").innerHTML = "Info"; - document.getElementById("alertText").innerHTML = message; + document.getElementById("alertText").innerHTML = message; + // Make alert messages hide themselves after 3s - no need to click + setTimeout(function(){ + $('#alertModal').modal('hide'); + }, 3000); $('#alertModal').modal(); }, From ac79d5ed28cc89e242816090f336b5be00b11371 Mon Sep 17 00:00:00 2001 From: Steve Tynor Date: Mon, 17 Jun 2024 16:50:26 -0400 Subject: [PATCH 3/4] fix CRT voice count sanity check --- data/crt.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/data/crt.go b/data/crt.go index 3d33b41..65151cc 100644 --- a/data/crt.go +++ b/data/crt.go @@ -259,8 +259,18 @@ type crtCursor struct { VoiceOffset int64 } +func countVoices(vces []*VCE) (result int) { + result = 0 + for _, vce := range vces { + if vce != nil { + result += 1 + } + } + return result +} + func WriteCrt(buf io.WriteSeeker, vces []*VCE) (err error) { - if len(vces) < 1 || len(vces) > 24 { + if countVoices(vces) < 1 || countVoices(vces) > 24 { err = errors.Errorf("Must have at least 1 and no more than 24 voices") return } From 10cbc0dea15724fec101e3c2d363c70954240000 Mon Sep 17 00:00:00 2001 From: Steve Tynor Date: Mon, 17 Jun 2024 16:53:20 -0400 Subject: [PATCH 4/4] bump version --- VERSION | 2 +- version.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index e21d35c..61b5ef7 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -VERSION=2.6.1 +VERSION=2.6.2 diff --git a/version.go b/version.go index d9d9a5e..5e1bb78 100644 --- a/version.go +++ b/version.go @@ -1,3 +1,3 @@ package main -const Version = "2.6.1" +const Version = "2.6.2"