auido: Remove some APIs

This commit is contained in:
Hajime Hoshi 2016-02-09 23:04:00 +09:00
parent 70fe6d8169
commit 2ba25b1a14
3 changed files with 8 additions and 15 deletions

View File

@ -27,6 +27,7 @@ import (
const (
screenWidth = 320
screenHeight = 240
sampleRate = 44100
)
var frames = 0
@ -57,7 +58,7 @@ func square(out []int16, volume float64, freq float64, sequence float64) {
}
return
}
length := int(float64(audio.SampleRate) / freq)
length := int(float64(sampleRate) / freq)
if length == 0 {
panic("invalid freq")
}
@ -85,7 +86,7 @@ func toBytes(l, r []int16) []byte {
}
func addNote() {
size := audio.SampleRate / 60
size := sampleRate / 60
notes := []float64{freqC, freqD, freqE, freqF, freqG, freqA * 2, freqB * 2}
defer func() {

View File

@ -29,14 +29,15 @@ import (
const (
screenWidth = 320
screenHeight = 240
sampleRate = 44100
)
var pcm = make([]float64, 4*audio.SampleRate)
var pcm = make([]float64, 4*sampleRate)
const baseFreq = 220
func init() {
s := float64(audio.SampleRate)
s := float64(sampleRate)
amp := []float64{1.0, 0.8, 0.6, 0.4, 0.2}
x := []float64{4.0, 2.0, 1.0, 0.5, 0.25}
for i := 0; i < len(pcm); i++ {

View File

@ -18,25 +18,16 @@ import (
"github.com/hajimehoshi/ebiten/internal/audio"
)
// SampleRate returns the sampling frequency (e.g. 44100).
const SampleRate = audio.SampleRate
// MaxChannel is a max number of channels.
const MaxChannel = audio.MaxChannel
// Queue queues the given data to the given channel.
// The given data is queued to the end of the buffer.
// This may not be played immediately when data already exists in the buffer.
//
// data's format must be linear PCM (44100Hz, 16bits, 2 channel stereo, little endian)
// without a header (e.g. RIFF header).
//
// TODO: Pass sample rate and num of channels.
func Queue(data []byte) bool {
return audio.Queue(data)
}
// IsPlaying returns a boolean value which indicates if the channel buffer has data to play.
func IsPlaying(channel int) bool {
return audio.IsPlaying(channel)
}
// TODO: Add Clear function