private void load(ITrackStore tracks) { bassTrack = (TrackBass)tracks.Get("sample-track.mp3"); int length = bassTrack.CurrentAmplitudes.FrequencyAmplitudes.Length; Children = new Drawable[] { track = new DrawableTrack(bassTrack), 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 }) }, } } }, }; }
protected override Track GetBeatmapTrack() { try { return(trackStore.Get(getPathForFile(Metadata.AudioFile))); } catch (Exception e) { Logger.Error(e, "Track failed to load"); return(null); } }
private void load(ITrackStore tracks) { Child = new DraggableAudioContainer { FillMode = FillMode.Fit, Child = new DraggableAudioContainer { Child = new DraggableAudioContainer { Child = new TrackPlayer(tracks.Get("sample-track.mp3")) } } }; }
private void load(ITrackStore tracks, ISampleStore samples) { track = new DrawableTrack(tracks.Get("sample-track.mp3")); sample = new DrawableSample(samples.Get("long.mp3")); if (withMixer) { InternalChild = new DrawableAudioMixer { Children = new Drawable[] { track, sample } } } ; else { InternalChildren = new Drawable[] { track, sample } }; }
protected override Track GetBeatmapTrack() => trackStore.Get(firstAudioFile);
private void Load(GameHost gameHost, CachedMap cachedMap) { IResourceStore <byte[]> store = new StorageBackedResourceStore(gameHost.Storage); ITrackStore trackStore = audio.GetTrackStore(store); var audioFile = $"{Path.GetDirectoryName(_map.Path)}{Path.DirectorySeparatorChar}{_map.AFileName}"; track = trackStore.Get(audioFile); if (track != null) { track.Volume.Value = Gameini.Get <double>(SettingsConfig.Volume); } InternalChildren = new Drawable[] { GameplayScreenLoader = new GameplayScreenLoader { RelativeSizeAxes = Axes.Both, Size = new Vector2(1f), Anchor = Anchor.Centre, Origin = Anchor.Centre, }, rhythmBoxClockContainer = new RhythmBoxClockContainer(0) { RelativeSizeAxes = Axes.Both, Size = new Vector2(1f) }, BreakOverlay = new BreakOverlay(new Action[] { () => BreakOverlay.State.Value = Visibility.Hidden, () => ReturntoSongSelectionAfterFail.Value = true }) { RelativePositionAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, Size = new Vector2(1f), Alpha = 0f, }, KeyPress[0] = GetSprite("Skin/K1", 0.3f), KeyPress[1] = GetSprite("Skin/K2", 0.4f), KeyPress[2] = GetSprite("Skin/K3", 0.5f), KeyPress[3] = GetSprite("Skin/K4", 0.6f), volume = new Volume(new Bindable <Track>(track)) { Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, RelativePositionAxes = Axes.Both, Size = new Vector2(1f, 0.3f), X = 0.4f, Y = 0.2f, Alpha = 0f, }, }; BreakOverlay.State.Value = Visibility.Hidden; BreakOverlay.State.ValueChanged += async(e) => { if (e.NewValue == Visibility.Hidden) { BreakOverlay.AnimationOut(); await Task.Delay(1500); Resuming.Value = true; rhythmBoxClockContainer.Start(); track.Start(); _RbPlayfield.Clock = rhythmBoxClockContainer.RhythmBoxClock; } }; rhythmBoxClockContainer.Children = new Drawable[] { _RbPlayfield = new Playfield.Playfield(ToApplyMods) { Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, RelativePositionAxes = Axes.Both, Size = new Vector2(0.6f, 0.9f), Map = _map, Y = 0.02f }, hpbar = new HPBar(ToApplyMods) { Anchor = Anchor.TopLeft, Origin = Anchor.TopLeft, RelativeSizeAxes = Axes.Both, Size = new Vector2(0.8f, 1f), Colour = Color4.AliceBlue }, DispayCombo = new TextFlowContainer { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, RelativeSizeAxes = Axes.Both, RelativePositionAxes = Axes.Both, Size = new Vector2(0.1f), TextAnchor = Anchor.BottomLeft, }, DispayScore = new TextFlowContainer { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, RelativeSizeAxes = Axes.Both, RelativePositionAxes = Axes.Both, Size = new Vector2(0.1f), TextAnchor = Anchor.TopRight, X = -0.01f }, }; rhythmBoxClockContainer.IsPaused.BindTo(IsPaused); rhythmBoxClockContainer.UserPlaybackRate.BindTo(UserPlaybackRate); _RbPlayfield.Clock = rhythmBoxClockContainer.RhythmBoxClock; DispayScore.Clock = rhythmBoxClockContainer.RhythmBoxClock; DispayCombo.Clock = rhythmBoxClockContainer.RhythmBoxClock; hpbar.Clock = rhythmBoxClockContainer.RhythmBoxClock; _RbPlayfield.Resuming.BindTo(Resuming); DispayCombo.AddText("0x", x => x.Font = new FontUsage("Roboto", 40)); DispayScore.AddText("000000", x => x.Font = new FontUsage("Roboto", 40)); Score.Combo.PrivateComboBindable.ValueChanged += (e) => hpbar.CurrentValue.Value += hpbar.CalcValue(Score.Combo.currentHit); _RbPlayfield.HasFinished.ValueChanged += (e) => { if (!e.NewValue) { return; } rhythmBoxClockContainer.Stop(); var currentTime = track?.CurrentTime; track?.Stop(); _RbPlayfield.HasFinished.UnbindEvents(); cachedMap.Map = _map; cachedMap.LoadTrackFile(); cachedMap.Seek(currentTime.GetValueOrDefault()); Scheduler.AddDelayed(() => this.Expire(), 1000); LoadComponentAsync(new ResultScreen(), this.Push); }; ReturntoSongSelectionAfterFail.ValueChanged += (e) => { cachedMap.Map = _map; cachedMap.LoadTrackFile(); cachedMap.Seek(track.CurrentTime); Selection songSelction; LoadComponent(songSelction = new Selection()); Schedule(() => this.Push(songSelction)); }; _RbPlayfield.CanStart.ValueChanged += (e) => { if (e.NewValue) { Load(1000); } }; }
protected override Track GetTrack() => trackManager.Get($"https://b.ppy.sh/preview/{beatmapSetInfo.OnlineID}.mp3");
protected override Track GetTrack() => trackManager.Get($"{trackSong.TrackDir}");