mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
audio: Refactoring
This commit is contained in:
parent
3cf5ca4df3
commit
2624ed6824
@ -59,13 +59,6 @@ const (
|
|||||||
mask = ^(channelNum*bytesPerSample - 1)
|
mask = ^(channelNum*bytesPerSample - 1)
|
||||||
)
|
)
|
||||||
|
|
||||||
func min(a, b int) int {
|
|
||||||
if a < b {
|
|
||||||
return a
|
|
||||||
}
|
|
||||||
return b
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *players) Read(b []uint8) (int, error) {
|
func (p *players) Read(b []uint8) (int, error) {
|
||||||
p.Lock()
|
p.Lock()
|
||||||
defer p.Unlock()
|
defer p.Unlock()
|
||||||
@ -94,7 +87,9 @@ func (p *players) Read(b []uint8) (int, error) {
|
|||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
l = min(n, l)
|
if n < l {
|
||||||
|
l = n
|
||||||
|
}
|
||||||
}
|
}
|
||||||
l &= mask
|
l &= mask
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user