Cycling74 / min-devkit

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

Outlet thread check causes Vector Operator to drop audio #155

Open mourendxu opened 4 years ago

mourendxu commented 4 years ago

Hi guys, not sure if this is fixed in 0.5. But I found that if I define one of my outlet as outlet<thread_check::scheduler, thread_action::fifo>

in my vector operator ~ object. I drop quite a bit of audio data. Once I take it out, everything went back to normal.

Is this a bug, or is this a feature I can't/shouldn't use with vector operators? Though, I can't quite see why.

Thank you.

mourendxu commented 4 years ago

I just checked against 0.5. The problem has gotten better, however, I am still seeing drops here and there.

Thank you.

tap commented 4 years ago

Calling outlets in the audio thread is generally highly discouraged.

Because you know that you are in the audio thread it would be best to push your data onto a fifo<> and then dequeue that data in a timer<>.

Hopes this helps!

mourendxu commented 4 years ago

Hi, thank you for your reply.

I fully understand that. But according the documentation on Threading, under "High-Level Outlet Threading Specification," by defining the thread behavior of my outlet will "enforce delivery on a specific thread." So, why if I did define my outlet using thread_check and thread_action would cause a drop in audio? I was seeing a drop of almost every 2 blocks without me outputting anything out of my outlet.

In 0.49, it was extremely severe.

In 0.5, the drop outs are much more intermittent. But they are still there.

I do have a question though: my object does not output any message unless an input message has been received. According to the Threading document, am I correct to assume whichever thread I receive the message on will cause my object to output on that thread?

So, why is it if I simply output normally out of my outlet, without any thread_check and thread_action defined on my outlet, I see no drop in my audio?

Thank you!

tap commented 4 years ago

Thanks for your persistence. I may have misunderstood what you are doing. Is it possible to share your code with me so that I can see exactly what is happening myself?

I'm also curious what your settings are in the Audio Status window.

If you aren't comfortable sharing it publically on the Github tracker then you can also email me directly at tim@cycling74.com

Thanks! Tim

mourendxu commented 4 years ago

Thank you, Tim!

I will send you the code later today. The code itself is pretty straightforward. I will explain in more details in my email.

I ran it under two conditions, Overdrive on and Overdrive with Interrupt on. The latter is the standard setting inside of Ableton Live.

Will drop a note here when I have sent the email.

Thank you again.

mourendxu commented 4 years ago

Email sent.

Thank you!

omarcostahamido commented 3 years ago

Hey there. I am also having threading issues (i've started a new one here). Have you been able to solve this, and can you help me?