-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
eboatwright
committed
Aug 21, 2021
1 parent
7e60a63
commit 5b2e92c
Showing
6 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package pearl | ||
|
||
|
||
import ( | ||
"github.com/hajimehoshi/ebiten/v2/audio" | ||
"github.com/hajimehoshi/ebiten/v2/audio/wav" | ||
|
||
"os" | ||
) | ||
|
||
|
||
func PlaySoundFromFile(path string) { | ||
sfx, _ := os.Open(path) | ||
decoded, _ := wav.Decode(g.audioContext, sfx) | ||
player, _ := audio.NewPlayer(g.audioContext, decoded) | ||
|
||
player.Rewind() | ||
player.Play() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package main | ||
|
||
|
||
import ( | ||
"github.com/eboatwright/pearl" | ||
) | ||
|
||
|
||
func main() { | ||
pearl.Start(960, 600, 3, "Audio Test", pearl.RGBA(0, 0, 0, 255), func() { | ||
scene := &pearl.Scene { ID: "scene" } | ||
pearl.LoadScene(scene) | ||
pearl.PlaySoundFromFile("test.wav") | ||
}) | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters