SpencerT Posted November 3, 2022 Share Posted November 3, 2022 I apologize for the silly question as I'm sure this is pretty easy. I'm trying to program a pico button to "cycle through" existing media sessions. The intention is each button press would move me to the next session but it stops after the first active session and subsequent presses don't do anything. Any suggestions on what I'm missing? Thanks, Spencer Quote Link to comment Share on other sites More sharing options...
South Africa C4 user Posted November 3, 2022 Share Posted November 3, 2022 Your code is doing what it is coded to do but not what you want it to do. In this case, I would probably create a variable called SessionIndex and simply have the button push increase this by 1. I would then do the majority of the coding on when SessionIndex changes. Here I would have: If SessionIndex >= 7 set SessionIndex = 0 If SesseionIndex = 0 turn Room Off If SessionIndex = 6 and GreatRoom is in a session join GreatRoom session else add 1 to Session Index If SessionIndex = 5 and FrontPatio is in a session join FrontPatio session else add 1 to SessionIndex Etc. The order (working backwards from 6 is deliberate to stop unintended consequences of adding 1 to SessionIndex before C4 goes through all if the relevant lines of code. Careful use of else’s could get the same result and remove the need to work backwards from 6 to 1. I haven’t tried this code so you would need to test the code. Personally, I would complicate this further (with a 2 second timer) to allow multiple button clicks in close succession without multiple session changes (but only 1 change). SpencerT 1 Quote Link to comment Share on other sites More sharing options...
SpencerT Posted November 3, 2022 Author Share Posted November 3, 2022 Great idea, thank you. Embarrassed to say that I did not even even realize I could create my own variables! I'll give this shot and post back. Thanks! Quote Link to comment Share on other sites More sharing options...
c4toys Posted November 3, 2022 Share Posted November 3, 2022 I do something similar and "Else" select room control preset cycler SpencerT 1 Quote Link to comment Share on other sites More sharing options...
DLite Posted November 3, 2022 Share Posted November 3, 2022 15 minutes ago, c4toys said: I do something similar and "Else" select room control preset cycler Is "in a session" one of the room variables? This is a cool idea, but I don't see where to program against to identify whether the room is in a session. Is this using a particular driver? Quote Link to comment Share on other sites More sharing options...
SpencerT Posted November 3, 2022 Author Share Posted November 3, 2022 3 hours ago, DLite said: Is "in a session" one of the room variables? This is a cool idea, but I don't see where to program against to identify whether the room is in a session. Is this using a particular driver? "In a session" is under "digital media" on the right side. DLite 1 Quote Link to comment Share on other sites More sharing options...
South Africa C4 user Posted November 4, 2022 Share Posted November 4, 2022 There is also a really neat driver (Keypad Audio Control) from Domosapiens (on DriverCentral) that sits on top of the Room Control driver and allows a lot of music control. It allows joining of sessions such as this and toggling through options. I can’t recall (off the top of my head) if it would allow this many sessions to be joined as options. @pbirwould know. SpencerT 1 Quote Link to comment Share on other sites More sharing options...
pbir Posted November 4, 2022 Share Posted November 4, 2022 The Keypad Audio Control driver allows you to 'capture' audio from another room. Up to three rooms may be designated for capture and the driver will capture the first room with its audio turned On. This is actually the opposite of adding sessions using a T3/T4 screen (pull vs. push). South Africa C4 user and SpencerT 2 Quote Link to comment Share on other sites More sharing options...
SpencerT Posted November 4, 2022 Author Share Posted November 4, 2022 @South Africa C4 user - Thank you so much. Was able to get this to work with variables. Cycles through each active session with each click. Exactly what I was looking for. Took me a while to get it to work. Thank you! South Africa C4 user 1 Quote Link to comment Share on other sites More sharing options...
SpencerT Posted November 4, 2022 Author Share Posted November 4, 2022 Well... Almost. So this seems to work well as long as I'm streaming music directly from the controller. Easily jumps between sessions with each button press. But.. If I have sessions playing with other music (for anything other than pandora we use a NAD CI-580 Bluesound player for 4 more streams). Everything is plumbed into my matrix, sessions in the app shows TV audio, streaming sources off of the bluesound, just the same as pandora or qobuz on the controller. Is it a correct assumption that the digital media / session variables only apply to devices in a session with audio streaming directly from the controller? Not ALL of the actual sessions running? Quote Link to comment Share on other sites More sharing options...
SpencerT Posted November 5, 2022 Author Share Posted November 5, 2022 3 hours ago, SpencerT said: Well... Almost. So this seems to work well as long as I'm streaming music directly from the controller. Easily jumps between sessions with each button press. But.. If I have sessions playing with other music (for anything other than pandora we use a NAD CI-580 Bluesound player for 4 more streams). Everything is plumbed into my matrix, sessions in the app shows TV audio, streaming sources off of the bluesound, just the same as pandora or qobuz on the controller. Is it a correct assumption that the digital media / session variables only apply to devices in a session with audio streaming directly from the controller? Not ALL of the actual sessions running? Hate to be the DB that quotes myself. Just trying to document this. What I found... Programming against the digital media / if in a session variables - only works for streams coming off the controller (at least in my environment). However, if I detect the session some other way (like room / power state).. I can use the digital media / add rooms to session action. I'm sure I didn't discover water on mars, just thought it was super weird behavior and wanted to document it in this post. Actually found a post from 2017 specifying that not all A/V devices are considered digital media. Based on my testing, I would surmise that not all sessions are considered 'digital media / sessions' from a conditionals standpoint. But - all digital media sessions can be joined with the command regardless of "how" they were started. ???????? Quote Link to comment Share on other sites More sharing options...
c4toys Posted November 5, 2022 Share Posted November 5, 2022 Dont join session. use room control driver to add rooms to the source room. SpencerT and South Africa C4 user 2 Quote Link to comment Share on other sites More sharing options...
SpencerT Posted November 5, 2022 Author Share Posted November 5, 2022 11 minutes ago, c4toys said: Dont join session. use room control driver to add rooms to the source room. I'm starting to play with that, dealer added it to a few rooms for me to play around with. Weird thing is digital media / join session works for everything. Detect session doesn't work through digital media (unless it's a c4 stream). Quote Link to comment Share on other sites More sharing options...
South Africa C4 user Posted November 5, 2022 Share Posted November 5, 2022 1 hour ago, c4toys said: Dont join session. use room control driver to add rooms to the source room. Sorry - I assumed you knew that Digital Media was limited to “Digital Media within the C4 environment”. The Room Control driver saves lots of extra code in this regard. And the Domosapiens driver on top of the Room Control Driver makes things even simpler. SpencerT 1 Quote Link to comment Share on other sites More sharing options...
South Africa C4 user Posted November 5, 2022 Share Posted November 5, 2022 1 hour ago, SpencerT said: I'm starting to play with that, dealer added it to a few rooms for me to play around with. Weird thing is digital media / join session works for everything. Detect session doesn't work through digital media (unless it's a c4 stream). This I did not know! Quote Link to comment Share on other sites More sharing options...
South Africa C4 user Posted November 5, 2022 Share Posted November 5, 2022 9 hours ago, SpencerT said: @South Africa C4 user - Thank you so much. Was able to get this to work with variables. Cycles through each active session with each click. Exactly what I was looking for. Took me a while to get it to work. Thank you! Please note that your “else’s” in the above code are doing absolutely nothing… for an “else” to work, you need to indent the code that applies to the “else”. This is done by dragging the relevant code onto the else… SpencerT and c4toys 2 Quote Link to comment Share on other sites More sharing options...
South Africa C4 user Posted November 5, 2022 Share Posted November 5, 2022 Just now, South Africa C4 user said: Please note that your “else’s” in the above code are doing absolutely nothing… for an “else” to work, you need to indent the code that applies to the “else”. This is done by dragging the relevant code onto the else… I suspect the reason you added all the additional “+1” to your code was because it was not doing what you expected which was a consequence of the “else” not being used… SpencerT 1 Quote Link to comment Share on other sites More sharing options...
SpencerT Posted November 5, 2022 Author Share Posted November 5, 2022 9 hours ago, South Africa C4 user said: I suspect the reason you added all the additional “+1” to your code was because it was not doing what you expected which was a consequence of the “else” not being used… Lol, It's because I did not fully understand and dumped all of this under the pico button. Fwiw, this worked great with 2 sessions playing. It was seemingly random with sessions playing across all of these rooms. I also see what you meant about starting the variables from highest to lowest. I got that fixed, but re-reading your first post I see that I should have the pico button send a +1 and put the programming under the variable which will make this much cleaner (and it will actually work like I want it to). I'll redo it and post it up. South Africa C4 user 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.