Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • B bjgf
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Issues 127
    • Issues 127
    • List
    • Boards
    • Service Desk
    • Milestones
  • Jira
    • Jira
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar
  • BlueJ
  • bjgf
  • Issues
  • #1748
Closed
Open
Issue created Feb 14, 2014 by Neil Brown@nccbMaintainer

[GREENFOOT-404] Volume-methods for SoundStreams is dysfunctional

the setVolume- and getVolume-methods in class SoundStream does not match their expected behaviours.

I: (Package sound, class SoundStream)

setVolume delegates a change of the volume to a logarithmic transformed value to the audio line. getVolume however directly returns the volume of the audioline.

Thus, for a given GreenfootSound-reference "gsound" resulting from an mp3-file the following odd behaviour occurs: {noformat} gsound.setVolume(5); System.out.println(gsound.getVolume()); // result: 34 {noformat}

Basically, if you give a specific value to the setVolume-methode, the getVolume-method should return exactly that value after that.

II: (Package sound, class SoundUtils)

Also, for performing the logarithmic transformation the method logToLin in class SoundUtils is used. This method claims to convert a value between 0-100 to a value in the same range. Actually, if 0 is the given parameter, this is incorrect. Instead, Math.log(0) is conducted and thus, the resulting value is something resulting from an operation on "negative infinity" (e.g. -2147483648); see javadoc of Math.log. {noformat} gsound.setVolume(0); System.out.println(gsound.getVolume()); // result: -2147483648 {noformat}


Issue metadata

  • Issue type: Bug
  • Priority: Medium
Assignee
Assign to
Time tracking