GameOfLife / Unit-Lib

The Unit Library is a system that provides high level abstractions on top of the SuperCollider language.
25 stars 6 forks source link

UGlobalEQ not working with supernova #21

Closed miguel-negrao closed 11 years ago

miguel-negrao commented 11 years ago

Supernova has much more checks then scsynth. Whenever I use the UGlobalEQ in UnitLib I get:

argument number out of range

from supernova, which means we are trying to set to a control higher then the number of controls that exist:

void sc_synth::set(slot_index_t slot_index, sample val)
{
    if (slot_index >= mNumControls) {
        log("argument number out of range\n");
        return;
    }

    mControlRates[slot_index] = 0;
    mMapControls[slot_index] = &mControls[slot_index];
    mControls[slot_index] = val;
}

This happens when units with which don't have the EQ are present, and those units will get their controls changed by the EQ set messages... strange, will check this with tim

woutersnoei commented 11 years ago

Does it happen also on fullEQ Units? I don't see anything weird here. UGlobalEQ.eqSetting.asControlInput returns an array with 16 values, and it is used in:

\u_globalEQ_setting.kr( eqSetting.asControlInput );

Also when I look into the synthDef of an arbitrary Udef:

\output.asUdef.synthDef[0].allControlNames.collect(_.defaultValue)[2].size; // -> 16

Could it be because we are using the rootnode to mass-set the value for all synths, and the ones that don't have the arg at all give the error?

miguel-negrao commented 11 years ago

It doesn't happen with fullEQ units. I would assume that if you .set with a control name that does not exist in the synth, nothing happens right ? And the same would be true when you do set on RootNode ? Perhaps it's a supernova bug, I have to cook a reproducer for tim

woutersnoei commented 11 years ago

SynthDef( "test1", { |a = 0, b = 1| Out.ar( 0, Silent.ar ); }).add;

SynthDef( "test2", { |b = 1| Out.ar( 0, Silent.ar ); }).add;

z = [ Synth( "test1" ), Synth( "test2" ) ];

RootNode(s).set( \a, 1 ); // does this produce the message?

RootNode(s).dumpTree( true );

// posts: NODE TREE Group 0 1 group 1001 test2 b: 1 1000 test1 a: 1 b: 1

miguel-negrao commented 11 years ago

Nope, that doesn't cause the issue:

RootNode(s).set( \a, 5)
NODE TREE Group 0
   0 group
      1 group
         1001 test2
            b: 1
         1000 test1
            a: 5
            b: 1

but check this,

RootNode(s).set( \a, [5,10] ); // does this produce the message?

RootNode(0)
argument number out of range
RootNode(0)
NODE TREE Group 0
   0 group
      1 group
         1001 test2
            b: 10
         1000 test1
            a: 5
            b: 10

so that is the issue. This looks like a bug, no ?

woutersnoei commented 11 years ago

And this?

SynthDef( "test1", { |a = #[0,0], b = 1| Out.ar( 0, Silent.ar ); }).add;

SynthDef( "test2", { |b = 1| Out.ar( 0, Silent.ar ); }).add;

z = [ Synth( "test1" ), Synth( "test2" ) ];

RootNode(s).set( \a, [1,1] );

miguel-negrao commented 11 years ago

Yes, that one also causes the warning:

RootNode(s).set( \a, [2,2] );

RootNode(0) argument number out of range

and sets the value of b to 2

RootNode(0)
argument number out of range
RootNode(0)
NODE TREE Group 0
   0 group
      1 group
         1001 test2
            b: 2
         1000 test1
            a: 2, 2
            b: 1
miguel-negrao commented 11 years ago

Opened an issue for supernova https://github.com/supercollider/supercollider/issues/916