Skip to content
This repository was archived by the owner on Aug 13, 2025. It is now read-only.
/ trial Public archive

Commit d57a6bb

Browse files
committed
Fix reinitialisation of sound banks
1 parent 51cf334 commit d57a6bb

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

harmony/asset.lisp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@
1414
(mixed:end (harmony:source (voice resource)))
1515
(mixed:start (harmony:source (voice resource))))))
1616

17+
(defmethod reinitialize-instance :after ((file trial:sound-bank) &key)
18+
(when (trial:loaded-p file)
19+
(let ((resources (slot-value file 'trial::resources)))
20+
(loop for resource being the hash-values of resources
21+
do (apply #'reinitialize-instance resource (trial::generation-arguments file))))))
22+
1723
(defmethod harmony:play ((file trial:sound-bank) &rest args)
1824
(let ((chance 8f0)
1925
(resources (slot-value file 'trial::resources)))
@@ -60,12 +66,15 @@
6066
for file = (trial:coerce-asset-input asset input)
6167
collect (list* file :name (file-namestring file) params)))))
6268

63-
(defmethod harmony:transition ((asset environment) to &rest args &key &allow-other-keys)
64-
(apply #'harmony:transition (or (trial:resource asset T)
65-
#-elide-allocation-checks (error "Voice has not been allocated.")
66-
#+elide-allocation-checks (return-from harmony:transition voice))
69+
(defmethod harmony:transition ((env environment) to &rest args &key &allow-other-keys)
70+
(apply #'harmony:transition (or (trial:resource env T)
71+
#-elide-allocation-checks (error "Environment has not been allocated.")
72+
#+elide-allocation-checks (return-from harmony:transition env))
6773
to args))
6874

75+
(defmethod harmony:state ((env environment))
76+
(harmony:state (trial:resource env T)))
77+
6978
(defclass music (trial:resource harmony:environment)
7079
())
7180

0 commit comments

Comments
 (0)