Observing selected scene
Trying to do something basic, but it confuses me. Observing the selected scene does give me a new id, but is not handled by the live.object when I ask for its name. This can be solved by including a deferlow, but that seems a little awkward. Moreover, many warnings occur: live.object: Live API is not initialized, use live.thisdevice to determine when initialization is complete. It appears something has changed, but I don’t really get what. Any advice?
----------begin_max5_patcher---------- 703.3oc2WtsiaBCDF9ZxSgEWmtByojTsZkZeM5tJhCSSbEXivNYy1U66dM1P NCABHZ2dCNL3f+mO9mA76SLLCY6.tI5qnefLLdehggJTQ.ixyMLSC1EkDvUS yLhklBTg4T80DvNgJtXMgihY.GQYBzlr3.Afd5op4kEHhVSnqVlCQB85YaM+ AqoHrqqZvyRMHigdo7OQ2jRnIfPsx3xfjX05wB+0Wvyqt8+jQEzfTPcoukSB RPemkDad3Fw1HptSVUZJG3xTIPPXzi0ksVINKJFrJOrWTEKEm7a0RgkWnH5G SlTbXZOY3iOhNfQMBafed18le98heC.IRANOXEbAIHwHGbC4tqu6Q4dYp6WW paekT28tR8JHpCIdKCz5wzbH8G0QkrbVFjKdCwgDIJf3k7Hf1jGwcgeAZlqc JkFlNwIu+g4DEdUpwKaEgBQI2FJZKji8CdcsrAeWLwtNlDFPWYNcbXSBKHVu d0iG281DYokWm6pLvNFkZGipqBohd1D48rYCzwww+3NOy5dEk0muJpDxV3AV HGx2B42txBisKFlY2r24Jvw1ZXKsZtrpLLOXqrUpb4k4wx.gHmDtQn+pHi8b xvbor2KmvE.MReGTwU.dnrfq.ARkzM3+lqLdZP641c62r++ZnWxDse6dZn67 Itgttzrv6daBg0eZq2hNWXhsGKayeshxl.rDoqQE+ZIWVhtk.ud6Wf5p+pTb 2eC58YGcZrIXasip4HSZ54aKTknEwOEgb1l7npUppEN5PtFCbAgp1i0QSp3y uQ38SZMINFnGu2hTRbFiPEkh.8xUefNrZx4jIcSM4Y4o5zn2mnq6hKOyW2QZ gS0I8LONSh0jGy5VdzWMMqMZxdb0jyI1qFzz34AOCA0nIqQUSsBS3w8QGtMX xab0jWKzzY8XFENgailFO6TavjSOnj7jOl7GWn+xzB -----------end_max5_patcher-----------
Actually it is handed to the Live object (sort of) but it can’t do anything with it. When you have your Max device loaded right click on the title bar and use "Open Max window". You won’t get the same window which you’d get when editing the device; this is the "runtime" window.
And its ideal for debugging your patches since many warning and/or error messages which won’t find their way into the main Max window will be shown here.
In your case: "live.object – Setting the id cannot be triggered by notifications".
So it is receiving the id message yet cannot use it. The solution, as you mentioned yourself, is using deferlow. Its really not that awkward; it will only make sure that any code you put behind it is executed last.
To put it simple; it will (to a certain extend) protect you from loops. You know; your observer checks a dial and when it detects a change you let it trigger code which sets the value to something else. Resulting in the observer spotting a change which triggers another change and so on…
That is (to an extend) avoided by deferlow. It will simply make sure that any code you put behind it will be executed when all other parts of your patch have finished.
Proof of concept (added deferlow to your patch):
----------begin_max5_patcher---------- 1579.3oc6ZszqahCEdcpT+OXw56DAl.IYTUkZ0rYj5pYa6nHB3j3oFaDXx8d mpY9sO9Aj.ALgPtgba6rARrM1e967vmyA91aeyDq0rmPYVfeE7YvjIeSzxDU axVlT1vDq3fmBIAYpAZQQOxV+WVOTzGG8DW0dDZCJkvd7POz7XLkf3pGyor0 j.d3NLc6pTTHWuxP2YSse.3uPd0CJu5H9M3OKelMLJmFDiTqyGRwADvGYjnp qDKm2XovQpGPf1ew4vX0Cj+bBRu3VV0WmL7eq5wwdpsp4+4suQdWb6gdyQD7 dzz04bNidXg2GjdXOzV+8mtr8UTjcIQcJcYfNRBREqOGktBQCVSPl3J+dwUY A6QQqB37TrXifN9qrBhojYj6bRNhsor8CcTERkKB7gV5DSwbgPuBtsaaXY6X o7t33ZiNlEIjYJR.NeZqSHgQ2dQyGlp.mgYCS+pb1xLtAjSAKx7FDS2vTXoU .jKXoLycyRiPoFmZk0qYlMAghH3XEa09tKiiRLuyPBcxBcH1lMVOHtQOpLUe nOkvnHJui0BS2iyvcoJn3B9yEJ4sNj.JkwC3XFc0AYb6B1R0j1AS7QodQuEd LN9ig3BIjEGKYgF9Y46vYfHF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ulkNvyHcVtnRfW5zI58oHcHVflN9n1yzn9HY3sToSuC+pINtoIdbNt FSuZptHRpaOU6LFTckJDHSs0TV1J1PN.CBgLQlygkHq.7fSXlHTFGSOT3jOe Pg5zAd7XsZ14w3nDFlxKv3kXoNH36zW367hB+xNj6jKrft8oDRc02YqfU6Ut x3v2RXqCHEk.r4G7S6EDyTQn0jbcszhBqdp3sr7pMDq90T1LHRmUePMEmFDk sVy2dCM4qt67XS90aTQear.m7M3zCvM+tvbmtrF.G79.N25BrN.2cPrB6EyY eW.2rdQbN2GopSuHNu6C375C3N0eyXxbN8BbiuJm228GOboXy0dg5M9CWpeC DEe4SU+mutj6ybkCT9mWF8fdscbuz8SALWn2.P0G7Qs+n+D3bDow5o+Sicir Aws+Cn65sqB -----------end_max5_patcher-----------
Oh, ps: although it looks cleaner you don’t really need the loadbang in there. The moment you use an argument with live.path it will send out the value as soon as the patch is loaded.
Its no big deal and using a loadbang has advantages (making your patch easier to read) but I figured I’d mention it nonetheless.
HI – can I follow up with a newbie question?
1) For getting the name why would you use ‘get’ and not ‘observe’? is it because ‘get’ is less cpu intensive (as it doesn’t need to ‘listen’ for updates from the application, and it receives a bang anyway everytime the ‘selected_scene’ changes?)
2) is there a reason why you would first set the path to live_set view, then observe selected_scene, and then with the ID go a ‘get name’? Why not cut out one step and use the path of "live_set view selected_track" and go straight to a ‘get name’ after that?
I can see in my test patch that both give the same result (though I might be overlooking specific conditions) – I’m interested in the cleanest, but also most efficient programming as I want to use this for realtime performance control.
Although this isn’t my patch I guess I can comment in general..
1) Hoover the mouse over the left inlet (top left) of the live.object object. Or check the reference page.
live.object doesn’t know about observe. But speaking in general; if you only want to get the name of a device once its better to use get with live.object because that gets the name without doing anything else.
As you mentioned yourself; observe would get the name but continue to observe the property for any changes, which isn’t always desirable.
2) The "selected_track" path won’t give you the name of the scene, which I think is what the OP was after.
Forums > Max For Live