Your Universal Remote Control Center
RemoteCentral.com
Custom Installers' Lounge Forum - View Post
Previous section Next section Up level
Up level
The following page was printed from RemoteCentral.com:

Login:
Pass:
 
 

Topic:
Denon Volume Regex
This thread has 5 replies. Displaying all posts.
Post 1 made on Sunday April 29, 2018 at 09:08
mborner
Long Time Member
Joined:
Posts:
January 2006
122
Hello, I have a Denon X4200 and I'm trying to get 2-way feedback working for volume. I have it working but for the life of me I can't get it to display a decimal point in the volume number, ie, 55.5. I can get it to display whole numbers, like 55,42,10 etc. but the 1/2 db increments show up like 405 instead of 40.5. Why can't I get the regular expression to show (.)? My string looks like this
(/d{1,2}\.\d) This is as elementary as regular expressions get, what am I missing? My front end is Demopad.
Thanks.
Post 2 made on Monday April 30, 2018 at 13:37
TEJ
Long Time Member
Joined:
Posts:
October 2004
26
Not sure about demopad and it's handling of regex, but this works in perl:
 
$volume=405;
$volume =~ s/(\d{1,3})(\d)/\1\.\2/;
OP | Post 3 made on Tuesday May 1, 2018 at 11:34
mborner
Long Time Member
Joined:
Posts:
January 2006
122
On April 30, 2018 at 13:37, TEJ said...
Not sure about demopad and it's handling of regex, but this works in perl:
 
$volume=405;
$volume =~ s/(\d{1,3})(\d)/\1\.\2/;

Thanks, TEJ, but I'm now thinking this is something that cannot be done using regular expressions and or Demopad. Even the parsed data from the receiver has no decimal points or zeroes as the third digit. I'm at a loss as to how iRule did it.
Post 4 made on Wednesday May 2, 2018 at 09:35
thecynic315
Senior Member
Joined:
Posts:
August 2008
1,001
min vol = X
max vol = Y

if vol is Z

then vol = ### + . + #

ie you know(for example) the range is 0.0 to 100.0, so if you see 500 you know it should be 50.0 so you'll have to build the string yourself.
OP | Post 5 made on Wednesday May 2, 2018 at 16:24
mborner
Long Time Member
Joined:
Posts:
January 2006
122
On May 2, 2018 at 09:35, thecynic315 said...
min vol = X
max vol = Y

if vol is Z

then vol = ### + . + #

ie you know(for example) the range is 0.0 to 100.0, so if you see 500 you know it should be 50.0 so you'll have to build the string yourself.

Thanks. At the risk of sounding needy, I've been spending hours studying and learning regular expressions but I'm guessing regex can't to that, am I right?
The parsed data from the receiver looks like this: 98MV495MVMAX 98MV49MVMAX
Notice no decimal points or zeroes in the string.
Post 6 made on Wednesday May 2, 2018 at 17:07
thecynic315
Senior Member
Joined:
Posts:
August 2008
1,001
On May 2, 2018 at 16:24, mborner said...
Thanks. At the risk of sounding needy, I've been spending hours studying and learning regular expressions but I'm guessing regex can't to that, am I right?
The parsed data from the receiver looks like this: 98MV495MVMAX 98MV49MVMAX
Notice no decimal points or zeroes in the string.

so that says 49.5 and 49?

So do the regex to get the value. 495

Then you can check the last digit. 5

Is the number > 101? Yes so create a string with the first two digits add a . and the last digit or just a 0.

If the number is < 100 just check the 9 cases where it might not be a half step: 15,25,35,45...

I mean there are some other things you can do I guess for better checks but I am too tired to do math right now.


Jump to


Protected Feature Before you can reply to a message...
You must first register for a Remote Central user account - it's fast and free! Or, if you already have an account, please login now.

Please read the following: Unsolicited commercial advertisements are absolutely not permitted on this forum. Other private buy & sell messages should be posted to our Marketplace. For information on how to advertise your service or product click here. Remote Central reserves the right to remove or modify any post that is deemed inappropriate.

Hosting Services by ipHouse