Commit 3cdcbcde authored by Dave Griffiths's avatar Dave Griffiths
Browse files

lz fix

parent bd647de2
; lz/nz
(synth-init 10 44100)
(synth-init 50 44100)
(define (make-lz md d stk w h mem)
(vector md d stk w h mem))
......@@ -127,9 +127,10 @@
(define (nz-tick nz)
(when (ntp>? (ntp-time-add (t) (nz-off nz)) (nz-cur-t nz))
(set-nz-cur-t! nz (ntp-time-add (nz-cur-t nz) (nz-tk nz)))
(let ((t (lz-tick (nz-lz nz)))
(v (car (nz-vals nz))))
(when (or (char=? t #\a) (char=? t #\b) (char=? t #\c) (char=? t #\b) (char=? t #\ ))
(set-nz-cur-t! nz (ntp-time-add (nz-cur-t nz) (nz-tk nz))))
(cond
((char=? t #\+) (set-nz-vals! nz (cons (+ (car (nz-vals nz)) 1) (cdr (nz-vals nz)))))
((char=? t #\-) (set-nz-vals! nz (cons (- (car (nz-vals nz)) 1) (cdr (nz-vals nz)))))
......@@ -189,11 +190,8 @@
(add
(saw (add (/ (note v) 4) (mul 1000 (pow (adsr 0.3 0.1 0 0) 3))))
(saw (add (+ 1 (/ (note v) 4)) (mul 1000 (pow (adsr 0.1 0.1 0 0) 3)))))))
(lambda (v) (mul (adsr 0 0.02 0 0) (mooglp (white 4) (* v 0.01) 0.45)))))
)
(lambda (v) (mul (adsr 0 0.02 0 0) (mooglp (white 4) (* v 0.01) 0.45))))
(define ss2
(list
(list
(lambda (v) (moogbp (mul (adsr 0 0.2 0.1 0.1) (pink 100)) (adsr 0 0.01 0.1 1) 0.3))
(lambda (v) (mul (adsr 0 0.01 0 1) (white 20)))
......@@ -215,11 +213,11 @@
(lambda (v) (mul (adsr 0 0.01 0.1 1) (pink (+ 140 (* v 20)))))
(lambda (v) (mul (adsr 0 0.01 0.1 1) (pink (mul (adsr 0 0.1 0 0) (+ 40 (* v 50)))))))
))
)
)
(define z (build-nz l ss 0.2))
(every-frame (nz-tick z))
......@@ -226,8 +226,8 @@ void Graph::Process(unsigned int bufsize, Sample &left, Sample &right)
if (pan<0) leftpan=1-pan;
else rightpan=1+pan;
left.MulMix(m_NodeMap[i->first]->GetOutput(),0.5*leftpan);
right.MulMix(m_NodeMap[i->first]->GetOutput(),0.5*rightpan);
left.MulMix(m_NodeMap[i->first]->GetOutput(),2.5*leftpan);
right.MulMix(m_NodeMap[i->first]->GetOutput(),2.5*rightpan);
}
}
......
......@@ -269,20 +269,26 @@ int main(int argc, char *argv[])
//usleep(5*1000);
if (window) DisplayCallback();
else {
if (!pthread_mutex_trylock(render_mutex)) {
appEval("(frame-hook)");
pthread_mutex_unlock(render_mutex);
}
if (!pthread_mutex_trylock(render_mutex)) {
appEval("(frame-hook)");
pthread_mutex_unlock(render_mutex);
}
}
usleep(1000);
}
#else
if (window) glutMainLoop();
else while(true)
{
appEval("(frame-hook)");
usleep(1000);
}
else
{
while(true)
{
if (!pthread_mutex_trylock(render_mutex)) {
appEval("(frame-hook)");
usleep(1000);
pthread_mutex_unlock(render_mutex);
}
}
}
#endif
return 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment