|
Nsound
0.9.4
|
#include <Nsound/Mesh2D.h>
Public Member Functions | |
| Mesh2D (const float64 &sample_rate, uint32 width, uint32 height, const float64 &leak_gain, const float64 &tau, const float64 &delta=6.0, const float64 &gamma=8.0) | |
| Constructor. More... | |
| Mesh2D (const Mesh2D ©) | |
| Copy Constructor. More... | |
| ~Mesh2D () | |
| Destructor. More... | |
| void | clear () |
| Clears all MeshJunctions to zero. More... | |
| float64 | getEnergy () const |
| Calculate total energy in the mesh. More... | |
| Mesh2D & | operator= (const Mesh2D &rhs) |
| Assignment operator. More... | |
| Buffer | strike (const Buffer &x_pos, const Buffer &y_pos, const Buffer &velocity) |
| Hit the mesh many times at different locations. More... | |
| Buffer | strike (const float64 &x_pos, const float64 &y_pos, const float64 &velocity) |
| Hit the mesh once. More... | |
| void | setMeshDumping (boolean flag, const std::string &dirname=".", const std::string &prefix="mesh") |
| Enables the dumping of mesh values to disk for use with mesh2blender.py. More... | |
Private Member Functions | |
| void | allocMemory () |
| Allocates memory for the mesh. More... | |
| void | freeMemory () |
| Frees memory from the mesh. More... | |
| void | writeMeshMap () |
| Write to disk the mesh map, used with mesh2blender.py. More... | |
| void | writeMeshFile (const std::string &mode) |
| MeshJunction * | mesh (uint32 x, uint32 y) |
| float64 | tick (const float64 &x_pos, const float64 &y_pos, const float64 &velocity) |
| Calculate one sample. More... | |
Private Attributes | |
| float64 | sample_rate_ |
| uint32 | X_ |
| uint32 | Y_ |
| The number of MeshJunctions columns. More... | |
| float64 | leak_gain_ |
| The number of MeshJunctions rows. More... | |
| float64 | tau_ |
| MeshJunction leak gain. More... | |
| float64 | delta_ |
| MeshJunction tau. More... | |
| float64 | gamma_ |
| MeshJunction delta. More... | |
| MeshJunction ** | mesh_ |
| MeshJunction gamma. More... | |
| MeshJunction * | center_ |
| Array of pointers. More... | |
| boolean | dump_mesh_ |
| Center MeshJunction where final sound is collected. More... | |
| std::string | dirname_ |
| std::string | prefix_ |
WARNING: This is Experimental, you should not use this class as it may not be working or will change in future releases of Nsound.
| Mesh2D::Mesh2D | ( | const float64 & | sample_rate, |
| uint32 | width, | ||
| uint32 | height, | ||
| const float64 & | leak_gain, | ||
| const float64 & | tau, | ||
| const float64 & | delta = 6.0, |
||
| const float64 & | gamma = 8.0 |
||
| ) |
Constructor.
Definition at line 48 of file Mesh2D.cc.
References allocMemory(), and tau_.
| Mesh2D::Mesh2D | ( | const Mesh2D & | copy | ) |
Copy Constructor.
Definition at line 85 of file Mesh2D.cc.
| Mesh2D::~Mesh2D | ( | ) |
| void Mesh2D::clear | ( | ) |
Clears all MeshJunctions to zero.
Definition at line 159 of file Mesh2D.cc.
References Nsound::MeshJunction::clear(), mesh_, X_, and Y_.
Referenced by strike().
| float64 Mesh2D::getEnergy | ( | ) | const |
Assignment operator.
Definition at line 225 of file Mesh2D.cc.
References allocMemory(), delta_, freeMemory(), gamma_, leak_gain_, tau_, X_, and Y_.
Hit the mesh many times at different locations.
Definition at line 249 of file Mesh2D.cc.
References Nsound::Buffer::getLength(), and tick().
Referenced by main().
Hit the mesh once.
Definition at line 353 of file Mesh2D.cc.
References center_, clear(), Nsound::Generator::drawLine(), Nsound::MeshJunction::getVelocity(), sample_rate_, tick(), writeMeshFile(), and writeMeshMap().
| void Mesh2D::setMeshDumping | ( | boolean | flag, |
| const std::string & | dirname = ".", |
||
| const std::string & | prefix = "mesh" |
||
| ) |
Enables the dumping of mesh values to disk for use with mesh2blender.py.
Definition at line 341 of file Mesh2D.cc.
References dirname_, dump_mesh_, and prefix_.
|
private |
Allocates memory for the mesh.
Definition at line 112 of file Mesh2D.cc.
References center_, delta_, gamma_, leak_gain_, mesh(), mesh_, Nsound::MeshJunction::setNeighborEast(), Nsound::MeshJunction::setNeighborNorth(), Nsound::MeshJunction::setNeighborSouth(), Nsound::MeshJunction::setNeighborWest(), tau_, X_, and Y_.
Referenced by Mesh2D(), and operator=().
|
private |
Frees memory from the mesh.
Definition at line 169 of file Mesh2D.cc.
Referenced by operator=(), and ~Mesh2D().
|
private |
|
private |
|
private |
Definition at line 198 of file Mesh2D.cc.
Referenced by allocMemory(), tick(), writeMeshFile(), and writeMeshMap().
|
private |
Calculate one sample.
Definition at line 386 of file Mesh2D.cc.
References center_, Nsound::MeshJunction::getVelocity(), mesh(), mesh_, Nsound::MeshJunction::saveState(), Nsound::MeshJunction::strike(), Nsound::MeshJunction::updateVelocity(), X_, and Y_.
Referenced by strike().
|
private |
|
private |
Definition at line 133 of file Mesh2D.h.
Referenced by allocMemory(), clear(), freeMemory(), getEnergy(), mesh(), operator=(), tick(), writeMeshFile(), and writeMeshMap().
|
private |
The number of MeshJunctions columns.
Definition at line 134 of file Mesh2D.h.
Referenced by allocMemory(), clear(), freeMemory(), getEnergy(), operator=(), tick(), writeMeshFile(), and writeMeshMap().
|
private |
The number of MeshJunctions rows.
Definition at line 136 of file Mesh2D.h.
Referenced by allocMemory(), and operator=().
|
private |
MeshJunction leak gain.
Definition at line 137 of file Mesh2D.h.
Referenced by allocMemory(), Mesh2D(), and operator=().
|
private |
MeshJunction tau.
Definition at line 138 of file Mesh2D.h.
Referenced by allocMemory(), and operator=().
|
private |
MeshJunction delta.
Definition at line 139 of file Mesh2D.h.
Referenced by allocMemory(), and operator=().
|
private |
MeshJunction gamma.
Definition at line 141 of file Mesh2D.h.
Referenced by allocMemory(), clear(), freeMemory(), getEnergy(), mesh(), and tick().
|
private |
Array of pointers.
Definition at line 143 of file Mesh2D.h.
Referenced by allocMemory(), strike(), and tick().
|
private |
Center MeshJunction where final sound is collected.
Definition at line 145 of file Mesh2D.h.
Referenced by setMeshDumping(), writeMeshFile(), and writeMeshMap().
|
private |
Definition at line 147 of file Mesh2D.h.
Referenced by setMeshDumping(), writeMeshFile(), and writeMeshMap().
|
private |
Definition at line 148 of file Mesh2D.h.
Referenced by setMeshDumping(), writeMeshFile(), and writeMeshMap().
1.8.6