Пример #1
0
        public Mixer(int samplerate, AudioFormat format, ChannelsLayout channels)
        {
            try
            {
                this.SampleRate    = samplerate;
                this.Channels      = channels == ChannelsLayout.Dolby ? 6 : 2;
                this.ChannelLayout = channels;
                this.Format        = format;

                switch (format)
                {
                case AudioFormat.Short16:
                    this.SampleSize = 2;
                    break;

                case AudioFormat.Float32:
                    this.SampleSize = 4;
                    break;
                }
                this.buffer = new byte[this.SampleRate * this.SampleSize * this.Channels];
            }
            catch
            {
                GC.SuppressFinalize(this);
                throw;
            }
        }
Пример #2
0
        public AudioOut(int samplerate, AudioFormat format, ChannelsLayout channels, int buffers)
        {
            BaseLib.Media.Interop.staticinit.Initialize();

            try
            {
                this.SampleRate    = samplerate;
                this.Channels      = channels == ChannelsLayout.Dolby ? 6 : 2;;
                this.ChannelLayout = channels;
                this.Format        = format;

                switch (this.Format)
                {
                case AudioFormat.Short16: this.SampleSize = 2 * this.Channels; break;

                default: this.SampleSize = 4 * this.Channels; break;
                }
                Intialize(buffers);
            }
            catch (Exception e)
            {
                GC.SuppressFinalize(this);
                throw;
            }
        }
Пример #3
0
        public void ToggleShowServerChannelsLayout()
        {
            _AnimationDisposer?.Dispose();
            _AnimationDisposer = new CompositeDisposable();

            var fade = ServersLayout
                       .Fade(value: 0.0f)
                       .Offset(offsetX: -30)
                       .SetDurationForAll(ToggleDuration.TotalMilliseconds)
                       .AddTo(_AnimationDisposer);
            var fade2 = ChannelsLayout
                        .Fade(value: 1.0f)
                        .Offset(offsetX: 0)
                        .SetDelay(ToggleDuration.TotalMilliseconds * 0.5)
                        .SetDurationForAll(ToggleDuration.TotalMilliseconds)
                        .AddTo(_AnimationDisposer);

            fade.Completed += OnShowServerChannels;

            ChannelsLayout.Visibility = Visibility.Visible;
            ServersLayout.Visibility  = Visibility.Visible;

            fade.Start();
            fade2.Start();
        }
Пример #4
0
        private void MenuView_Loaded(object sender, RoutedEventArgs e)
        {
            var anim = ChannelsLayout.Fade(duration: 0);

            anim.Start();
            anim.Completed += OnShowServers;
            anim.Dispose();
        }
Пример #5
0
        public AudioStream open_audio(uint ind, int samplerate, AudioFormat fmt, ChannelsLayout channellayout, AudioStream.FrameReadyFunction frameready)
        {
            Trace.Assert(!this.audiostreams.Any(_stream => _stream.info.ind == this.AudioStreams[ind].info.ind));

            var result = this.AudioStreams[ind].open(samplerate, fmt, channellayout, frameready);

            this.audiostreams.Add(result);
            return(result);
        }
Пример #6
0
        internal AudioStream open(int samplerate, AudioFormat format, ChannelsLayout channelslayout, AudioStream.FrameReadyFunction frameready)
        {
            this._framedelegate = new AudioStream.FrameReadyFunction(frameready);
            var error = new StringBuilder(1024);

            var audstream = Imports._player_openaudio(Player._player, info.ind, samplerate, format, channelslayout, Marshal.GetFunctionPointerForDelegate(frameready), error);

            BBRException.CheckError(error, $"open_audio");

            return(new AudioStream(this, audstream));
        }
Пример #7
0
 public static extern IntPtr _player_openaudio(IntPtr player, uint ind, int samplerate, AudioFormat format, ChannelsLayout channels, IntPtr frameready, [MarshalAs(UnmanagedType.LPStr)] StringBuilder error);
Пример #8
0
 public static extern IntPtr recorder_addaudio(IntPtr recorder, int bitrate, int samplerate, ChannelsLayout channels, AudioFormat audiofmt, [MarshalAs(UnmanagedType.LPStr)] StringBuilder error);