defaultxr / cl-patterns

Library for writing patterns to generate or process (a)musical sequences of mathematically (un)related (non-)compound values in Lisp.

Home Page:https://w.struct.ws/cl-patterns

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't change tempo of running clock loop

emenel opened this issue · comments

When I attempt to change the tempo of a running clock loop there is an error.

Start the clock loop:
(start-clock-loop :tempo 110/60)

Then I try to change it using one of these functions:
(play (event :type :tempo :tempo 60/60))
(tempo 90/60)

Both of those throw this error:

There is no applicable method for the generic function
  #<STANDARD-GENERIC-FUNCTION CL-PATTERNS::BACKEND-TIMESTAMPS-FOR-EVENT (1)>
when called with arguments
  ((EVENT :TYPE :TEMPO :TEMPO 3/2 :BEAT-AT-START 191/60 :TIMESTAMP-AT-START @2023-01-08T22:06:14.017817-05:00)
   #<CL-PATTERNS::TASK :ITEM #<T-PSTREAM (EVENT :TYPE :TEMPO :TEMPO 3/2) 1>>
   #<CL-PATTERNS::SUPERCOLLIDER {700B1F1C63}>).
   [Condition of type SB-PCL::NO-APPLICABLE-METHOD-ERROR]
Restarts: 
  0: [RETRY] Retry calling the generic function.
  1: [SKIP-EVENT] Skip this event, preserving the task on the clock so it can be run again.
  2: [REMOVE-TASK] Remove this task from the clock.
  3: [ABORT] abort thread (#<THREAD "cl-patterns clock-loop" RUNNING {700737DCA3}>)

Stack Trace: 
  0: ((:METHOD NO-APPLICABLE-METHOD (T)) #<STANDARD-GENERIC-FUNCTION CL-PATTERNS::BACKEND-TIMESTAMPS-FOR-EVENT (1)> (EVENT :TYPE :TEMPO :TEMPO 3/2 :BEAT-AT-START 191/60 :TIMESTAMP-AT-START @2023-01-08T22:0..
  1: (SB-PCL::CALL-NO-APPLICABLE-METHOD #<STANDARD-GENERIC-FUNCTION CL-PATTERNS::BACKEND-TIMESTAMPS-FOR-EVENT (1)> ((EVENT :TYPE :TEMPO :TEMPO 3/2 :BEAT-AT-START 191/60 :TIMESTAMP-AT-START @2023-01-08T22:0..
  2: ((:METHOD CL-PATTERNS::CLOCK-PROCESS-EVENT (T T T (EQL :TEMPO))) #<CL-PATTERNS::CLOCK :TEMPO 11/6 (110 BPM) :BEAT 3.0> #<CL-PATTERNS::TASK :ITEM #<T-PSTREAM (EVENT :TYPE :TEMPO :TEMPO 3/2) 1>> (EVENT ..
  3: ((FLET SB-THREAD::WITH-RECURSIVE-LOCK-THUNK :IN CLOCK-PROCESS))
  4: ((FLET "WITHOUT-INTERRUPTS-BODY-11" :IN SB-THREAD::CALL-WITH-RECURSIVE-LOCK))
  5: (SB-THREAD::CALL-WITH-RECURSIVE-LOCK #<FUNCTION (FLET SB-THREAD::WITH-RECURSIVE-LOCK-THUNK :IN CLOCK-PROCESS) {1092C097B}> #<SB-THREAD:MUTEX "Anonymous recursive lock" owner: #<SB-THREAD:THREAD "cl-pa..
  6: (CLOCK-PROCESS #<CL-PATTERNS::CLOCK :TEMPO 11/6 (110 BPM) :BEAT 3.0> 1/10)
  7: (CLOCK-LOOP #<CL-PATTERNS::CLOCK :TEMPO 11/6 (110 BPM) :BEAT 3.0> :GRANULARITY NIL)
  8: ((LAMBDA NIL :IN START-CLOCK-LOOP))
  9: ((LAMBDA NIL :IN BORDEAUX-THREADS::BINDING-DEFAULT-SPECIALS))
  10: ((FLET SB-UNIX::BODY :IN SB-THREAD::RUN))
  11: ((FLET "WITHOUT-INTERRUPTS-BODY-127" :IN SB-THREAD::RUN))
  12: ((FLET SB-UNIX::BODY :IN SB-THREAD::RUN))
  13: ((FLET "WITHOUT-INTERRUPTS-BODY-120" :IN SB-THREAD::RUN))
  14: (SB-THREAD::RUN)

Thanks for your help and this amazing library!

Sorry about that; I had the new version in my local repo but didn't notice it should have been committed. If you pull the latest git master of cl-patterns into your quicklisp local-projects and reload it, it should be fixed now. Let me know if you have any other issues, and thank you for the kind words :)

@defaultxr thank you! i'm going to give that a try right now.