mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +01:00
audio: SetVolume now rejects NaN
This commit is contained in:
parent
54f0e30fe6
commit
e631714a43
@ -262,12 +262,9 @@ func (p *Player) Volume() float64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *Player) SetVolume(volume float64) {
|
func (p *Player) SetVolume(volume float64) {
|
||||||
// TODO: What if volume is NaN?
|
// The condition must be true when volume is NaN.
|
||||||
if 1 < volume {
|
if !(0 <= volume && volume <= 1) {
|
||||||
panic("audio: volume must <= 1")
|
panic("audio: volume must be in between 0 and 1")
|
||||||
}
|
|
||||||
if volume < 0 {
|
|
||||||
panic("audio: volume must >= 0")
|
|
||||||
}
|
}
|
||||||
p.volume = volume
|
p.volume = volume
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user