Added the sf::Time class
This commit is contained in:
parent
e775bd0169
commit
4116ad033c
58 changed files with 880 additions and 227 deletions
|
@ -20,9 +20,9 @@ void PlaySound()
|
|||
|
||||
// Display sound informations
|
||||
std::cout << "canary.wav :" << std::endl;
|
||||
std::cout << " " << buffer.GetDuration() / 1000.f << " seconds" << std::endl;
|
||||
std::cout << " " << buffer.GetSampleRate() << " samples / sec" << std::endl;
|
||||
std::cout << " " << buffer.GetChannelCount() << " channels" << std::endl;
|
||||
std::cout << " " << buffer.GetDuration().AsSeconds() << " seconds" << std::endl;
|
||||
std::cout << " " << buffer.GetSampleRate() << " samples / sec" << std::endl;
|
||||
std::cout << " " << buffer.GetChannelCount() << " channels" << std::endl;
|
||||
|
||||
// Create a sound instance and play it
|
||||
sf::Sound sound(buffer);
|
||||
|
@ -32,10 +32,10 @@ void PlaySound()
|
|||
while (sound.GetStatus() == sf::Sound::Playing)
|
||||
{
|
||||
// Leave some CPU time for other processes
|
||||
sf::Sleep(100);
|
||||
sf::Sleep(sf::Milliseconds(100));
|
||||
|
||||
// Display the playing position
|
||||
std::cout << "\rPlaying... " << std::fixed << std::setprecision(2) << sound.GetPlayingOffset() / 1000.f << " sec ";
|
||||
std::cout << "\rPlaying... " << std::fixed << std::setprecision(2) << sound.GetPlayingOffset().AsSeconds() << " sec ";
|
||||
std::cout << std::flush;
|
||||
}
|
||||
std::cout << std::endl << std::endl;
|
||||
|
@ -55,9 +55,9 @@ void PlayMusic()
|
|||
|
||||
// Display music informations
|
||||
std::cout << "orchestral.ogg :" << std::endl;
|
||||
std::cout << " " << music.GetDuration() / 1000.f << " seconds" << std::endl;
|
||||
std::cout << " " << music.GetSampleRate() << " samples / sec" << std::endl;
|
||||
std::cout << " " << music.GetChannelCount() << " channels" << std::endl;
|
||||
std::cout << " " << music.GetDuration().AsSeconds() << " seconds" << std::endl;
|
||||
std::cout << " " << music.GetSampleRate() << " samples / sec" << std::endl;
|
||||
std::cout << " " << music.GetChannelCount() << " channels" << std::endl;
|
||||
|
||||
// Play it
|
||||
music.Play();
|
||||
|
@ -66,10 +66,10 @@ void PlayMusic()
|
|||
while (music.GetStatus() == sf::Music::Playing)
|
||||
{
|
||||
// Leave some CPU time for other processes
|
||||
sf::Sleep(100);
|
||||
sf::Sleep(sf::Milliseconds(100));
|
||||
|
||||
// Display the playing position
|
||||
std::cout << "\rPlaying... " << std::fixed << std::setprecision(2) << music.GetPlayingOffset() / 1000.f << " sec ";
|
||||
std::cout << "\rPlaying... " << std::fixed << std::setprecision(2) << music.GetPlayingOffset().AsSeconds() << " sec ";
|
||||
std::cout << std::flush;
|
||||
}
|
||||
std::cout << std::endl;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue