+// sample_group.cxx -- Manage a group of samples relative to a base position
+//
+// Written for the new SoundSystem by Erik Hofman, October 2009
+//
+// Copyright (C) 2009 Erik Hofman <erik@ehofman.com>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License as
+// published by the Free Software Foundation; either version 2 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software Foundation,
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+// $Id$
+
#ifdef HAVE_CONFIG_H
# include <simgear_config.h>
#endif
_active(false),
_tied_to_listener(false),
_velocity(SGVec3d::zeros()),
- _position(SGGeod()),
- _orientation(SGQuatd::zeros())
+ _orientation(SGQuatd::zeros()),
+ _position(SGGeod())
{
_samples.clear();
}
_active(false),
_tied_to_listener(false),
_velocity(SGVec3d::zeros()),
- _position(SGGeod()),
- _orientation(SGQuatd::zeros())
+ _orientation(SGQuatd::zeros()),
+ _position(SGGeod())
{
_smgr->add(this, refname);
- _active = _smgr->is_working();
_samples.clear();
}
}
// set source velocity of all managed sounds
-void SGSampleGroup::set_velocity( SGVec3d &vel ) {
+void SGSampleGroup::set_velocity( const SGVec3d &vel ) {
if ( isnan(vel[0]) || isnan(vel[1]) || isnan(vel[2]) )
{
SG_LOG( SG_GENERAL, SG_ALERT, "NAN's found in SampleGroup velocity");
}
}
-// ste the source orientation of all managed sounds
-void SGSampleGroup::set_position( SGGeod pos ) {
+// set the source position of all managed sounds
+void SGSampleGroup::set_position( const SGGeod& pos ) {
sample_map_iterator sample_current = _samples.begin();
sample_map_iterator sample_end = _samples.end();
}
-// ste the source orientation of all managed sounds
-void SGSampleGroup::set_orientation( SGQuatd ori ) {
+// set the source orientation of all managed sounds
+void SGSampleGroup::set_orientation( const SGQuatd& ori ) {
if (_orientation != ori) {
sample_map_iterator sample_current = _samples.begin();
alSourcefv( source, AL_DIRECTION, _smgr->get_direction().data() );
alSourcefv( source, AL_VELOCITY, _smgr->get_velocity().data() );
} else {
- alSourcefv( source, AL_POSITION, sample->get_position());
+ alSourcefv( source, AL_POSITION, sample->get_position() );
alSourcefv( source, AL_DIRECTION, sample->get_orientation() );
alSourcefv( source, AL_VELOCITY, sample->get_velocity() );
}