public Character( StatExpressionsInfo statExpressions, CharacterPlanetPawn pawn, IInputSource inputSource, CharacterStatus status, CharacterStateController stateController, CharacterStateController weaponStateController, int teamId, CharacterInfo info ) { this.statExpressions = statExpressions; this.status = status; this.health = new IntReactiveProperty( this.status.maxHealth.Value ); this.pawn = pawn; this.inputSource = inputSource; this.stateController = stateController; this.weaponStateController = weaponStateController; this.teamId = teamId; this.info = info; this.inventory = new BasicInventory( this ); pawn.SetCharacter( this ); this.stateController.Initialize( this ); this.weaponStateController.Initialize( this ); var inputSourceDisposable = inputSource as IDisposable; if ( inputSourceDisposable != null ) { _compositeDisposable.Add( inputSourceDisposable ); } Observable.EveryUpdate().Subscribe( OnUpdate ).AddTo( _compositeDisposable ); status.moveSpeed.Subscribe( UpdatePawnSpeed ).AddTo( _compositeDisposable ); health.Subscribe( OnHealthChange );//.AddTo( _compositeDisposable ); instances.Add( this ); }
public string Connect(Dictionary<string, string> requestParams, IInputSource inputSource, string endpoint) { requestParams.Add(inputSource.Key, inputSource.Value); return MakeHttpRequest(requestParams, endpoint); }
public AddToTextIndexResponse.Value Execute(IInputSource inputSource, IdolConnect ic) { var apiResults = ic.Connect(ToParameterDictionary(), inputSource, SyncEndpoint); var deseriaizedResponse = JsonConvert.DeserializeObject<AddToTextIndexResponse.Value>(apiResults); if (deseriaizedResponse.message == null & deseriaizedResponse.error == 0) { return deseriaizedResponse; } else { if (deseriaizedResponse.message != null) { throw new APIFailedException(deseriaizedResponse.message); } else { if (deseriaizedResponse.detail.Count == 1) { throw new InvalidJobArgumentsException(deseriaizedResponse.detail[0]); } else { throw new InvalidJobArgumentsException(deseriaizedResponse.actions[0].errors[0].reason); } } } }
public RecordingInputSourceDecorator(IInputSource source, String filePath, IPersistenceManager persistenceManager, Int32 buttonCount) { _frame = 0; _source = source; _filePath = filePath; _persistenceManager = persistenceManager; _previousState = new InputState(); _data = new ReplayData(); _buttonCount = buttonCount; }
public void Dispose() { lock (_syncObj) if (_nextInputSource != null) { _nextInputSource.Dispose(); _nextInputSource = null; } PlaybackSession playbackSession = _playbackSession; if (playbackSession != null) playbackSession.Dispose(); }
/// <summary> /// Once the objects are instanciated, awake is called before start. Use it /// to setup references to other objects /// </summary> protected virtual void Awake() { // Grab the actor controller so we can set it's values later mActorController = gameObject.GetComponent<ActorController>(); // Object that will provide access to the keyboard, mouse, etc if (InputSourceOwner != null) { mInputSource = InterfaceHelper.GetComponent<IInputSource>(InputSourceOwner); } // Default speed we'll use to rotate. To help smooth out the rotation, // We make it consistant even in low frame rates, by set the standard to be a // rotation if we're running at 60 frames per second. mDegreesPer60FPSTick = RotationSpeed / 60f; }
/// <summary> /// Stops dragging the object. /// </summary> public void StopDragging() { if (!isDragging) { return; } // Remove self as a modal input handler InputManager.Instance.PopModalInputHandler(); isDragging = false; currentInputSource = null; StoppedDragging.RaiseEvent(); }
/// <summary> /// Finds a layout matching the given gamepad /// </summary> /// <param name="source">The source that the <paramref name="device"/> came from</param> /// <param name="device">The device to find a layout for</param> /// <returns>The gamepad layout that was found, or null if none was found</returns> public static GamePadLayout FindLayout(IInputSource source, IGameControllerDevice device) { lock (layouts) { foreach (var layout in layouts) { if (layout.MatchDevice(source, device)) { return(layout); } } return(null); } }
private static IDisposable ConnectRightUp(IInputSource source, IInputTarget target) { //var observer = new InputArgsObserver(target, OnNextRightUp); //return source.RightUp.SubscribeSafe(observer); return(source.RightUp.Subscribe(OnNextRightUp)); void OnNextRightUp(InputArgs args) { if (target.IsRightUpAvailable()) { target.RightUp(args); } } }
private static IDisposable ConnectLeftDown(IInputSource source, IInputTarget target) { //var observer = new InputArgsObserver(target, OnNextLeftDown); //return source.LeftDown.SubscribeSafe(observer); return(source.LeftDown.Subscribe(OnNextLeftDown)); void OnNextLeftDown(InputArgs args) { if (target.IsLeftDownAvailable()) { target.LeftDown(args); } } }
private static IDisposable ConnectMove(IInputSource source, IInputTarget target) { //var observer = new InputArgsObserver(target, OnNextMove); //return source.Move.SubscribeSafe(observer); return(source.Move.Subscribe(OnNextMove)); void OnNextMove(InputArgs args) { if (target.IsMoveAvailable()) { target.Move(args); } } }
/// <summary> /// Creates and initializes a new instance. /// </summary> /// <param name="controller">Reference to controller object.</param> public static PlaybackSession Create(Controller controller) { IInputSource inputSource = controller.PlaybackProcessor.GetAndClearNextInputSource(); if (inputSource == null) { return(null); } BassStream stream = inputSource.OutputStream; PlaybackSession playbackSession = new PlaybackSession(controller, stream.Channels, stream.SampleRate, stream.IsPassThrough); playbackSession.Initialize(inputSource); return(playbackSession); }
/// <inheritdoc /> public bool AddInput(IInputSource input) { if (input == null) { return(false); } if (inputs.Contains(input)) { return(true); } inputs.Add(input); inputCount++; return(true); }
/// <inheritdoc /> public bool RemoveInput(IInputSource input) { if (input == null) { return(false); } var result = inputs.Remove(input); if (result) { inputCount--; } return(result); }
/// <summary> /// Use this for initialization /// </summary> protected override void Awake() { base.Awake(); if (_Anchor != null && this.enabled) { ICharacterController lController = InterfaceHelper.GetComponent <ICharacterController>(_Anchor.gameObject); if (lController == null) { IBaseCameraAnchor lAnchor = _Anchor.GetComponent <IBaseCameraAnchor>(); if (lAnchor != null) { IsInternalUpdateEnabled = false; IsFixedUpdateEnabled = false; lAnchor.OnAnchorPostLateUpdate += OnControllerLateUpdate; } else { IsInternalUpdateEnabled = true; } } else { IsInternalUpdateEnabled = false; IsFixedUpdateEnabled = false; lController.OnControllerPostLateUpdate += OnControllerLateUpdate; } mTilt = QuaternionExt.FromToRotation(_Transform.up, _Anchor.up); mToCameraDirection = _Transform.position - _Anchor.position; mToCameraDirection.y = 0f; mToCameraDirection.Normalize(); if (mToCameraDirection.sqrMagnitude == 0f) { mToCameraDirection = -_Anchor.forward; } } // Object that will provide access to the keyboard, mouse, etc if (_InputSourceOwner != null) { mInputSource = InterfaceHelper.GetComponent <IInputSource>(_InputSourceOwner); } // Default the speed we'll use to rotate mDegreesPer60FPSTick = _RotationSpeed / 60f; }
public void Initialize(IInputSource inputSource, uint sourceId, XboxControllerData inputData, object tag = null) { BaseInitialize(inputSource, sourceId, tag); GamePadName = inputData.GamePadName; XboxLeftStickHorizontalAxis = inputData.XboxLeftStickHorizontalAxis; XboxLeftStickVerticalAxis = inputData.XboxLeftStickVerticalAxis; XboxRightStickHorizontalAxis = inputData.XboxRightStickHorizontalAxis; XboxRightStickVerticalAxis = inputData.XboxRightStickVerticalAxis; XboxDpadHorizontalAxis = inputData.XboxDpadHorizontalAxis; XboxDpadVerticalAxis = inputData.XboxDpadVerticalAxis; XboxLeftTriggerAxis = inputData.XboxLeftTriggerAxis; XboxRightTriggerAxis = inputData.XboxRightTriggerAxis; XboxSharedTriggerAxis = inputData.XboxSharedTriggerAxis; XboxA_Down = inputData.XboxA_Down; XboxB_Down = inputData.XboxB_Down; XboxX_Down = inputData.XboxX_Down; XboxY_Down = inputData.XboxY_Down; XboxLeftBumper_Down = inputData.XboxLeftBumper_Down; XboxRightBumper_Down = inputData.XboxRightBumper_Down; XboxLeftStick_Down = inputData.XboxLeftStick_Down; XboxRightStick_Down = inputData.XboxRightStick_Down; XboxView_Down = inputData.XboxView_Down; XboxMenu_Down = inputData.XboxMenu_Down; XboxA_Pressed = inputData.XboxA_Pressed; XboxB_Pressed = inputData.XboxB_Pressed; XboxX_Pressed = inputData.XboxX_Pressed; XboxY_Pressed = inputData.XboxY_Pressed; XboxLeftBumper_Pressed = inputData.XboxLeftBumper_Pressed; XboxRightBumper_Pressed = inputData.XboxRightBumper_Pressed; XboxLeftStick_Pressed = inputData.XboxLeftStick_Pressed; XboxRightStick_Pressed = inputData.XboxRightStick_Pressed; XboxView_Pressed = inputData.XboxView_Pressed; XboxMenu_Pressed = inputData.XboxMenu_Pressed; XboxA_Up = inputData.XboxA_Up; XboxB_Up = inputData.XboxB_Up; XboxX_Up = inputData.XboxX_Up; XboxY_Up = inputData.XboxY_Up; XboxLeftBumper_Up = inputData.XboxLeftBumper_Up; XboxRightBumper_Up = inputData.XboxRightBumper_Up; XboxLeftStick_Up = inputData.XboxLeftStick_Up; XboxRightStick_Up = inputData.XboxRightStick_Up; XboxView_Up = inputData.XboxView_Up; XboxMenu_Up = inputData.XboxMenu_Up; }
/// <summary> /// Awake is called after all objects are initialized so you can safely speak to /// other objects. This is where reference can be associated. /// </summary> protected void Awake() { // Simply stop if one of the GameCores is already initialized if (GameCore.Core != null) { Destroy(gameObject); return; } // The GameCore will be active for all scenes as it sits above them DontDestroyOnLoad(gameObject); // Only store the first one if (GameCore.Core == null) { GameCore.Core = this; } // Object that will provide access to the keyboard, mouse, etc if (_InputSourceOwner != null) { _InputSource = InterfaceHelper.GetComponent <IInputSource>(_InputSourceOwner); } // If the input source is still null, see if we can grab a local input source if (_InputSource == null) { _InputSource = InterfaceHelper.GetComponent <IInputSource>(gameObject); } // If that's still null, see if we can grab one from the scene. This may happen // if the MC was instanciated from a prefab which doesn't hold a reference to the input source if (_AutoFindInputSource && _InputSource == null) { IInputSource[] lInputSources = InterfaceHelper.GetComponents <IInputSource>(); for (int i = 0; i < lInputSources.Length; i++) { GameObject lInputSourceOwner = ((MonoBehaviour)lInputSources[i]).gameObject; if (lInputSourceOwner.activeSelf && lInputSources[i].IsEnabled) { _InputSource = lInputSources[i]; _InputSourceOwner = lInputSourceOwner; } } } // Initialize any states IsCursorVisible = _IsCursorVisible; }
/// <summary> /// Stops dragging the object. /// </summary> public void StopDragging() { this.GetComponentInParent <Rigidbody>().useGravity = true; if (!isDragging) { return; } // Remove self as a modal input handler InputManager.Instance.PopModalInputHandler(); isDragging = false; currentInputSource = null; StoppedDragging.RaiseEvent(); }
/// <summary>Get an axis input value</summary> /// <param name="value">The input value, if any; Otherwise, the type's default value.</param> /// <returns>True if the input has a value; otherwise, false.</returns> protected override bool TryGetInputValue(IInputSource source, out float value) { float inputValue; if (source.TryGetAnalogInput(this.InputName, out inputValue)) { value = this.modifier(inputValue); return(true); } else { value = 0f; return(false); } }
/// <summary> /// Releases the game object back to the pool (if allocated) or simply destroys if it not. /// </summary> public override void Release() { base.Release(); if (mSelectedTarget != null) { RemoveMaterial(mSelectedTarget.gameObject, mMaterialInstance); } OnSelectedEvent = null; mOwner = null; mInputSource = null; mSelectedTarget = null; }
/// <summary> /// Get a reference to the Input Source already in the scene, or create a new one if needed /// </summary> /// <param name="rViewActivatorOption"></param> /// <returns></returns> public static GameObject GetOrCreateInputSource(int rViewActivatorOption) { // Find or create the input source; will use Easy Input if it is installed GameObject lInputSourceGO = null; IInputSource lInputSource = InputSetupHelper.CreateInputSource("com.ootii.Input.EasyInputSource, " + AssemblyHelper.AssemblyInfo, ref lInputSourceGO); if (lInputSource == null) { lInputSource = InputSetupHelper.CreateInputSource <UnityInputSource>(ref lInputSourceGO); } ReflectionHelper.SetProperty(lInputSource, "ViewActivator", rViewActivatorOption); return(lInputSourceGO); }
public void RaiseSourceUp(IInputSource source, uint sourceId) { // Create input event inputEventData.Initialize(source, sourceId); // Pass handler through HandleEvent to perform modal/fallback logic HandleEvent(inputEventData, OnSourceUpEventHandler); // UI events if (ShouldSendUnityUiEvents) { PointerEventData unityUIPointerEvent = GazeManager.Instance.UnityUIPointerEvent; HandleEvent(unityUIPointerEvent, ExecuteEvents.pointerUpHandler); } }
/// <summary> /// オブジェクトのドラッグを止める /// </summary> public void StopDragging() { if (!isDragging) { return; } // モーダル入力対象から自身を削除する InputManager.Instance.PopModalInputHandler(); isDragging = false; currentInputSource = null; currentInputSourceId = 0; StoppedDragging.RaiseEvent(); }
/// <summary> /// Removes and tops tracking input from an input source. /// </summary> public static void RemoveInputSource(IInputSource source) { if (_sources.Remove(source)) { // Remove Events source.CharacterTyped -= OnCharacterTyped; source.KeyPressed -= OnKeyPressed; source.KeyReleased -= OnKeyReleased; source.KeyRepeat -= OnKeyRepeat; source.MousePressed -= OnMousePressed; source.MouseReleased -= OnMouseReleased; source.MouseScrolled -= OnMouseScrolled; source.MouseMoved -= OnMouseMoved; } }
/// <summary> /// Adds and begins tracking input from an input source. /// </summary> public static void AddInputSource(IInputSource source) { if (_sources.Add(source)) { // Register Events source.CharacterTyped += OnCharacterTyped; source.KeyPressed += OnKeyPressed; source.KeyReleased += OnKeyReleased; source.KeyRepeat += OnKeyRepeat; source.MousePressed += OnMousePressed; source.MouseReleased += OnMouseReleased; source.MouseScrolled += OnMouseScrolled; source.MouseMoved += OnMouseMoved; } }
public void OnSourceLost(SourceStateEventData eventData) { if (currentInputSource != null && eventData.SourceId == currentInputSourceId) { Debug.Log("sourceLost"); isRotating = false; // Remove self as a modal input handler InputManager.Instance.PopModalInputHandler(); mainCursor.OnInputUp(inputEventData); inputEventData = null; currentInputSource = null; } }
public void RaiseInputClicked(IInputSource source, uint sourceId, int tapCount) { // Create input event sourceClickedEventData.Initialize(source, sourceId, tapCount); // Pass handler through HandleEvent to perform modal/fallback logic HandleEvent(sourceClickedEventData, OnInputClickedEventHandler); // UI events if (ShouldSendUnityUiEvents) { PointerEventData unityUIPointerEvent = GazeManager.Instance.UnityUIPointerEvent; HandleEvent(unityUIPointerEvent, ExecuteEvents.pointerClickHandler); } }
public void StopDragging() { if (!isDragging) { return; } InputManager.Instance.PopModalInputHandler(); isDragging = false; currentInputSource = null; rend.material.color = defaultColor; gizmoSetting.IsDraggingMover = false; StoppedDragging.RaiseEvent(); }
public void OnInputDown(InputEventData eventData) { if (isDragging) { return; } if (!eventData.InputSource.SupportsInputInfo(eventData.SourceId, SupportedInputInfo.Position)) { return; } currentInputSource = eventData.InputSource; currentInputSourceId = eventData.SourceId; StartDragging(); }
public void Dispose() { lock (_syncObj) if (_nextInputSource != null) { _nextInputSource.Dispose(); _nextInputSource = null; } PlaybackSession playbackSession = _playbackSession; if (playbackSession != null) { playbackSession.Dispose(); } }
/// <summary> /// Stops dragging the object. /// </summary> public void StopDragging() { if (!isDragging) { return; } // Remove self as a modal input handler //InputManager.Instance.PopModalInputHandler(); InputManager.Instance.RemoveMultiModalInputHandler(currentInputSourceId); isDragging = false; currentInputSource = null; RepositionManager.Instance.SetItemMode(gameObject, ItemStatusModes.IDLE); }
/// <summary> /// Once the objects are instanciated, awake is called before start. Use it /// to setup references to other objects /// </summary> protected virtual void Awake() { // Grab the actor controller so we can set it's values later mActorController = gameObject.GetComponent <ActorController>(); // Object that will provide access to the keyboard, mouse, etc if (InputSourceOwner != null) { mInputSource = InterfaceHelper.GetComponent <IInputSource>(InputSourceOwner); } // Default speed we'll use to rotate. To help smooth out the rotation, // We make it consistant even in low frame rates, by set the standard to be a // rotation if we're running at 60 frames per second. mDegreesPer60FPSTick = RotationSpeed / 60f; }
void StopScaling() { if (!isScaling) { return; } // Remove self as a model input handler InputManager.Instance.PopModalInputHandler(); isScaling = false; currentInputSource = null; currentInputSourceId = 0; StoppedScaling.RaiseEvent(); }
/// <summary>Checks the raw input and gets the mapped input event (if any)</summary> /// <param name="source">The input source to be checked.</param> /// <param name="value">The input value, if any. Otherwise, the default for the type.</param> /// <returns>The current InputPhase, if the input has a value; otherwise, InputPhase.Unknown.</returns> public InputPhase CheckInput(IInputSource source, out TValue value) { if (!this.TryGetInputValue(source, out value)) { return(InputPhase.Unknown); } this.active = !value.Equals(default(TValue)); var phase = !this.WasActive && this.active ? InputPhase.Begin : this.WasActive && this.active ? InputPhase.Continue : this.WasActive && !this.active ? InputPhase.End : InputPhase.Unknown; this.LastValue = value; return(phase); }
public TimeSpan GetDuration() { PlaybackSession session = _playbackProcessor.PlaybackSession; if (session == null) { return(TimeSpan.Zero); } IInputSource source = session.CurrentInputSource; if (source == null) { return(TimeSpan.Zero); } return(source.Length); }
public void OnInputUp(InputEventData eventData) { if (currentInputSource != null && eventData.SourceId == currentInputSourceId) { if (RepositionManager.Instance.GetWallStatusMode(instanceId) == WallStatusModes.DRAGGING) { // Remove self as a modal input handler InputManager.Instance.RemoveMultiModalInputHandler(currentInputSourceId); RepositionManager.Instance.SetWallMode(gameObject, WallStatusModes.LOCKED); currentInputSource = null; currentInputSourceId = 0; } } lastInputUpTime = Time.unscaledTime; }
/// <summary> /// Initializes a new instance of the <see cref="InputProcessor"/> class. /// </summary> /// <param name="source">The input source.</param> /// <param name="target">The input target.</param> public InputProcessor(IInputSource source, IInputTarget target) { _leftDownDisposable = source.LeftDown.Subscribe( (v) => { if (target.IsLeftDownAvailable()) { target.LeftDown(v.X, v.Y); } }); _leftUpDisposable = source.LeftUp.Subscribe( (v) => { if (target.IsLeftUpAvailable()) { target.LeftUp(v.X, v.Y); } }); _rightDownDisposable = source.RightDown.Subscribe( (v) => { if (target.IsRightDownAvailable()) { target.RightDown(v.X, v.Y); } }); _rightUpDisposable = source.RightUp.Subscribe( (v) => { if (target.IsRightUpAvailable()) { target.RightUp(v.X, v.Y); } }); _moveDisposable = source.Move.Subscribe( (v) => { if (target.IsMoveAvailable()) { target.Move(v.X, v.Y); } }); }
public void ClearNextInputSource() { lock (_syncObj) _nextInputSource = null; }
public void Initialize(IInputSource inputSource, uint sourceId, Vector3 cumulativeDelta) { BaseInitialize(inputSource, sourceId); CumulativeDelta = cumulativeDelta; }
public IInputSource GetAndClearNextInputSource() { lock (_syncObj) { IInputSource result = _nextInputSource; _nextInputSource = null; return result; } }
public HoldEventArgs(IInputSource inputSource, uint sourceId) : base(inputSource, sourceId) { }
/// <summary> /// Callback function for the outputstream. /// </summary> /// <param name="streamHandle">Bass stream handle that requests sample data.</param> /// <param name="buffer">Buffer to write the sampledata to.</param> /// <param name="requestedBytes">Requested number of bytes.</param> /// <param name="userData"></param> /// <returns>Number of bytes read.</returns> private int OutputStreamWriteProc(int streamHandle, IntPtr buffer, int requestedBytes, IntPtr userData) { IInputSource inputSource; lock (_syncObj) { if (_state == SessionState.Reset) return 0; inputSource = _currentInputSource; if (inputSource == null) { _state = SessionState.Ended; return (int) BASSStreamProc.BASS_STREAMPROC_END; } } try { BassStream stream = inputSource.OutputStream; int read = stream.Read(buffer, requestedBytes); bool doCheckNextInputSource = false; lock (_syncObj) if (!_isAwaitingNextInputSource && stream.GetPosition() > stream.Length.Subtract(REQUEST_NEXT_ITEM_THRESHOLD)) { // Near end of the stream - make sure that next input source is available _isAwaitingNextInputSource = true; doCheckNextInputSource = true; } if (doCheckNextInputSource) _playbackProcessor.CheckInputSourceAvailable(); if (read > 0) // Normal case, we have finished return read; // Old buffer ran out of samples - either we can get another valid input source below or we are finished. End wait state. _isAwaitingNextInputSource = false; // Nothing could be read from old input source. Second try: Next input source. IInputSource newInputSource = _playbackProcessor.PeekNextInputSource(); // Special treatment for CD drives: If the new input source is from the same audio CD drive, we must take the stream over BassCDTrackInputSource bcdtisOld = inputSource as BassCDTrackInputSource; BassCDTrackInputSource bcdtisNew = newInputSource as BassCDTrackInputSource; if (bcdtisOld != null && bcdtisNew != null) { if (bcdtisOld.SwitchTo(bcdtisNew)) { _playbackProcessor.ClearNextInputSource(); return OutputStreamWriteProc(streamHandle, buffer, requestedBytes, userData); } } lock (_syncObj) { _currentInputSource = null; _controller.ScheduleDisposeObject_Async(inputSource); if (newInputSource == null) { _state = SessionState.Ended; return (int) BASSStreamProc.BASS_STREAMPROC_END; } } if (!MatchesInputSource(newInputSource)) { // The next available input source is not compatible, so end our stream. The playback processor will start a new playback session later. lock (_syncObj) _state = SessionState.Ended; return (int) BASSStreamProc.BASS_STREAMPROC_END; } _playbackProcessor.ClearNextInputSource(); // Should be the contents of newInputSource lock (_syncObj) { _currentInputSource = newInputSource; _state = SessionState.Playing; } // Next try return OutputStreamWriteProc(streamHandle, buffer, requestedBytes, userData); } catch (Exception) { // We might come here due to a race condition. To avoid that, we would have to employ a new manual locking mechanism // to avoid that during the execution of this method, no methods are called from outside which change our // streams/partner instances. return 0; } }
public void Initialize(IInputSource inputSource, uint sourceId) { BaseInitialize(inputSource, sourceId); }
/// <summary> /// Determines whether a given inputsource fits in this session or not. /// </summary> /// <param name="inputSource">The inputsource to check.</param> /// <returns><c>true</c>, if the given <paramref name="inputSource"/> matches to this playback session, /// else <c>false</c>.</returns> public bool MatchesInputSource(IInputSource inputSource) { return inputSource != null && inputSource.OutputStream.Channels == Channels && inputSource.OutputStream.SampleRate == SampleRate && inputSource.OutputStream.IsPassThrough == IsPassThrough; }
/// <summary> /// Initializes this playback session with the given <paramref name="inputSource"/>. /// <see cref="End"/> must have been called before. /// </summary> /// <param name="inputSource">The new input source to play.</param> /// <returns><c>true</c>, if the new input source can be played. <c>false</c> if either <see cref="End"/> was not /// called or if the new input source is not compatible with this playback session.</returns> public bool InitializeWithNewInputSource(IInputSource inputSource) { return Initialize(inputSource); }
public SourceClickEventArgs(IInputSource inputSource, uint sourceId, int tapCount) : base(inputSource, sourceId) { TapCount = tapCount; }
public InputSourceEventArgs(IInputSource inputSource, uint sourceId) { InputSource = inputSource; SourceId = sourceId; }
public ManipulationEventArgs(IInputSource inputSource, uint sourceId, Vector3 cumulativeDelta) : base(inputSource, sourceId) { CumulativeDelta = cumulativeDelta; }
public MouseNagPresenter(IInputSource inputSource, INag nagger) { this.nagger = nagger; inputSource.MouseMoved += MouseMoved; inputSource.KeyBoardKeyPressed += KeyBoardKeyPressed; }
public NavigationEventArgs(IInputSource inputSource, uint sourceId, Vector3 normalizedOffset) : base(inputSource, sourceId) { NormalizedOffset = normalizedOffset; }
/// <inheritdoc /> public bool RemoveInput(IInputSource input) { if (input == null) return false; var result = inputs.Remove(input); if (result) inputCount--; return result; }
/// <summary> /// Ends and discards this playback session. /// </summary> public void End(bool waitForFadeOut) { lock (_syncObj) { if (_state == SessionState.Reset) return; _state = SessionState.Reset; } _controller.OutputDeviceManager.StopDevice(waitForFadeOut); _controller.OutputDeviceManager.ResetInputStream(); _playbackBuffer.ResetInputStream(); _winAmpDSPProcessor.ResetInputStream(); _vstProcessor.ResetInputStream(); _upDownMixer.ResetInputStream(); lock (_syncObj) { _controller.ScheduleDisposeObject_Async(_outputStream); _outputStream = null; _controller.ScheduleDisposeObject_Async(_currentInputSource); _currentInputSource = null; } }
internal TouchPoint INTERNAL_BeginTouch(Vector2 position, IInputSource input) { return INTERNAL_BeginTouch(position, input, null); }
protected bool Initialize(IInputSource inputSource) { if (_state != SessionState.Reset) return false; if (!MatchesInputSource(inputSource)) return false; _currentInputSource = inputSource; Log.Debug("PlaybackSession: Creating output stream"); const BASSFlag flags = BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_STREAM_DECODE; int handle = Bass.BASS_StreamCreate( _currentInputSource.OutputStream.SampleRate, _currentInputSource.OutputStream.Channels, flags, _streamWriteProcDelegate, IntPtr.Zero); if (handle == BassConstants.BassInvalidHandle) throw new BassLibraryException("BASS_StreamCreate"); _outputStream = BassStream.Create(handle); _state = SessionState.Initialized; _upDownMixer.SetInputStream(_outputStream); _vstProcessor.SetInputStream(_upDownMixer.OutputStream); _winAmpDSPProcessor.SetInputStream(_vstProcessor.OutputStream); _playbackBuffer.SetInputStream(_winAmpDSPProcessor.OutputStream); _controller.OutputDeviceManager.SetInputStream(_playbackBuffer.OutputStream, _outputStream.IsPassThrough); return true; }
internal TouchPoint INTERNAL_BeginTouch(Vector2 position, IInputSource input, Tags tags) { TouchPoint touch; lock (touchLock) { touch = touchPointPool.Get(); touch.INTERNAL_Init(nextTouchId++, position, input, tags); touchesBegan.Add(touch); } return touch; }
public SourceData(IInputSource inputSource, uint sourceId) { SourceId = sourceId; HasPosition = false; SourcePosition = Vector3.zero; IsSourceDown = false; IsSourceDownPending = false; SourceStateChanged = false; SourceStateUpdateTimer = -1; InputSourceArgs = new InputSourceEventArgs(inputSource, sourceId); }
public void OnInputDown(InputEventData eventData) { if (isDragging) { // We're already handling drag input, so we can't start a new drag operation. return; } if (!eventData.InputSource.SupportsInputInfo(eventData.SourceId, SupportedInputInfo.Position)) { // The input source must provide positional data for this script to be usable return; } currentInputSource = eventData.InputSource; currentInputSourceId = eventData.SourceId; StartDragging(); }
/// <inheritdoc /> public bool AddInput(IInputSource input) { if (input == null) return false; if (inputs.Contains(input)) return true; inputs.Add(input); inputCount++; return true; }
/// <summary> /// Enqueues the given input source for playback and starts playback if nessecary. /// </summary> /// <param name="inputSource">The input source for the media item to play.</param> /// <param name="startTime">Time to start the new media item.</param> public void MoveToNextItem_Async(IInputSource inputSource, StartTime startTime) { Log.Info("Preparing for playback: '{0}'", inputSource); _playbackProcessor.SetNextInputSource(inputSource); if (startTime == StartTime.AtOnce) _playbackProcessor.ScheduleMoveToNextInputSource(); else _playbackProcessor.ScheduleNextInputSourceAvailable(); }