First time here? Check out the FAQ!
x

How do you encapsulate a Replicator?

0 votes
639 views

Let's say I want to make a special kind of Replicator. For instance a panning replicator that pans all its replicated Sounds from left to right. I do this kind of thing a lot so thought it would be useful to encapsulate. (It was also the exercise we tried in the Kata tonight). 

This seems kind of easy at first. I get a Replicator and a Pan Sound and put some expression in the Pan parameter using ?VoiceNumber etc.

But when I try to encapsulate it I get stuck. In the Replicator I put "?Number" in its Number parameter field. Then the class editor asks me to enter a value for ?Number. If I put 0 (zero), I get no replicatedSound parameter in my new class. If I put 1 for ?Number, I get two Sound parameters, "ReplicatedSound" and "ReplicatedSound_1". 

I tried adding "?replicatedSound" to the SpecialEvents list, but that didn't work.

I tried using a Script to assemble the Sound, like this:

But that didn't work either. 

 

So how would I encapsulate my own kind of Replicator?

 

asked Jan 28, 2019 in Using Kyma by alan-jackson (Virtuoso) (15,840 points)

3 Answers

0 votes
Alternatively you could make an example of the Replicated Panner and set the Input to be the ReplaceableInput. That would be just as effective and direct a way to apply your replicated panning structure to any new input.
answered Jan 29, 2019 by ssc (Savant) (126,620 points)
0 votes
At neverenginelabs.com we encapsulate replicators all the time in different ways.

I'll try to prepare a short demonstration if I have time...

A replicator is basically a Scripted building sound, so you can get similar things in SmallTalk, but without the ?VoiceNumber and ?NumberVoices being distributed outside the Class
answered Jan 29, 2019 by cristian-vogel (Master) (8,410 points)
edited Jan 29, 2019 by cristian-vogel
The problem is that Encapsulated Classes cannot pass lifted Variables ( the ?green ones )
To clarify, I think what Cristian may be suggesting is that you could create a Script to instantiate multiple copies of your panned input (and then encapsulate the Script), rather than literally encapsulating the Replicator Sound. You can find examples of Scripts that build multiple copies of Sounds in the Kyma Sound Library under Scripts, constructors, sequencers & composition in the Sound file Scripts*.kym.
0 votes

HI Alan,

 

Here is an example of an encapsulated Replicator. I am not sure it is what you were after, but maybe you can crack open the capsule and  figure out how I did it.

http://kyma.symbolicsound.com/qa/?qa=blob&qa_blobid=9461793282238148738

answered Feb 23, 2019 by cristian-vogel (Master) (8,410 points)
...