本文整理汇总了C++中SoundManager::SetMute方法的典型用法代码示例。如果您正苦于以下问题:C++ SoundManager::SetMute方法的具体用法?C++ SoundManager::SetMute怎么用?C++ SoundManager::SetMute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SoundManager
的用法示例。
在下文中一共展示了SoundManager::SetMute方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main ()
{
printf ("Results of test 'test':\n");
try
{
Timer timer (bind (&Application::Exit, 0), TEST_WORK_TIME);
srand ((unsigned int)time (NULL));
SoundManager manager ("OpenAL", "*");
Listener listener;
Emitter emitter;
emitter.SetSource ("declaration1");
emitter.SetSampleIndex (rand ());
/*
Testing basic manager properties
*/
printf ("Initial volume = %f,", manager.Volume ());
manager.SetVolume (0.7f);
printf (" new volume = %f.\n", manager.Volume ());
printf ("Initial mute: "); print (manager.IsMuted ());
manager.SetMute (true);
printf ("Mute: "); print (manager.IsMuted ());
manager.SetMute (false);
printf ("Mute: "); print (manager.IsMuted ());
printf ("Initial listener status: "); print (manager.Listener ());
listener.position = vec3f (0.f, 1.f, 0.f);
listener.direction = vec3f (0.f, 0.f, 1.f);
listener.up = vec3f (0.f, -1.f, 0.f);
listener.velocity = vec3f (1.f, 0.f, 0.f);
manager.SetListener (listener);
printf ("New listener status: "); print (manager.Listener ());
manager.LoadSoundLibrary (library_file);
/*
Testing basic emitter properties
*/
printf ("Emitter source - %s\n", emitter.Source ());
printf ("Initial emitter volume = %f,", emitter.Volume ());
emitter.SetVolume (0.9f);
printf (" new emitter volume = %f.\n", emitter.Volume ());
printf ("Initial position: "); print (emitter.Position ());
printf ("\nInitial direction: "); print (emitter.Direction ());
printf ("\nInitial velocity: "); print (emitter.Velocity ());
emitter.SetPosition (vec3f (-50.f, 2.f, 4.f));
emitter.SetDirection (vec3f (-2.f, -2.f, -4.f));
emitter.SetVelocity (vec3f (0.f, 0.f, 0.1f));
printf ("\nNew position: "); print (emitter.Position ());
printf ("\nNew direction: "); print (emitter.Direction ());
printf ("\nNew velocity: "); print (emitter.Velocity ()); printf ("\n");
/*
Testing manager work
*/
manager.PlaySound (emitter, 0.3f);
printf ("Current offset in seconds = %f\n", manager.Tell (emitter));
printf ("Duration in seconds = %f\n", manager.Duration (emitter));
printf ("Looping = %c\n", manager.IsLooping (emitter) ? 'y' : 'n');
printf ("Is Playing = %c\n", manager.IsPlaying (emitter) ? 'y' : 'n');
Timer timer2 (bind (&TimerHandler, ref (emitter)), ACTION_TIME);
Application::Run ();
}
catch (std::exception& exception)
{
printf ("exception: %s\n",exception.what ());
}
catch (...)
{
printf ("unknown exception\n");
}
printf ("exit\n");
return Application::GetExitCode ();
}