Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /storage/content/49/145849/famitracker.com/public_html/forum/classes/dbHandler.php on line 29 FamiTracker
Login:
Menu:
Post: Author:
FamiTracker > General > Bug Reports & Feature Requests > Request: Hex to Decimal Envelope Input Conversion Owner: B00daW New post
Page 1 of 1 Sort:  
Request: Hex to Decimal Envelope Input Conversion Posted: 2014-09-28 14:24  (Last Edited: 2014-09-28 14:27) Reply | Quote
B00daW

Avatar

Member for: 4986 days
Status: Offline

#62285
It's nice that we can manually input our envelopes and press enter instead of drawing them. It would be even nicer if we could input spaced byte values in hex and FamiTracker converts them to decimal. And if the value is greater than bitwise operations permit, it maxes out.

Currently non-"numeric"/decimal values are treated as "0" when input.

Reason?

Copy/paste of code-based envelopes from other engines and platforms or to accommodate coder minds.

Posted: 2014-09-28 14:32  (Last Edited: 2014-09-28 23:20) Reply | Quote
B00daW

Avatar

Member for: 4986 days
Status: Offline

#62286
Woops! How the bloody heck did this thread not get posted in "Bugs/Requests"? Might be user error... Apologies.

(Fixed. Thank you.)

Posted: 2014-09-28 20:18  (Last Edited: 2014-09-28 20:18) Reply | Quote
Im_a_Track_Man

Avatar

Member for: 4138 days
Location: Plantation, Florida
Status: Offline

#62303
Having hex input would be amazing, especially for N163 waves.

Posted: 2014-09-28 20:22 Reply | Quote
jsr
Administrator

Avatar

Member for: 5925 days
Location: Sweden
Status: Offline

#62304
No worries I'll move the thread.

Reading hex values would be no problem to add. What kind of notation would you like to see, would 6502 style ($) be sufficient?

Is there a way in MML to express this already?

_______________________
Programmer and developer
Posted: 2014-09-28 22:40  (Last Edited: 2014-09-28 22:41) Reply | Quote
jrlepage
Moderator

Avatar

Member for: 4983 days
Location: Canada
Status: Offline

#62316
$0F, $0f, $F and $f all represent 15 in MML (so do x0F, x0f, xF and xf).

_______________________
Follow me on [url=https://twitter.com/jrlepage2a03]Twitter.
I record (some) NSFs on hardware. Feel free to [url=http://www.famitracker.com/forum/posts.php?id=3633]request a hardware render.
Posted: 2014-09-28 23:05  (Last Edited: 2014-09-28 23:07) Reply | Quote
B00daW

Avatar

Member for: 4986 days
Status: Offline

#62318
"$" should process but spaced values with "0" in front would be nice as well. (If jrlepage says "x" is used, then that probably should parse/process as well.) What I'd really like to see is a string of bytes copy/pasted from a hex editor or a look-up table with assembler notation process from code. As long as the set doesn't have any carriage breaks I guess even "%" binary string lookups should be able to process into decimal as well. I believe this would add even more flexibility of use and smiles to your constituency.

Thank you for moving the thread. I didn't mean to make you spend the extra effort.

Posted: 2014-09-28 23:31 Reply | Quote
jrlepage
Moderator

Avatar

Member for: 4983 days
Location: Canada
Status: Offline

#62320
I don't think converting spaced values with 0 in front would be a good idea. I've used decimal values with a leading 0 in many of my MMLs (purely for the sake of avoiding misaligned volume envelopes in the MMLs), and I know of a couple graph-to-envelope conversion programs which add leading 0s to single-digit decimal values, too. At least with a prefix like '$' or 'x', you can be certain that the number that follows will be a hexadecimal value, something a leading 0 cannot guarantee.

_______________________
Follow me on [url=https://twitter.com/jrlepage2a03]Twitter.
I record (some) NSFs on hardware. Feel free to [url=http://www.famitracker.com/forum/posts.php?id=3633]request a hardware render.
Posted: 2014-09-29 00:51 Reply | Quote
Stratelier



Member for: 2954 days
Status: Offline

#62325
Spaced values with x or 0x in front of them could certainly work, as 0x(...) is a common way of representing hexadecimal anyway.

_______________________
Where to find me:
YouTube: [url=http://youtube.com/user/stratelier]http://youtube.com/user/stratelier
DeviantArt: [url=http://stratadrake.deviantart.com/]http://stratadrake.deviantart.com/
Posted: 2014-09-29 02:58 Reply | Quote
jrlepage
Moderator

Avatar

Member for: 4983 days
Location: Canada
Status: Offline

#62329
0x<number> would work, yes. A leading 0 alone would introduce more problems than it would solve, though.

_______________________
Follow me on [url=https://twitter.com/jrlepage2a03]Twitter.
I record (some) NSFs on hardware. Feel free to [url=http://www.famitracker.com/forum/posts.php?id=3633]request a hardware render.
Posted: 2014-09-29 04:32 Reply | Quote
B00daW

Avatar

Member for: 4986 days
Status: Offline

#62331
I guess what to keep in mind is how to keep copy/pasting simple without any or much editing or scripted conversion necessary. Most code already has the proper notation but as long as it's all parsed properly I don't see how all suggested forms of notation wouldn't be possible.

For instance, even if the values were hex alone and not even spaced -- directly copy/pasted from a binary -- as long as the array is an even number of nybbles, it could parse the whole array byte by byte without signs.

Posted: 2014-09-29 05:09 Reply | Quote
Stratelier



Member for: 2954 days
Status: Offline

#62332
[quote=jrlepage]0x<number> would work, yes. A leading 0 alone would introduce more problems than it would solve, though.[/quote]
IIRC that's how VB.net treated Octal numbers, and yes it was confusing.

_______________________
Where to find me:
YouTube: [url=http://youtube.com/user/stratelier]http://youtube.com/user/stratelier
DeviantArt: [url=http://stratadrake.deviantart.com/]http://stratadrake.deviantart.com/
Posted: 2014-09-29 19:23 Reply | Quote
jsr
Administrator

Avatar

Member for: 5925 days
Location: Sweden
Status: Offline

#62347
I've added '$' and 'x' for hex numbers. There are several other ways, 0x00 used by C/C++ or 00h for example, but I think MML compatibility would be sufficient here.

_______________________
Programmer and developer
Posted: 2014-09-30 03:05  (Last Edited: 2014-09-30 03:15) Reply | Quote
B00daW

Avatar

Member for: 4986 days
Status: Offline

#62371
Nice. It would also be easy to do non-spaced hex values with just a single leading $ or x. That way even if the hex values do not contain numbers A-F Famitracker will still know to parse the array as hexadecimal. Also this leads to practically universal copy/paste of code and binary data.

Example arrays:

Decimal: 0 1 2 3 4 5 6 7

(Inconsistent) Hexadecimal: x1 $02 x03 $4 x05 $6 x7

(Data copy/paste) Hexadecimal: $0001020304050607

Or if you don't want to do a lot of extra compatibility coding, why not use "h" for that instance.

Ex: h0001020304050607


Posted: 2014-10-01 05:58 Reply | Quote
jrlepage
Moderator

Avatar

Member for: 4983 days
Location: Canada
Status: Offline

#62410
Also, changing 0x00-formatted hex values to Famitracker-compatible hex values merely becomes a matter of running the envelope through search-and-replace in your text editor of choice at that point.

_______________________
Follow me on [url=https://twitter.com/jrlepage2a03]Twitter.
I record (some) NSFs on hardware. Feel free to [url=http://www.famitracker.com/forum/posts.php?id=3633]request a hardware render.
Page 1 of 1 Sort: