Cycling74 / min-devkit

Tools, documentation, and reference implementation of a Max Package built using the Min-API.
MIT License
156 stars 30 forks source link

Online Docs "Writing Audio Objects with Min” error #206

Open madronalabs opened 1 year ago

madronalabs commented 1 year ago

The document "Writing Audio Objects with Min” (http://cycling74.github.io/min-devkit/guide/audio http://cycling74.github.io/min-devkit/guide/audio) has errors: in particular the "Vector Operators” code will not compile because the function names channelcount() and framecount() do not exist in the current API.

isabelgk commented 1 year ago

Hi @madronalabs !

I believe this is the section you're referring to?

The number of channels and the size of the vectors are properties of the audio_bundle. Use the channelcount() and framecount() methods to access the dimensions and the samples() method to gain access to the vector data for a specified channel.

It looks like the audio_bundle struct has both methods defined:

https://github.com/Cycling74/min-api/blob/043733c81e0ff0fde0e3fecb6c1730b83f0acf58/include/c74_min_operator_vector.h#L54

https://github.com/Cycling74/min-api/blob/043733c81e0ff0fde0e3fecb6c1730b83f0acf58/include/c74_min_operator_vector.h#L62

You'd have to call input_bundle.channelcount() on the input_bundle rather than channelcount() as a free function. Usually you see audio_bundles passed in as arguments to the perform method of an audio-rate object (e.g. operator()) https://github.com/Cycling74/min-devkit/blob/db42a82f2e203d30c5d1333cbfcc13024b7f9ff1/source/projects/min.stress_tilde/min.stress_tilde.cpp#L22

madronalabs commented 1 year ago

The issue is spelling: c74_min_operator_vector.h defines the methods channel_count() and frame_count(), not channelcount() and framecount().

isabelgk commented 1 year ago

Ah, thanks for clarifying! You're totally right, and we should fix this up.