You could keep track of the total duration by updating a History object in the if(is_complete) section. E.g., where it currently states
len = write_index + offset – prev_offset – 1;
You could replace it with (assuming History total_length is declared above):
prev_length = peek(length_data, write_segment, 0);
That updates the total length every time a new segment is recorded. Then you can simply output that from another outlet. (see below)
There’s no way to output a bang from gen~, but you can very simply test according to the value of the write segment (e.g. [==~ 63] -> [change]) to get a trigger signal.
– Pasted Max Patch, click to expand. –
Copy all of the following text.Then, in Max, select New From Clipboard.
Aug 18, 2013 at 5:32pm #259219