I can't catch you James, i'm tired. Thanks.
Just one question:
What about "slave reference clock to audio"?
Before updating?
No, it's not gone.
It's a bit annoying that the volume control over KS takes a half-second to respond, making it tedious to finetune(in loud gunfights for instance)...but we got a buffer, for the best and the worst I guess.
3... 2...
All the parameters show us it's about to fire up mysterious Slysoft Player rocket????
I think ReClock is the fuel tank of this rocket.
James, am i right?
Or is it just a conspiracy theory?
Or not?
Little do I know.
That's my middle name.As you are the "official ReClock code reviewer(tm)"
The code looks good to me, and yes, the double to float conversion should be pretty straightforward...here is something for you to review.
m_currentKSVolume is a double with a value between 0.0 (0%) and 1.0 (100%). The cast double to float seems to round correctly (I checked with debugger).
I have one doubt about this code, but first one suggestion. I think it would be preferable to perform the subtractions between "long" before the conversion to double. It's slightly more precise in case there isn't a double that represents exactly the long. Like this:Here is how m_currentKSVolume is set.
// units of 6db
double l_att = ((double)(DSBVOLUME_MAX - m_currentVolume)) / (100.0 * 6.0);
double l_factor = 1.0 / pow(2.0, l_att);
m_currentKSVolume = l_factor * (((double)(m_currentVolume - DSBVOLUME_MIN)) / ((double)(DSBVOLUME_MAX - DSBVOLUME_MIN)));
double l_att = ((double)(DSBVOLUME_MAX - m_currentVolume)) / 100.0;
m_currentKSVolume = 1.0 / pow(10.0, l_att/20.0);
if (m_currentVolume == DSBVOLUME_MAX)
m_currentKSVolume = 1.0;
else
{
double l_att = ((double)(DSBVOLUME_MAX - m_currentVolume)) / 100.0;
m_currentKSVolume = 1.0 / pow(10.0, l_att/20.0);
}
Fine. Where do you think attenuation should be done? Before or after resampling? (I believe it is before at the moment)The code looks good to me, and yes, the double to float conversion should be pretty straightforward...
I believe I was seriously confused. It looks better to me your way.I have one doubt about this code, but first one suggestion. I think it would be preferable to perform the subtractions between "long" before the conversion to double. It's slightly more precise in case there isn't a double that represents exactly the long. Like this:
Now, my doubt: Why are you using 6dB steps and then a 2^x formula and all the other stuff instead of the 1dB steps with the 10^x formula?Code:// units of 6db double l_att = ((double)(DSBVOLUME_MAX - m_currentVolume)) / (100.0 * 6.0); double l_factor = 1.0 / pow(2.0, l_att); m_currentKSVolume = l_factor * (((double)(m_currentVolume - DSBVOLUME_MIN)) / ((double)(DSBVOLUME_MAX - DSBVOLUME_MIN)));
For example, why not doing it simply like this:
Code:double l_att = ((double)(DSBVOLUME_MAX - m_currentVolume)) / 100.0; m_currentKSVolume = 1.0 / pow(10.0, l_att/20.0);
Also, just to be sure that no issues with floating point math will affect the "no attenuation" mode I would do something like this:
Here the speed is unimportant, but we have to be sure that m_currentKSVolume is 1.0 and not 0.99999999999999. (yes, picky is my second middle name )Code:if (m_currentVolume == DSBVOLUME_MAX) m_currentKSVolume = 1.0; else { double l_att = ((double)(DSBVOLUME_MAX - m_currentVolume)) / 100.0; m_currentKSVolume = 1.0 / pow(10.0, l_att/20.0); }
Thank you for your feedback!
Where do you think attenuation should be done? Before or after resampling? (I believe it is before at the moment)
Before or after timeshifting? (I believe it is before at the moment)
Obviously after the compressor (I am not sure if it is correct at the moment, I'll have to look up the code)
I don't know what you are referring as the compressor. I am considering it to be the code for guarantying no clipping after resampling.Attenuation is done before the compressor, which is wrong. I don't know if I can (or want) to change it, as this would result in some work.
I don't know what you are referring as the compressor. I am considering it to be the code for guarantying no clipping after resampling.
Interesting point. I've put it before the resampler because I didn't want to increase CPU / FPU load (when increasing the sample rate).Furthermore, I think that the volume control would be preferable after resampling. Resampling adds noise, so, if we lower the volume before, it might happen that the S/N ratio would be a little lower (I don't know if the noise is proportional to the input signal), while changing the volume after decreases both signal and noise by the same amount.
Right, I forgot it. I've never used it, hence not remembering it... Also, I only checked in the config dialogs, I did not remember the properties dialog...No, ReClock does have a sound compressor. It's in the properties in the "sound adaptation" group.
Yes, both true, but I don't think the cpu load of a simple multiplication would be significative... As I've said, it's your call, I'm not really intending to use it when watching my movies in "quality mode", so it's not a problem to me. Though, for day to day usage, it's a very nice feature to have... no more need to change to directsound whenever I need volume control.Interesting point. I've put it before the resampler because I didn't want to increase CPU / FPU load (when increasing the sample rate).
EDIT: And I assumed that reducing volume to the resampler input will avoid clipping at the output anyway.
Yes, but as it is a "compressor" it makes sense that it receives full volume. Otherwise it tries to amplify the signal previously attenuated.Right, I forgot it. I've never used it, hence not remembering it... Also, I only checked in the config dialogs, I did not remember the properties dialog...
So, I think it would not be problematic to have volume control after it. Besides, the quality would be so compromised when using it that it would not matter where the volume control is.
Yes, both true, but I don't think the cpu load of a simple multiplication would be significative...
indeed, there's no point for clipping detection when the volume attenuation's enabled...eagerly awaiting b69 thenI assumed that reducing volume to the resampler input will avoid clipping at the output anyway.
Yes, they would fight against each other...Yes, but as it is a "compressor" it makes sense that it receives full volume. Otherwise it tries to amplify the signal previously attenuated.
Agreed.I changed the chain like this:
format conversion -> time stretch -> resampler -> compressor -> volume control -> mute -> mono expansion -> format conversion
(Not that it'll make much of a difference.... )
The chain is
format conversion -> time stretch -> volume control -> resampler -> compressor -> mute -> mono expansion -> format conversion
well, I use very high attenuation, so processing it after the resampler should make for a nice improvement hopefully? as long as it's also enabled when the resampler's not in use so I don't blast my ears off on mismatched refresh ratesI changed the chain like this:
format conversion -> time stretch -> resampler -> compressor -> volume control -> mute -> mono expansion -> format conversion