本文整理汇总了C++中SoundManager::LoadSound方法的典型用法代码示例。如果您正苦于以下问题:C++ SoundManager::LoadSound方法的具体用法?C++ SoundManager::LoadSound怎么用?C++ SoundManager::LoadSound使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SoundManager
的用法示例。
在下文中一共展示了SoundManager::LoadSound方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateMateials
void CreateMateials (NewtonWorld* world, SceneManager* sceneManager)
{
SoundManager* sndManager;
sndManager = sceneManager->GetSoundManager();
// create the Material IDs,
g_floorMaterial = NewtonMaterialCreateGroupID (world);
g_woodMaterial = NewtonMaterialCreateGroupID (world);
g_metalMaterial = NewtonMaterialCreateGroupID (world);
// load the sound effects
woodOnFloor.m_sound = sndManager->LoadSound ("boxHit.wav");
woodOnFloor.m_manager = sndManager;
metalOnFloor.m_sound = sndManager->LoadSound ("metal.wav");
metalOnFloor.m_manager = sndManager;
woodOnMetal.m_sound = sndManager->LoadSound ("metalBox.wav");
woodOnMetal.m_manager = sndManager;
metalOnMetal.m_sound = sndManager->LoadSound ("metalMetal.wav");
metalOnMetal.m_manager = sndManager;
woodOnWood.m_sound = sndManager->LoadSound ("boxBox.wav");
woodOnWood.m_manager = sndManager;
//configure the Material interactions
NewtonMaterialSetCollisionCallback (world, g_woodMaterial, g_floorMaterial, &woodOnFloor, NULL, GenericContactProcess);
NewtonMaterialSetCollisionCallback (world, g_metalMaterial, g_floorMaterial, &metalOnFloor, NULL, GenericContactProcess);
NewtonMaterialSetCollisionCallback (world, g_metalMaterial, g_woodMaterial, &woodOnMetal, NULL, GenericContactProcess);
NewtonMaterialSetCollisionCallback (world, g_woodMaterial, g_woodMaterial, &woodOnWood, NULL, GenericContactProcess);
NewtonMaterialSetCollisionCallback (world, g_metalMaterial, g_metalMaterial, &metalOnMetal, NULL, GenericContactProcess);
}
示例2: CreateScene
void CreateScene (NewtonWorld* world, SceneManager* sceneManager)
{
Entity* floor;
NewtonCollision* shape;
NewtonBody* floorBody;
void* materialManager;
SoundManager* sndManager;
PhysicsMaterialInteration matInterations;
sndManager = sceneManager->GetSoundManager();
// Create the material for this scene, and attach it to the Newton World
materialManager = CreateMaterialManager (world, sndManager);
// add the Material table
matInterations.m_restitution = 0.6f;
matInterations.m_staticFriction = 0.6f;
matInterations.m_kineticFriction = 0.3f;
matInterations.m_scrapingSound = NULL;
matInterations.m_impactSound = sndManager->LoadSound ("metalMetal.wav");
AddMaterilInteraction (materialManager, m_metal, m_metal, &matInterations);
matInterations.m_impactSound = sndManager->LoadSound ("boxBox.wav");
AddMaterilInteraction (materialManager, m_wood, m_wood, &matInterations);
matInterations.m_impactSound = sndManager->LoadSound ("metalBox.wav");
AddMaterilInteraction (materialManager, m_metal, m_wood, &matInterations);
matInterations.m_impactSound = sndManager->LoadSound ("grass0.wav");
AddMaterilInteraction (materialManager, m_wood, m_grass, &matInterations);
matInterations.m_impactSound = sndManager->LoadSound ("boxHit.wav");
AddMaterilInteraction (materialManager, m_wood, m_bricks, &matInterations);
matInterations.m_impactSound = sndManager->LoadSound ("grass1.wav");
AddMaterilInteraction (materialManager, m_metal, m_grass, &matInterations);
AddMaterilInteraction (materialManager, m_grass, m_bricks, &matInterations);
matInterations.m_impactSound = sndManager->LoadSound ("metal.wav");
AddMaterilInteraction (materialManager, m_metal, m_bricks, &matInterations);
AddMaterilInteraction (materialManager, m_grass, m_grass, &matInterations);
// Create a large body to be the floor
floor = sceneManager->CreateEntity();
floor->LoadMesh ("LevelMesh.dat");
// add static floor Physics
int materialMap[] = {m_bricks, m_grass, m_wood, m_metal};
shape = CreateMeshCollision (world, floor, materialMap);
floorBody = CreateRigidBody (world, floor, shape, 0.0f);
NewtonReleaseCollision (world, shape);
// set the Transformation Matrix for this rigid body
dMatrix matrix (floor->m_curRotation, floor->m_curPosition);
NewtonBodySetMatrix (floorBody, &matrix[0][0]);
// now we will use the properties of this body to set a proper world size.
dVector minBox;
dVector maxBox;
NewtonCollisionCalculateAABB (shape, &matrix[0][0], &minBox[0], &maxBox[0]);
// add some extra padding
minBox.m_x -= 50.0f;
minBox.m_y -= 500.0f;
minBox.m_z -= 50.0f;
maxBox.m_x += 50.0f;
maxBox.m_y += 500.0f;
maxBox.m_z += 50.0f;
// set the new world size
NewtonSetWorldSize (world, &minBox[0], &maxBox[0]);
// add some visual entities.
dFloat y0 = FindFloor (world, 0.0f, 0.0f) + 10.0f;
for (int i = 0; i < 5; i ++) {
Entity* smilly;
NewtonBody* smillyBody;
smilly = sceneManager->CreateEntity();
smilly->LoadMesh ("Smilly.dat");
smilly->m_curPosition.m_y = y0;
y0 += 2.0f;
smilly->m_prevPosition = smilly->m_curPosition;
// add a body with a box shape
shape = CreateNewtonBox (world, smilly, m_metal);
smillyBody = CreateRigidBody (world, smilly, shape, 10.0f);
NewtonReleaseCollision (world, shape);
}
// add some visual entities.
y0 = FindFloor (world, 0.0f, 0.4f) + 10.5f;
for (int i = 0; i < 5; i ++) {
Entity* frowny;
NewtonBody* frownyBody;
frowny = sceneManager->CreateEntity();
//.........这里部分代码省略.........
示例3: CreateScene
void CreateScene (NewtonWorld* world, SceneManager* sceneManager)
{
Entity* floor;
NewtonBody* floorBody;
NewtonCollision* shape;
void* materialManager;
SoundManager* sndManager;
PhysicsMaterialInteration matInterations;
sndManager = sceneManager->GetSoundManager();
// Create the material for this scene, and attach it to the Newton World
materialManager = CreateMaterialManager (world, sndManager);
// add the Material table
matInterations.m_restitution = 0.6f;
matInterations.m_staticFriction = 0.6f;
matInterations.m_kineticFriction = 0.3f;
matInterations.m_scrapingSound = NULL;
matInterations.m_impactSound = sndManager->LoadSound ("metalMetal.wav");
AddMaterilInteraction (materialManager, m_metal, m_metal, &matInterations);
matInterations.m_impactSound = sndManager->LoadSound ("boxBox.wav");
AddMaterilInteraction (materialManager, m_wood, m_wood, &matInterations);
matInterations.m_impactSound = sndManager->LoadSound ("metalBox.wav");
AddMaterilInteraction (materialManager, m_metal, m_wood, &matInterations);
matInterations.m_impactSound = sndManager->LoadSound ("grass0.wav");
AddMaterilInteraction (materialManager, m_wood, m_grass, &matInterations);
matInterations.m_impactSound = sndManager->LoadSound ("boxHit.wav");
AddMaterilInteraction (materialManager, m_wood, m_bricks, &matInterations);
matInterations.m_impactSound = sndManager->LoadSound ("grass1.wav");
AddMaterilInteraction (materialManager, m_metal, m_grass, &matInterations);
matInterations.m_impactSound = sndManager->LoadSound ("metal.wav");
AddMaterilInteraction (materialManager, m_metal, m_bricks, &matInterations);
// Create a large body to be the floor
floor = sceneManager->CreateEntity();
// add scene collision from a level mesh
int materialMap[] = {m_bricks, m_grass, m_wood, m_metal};
shape = CreateHeightFieldCollision (world, "h2.raw", materialMap);
floorBody = CreateRigidBody (world, floor, shape, 0.0f);
NewtonDestroyCollision(shape);
// make a visual mesh for the collision data
CreateHeightFieldMesh (shape, floor);
// set the matrix at the origin
dVector boxP0;
dVector boxP1;
dMatrix matrix (floor->m_curRotation, floor->m_curPosition);
NewtonCollisionCalculateAABB (shape, &matrix[0][0], &boxP0.m_x, &boxP1.m_x);
// place the origin of the visual mesh at the center of the height field
matrix.m_posit = (boxP0 + boxP1).Scale (-0.5f);
matrix.m_posit.m_w = 1.0f;
floor->m_curPosition = matrix.m_posit;
floor->m_prevPosition = matrix.m_posit;
// relocate the body;
NewtonBodySetMatrix (floorBody, &matrix[0][0]);
// now we will use the properties of this body to set a proper world size.
NewtonCollisionCalculateAABB (shape, &matrix[0][0], &boxP0.m_x, &boxP1.m_x);
// add some extra padding
boxP0.m_x -= 50.0f;
boxP0.m_y -= 500.0f;
boxP0.m_z -= 50.0f;
boxP1.m_x += 50.0f;
boxP1.m_y += 500.0f;
boxP1.m_z += 50.0f;
// set the new world size
NewtonSetWorldSize (world, &boxP0[0], &boxP1[0]);
// add some visual entities.
dFloat y0 = FindFloor (world, 0.0f, 0.0f) + 2.0f;
for (int i = 0; i < 1; i ++) {
Entity* carEnt;
NewtonBody* carBody;
NewtonUserJoint* carController;
carEnt = sceneManager->CreateEntity();
carEnt->LoadMesh ("porche.dat");
carEnt->m_curPosition.m_y = y0;
y0 += 2.0f;
carEnt->m_prevPosition = carEnt->m_curPosition;
// add a body with a box shape
shape = CreateNewtonBox (world, carEnt, m_metal);
//.........这里部分代码省略.........