本文整理汇总了C++中SoundPtr::setFile方法的典型用法代码示例。如果您正苦于以下问题:C++ SoundPtr::setFile方法的具体用法?C++ SoundPtr::setFile怎么用?C++ SoundPtr::setFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SoundPtr
的用法示例。
在下文中一共展示了SoundPtr::setFile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TutorialCollisionListener
TutorialCollisionListener(Path SoundFilePath)
{
_CollisionSound = SoundManager::the()->createSound();
beginEditCP(_CollisionSound, Sound::FileFieldMask | Sound::VolumeFieldMask | Sound::StreamingFieldMask | Sound::LoopingFieldMask);
_CollisionSound->setFile(SoundFilePath);
_CollisionSound->setVolume(1.0);
_CollisionSound->setStreaming(false);
_CollisionSound->setLooping(0);
endEditCP(_CollisionSound, Sound::FileFieldMask | Sound::VolumeFieldMask | Sound::StreamingFieldMask | Sound::LoopingFieldMask);
}
示例2: main
//.........这里部分代码省略.........
NodePtr TorusGeometryNode = makeTorus(.5, 2, 16, 16);
// Make Main Scene Node and add the Torus
scene = osg::Node::create();
beginEditCP(scene, Node::CoreFieldMask | Node::ChildrenFieldMask);
scene->setCore(osg::Group::create());
scene->addChild(TorusGeometryNode);
endEditCP(scene, Node::CoreFieldMask | Node::ChildrenFieldMask);
// Create the Graphics
GraphicsPtr TutorialGraphics = osg::Graphics2D::create();
// Initialize the LookAndFeelManager to enable default settings
LookAndFeelManager::the()->getLookAndFeel()->init();
LayoutPtr MainInternalWindowLayout = osg::FlowLayout::create();
PanelPtr CaptionContainer = osg::Panel::create();
beginEditCP(CaptionContainer, Panel::PreferredSizeFieldMask | Panel::LayoutFieldMask);
CaptionContainer->setPreferredSize(Pnt2f(250.0,30.0));
CaptionContainer->setLayout(MainInternalWindowLayout);
endEditCP(CaptionContainer, Panel::PreferredSizeFieldMask | Panel::LayoutFieldMask);
//Initialize the Sound Manager
SoundManager::the()->attachUpdateProducer(TutorialWindowEventProducer);
TutorialSound = SoundManager::the()->createSound();
beginEditCP(TutorialSound, Sound::FileFieldMask | Sound::VolumeFieldMask | Sound::StreamingFieldMask | Sound::LoopingFieldMask);
TutorialSound->setFile(Path("./Data/captionSoundFile.ogg"));
TutorialSound->setVolume(1.0);
TutorialSound->setStreaming(true);
TutorialSound->setLooping(0);
endEditCP(TutorialSound, Sound::FileFieldMask | Sound::VolumeFieldMask | Sound::StreamingFieldMask | Sound::LoopingFieldMask);
// Create the Caption
TutorialCaption = osg::Caption::create();
//Add the segments of text to be displayed
TutorialCaption->captionSegment("Listeners can be used for a variety",1.7,3.4);
TutorialCaption->captionSegment("of different applications.",3.4,4.7);
TutorialCaption->captionSegment("In this tutorial we will",5.0,6.35);
TutorialCaption->captionSegment("simply be changing the background though.",6.35,8.0);
TutorialCaption->captionSegment("First we will change the",8.8,10.2);
TutorialCaption->captionSegment("torus on screen to a sphere.",10.2,11.75);
TutorialCaption->captionSegment("By timing things correctly we can make",12.7,14.6);
TutorialCaption->captionSegment("the changes right as the word is spoken.",14.6,16.75);
TutorialCaption->captionSegment("Such as changing the sphere to a cube",17.3,20.0);
TutorialCaption->captionSegment("but personally I would prefer",20.33,21.65);
TutorialCaption->captionSegment("the background to be blank.",21.65,22.8);
TutorialCaption->captionSegment("Much better!",23.8,25.0);
//Add the tutorial Caption Listener to the Caption that was set up for the tutorial
TutorialCaptionListener TheCaptionListener;
TutorialCaption->addCaptionListener(&TheCaptionListener);
//Create the Caption component Generator
TutorialCapGen = DefaultCaptionComponentGenerator::create();
TutorialCaption->attachWindowEventProducer(TutorialWindowEventProducer);
beginEditCP(TutorialCaption, Caption::ParentContainerFieldMask | Caption::ComponentGeneratorFieldMask | Caption::CaptionDialogSoundFieldMask);