From 83a3c07431bac03232500f2ee243198ed2f2c17f Mon Sep 17 00:00:00 2001 From: sunqirui Date: Thu, 6 Jan 2022 11:27:51 +0800 Subject: [PATCH 01/17] =?UTF-8?q?add=20PauseSound,ResumeSound,StopSound=20?= =?UTF-8?q?API=E3=80=82=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- audio.go | 97 ++++++++++++++++++++++++--- game.go | 19 ++++-- test/Quote/Monkey.spx | 17 +++++ test/Quote/index.gmx | 1 + test/Quote/res/sounds/clap/index.json | 5 ++ 5 files changed, 122 insertions(+), 17 deletions(-) create mode 100644 test/Quote/res/sounds/clap/index.json diff --git a/audio.go b/audio.go index d91c07f5..78120285 100644 --- a/audio.go +++ b/audio.go @@ -21,7 +21,7 @@ type readSeekCloser struct { } type readCloser struct { - io.Reader + io.ReadSeeker io.Closer } @@ -38,9 +38,23 @@ func newReadSeeker(source io.ReadCloser) io.ReadSeeker { // ------------------------------------------------------------------------------------- +type playerState int + +const ( + playerPaused playerState = iota + playerPlay + playerClosed +) + +type soundPlayer struct { + *audio.Player + media Sound + state playerState +} type soundMgr struct { + g *Game audioContext *audio.Context - players map[*audio.Player]chan bool + players map[*soundPlayer]chan bool playersM sync.Mutex } @@ -49,26 +63,27 @@ const ( defaultRatio = 100.0 ) -func (p *soundMgr) addPlayer(sp *audio.Player, done chan bool) { +func (p *soundMgr) addPlayer(sp *soundPlayer, done chan bool) { p.playersM.Lock() defer p.playersM.Unlock() p.players[sp] = done } -func (p *soundMgr) init() { +func (p *soundMgr) init(g *Game) { audioContext := audio.NewContext(defaultSampleRate) p.audioContext = audioContext - p.players = make(map[*audio.Player]chan bool) + p.players = make(map[*soundPlayer]chan bool) + p.g = g } func (p *soundMgr) update() { p.playersM.Lock() defer p.playersM.Unlock() - var closed []*audio.Player + var closed []*soundPlayer for sp, done := range p.players { - if !sp.IsPlaying() { + if !sp.IsPlaying() && sp.state != playerPaused { sp.Close() if done != nil { done <- true @@ -85,12 +100,13 @@ func (p *soundMgr) stopAll() { p.playersM.Lock() defer p.playersM.Unlock() - closed := make([]*audio.Player, 0, len(p.players)) + closed := make([]*soundPlayer, 0, len(p.players)) for sp, done := range p.players { sp.Close() if done != nil { done <- true } + sp.state = playerClosed closed = append(closed, sp) } for _, sp := range closed { @@ -98,7 +114,13 @@ func (p *soundMgr) stopAll() { } } -func (p *soundMgr) play(source io.ReadCloser, wait ...bool) (err error) { +func (p *soundMgr) play(media Sound, wait ...bool) (err error) { + + source, err := p.g.fs.Open(media.Path) + if err != nil { + panic(err) + } + audioContext := p.audioContext d, _, err := qaudio.Decode(newReadSeeker(source)) if err != nil { @@ -108,7 +130,10 @@ func (p *soundMgr) play(source io.ReadCloser, wait ...bool) (err error) { d = convert.ToStereo16(d) d = convert.Resample(d, audioContext.SampleRate()) - sp, err := audioContext.NewPlayer(&readCloser{d, source}) + + sp := &soundPlayer{} + sp.media = media + sp.Player, err = audioContext.NewPlayer(&readCloser{d, source}) if err != nil { source.Close() return @@ -121,12 +146,64 @@ func (p *soundMgr) play(source io.ReadCloser, wait ...bool) (err error) { } p.addPlayer(sp, done) sp.Play() + sp.state = playerPlay if waitDone { waitForChan(done) } return } +func (p *soundMgr) stop(media Sound) { + p.playersM.Lock() + defer p.playersM.Unlock() + + closed := make([]*soundPlayer, 0, len(p.players)) + for sp, done := range p.players { + if sp.media.Path == media.Path { + sp.Close() + if done != nil { + done <- true + } + sp.state = playerClosed + closed = append(closed, sp) + } + } + for _, sp := range closed { + delete(p.players, sp) + } +} + +func (p *soundMgr) pause(media Sound) { + p.playersM.Lock() + defer p.playersM.Unlock() + + for sp, done := range p.players { + if sp.media.Path == media.Path { + sp.Pause() + sp.state = playerPaused + if done != nil { + done <- true + } + } + + } +} + +func (p *soundMgr) resume(media Sound) { + p.playersM.Lock() + defer p.playersM.Unlock() + for sp, done := range p.players { + if sp.media.Path == media.Path { + sp.Play() + sp.state = playerPlay + if done != nil { + done <- true + } + } + + } +} + func (p *soundMgr) volume() float64 { for sp := range p.players { return sp.Volume() * defaultRatio diff --git a/game.go b/game.go index d1f04c72..15adf947 100644 --- a/game.go +++ b/game.go @@ -414,7 +414,7 @@ func (p *Game) startLoad(resource interface{}, cfg *Config) (err error) { } p.initGame() p.input.init(p, keyDuration) - p.sounds.init() + p.sounds.init(p) p.shapes = make(map[string]Spriter) p.events = make(chan event, 16) p.fs = fs @@ -1348,16 +1348,21 @@ func (p *Game) Play__0(media Sound, wait ...bool) { if debugInstr { log.Println("Play", media.Path, wait) } - f, err := p.fs.Open(media.Path) - if err != nil { - panic(err) - } - err = p.sounds.play(f, wait...) + + err := p.sounds.play(media, wait...) if err != nil { panic(err) } } - +func (p *Game) PauseSound(media Sound) { + p.sounds.pause(media) +} +func (p *Game) ResumeSound(media Sound) { + p.sounds.resume(media) +} +func (p *Game) StopSound(media Sound) { + p.sounds.stop(media) +} func (p *Game) StopAllSounds() { p.sounds.stopAll() } diff --git a/test/Quote/Monkey.spx b/test/Quote/Monkey.spx index 8faf2111..f894b6ae 100644 --- a/test/Quote/Monkey.spx +++ b/test/Quote/Monkey.spx @@ -1,3 +1,9 @@ +onStart => { + for { + //play chomp,true + } +} + onClick => { quote "m" step 100 @@ -10,3 +16,14 @@ onClick => { onKey KeyQ, => { quote "m", "monkey", 1 } +onKey KeyW, =>{ + play clap +} + +onKey KeyA, =>{ + pauseSound clap +} + +onKey KeyB, =>{ + resumeSound clap +} \ No newline at end of file diff --git a/test/Quote/index.gmx b/test/Quote/index.gmx index ffd1e5a2..f810ec00 100644 --- a/test/Quote/index.gmx +++ b/test/Quote/index.gmx @@ -2,5 +2,6 @@ var ( Monkey Monkey Crocodile Crocodile chomp Sound + clap Sound ) run "res", {Title: "Quote (by Go+)"} diff --git a/test/Quote/res/sounds/clap/index.json b/test/Quote/res/sounds/clap/index.json new file mode 100644 index 00000000..b79c3fa8 --- /dev/null +++ b/test/Quote/res/sounds/clap/index.json @@ -0,0 +1,5 @@ +{ + "path": "../../../../res/monkey_clap.mp3", + "rate": 11025, + "sampleCount": 2912 + } \ No newline at end of file From 2df52d4ddb1a6ddfe4891f68c97904513b954fa7 Mon Sep 17 00:00:00 2001 From: sunqirui Date: Thu, 6 Jan 2022 11:38:59 +0800 Subject: [PATCH 02/17] loop play --- test/Quote/Monkey.spx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Quote/Monkey.spx b/test/Quote/Monkey.spx index f894b6ae..e8fd41db 100644 --- a/test/Quote/Monkey.spx +++ b/test/Quote/Monkey.spx @@ -1,6 +1,6 @@ onStart => { for { - //play chomp,true + play chomp,true } } From 19d20ceff897248604678e40bc1f82d2aea921cc Mon Sep 17 00:00:00 2001 From: sunqirui Date: Thu, 6 Jan 2022 11:44:52 +0800 Subject: [PATCH 03/17] gopfmt -w . --- test/Quote/Monkey.spx | 10 +++++----- test/Quote/index.gmx | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/test/Quote/Monkey.spx b/test/Quote/Monkey.spx index e8fd41db..91702b5c 100644 --- a/test/Quote/Monkey.spx +++ b/test/Quote/Monkey.spx @@ -1,6 +1,6 @@ onStart => { for { - play chomp,true + play chomp, true } } @@ -16,14 +16,14 @@ onClick => { onKey KeyQ, => { quote "m", "monkey", 1 } -onKey KeyW, =>{ +onKey KeyW, => { play clap } -onKey KeyA, =>{ +onKey KeyA, => { pauseSound clap } -onKey KeyB, =>{ +onKey KeyB, => { resumeSound clap -} \ No newline at end of file +} diff --git a/test/Quote/index.gmx b/test/Quote/index.gmx index f810ec00..f0422260 100644 --- a/test/Quote/index.gmx +++ b/test/Quote/index.gmx @@ -4,4 +4,5 @@ var ( chomp Sound clap Sound ) + run "res", {Title: "Quote (by Go+)"} From 1ac0e3854946c846b47ce303f270356cdb38dc79 Mon Sep 17 00:00:00 2001 From: sunqirui Date: Fri, 21 Jan 2022 15:40:55 +0800 Subject: [PATCH 04/17] update audio API .add action play --- audio.go | 69 +++++++++++++++++++++++++++++++++++++++---- game.go | 25 +++++++++------- test/Quote/Monkey.spx | 6 ++-- 3 files changed, 81 insertions(+), 19 deletions(-) diff --git a/audio.go b/audio.go index 78120285..de1f8004 100644 --- a/audio.go +++ b/audio.go @@ -43,9 +43,21 @@ type playerState int const ( playerPaused playerState = iota playerPlay + playerLoopPlay playerClosed ) +type ActionState int + +const ( + ActionPlay ActionState = iota + ActionLoopPlay + ActionLoopContinuePlay + ActionPause + ActionResume + ActionStop +) + type soundPlayer struct { *audio.Player media Sound @@ -84,6 +96,11 @@ func (p *soundMgr) update() { var closed []*soundPlayer for sp, done := range p.players { if !sp.IsPlaying() && sp.state != playerPaused { + if sp.state == playerLoopPlay { + sp.Rewind() + sp.Play() + continue + } sp.Close() if done != nil { done <- true @@ -114,7 +131,44 @@ func (p *soundMgr) stopAll() { } } -func (p *soundMgr) play(media Sound, wait ...bool) (err error) { +func (p *soundMgr) playAction(media Sound, wait bool, action ActionState) (err error) { + + switch action { + case ActionPlay: + err = p.play(media, wait, ActionPlay) + case ActionLoopPlay: + err = p.play(media, wait, ActionLoopPlay) + case ActionLoopContinuePlay: + err = p.playContinue(media, wait) + case ActionStop: + p.stop(media) + case ActionResume: + p.resume(media) + case ActionPause: + p.pause(media) + } + return +} +func (p *soundMgr) playContinue(media Sound, wait bool) (err error) { + p.playersM.Lock() + isFound := false + for sp, done := range p.players { + if sp.media.Path == media.Path { + sp.state = playerLoopPlay + isFound = true + if done != nil { + done <- true + } + } + } + p.playersM.Unlock() + + if isFound == false { + err = p.play(media, wait, ActionLoopPlay) + } + return +} +func (p *soundMgr) play(media Sound, wait bool, action ActionState) (err error) { source, err := p.g.fs.Open(media.Path) if err != nil { @@ -139,15 +193,20 @@ func (p *soundMgr) play(media Sound, wait ...bool) (err error) { return } - var waitDone = (wait != nil) var done chan bool - if waitDone { + if wait { done = make(chan bool, 1) } p.addPlayer(sp, done) sp.Play() - sp.state = playerPlay - if waitDone { + switch action { + case ActionPlay: + sp.state = playerPlay + case ActionLoopPlay: + sp.state = playerLoopPlay + } + + if wait { waitForChan(done) } return diff --git a/game.go b/game.go index 15adf947..4008f28b 100644 --- a/game.go +++ b/game.go @@ -1341,28 +1341,31 @@ func (p *Game) loadSound(name string) (media Sound, err error) { return } +func (p *Game) Play__0(media Sound) { + p.Play__1(media, false) +} +func (p *Game) Play__1(media Sound, wait bool) { + p.Play__3(media, wait, ActionPlay) +} +func (p *Game) Play__2(media Sound, action ActionState) { + p.Play__3(media, false, action) +} + // Play func: // Play(sound) // Play(video) -- maybe -func (p *Game) Play__0(media Sound, wait ...bool) { +// Play(sound, wait) -- sync +// Play(sound) +func (p *Game) Play__3(media Sound, wait bool, action ActionState) { if debugInstr { log.Println("Play", media.Path, wait) } - err := p.sounds.play(media, wait...) + err := p.sounds.playAction(media, wait, action) if err != nil { panic(err) } } -func (p *Game) PauseSound(media Sound) { - p.sounds.pause(media) -} -func (p *Game) ResumeSound(media Sound) { - p.sounds.resume(media) -} -func (p *Game) StopSound(media Sound) { - p.sounds.stop(media) -} func (p *Game) StopAllSounds() { p.sounds.stopAll() } diff --git a/test/Quote/Monkey.spx b/test/Quote/Monkey.spx index 91702b5c..f5b2275e 100644 --- a/test/Quote/Monkey.spx +++ b/test/Quote/Monkey.spx @@ -1,6 +1,6 @@ onStart => { for { - play chomp, true + play chomp, false, ActionLoopContinuePlay } } @@ -21,9 +21,9 @@ onKey KeyW, => { } onKey KeyA, => { - pauseSound clap + play clap, ActionStop } onKey KeyB, => { - resumeSound clap + play clap, ActionResume } From bd4adf5bee6277388dc1d6500b2b7d254e5e7540 Mon Sep 17 00:00:00 2001 From: sunqirui Date: Fri, 21 Jan 2022 16:33:32 +0800 Subject: [PATCH 05/17] update play api --- audio.go | 15 ++++++++++----- game.go | 28 +++++++++++++++------------- test/Quote/Monkey.spx | 2 +- 3 files changed, 26 insertions(+), 19 deletions(-) diff --git a/audio.go b/audio.go index de1f8004..add95795 100644 --- a/audio.go +++ b/audio.go @@ -58,6 +58,11 @@ const ( ActionStop ) +type SoundAction struct { + Wait bool `json:"wait"` + Action ActionState `json:"action"` +} + type soundPlayer struct { *audio.Player media Sound @@ -131,15 +136,15 @@ func (p *soundMgr) stopAll() { } } -func (p *soundMgr) playAction(media Sound, wait bool, action ActionState) (err error) { +func (p *soundMgr) playAction(media Sound, actionPlay *SoundAction) (err error) { - switch action { + switch actionPlay.Action { case ActionPlay: - err = p.play(media, wait, ActionPlay) + err = p.play(media, actionPlay.Wait, ActionPlay) case ActionLoopPlay: - err = p.play(media, wait, ActionLoopPlay) + err = p.play(media, actionPlay.Wait, ActionLoopPlay) case ActionLoopContinuePlay: - err = p.playContinue(media, wait) + err = p.playContinue(media, actionPlay.Wait) case ActionStop: p.stop(media) case ActionResume: diff --git a/game.go b/game.go index 4008f28b..0e9754be 100644 --- a/game.go +++ b/game.go @@ -1341,27 +1341,29 @@ func (p *Game) loadSound(name string) (media Sound, err error) { return } -func (p *Game) Play__0(media Sound) { - p.Play__1(media, false) -} -func (p *Game) Play__1(media Sound, wait bool) { - p.Play__3(media, wait, ActionPlay) -} -func (p *Game) Play__2(media Sound, action ActionState) { - p.Play__3(media, false, action) -} - // Play func: // Play(sound) // Play(video) -- maybe // Play(sound, wait) -- sync // Play(sound) -func (p *Game) Play__3(media Sound, wait bool, action ActionState) { +func (p *Game) Play__0(media Sound) { + p.Play__1(media, false) +} +func (p *Game) Play__1(media Sound, actions interface{}) { if debugInstr { - log.Println("Play", media.Path, wait) + log.Println("Play", media.Path) + } + + var err error + switch v := actions.(type) { + case bool: + err = p.sounds.playAction(media, &SoundAction{Wait: v, Action: ActionPlay}) + case *SoundAction: + err = p.sounds.playAction(media, v) + default: + panic("Play: unexpected input") } - err := p.sounds.playAction(media, wait, action) if err != nil { panic(err) } diff --git a/test/Quote/Monkey.spx b/test/Quote/Monkey.spx index f5b2275e..c37c817c 100644 --- a/test/Quote/Monkey.spx +++ b/test/Quote/Monkey.spx @@ -1,6 +1,6 @@ onStart => { for { - play chomp, false, ActionLoopContinuePlay + play clap, &SoundAction{Action: ActionLoopContinuePlay,Wait:false} } } From 62af668197540409567371c66eb15217ce776e08 Mon Sep 17 00:00:00 2001 From: sunqirui Date: Fri, 21 Jan 2022 16:47:33 +0800 Subject: [PATCH 06/17] rename SoundAction=>PlayOptions --- audio.go | 4 ++-- game.go | 4 ++-- test/Quote/Monkey.spx | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/audio.go b/audio.go index add95795..f21bc1b5 100644 --- a/audio.go +++ b/audio.go @@ -58,7 +58,7 @@ const ( ActionStop ) -type SoundAction struct { +type PlayOptions struct { Wait bool `json:"wait"` Action ActionState `json:"action"` } @@ -136,7 +136,7 @@ func (p *soundMgr) stopAll() { } } -func (p *soundMgr) playAction(media Sound, actionPlay *SoundAction) (err error) { +func (p *soundMgr) playAction(media Sound, actionPlay *PlayOptions) (err error) { switch actionPlay.Action { case ActionPlay: diff --git a/game.go b/game.go index 0e9754be..df23ebc5 100644 --- a/game.go +++ b/game.go @@ -1357,8 +1357,8 @@ func (p *Game) Play__1(media Sound, actions interface{}) { var err error switch v := actions.(type) { case bool: - err = p.sounds.playAction(media, &SoundAction{Wait: v, Action: ActionPlay}) - case *SoundAction: + err = p.sounds.playAction(media, &PlayOptions{Wait: v, Action: ActionPlay}) + case *PlayOptions: err = p.sounds.playAction(media, v) default: panic("Play: unexpected input") diff --git a/test/Quote/Monkey.spx b/test/Quote/Monkey.spx index c37c817c..dff019a5 100644 --- a/test/Quote/Monkey.spx +++ b/test/Quote/Monkey.spx @@ -1,6 +1,6 @@ onStart => { for { - play clap, &SoundAction{Action: ActionLoopContinuePlay,Wait:false} + play clap, &PlayOptions{Action: ActionLoopContinuePlay,Wait:false} } } @@ -21,9 +21,9 @@ onKey KeyW, => { } onKey KeyA, => { - play clap, ActionStop + play clap, &PlayOptions{Action: ActionStop} } onKey KeyB, => { - play clap, ActionResume + play clap, &PlayOptions{Action: ActionResume} } From 493a4587f55d8e6fce909dbb92a82a3faabcf53e Mon Sep 17 00:00:00 2001 From: sunqirui Date: Fri, 21 Jan 2022 16:52:42 +0800 Subject: [PATCH 07/17] play api update --- game.go | 14 +++++--------- test/Quote/Monkey.spx | 6 +++--- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/game.go b/game.go index df23ebc5..2e821b2a 100644 --- a/game.go +++ b/game.go @@ -1349,20 +1349,16 @@ func (p *Game) loadSound(name string) (media Sound, err error) { func (p *Game) Play__0(media Sound) { p.Play__1(media, false) } -func (p *Game) Play__1(media Sound, actions interface{}) { +func (p *Game) Play__1(media Sound, wait bool) { + p.Play__2(media, &PlayOptions{Wait: wait, Action: ActionPlay}) +} +func (p *Game) Play__2(media Sound, action *PlayOptions) { if debugInstr { log.Println("Play", media.Path) } var err error - switch v := actions.(type) { - case bool: - err = p.sounds.playAction(media, &PlayOptions{Wait: v, Action: ActionPlay}) - case *PlayOptions: - err = p.sounds.playAction(media, v) - default: - panic("Play: unexpected input") - } + err = p.sounds.playAction(media, action) if err != nil { panic(err) diff --git a/test/Quote/Monkey.spx b/test/Quote/Monkey.spx index dff019a5..f7c4ec6e 100644 --- a/test/Quote/Monkey.spx +++ b/test/Quote/Monkey.spx @@ -1,6 +1,6 @@ onStart => { for { - play clap, &PlayOptions{Action: ActionLoopContinuePlay,Wait:false} + play clap, {Action: ActionLoopContinuePlay,Wait:false} } } @@ -21,9 +21,9 @@ onKey KeyW, => { } onKey KeyA, => { - play clap, &PlayOptions{Action: ActionStop} + play clap, {Action: ActionStop} } onKey KeyB, => { - play clap, &PlayOptions{Action: ActionResume} + play clap, {Action: ActionResume} } From 7bebc8c04c9db77d1c2728d926576a73b97b7e00 Mon Sep 17 00:00:00 2001 From: sunqirui Date: Fri, 21 Jan 2022 22:19:29 +0800 Subject: [PATCH 08/17] remove audio " done " --- audio.go | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/audio.go b/audio.go index f21bc1b5..472f821d 100644 --- a/audio.go +++ b/audio.go @@ -157,13 +157,11 @@ func (p *soundMgr) playAction(media Sound, actionPlay *PlayOptions) (err error) func (p *soundMgr) playContinue(media Sound, wait bool) (err error) { p.playersM.Lock() isFound := false - for sp, done := range p.players { + for sp, _ := range p.players { if sp.media.Path == media.Path { sp.state = playerLoopPlay isFound = true - if done != nil { - done <- true - } + } } p.playersM.Unlock() @@ -241,13 +239,11 @@ func (p *soundMgr) pause(media Sound) { p.playersM.Lock() defer p.playersM.Unlock() - for sp, done := range p.players { + for sp, _ := range p.players { if sp.media.Path == media.Path { sp.Pause() sp.state = playerPaused - if done != nil { - done <- true - } + } } @@ -256,13 +252,11 @@ func (p *soundMgr) pause(media Sound) { func (p *soundMgr) resume(media Sound) { p.playersM.Lock() defer p.playersM.Unlock() - for sp, done := range p.players { + for sp, _ := range p.players { if sp.media.Path == media.Path { sp.Play() sp.state = playerPlay - if done != nil { - done <- true - } + } } From 5e4b3e716c85518f702d5f7f21c890ad847e2597 Mon Sep 17 00:00:00 2001 From: xushiwei Date: Mon, 24 Jan 2022 10:52:32 +0800 Subject: [PATCH 09/17] play --- audio.go | 82 +++++++++++++++++++------------------------ game.go | 15 ++++---- test/Quote/Monkey.spx | 8 ++--- 3 files changed, 47 insertions(+), 58 deletions(-) diff --git a/audio.go b/audio.go index 472f821d..49a84ed1 100644 --- a/audio.go +++ b/audio.go @@ -38,36 +38,37 @@ func newReadSeeker(source io.ReadCloser) io.ReadSeeker { // ------------------------------------------------------------------------------------- -type playerState int +type playerState byte const ( - playerPaused playerState = iota - playerPlay - playerLoopPlay + playerPlay playerState = iota playerClosed + playerPaused ) -type ActionState int +type PlayAction int const ( - ActionPlay ActionState = iota - ActionLoopPlay - ActionLoopContinuePlay - ActionPause - ActionResume - ActionStop + PlayRewind PlayAction = iota + PlayContinue + PlayPause + PlayResume + PlayStop ) type PlayOptions struct { - Wait bool `json:"wait"` - Action ActionState `json:"action"` + Action PlayAction + Wait bool + Loop bool } type soundPlayer struct { *audio.Player media Sound state playerState + loop bool } + type soundMgr struct { g *Game audioContext *audio.Context @@ -101,7 +102,7 @@ func (p *soundMgr) update() { var closed []*soundPlayer for sp, done := range p.players { if !sp.IsPlaying() && sp.state != playerPaused { - if sp.state == playerLoopPlay { + if sp.loop { sp.Rewind() sp.Play() continue @@ -136,43 +137,40 @@ func (p *soundMgr) stopAll() { } } -func (p *soundMgr) playAction(media Sound, actionPlay *PlayOptions) (err error) { - - switch actionPlay.Action { - case ActionPlay: - err = p.play(media, actionPlay.Wait, ActionPlay) - case ActionLoopPlay: - err = p.play(media, actionPlay.Wait, ActionLoopPlay) - case ActionLoopContinuePlay: - err = p.playContinue(media, actionPlay.Wait) - case ActionStop: +func (p *soundMgr) playAction(media Sound, opts *PlayOptions) (err error) { + switch opts.Action { + case PlayRewind: + err = p.play(media, opts.Wait, opts.Loop) + case PlayContinue: + err = p.playContinue(media, opts.Wait, opts.Loop) + case PlayStop: p.stop(media) - case ActionResume: + case PlayResume: p.resume(media) - case ActionPause: + case PlayPause: p.pause(media) } return } -func (p *soundMgr) playContinue(media Sound, wait bool) (err error) { + +func (p *soundMgr) playContinue(media Sound, wait, loop bool) (err error) { p.playersM.Lock() - isFound := false - for sp, _ := range p.players { + found := false + for sp := range p.players { if sp.media.Path == media.Path { - sp.state = playerLoopPlay - isFound = true - + sp.loop = loop + found = true } } p.playersM.Unlock() - if isFound == false { - err = p.play(media, wait, ActionLoopPlay) + if !found { + err = p.play(media, wait, loop) } return } -func (p *soundMgr) play(media Sound, wait bool, action ActionState) (err error) { +func (p *soundMgr) play(media Sound, wait, loop bool) (err error) { source, err := p.g.fs.Open(media.Path) if err != nil { panic(err) @@ -188,8 +186,7 @@ func (p *soundMgr) play(media Sound, wait bool, action ActionState) (err error) d = convert.ToStereo16(d) d = convert.Resample(d, audioContext.SampleRate()) - sp := &soundPlayer{} - sp.media = media + sp := &soundPlayer{media: media, loop: loop} sp.Player, err = audioContext.NewPlayer(&readCloser{d, source}) if err != nil { source.Close() @@ -202,13 +199,6 @@ func (p *soundMgr) play(media Sound, wait bool, action ActionState) (err error) } p.addPlayer(sp, done) sp.Play() - switch action { - case ActionPlay: - sp.state = playerPlay - case ActionLoopPlay: - sp.state = playerLoopPlay - } - if wait { waitForChan(done) } @@ -239,7 +229,7 @@ func (p *soundMgr) pause(media Sound) { p.playersM.Lock() defer p.playersM.Unlock() - for sp, _ := range p.players { + for sp := range p.players { if sp.media.Path == media.Path { sp.Pause() sp.state = playerPaused @@ -252,7 +242,7 @@ func (p *soundMgr) pause(media Sound) { func (p *soundMgr) resume(media Sound) { p.playersM.Lock() defer p.playersM.Unlock() - for sp, _ := range p.players { + for sp := range p.players { if sp.media.Path == media.Path { sp.Play() sp.state = playerPlay diff --git a/game.go b/game.go index 2e821b2a..f3486b47 100644 --- a/game.go +++ b/game.go @@ -1344,26 +1344,27 @@ func (p *Game) loadSound(name string) (media Sound, err error) { // Play func: // Play(sound) // Play(video) -- maybe -// Play(sound, wait) -- sync -// Play(sound) +// Play(media, wait) -- sync +// Play(media, opts) func (p *Game) Play__0(media Sound) { - p.Play__1(media, false) + p.Play__2(media, &PlayOptions{}) } + func (p *Game) Play__1(media Sound, wait bool) { - p.Play__2(media, &PlayOptions{Wait: wait, Action: ActionPlay}) + p.Play__2(media, &PlayOptions{Wait: wait}) } + func (p *Game) Play__2(media Sound, action *PlayOptions) { if debugInstr { log.Println("Play", media.Path) } - var err error - err = p.sounds.playAction(media, action) - + err := p.sounds.playAction(media, action) if err != nil { panic(err) } } + func (p *Game) StopAllSounds() { p.sounds.stopAll() } diff --git a/test/Quote/Monkey.spx b/test/Quote/Monkey.spx index f7c4ec6e..59ceeee0 100644 --- a/test/Quote/Monkey.spx +++ b/test/Quote/Monkey.spx @@ -1,7 +1,5 @@ onStart => { - for { - play clap, {Action: ActionLoopContinuePlay,Wait:false} - } + play clap, {Action: PlayContinue, Loop: true} } onClick => { @@ -21,9 +19,9 @@ onKey KeyW, => { } onKey KeyA, => { - play clap, {Action: ActionStop} + play clap, {Action: PlayPause} } onKey KeyB, => { - play clap, {Action: ActionResume} + play clap, {Action: PlayResume} } From 1eafd34d3e5ecdd7895452428d22a15ec7b5cc5a Mon Sep 17 00:00:00 2001 From: xushiwei Date: Fri, 20 May 2022 00:24:11 +0800 Subject: [PATCH 10/17] Create dependabot.yml --- .github/dependabot.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..b444581e --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "gomod" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "daily" From f2c88717048d710cdd828b9c556956709236f199 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 May 2022 16:24:48 +0000 Subject: [PATCH 11/17] Bump github.com/goplus/gop from 1.1.0-alpha2 to 1.1.0-beta5 Bumps [github.com/goplus/gop](https://github.com/goplus/gop) from 1.1.0-alpha2 to 1.1.0-beta5. - [Release notes](https://github.com/goplus/gop/releases) - [Commits](https://github.com/goplus/gop/compare/v1.1.0-alpha2...v1.1.0-beta5) --- updated-dependencies: - dependency-name: github.com/goplus/gop dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 3bb5324b..ac01c6b6 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/ajstarks/svgo v0.0.0-20210927141636-6d70534b1098 github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 github.com/goplus/canvas v0.1.0 - github.com/goplus/gop v1.1.0-alpha2 + github.com/goplus/gop v1.1.0-beta5 github.com/hajimehoshi/ebiten/v2 v2.2.0 github.com/pkg/errors v0.9.1 github.com/qiniu/audio v0.2.1 diff --git a/go.sum b/go.sum index e115c1bb..10d946a3 100644 --- a/go.sum +++ b/go.sum @@ -12,9 +12,10 @@ github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF0 github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/goplus/canvas v0.1.0 h1:Vx3f2+U8UANvWf5/01YsQYKNbZDm1GZCjhlEBFrQkeU= github.com/goplus/canvas v0.1.0/go.mod h1:Rhcvo5qkpD9WuXFnvnXtrBSY97l6h7sXQuofrmiLNdM= -github.com/goplus/gop v1.1.0-alpha2 h1:s3wMFJpprmFBmVRqUIoggQ2wJ3Kb3gX+7J0f8f2Oh8Q= -github.com/goplus/gop v1.1.0-alpha2/go.mod h1:FTu64eb9ZYCwnTfSze6asR8kbxXPs6mbI+kRmUikKf0= -github.com/goplus/gox v1.9.4/go.mod h1:PznHkzl2HARBf7+s2reqcwKm1Z1a6Wae6EntQEh0iJI= +github.com/goplus/gop v1.1.0-beta5 h1:S1zuePq+IbCFwglMKUUNPAo/VZgF04QqtBk+NOuHSac= +github.com/goplus/gop v1.1.0-beta5/go.mod h1:vmstNDS6Ye1blzT9645KQ4+PikpteNZvqjmR2dV1D8k= +github.com/goplus/gox v1.11.6/go.mod h1:gu7fuQF8RmWPZUjd+tEJGuV3m/vOEv0bHrct0x/KatM= +github.com/goplus/mod v0.9.3/go.mod h1:NHU13OjeNV3ez1f+R9FLJIlIun0KNSuZb0jnmP3N3o8= github.com/hajimehoshi/bitmapfont/v2 v2.1.3/go.mod h1:2BnYrkTQGThpr/CY6LorYtt/zEPNzvE/ND69CRTaHMs= github.com/hajimehoshi/ebiten/v2 v2.2.0 h1:2mP9HrLLqiH9X3MajElYZEjVZU/CGh22iFkjatxhT4w= github.com/hajimehoshi/ebiten/v2 v2.2.0/go.mod h1:olKl/qqhMBBAm2oI7Zy292nCtE+nitlmYKNF3UpbFn0= From 60552a1b2c6bd69b9b783a78fbefb9976a17082f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 May 2022 04:40:48 +0000 Subject: [PATCH 12/17] Bump github.com/goplus/gop from 1.1.0-beta5 to 1.1.0-rc1 Bumps [github.com/goplus/gop](https://github.com/goplus/gop) from 1.1.0-beta5 to 1.1.0-rc1. - [Release notes](https://github.com/goplus/gop/releases) - [Commits](https://github.com/goplus/gop/compare/v1.1.0-beta5...v1.1.0-rc1) --- updated-dependencies: - dependency-name: github.com/goplus/gop dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index ac01c6b6..19d51bc7 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/ajstarks/svgo v0.0.0-20210927141636-6d70534b1098 github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 github.com/goplus/canvas v0.1.0 - github.com/goplus/gop v1.1.0-beta5 + github.com/goplus/gop v1.1.0-rc1 github.com/hajimehoshi/ebiten/v2 v2.2.0 github.com/pkg/errors v0.9.1 github.com/qiniu/audio v0.2.1 diff --git a/go.sum b/go.sum index 10d946a3..18fcd808 100644 --- a/go.sum +++ b/go.sum @@ -4,17 +4,22 @@ github.com/ajstarks/deck v0.0.0-20200831202436-30c9fc6549a9/go.mod h1:JynElWSGnm github.com/ajstarks/deck/generate v0.0.0-20210309230005-c3f852c02e19/go.mod h1:T13YZdzov6OU0A1+RfKZiZN9ca6VeKdBdyDV+BY97Tk= github.com/ajstarks/svgo v0.0.0-20210927141636-6d70534b1098 h1:iiPTCsr/y6MEke5leED5Bi/0zlznD44tlHQvTgLOJcE= github.com/ajstarks/svgo v0.0.0-20210927141636-6d70534b1098/go.mod h1:1KcenG0jGWcpt8ov532z81sp/kMMUG485J2InIOyADM= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/esimov/stackblur-go v1.0.1-0.20190121110005-00e727e3c7a9 h1:TJdKpA5v3Xu24Vv0yQy1MyRJgpt7vk9AT58fGPfiZcs= github.com/esimov/stackblur-go v1.0.1-0.20190121110005-00e727e3c7a9/go.mod h1:a3zzeKuJKUpCcReHmEsuPaEnq42D2b/bHoCI8UjIuMY= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20210727001814-0db043d8d5be h1:vEIVIuBApEBQTEJt19GfhoU+zFSV+sNTa9E9FdnRYfk= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20210727001814-0db043d8d5be/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/goplus/c2go v0.7.1/go.mod h1:1om0h0m9wOzUqgxtLvaPOd2B1raurJmZ3ghGP576zZA= github.com/goplus/canvas v0.1.0 h1:Vx3f2+U8UANvWf5/01YsQYKNbZDm1GZCjhlEBFrQkeU= github.com/goplus/canvas v0.1.0/go.mod h1:Rhcvo5qkpD9WuXFnvnXtrBSY97l6h7sXQuofrmiLNdM= -github.com/goplus/gop v1.1.0-beta5 h1:S1zuePq+IbCFwglMKUUNPAo/VZgF04QqtBk+NOuHSac= -github.com/goplus/gop v1.1.0-beta5/go.mod h1:vmstNDS6Ye1blzT9645KQ4+PikpteNZvqjmR2dV1D8k= -github.com/goplus/gox v1.11.6/go.mod h1:gu7fuQF8RmWPZUjd+tEJGuV3m/vOEv0bHrct0x/KatM= +github.com/goplus/gop v1.1.0-rc1 h1:MmQ6mLc8eDQpw6eqTdZzaTyS+HK1kQWsEzecgvShZDc= +github.com/goplus/gop v1.1.0-rc1/go.mod h1:caYHP6DOFj/vPUTD3u9gHMzDJ2TmQAuKos4hia07IvA= +github.com/goplus/gox v1.11.7/go.mod h1:gu7fuQF8RmWPZUjd+tEJGuV3m/vOEv0bHrct0x/KatM= +github.com/goplus/libc v0.3.5/go.mod h1:Tylp4skmMW4TZsGKpajx1TARMtExegAqRX0bzAEGZW8= github.com/goplus/mod v0.9.3/go.mod h1:NHU13OjeNV3ez1f+R9FLJIlIun0KNSuZb0jnmP3N3o8= github.com/hajimehoshi/bitmapfont/v2 v2.1.3/go.mod h1:2BnYrkTQGThpr/CY6LorYtt/zEPNzvE/ND69CRTaHMs= github.com/hajimehoshi/ebiten/v2 v2.2.0 h1:2mP9HrLLqiH9X3MajElYZEjVZU/CGh22iFkjatxhT4w= @@ -31,10 +36,15 @@ github.com/jezek/xgb v0.0.0-20210312150743-0e0f116e1240 h1:dy+DS31tGEGCsZzB45HmJ github.com/jezek/xgb v0.0.0-20210312150743-0e0f116e1240/go.mod h1:3P4UH/k22rXyHIJD2w4h2XMqPX4Of/eySEZq9L6wqc4= github.com/jfreymuth/oggvorbis v1.0.3/go.mod h1:1U4pqWmghcoVsCJJ4fRBKv9peUJMBHixthRlBeD6uII= github.com/jfreymuth/vorbis v1.0.2/go.mod h1:DoftRo4AznKnShRl1GxiTFCseHr4zR9BN3TWXyuzrqQ= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/petermattis/goid v0.0.0-20220331194723-8ee3e6ded87a/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/qiniu/audio v0.2.1 h1:lAc3dWfr7uAfn7mfee2u0/fl/QSQA9oTOqdBtxyFZAM= github.com/qiniu/audio v0.2.1/go.mod h1:APMJRPaS4toviejZnDzzZ8wVyr12jqZhd3xfKr/qYnE= github.com/qiniu/oksvg v0.2.0-no-charset h1:KKQg81v52pd5VyaxrF891igoOO50epKfFWkryYgntnE= @@ -44,6 +54,8 @@ github.com/qiniu/x v1.11.5/go.mod h1:03Ni9tj+N2h2aKnAz+6N0Xfl8FwMEDRC2PAlxekASDs github.com/srwiley/rasterx v0.0.0-20200120212402-85cb7272f5e9/go.mod h1:mvWM0+15UqyrFKqdRjY6LuAVJR0HOVhJlEgZ5JWtSWU= github.com/srwiley/rasterx v0.0.0-20210519020934-456a8d69b780 h1:oDMiXaTMyBEuZMU53atpxqYsSB3U1CHkeAu2zr6wTeY= github.com/srwiley/rasterx v0.0.0-20210519020934-456a8d69b780/go.mod h1:mvWM0+15UqyrFKqdRjY6LuAVJR0HOVhJlEgZ5JWtSWU= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= From 903f98cbfa5ed620ab3b61c1d876c93f7a4d1e63 Mon Sep 17 00:00:00 2001 From: JessonChan Date: Fri, 27 May 2022 00:22:20 +0800 Subject: [PATCH 13/17] cache the svg to image,which could decrease cpu usage --- internal/svgr/svg.go | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/internal/svgr/svg.go b/internal/svgr/svg.go index 95c737bc..da2541ce 100644 --- a/internal/svgr/svg.go +++ b/internal/svgr/svg.go @@ -2,7 +2,9 @@ package svg import ( "bytes" + "crypto/md5" "errors" + "fmt" "image" "io" "io/ioutil" @@ -11,10 +13,10 @@ import ( "github.com/srwiley/rasterx" ) -//const svgHeader = ` -// +// Date: Fri, 27 May 2022 00:25:15 +0800 Subject: [PATCH 14/17] cache decoded image of svg,which will decrease the cpu usage --- internal/svgr/svg.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/internal/svgr/svg.go b/internal/svgr/svg.go index da2541ce..858bfb2f 100644 --- a/internal/svgr/svg.go +++ b/internal/svgr/svg.go @@ -37,7 +37,6 @@ func decode(input []byte, width int, height int) (image.Image, error) { if err != nil { return nil, err } - w, h := int(icon.ViewBox.W), int(icon.ViewBox.H) if width > 0 && height > 0 { w, h = width, height @@ -55,6 +54,10 @@ type md5hash string var cacheImg = map[md5hash]image.Image{} +func md5Svg(bs []byte, width, height int) md5hash { + return md5hash(fmt.Sprintf("%s,d%,%d", md5.Sum(bs), width, height)) +} + // Decode decodes the first frame of an SVG file into an image. // func Decode(r io.Reader) (image.Image, error) { @@ -68,12 +71,7 @@ func DecodeSize(r io.Reader, width int, height int) (image.Image, error) { if err != nil { return nil, err } - img, err := decode(b, width, height) - return img, err -} - -func md5Svg(bs []byte, width, height int) md5hash { - return md5hash(fmt.Sprintf("%s,d%,%d", md5.Sum(bs), width, height)) + return decode(b, width, height) } // DecodeConfig returns metadata. From 87a6f7b1897da82b36237abb9175e091a988b24c Mon Sep 17 00:00:00 2001 From: JessonChan Date: Fri, 27 May 2022 07:59:45 +0800 Subject: [PATCH 15/17] cache decoded image of svg,which will decrease the cpu usage --- internal/svgr/svg.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/svgr/svg.go b/internal/svgr/svg.go index 858bfb2f..c0db8631 100644 --- a/internal/svgr/svg.go +++ b/internal/svgr/svg.go @@ -55,7 +55,7 @@ type md5hash string var cacheImg = map[md5hash]image.Image{} func md5Svg(bs []byte, width, height int) md5hash { - return md5hash(fmt.Sprintf("%s,d%,%d", md5.Sum(bs), width, height)) + return md5hash(fmt.Sprintf("%s,%d,%d", md5.Sum(bs), width, height)) } // Decode decodes the first frame of an SVG file into an image. From 2c10b93b262cc1971d6c5accffc53e133418c9ce Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 May 2022 04:43:36 +0000 Subject: [PATCH 16/17] Bump github.com/goplus/gop from 1.1.0-rc1 to 1.1.0-rc2 Bumps [github.com/goplus/gop](https://github.com/goplus/gop) from 1.1.0-rc1 to 1.1.0-rc2. - [Release notes](https://github.com/goplus/gop/releases) - [Commits](https://github.com/goplus/gop/compare/v1.1.0-rc1...v1.1.0-rc2) --- updated-dependencies: - dependency-name: github.com/goplus/gop dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 19d51bc7..b9aa2bb6 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/ajstarks/svgo v0.0.0-20210927141636-6d70534b1098 github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 github.com/goplus/canvas v0.1.0 - github.com/goplus/gop v1.1.0-rc1 + github.com/goplus/gop v1.1.0-rc2 github.com/hajimehoshi/ebiten/v2 v2.2.0 github.com/pkg/errors v0.9.1 github.com/qiniu/audio v0.2.1 diff --git a/go.sum b/go.sum index 18fcd808..4c0b827f 100644 --- a/go.sum +++ b/go.sum @@ -13,14 +13,14 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20210727001814-0db043d8d5be/go.mod h1:tQ2 github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/goplus/c2go v0.7.1/go.mod h1:1om0h0m9wOzUqgxtLvaPOd2B1raurJmZ3ghGP576zZA= +github.com/goplus/c2go v0.7.2/go.mod h1:Gd/r7JdrxXDoFKXyP6tsKTM0+j50CGxT0QDJ/5k8hYU= github.com/goplus/canvas v0.1.0 h1:Vx3f2+U8UANvWf5/01YsQYKNbZDm1GZCjhlEBFrQkeU= github.com/goplus/canvas v0.1.0/go.mod h1:Rhcvo5qkpD9WuXFnvnXtrBSY97l6h7sXQuofrmiLNdM= -github.com/goplus/gop v1.1.0-rc1 h1:MmQ6mLc8eDQpw6eqTdZzaTyS+HK1kQWsEzecgvShZDc= -github.com/goplus/gop v1.1.0-rc1/go.mod h1:caYHP6DOFj/vPUTD3u9gHMzDJ2TmQAuKos4hia07IvA= +github.com/goplus/gop v1.1.0-rc2 h1:a7qKX5NiJHvmwUU2Rm3+9ujgBkmOlmH4UcyjWsRoh98= +github.com/goplus/gop v1.1.0-rc2/go.mod h1:SDRkIwrlplH1dZjEubh1vubA8aJvPtMrkEgFz+MjJsA= github.com/goplus/gox v1.11.7/go.mod h1:gu7fuQF8RmWPZUjd+tEJGuV3m/vOEv0bHrct0x/KatM= -github.com/goplus/libc v0.3.5/go.mod h1:Tylp4skmMW4TZsGKpajx1TARMtExegAqRX0bzAEGZW8= -github.com/goplus/mod v0.9.3/go.mod h1:NHU13OjeNV3ez1f+R9FLJIlIun0KNSuZb0jnmP3N3o8= +github.com/goplus/libc v0.3.6/go.mod h1:nyKm7Iir6iI6hQT5WWUG6Jomx2zt/XRAGLLKtLrlICI= +github.com/goplus/mod v0.9.7/go.mod h1:NHU13OjeNV3ez1f+R9FLJIlIun0KNSuZb0jnmP3N3o8= github.com/hajimehoshi/bitmapfont/v2 v2.1.3/go.mod h1:2BnYrkTQGThpr/CY6LorYtt/zEPNzvE/ND69CRTaHMs= github.com/hajimehoshi/ebiten/v2 v2.2.0 h1:2mP9HrLLqiH9X3MajElYZEjVZU/CGh22iFkjatxhT4w= github.com/hajimehoshi/ebiten/v2 v2.2.0/go.mod h1:olKl/qqhMBBAm2oI7Zy292nCtE+nitlmYKNF3UpbFn0= From ce3a7f7203a9ae4f7faeed606b608e905c428ec3 Mon Sep 17 00:00:00 2001 From: xushiwei Date: Mon, 30 May 2022 13:18:48 +0800 Subject: [PATCH 17/17] Update go.yml --- .github/workflows/go.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 5740c6c2..31b21248 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -11,10 +11,10 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v3 with: go-version: 1.16