Skip to content

Commit

Permalink
Use beatmap file map for audio
Browse files Browse the repository at this point in the history
  • Loading branch information
Wieku committed Oct 1, 2024
1 parent 2c2973b commit 1661f1a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions app/states/player.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import (
"log"
"math"
"math/rand"
"path/filepath"
"runtime"
"strconv"
"strings"
Expand Down Expand Up @@ -168,7 +167,10 @@ func NewPlayer(beatMap *beatmap.BeatMap) *Player {
player.mapFullName = fmt.Sprintf("%s - %s [%s]", beatMap.Artist, beatMap.Name, beatMap.Difficulty)
log.Println("Playing:", player.mapFullName)

track := bass.NewTrack(filepath.Join(settings.General.GetSongsDir(), beatMap.Dir, beatMap.Audio))
var track *bass.TrackBass
if fPath, err2 := beatMap.GetAudioFile(); err2 == nil {
track = bass.NewTrack(fPath)
}

if track == nil {
log.Println("Failed to create music stream, creating a dummy stream...")
Expand Down
5 changes: 4 additions & 1 deletion launcher/songselect.go
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,10 @@ func (m *songSelectPopup) stopPreview() {
func (m *songSelectPopup) startPreview(bMap *beatmap.BeatMap) {
cT := qpc.GetMilliTimeF()

track := bass.NewTrack(filepath.Join(settings.General.OsuSongsDir, bMap.Dir, bMap.Audio))
var track *bass.TrackBass
if fPath, err2 := bMap.GetAudioFile(); err2 == nil {
track = bass.NewTrack(fPath)
}

if track != nil {
beatmap.ParseTimingPointsAndPauses(bMap)
Expand Down

0 comments on commit 1661f1a

Please sign in to comment.