mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-26 02:42:02 +01:00
examples/audio: Use the same audio file for Ogg and MP3
This also changes the sample rate to 32000 for some special environments.
This commit is contained in:
parent
e873b386a0
commit
6f462e824f
@ -42,7 +42,7 @@ const (
|
||||
screenWidth = 640
|
||||
screenHeight = 480
|
||||
|
||||
sampleRate = 22050
|
||||
sampleRate = 32000
|
||||
)
|
||||
|
||||
var (
|
||||
@ -106,7 +106,7 @@ func NewPlayer(audioContext *audio.Context, musicType musicType) (*Player, error
|
||||
}
|
||||
case typeMP3:
|
||||
var err error
|
||||
s, err = mp3.Decode(audioContext, bytes.NewReader(raudio.Classic_mp3))
|
||||
s, err = mp3.Decode(audioContext, bytes.NewReader(raudio.Ragtime_mp3))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -255,10 +255,11 @@ Press S to toggle Play/Pause
|
||||
Press P to play SE
|
||||
Press Z or X to change volume of the music
|
||||
Press U to switch the runnable-on-unfocused state
|
||||
Press A to switch Ogg and MP3
|
||||
Press A to switch Ogg and MP3 (Current: %s)
|
||||
Current Time: %s
|
||||
Current Volume: %d/128
|
||||
Type: %s`, ebiten.CurrentTPS(), currentTimeStr, int(p.audioPlayer.Volume()*128), p.musicType)
|
||||
Type: %s`, ebiten.CurrentTPS(), p.musicType,
|
||||
currentTimeStr, int(p.audioPlayer.Volume()*128), p.musicType)
|
||||
ebitenutil.DebugPrint(screen, msg)
|
||||
}
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
Binary file not shown.
@ -1,14 +1,5 @@
|
||||
# License
|
||||
|
||||
## classic.mp3
|
||||
|
||||
```
|
||||
https://musopen.org/music/466/johann-sebastian-bach/air-on-the-g-string-from-orchestral-suite-no-3-bwv-1068/
|
||||
|
||||
Air on the G String (from Orchestral Suite no. 3, BWV 1068)
|
||||
Public Domain
|
||||
```
|
||||
|
||||
## jab.wav
|
||||
|
||||
```
|
||||
@ -27,7 +18,7 @@ CC0
|
||||
```
|
||||
|
||||
|
||||
## ragtime.ogg
|
||||
## ragtime.ogg / ragtime.mp3
|
||||
|
||||
```
|
||||
https://soundcloud.com/jacaranda-trilhas-sonoras/james-scott-01-frog-legs-rag
|
||||
|
File diff suppressed because one or more lines are too long
BIN
examples/resources/audio/ragtime.mp3
Normal file
BIN
examples/resources/audio/ragtime.mp3
Normal file
Binary file not shown.
5
examples/resources/audio/ragtime.mp3.go
Normal file
5
examples/resources/audio/ragtime.mp3.go
Normal file
File diff suppressed because one or more lines are too long
Binary file not shown.
5
examples/resources/audio/ragtime.ogg.go
Normal file
5
examples/resources/audio/ragtime.ogg.go
Normal file
File diff suppressed because one or more lines are too long
@ -12,10 +12,10 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:generate file2byteslice -package=audio -input=./audio/classic.mp3 -output=./audio/classic.go -var=Classic_mp3
|
||||
//go:generate file2byteslice -package=audio -input=./audio/jab.wav -output=./audio/jab.go -var=Jab_wav
|
||||
//go:generate file2byteslice -package=audio -input=./audio/jump.ogg -output=./audio/jump.go -var=Jump_ogg
|
||||
//go:generate file2byteslice -package=audio -input=./audio/ragtime.ogg -output=./audio/ragtime.go -var=Ragtime_ogg
|
||||
//go:generate file2byteslice -package=audio -input=./audio/ragtime.mp3 -output=./audio/ragtime.mp3.go -var=Ragtime_mp3
|
||||
//go:generate file2byteslice -package=audio -input=./audio/ragtime.ogg -output=./audio/ragtime.ogg.go -var=Ragtime_ogg
|
||||
//go:generate file2byteslice -package=fonts -input=./fonts/mplus-1p-regular.ttf -output=./fonts/mplus1pregular.go -var=MPlus1pRegular_ttf
|
||||
//go:generate file2byteslice -package=fonts -input=./fonts/pressstart2p.ttf -output=./fonts/pressstart2p.go -var=PressStart2P_ttf
|
||||
//go:generate file2byteslice -package=images -input=./images/ebiten.png -output=./images/ebiten.go -var=Ebiten_png
|
||||
|
Loading…
Reference in New Issue
Block a user