#pragma once /* ----------------------------------------------------------------------------- Class: Song Desc: Holds data about a piece of music that can be played by one or more Games. Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ #include "NoteMetadata.h" #include "GameTypes.h" #include "RageUtil.h" //enum DanceStyle; // why is this needed? struct BPMSegment { BPMSegment() { m_fStartBeat = m_fBPM = -1; }; float m_fStartBeat; float m_fBPM; }; struct FreezeSegment { FreezeSegment() { m_fStartBeat = m_fFreezeSeconds = -1; }; float m_fStartBeat; float m_fFreezeSeconds; }; class Song { public: Song(); bool LoadFromSongDir( CString sDir ); bool LoadFromDWIFile( CString sPath ); bool LoadFromBMSDir( CString sDir ); bool LoadFromSMDir( CString sDir ); void Save(); private: void TidyUpData(); // call after loading to clean up invalid data public: CString GetSongFilePath() {return m_sSongFilePath; }; CString GetSongFileDir() {return m_sSongDir; }; CString GetGroupName() {return m_sGroupName; }; CString GetMusicPath() {return m_sMusicPath; }; void GetMusicSampleRange( float &fStartSec, float &fEndSec ) { fStartSec = m_fMusicSampleStartSeconds; fEndSec = m_fMusicSampleStartSeconds + m_fMusicSampleLengthSeconds; }; CString GetBannerPath() {return m_sBannerPath; }; CString GetBackgroundPath() {return m_sBackgroundPath; }; CString GetBackgroundMoviePath(){return m_sBackgroundMoviePath; }; CString GetCDTitlePath() {return m_sCDTitlePath; }; bool HasMusic() {return m_sMusicPath != "" && DoesFileExist(GetMusicPath()); }; bool HasBanner() {return m_sBannerPath != "" && DoesFileExist(GetBannerPath()); }; bool HasBackground() {return m_sBackgroundPath != "" && DoesFileExist(GetBackgroundPath()); }; bool HasBackgroundMovie() {return m_sBackgroundMoviePath != ""&& DoesFileExist(GetBackgroundMoviePath()); }; bool HasCDTitle() {return m_sCDTitlePath != "" && DoesFileExist(GetCDTitlePath()); }; CString GetMainTitle() {return m_sMainTitle; }; CString GetSubTitle() {return m_sSubTitle; }; void GetMainAndSubTitlesFromFullTitle( CString sFullTitle, CString &sMainTitleOut, CString &sSubTitleOut ) { char szSeps[] = { '-', '~' }; for( int i=0; i& arrayAddTo ); int GetNumTimesPlayed() { int iTotalNumTimesPlayed = 0; for( int i=0; i m_BPMSegments; // this must be sorted before dancing CArray m_FreezeSegments; // this must be sorted before dancing public: CArray m_arrayNoteMetadatas; }; void SortSongPointerArrayByTitle( CArray &arraySongPointers ); void SortSongPointerArrayByBPM( CArray &arraySongPointers ); void SortSongPointerArrayByArtist( CArray &arraySongPointers ); void SortSongPointerArrayByGroup( CArray &arraySongPointers ); void SortSongPointerArrayByMostPlayed( CArray &arraySongPointers );