diff options
Diffstat (limited to 'apps/plugins/pdbox/PDa/src/d_ugen.c')
-rw-r--r-- | apps/plugins/pdbox/PDa/src/d_ugen.c | 51 |
1 files changed, 44 insertions, 7 deletions
diff --git a/apps/plugins/pdbox/PDa/src/d_ugen.c b/apps/plugins/pdbox/PDa/src/d_ugen.c index 2c359c384d..6cf0a5a97d 100644 --- a/apps/plugins/pdbox/PDa/src/d_ugen.c +++ b/apps/plugins/pdbox/PDa/src/d_ugen.c | |||
@@ -21,11 +21,17 @@ | |||
21 | * | 21 | * |
22 | */ | 22 | */ |
23 | 23 | ||
24 | 24 | #ifdef ROCKBOX | |
25 | #include "plugin.h" | ||
26 | #include "pdbox.h" | ||
27 | #include "m_pd.h" | ||
28 | #include "m_imp.h" | ||
29 | #else /* ROCKBOX */ | ||
25 | #include "m_pd.h" | 30 | #include "m_pd.h" |
26 | #include "m_imp.h" | 31 | #include "m_imp.h" |
27 | #include <stdlib.h> | 32 | #include <stdlib.h> |
28 | #include <stdarg.h> | 33 | #include <stdarg.h> |
34 | #endif /* ROCKBOX */ | ||
29 | 35 | ||
30 | extern t_class *vinlet_class, *voutlet_class, *canvas_class; | 36 | extern t_class *vinlet_class, *voutlet_class, *canvas_class; |
31 | t_sample *obj_findsignalscalar(t_object *x, int m); | 37 | t_sample *obj_findsignalscalar(t_object *x, int m); |
@@ -258,6 +264,10 @@ static t_int *block_epilog(t_int *w) | |||
258 | 264 | ||
259 | static void block_dsp(t_block *x, t_signal **sp) | 265 | static void block_dsp(t_block *x, t_signal **sp) |
260 | { | 266 | { |
267 | #ifdef ROCKBOX | ||
268 | (void) x; | ||
269 | (void) sp; | ||
270 | #endif | ||
261 | /* do nothing here */ | 271 | /* do nothing here */ |
262 | } | 272 | } |
263 | 273 | ||
@@ -303,6 +313,7 @@ void dsp_tick(void) | |||
303 | t_int *ip; | 313 | t_int *ip; |
304 | for (ip = dsp_chain; *ip; ) ip = (*(t_perfroutine)(*ip))(ip); | 314 | for (ip = dsp_chain; *ip; ) ip = (*(t_perfroutine)(*ip))(ip); |
305 | dsp_phase++; | 315 | dsp_phase++; |
316 | printf("%d\n", dsp_phase); | ||
306 | } | 317 | } |
307 | } | 318 | } |
308 | 319 | ||
@@ -330,9 +341,13 @@ static t_signal *signal_usedlist; | |||
330 | /* call this when DSP is stopped to free all the signals */ | 341 | /* call this when DSP is stopped to free all the signals */ |
331 | void signal_cleanup(void) | 342 | void signal_cleanup(void) |
332 | { | 343 | { |
344 | #ifdef ROCKBOX | ||
345 | t_signal *sig; | ||
346 | #else | ||
333 | t_signal **svec, *sig, *sig2; | 347 | t_signal **svec, *sig, *sig2; |
348 | #endif | ||
334 | int i; | 349 | int i; |
335 | while (sig = signal_usedlist) | 350 | while((sig = signal_usedlist)) |
336 | { | 351 | { |
337 | signal_usedlist = sig->s_nextused; | 352 | signal_usedlist = sig->s_nextused; |
338 | if (!sig->s_isborrowed) | 353 | if (!sig->s_isborrowed) |
@@ -397,9 +412,15 @@ void signal_makereusable(t_signal *sig) | |||
397 | 412 | ||
398 | t_signal *signal_new(int n, float sr) | 413 | t_signal *signal_new(int n, float sr) |
399 | { | 414 | { |
415 | #ifdef ROCKBOX | ||
416 | int logn; | ||
417 | #else | ||
400 | int logn, n2; | 418 | int logn, n2; |
419 | #endif | ||
401 | t_signal *ret, **whichlist; | 420 | t_signal *ret, **whichlist; |
421 | #ifndef ROCKBOX | ||
402 | t_sample *fp; | 422 | t_sample *fp; |
423 | #endif | ||
403 | logn = ilog2(n); | 424 | logn = ilog2(n); |
404 | if (n) | 425 | if (n) |
405 | { | 426 | { |
@@ -413,7 +434,7 @@ t_signal *signal_new(int n, float sr) | |||
413 | whichlist = &signal_freeborrowed; | 434 | whichlist = &signal_freeborrowed; |
414 | 435 | ||
415 | /* first try to reclaim one from the free list */ | 436 | /* first try to reclaim one from the free list */ |
416 | if (ret = *whichlist) | 437 | if((ret = *whichlist)) |
417 | *whichlist = ret->s_nextfree; | 438 | *whichlist = ret->s_nextfree; |
418 | else | 439 | else |
419 | { | 440 | { |
@@ -520,8 +541,10 @@ static t_dspcontext *ugen_currentcontext; | |||
520 | 541 | ||
521 | void ugen_stop(void) | 542 | void ugen_stop(void) |
522 | { | 543 | { |
544 | #ifndef ROCKBOX | ||
523 | t_signal *s; | 545 | t_signal *s; |
524 | int i; | 546 | int i; |
547 | #endif | ||
525 | if (dsp_chain) | 548 | if (dsp_chain) |
526 | { | 549 | { |
527 | freebytes(dsp_chain, dsp_chainsize * sizeof (t_int)); | 550 | freebytes(dsp_chain, dsp_chainsize * sizeof (t_int)); |
@@ -577,8 +600,10 @@ t_dspcontext *ugen_start_graph(int toplevel, t_signal **sp, | |||
577 | int ninlets, int noutlets) | 600 | int ninlets, int noutlets) |
578 | { | 601 | { |
579 | t_dspcontext *dc = (t_dspcontext *)getbytes(sizeof(*dc)); | 602 | t_dspcontext *dc = (t_dspcontext *)getbytes(sizeof(*dc)); |
603 | #ifndef ROCKBOX | ||
580 | float parent_srate, srate; | 604 | float parent_srate, srate; |
581 | int parent_vecsize, vecsize; | 605 | int parent_vecsize, vecsize; |
606 | #endif | ||
582 | 607 | ||
583 | if (ugen_loud) post("ugen_start_graph..."); | 608 | if (ugen_loud) post("ugen_start_graph..."); |
584 | 609 | ||
@@ -672,7 +697,11 @@ static void ugen_doit(t_dspcontext *dc, t_ugenbox *u) | |||
672 | { | 697 | { |
673 | t_sigoutlet *uout; | 698 | t_sigoutlet *uout; |
674 | t_siginlet *uin; | 699 | t_siginlet *uin; |
700 | #ifdef ROCKBOX | ||
701 | t_sigoutconnect *oc; | ||
702 | #else | ||
675 | t_sigoutconnect *oc, *oc2; | 703 | t_sigoutconnect *oc, *oc2; |
704 | #endif | ||
676 | t_class *class = pd_class(&u->u_obj->ob_pd); | 705 | t_class *class = pd_class(&u->u_obj->ob_pd); |
677 | int i, n; | 706 | int i, n; |
678 | /* suppress creating new signals for the outputs of signal | 707 | /* suppress creating new signals for the outputs of signal |
@@ -681,13 +710,13 @@ static void ugen_doit(t_dspcontext *dc, t_ugenbox *u) | |||
681 | we delay new signal creation, which will be handled by calling | 710 | we delay new signal creation, which will be handled by calling |
682 | signal_setborrowed in the ugen_done_graph routine below. */ | 711 | signal_setborrowed in the ugen_done_graph routine below. */ |
683 | int nonewsigs = (class == canvas_class || | 712 | int nonewsigs = (class == canvas_class || |
684 | (class == vinlet_class) && !(dc->dc_reblock)); | 713 | ((class == vinlet_class) && !(dc->dc_reblock))); |
685 | /* when we encounter a subcanvas or a signal outlet, suppress freeing | 714 | /* when we encounter a subcanvas or a signal outlet, suppress freeing |
686 | the input signals as they may be "borrowed" for the super or sub | 715 | the input signals as they may be "borrowed" for the super or sub |
687 | patch; same exception as above, but also if we're "switched" we | 716 | patch; same exception as above, but also if we're "switched" we |
688 | have to do a copy rather than a borrow. */ | 717 | have to do a copy rather than a borrow. */ |
689 | int nofreesigs = (class == canvas_class || | 718 | int nofreesigs = (class == canvas_class || |
690 | (class == voutlet_class) && !(dc->dc_reblock || dc->dc_switched)); | 719 | ((class == voutlet_class) && !(dc->dc_reblock || dc->dc_switched))); |
691 | t_signal **insig, **outsig, **sig, *s1, *s2, *s3; | 720 | t_signal **insig, **outsig, **sig, *s1, *s2, *s3; |
692 | t_ugenbox *u2; | 721 | t_ugenbox *u2; |
693 | 722 | ||
@@ -701,7 +730,7 @@ static void ugen_doit(t_dspcontext *dc, t_ugenbox *u) | |||
701 | s3 = signal_new(dc->dc_vecsize, dc->dc_srate); | 730 | s3 = signal_new(dc->dc_vecsize, dc->dc_srate); |
702 | /* post("%s: unconnected signal inlet set to zero", | 731 | /* post("%s: unconnected signal inlet set to zero", |
703 | class_getname(u->u_obj->ob_pd)); */ | 732 | class_getname(u->u_obj->ob_pd)); */ |
704 | if (scalar = obj_findsignalscalar(u->u_obj, i)) | 733 | if((scalar = obj_findsignalscalar(u->u_obj, i))) |
705 | dsp_add_scalarcopy(scalar, s3->s_vec, s3->s_n); | 734 | dsp_add_scalarcopy(scalar, s3->s_vec, s3->s_n); |
706 | else | 735 | else |
707 | dsp_add_zero(s3->s_vec, s3->s_n); | 736 | dsp_add_zero(s3->s_vec, s3->s_n); |
@@ -781,7 +810,7 @@ static void ugen_doit(t_dspcontext *dc, t_ugenbox *u) | |||
781 | u2 = oc->oc_who; | 810 | u2 = oc->oc_who; |
782 | uin = &u2->u_in[oc->oc_inno]; | 811 | uin = &u2->u_in[oc->oc_inno]; |
783 | /* if there's already someone here, sum the two */ | 812 | /* if there's already someone here, sum the two */ |
784 | if (s2 = uin->i_signal) | 813 | if((s2 = uin->i_signal)) |
785 | { | 814 | { |
786 | s1->s_refcount--; | 815 | s1->s_refcount--; |
787 | s2->s_refcount--; | 816 | s2->s_refcount--; |
@@ -825,7 +854,11 @@ static void ugen_doit(t_dspcontext *dc, t_ugenbox *u) | |||
825 | 854 | ||
826 | void ugen_done_graph(t_dspcontext *dc) | 855 | void ugen_done_graph(t_dspcontext *dc) |
827 | { | 856 | { |
857 | #ifdef ROCKBOX | ||
858 | t_ugenbox *u; | ||
859 | #else | ||
828 | t_ugenbox *u, *u2; | 860 | t_ugenbox *u, *u2; |
861 | #endif | ||
829 | t_sigoutlet *uout; | 862 | t_sigoutlet *uout; |
830 | t_siginlet *uin; | 863 | t_siginlet *uin; |
831 | t_sigoutconnect *oc, *oc2; | 864 | t_sigoutconnect *oc, *oc2; |
@@ -966,7 +999,11 @@ void ugen_done_graph(t_dspcontext *dc) | |||
966 | for (u = dc->dc_ugenlist; u; u = u->u_next) | 999 | for (u = dc->dc_ugenlist; u; u = u->u_next) |
967 | { | 1000 | { |
968 | t_pd *zz = &u->u_obj->ob_pd; | 1001 | t_pd *zz = &u->u_obj->ob_pd; |
1002 | #ifdef ROCKBOX | ||
1003 | t_signal **outsigs = dc->dc_iosigs; | ||
1004 | #else | ||
969 | t_signal **insigs = dc->dc_iosigs, **outsigs = dc->dc_iosigs; | 1005 | t_signal **insigs = dc->dc_iosigs, **outsigs = dc->dc_iosigs; |
1006 | #endif | ||
970 | if (outsigs) outsigs += dc->dc_ninlets; | 1007 | if (outsigs) outsigs += dc->dc_ninlets; |
971 | 1008 | ||
972 | if (pd_class(zz) == vinlet_class) | 1009 | if (pd_class(zz) == vinlet_class) |