Ejemplo n.º 1
0
        public VisualizationController(
            IAudioStreamSource micHandler,
            INoteDetector noteDetector,
            IVisualizationView view
            )
        {
            micHandler.SamplesStream.Subscribe(
                samples =>
            {
                view.VisualizeSamples(samples);

                // var note = noteDetector.DetectedNotes
                //
                // // var frequency = fDetector.GetFrequency(samples);
                // // var note = fConverter.FrequencyToNote(frequency);
                //
                // view.AddNote(note);

                noteDetector.AddSamples(samples);
            }).AddTo(_disposables);

            noteDetector.DetectedNotes.Subscribe(note => { view.AddNote(note); });
        }
Ejemplo n.º 2
0
            public AudioComponent(IAudio audio)
            {
                this.pcm_ =
                    new OggLoader().Load(
                        LocalIo.Resources.GetFile("music/lobbyBackAndForth.ogg"));

                this.streamPopulator_ = new RateStreamPopulator(this.pcm_);

                var factory = audio.Factory;

                //this.source_ = factory.NewAudioSource();
                //this.buffer_ = factory.NewAudioBuffer();

                //this.buffer_.FillWithPcm(this.pcm_);

                //this.source_.Play(this.buffer_, true);

                this.source_ = factory.NewAudioStreamSource(
                    this.streamPopulator_.Populate,
                    this.pcm_.Channels,
                    this.pcm_.BytesPerSample,
                    this.pcm_.SampleRate);
                this.source_.Play(true);
            }
 public ISingleSongPlayer GetSongPlayerForSource(IAudioStreamSource source)
 {
     return(new DiscordAudioPlayer(_channel, _user, source));
 }
 public DiscordAudioPlayer(Channel channel, User user, IAudioStreamSource source)
 {
     _channel = channel;
     _user    = user;
     _source  = source;
 }