Max C external - creating hash table.


    Nov 13 2020 | 4:55 pm
    Hello,
    I am fairly new at this, so I was wondering if anyone has any good resources about creating a hash table in a C external. The data is sent through an inlet, and needs to be stored in a hash table. The receiving of the data I know how to do, but I can't understand the documentation much on the creation of the hash table.
    There will be 5 keys and each of the keys will have 12 arrays of data, numbered 1-12. I also don't need to dynamically allocate it because I know the exact number of elements.
    Thank you in advance!

    • Nov 13 2020 | 8:06 pm
      You have very simple requirements. Why do you need to write an external in C?
      There are objects such as [dict] or [coll] that can easily satisfy your requirements. You can use those objects to structure your data as you have described. Much quicker and easier than writing an external from scratch, especially if you are not familiar with the Max/MSP SDK.
    • Nov 15 2020 | 10:26 am
      I will be needing the hash data structure for further development later on in the project.
    • Nov 15 2020 | 4:56 pm
      Hi Iva, if you know you want to be doing it in C, here are some tips: - make a pointer to it in your object struct: - initialize this in your new method and set flags (look up the flags in the sdk docs) - don't forget in your free method to delete items from your hashtab. The various flags control how much this happens automatically (ie, is the item freed when taken out of the hashtab or not)
      I use one of them in Scheme For Max, "registry", and you can look at how I use it here: https://github.com/iainctduncan/scheme-for-max/blob/master/s4m/s4m.c