예제 #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);