Skip to content

Commit

Permalink
Merge pull request #85 from chinenual/develop
Browse files Browse the repository at this point in the history
v2.6.2
  • Loading branch information
chinenual authored Jun 17, 2024
2 parents 7343702 + 10cbc0d commit b514344
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 7 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
VERSION=2.6.1
VERSION=2.6.2

16 changes: 13 additions & 3 deletions data/crt.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
Expand Down Expand Up @@ -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
}
Expand Down
8 changes: 7 additions & 1 deletion message.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
6 changes: 5 additions & 1 deletion resources/app/static/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
},

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.6.1"
const Version = "2.6.2"

0 comments on commit b514344

Please sign in to comment.