private void load(ISampleStore samples)
        {
            bassSample = (SampleChannelBass)samples.Get("long.mp3");

            var length = bassSample.CurrentAmplitudes.FrequencyAmplitudes.Length;

            Children = new Drawable[]
            {
                sample = new DrawableSample(bassSample),
                new GridContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    Content          = new[]
                    {
                        new Drawable[]
                        {
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Children         = new Drawable[]
                                {
                                    leftChannel = new Box
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Anchor           = Anchor.Centre,
                                        Origin           = Anchor.CentreRight,
                                    },
                                    rightChannel = new Box
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Anchor           = Anchor.Centre,
                                        Origin           = Anchor.CentreLeft,
                                    }
                                }
                            },
                        },
                        new Drawable[]
                        {
                            amplitudeBoxes = new Container
                            {
                                RelativeSizeAxes   = Axes.Both,
                                ChildrenEnumerable =
                                    Enumerable.Range(0, length)
                                    .Select(i => new Box
                                {
                                    RelativeSizeAxes     = Axes.Both,
                                    RelativePositionAxes = Axes.X,
                                    Anchor = Anchor.BottomLeft,
                                    Origin = Anchor.BottomLeft,
                                    Width  = 1f / length,
                                    X      = (float)i / length
                                })
                            },
                        }
                    }
                },
            };
        }
Exemplo n.º 2
0
        public void Setup()
        {
            // Initialize bass with no audio to make sure the test remains consistent even if there is no audio device.
            Bass.Init(0);

            resources = new DllResourceStore(typeof(TrackBassTest).Assembly);

            sample = new SampleBass(resources.Get("Resources.Tracks.sample-track.mp3"));

            channel = new SampleChannelBass(sample, channel => { });
            updateSample();
        }