Hey Uber Free working code here, take please!

Discussion in 'Support!' started by rajamonni, August 6, 2013.

  1. rajamonni

    rajamonni New Member

    Messages:
    18
    Likes Received:
    0
    function toLog(value)
    {
    // Made by rajamonni

    var max = 100; // max value for value
    var minDb = -40; // minimum Db, when value is 1

    if(value == 0)
    {
    // 0 means off, decibels don't have off.
    return 0;
    }

    var decibels = (max - value) / max * minDb;
    return Math.pow(10, (decibels / 20)) * 100;
    }
    var decibels = (max - position) / max* minDb;

    return Math.pow(10, (decibels / 20)) * 100;
    }

    And then add this to (and all others like it)

    $("#slider_master").slider({
    range: "max",
    min: 0,
    max: 100,
    value: model.master_volume(),
    slide: function (event, ui) {
    model.master_volume(toLog(ui.value));
    }
    });

    This makes your audio controls work much better.

    sneakyness pointed me to the right line of code so I was able to write the math.

    Please try this out, it's WAY better than the current implementation.

    Attached Files:

    Last edited: August 7, 2013
  2. VectorShift

    VectorShift New Member

    Messages:
    24
    Likes Received:
    4
    While this thread probably got Uber's attention if you didn't have it already, the title and last line of your post are probably not doing you any favors.

    I think the proper place to post your code is in the bug report you filed.

    Yeah, it would be nice if Uber fixed every bug immediately, especially the ones where they have already been given a fix, but we don't know what their development process, schedule, and priorities are. I definitely think there should be feedback into their priorities. They should try to address the bugs and lack of features that generate the most complaints, but only to an extent. They shouldn't rip up their schedule to address every complaint. To that end, I think it's a good idea to complain here when there is something you don't like, but I think you went beyond complaining and became demanding. I think it would be better for you to convince your peers that this is a problem worth complaining about in order to get them to complain too. By creating a thread requesting action, you are asking Uber to give your voice more weight. Granted you are providing a fix, and I think that should count for something.

    Let me know if I went overboard with my reply.
  3. oxide246

    oxide246 Active Member

    Messages:
    249
    Likes Received:
    30
    At least the sound slider is already working. I would much rather see new features implemented over this tweak. I see this as a polish thing which could wait till late beta.
  4. rajamonni

    rajamonni New Member

    Messages:
    18
    Likes Received:
    0
    Yeah, I can see why nobody thinks this is of any significant importance.

    Please try it out though and see which you like better.

    I'm sorry for my tone, but I'm a bit annoyed. The fix is so little trouble, why would you not use it?

    If someone likes it, I might improve it a bit more. But I don't want to use my time on something that isn't useful.
  5. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    It's an interesting issue I never realized existed. In fact it explain a weird behavior of a volume bar I long ago programmed myself. But since I myself only use the volume bar to set the music volume to 0 I never even have seen it in PA yet.
  6. irregularprogramming

    irregularprogramming Member

    Messages:
    99
    Likes Received:
    41
    I think the developers at user knows how to program a volume bar.
  7. rajamonni

    rajamonni New Member

    Messages:
    18
    Likes Received:
    0
    I hope so, many games do it wrong.

    The ones I can remember 100% sure are Kerbal Space Program and Demigod.

    And I can only remember one game that does it right, X3.

    But they did already something very right with it, they added the master volume.

    Edit:

    If you tried my settings.js, please give feedback. Which one you preferred?
    If you don't know how to do this, just download the file and overwrite the file:
    media/ui/alpha/settings/settings.js
    Under your planetary annihilation folder.

    If it doesn't work, just use the launcher to verify the files and my version will be removed.
  8. neutrino

    neutrino low mass particle Uber Employee

    Messages:
    3,123
    Likes Received:
    2,687
    We'll take a look at including this. I don't see why we wouldn't.
  9. neutrino

    neutrino low mass particle Uber Employee

    Messages:
    3,123
    Likes Received:
    2,687
    Apparently I was too slow and someone here already wrote the code to do this and it's in the current internal build.
  10. mushroomars

    mushroomars Well-Known Member

    Messages:
    1,655
    Likes Received:
    319
    DOUBLE POST MODS BAN BAN
  11. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    SPAM POSTS MODS BAN BAN ... oh wait

    so the serious part of my post:
    I just tried both versions and ... there was a difference, but I could not really tell what was better. Maybe my ears are just too bad or something.
  12. infuscoletum

    infuscoletum Active Member

    Messages:
    606
    Likes Received:
    37
    I read something on log based volume versus linear. I believe the reason log volume works "better", or at least seems more natural, is because of how speakers physically work in an enclosure.
  13. tugimus

    tugimus Member

    Messages:
    61
    Likes Received:
    0
    KSP is in Alpha.
  14. deso88

    deso88 Member

    Messages:
    197
    Likes Received:
    10
    And Demigod was bad overall. So nothing new.
  15. infuscoletum

    infuscoletum Active Member

    Messages:
    606
    Likes Received:
    37
  16. BulletMagnet

    BulletMagnet Post Master General

    Messages:
    3,263
    Likes Received:
    591
    Yeah, human sensory perception is usually logarithmic.

    It gives us a very large range that we can sense over. Downside is that you can clobber quieter sounds with louder noises easier than you would with a linear sense.
  17. irregularprogramming

    irregularprogramming Member

    Messages:
    99
    Likes Received:
    41

    Cool, thank you. :mrgreen:

Share This Page