// RumblePlay runs a simple rumble effect on a haptic device.
// (https://wiki.libsdl.org/SDL_HapticRumblePlay)
493454
func (h *Haptic) RumblePlay(strength float32, length uint32) error {
	return errorFromInt(int(
		C.SDL_HapticRumblePlay(h.cptr(), C.float(strength), C.Uint32(length))))
}
15129
func (cs *ConsensusState) catchupReplay(csHeight int64) error {

	// Set replayMode to true so we don't log signing errors.
	cs.replayMode = true
	defer func() { cs.replayMode = false }()

	// Ensure that #ENDHEIGHT for this height doesn't exist.
	// NOTE: This is just a sanity check. As far as we know things work fine
	// without it, and Handshake could reuse ConsensusState if it weren't for
	// this check (since we can crash after writing #ENDHEIGHT).
	//
	// Ignore data corruption errors since this is a sanity check.
	gr, found, err := cs.wal.SearchForEndHeight(csHeight, &WALSearchOptions{IgnoreDataCorruptionErrors: true})
	if err != nil {
		return err
	}
	if gr != nil {
		if err := gr.Close(); err != nil {
			return err
		}
	}
	if found {
		return fmt.Errorf("WAL should not contain #ENDHEIGHT %d", csHeight)
	}

	// Search for last height marker.
	//
	// Ignore data corruption errors in previous heights because we only care about last height
	gr, found, err = cs.wal.SearchForEndHeight(csHeight-1, &WALSearchOptions{IgnoreDataCorruptionErrors: true})
	if err == io.EOF {
		cs.Logger.Error("Replay: wal.group.Search returned EOF", "#ENDHEIGHT", csHeight-1)
	} else if err != nil {
		return err
	}
	if !found {
		return fmt.Errorf("Cannot replay height %d. WAL does not contain #ENDHEIGHT for %d", csHeight, csHeight-1)
	}
	defer gr.Close() // nolint: errcheck

	cs.Logger.Info("Catchup by replaying consensus messages", "height", csHeight)

	var msg *TimedWALMessage
	dec := WALDecoder{gr}

	for {
		msg, err = dec.Decode()
		if err == io.EOF {
			break
		} else if IsDataCorruptionError(err) {
			cs.Logger.Error("data has been corrupted in last height of consensus WAL", "err", err, "height", csHeight)
			return err
		} else if err != nil {
			return err
		}

		// NOTE: since the priv key is set when the msgs are received
		// it will attempt to eg double sign but we can just ignore it
		// since the votes will be replayed and we'll get to the next step
		if err := cs.readReplayMessage(msg, nil); err != nil {
			return err
		}
	}
	cs.Logger.Info("Replay: Done")
	return nil
}
1195258
func (d *domainClient) ReplaySnapshot(ctx context.Context, args *ReplaySnapshotArgs) (reply *ReplaySnapshotReply, err error) {
	reply = new(ReplaySnapshotReply)
	if args != nil {
		err = rpcc.Invoke(ctx, "LayerTree.replaySnapshot", args, reply, d.conn)
	} else {
		err = rpcc.Invoke(ctx, "LayerTree.replaySnapshot", nil, reply, d.conn)
	}
	if err != nil {
		err = &internal.OpError{Domain: "LayerTree", Op: "ReplaySnapshot", Err: err}
	}
	return
}
116862
func (h *Haptic) StopEffect(effect int) error {
	return errorFromInt(int(
		C.SDL_HapticStopEffect(h.cptr(), C.int(effect))))
}
86288
func (s *CreateJobPlaylist) SetPlayReadyDrm(v *PlayReadyDrm) *CreateJobPlaylist {
	s.PlayReadyDrm = v
	return s
}
486625
func (s *Stream) Play() error {
	s.l.Lock()
	defer s.l.Unlock()

	switch s.state {
	case StatePaused:
		s.state = StatePlaying
		go s.process()
		return nil
	case StatePlaying:
		return errors.New("gumbleffmpeg: stream already playing")
	case StateStopped:
		return errors.New("gumbleffmpeg: stream has stopped")
	}

	// fresh stream
	if s.Source == nil {
		return errors.New("gumbleffmpeg: nil source")
	}

	args := s.Source.arguments()
	if s.Offset > 0 {
		args = append([]string{"-ss", strconv.FormatFloat(s.Offset.Seconds(), 'f', -1, 64)}, args...)
	}
	args = append(args, "-ac", strconv.Itoa(gumble.AudioChannels), "-ar", strconv.Itoa(gumble.AudioSampleRate), "-f", "s16le", "-")
	cmd := exec.Command(s.Command, args...)
	var err error
	s.pipe, err = cmd.StdoutPipe()
	if err != nil {
		return err
	}
	if err := s.Source.start(cmd); err != nil {
		return err
	}
	if err := cmd.Start(); err != nil {
		s.Source.done()
		return err
	}
	s.wg.Add(1)
	s.cmd = cmd
	s.state = StatePlaying
	go s.process()
	return nil
}
364081
func (h *Haptic) UpdateEffect(effect int, data HapticEffect) error {
	return errorFromInt(int(
		C.SDL_HapticUpdateEffect(
			h.cptr(),
			C.int(effect),
			data.cHapticEffect())))
}
1163619
func (c *Client) PlaylistMove(name string, id, pos int) error {
	return c.Command("playlistmove %s %d %d", name, id, pos).OK()
}
262206
func HapticOpen(index int) (*Haptic, error) {
	haptic := (*Haptic)(unsafe.Pointer(C.SDL_HapticOpen(C.int(index))))
	if haptic == nil {
		return nil, GetError()
	}
	return haptic, nil
}
559441
func Playing(listener func(*vecty.Event)) *vecty.EventListener {
	return &vecty.EventListener{Name: "playing", Listener: listener}
}
1272255
func NewReplayXHRArgs(requestID RequestID) *ReplayXHRArgs {
	args := new(ReplayXHRArgs)
	args.RequestID = requestID
	return args
}
134233
func (h *Haptic) RumbleSupported() (bool, error) {
	ret := int(C.SDL_HapticRumbleSupported(h.cptr()))
	return ret == C.SDL_TRUE, errorFromInt(ret)
}
1119195
func (sprite *sprite) AddTouchListener(listener peer.TouchListener) {
	simlog.FuncIn()
	sprite.Sprite.AddTouchListener(listener)
	simlog.FuncOut()
}
1249020
func (cl *CommandList) PlaylistLoad(name string, start, end int) {
	if start < 0 || end < 0 {
		cl.cmdQ.PushBack(&command{fmt.Sprintf("load %s", quote(name)), nil, cmdNoReturn})
	} else {
		cl.cmdQ.PushBack(&command{fmt.Sprintf("load %s %d:%d", quote(name), start, end), nil, cmdNoReturn})
	}
}
1338873
func LoadedPlayer(url string) (*Player, error) {
	res, err := engo.Files.Resource(url)
	if err != nil {
		return nil, err
	}

	audioRes, ok := res.(*Player)
	if !ok {
		return nil, fmt.Errorf("resource not of type `*Player`: %s", url)
	}

	return audioRes, nil
}
628342
func (h *Handshaker) replayBlock(state sm.State, height int64, proxyApp proxy.AppConnConsensus) (sm.State, error) {
	block := h.store.LoadBlock(height)
	meta := h.store.LoadBlockMeta(height)

	blockExec := sm.NewBlockExecutor(h.stateDB, h.logger, proxyApp, sm.MockMempool{}, sm.MockEvidencePool{})
	blockExec.SetEventBus(h.eventBus)

	var err error
	state, err = blockExec.ApplyBlock(state, meta.BlockID, block)
	if err != nil {
		return sm.State{}, err
	}

	h.nBlocks++

	return state, nil
}
1178283
func (h *Haptic) DestroyEffect(effect int) {
	C.SDL_HapticDestroyEffect(h.cptr(), C.int(effect))
}