mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
audio/mp3: Refactoring
This commit is contained in:
parent
9130c490c2
commit
3be2b2516f
@ -58,8 +58,9 @@ func Decode(context *audio.Context, src audio.ReadSeekCloser) (*Stream, error) {
|
|||||||
var s audio.ReadSeekCloser = d
|
var s audio.ReadSeekCloser = d
|
||||||
size := d.Length()
|
size := d.Length()
|
||||||
if d.SampleRate() != context.SampleRate() {
|
if d.SampleRate() != context.SampleRate() {
|
||||||
s = convert.NewResampling(s, d.Length(), d.SampleRate(), context.SampleRate())
|
r := convert.NewResampling(s, d.Length(), d.SampleRate(), context.SampleRate())
|
||||||
size = size * int64(context.SampleRate()) / int64(d.SampleRate())
|
s = r
|
||||||
|
size = r.Size()
|
||||||
}
|
}
|
||||||
return &Stream{
|
return &Stream{
|
||||||
inner: s,
|
inner: s,
|
||||||
|
Loading…
Reference in New Issue
Block a user