// New is called when the AudioSystem is added to the world.
352768
func (a *AudioSystem) New(w *ecs.World) {
	var err error
	switch engo.CurrentBackEnd {
	case engo.BackEndMobile:
		a.bufsize = 12288
	default:
		a.bufsize = 8192
	}
	if engo.Headless() {
		otoPlayer = &stepPlayer{
			stepStart: make(chan []byte),
			stepDone:  make(chan struct{}, 1),
		}
	} else {
		if otoPlayer == nil {
			otoPlayer, err = oto.NewPlayer(SampleRate, channelNum, bytesPerSample, a.bufsize)
			if err != nil {
				log.Printf("audio error. Unable to create new OtoPlayer: %v \n\r", err)
			}
		} else {
			closeCh <- struct{}{}
			<-loopClosedCh
		}
	}
	// run oto on a separate thread so it doesn't slow down updates
	closeCh = make(chan struct{}, 1)
	a.pauseCh = make(chan struct{}, 1)
	a.restartCh = make(chan struct{}, 1)
	a.playerCh = make(chan []*Player, 25)
	loopClosedCh = make(chan struct{})
	go func() {
		players := make([]*Player, 0)
	loop:
		for {
			select {
			case <-closeCh:
				break loop
			case <-a.pauseCh:
				<-a.restartCh
			case players = <-a.playerCh:
			default:
				buf := make([]byte, 2048)
				a.read(buf, players)

				if _, err := otoPlayer.Write(buf); err != nil {
					log.Printf("error copying to OtoPlayer: %v \r\n", err)
				}
			}
		}
		loopClosedCh <- struct{}{}
	}()
	masterVolume = 1
}
1144155
func (api *AutoBackupAPI) New(name string, diskID int64) *sacloud.AutoBackup {
	return sacloud.CreateNewAutoBackup(name, diskID)
}
848296
func New(major, minor, patch int, prmds ...string) Version {
	if major < 0 {
		major = 0
	}
	if minor < 0 {
		minor = 0
	}
	if patch < 0 {
		patch = 0
	}
	v := &vsn{
		major: major,
		minor: minor,
		patch: patch,
	}
	isPR := true
	for _, prmd := range prmds {
		if isPR {
			if prmd == Metadata {
				isPR = false
				continue
			}
			v.preRelease = append(v.preRelease, validID(prmd, true))
		} else {
			v.metadata = append(v.metadata, validID(prmd, false))
		}
	}
	return v
}
1077026
func New(requests chan *choria.ConnectorMessage, fw *choria.Framework, conn choria.ConnectorInfo, srv ServerInfoSource, log *logrus.Entry) *Manager {
	return &Manager{
		agents:     make(map[string]Agent),
		subs:       make(map[string][]string),
		fw:         fw,
		log:        log.WithFields(logrus.Fields{"subsystem": "agents"}),
		mu:         &sync.Mutex{},
		requests:   requests,
		conn:       conn,
		serverInfo: srv,
	}
}
220298
func New(s []string) Env {
	e := Env{
		CaseInsensitive: SystemIsCaseInsensitive(),
	}
	e.LoadSlice(s)
	return e
}
434705
func New(c commands.ZWaveCommand, class byte, data []byte) (Report, error) {
	switch c {
	case commands.Alarm:
		switch class {
		case 0x05: // Report
			return NewAlarm(data)
		}
	case commands.ManufacturerSpecific:
		switch class {
		case 0x05: // Report
			return NewManufacturerSpecific(data)
		}
	case commands.MultiInstance:
		switch class {
		case 0x08: // MultiChannelCmd_EndPointReport
			return NewMultiChannelEndpoints(data)
		}
	case commands.SensorMultiLevel:
		switch class {
		case 0x05: // Report
			return NewSensorMultiLevel(data)
		}
	case commands.SwitchBinary:
		switch class {
		case 0x03: // Report
			switch len(data) {
			case 1:
				return NewSwitchBinaryV1(data)
			case 3:
				return NewSwitchBinaryV2(data)
			}
		}
	case commands.SwitchMultilevel:
		switch class {
		case 0x03: // Report
			switch len(data) {
			case 1:
				return NewSwitchMultilevelV1(data)
			// V2 reports is same as V1
			// V3 reports is depreciated and is not recomended to implement by sigma designs
			case 3:
				return NewSwitchMultilevelV4(data)
			}
		}
	case commands.WakeUp:
		return NewWakeUp()
	}

	return nil, fmt.Errorf("Unknown command (%x - %s) / command class (%x)", byte(c), c, class)
}
417885
func New(apiKey string, system SystemType) *Client {
	return &Client{
		Key: apiKey,
		Url: system.Url(),
	}
}
1264543
func New(text string) error {
	if AddStack {
		text += "\n" + string(debug.Stack())
	}
	return &errorString{text}
}
191485
func New(constructorsAndValues ...interface{}) *Psyringe {
	p := newPsyringe()
	if err := p.addErr(constructorsAndValues...); err != nil {
		panic(err)
	}
	return p
}
1023776
func New() Release {
	now := time.Now()

	return Release{
		Year:  now.Year(),
		Month: int(now.Month()),
	}
}
43107
func (factory *HorizonBoxBeeFactory) New(name, description string, options bees.BeeOptions) bees.BeeInterface {
	bee := HorizonBoxBee{
		Bee: bees.NewBee(name, factory.ID(), description, options),
	}
	bee.ReloadOptions(options)

	return &bee
}
1040247
func (factory *GitterBeeFactory) New(name, description string, options bees.BeeOptions) bees.BeeInterface {
	bee := GitterBee{
		Bee: bees.NewBee(name, factory.ID(), description, options),
	}
	bee.ReloadOptions(options)

	return &bee
}
841001
func New(files Files) (vfs.FileSystem, error) {
	fs := make(MapFS)

	for path, file := range files {
		if err := fs.addFile(path, file); err != nil {
			return nil, err
		}
	}

	return fs, nil
}
1175107
func (l *Logger) New(ctx *gear.Context) (interface{}, error) {
	log := Log{}
	l.init(log, ctx)
	return log, nil
}
903141
func (factory *JabberBeeFactory) New(name, description string, options bees.BeeOptions) bees.BeeInterface {
	bee := JabberBee{
		Bee: bees.NewBee(name, factory.ID(), description, options),
	}
	bee.ReloadOptions(options)

	return &bee
}
384622
func (factory *RSSBeeFactory) New(name, description string, options bees.BeeOptions) bees.BeeInterface {
	bee := RSSBee{
		Bee: bees.NewBee(name, factory.ID(), description, options),
	}
	bee.ReloadOptions(options)

	return &bee
}
194089
func (factory *SlackBeeFactory) New(name, description string, options bees.BeeOptions) bees.BeeInterface {
	bee := SlackBee{
		Bee: bees.NewBee(name, factory.ID(), description, options),
	}
	bee.ReloadOptions(options)

	return &bee
}