out to file for channel mixer
2 files changed, 29 insertions(+), 0 deletions(-)

M player/channelmixer.go
M player/channelsys.go
M player/channelmixer.go +26 -0
@@ 2,12 2,16 @@ package player
 
 import (
 	"fmt"
+	"os"
 )
 
 type ChannelMixer struct {
 	channelSys *ChannelSys
 	// XXX ?
 	InstrumentPlayers []*InstrumentPlayer
+	
+	// test
+	outTestFile *os.File
 }
 
 func NewChannelMixer(s *ChannelSys) *ChannelMixer {

          
@@ 20,6 24,22 @@ func NewChannelMixer(s *ChannelSys) *Cha
 	return cm
 }
 
+func (cm *ChannelMixer) Init() {
+	fmt.Println("ChannelMixer Init")
+	
+	writeToFile := true
+	
+	if writeToFile {
+		path := "/tmp/out_channel_mixer_buf.raw"
+		var err error
+		cm.outTestFile, err = os.Create(path)
+		
+		if err != nil {
+			panic(err)
+		}
+	}
+}
+
 func (cm *ChannelMixer) mixnbufs(bufs... [][2]float64) [][2]float64 {
 	//var res [][2]float64
 

          
@@ 94,5 114,11 @@ func (cm *ChannelMixer) MixBuf() [][2]fl
 func (cm *ChannelMixer) RenderTick(tickSize int) [][2]float64 {
 	buf := cm.MixBufTest(tickSize)
 	
+	writeToFile := true
+	
+	if writeToFile {
+		DumpBufFile(cm.outTestFile, buf)
+	}
+	
 	return buf
 }

          
M player/channelsys.go +3 -0
@@ 19,6 19,9 @@ func NewChannelSys() *ChannelSys {
 	}
 	s.ChannelMixer = NewChannelMixer(s)
 	
+	// XXX
+	s.ChannelMixer.Init()
+	
 	return s	
 }