本文整理汇总了C++中sf::Music::getStatus方法的典型用法代码示例。如果您正苦于以下问题:C++ Music::getStatus方法的具体用法?C++ Music::getStatus怎么用?C++ Music::getStatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sf::Music
的用法示例。
在下文中一共展示了Music::getStatus方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tick
static void tick()
{
if(currently_playing.getStatus() == sf::SoundSource::Stopped)
{
current_song++;
swap_to_song_type(ROUND_GENERAL);
}
}
示例2: HandleSound
void HandleSound(){
/* Handle sound_queue and music */
if( SoundFx.getStatus() == 0 ){ //status : STOPPED
if( !sound_queue.empty() ){
SoundFx.openFromFile( *sound_queue.front() );
SoundFx.play();
sound_queue.pop();
}
}
if( ::SoundMusic.getStatus() == 0 && now_log -> music_path.size() != 0 ){
::SoundMusic.play();
}
}
示例3: swap_to_song_type
static void swap_to_song_type(music_purpose new_purpose)
{
if(new_purpose == NONE)
{
currently_playing.stop();
current_song = -1;
return;
}
///at the moment do shit
int new_song = -1;
for(int i=0; i<(int)file_names.size(); i++)
{
int song_offset = (i + current_song) % file_names.size();
music_purpose current_purpose = (music_purpose)purpose[song_offset];
if((current_purpose & new_purpose) > 0)
{
new_song = song_offset;
break;
}
}
if(new_song == -1)
return;
if(new_song == current_song && currently_playing.getStatus() != sf::SoundSource::Stopped)
return;
currently_playing.stop();
currently_playing.openFromFile("res/" + file_names[new_song]);
currently_playing.play();
current_song = new_song;
}
示例4: tick
void ambiance::tick(int madness)
{
ambMadness = 101-madness;
ambMaxVolume = 100;
// SO THE ENGINE BEGINS //
// IF NOT PLAYING AA ///////////////////////////////////////////////////
if (ALLambAA[ambAARandom].getStatus() == 0)
{
// FILE SELECTOR //
ambAARandom = rand()% ARRAY_SIZE(ambAAFile);
//ALLambAA[ambAARandom].openFromFile(ambAAFile[ambAARandom]);
// VOLUME RESET //
ALLambAA[ambAARandom].setVolume(0);
ambAAVolume = 0;
ambAADynamics = 100000;
// LENGTH //
ambAALength = rand() % 60 + 40;
ambAASecCounter = 0;
// FADE //
ambAAFadeSpeed = rand()% 2 + 3;
ambAAFadeOut = false;
// PITCH //
ambAAPitch = rand() % 100;
ambAAPitch = ambAAPitch/200+0.75;
ALLambAA[ambAARandom].setPitch(ambAAPitch);
// PLAY //
ALLambAA[ambAARandom].play();
}
// IF NOT PLAYING AB /////////////////////////////////////////////////////////
if (ALLambAB[ambABRandom].getStatus() == 0)
{
// FILE SELECTOR //
ambABRandom = rand()% ARRAY_SIZE(ambABFile);
//ALLambAB[ambABRandom].openFromFile(ambABFile[ambABRandom]);
// VOLUME RESET //
ALLambAB[ambABRandom].setVolume(0);
ambABVolume = 0;
ambABDynamics = 100000;
// LENGTH //
ambABLength = rand() % 30 + 30;
ambABSecCounter = 0;
// FADE //
ambABFadeSpeed = rand()% 2 + 3;
ambABFadeOut = false;
// PITCH //
ambABPitch = rand() % 100;
ambABPitch = ambABPitch/200+0.75;
ALLambAB[ambABRandom].setPitch(ambABPitch);
// PLAY //
ALLambAB[ambABRandom].play();
}
// FADE AA ////////////////////////////////////////////////////////////////
// COUNTERS //
ambAAFrameCounter++;
if (ambAAFrameCounter>60)
{
ambAAFrameCounter = 0;
ambAASecCounter++;
}
// FADE //
if (ALLambAB[ambABRandom].getStatus() == 2)
{
ambAADynamics = 10000*(ambMadness*0.25/100) + 2500;
// FADE VOLUME UP //
if (ambAAVolume + ambAAFadeSpeed < ambAADynamics && ambAAFadeOut == false)
{
ambAAVolume = ambAAVolume + ambAAFadeSpeed;
ambAAIntToFloat = ambAAVolume;
ALLambAA[ambAARandom].setVolume(ambAAIntToFloat/100*(ambMaxVolume/100));
}
// FADE VOLUME DOWN //
else if (ambAAVolume > ambAADynamics && ambAAFadeOut == false)
{
ambAAVolume = ambAAVolume - ambAAFadeSpeed*2;
//.........这里部分代码省略.........