Optimized way to get wav header.
Slice/Unsafe is selected
Show becnhmark results:
make test
// If u want to stream data through channels.
fwh.StartStreamEvent()
filePaths := []string{
...
}
filePaths2 := []string{
...
}
// Send your filePaths to channel.
for _, val := range filePaths {
fwh.FilePathCh <- val
}
// Consume WavHeaderInfos from channel.
go func() {
consume := fwh.HeaderCh
for {
select {
case wavinfo, ok := <-consume:
if !ok {
consume = fwh.HeaderCh
} else {
// Do something..
log.Println("@@ WavInfo:", wavinfo)
}
default:
continue
}
}
}()
// Change channel capacity. Async or Sync.
go fwh.ChangeQueueSize(30, 40)
// Again, send new filePaths to adjusted channel.
for _, val := range filePaths2 {
fwh.FilePathCh <- val
}