Skip to content
This repository has been archived by the owner on Jul 22, 2022. It is now read-only.

Commit

Permalink
Updating to use MixerVolume value
Browse files Browse the repository at this point in the history
- using updated gomixing library
  • Loading branch information
Jason Crawford committed Dec 28, 2020
1 parent 6b01f0b commit 8f0872a
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion device_directsound.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func (d *dsoundDevice) PlayWithCtx(ctx context.Context, in <-chan *PremixData) e
if err != nil {
continue
}
d.mix.FlattenTo(segments, panmixer, row.SamplesLen, row.Data)
d.mix.FlattenTo(segments, panmixer, row.SamplesLen, row.Data, row.MixerVolume)
if err := lpdsb.Unlock(segments); err != nil {
continue
}
Expand Down
2 changes: 1 addition & 1 deletion device_file_flac.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func (d *fileDeviceFlac) PlayWithCtx(ctx context.Context, in <-chan *PremixData)
if !ok {
return nil
}
mixedData := d.mix.FlattenToInts(panmixer, row.SamplesLen, row.Data)
mixedData := d.mix.FlattenToInts(panmixer, row.SamplesLen, row.Data, row.MixerVolume)
subframes := make([]*frame.Subframe, d.mix.Channels)
for i := range subframes {
subframe := &frame.Subframe{
Expand Down
2 changes: 1 addition & 1 deletion device_file_wav.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (d *fileDeviceWav) PlayWithCtx(ctx context.Context, in <-chan *PremixData)
if !ok {
return nil
}
mixedData := d.mix.Flatten(panmixer, row.SamplesLen, row.Data)
mixedData := d.mix.Flatten(panmixer, row.SamplesLen, row.Data, row.MixerVolume)
d.w.Write(mixedData)
d.sz += uint32(len(mixedData))
if d.onRowOutput != nil {
Expand Down
2 changes: 1 addition & 1 deletion device_pulseaudio.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (d *pulseaudioDevice) PlayWithCtx(ctx context.Context, in <-chan *PremixDat
if !ok {
return nil
}
mixedData := d.mix.Flatten(panmixer, row.SamplesLen, row.Data)
mixedData := d.mix.Flatten(panmixer, row.SamplesLen, row.Data, row.MixerVolume)
d.pa.Output(mixedData)
if d.onRowOutput != nil {
d.onRowOutput(KindSoundCard, row)
Expand Down
2 changes: 1 addition & 1 deletion device_winmm.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (d *winmmDevice) PlayWithCtx(ctx context.Context, in <-chan *PremixData) er
if !ok {
return
}
mixedData := d.mix.Flatten(panmixer, row.SamplesLen, row.Data)
mixedData := d.mix.Flatten(panmixer, row.SamplesLen, row.Data, row.MixerVolume)
rowWave := RowWave{
Wave: d.waveout.Write(mixedData),
Row: row,
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/gotracker/gosound
go 1.15

require (
github.com/gotracker/gomixing v1.0.5
github.com/gotracker/gomixing v1.0.6
github.com/jfreymuth/pulse v0.1.0
github.com/mewkiz/flac v1.0.6
github.com/pkg/errors v0.9.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ github.com/d4l3k/messagediff v1.2.2-0.20190829033028-7e0a312ae40b/go.mod h1:Oozb
github.com/go-audio/audio v1.0.0/go.mod h1:6uAu0+H2lHkwdGsAY+j2wHPNPpPoeg5AaEFh9FlA+Zs=
github.com/go-audio/riff v1.0.0/go.mod h1:l3cQwc85y79NQFCRB7TiPoNiaijp6q8Z0Uv38rVG498=
github.com/go-audio/wav v1.0.0/go.mod h1:3yoReyQOsiARkvPl3ERCi8JFjihzG6WhjYpZCf5zAWE=
github.com/gotracker/gomixing v1.0.5 h1:TpeW8V692chsYq+q1TCO7cvNtQ24F4zJ3JDCh3WZRlU=
github.com/gotracker/gomixing v1.0.5/go.mod h1:orU2G///ovcRkt4bdNZMhOPvHW0vl5yebXaLKqQcHWw=
github.com/gotracker/gomixing v1.0.6 h1:RRwO+GqWUmVNzUfPsrDA+Hao2C+hJE3cBAxCUvP2rw8=
github.com/gotracker/gomixing v1.0.6/go.mod h1:orU2G///ovcRkt4bdNZMhOPvHW0vl5yebXaLKqQcHWw=
github.com/icza/bitio v1.0.0 h1:squ/m1SHyFeCA6+6Gyol1AxV9nmPPlJFT8c2vKdj3U8=
github.com/icza/bitio v1.0.0/go.mod h1:0jGnlLAx8MKMr9VGnn/4YrvZiprkvBelsVIbA9Jjr9A=
github.com/icza/mighty v0.0.0-20180919140131-cfd07d671de6 h1:8UsGZ2rr2ksmEru6lToqnXgA8Mz1DP11X4zSJ159C3k=
Expand Down
12 changes: 8 additions & 4 deletions premixdata.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
package gosound

import "github.com/gotracker/gomixing/mixing"
import (
"github.com/gotracker/gomixing/mixing"
"github.com/gotracker/gomixing/volume"
)

// PremixData is a structure containing the audio pre-mix data for a specific row or buffer
type PremixData struct {
SamplesLen int
Data []mixing.ChannelData
Userdata interface{}
SamplesLen int
Data []mixing.ChannelData
MixerVolume volume.Volume
Userdata interface{}
}

0 comments on commit 8f0872a

Please sign in to comment.