func (d *Decoder) IsInSpeech() bool {
	v := pocketsphinx.GetInSpeech(d.dec)
	return v == 1
}
IsInSpeech checks if the last feed audio buffer contained speech.
package sphinx
import (
	"errors"
	"time"
	"github.com/xlab/pocketsphinx-go/pocketsphinx"
)
type Decoder struct {
	cfg *Config
	dec *pocketsphinx.Decoder
	maxRawdataSize int32
	rawdataBuf     [][]int16
}
func (d *Decoder) Config() *Config {
	return d.cfg
}
func NewDecoder(cfg *Config) (*Decoder, error) {
	if cfg == nil {
		cfg = NewConfig()
	}
	dec := &Decoder{
		cfg: cfg,
		dec: pocketsphinx.Init(cfg.CommandLn()),
	}
	if dec.dec == nil {
		cfg.Destroy()
		err := errors.New("pocketsphinx.Init failed")
		return nil, err
	}
	dec.SetRawDataSize(0)
	return dec, nil
}
func (d *Decoder) Reconfigure(cfg *Config) {
	pocketsphinx.Reinit(d.dec, cfg.CommandLn())
}
func (d *Decoder) Destroy() bool {
	if d.dec != nil {
		ret := pocketsphinx.Free(d.dec)
		d.dec = nil
		return ret == 0
	}
	d.cfg.Destroy()
	return true
}
func (d *Decoder) LogMath() *LogMath {
	return &LogMath{
		m: pocketsphinx.GetLogmath(d.dec),
	}
}
func (d *Decoder) Decoder() *pocketsphinx.Decoder {
	return pocketsphinx.Retain(d.dec)
}
func (d *Decoder) UpdateMLLR(mllr *MLLR) *MLLR {
	var m *pocketsphinx.Mllr
	if mllr == nil {
		m = pocketsphinx.UpdateMllr(d.dec, nil)
	} else {
		m = pocketsphinx.UpdateMllr(d.dec, mllr.m)
	}
	if m != nil {
		return &MLLR{
			m: m,
		}
	}
	return nil
}
func (d *Decoder) ReadDict(dictFile, fillerDictFile String) bool {
	ret := pocketsphinx.LoadDict(d.dec, dictFile.S(), fillerDictFile.S(), end)
	return ret == 0
}
func (d *Decoder) WriteDict(dictFile String) bool {
	ret := pocketsphinx.SaveDict(d.dec, dictFile.S(), end)
	return ret == 0
}
func (d *Decoder) AddWord(word, phones String, update bool) (id int32, ok bool) {
	ret := pocketsphinx.AddWord(d.dec, word.S(), phones.S(), b(update))
	if ret < 0 {
		return 0, false
	}
	return ret, true
}
func (d *Decoder) LookupWord(word String) (string, bool) {
	phones := pocketsphinx.LookupWord(d.dec, word.S())
	if phones != nil {
		return string(phones), true
	}
	return "", false
}
func (d *Decoder) StartStream() bool {
	ret := pocketsphinx.StartStream(d.dec)
	return ret == 0
}
func (d *Decoder) StartUtt() bool {
	ret := pocketsphinx.StartUtt(d.dec)
	return ret == 0
}
func (d *Decoder) EndUtt() bool {
	ret := pocketsphinx.EndUtt(d.dec)
	return ret == 0
}
func (d *Decoder) ProcessRaw(data []int16, noSearch, fullUtterance bool) (frames int32, ok bool) {
	frames = pocketsphinx.ProcessRaw(d.dec, data, uint(len(data)), b(noSearch), b(fullUtterance))
	if frames < 0 {
		return 0, false
	}
	return frames, true
}
func (d *Decoder) ProcessCep(data [][]float32, noSearch, fullUtterance bool) (frames int32, ok bool) {
	frames = pocketsphinx.ProcessCep(d.dec, data, int32(len(data)), b(noSearch), b(fullUtterance))
	if frames < 0 {
		return 0, false
	}
	return frames, true
}
func (d *Decoder) FramesSearched() int32 {
	return pocketsphinx.GetNFrames(d.dec)
}
func (d *Decoder) Hypothesis() (hyp string, score int32) {
	hyp = pocketsphinx.GetHyp(d.dec, &score)
	return
}
func (d *Decoder) Probability() int32 {
	return pocketsphinx.GetProb(d.dec)
}
func (d *Decoder) WordLattice() *Lattice {
	lat := pocketsphinx.GetLattice(d.dec)
	return &Lattice{
		lat: lat,
	}
}
func (d *Decoder) UttDuration() (speech, cpu, wall time.Duration) {
	var speechSeconds float64
	var cpuSeconds float64
	var wallSeconds float64
	pocketsphinx.GetUttTime(d.dec, &speechSeconds, &cpuSeconds, &wallSeconds)
	speech = time.Duration(speechSeconds * float64(time.Second))
	cpu = time.Duration(cpuSeconds * float64(time.Second))
	wall = time.Duration(wallSeconds * float64(time.Second))
	return
}
func (d *Decoder) AllDuration() (speech, cpu, wall time.Duration) {
	var speechSeconds float64
	var cpuSeconds float64
	var wallSeconds float64
	pocketsphinx.GetAllTime(d.dec, &speechSeconds, &cpuSeconds, &wallSeconds)
	speech = time.Duration(speechSeconds * float64(time.Second))
	cpu = time.Duration(cpuSeconds * float64(time.Second))
	wall = time.Duration(wallSeconds * float64(time.Second))
	return
}