Help with custom Send/Recieve code


#1

This is very similar to https://sebiik.github.io/community.axoloti.com.backup/t/fixed-coded-object-referencing-instead-of-using-an-attribute/3825/6

But that thread seems to have wrapped up and it did not have a syntax example which would be super helpful.

In the factory 'recv f' I find this code in the k-rate tab, 'outlet_v = attr_sender.vi;'. The 'attrsender' is an object reference which is the 'name' of the send object.

It seems like all I have to do is change 'attr_sender.vi' to 'object-name'.vi. If I want more send/receives I just add variables in the send/receive objects that take the place of '_vi'.

Here is some pseudo code of what I want to accomplish:

In send object, named 'midiCentral'
int32_t send = 1<<27;

In receive object;
int32_t receive = parent->instancemidiCentral_i.send;

Is that all there is to it?


#2

yes and no :slight_smile:
yes, if the instance is in the same patch, that is all there is to it...
e.g. if its in a parent patch its a bit different.
(you can look at xpatch.cpp, to see the built code if your interested in what happens then)

also IF the user renames the object. of course, this will break this code.
now that's ok, if your using it privately, you hacked it, you know it
but not a good idea if your sharing code in a library, where your users do not know that you've hardcoded this, and so wonder why they get compile errors. (which they probably have no idea what they mean)


#3

Thanks! That is helpful.

In my case, the patch is designed to be used with one specific midi controller ( a BCR 2000 ) which needs to be mapped to specific CC channels for my control scheme to conform to the BCR's design/capabilities. So if my code ever goes into the community (it is a possibility, I have put a lot of work into my project), they would need to use it with a BCR 2000 or modify the code significantly even if I don't hard code object references.

I am creating a 8 voice (with 6 controls each, and ability to route/weigh 4 cv inputs to each control) drum machine that takes 8 trigger inputs and 4 cv inputs from Eurorack modules. It also sends 24ppq midi clock as CV pulses to Eurorack. I'm using it with a Trigger Riot module and a DSI Pro-2. It is actually mostly done and the breadboard prototype is fully functional. I have hard-coded bass, snare, and cymbal voices to save sram and allow 8 voices to run/be-controlled (hard-coding the voice 'patches' allowed me to have 8 voices instead of about 2 if they were in sub-patches) . I am going to design other hard coded voices to plug-in like a 'synth-voice' and a simple sampler. I just need to build the proto-board, slap it in a box, and polish/expand the code.

I will fully spill the beans about the project once it is a bit further along. At that time I will consider if the code part and hardware io design is worth sharing. There are probably a few pieces of code/ objects people will find useful like the hard-coded drum voices perhaps, which would not be too hard to modify to create normal patch-able control inputs.


#4

If you want a starting point for the simple sampler I made a really simple one here, called: jaffa/sam/simsam1:

Yes there is a lot to gain by doing that :slight_smile:


#5

Thanks for mentioning your sample player. I will definitely check it out. Why reinvent the wheel?