aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-11-22 22:09:29 +0100
committerThomas White <taw@physics.org>2020-11-22 22:09:29 +0100
commitb275d77794f5243a2e58899dfd7fcb8af0c757d5 (patch)
tree46cd381ed16cc479bca002d50a6e5c09d863e5da
parent3fba92e1fa75924f4dbc78eb4a844a247fe1b90b (diff)
cut-to-cue-number: Copy the hash table
This hash table will become the one which contains the cross-fade functions. Therefore, when we "emphatically" set it like this, it must not be the same table as in the cue state itself.
-rw-r--r--guile/starlet/playback.scm6
-rw-r--r--guile/starlet/utils.scm10
2 files changed, 12 insertions, 4 deletions
diff --git a/guile/starlet/playback.scm b/guile/starlet/playback.scm
index 39ccbe0..126d014 100644
--- a/guile/starlet/playback.scm
+++ b/guile/starlet/playback.scm
@@ -130,9 +130,9 @@
(define (cut-to-cue-number! pb cue-number)
(let* ((cue-list (get-playback-cue-list pb))
(cue-index (cue-number-to-index cue-list (qnum cue-number))))
- (set-state-hash-table! pb (get-state-hash-table
- (realize-state cue-list
- cue-index)))
+ (set-state-hash-table! pb (copy-hash-table
+ (get-state-hash-table
+ (realize-state cue-list cue-index))))
(set-next-cue-index! pb (+ cue-index 1))
;; Wipe out the old fade params
diff --git a/guile/starlet/utils.scm b/guile/starlet/utils.scm
index 13ee585..be87321 100644
--- a/guile/starlet/utils.scm
+++ b/guile/starlet/utils.scm
@@ -1,6 +1,7 @@
(define-module (starlet utils)
#:export (return-unspecified
- print-hash-table))
+ print-hash-table
+ copy-hash-table))
(define (return-unspecified)
@@ -13,3 +14,10 @@
(display value)
(newline))
ht))
+
+(define (copy-hash-table ht)
+ (let ((new-ht (make-hash-table)))
+ (hash-for-each (lambda (key value)
+ (hash-set! new-ht key value))
+ ht)
+ new-ht))