changes all tabs to 4 spaces (seems like I wasn't the only one who still used tabs Doep :p)

This commit is contained in:
bart.apella 2008-06-05 20:40:17 +00:00
parent 9f63336389
commit 13b0c9b060
18 changed files with 341 additions and 341 deletions

View File

@ -151,8 +151,8 @@ void PlaybackQueue::Next(){
void PlaybackQueue::Previous(){
musik::core::TrackPtr track( this->nowPlaying->PreviousTrack() );
this->SetCurrentTrack(track);
this->Play();
this->SetCurrentTrack(track);
this->Play();
}
@ -195,11 +195,11 @@ TrackPtr PlaybackQueue::CurrentTrack(){
//////////////////////////////////////////
void PlaybackQueue::SetCurrentTrack(TrackPtr track){
if(track){
this->currentTrack = track->Copy();
}else{
this->currentTrack = musik::core::TrackPtr();
}
if(track){
this->currentTrack = track->Copy();
}else{
this->currentTrack = musik::core::TrackPtr();
}
// Get all metadata to the track
if(this->currentTrack){

View File

@ -58,21 +58,21 @@ class PlaybackQueue : public sigslot::has_slots<>{
PlaybackQueue(void);
//////////////////////////////////////////
///\brief
///The one and only instance of the PlaybackQueue
//////////////////////////////////////////
static PlaybackQueue sInstance;
///\brief
///The one and only instance of the PlaybackQueue
//////////////////////////////////////////
static PlaybackQueue sInstance;
//////////////////////////////////////////
///\brief
///\brief
///The only instance of the audio::Transport
//////////////////////////////////////////
audio::Transport transport;
//////////////////////////////////////////
audio::Transport transport;
//////////////////////////////////////////
///\brief
///\brief
///The "now playing" tracklist
//////////////////////////////////////////
//////////////////////////////////////////
tracklist::Standard::Ptr nowPlaying;
bool playing;
@ -82,21 +82,21 @@ class PlaybackQueue : public sigslot::has_slots<>{
~PlaybackQueue(void);
//////////////////////////////////////////
///\brief
///Access to the PlaybackQueue singleton
//////////////////////////////////////////
static PlaybackQueue& Instance(){ return sInstance; };
///\brief
///Access to the PlaybackQueue singleton
//////////////////////////////////////////
static PlaybackQueue& Instance(){ return sInstance; };
//////////////////////////////////////////
///\brief
///Get a hold of the Transport
//////////////////////////////////////////
///\brief
///Get a hold of the Transport
//////////////////////////////////////////
musik::core::audio::Transport& Transport() { return this->transport; };
// Now Playing control
tracklist::Standard::Ptr NowPlayingTracklist();
void Play(tracklist::IRandomAccess &tracklist);
void Append(tracklist::IRandomAccess &tracklist);
void Append(tracklist::IRandomAccess &tracklist);
// Playback Control
void Play();

View File

@ -55,7 +55,7 @@ namespace musik{ namespace core{
private:
#ifdef WIN32
typedef musik::core::IPlugin* (__stdcall* CallGetPlugin)();
typedef musik::core::IPlugin* (__stdcall* CallGetPlugin)();
#endif
PluginFactory(void);

View File

@ -101,12 +101,12 @@ namespace musik{ namespace core{
///musik::core::State
//////////////////////////////////////////
enum Status:int{
Started = 1,
Ended = 2,
Canceled = 4,
OutputStarted = 8,
OutputEnded = 16,
Finished = 32
Started = 1,
Ended = 2,
Canceled = 4,
OutputStarted = 8,
OutputEnded = 16,
Finished = 32
};
unsigned int status;

View File

@ -5,30 +5,30 @@
using namespace musik::core::audio;
AudioPacketizer::AudioPacketizer(void) :
m_pMainBuffer(NULL),
m_PacketSize(0),
m_ReadBlock(0),
m_WriteBlock(0),
m_Finished(false),
m_OverflowSize(0),
m_pMainBuffer(NULL),
m_PacketSize(0),
m_ReadBlock(0),
m_WriteBlock(0),
m_Finished(false),
m_OverflowSize(0),
m_pOverflowBuffer(0)
{
}
AudioPacketizer::~AudioPacketizer(void)
{
SetPacketSize(0);
SetPacketSize(0);
}
bool AudioPacketizer::SetPacketSize(unsigned long Size)
{
if(Size != m_PacketSize)
{
if(m_pMainBuffer)
{
delete [] m_pMainBuffer;
m_pMainBuffer = NULL;
}
if(Size != m_PacketSize)
{
if(m_pMainBuffer)
{
delete [] m_pMainBuffer;
m_pMainBuffer = NULL;
}
if (m_pOverflowBuffer)
{
@ -36,124 +36,124 @@ bool AudioPacketizer::SetPacketSize(unsigned long Size)
m_pOverflowBuffer = 0;
}
if(Size)
{
m_pMainBuffer = new float[Size * 16];
m_PacketSize = Size;
if(Size)
{
m_pMainBuffer = new float[Size * 16];
m_PacketSize = Size;
for(int x=0; x<16; x++)
{
m_pBufferArray[x] = &m_pMainBuffer[x*Size];
}
for(int x=0; x<16; x++)
{
m_pBufferArray[x] = &m_pMainBuffer[x*Size];
}
m_pOverflowBuffer = new float[Size];
}
}
m_pOverflowBuffer = new float[Size];
}
}
m_ReadBlock = 0;
m_WriteBlock = 0;
m_OverflowSize = 0;
m_Finished = false;
m_ReadBlock = 0;
m_WriteBlock = 0;
m_OverflowSize = 0;
m_Finished = false;
return(true);
return(true);
}
bool AudioPacketizer::WriteData(float * Data, unsigned long Samples)
{
unsigned long SamplesLeft = Samples;
unsigned long SamplesLeft = Samples;
if(Samples >= m_PacketSize*16)
return(false);
if(Samples >= m_PacketSize*16)
return(false);
if(m_OverflowSize)
{
if((m_OverflowSize+Samples) >= m_PacketSize) // if overflow and new samples can create a packet make one
{
CopyFloat(m_pBufferArray[m_WriteBlock & 0x0f], m_pOverflowBuffer, m_OverflowSize);
CopyFloat(&m_pBufferArray[m_WriteBlock & 0x0f][m_OverflowSize], Data, m_PacketSize - m_OverflowSize);
if(m_OverflowSize)
{
if((m_OverflowSize+Samples) >= m_PacketSize) // if overflow and new samples can create a packet make one
{
CopyFloat(m_pBufferArray[m_WriteBlock & 0x0f], m_pOverflowBuffer, m_OverflowSize);
CopyFloat(&m_pBufferArray[m_WriteBlock & 0x0f][m_OverflowSize], Data, m_PacketSize - m_OverflowSize);
SamplesLeft -= (m_PacketSize - m_OverflowSize);
Data = &Data[m_PacketSize - m_OverflowSize];
m_WriteBlock++;
m_OverflowSize = 0;
}
}
SamplesLeft -= (m_PacketSize - m_OverflowSize);
Data = &Data[m_PacketSize - m_OverflowSize];
m_WriteBlock++;
m_OverflowSize = 0;
}
}
while(SamplesLeft >= m_PacketSize) // if the samples we have left can make packets
{
CopyFloat(m_pBufferArray[m_WriteBlock & 0x0f], Data, m_PacketSize);
while(SamplesLeft >= m_PacketSize) // if the samples we have left can make packets
{
CopyFloat(m_pBufferArray[m_WriteBlock & 0x0f], Data, m_PacketSize);
SamplesLeft -= (m_PacketSize);
Data = &Data[m_PacketSize];
m_WriteBlock++;
}
if(SamplesLeft)
{
CopyFloat(&m_pOverflowBuffer[m_OverflowSize], Data, SamplesLeft);
m_OverflowSize += SamplesLeft;
}
SamplesLeft -= (m_PacketSize);
Data = &Data[m_PacketSize];
m_WriteBlock++;
}
if(SamplesLeft)
{
CopyFloat(&m_pOverflowBuffer[m_OverflowSize], Data, SamplesLeft);
m_OverflowSize += SamplesLeft;
}
return(true);
return(true);
}
bool AudioPacketizer::Finished(void)
{
float * pData = m_pBufferArray[m_WriteBlock & 0x0f];
for(int x=0; x<m_PacketSize; x++)
{
pData[x] = 0.0f;
}
float * pData = m_pBufferArray[m_WriteBlock & 0x0f];
for(int x=0; x<m_PacketSize; x++)
{
pData[x] = 0.0f;
}
if(m_OverflowSize)
{
CopyFloat(pData, m_pOverflowBuffer, m_OverflowSize);
m_OverflowSize = 0;
}
if(m_OverflowSize)
{
CopyFloat(pData, m_pOverflowBuffer, m_OverflowSize);
m_OverflowSize = 0;
}
m_WriteBlock++;
m_WriteBlock++;
m_Finished = true;
m_Finished = true;
return true;
return true;
}
bool AudioPacketizer::IsBufferAvailable(void)
bool AudioPacketizer::IsBufferAvailable(void)
{
if(m_ReadBlock >= m_WriteBlock)
{
return(false);
}
if(m_ReadBlock >= m_WriteBlock)
{
return(false);
}
return true;
return true;
}
bool AudioPacketizer::GetBuffer(float * ToHere)
bool AudioPacketizer::GetBuffer(float * ToHere)
{
CopyFloat(ToHere, m_pBufferArray[m_ReadBlock & 0x0f], m_PacketSize);
CopyFloat(ToHere, m_pBufferArray[m_ReadBlock & 0x0f], m_PacketSize);
return true;
return true;
}
bool AudioPacketizer::Advance(unsigned long Packets)
{
m_ReadBlock += Packets;
return true;
m_ReadBlock += Packets;
return true;
}
bool AudioPacketizer::Rewind(unsigned long Packets)
{
m_ReadBlock -= Packets;
m_ReadBlock -= Packets;
if(m_ReadBlock<0)
m_ReadBlock = 0;
if(m_ReadBlock<0)
m_ReadBlock = 0;
return true;
return true;
}
bool AudioPacketizer::Reset(void)
{
m_ReadBlock = 0;
m_WriteBlock = 0;
m_OverflowSize = 0;
return true;
m_ReadBlock = 0;
m_WriteBlock = 0;
m_OverflowSize = 0;
return true;
}

View File

@ -6,40 +6,40 @@ class AudioPacketizer
{
protected:
float * m_pMainBuffer;
float * m_pBufferArray[16];
float * m_pMainBuffer;
float * m_pBufferArray[16];
unsigned long m_PacketSize;
unsigned long m_PacketSize;
long m_ReadBlock;
long m_WriteBlock;
long m_ReadBlock;
long m_WriteBlock;
float * m_pOverflowBuffer;
unsigned long m_OverflowSize;
float * m_pOverflowBuffer;
unsigned long m_OverflowSize;
bool m_Finished;
bool m_Finished;
public:
AudioPacketizer(void);
~AudioPacketizer(void);
AudioPacketizer(void);
~AudioPacketizer(void);
bool IsFinished(void)
{
return(m_Finished);
}
bool IsFinished(void)
{
return(m_Finished);
}
bool SetPacketSize(unsigned long Size);
bool SetPacketSize(unsigned long Size);
bool WriteData(float * Data, unsigned long Samples);
bool Finished(void);
bool WriteData(float * Data, unsigned long Samples);
bool Finished(void);
bool IsBufferAvailable(void);
bool GetBuffer(float * ToHere);
bool IsBufferAvailable(void);
bool GetBuffer(float * ToHere);
bool Advance(unsigned long Packets = 1);
bool Rewind(unsigned long Packets);
bool Reset(void);
bool Advance(unsigned long Packets = 1);
bool Rewind(unsigned long Packets);
bool Reset(void);
};
}}} // NS

View File

@ -23,13 +23,13 @@ AudioStream::AudioStream(IAudioSource* source, IAudioOutput* output, Transport*
, track(track)
{
this->output = output;
this->output->SetCallback(this);
this->output->SetCallback(this);
unsigned long srate;
source->GetFormat(&srate, &this->channels);
this->output->SetFormat(srate, this->channels);
unsigned long srate;
source->GetFormat(&srate, &this->channels);
this->output->SetFormat(srate, this->channels);
this->packetizer.SetPacketSize(this->output->GetBlockSize());
this->packetizer.SetPacketSize(this->output->GetBlockSize());
this->streamId = ++AudioStream::streamsCreated;
}
@ -37,16 +37,16 @@ AudioStream::AudioStream(IAudioSource* source, IAudioOutput* output, Transport*
AudioStream::~AudioStream()
{
this->output->Destroy();
this->audioSource->Destroy();
this->audioSource->Destroy();
}
bool AudioStream::SetVolumeScale(float scale)
bool AudioStream::SetVolumeScale(float scale)
{
this->volumeScale = scale;
return true;
this->volumeScale = scale;
return true;
}
bool AudioStream::GetBuffer(float * pAudioBuffer, unsigned long NumSamples)
bool AudioStream::GetBuffer(float * pAudioBuffer, unsigned long NumSamples)
{
boost::mutex::scoped_lock lock(this->mutex);
@ -60,99 +60,99 @@ bool AudioStream::GetBuffer(float * pAudioBuffer, unsigned long NumSamples)
return false;
}
if(this->packetizer.IsFinished())
{
if(!this->mixNotify)
{
if(this->packetizer.IsFinished())
{
if(!this->mixNotify)
{
transport->EventMixpointReached();
this->mixNotify = true;
}
this->isFinished = true;
}
this->mixNotify = true;
}
this->isFinished = true;
}
while(!this->packetizer.IsBufferAvailable())
{
float * pBuffer = NULL;
unsigned long ulNumSamples = 0;
while(!this->packetizer.IsBufferAvailable())
{
float * pBuffer = NULL;
unsigned long ulNumSamples = 0;
if(this->audioSource->GetBuffer(&pBuffer, &ulNumSamples))
{
this->packetizer.WriteData(pBuffer, ulNumSamples);
}
else
{
this->packetizer.Finished();
}
}
if(this->audioSource->GetBuffer(&pBuffer, &ulNumSamples))
{
this->packetizer.WriteData(pBuffer, ulNumSamples);
}
else
{
this->packetizer.Finished();
}
}
if(this->packetizer.GetBuffer(pAudioBuffer))
{
// if we're crossfading
if(this->packetizer.GetBuffer(pAudioBuffer))
{
// if we're crossfading
if(this->fadeState != FadeStateNone)
{
for(unsigned long x=0; x<NumSamples; x+=this->channels)
{
for(unsigned long chan=0; chan<this->channels; chan++)
{
pAudioBuffer[x+chan] *= this->volume;
}
this->volume += this->volumeChange;
this->volume = max(0.0f, min(this->volume, 1.0f));
}
{
for(unsigned long x=0; x<NumSamples; x+=this->channels)
{
for(unsigned long chan=0; chan<this->channels; chan++)
{
pAudioBuffer[x+chan] *= this->volume;
}
this->volume += this->volumeChange;
this->volume = max(0.0f, min(this->volume, 1.0f));
}
if((this->volume == 0.0) || (this->volume == 1.0))
if((this->volume == 0.0) || (this->volume == 1.0))
this->fadeState = FadeStateNone;
}
}
// now apply the volume scale, only if we need to
if(this->volumeScale != 1.0)
{
for(unsigned long x=0; x<NumSamples; x+=this->channels)
{
for(unsigned long chan=0; chan<this->channels; chan++)
{
pAudioBuffer[x+chan] *= this->volumeScale;
}
}
}
// now apply the volume scale, only if we need to
if(this->volumeScale != 1.0)
{
for(unsigned long x=0; x<NumSamples; x+=this->channels)
{
for(unsigned long chan=0; chan<this->channels; chan++)
{
pAudioBuffer[x+chan] *= this->volumeScale;
}
}
}
this->packetizer.Advance();
this->samplesOut += NumSamples;
this->packetizer.Advance();
this->samplesOut += NumSamples;
unsigned long pos = this->PositionMs();
unsigned long len = this->LengthMs();
unsigned long cft = this->GetCrossfadeTime() * 1000;
unsigned long pos = this->PositionMs();
unsigned long len = this->LengthMs();
unsigned long cft = this->GetCrossfadeTime() * 1000;
if(!this->mixNotify)
{
if(!this->mixNotify)
{
if (len <= cft || pos >= (len - cft))
{
this->isLast = !GetActivePlaylistCheckNext();
transport->EventMixpointReached();
this->mixNotify = true;
}
}
else
{
//if at end of last song in playlist but crossfade was the call n seconds ago
//used for repeatnone where this is the end of line.
if(pos >= len && this->isLast)
{
transport->EventPlaybackStoppedOk(this->track);
{
this->isLast = !GetActivePlaylistCheckNext();
transport->EventMixpointReached();
this->mixNotify = true;
}
}
else
{
//if at end of last song in playlist but crossfade was the call n seconds ago
//used for repeatnone where this is the end of line.
if(pos >= len && this->isLast)
{
transport->EventPlaybackStoppedOk(this->track);
this->playState = PlayStateStopped;
}
}
}
}
return true;
}
return true;
}
return false;
return false;
}
bool AudioStream::Start()
{
if (this->output->Start())
if (this->output->Start())
{
this->playState = PlayStatePlaying;
return true;
@ -199,20 +199,20 @@ bool AudioStream::Resume()
return true;
}
unsigned long AudioStream::LengthMs() const
unsigned long AudioStream::LengthMs() const
{
unsigned long length;
unsigned long length;
if(this->audioSource->GetLength(&length))
return length;
if(this->audioSource->GetLength(&length))
return length;
return AudioStream::UnknownLength;
}
unsigned long AudioStream::PositionMs() const
unsigned long AudioStream::PositionMs() const
{
unsigned long msOutput = ((float)this->samplesOut / (((float)this->output->GetSampleRate()/1000.0f) * (float)this->output->GetChannels()));
return msOutput;
unsigned long msOutput = ((float)this->samplesOut / (((float)this->output->GetSampleRate()/1000.0f) * (float)this->output->GetChannels()));
return msOutput;
}
bool AudioStream::SetPositionMs(unsigned long ms)
@ -220,24 +220,24 @@ bool AudioStream::SetPositionMs(unsigned long ms)
boost::mutex::scoped_lock lock(this->mutex);
if(this->fadeState != FadeStateNone)
{
this->volume = 1.0;
{
this->volume = 1.0;
this->fadeState = FadeStateNone;
}
}
unsigned long Pos = ms;
unsigned long Pos = ms;
if(this->audioSource->SetPosition(&Pos))
{
this->samplesOut = Pos * (((float)this->output->GetSampleRate()/1000.0f) * (float)this->output->GetChannels());
if(this->audioSource->SetPosition(&Pos))
{
this->samplesOut = Pos * (((float)this->output->GetSampleRate()/1000.0f) * (float)this->output->GetChannels());
this->packetizer.Reset();
this->output->Reset();
this->packetizer.Reset();
this->output->Reset();
return true;
}
return true;
}
return false;
return false;
}
utfstring AudioStream::ToString() const

View File

@ -8,12 +8,12 @@ class IAudioSource
{
protected: virtual ~IAudioSource() {};
public: virtual void Destroy() = 0;
public: virtual bool GetLength(unsigned long * MS) = 0;
public: virtual bool SetPosition(unsigned long * MS) = 0;// upon calling, *MS is the position to seek to, on return set it to the actual offset we seeked to
public: virtual bool SetState(unsigned long State) = 0;
public: virtual bool GetFormat(unsigned long * SampleRate, unsigned long * Channels) = 0;
public: virtual bool GetBuffer(float ** ppBuffer, unsigned long * NumSamples) = 0; // return false to signal that we are done decoding.
public: virtual void Destroy() = 0;
public: virtual bool GetLength(unsigned long * MS) = 0;
public: virtual bool SetPosition(unsigned long * MS) = 0;// upon calling, *MS is the position to seek to, on return set it to the actual offset we seeked to
public: virtual bool SetState(unsigned long State) = 0;
public: virtual bool GetFormat(unsigned long * SampleRate, unsigned long * Channels) = 0;
public: virtual bool GetBuffer(float ** ppBuffer, unsigned long * NumSamples) = 0; // return false to signal that we are done decoding.
public: virtual bool Open(const utfchar* source) = 0;
public: virtual const utfchar* GetSource() const = 0; // TODO: remove?

View File

@ -179,15 +179,15 @@ bool Transport::Resume()
void Transport::SetTrackPosition(unsigned long position)
{
try
{
try
{
AudioStream* stream = this->openStreams.at(0);
stream->SetPositionMs(position);
}
catch(...)
{
}
}
catch(...)
{
}
}
unsigned long Transport::TrackPosition() const
@ -230,17 +230,17 @@ size_t Transport::NumOfStreams() const
AudioStreamOverview Transport::StreamsOverview() const
{
AudioStreamOverview overview;
AudioStreamOverview overview;
for(std::vector<AudioStream*>::const_iterator it = this->openStreams.begin()
;it != this->openStreams.end()
;it++
)
for(std::vector<AudioStream*>::const_iterator it = this->openStreams.begin()
;it != this->openStreams.end()
;it++
)
{
overview.push_back((*it)->ToString());
overview.push_back((*it)->ToString());
}
return overview;
return overview;
}
AudioStream* Transport::CreateStream(TrackPtr trackPtr)
@ -273,10 +273,10 @@ AudioStream* Transport::CreateStream(TrackPtr trackPtr)
if (it != this->registeredSourceSuppliers.end() && supplier)
{
audioSource = supplier->CreateAudioSource();
if (audioSource != NULL && audioSource->Open(filePath))
{
audioStream = new AudioStream(audioSource, audioOutput, this, trackPtr);
{
audioStream = new AudioStream(audioSource, audioOutput, this, trackPtr);
}
}

View File

@ -95,7 +95,7 @@ public:
///\brief Get the number of open streams
size_t NumOfStreams() const;
///\brief Get a list with descriptions of the open streams
AudioStreamOverview StreamsOverview() const;
AudioStreamOverview StreamsOverview() const;
private:
typedef std::vector<boost::shared_ptr<IAudioSourceSupplier> > SourceSupplierList;

View File

@ -88,10 +88,10 @@ typedef unsigned int DBTIME;
#define UTF(x) _T(x)
//////////////////////////////////////////
///\brief
///utfchar is either a char or a utfchar depending on system.
//////////////////////////////////////////
typedef wchar_t utfchar;
///\brief
///utfchar is either a char or a utfchar depending on system.
//////////////////////////////////////////
typedef wchar_t utfchar;
// Boost specific
namespace boost{
@ -104,9 +104,9 @@ typedef unsigned int DBTIME;
}
//////////////////////////////////////////
///\brief
///utfstringstream is the stringstream for utfchar & utfstring
//////////////////////////////////////////
///\brief
///utfstringstream is the stringstream for utfchar & utfstring
//////////////////////////////////////////
namespace std
{
typedef wstringstream utfstringstream;
@ -118,9 +118,9 @@ typedef unsigned int DBTIME;
#undef UTF_WIDECHAR
//////////////////////////////////////////
///\brief
///utfchar is either a char or a utfchar depending on system.
//////////////////////////////////////////
///\brief
///utfchar is either a char or a utfchar depending on system.
//////////////////////////////////////////
typedef char utfchar;
//////////////////////////////////////////
@ -145,9 +145,9 @@ typedef unsigned int DBTIME;
//////////////////////////////////////////
///\brief
///utfstringstream is the stringstream for utfchar & utfstring
//////////////////////////////////////////
///\brief
///utfstringstream is the stringstream for utfchar & utfstring
//////////////////////////////////////////
namespace std
{
typedef stringstream utfstringstream;

View File

@ -45,22 +45,22 @@ namespace musik{ namespace core{ namespace db{
class Statement;
//////////////////////////////////////////
///\brief
///Same as Statement, but keeps the statement in a cache when destructed
///
///Be careful using this class only on "static" SQL statement
///\brief
///Same as Statement, but keeps the statement in a cache when destructed
///
///Be careful using this class only on "static" SQL statement
///This means that you should not use this on statements looking like
///this: CacheStatement("SELECT * FROM mytable WHERE id="+id,db);
///since the cache will grow for each id in this example
///since the cache will grow for each id in this example
///
///Instead, do like this:
///CacheStatement("SELECT * FROM mytable WHERE id=?",db);
///And use the BindInt to set the id
///
///\see
///
///\see
///musik::core::db::Statement
//////////////////////////////////////////
class CachedStatement : public Statement{
//////////////////////////////////////////
class CachedStatement : public Statement{
public:
CachedStatement(const char* sql,Connection &connection);
~CachedStatement();

View File

@ -50,12 +50,12 @@ namespace musik{ namespace core{ namespace db{
//////////////////////////////////////////
///\brief
///Database Wrapper
///
///A Connection to the database
//////////////////////////////////////////
class Connection : boost::noncopyable{
///\brief
///Database Wrapper
///
///A Connection to the database
//////////////////////////////////////////
class Connection : boost::noncopyable{
public:
Connection();
~Connection();

View File

@ -47,9 +47,9 @@ namespace musik{ namespace core{ namespace db{
class Connection;
//////////////////////////////////////////
///\brief
///ScopedTransaction is used to make transactions easier
///
///\brief
///ScopedTransaction is used to make transactions easier
///
///Usage like this:
///\code
///{
@ -57,11 +57,11 @@ namespace musik{ namespace core{ namespace db{
/// //everything in this scope is included in the transation
///}
///\endcode
///
///\remarks
///Nested transations are partially supported. First scope is the one deciding when transaction is commited.
//////////////////////////////////////////
class ScopedTransaction : boost::noncopyable{
///
///\remarks
///Nested transations are partially supported. First scope is the one deciding when transaction is commited.
//////////////////////////////////////////
class ScopedTransaction : boost::noncopyable{
public:
ScopedTransaction(Connection &connection);
~ScopedTransaction();

View File

@ -49,10 +49,10 @@ namespace musik{ namespace core{ namespace db{
//////////////////////////////////////////
///\brief
///Class for precompiling SQL statements
//////////////////////////////////////////
class Statement : boost::noncopyable{
///\brief
///Class for precompiling SQL statements
//////////////////////////////////////////
class Statement : boost::noncopyable{
public:
Statement(const char* sql,Connection &connection);
virtual ~Statement();

View File

@ -49,10 +49,10 @@
namespace musik{ namespace core{ namespace db{
//////////////////////////////////////////
///\brief
///The ReturnCode is used by several method to return the status of a execution
//////////////////////////////////////////
enum ReturnCode : int{
///\brief
///The ReturnCode is used by several method to return the status of a execution
//////////////////////////////////////////
enum ReturnCode : int{
OK = SQLITE_OK,
Row = SQLITE_ROW,
Done = SQLITE_DONE,

View File

@ -83,30 +83,30 @@ uistring TracklistModel::CellValueToString(int rowIndex, ColumnRef co
if(!track){
return _T("");
}else{
const utfchar *value = track->GetValue(tracklistColumn->metaKey.c_str());
const utfchar *value = track->GetValue(tracklistColumn->metaKey.c_str());
if(value)
{
if (tracklistColumn->metaKey == "duration")
{
UINT64 duration = boost::lexical_cast<int>(value);
UINT64 days(duration/86400);
duration = duration%86400;
UINT64 hours(duration/3600);
duration = duration%3600;
UINT64 minutes(duration/60);
duration = duration%60;
utfstring result;
if (minutes < 10)
result += _T("0");
result += boost::lexical_cast<utfstring>(minutes) + _T(":");
if (duration < 10)
result += _T("0");
result += boost::lexical_cast<utfstring>(duration);
return win32cpp::Escape(result);
}
return win32cpp::Escape(value);
{
if (tracklistColumn->metaKey == "duration")
{
UINT64 duration = boost::lexical_cast<int>(value);
UINT64 days(duration/86400);
duration = duration%86400;
UINT64 hours(duration/3600);
duration = duration%3600;
UINT64 minutes(duration/60);
duration = duration%60;
utfstring result;
if (minutes < 10)
result += _T("0");
result += boost::lexical_cast<utfstring>(minutes) + _T(":");
if (duration < 10)
result += _T("0");
result += boost::lexical_cast<utfstring>(duration);
return win32cpp::Escape(result);
}
return win32cpp::Escape(value);
}
}
return _T("");
}

View File

@ -147,15 +147,15 @@ void TransportController::OnTrackChange(musik::core::TrackPtr track){
win32cpp::uistring title(_T("-"));
win32cpp::uistring artist(_T("-"));
if(track){
if(track){
if(track->GetValue("title"))
title.assign( track->GetValue("title") );
if(track->GetValue("title"))
title.assign( track->GetValue("title") );
if(track->GetValue("visual_artist"))
artist.assign( track->GetValue("visual_artist") );
if(track->GetValue("visual_artist"))
artist.assign( track->GetValue("visual_artist") );
}
}
this->transportView.titleLabel->SetCaption(title);
this->transportView.artistLabel->SetCaption(artist);