Questions about Gate Outs

This forum is for developers of Rack Extensions to discuss the RE SDK, share code, and offer tips to other developers.
Post Reply
wendallsan
Posts: 45
Joined: 10 Dec 2017

14 Jun 2021

I am trying to figure out how to use gate outs via a simple exercise to 'pass through' a gate signal through a device when a gate is received on a gate input on the back panel. I see that the Silence Detection Effect example in the SDK has a gate out on it, but I wasn't able to figure out how it works after reviewing its code.

I have a gate input that is currently working well and is flashing a lamp on the front of the device for 0.3 seconds when a gate signal is received (all thanks to the Hello World tutorial). I want to have the gate out on the back panel go 'high' when this lamp is on. How do I make a gate out go 'high'?

I've dropped in relevant bits of code below of what I have so far, in case that is helpful. Thanks for any assistance you can provide!

device_2d.lua:

Code: Select all

...
back = {
	Bg = {
      { path = "Panel_Back_1U" },
  },
  TapeBack = {
    offset = { 200, 50 },
    { path = "Tape_Horizontal_1frames" },
  },
  Placeholder = {
      offset = { 100, 120 },
      {path = "Placeholder"}
  },
  S_cv_input_socket_gate_cv = {
    offset = { 1555, 55 },
    {path="SharedCVJack", frames = 3},
  },
  S_cv_output_socket_gate_cv = {
    offset = { 1555, 155 },
    { path="SharedCVJack", frames = 3 }
  }
}
...
hdgui_2D.lua:

Code: Select all

...
back = jbox.panel{
	...
		jbox.cv_output_socket{
			graphics = { node = "S_cv_output_socket_gate_cv" },
			socket = "/cv_outputs/trigger_out",
		}
	...
}
...
motherboard_ref.lua:

Code: Select all

...
cv_outputs = {
	trigger_out = jbox.cv_output{
		ui_name = jbox.ui_text( "text_triggerOutIsOn" )
	}
  }
custom_properties = jbox.property_set{
	rt_owner = {
		properties = {
			lampIsOn = jbox.boolean{
				default = false,
				ui_name = jbox.ui_text( "text_lampIsOn" ),
				ui_type = jbox.ui_linear( { min = 0, max = 1, units= {{decimals=0}} } ),
			},
			triggerOutIsOn = jbox.boolean{
				default = false,
				ui_name = jbox.ui_text( "text_triggerOutIsOn" ),
				ui_type = jbox.ui_linear( { min = 0, max = 1, units= {{decimals=0}} } ),
			}
		}
	},
    ...
}
...
MyExtension.h:

Code: Select all

...
private: TJBox_PropertyRef fTriggerOutIsOnPropertyRef;
private: TJBox_ObjectRef fTriggerCVRef;
...
MyExtension.cpp:

Code: Select all

// CONSTRUCTOR
MyExtension::MyExtension( TJBox_Float32 iSampleRate ) :
    ...
	fTriggerOutIsOnPropertyRef( JBox_MakePropertyRef( fCustomProps, "triggerOutIsOn" ) ),
	fTriggerCVRef( JBox_GetMotherboardObjectRef( "/cv_outputs/trigger_out" ) )
{}

// RENDERBATCH
void MyExtension::RenderBatch( const TJBox_PropertyDiff iPropertyDiffs[], TJBox_UInt32 iDiffCount ){
	HandleCVInputChanges();
	HandleLampTurnOff();
	HandleTriggerOutTurnOff();
}

void MyExtension::HandleCVInputChanges(){
	...
	TJBox_Value gateCVValue = JBox_LoadMOMProperty( fGateCVInputRef );
	TJBox_Tag gateCV = clamp( JBox_GetNumber( gateCVValue ) * 127.f, 0, 127 );
	if( gateCV != fLastGateCV ){
		if( gateCV > 0 ) {
			SetLampState( true );
			SetTriggerOut( true );
		}
		fLastGateCV = gateCV;
	}
}

void CMyExtension::SetLampState( bool bLampState ){
    JBox_StoreMOMProperty( fLampIsOnPropertyRef, JBox_MakeBoolean( bLampState ) );
    if( bLampState ){
        fSecondsUntilLampTurnOff = 0.3f;
    }
}

void CMyExtension::SetTriggerOut( bool bTriggerOutState ){	
	JBox_StoreMOMProperty( fTriggerOutIsOnPropertyRef, JBox_MakeBoolean( bTriggerOutState ) );	
	JBox_StoreMOMPropertyAsNumber( fTriggerCVRef, kJBox_CVOutputValue, 1.f );
    if( bTriggerOutState ){
        fSecondsUntilTriggerOutTurnOff = 0.3f;
    }
}

void CMyExtension::HandleLampTurnOff() {
	if( fSecondsUntilLampTurnOff > 0.f ){
		fSecondsUntilLampTurnOff -= kBatchSize / fSampleRate;
	} else if( fSecondsUntilLampTurnOff > -1.f ){
        SetLampState( false );
		JBOX_TRACE( "Lamp turn off" );
	}
}

void CMyExtension::HandleTriggerOutTurnOff(){
	if( fSecondsUntilTriggerOutTurnOff > 0.f ){
		fSecondsUntilTriggerOutTurnOff -= kBatchSize / fSampleRate;
	} else if( fSecondsUntilTriggerOutTurnOff > -1.f ){
        SetTriggerOut( false );
	}
}

User avatar
orthodox
RE Developer
Posts: 2286
Joined: 22 Jan 2015
Location: 55°09'24.5"N 37°27'41.4"E

14 Jun 2021

Looks good, what's wrong with it? Doesn't it work?

wendallsan
Posts: 45
Joined: 10 Dec 2017

14 Jun 2021

orthodox wrote:
14 Jun 2021
Looks good, what's wrong with it? Doesn't it work?
Hi and thanks for the response! When I hook the Gate Out to another device's Gate In (Kong, in my testing), I'm not seeing that gate being activated. So it doesn't look like the Gate Out signal is changing or is being recognized by the other device. I can bypass my device and see that Kong's pad is lighting up on a gate signal from a different source, but not when it's hooked up to my dev rack extension. My device seems to be receiving Gate signals without a problem, is merrily lighting a lamp each time it gets one, but doesn't seem to be passing this along to the Gate Out at this time.

User avatar
orthodox
RE Developer
Posts: 2286
Joined: 22 Jan 2015
Location: 55°09'24.5"N 37°27'41.4"E

14 Jun 2021

I haven't found where you set "/cv_outputs/trigger_out" to 0.0, it's always 1 regardless of bTriggerOutState .

By the way, you may find this device useful: https://www.reasonstudios.com/shop/rack ... -analyzer/

wendallsan
Posts: 45
Joined: 10 Dec 2017

14 Jun 2021

Thanks again. The CVA-7 Rack Extension does look handy. I've installed it and it appears to be working in Reason, but when I add an instance of it in Recon I get an assert failure and then Recon hangs on me.

Image

wendallsan
Posts: 45
Joined: 10 Dec 2017

14 Jun 2021

orthodox wrote:
14 Jun 2021
I haven't found where you set "/cv_outputs/trigger_out" to 0.0, it's always 1 regardless of bTriggerOutState .
Ah, that's what I needed! I see where I set this to 1.f but you're right, it's not set to anything else. I updated this to use the bool argument sent into the method and viola, it works! Thanks very much for this basic help, hopefully I've mastered the gate out moving forward!

Code: Select all

// ORIGINAL FLAVOR (BAD):
JBox_StoreMOMPropertyAsNumber( fTriggerCVRef, kJBox_CVOutputValue, 1.f );

// CRISPY (GOOD): bTriggerOutState IS A BOOL ARG PASSED INTO THE METHOD
JBox_StoreMOMPropertyAsNumber( fTriggerCVRef, kJBox_CVOutputValue, static_cast<float>( bTriggerOutState ) );

User avatar
orthodox
RE Developer
Posts: 2286
Joined: 22 Jan 2015
Location: 55°09'24.5"N 37°27'41.4"E

15 Jun 2021

orthodox wrote:
14 Jun 2021
I haven't found where you set "/cv_outputs/trigger_out" to 0.0, it's always 1 regardless of bTriggerOutState .

By the way, you may find this device useful: https://www.reasonstudios.com/shop/rack ... -analyzer/
Wasn't aware of that, that's definitely a problem with CVA-7.
There is another one, https://www.reasonstudios.com/shop/rack ... illoscope/ it's free as well and allows at least to watch CV dynamics.

User avatar
pongasoft
RE Developer
Posts: 484
Joined: 21 Apr 2016
Location: Las Vegas
Contact:

15 Jun 2021

That is bizarre that CVA-7 works in Reason but not in Recon. Which version of Recon are you using? (I am the author of CVA-7 btw)

wendallsan
Posts: 45
Joined: 10 Dec 2017

15 Jun 2021

I'm using Recon 11.2.1d10 (build 11418). Let me know if I can do anything for you testing-wise, I might learn something!

User avatar
orthodox
RE Developer
Posts: 2286
Joined: 22 Jan 2015
Location: 55°09'24.5"N 37°27'41.4"E

15 Jun 2021

pongasoft wrote:
15 Jun 2021
That is bizarre that CVA-7 works in Reason but not in Recon. Which version of Recon are you using? (I am the author of CVA-7 btw)
Recon 11.2.1d10

It says:

Code: Select all

c:\newjenkinsslave\workspace\jbuildreconwintestinggit\dev\modules\ui\ui\smugglerapp\app\sbitmaputils.cpp(1210):
ASSERT failure: ((iSequenceSize + iPixelsBetweenFrames) % iNumPhysicalFrames) == 0
Something with filmstrip asset sizes?

User avatar
selig
RE Developer
Posts: 12118
Joined: 15 Jan 2015
Location: The NorthWoods, CT, USA

15 Jun 2021

orthodox wrote:
15 Jun 2021
pongasoft wrote:
15 Jun 2021
That is bizarre that CVA-7 works in Reason but not in Recon. Which version of Recon are you using? (I am the author of CVA-7 btw)
Recon 11.2.1d10

It says:

Code: Select all

c:\newjenkinsslave\workspace\jbuildreconwintestinggit\dev\modules\ui\ui\smugglerapp\app\sbitmaputils.cpp(1210):
ASSERT failure: ((iSequenceSize + iPixelsBetweenFrames) % iNumPhysicalFrames) == 0
Something with filmstrip asset sizes?
Filmstrips must follow the x5 rule with regard to dimensions. 120 px wide is ok, 121 px is not (learned the hard way…).
Selig Audio, LLC

User avatar
pongasoft
RE Developer
Posts: 484
Joined: 21 Apr 2016
Location: Las Vegas
Contact:

16 Jun 2021

I will take a look...

User avatar
pongasoft
RE Developer
Posts: 484
Joined: 21 Apr 2016
Location: Las Vegas
Contact:

24 Jun 2021

wendallsan wrote:
14 Jun 2021
Thanks again. The CVA-7 Rack Extension does look handy. I've installed it and it appears to be working in Reason, but when I add an instance of it in Recon I get an assert failure and then Recon hangs on me.

Image
I have just released a new version of CVA-7 to fix this very problem. Thanks for reporting. https://www.reasonstudios.com/shop/rack ... -analyzer/

wendallsan
Posts: 45
Joined: 10 Dec 2017

01 Jul 2021

Sweet, I look forward to using it in my development attempts moving forward!

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest