plugdata-team / plugdata

Pure Data as a plugin, with a new GUI
https://plugdata.org
GNU General Public License v3.0
1.54k stars 66 forks source link

Strange calculations with playhead and file path misread #150

Closed Omar-Misa closed 2 years ago

Omar-Misa commented 2 years ago

Pictured here is a strange result in a calculation. The same happens when using [expr] and other mathematical operators. When i hit the bang, however, the result is accurate: calculations

Another issue is with symbol returned from [openpanel]. i believe it's a Windows thing. The returned symbol demarcate the file path hierarchy with a backslash. i believe backslash is interpreted as spaces. Using forward-slashes works as expected.

PlugData v0.5.3 VST3, Win10

timothyschoen commented 2 years ago

Thanks for reporting, I'll see what's causing this!

I didn't consider the backslashes, I'll look into that as well.

Omar-Misa commented 2 years ago

Thank you, and i should have mentioned that it only happens when tapping into DAW song information through 'playhead'. Otherwise, calculations are true.

timothyschoen commented 2 years ago

Good to know, that narrows it down quite a lot.

timothyschoen commented 2 years ago

This is because the output of playhead position is actually a list with 3 items! I copied this from Camomile so I didn't notice it myself yet. The solution is to put an [unpack f f f] underneath it, and you can now also get time in samples if you want! And calculation behave normally again!

I've also fixed openpanel on Windows!

Omar-Misa commented 2 years ago

Thank you! Glad that playhead-position use is so simply solved. Thanks too, more broadly, for making and sharing PlugData!

Incidentally, i found that there are more than three variables demarcated by position selector. In order of list index, they are:

  1. Position in quads.
  2. Position in samples.
  3. Loop end in quads.
  4. (???)
  5. Position in seconds.