First time here? Check out the FAQ!
x

Hotvalues and triggers in encapsulations

0 votes
254 views
I'm trying to encapsulate a new class, and when I press New class from example in the Action menu, I get prompted for default values, but some of my default values has to be hotvalues, as they for example trigger the start of a memorywriter recording several times.

I could of course give those specific variables, ?record f.ex., a default value of 1 or 0, but then I get an error that I'm dividing by zero somewhere. My guess is, that it's because I somewhere have an expression saying  
(1 / (?record durationOfGate))
If record is 1, then I guess this will be 1 / 0

Is there a way to get hotvalues in there from the beginning, or does my problem stem from something else?

I'm a bit out of my depth, and hope this is decipherable.

Thanks
Anders
asked May 11, 2020 in Capytalk & Smalltalk by anders-skibsted (Adept) (1,320 points)
To avoid dividing by zero, you could try:
(1 / (?record durationOfGate max: 0.001))
This worked!
But a more general question, is there a way to get something I encapsulate to a class, to generate hotvalues? I'm using a lot of osc signals coming in, and it would be a lot easier if I could just generate the hotvalues in my script in my encapsulation, instead of having parameters where I later type in the hotvalues with appropriate names.
When I try to it gives me an error, that I can't use hotvalues in encapsulation. Is this described somewhere in Kyma x revealed?
The reason it gives an error is to discourage the practice of setting a GeneratedEvent name to a green variable in an encapsulated Sound. A user defined class defined in this way may not work properly in all circumstances (for example, in a Timeline or Multigrid). See https://kyma.symbolicsound.com/qa/5107/encapsulating-sound-with-generatedevent-parameter-would?show=5124#c5124

Please log in or register to answer this question.

...