EASy68K  
It is currently Sat Nov 18, 2017 3:38 pm

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Thu Oct 16, 2014 8:04 pm 
Offline

Joined: Wed Sep 24, 2014 10:37 pm
Posts: 3
Thank you Chuck for answering my last question. Progress on YMDj, the native Sega Genesis music tracker I'm working on is going really good! Check the project out if you have time. http://chipmusic.org/forums/topic/15355/ymdj-genesismd-tracker/

I ran into a bit of a mind bender though. Basically to control the volume of the YM2612 FM synthesizer, I have to send it data with a byte range of 0x00 to 0x7F to it's data port for Total Level. This is fine for the Synth Editor screen, but in the Note Entry screen where musicians will want to control the volume of their instruments as they're composing this is a problem, because this byte value actually controls attenuation of the instrument. In other words, the higher the byte, the quieter the sound. This is very non-intuitive for most people I think, who would expect that higher values would mean louder sound. So to avoid the problem I decided I want to invert this byte value. To convert 0x00, 0x01, 0x02... etc to 0x7F, 0x7E, 0x7D... etc. I want to know if there is an algorithm I can use that will do this, or if I'm going to have to resort to using a look up table.

Thanks again.


Top
 Profile  
 
PostPosted: Thu Oct 16, 2014 8:49 pm 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1049
Just do

0x7F - n, where n is the user entered value 0,1,2, etc.

_________________
Prof. Kelly


Top
 Profile  
 
PostPosted: Fri Oct 17, 2014 1:11 am 
Offline

Joined: Wed Sep 24, 2014 10:37 pm
Posts: 3
profkelly wrote:
Just do

0x7F - n, where n is the user entered value 0,1,2, etc.


I really think that I overthink on certain things. Sometimes the answer just stares us right in the face and we miss it. I'm really glad I asked though, because the solution I came up with was a bit more involved than that. n - 0x7F = R, then 0 - R = 0x7D or negating R. Valid, but not efficient. Thanks again for your help. I'll be sure your name goes into the "Special Thanks" section when this is all said and done. Do you prefer Chuck Kelly, or Professor Kelly?


Top
 Profile  
 
PostPosted: Sat Oct 18, 2014 12:57 pm 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1049
CountSymphoniC wrote:
I'll be sure your name goes into the "Special Thanks" section when this is all said and done. Do you prefer Chuck Kelly, or Professor Kelly?
Either is fine.

_________________
Prof. Kelly


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group