SetVolume sets the Player's volume volume can only be set from 0 to 1
(volume float64)
| 287 | // SetVolume sets the Player's volume |
| 288 | // volume can only be set from 0 to 1 |
| 289 | func (p *Player) SetVolume(volume float64) { |
| 290 | // The condition must be true when volume is NaN. |
| 291 | if volume < 0 || volume > 1 { |
| 292 | log.Println("Volume can only be set between zero and one. Volume was not set.") |
| 293 | return |
| 294 | } |
| 295 | |
| 296 | p.sync(func() { |
| 297 | p.volume = volume * masterVolume |
| 298 | }) |
| 299 | } |
| 300 | |
| 301 | var masterVolume float64 |
| 302 |