OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4MusicFile Class Referenceabstract

#include <C4MusicFile.h>

Inheritance diagram for C4MusicFile:
[legend]
Collaboration diagram for C4MusicFile:
[legend]

Public Member Functions

 C4MusicFile ()=default
 
virtual ~C4MusicFile ()=default
 
virtual bool Init (const char *strFile)
 
virtual bool Play (bool loop=false, double max_resume_time=0.0)=0
 
virtual void Stop (int fadeout_ms=0)=0
 
virtual void CheckIfPlaying ()=0
 
virtual void SetVolume (int)=0
 
virtual bool HasCategory (const char *szcat) const
 
virtual double GetRemainingTime ()
 
virtual bool HasResumePos () const
 
virtual void ClearResumePos ()
 
virtual C4TimeMilliseconds GetLastInterruptionTime () const
 
virtual StdStrBuf GetDebugInfo () const
 
bool IsLooping () const
 
bool HasBeenAnnounced () const
 
void Announce ()
 

Public Attributes

char FileName [_MAX_FNAME+1]
 
C4MusicFilepNext {nullptr}
 
int LastPlayed {-1}
 
bool NoPlay {false}
 
bool loop {false}
 
bool announced {false}
 

Protected Member Functions

bool ExtractFile ()
 
bool RemTempFile ()
 

Protected Attributes

bool SongExtracted {false}
 

Detailed Description

Definition at line 26 of file C4MusicFile.h.

Constructor & Destructor Documentation

C4MusicFile::C4MusicFile ( )
default
virtual C4MusicFile::~C4MusicFile ( )
virtualdefault

Member Function Documentation

void C4MusicFile::Announce ( )

Definition at line 40 of file C4MusicFile.cpp.

References announced, FileName, GetFilename(), LoadResStr(), and LogF().

Referenced by C4MusicSystem::Play().

41 {
42  LogF(LoadResStr("IDS_PRC_PLAYMUSIC"), GetFilename(FileName));
43  announced = true;
44 }
char * GetFilename(char *szPath)
Definition: StdFile.cpp:45
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
bool announced
Definition: C4MusicFile.h:39
bool LogF(const char *strMessage,...)
Definition: C4Log.cpp:250
char FileName[_MAX_FNAME+1]
Definition: C4MusicFile.h:34

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void C4MusicFile::CheckIfPlaying ( )
pure virtual

Implemented in C4MusicFileSDL.

Referenced by C4MusicSystem::Execute().

Here is the caller graph for this function:

virtual void C4MusicFile::ClearResumePos ( )
inlinevirtual

Definition at line 49 of file C4MusicFile.h.

49 { }
bool C4MusicFile::ExtractFile ( )
protected

Definition at line 46 of file C4MusicFile.cpp.

References C4Config::AtTempPath(), C4CFN_TempMusic2, C4Group_CopyItem(), Config, FileName, and SongExtracted.

Referenced by C4MusicFileSDL::Play().

47 {
48  // safety
49  if (SongExtracted) return true;
50  // extract entry
52  // ok
53  SongExtracted = true;
54  return true;
55 }
C4Config Config
Definition: C4Config.cpp:833
bool C4Group_CopyItem(const char *szSource, const char *szTarget1, bool fNoSort, bool fResetAttributes)
Definition: C4Group.cpp:100
#define C4CFN_TempMusic2
Definition: C4Components.h:152
const char * AtTempPath(const char *szFilename)
Definition: C4Config.cpp:540
bool SongExtracted
Definition: C4MusicFile.h:65
char FileName[_MAX_FNAME+1]
Definition: C4MusicFile.h:34

Here is the call graph for this function:

Here is the caller graph for this function:

virtual StdStrBuf C4MusicFile::GetDebugInfo ( ) const
inlinevirtual

Definition at line 52 of file C4MusicFile.h.

Referenced by C4MusicSystem::Play().

52 { return StdStrBuf(FileName); }
char FileName[_MAX_FNAME+1]
Definition: C4MusicFile.h:34

Here is the caller graph for this function:

virtual C4TimeMilliseconds C4MusicFile::GetLastInterruptionTime ( ) const
inlinevirtual

Definition at line 50 of file C4MusicFile.h.

virtual double C4MusicFile::GetRemainingTime ( )
inlinevirtual

Definition at line 47 of file C4MusicFile.h.

Referenced by C4MusicSystem::Play().

47 { return 0.0; }

Here is the caller graph for this function:

bool C4MusicFile::HasBeenAnnounced ( ) const
inline

Definition at line 56 of file C4MusicFile.h.

References announced.

Referenced by C4MusicSystem::Play().

56 { return announced; }
bool announced
Definition: C4MusicFile.h:39

Here is the caller graph for this function:

virtual bool C4MusicFile::HasCategory ( const char *  szcat) const
inlinevirtual

Definition at line 46 of file C4MusicFile.h.

Referenced by C4MusicSystem::SetPlayList().

46 { return false; }

Here is the caller graph for this function:

virtual bool C4MusicFile::HasResumePos ( ) const
inlinevirtual

Definition at line 48 of file C4MusicFile.h.

Referenced by C4MusicSystem::Play().

48 { return false; }

Here is the caller graph for this function:

bool C4MusicFile::Init ( const char *  strFile)
virtual

Definition at line 66 of file C4MusicFile.cpp.

References FileName, and SCopy().

Referenced by C4MusicSystem::Load().

67 {
68  SCopy(szFile, FileName);
69  return true;
70 }
void SCopy(const char *szSource, char *sTarget, size_t iMaxL)
Definition: Standard.cpp:130
char FileName[_MAX_FNAME+1]
Definition: C4MusicFile.h:34

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4MusicFile::IsLooping ( ) const
inline

Definition at line 54 of file C4MusicFile.h.

References loop.

Referenced by C4MusicSystem::Play().

54 { return loop; }

Here is the caller graph for this function:

virtual bool C4MusicFile::Play ( bool  loop = false,
double  max_resume_time = 0.0 
)
pure virtual

Implemented in C4MusicFileSDL.

Referenced by C4MusicSystem::NotifySuccess(), and C4MusicSystem::Play().

Here is the caller graph for this function:

bool C4MusicFile::RemTempFile ( )
protected

Definition at line 57 of file C4MusicFile.cpp.

References C4Config::AtTempPath(), C4CFN_TempMusic2, Config, EraseFile(), and SongExtracted.

Referenced by C4MusicFileSDL::Stop().

58 {
59  if (!SongExtracted) return true;
60  // delete it
62  SongExtracted = false;
63  return true;
64 }
C4Config Config
Definition: C4Config.cpp:833
bool EraseFile(const char *szFileName)
#define C4CFN_TempMusic2
Definition: C4Components.h:152
const char * AtTempPath(const char *szFilename)
Definition: C4Config.cpp:540
bool SongExtracted
Definition: C4MusicFile.h:65

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void C4MusicFile::SetVolume ( int  )
pure virtual

Implemented in C4MusicFileSDL.

Referenced by C4MusicSystem::Execute(), C4MusicSystem::Play(), and C4MusicSystem::UpdateVolume().

Here is the caller graph for this function:

virtual void C4MusicFile::Stop ( int  fadeout_ms = 0)
pure virtual

Implemented in C4MusicFileSDL.

Referenced by C4MusicSystem::Execute(), C4MusicSystem::FadeOut(), C4MusicSystem::Play(), and C4MusicSystem::Stop().

Here is the caller graph for this function:

Member Data Documentation

bool C4MusicFile::announced {false}

Definition at line 39 of file C4MusicFile.h.

Referenced by Announce(), and HasBeenAnnounced().

char C4MusicFile::FileName[_MAX_FNAME+1]
int C4MusicFile::LastPlayed {-1}

Definition at line 36 of file C4MusicFile.h.

Referenced by C4MusicSystem::Play().

bool C4MusicFile::loop {false}

Definition at line 38 of file C4MusicFile.h.

Referenced by IsLooping().

bool C4MusicFile::NoPlay {false}

Definition at line 37 of file C4MusicFile.h.

Referenced by C4MusicSystem::SetPlayList().

bool C4MusicFile::SongExtracted {false}
protected

Definition at line 65 of file C4MusicFile.h.

Referenced by ExtractFile(), C4MusicFileSDL::Play(), and RemTempFile().


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