Skip to content
This repository has been archived by the owner on Mar 18, 2024. It is now read-only.

Commit

Permalink
Merge pull request #3 from gotracker/mixer-fixup
Browse files Browse the repository at this point in the history
Mixer API cleanup
  • Loading branch information
heucuva authored Jul 22, 2022
2 parents ef2973b + fe9de91 commit 65ff401
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions mixing/mixer.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import (

// Mixer is a manager for mixing multiple single- and multi-channel samples into a single multi-channel output stream
type Mixer struct {
Channels int
BitsPerSample int
Channels int
}

// NewMixBuffer returns a mixer buffer with a number of channels
Expand Down Expand Up @@ -42,8 +41,8 @@ func (m Mixer) Flatten(panmixer PanMixer, samplesLen int, row []ChannelData, mix
}

// FlattenToInts runs a flatten on the channel data into separate channel data of int32 variety
// these int32s still respect the BitsPerSample size
func (m Mixer) FlattenToInts(panmixer PanMixer, samplesLen int, row []ChannelData, mixerVolume volume.Volume) [][]int32 {
// these int32s still respect the bitsPerSample size
func (m Mixer) FlattenToInts(panmixer PanMixer, samplesLen, bitsPerSample int, row []ChannelData, mixerVolume volume.Volume) [][]int32 {
data := m.NewMixBuffer(samplesLen)
for _, rdata := range row {
for _, cdata := range rdata {
Expand All @@ -56,7 +55,7 @@ func (m Mixer) FlattenToInts(panmixer PanMixer, samplesLen int, row []ChannelDat
}
}
}
return data.ToIntStream(panmixer.NumChannels(), samplesLen, m.BitsPerSample, mixerVolume)
return data.ToIntStream(panmixer.NumChannels(), samplesLen, bitsPerSample, mixerVolume)
}

// FlattenTo will to a final saturation mix of all the row's channel data into a single output buffer
Expand Down

0 comments on commit 65ff401

Please sign in to comment.