soundmgr_openal.cxx \
xmlsound.cxx
-#noinst_PROGRAMS = openal_test1 openal_test2
-
-#openal_test1_SOURCES = openal_test1.cxx
-#openal_test2_SOURCES = openal_test2.cxx
-
-#openal_test1_LDADD = \
-# $(top_builddir)/simgear/debug/libsgdebug.a \
-# $(openal_LIBS)
-
-#openal_test2_LDADD = \
-# libsgsound.a \
-# $(top_builddir)/simgear/structure/libsgstructure.a \
-# $(top_builddir)/simgear/timing/libsgtiming.a \
-# $(top_builddir)/simgear/debug/libsgdebug.a \
-# $(top_builddir)/simgear/misc/libsgmisc.a \
-# $(openal_LIBS)
+check_PROGRAMS = openal_test1 openal_test2
+
+openal_test1_SOURCES = openal_test1.cxx
+openal_test2_SOURCES = openal_test2.cxx
+
+openal_test1_LDADD = \
+ $(top_builddir)/simgear/debug/libsgdebug.a \
+ $(openal_LIBS)
+
+openal_test2_LDADD = \
+ libsgsound.a \
+ $(top_builddir)/simgear/structure/libsgstructure.a \
+ $(top_builddir)/simgear/timing/libsgtiming.a \
+ $(top_builddir)/simgear/debug/libsgdebug.a \
+ $(top_builddir)/simgear/misc/libsgmisc.a \
+ $(top_builddir)/simgear/math/libsgmath.a \
+ $(openal_LIBS)
INCLUDES = -I$(top_srcdir) -DSRC_DIR=\"$(top_srcdir)/simgear/sound\"
ALCdevice *dev;
ALCcontext *context;
+ sglog().setLogLevels( SG_ALL, SG_ALERT );
+
// initialize OpenAL
if ( (dev = alcOpenDevice( NULL )) != NULL
&& ( context = alcCreateContext( dev, NULL )) != NULL ) {
smgr->bind();
smgr->init();
- smgr->set_volume(0.9);
sgr = smgr->find("default", true);
+ smgr->set_volume(0.9);
+ smgr->activate();
SGSoundSample *sample1 = new SGSoundSample( SRC_DIR, "jet.wav" );
sample1->set_volume(1.0);
sample1->set_pitch(1.0);
sample1->play_looped();
sgr->add(sample1, "sound1");
- smgr->update(1.0);
+ smgr->update_late(1.0);
printf("playing sample1\n");
sleep(1);
sample2->set_pitch(0.4);
sample2->play_looped();
sgr->add(sample2, "sound2");
- smgr->update(1.0);
+ smgr->update_late(1.0);
printf("playing sample2\n");
sleep(1);
sample3->set_pitch(0.8);
sample3->play_looped();
sgr->add(sample3, "sound3");
- smgr->update(1.0);
+ smgr->update_late(1.0);
printf("playing sample3\n");
sleep(1);
sample4->set_pitch(1.2);
sample4->play_looped();
sgr->add(sample4, "sound4");
- smgr->update(1.0);
+ smgr->update_late(1.0);
printf("playing sample4\n");
sleep(1);
sample5->set_pitch(1.6);
sample5->play_looped();
sgr->add(sample5, "sound5");
- smgr->update(1.0);
+ smgr->update_late(1.0);
printf("playing sample5\n");
sleep(1);
sample6->set_pitch(2.0);
sample6->play_looped();
sgr->add(sample6, "sound6");
- smgr->update(1.0);
+ smgr->update_late(1.0);
printf("playing sample6\n");
sleep(1);
for (int i=0; i<10; i++) {
sleep(1);
- smgr->update(1);
+ smgr->update_late(1);
}
sgr->stop("sound1");
sgr->stop("sound2");
sgr->stop("sound3");
sleep(0.5);
- sgr->update(0.5);
+ smgr->update_late(0.5);
sgr->stop("sound4");
sgr->stop("sound5");
sgr->stop("sound6");
- sgr->update(1);
+ smgr->update_late(1);
sleep(1);
smgr->unbind();
void SGSoundSample::update_absolute_position() {
SGQuatd orient = SGQuatd::fromLonLat(_base_pos) * _orientation;
_orivec = -toVec3f(orient.rotate(_direction));
+printf("ori: %f %f %f\n", _orivec[0], _orivec[1], _orivec[2]);
- orient = SGQuatd::fromRealImag(0, _relative_pos) * _orientation;
+ orient = SGQuatd::fromRealImag(0, _relative_pos) * _orientation;
_absolute_pos = -SGVec3d::fromGeod(_base_pos); // -orient.rotate(SGVec3d::e1());
+printf("pos: %f %f %f\n", _absolute_pos[0], _absolute_pos[1], _absolute_pos[2]);
}
string SGSoundSample::random_string() {
}
- float reference_dist = node->getDoubleValue("reference-dist", 500.0);
+ float reference_dist = node->getDoubleValue("reference-dist", 50.0);
float max_dist = node->getDoubleValue("max-dist", 3000.0);
//
// Orientation
//
SGVec3d dir = SGVec3d::zeros();
- float inner, outer, outer_gain;
- inner = outer = 360.0;
- outer_gain = 0.0;
+ float inner = 360.0;
+ float outer = 360.0;
+ float outer_gain = 0.0;;
prop = node->getChild("orientation");
if ( prop != NULL ) {
dir = SGVec3d(-prop->getDoubleValue("x", 0.0),
_sample = new SGSoundSample( path.c_str(), node->getStringValue("path", ""));
_sample->set_relative_position( offset_pos );
_sample->set_direction( dir );
- _sample->set_audio_cone(inner, outer, outer_gain);
+ _sample->set_audio_cone( inner, outer, outer_gain );
_sample->set_reference_dist( reference_dist );
_sample->set_max_dist( max_dist );
- _sample->set_volume(v);
- _sample->set_pitch(p);
+ _sample->set_volume( v );
+ _sample->set_pitch( p );
_sgrp->add( _sample, _name );
}