// Set instrument information from file including MIDI base note, keyboard mapping and looping information (start/stop and mode).
// Return true if the file header contains instrument information for the file. false otherwise.
509147
func (f *File) SetInstrument(i *Instrument) bool {
	c := new(C.SF_INSTRUMENT)
	c.gain = C.int(i.Gain)
	c.basenote = C.char(i.Basenote)
	c.detune = C.char(i.Detune)
	c.velocity_lo = C.char(i.Velocity[0])
	c.velocity_hi = C.char(i.Velocity[1])
	c.key_lo = C.char(i.Key[0])
	c.key_hi = C.char(i.Key[1])
	c.loop_count = C.int(i.LoopCount)
	var index int
	for ; index < i.LoopCount; index++ {
		c.loops[index].mode = C.int(i.Loops[index].Mode)
		c.loops[index].start = C.uint32_t(i.Loops[index].Start)
		c.loops[index].end = C.uint32_t(i.Loops[index].End)
		c.loops[index].count = C.uint32_t(i.Loops[index].Count)
	}
	for ; index < 16; index++ {
		c.loops[index].mode = C.int(None)
		// why is this necessary? libsndfile doesn't check loopcount for AIFF
	}

	r := C.sf_command(f.s, C.SFC_SET_INSTRUMENT, unsafe.Pointer(c), C.int(unsafe.Sizeof(*c)))
	return (r == C.SF_TRUE)
}
673034
func (fds *FDSet) Set(fd uintptr) {
	fds.X__fds_bits[fd/NFDBITS] |= (1 << (fd % NFDBITS))
}
784732
func (ini *INI) Set(section, key, value string) {
	sec := ini.getSection(section)
	if sec == nil {
		sec = ini.addSection(section)
	} else {
		// The section name may be different.
		sec.Name = section
	}

	if key == "" {
		// Only add the newline if it is the first one.
		if n := len(sec.Data); n > 0 && sec.Data[n-1] != nil {
			sec.Data = append(sec.Data, nil)
		}
		return
	}

	if item := sec.getItem(key, ini.isCaseSensitive); item != nil {
		// The key does exist.
		item.Key = key
		item.Value = value
		return
	}
	// The key does not exist.
	sec.Data = append(sec.Data, &iniItem{Key: key, Value: value})
}
570972
func (context *BaseContext) SetString(key string, value string) {
	context.userData[key] = value
}
280965
func (f *File) SetString(in string, typ StringType) (err error) {
	s := C.CString(in)
	defer C.free(unsafe.Pointer(s))
	if C.sf_set_string(f.s, C.int(typ), s) != 0 {
		err = errors.New(C.GoString(C.sf_strerror(f.s)))
	}
	return
}
964140
func SetLevelFromString(s string) logger.Level {
	level, _ := ParseLevel(s)
	glogger.SetLevel(level)
	return level
}
599991
func (c *Certificates) Set(value string) error {
	certificates := strings.Split(value, ";")
	for _, certificate := range certificates {
		files := strings.Split(certificate, ",")
		if len(files) != 2 {
			return fmt.Errorf("bad certificates format: %s", value)
		}
		*c = append(*c, Certificate{
			CertFile: FileOrContent(files[0]),
			KeyFile:  FileOrContent(files[1]),
		})
	}
	return nil
}
1174717
func (s setMap) SetString(key string, value *string) {
	if value == nil {
		return
	}

	s[key] = *value
}
1217818
func (c *writeTroughCache) Set(key string, data []byte) error {
	err := c.memory.Set(key, data)
	if err != nil {
		return err
	}

	err = c.file.Set(key, data)
	if err != nil {
		return err
	}

	return nil
}
1202663
func Set(data []byte, setValue []byte, keys ...string) (value []byte, err error) {
	// ensure keys are set
	if len(keys) == 0 {
		return nil, KeyPathNotFoundError
	}

	_, _, startOffset, endOffset, err := internalGet(data, keys...)
	if err != nil {
		if err != KeyPathNotFoundError {
			// problem parsing the data
			return nil, err
		}
		// full path doesnt exist
		// does any subpath exist?
		var depth int
		for i := range keys {
			_, _, start, end, sErr := internalGet(data, keys[:i+1]...)
			if sErr != nil {
				break
			} else {
				endOffset = end
				startOffset = start
				depth++
			}
		}
		comma := true
		object := false
		if endOffset == -1 {
			firstToken := nextToken(data)
			// We can't set a top-level key if data isn't an object
			if len(data) == 0 || data[firstToken] != '{' {
				return nil, KeyPathNotFoundError
			}
			// Don't need a comma if the input is an empty object
			secondToken := firstToken + 1 + nextToken(data[firstToken+1:])
			if data[secondToken] == '}' {
				comma = false
			}
			// Set the top level key at the end (accounting for any trailing whitespace)
			// This assumes last token is valid like '}', could check and return error
			endOffset = lastToken(data)
		}
		depthOffset := endOffset
		if depth != 0 {
			// if subpath is a non-empty object, add to it
			if data[startOffset] == '{' && data[startOffset+1+nextToken(data[startOffset+1:])] != '}' {
				depthOffset--
				startOffset = depthOffset
				// otherwise, over-write it with a new object
			} else {
				comma = false
				object = true
			}
		} else {
			startOffset = depthOffset
		}
		value = append(data[:startOffset], append(createInsertComponent(keys[depth:], setValue, comma, object), data[depthOffset:]...)...)
	} else {
		// path currently exists
		startComponent := data[:startOffset]
		endComponent := data[endOffset:]

		value = make([]byte, len(startComponent)+len(endComponent)+len(setValue))
		newEndOffset := startOffset + len(setValue)
		copy(value[0:startOffset], startComponent)
		copy(value[startOffset:newEndOffset], setValue)
		copy(value[newEndOffset:], endComponent)
	}
	return value, nil
}
1306400
func (l *AllowedLevel) Set(s string) error {
	switch s {
	case "debug":
		l.o = level.AllowDebug()
	case "info":
		l.o = level.AllowInfo()
	case "warn":
		l.o = level.AllowWarn()
	case "error":
		l.o = level.AllowError()
	default:
		return errors.Errorf("unrecognized log level %q", s)
	}
	l.s = s
	return nil
}
314862
func (section *Section) SetString(name string, value string) {
	current, err := section.Get(name)

	// Exists just update the value/type
	if err == nil {
		current.UpdateValue(value)
	} else {
		section.Set(name, NewString(value))
	}
}
102440
func (bsh *BufferedServerHeader) Set(key string, value string) {
	if bsh.released {
		bsh.original.Set(key, value)
	} else {
		bsh.headerMap[key] = []string{value}
	}
}
440974
func (r *Registry) Instruments() map[string]interface{} {
	r.m.RLock()
	defer r.m.RUnlock()
	instruments := r.instruments
	return instruments
}
957435
func (me *TxsdSequencingDirectivesTypeAllSampleDemuxDirective) Set(s string) {
	(*xsdt.String)(me).Set(s)
}
107468
func (fi *FileInfo) init() {
	fi.lazyInit.Do(func() {
		relDir := strings.Trim(fi.relDir, helpers.FilePathSeparator)
		parts := strings.Split(relDir, helpers.FilePathSeparator)
		var section string
		if (!fi.isLeafBundle && len(parts) == 1) || len(parts) > 1 {
			section = parts[0]
		}
		fi.section = section

		if fi.isLeafBundle && len(parts) > 0 {
			fi.contentBaseName = parts[len(parts)-1]
		} else {
			fi.contentBaseName = fi.translationBaseName
		}

		fi.uniqueID = helpers.MD5String(filepath.ToSlash(fi.relPath))
	})
}
457398
func (f *Strings) Set(i string) error {
	*f = append(*f, i)
	return nil
}