Etterna 0.74.4
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Song Class Reference

Holds all music metadata and steps for one song. More...

#include <Song.h>

Collaboration diagram for Song:
Collaboration graph
[legend]

Public Types

enum  SelectionDisplay { SHOW_ALWAYS , SHOW_NEVER }
 When should this song be displayed in the music wheel? More...
 
using VBackgroundChange = std::vector< BackgroundChange >
 

Public Member Functions

void SetSongDir (const std::string &sDir)
 
auto GetSongDir () -> const std::string &
 
void Reset ()
 
void DetachSteps ()
 
void FinalizeLoading ()
 Load a song from the chosen directory.
 
auto LoadFromSongDir (std::string sDir, Calc *calc=nullptr) -> bool
 
auto ReloadFromSongDir (const std::string &sDir) -> bool
 
auto ReloadFromSongDir () -> bool
 
void ReloadIfNoMusic ()
 
auto GetFileHash () -> std::string
 
auto GetDateAdded () const -> DateTime
 
void TidyUpData (bool fromCache=false, bool duringCache=false, Calc *calc=nullptr)
 Call this after loading a song to clean up invalid data.
 
void ReCalculateRadarValuesAndLastSecond (bool fromCache=false, bool duringCache=false, Calc *calc=nullptr)
 Get the new radar values, and determine the last second at the same time. This is called by TidyUpData, after saving the Song.
 
void TranslateTitles ()
 Translate any titles that aren't in english. This is called by TidyUpData.
 
auto SaveToSSCFile (const std::string &sPath, bool bSavingCache) -> bool
 Save to the new SSC file format.
 
auto SaveToETTFile (const std::string &sPath, bool bSavingCache) -> bool
 
void Save ()
 Save to the SSC and SM files no matter what.
 
auto SaveToCacheFile () -> bool
 Save the current Song to a cache file using the preferred format.
 
auto SaveToSMFile () -> bool
 Save the current Song to a SM file.
 
auto SaveToDWIFile () -> bool
 Save the current Song to a DWI file if possible.
 
auto GetSongFilePath () const -> const std::string &
 
auto GetCacheFilePath () const -> std::string
 
auto GetSongDir () const -> const std::string &
 
auto GetDisplayMainTitle () const -> const std::string &
 
auto GetDisplaySubTitle () const -> const std::string &
 
auto GetDisplayArtist () const -> const std::string &
 
auto GetMainTitle () const -> const std::string &
 
auto GetTranslitMainTitle () const -> const std::string &
 Retrieve the transliterated title, or the main title if there is no translit.
 
auto GetStepsToSave (bool bSavingCache=true, const std::string &path="") -> std::vector< Steps * >
 
auto GetTranslitSubTitle () const -> const std::string &
 Retrieve the transliterated subtitle, or the main subtitle if there is no translit.
 
auto GetTranslitArtist () const -> const std::string &
 Retrieve the transliterated artist, or the main artist if there is no translit.
 
auto GetDisplayFullTitle () const -> const std::string &
 
auto GetTranslitFullTitle () const -> const std::string &
 
auto GetMusicPath () const -> const std::string &
 
auto GetInstrumentTrackPath (InstrumentTrack it) const -> const std::string &
 
auto GetBannerPath () const -> const std::string &
 
auto GetJacketPath () const -> const std::string &
 
auto GetCDImagePath () const -> const std::string &
 
auto GetDiscPath () const -> const std::string &
 
auto GetLyricsPath () const -> const std::string &
 
auto GetBackgroundPath () const -> const std::string &
 
auto GetCDTitlePath () const -> const std::string &
 
auto GetPreviewVidPath () const -> const std::string &
 
auto GetPreviewMusicPath () const -> const std::string &
 
auto GetCredits () const -> const std::string &
 
auto GetPreviewStartSeconds () const -> float
 
auto GetCacheFile (const std::string &sType) -> std::string
 
auto HighestMSDOfSkillset (Skillset x, float rate, bool filtered_charts_only) const -> float
 
auto IsSkillsetHighestOfChart (Steps *chart, Skillset skill, float rate) const -> bool
 
auto MatchesFilter (float rate, std::vector< Steps * > *vMatchingStepsOut=nullptr) const -> bool
 This functions returns whether it has any chart of the given types with the given rate. If no type is given it checks all charts.
 
auto ChartMatchesFilter (Steps *chart, float rate) const -> bool
 
auto IsChartHighestDifficulty (Steps *chart, Skillset skill, float rate) const -> bool
 
auto HasChartByHash (const std::string &hash) -> bool
 
auto HasMusic () const -> bool
 
auto HasInstrumentTrack (InstrumentTrack it) const -> bool
 
auto HasBanner () const -> bool
 
auto HasBackground () const -> bool
 
auto HasJacket () const -> bool
 
auto HasCDImage () const -> bool
 
auto HasDisc () const -> bool
 
auto HasCDTitle () const -> bool
 
auto HasBGChanges () const -> bool
 
auto HasLyrics () const -> bool
 
auto HasPreviewVid () const -> bool
 
auto Matches (const std::string &sGroup, const std::string &sSong) const -> bool
 
auto GetFirstBeat () const -> float
 
auto GetFirstSecond () const -> float
 
auto GetLastBeat () const -> float
 
auto GetLastSecond () const -> float
 
auto GetSpecifiedLastBeat () const -> float
 
auto GetSpecifiedLastSecond () const -> float
 
void SetFirstSecond (float f)
 
void SetLastSecond (float f)
 
void SetSpecifiedLastSecond (float f)
 
auto GetBackgroundChanges (BackgroundLayer bl) const -> const std::vector< BackgroundChange > &
 
auto GetBackgroundChanges (BackgroundLayer bl) -> std::vector< BackgroundChange > &
 
auto GetForegroundChanges () const -> const std::vector< BackgroundChange > &
 
auto GetForegroundChanges () -> std::vector< BackgroundChange > &
 
auto GetBGChanges1ToVectorString () const -> std::vector< std::string >
 
auto GetBGChanges2ToVectorString () const -> std::vector< std::string >
 
auto GetFGChanges1ToVectorString () const -> std::vector< std::string >
 
auto GetInstrumentTracksToVectorString () const -> std::vector< std::string >
 
void AddBackgroundChange (BackgroundLayer blLayer, const BackgroundChange &seg)
 
void AddForegroundChange (const BackgroundChange &seg)
 
void AddLyricSegment (const LyricSegment &seg)
 
void GetDisplayBpms (DisplayBpms &AddTo, bool bIgnoreCurrentRate=false) const
 
auto GetBackgroundAtBeat (BackgroundLayer iLayer, float fBeat) const -> const BackgroundChange &
 
auto CreateSteps () -> Steps *
 
void InitSteps (Steps *pSteps)
 
auto GetOrTryAtLeastToGetSimfileAuthor () const -> const std::string
 
auto HasSignificantBpmChangesOrStops () const -> bool
 
auto GetStepsSeconds () const -> float
 
auto IsLong () const -> bool
 
auto IsMarathon () const -> bool
 
void PlaySampleMusicExtended ()
 
auto SongCompleteForStyle (const Style *st) const -> bool
 
auto HasStepsType (StepsType st) const -> bool
 
auto HasStepsTypeAndDifficulty (StepsType st, Difficulty dc) const -> bool
 
auto GetAllSteps () const -> const std::vector< Steps * > &
 
auto GetStepsByStepsType (StepsType st) const -> const std::vector< Steps * > &
 
auto GetChartsOfCurrentGameMode () const -> std::vector< Steps * >
 Get the steps of all types within the current game mode.
 
auto GetChartsMatchingFilter () const -> std::vector< Steps * >
 
auto HasEdits (StepsType st) const -> bool
 
auto HasFavoritedChart () const -> bool
 
void SetHasFavoritedChart (bool b)
 
auto HasGoal () const -> bool
 
void SetHasGoal (bool b)
 
auto HasPermaMirrorChart () const -> bool
 
void SetHasPermaMirrorChart (bool b)
 
void SetEnabled (bool b)
 
auto GetEnabled () const -> bool
 
void AddSteps (Steps *pSteps)
 Add the chosen Steps to the Song. We are responsible for deleting the memory pointed to by pSteps!
 
void DeleteSteps (const Steps *pSteps, bool bReAutoGen=true)
 
auto IsEditAlreadyLoaded (Steps *pSteps) const -> bool
 
auto IsStepsUsingDifferentTiming (Steps *pSteps) const -> bool
 
auto AnyChartUsesSplitTiming () const -> bool
 
void UnloadAllCalcDebugOutput ()
 
void PushSelf (lua_State *L)
 

Static Public Member Functions

static auto GetSongAssetPath (std::string sPath, const std::string &sSongPath) -> std::string
 

Public Attributes

enum Song::SelectionDisplay m_SelectionDisplay
 
std::string m_sFileHash
 
DateTime dateAdded = DateTime::GetNowDateTime()
 
std::string m_sSongFileName
 Filename associated with this file. This will always have a .SSC extension. If we loaded a .SSC, this will point to it, but if we loaded any other type, this will point to a generated .SSC filename.
 
std::string m_sGroupName
 The group this Song is in.
 
ProfileSlot m_LoadedFromProfile
 the Profile this came from. This is ProfileSlot_Invalid if it wasn't loaded from a profile.
 
bool m_bIsSymLink
 Is the song file itself a symlink to another file?
 
bool m_bEnabled
 
std::string m_sMainTitle
 The title of the Song.
 
std::string m_sSubTitle
 The subtitle of the Song, if it exists.
 
std::string m_sArtist
 The artist of the Song, if it exists.
 
std::string m_sMainTitleTranslit
 The transliterated title of the Song, if it exists.
 
std::string m_sSubTitleTranslit
 The transliterated subtitle of the Song, if it exists.
 
std::string m_sArtistTranslit
 The transliterated artist of the Song, if it exists.
 
std::string displayfulltitle
 
std::string translitfulltitle
 
float m_fVersion
 The version of the song/file.
 
std::string m_sGenre
 The genre of the song/file.
 
std::string m_sCredit
 The person who worked with the song file who should be credited. This is read and saved, but never actually used.
 
std::string m_sOrigin
 
std::string m_sMusicFile
 
std::string m_PreviewFile
 
std::string m_sInstrumentTrackFile [NUM_InstrumentTrack]
 
float m_fMusicLengthSeconds
 The length of the music file.
 
float m_fMusicSampleStartSeconds
 
float m_fMusicSampleLengthSeconds
 
DisplayBPM m_DisplayBPMType
 
float m_fSpecifiedBPMMin
 
float m_fSpecifiedBPMMax
 
std::string m_sBannerFile
 
std::string m_sJacketFile
 
std::string m_sCDFile
 
std::string m_sDiscFile
 
std::string m_sLyricsFile
 
std::string m_sBackgroundFile
 
std::string m_sCDTitleFile
 
std::string m_sPreviewVidFile
 
std::string m_sMusicPath
 
std::string m_PreviewPath
 
std::string m_sInstrumentTrackPath [NUM_InstrumentTrack]
 
std::string m_sBannerPath
 
std::string m_sJacketPath
 
std::string m_sCDPath
 
std::string m_sDiscPath
 
std::string m_sLyricsPath
 
std::string m_sBackgroundPath
 
std::string m_sCDTitlePath
 
std::string m_sPreviewVidPath
 
std::vector< std::string > ImageDir
 
bool m_bHasMusic
 
bool m_bHasBanner
 
bool m_bHasBackground
 
TimingData m_SongTiming
 The Song's TimingData.
 
std::vector< LyricSegmentm_LyricSegments
 The list of LyricSegments. This must be sorted before gameplay.
 
std::vector< std::string > m_vsKeysoundFile
 An array of keysound file names (e.g. "beep.wav"). The index in this array corresponds to the index in TapNote. If you change the index in here, you must change all NoteData too. Any note that doesn't have a value in the range of this array means "this note doesn't have a keysound".
 
CachedObject< Songm_CachedObject
 
std::vector< Steps * > m_vpSteps
 
std::vector< Steps * > m_UnknownStyleSteps
 

Detailed Description

Holds all music metadata and steps for one song.

Member Enumeration Documentation

◆ SelectionDisplay

When should this song be displayed in the music wheel?

Enumerator
SHOW_ALWAYS 

always show on the wheel.

SHOW_NEVER 

never show on the wheel (unless song hiding is turned off).

Member Function Documentation

◆ AddSteps()

void Song::AddSteps ( Steps pSteps)

Add the chosen Steps to the Song. We are responsible for deleting the memory pointed to by pSteps!

Parameters
pStepsthe new steps.

◆ FinalizeLoading()

void Song::FinalizeLoading ( )

Load a song from the chosen directory.

This assumes that there is no song present right now.

Parameters
sDirthe song directory from which to load.

◆ GetTranslitArtist()

auto Song::GetTranslitArtist ( ) const -> const std::string&
inline

Retrieve the transliterated artist, or the main artist if there is no translit.

Returns
the proper artist.

◆ GetTranslitMainTitle()

auto Song::GetTranslitMainTitle ( ) const -> const std::string&
inline

Retrieve the transliterated title, or the main title if there is no translit.

Returns
the proper title.

◆ GetTranslitSubTitle()

auto Song::GetTranslitSubTitle ( ) const -> const std::string&
inline

Retrieve the transliterated subtitle, or the main subtitle if there is no translit.

Returns
the proper subtitle.

◆ ReCalculateRadarValuesAndLastSecond()

void Song::ReCalculateRadarValuesAndLastSecond ( bool  fromCache = false,
bool  duringCache = false,
Calc calc = nullptr 
)

Get the new radar values, and determine the last second at the same time. This is called by TidyUpData, after saving the Song.

Parameters
fromCachewas this data loaded from the cache file?
duringCachewas this data loaded during the cache process?

◆ SaveToCacheFile()

bool Song::SaveToCacheFile ( ) -> bool

Save the current Song to a cache file using the preferred format.

Returns
its success or failure.

◆ SaveToDWIFile()

bool Song::SaveToDWIFile ( ) -> bool

Save the current Song to a DWI file if possible.

Returns
its success or failure.

◆ SaveToSMFile()

bool Song::SaveToSMFile ( ) -> bool

Save the current Song to a SM file.

Returns
its success or failure.

◆ SaveToSSCFile()

bool Song::SaveToSSCFile ( const std::string &  sPath,
bool  bSavingCache 
) -> bool

Save to the new SSC file format.

Parameters
sPaththe path where we're saving the file.
bSavingCachea flag to determine if we're saving cache data.

◆ TidyUpData()

void Song::TidyUpData ( bool  fromCache = false,
bool  duringCache = false,
Calc calc = nullptr 
)

Call this after loading a song to clean up invalid data.

Parameters
fromCachewas this data loaded from the cache file?
duringCachewas this data loaded during the cache process?

The documentation for this class was generated from the following files: