Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.volume() is wrong after fade #1045

Merged
merged 1 commit into from May 17, 2020
Merged

Conversation

Megabyteceer
Copy link
Contributor

After short fades volume returns 0 or 1; After long fades volume() returns not exact real volume.

After fade complete volume() returns 0 or 1 on short fades. And not strict value at long fades.
@Megabyteceer
Copy link
Contributor Author

line 1245 - i think additional volume setting has no sense now because it will be already equal to 'to'.

@nolangormley
Copy link

Came here to post the same issue. I am working on a project that involves fading, and then fading to zero. I am having to store the value I fade to initially as the sound.volume() is not correct. Any insight on this issue?

@Megabyteceer
Copy link
Contributor Author

PR with fix is open, but no updates. I use external fix as you do.

@nolangormley
Copy link

Just figured this out actually. sound.volume() will return 1 while sound.volume(soundID) will return the correct sound volume after a fade. This is an example code snippet:

var sound = new Howl({
      src: ['1.mp3']
});
var id = sound.play()
sound.fade(1, .5, 100, id)
sound.volume() // Will return 1
sound.volume(id) // Will return .5

Not sure if this is documented anywhere, but it has worked for me.

@Megabyteceer
Copy link
Contributor Author

Fade makes wrong volume especially for short fade times. As example 5 ms.

@nolangormley
Copy link

Do you have a sample of that? I just tried this with 5ms and 1ms and it worked both times when using the ID.

screen shot 2019-02-19 at 2 27 00 pm

screen shot 2019-02-19 at 2 28 18 pm

@Megabyteceer
Copy link
Contributor Author

With id really works fine. But without id its goes further that target volume

let s = new Howl({src:["https://freesound.org/data/previews/122/122815_2233594-lq.mp3"]});
s.play();
s.fade(0.0, 0.75, 40);
setTimeout(() => {
console.log("volume: " + s.volume()); //volume: 0.77
}, 5000);

@goldfire goldfire merged commit f58dab1 into goldfire:master May 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants