public RealtimeWorld(GameWindow window, IAudioAdapter audioAdapter, IGraphicsHost graphicsHost) { var graphics = graphicsHost.GetGraphicsAdapter(); var audioSystem = new AudioSystem(this, audioAdapter); var cameraSystem = new CameraSystem(this, graphicsHost); var actorSystem = new ActorSystem(this); var animationSystem = new AnimationSystem(this); // new up systems, order here will be order of update Systems.Add(new OpenTKInputSystem(this, window)); Systems.Add(new BspSystem(this)); Systems.Add(new PhysxPhysicsSystem(this)); Systems.Add(new MoverSystem(this)); Systems.Add(cameraSystem); Systems.Add(audioSystem); Systems.Add(actorSystem); Systems.Add(animationSystem); Systems.Add(new ScriptSystem(this, audioSystem, cameraSystem, actorSystem, animationSystem)); Systems.Add(new RenderCollectorSystem(this, graphics)); RenderSystems.Add(new RenderPipelineSystem(this, graphics)); globalResources.Add(new RenderListStore()); globalResources.Add(new InputStore()); }
internal unsafe void Add(IAudioAdapter adapter) { ThrowIfNotThread(_eventLoopThread); _backingCollection.Add(adapter); SetCompleteSignal(false); }
public AudioViewModel(Audio audio, IAudioAdapter adapter, Lyrics lyrics=null) { _audio = audio; _lyrics = lyrics; _adapter = adapter; _mediaElement = new MediaElement(); PlayOrPauseImage = new DoubleImageViewModel(Resources.PlayImape, Resources.PauseImage); OpenOrCloseTextImage = new DoubleImageViewModel(Resources.OpenTextImage, Resources.CloseTextImage); }
/// <summary> /// Конструктор с параметрами /// </summary> /// <param name="adapter">Адаптер контакта</param> public SearcherViewModel(IAudioAdapter adapter) { _adapter = adapter; OptionImage = new DoubleImageViewModel(Resources.OpenSettingsImage, Resources.CloseTextImage); SearchResult = new AudioCollectionViewModel(_adapter.GetUserAudio().ToArray(), adapter); SearchOptions = new AudioSearchOptions(); CanSearch = true; OnPropertyChanged("EmptySearchResult"); OnPropertyChanged("FullSearchResult"); }
static void PrintAudioAdapter(IAudioAdapter audioAdapter) { Console.WriteLine($" Name: {audioAdapter.Name}"); Console.WriteLine($" Type: {audioAdapter.DeviceType}"); Console.WriteLine($" Channel count: {audioAdapter.Channels}"); Console.WriteLine($" Sample rate: {audioAdapter.SampleRate}"); Console.WriteLine($" Bit depth: {audioAdapter.BitDepth}"); Console.WriteLine($" Endianness: {(audioAdapter.IsBigEndian ? "Big" : "Little")}"); if (audioAdapter is PulseSourceAdapter source) { Console.WriteLine($" Number type: {(source.IsFloatingPoint ? "float" : $"{(source.IsUnsigned ? "unsigned " : "signed ")}integer")}"); Console.WriteLine($" Number of bits per sample: {source.PackedSize}"); Console.WriteLine($" Description: {source.Description}"); } if (audioAdapter is PulseSinkAdapter sink) { Console.WriteLine($" Number type: {(sink.IsFloatingPoint ? "float" : $"{(sink.IsUnsigned ? "unsigned " : "signed ")}integer")}"); Console.WriteLine($" Number of bits per sample: {sink.PackedSize}"); Console.WriteLine($" Description: {sink.Description}"); } }
/// <summary>Initializes a new instance of the <see cref="PulseAudioPlaybackDevice" /> class.</summary> internal unsafe PulseAudioPlaybackDevice(IAudioAdapter adapter, pa_context *context) { Assert(context != null, "pa_context passed was null"); if (adapter.DeviceType != AudioDeviceType.Playback) { ThrowInvalidOperationException(nameof(adapter), adapter.DeviceType); } _context = context; _sampleDataPipe = new Pipe(); _stream = new Lazy <IntPtr>(CreateStream, isThreadSafe: true); _writeDelegateHandle = new Lazy <GCHandle>(CreateHandle, isThreadSafe: true); _writeDelegate = new NativeDelegate <pa_stream_request_cb_t>(WriteCallback); _writeRequest = new ManualResetValueTaskSource <int>() { RunContinuationsAsynchronously = true }; Adapter = adapter; _ = _state.Transition(to: Initialized); }
public AudioSystem(World world, IAudioAdapter audioAdapter) : base(world) { this.listener = audioAdapter.CreateListener(); this.globalEmitter = audioAdapter.CreateEmitter(); this.audioAdapter = audioAdapter; }
static pa_sample_format GetSampleFormat(IAudioAdapter adapter) { // TODO: make this return some appropriate value return(pa_sample_format.PA_SAMPLE_S16LE); }