本文整理汇总了C++中AudioPlayer::getCurrentSong方法的典型用法代码示例。如果您正苦于以下问题:C++ AudioPlayer::getCurrentSong方法的具体用法?C++ AudioPlayer::getCurrentSong怎么用?C++ AudioPlayer::getCurrentSong使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AudioPlayer
的用法示例。
在下文中一共展示了AudioPlayer::getCurrentSong方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: paintCell
void PlaylistComponent::paintCell( Graphics& g, int rowNumber, int columnId, int width, int height, bool rowIsSelected )
{
AudioPlayer* player = AudioPlayer::getInstance();
std::shared_ptr<Playlist> playlist = player->getPlaylist();
std::shared_ptr<PlaylistEntry> playlistEntry = playlist->getEntry(rowNumber);
if(playlistEntry)
{
g.setColour(Colours::black);
std::shared_ptr<SongInfo> songInfo = playlistEntry->getSongInfo();
if(songInfo == player->getCurrentSong())
g.setFont(_boldfont);
else
g.setFont(_font);
switch(columnId)
{
case 1:
g.drawText(songInfo->getTitle(), 2, 0, width - 4, height, Justification::centredLeft, true);
break;
case 2:
g.drawText(songInfo->getArtist(), 2, 0, width - 4, height, Justification::centredLeft, true);
break;
case 3:
int seconds = songInfo->getLengthSeconds();
if(seconds > 0)
{
const String s = String::formatted("%d:%02d", (seconds / 60), (seconds % 60) );
g.drawText(s, 2, 0, width - 4, height, Justification::centredRight, true);
}
break;
}
}
//g.setColour (Colours::black.withAlpha (0.2f));
//g.fillRect (width - 1, 0, 1, height);
}