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 ()
 
virtual ~C4MusicFile ()
 
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
 
int LastPlayed
 
bool NoPlay
 
bool loop
 
bool announced
 

Protected Member Functions

bool ExtractFile ()
 
bool RemTempFile ()
 

Protected Attributes

bool SongExtracted
 

Detailed Description

Definition at line 26 of file C4MusicFile.h.

Constructor & Destructor Documentation

C4MusicFile::C4MusicFile ( )
inline

Definition at line 30 of file C4MusicFile.h.

30  :
31  pNext(nullptr), LastPlayed(-1), NoPlay(false), loop(false), SongExtracted(false), announced(false)
32  { }
C4MusicFile * pNext
Definition: C4MusicFile.h:37
bool announced
Definition: C4MusicFile.h:41
int LastPlayed
Definition: C4MusicFile.h:38
bool SongExtracted
Definition: C4MusicFile.h:67
virtual C4MusicFile::~C4MusicFile ( )
inlinevirtual

Definition at line 33 of file C4MusicFile.h.

33 { }

Member Function Documentation

void C4MusicFile::Announce ( )

Definition at line 41 of file C4MusicFile.cpp.

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

Referenced by C4MusicSystem::Play().

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

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 51 of file C4MusicFile.h.

51 { }
bool C4MusicFile::ExtractFile ( )
protected

Definition at line 47 of file C4MusicFile.cpp.

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

Referenced by C4MusicFileSDL::Play().

48 {
49  // safety
50  if (SongExtracted) return true;
51  // extract entry
53  // ok
54  SongExtracted = true;
55  return true;
56 }
C4Config Config
Definition: C4Config.cpp:837
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:544
bool SongExtracted
Definition: C4MusicFile.h:67
char FileName[_MAX_FNAME+1]
Definition: C4MusicFile.h:36

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 54 of file C4MusicFile.h.

Referenced by C4MusicSystem::Play().

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

Here is the caller graph for this function:

virtual C4TimeMilliseconds C4MusicFile::GetLastInterruptionTime ( ) const
inlinevirtual

Definition at line 52 of file C4MusicFile.h.

virtual double C4MusicFile::GetRemainingTime ( )
inlinevirtual

Definition at line 49 of file C4MusicFile.h.

Referenced by C4MusicSystem::Play().

49 { return 0.0; }

Here is the caller graph for this function:

bool C4MusicFile::HasBeenAnnounced ( ) const
inline

Definition at line 58 of file C4MusicFile.h.

References announced.

Referenced by C4MusicSystem::Play().

58 { return announced; }
bool announced
Definition: C4MusicFile.h:41

Here is the caller graph for this function:

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

Definition at line 48 of file C4MusicFile.h.

Referenced by C4MusicSystem::SetPlayList().

48 { return false; }

Here is the caller graph for this function:

virtual bool C4MusicFile::HasResumePos ( ) const
inlinevirtual

Definition at line 50 of file C4MusicFile.h.

Referenced by C4MusicSystem::Play().

50 { return false; }

Here is the caller graph for this function:

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

Definition at line 67 of file C4MusicFile.cpp.

References FileName, and SCopy().

Referenced by C4MusicSystem::Load().

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

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4MusicFile::IsLooping ( ) const
inline

Definition at line 56 of file C4MusicFile.h.

References loop.

Referenced by C4MusicSystem::Play().

56 { 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 58 of file C4MusicFile.cpp.

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

Referenced by C4MusicFileSDL::Stop().

59 {
60  if (!SongExtracted) return true;
61  // delete it
63  SongExtracted = false;
64  return true;
65 }
C4Config Config
Definition: C4Config.cpp:837
bool EraseFile(const char *szFilename)
Definition: StdFile.cpp:495
#define C4CFN_TempMusic2
Definition: C4Components.h:152
const char * AtTempPath(const char *szFilename)
Definition: C4Config.cpp:544
bool SongExtracted
Definition: C4MusicFile.h:67

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

Definition at line 41 of file C4MusicFile.h.

Referenced by Announce(), and HasBeenAnnounced().

char C4MusicFile::FileName[_MAX_FNAME+1]
int C4MusicFile::LastPlayed

Definition at line 38 of file C4MusicFile.h.

Referenced by C4MusicSystem::Play().

bool C4MusicFile::loop

Definition at line 40 of file C4MusicFile.h.

Referenced by IsLooping().

bool C4MusicFile::NoPlay

Definition at line 39 of file C4MusicFile.h.

Referenced by C4MusicSystem::SetPlayList().

bool C4MusicFile::SongExtracted
protected

Definition at line 67 of file C4MusicFile.h.

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


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