1. /**
    2. @author CuiZhouwei
    3. @date 2022/7/29
    4. **/
    5. package play
    6. import (
    7. "fmt"
    8. "time"
    9. )
    10. type WAVPlayer struct {
    11. stat int
    12. progress int
    13. }
    14. func (p *WAVPlayer) Play(source, name string) {
    15. fmt.Printf("\nPlaying music %s WAV type now ,from %s\n", name, source)
    16. p.progress = 0
    17. for p.progress < 100 {
    18. time.Sleep(100 * time.Millisecond) //假装正在播放
    19. fmt.Printf("the music %s playing\n", name)
    20. p.progress += 10
    21. }
    22. fmt.Printf("\nFinish %s music from %s \n", name, source)
    23. }