本文整理汇总了C++中SoundPlayer::setMultiPlay方法的典型用法代码示例。如果您正苦于以下问题:C++ SoundPlayer::setMultiPlay方法的具体用法?C++ SoundPlayer::setMultiPlay怎么用?C++ SoundPlayer::setMultiPlay使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SoundPlayer
的用法示例。
在下文中一共展示了SoundPlayer::setMultiPlay方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setup
//--------------------------------------------------------------
void SoundManager::setup(ofxXmlSettings& settings)
{
m_driver = settings.getValue("murmur:soundOutput:driver", 0);
printf("- setting sound output driver [%d]\n", m_driver);
ofFmodSelectDriver(m_driver);
m_driver = ofFmodGetDriverSelected();
printf("- selected driver is [%d]\n", m_driver);
int nbOutputs = settings.getValue("murmur:soundOutput:nbSpeakers", 2);
printf("- setting sound output for %d speakers\n", nbOutputs);
ofFmodSetNumOutputs( nbOutputs );
settings.pushTag("murmur");
settings.pushTag("soundOutput");
settings.pushTag("soundMain");
int nbSpeakers = settings.getNumTags("speaker");
mp_soundMainSpeakers = new int[nbSpeakers];
for (int i=0;i<nbSpeakers;i++)
{
mp_soundMainSpeakers[i] = settings.getValue("speaker",0,i);
printf("- adding for sound main speaker [%d]\n", i);
}
m_nbSoundMainSpeakers = nbSpeakers;
settings.popTag();
settings.popTag();
string soundMainFile = settings.getAttribute("murmur:soundOutput:soundMain","file", "main.wav");
printf("- sound main is [%s]\n", soundMainFile.c_str());
ofDirectory dirSounds("Sounds");
if (dirSounds.exists())
{
dirSounds.listDir();
printf("DIR %s [%d file(s)]\n", dirSounds.path().c_str(),dirSounds.size());
vector<ofFile> files = dirSounds.getFiles();
vector<ofFile>::iterator it;
for (it = files.begin(); it != files.end(); ++it)
{
if ((*it).getExtension() == "mp3" || (*it).getExtension() == "wav")
{
string filename = (*it).getFileName();
printf("- [%s]\n", filename.c_str());
SoundPlayer* pSoundPlayer = new SoundPlayer(filename);
pSoundPlayer->loadSound( "Sounds/"+filename );
pSoundPlayer->setLoop(false);
pSoundPlayer->setMultiPlay(true);
m_listSoundPlayer.push_back( pSoundPlayer );
}
}
}
mp_soundMain = getSoundPlayer(soundMainFile);
}
示例2: setup
//--------------------------------------------------------------
void SoundManager::setup(ofxXmlSettings& settings)
{
OFAPPLOG->begin("SoundManager::setup()");
m_driver = settings.getValue("murmur:soundOutput:driver", 0);
OFAPPLOG->println(" - setting sound output driver ["+ofToString(m_driver)+"]");
ofFmodSelectDriver(m_driver);
m_driver = ofFmodGetDriverSelected();
OFAPPLOG->println(" - selected driver is "+ofToString(m_driver));
int nbOutputs = settings.getValue("murmur:soundOutput:nbSpeakers", 2);
OFAPPLOG->println(" - setting sound output for "+ofToString(nbOutputs)+" speaker(s)");
ofFmodSetNumOutputs( nbOutputs );
settings.pushTag("murmur");
settings.pushTag("soundOutput");
settings.pushTag("soundMain");
int nbSpeakers = settings.getNumTags("speaker");
mp_soundMainSpeakers = new int[nbSpeakers];
for (int i=0;i<nbSpeakers;i++)
{
mp_soundMainSpeakers[i] = settings.getValue("speaker",0,i);
OFAPPLOG->println(" - adding for sound main speaker ["+ofToString(i)+"]");
}
m_nbSoundMainSpeakers = nbSpeakers;
settings.popTag();
settings.popTag();
string soundMainFile = settings.getAttribute("murmur:soundOutput:soundMain","file", "main.wav");
OFAPPLOG->println(" - sound main is '"+soundMainFile+"'");
ofDirectory dirSounds("Sounds");
if (dirSounds.exists())
{
dirSounds.listDir();
OFAPPLOG->println(" - DIR is '"+dirSounds.path()+"' ["+ofToString(dirSounds.size())+" file(s)]");
vector<ofFile> files = dirSounds.getFiles();
vector<ofFile>::iterator it;
string strFileNames = "";
string strFileNamesSep = "";
for (it = files.begin(); it != files.end(); ++it)
{
if ((*it).getExtension() == "mp3" || (*it).getExtension() == "wav")
{
string filename = (*it).getFileName();
strFileNames += strFileNamesSep + filename;
SoundPlayer* pSoundPlayer = new SoundPlayer(filename);
pSoundPlayer->loadSound( "Sounds/"+filename );
pSoundPlayer->setLoop(false);
pSoundPlayer->setMultiPlay(true);
m_listSoundPlayer.push_back( pSoundPlayer );
strFileNamesSep = ", ";
}
}
OFAPPLOG->println(" - FILES are '"+strFileNames+"'");
}
mp_soundMain = getSoundPlayer(soundMainFile);
OFAPPLOG->end();
}