mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +01:00
audio/mp3: Refactoring: Use uint32 for output data
This commit is contained in:
parent
51a2507430
commit
541a633361
@ -40,7 +40,7 @@ var (
|
||||
)
|
||||
|
||||
func decodeL3() error {
|
||||
out := make([]int, 576)
|
||||
out := make([]uint32, 576)
|
||||
// Number of channels(1 for mono and 2 for stereo)
|
||||
nch := 2
|
||||
if C.g_frame_header.mode == C.mpeg1_mode_single_channel {
|
||||
@ -68,7 +68,7 @@ func decodeL3() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func audioWriteRaw(samples []int) error {
|
||||
func audioWriteRaw(samples []uint32) error {
|
||||
nch := 2
|
||||
if C.g_frame_header.mode == C.mpeg1_mode_single_channel {
|
||||
nch = 1
|
||||
|
@ -558,7 +558,7 @@ var g_synth_dtbl = [512]float32{
|
||||
0.000015259, 0.000015259, 0.000015259, 0.000015259,
|
||||
}
|
||||
|
||||
func l3SubbandSynthesis(gr int, ch int, out []int) {
|
||||
func l3SubbandSynthesis(gr int, ch int, out []uint32) {
|
||||
u_vec := make([]float32, 512)
|
||||
s_vec := make([]float32, 32)
|
||||
|
||||
@ -604,15 +604,16 @@ func l3SubbandSynthesis(gr int, ch int, out []int) {
|
||||
samp = -32767
|
||||
}
|
||||
samp &= 0xffff
|
||||
s := uint32(samp)
|
||||
if ch == 0 { /* This function must be called for channel 0 first */
|
||||
/* We always run in stereo mode,& duplicate channels here for mono */
|
||||
if nch == 1 {
|
||||
out[32*ss+i] = (samp << 16) | (samp)
|
||||
out[32*ss+i] = (s << 16) | (s)
|
||||
} else {
|
||||
out[32*ss+i] = samp << 16
|
||||
out[32*ss+i] = s << 16
|
||||
}
|
||||
} else {
|
||||
out[32*ss+i] |= samp
|
||||
out[32*ss+i] |= s
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user