Many sounds from one data buffer+volume control

This commit is contained in:
bloeys
2022-06-25 20:44:03 +04:00
parent cdc8d47353
commit ca4db3a12b
3 changed files with 45 additions and 13 deletions

View File

@ -58,12 +58,12 @@ func (sb *SoundBuffer) Seek(offset int64, whence int) (int64, error) {
return sb.Pos, nil
}
//Clone returns a new SoundBuffer that uses the same `Data` but with an independent ReadSeeker.
//Copy returns a new SoundBuffer that uses the same `Data` but with an independent ReadSeeker.
//This allows you to have many readers all reading from different positions of the same buffer.
//
//The new buffer will have its starting position set to io.SeekStart (`Pos=0`)
func (sb *SoundBuffer) Clone() SoundBuffer {
return SoundBuffer{
func (sb *SoundBuffer) Copy() *SoundBuffer {
return &SoundBuffer{
Data: sb.Data,
Pos: 0,
}