//
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
// $Id$
+#ifdef HAVE_CONFIG_H
+# include <simgear_config.h>
+#endif
+
#include <simgear/compiler.h>
#if defined(__APPLE__)
# endif
#endif
-#include STL_IOSTREAM
+#if defined (__CYGWIN__)
+#include <ieeefp.h>
+#endif
+
+
+#include <iostream>
#include <simgear/debug/logstream.hxx>
#include <simgear/misc/sg_path.hxx>
SG_LOG( SG_GENERAL, SG_ALERT, "Audio initialization failed!" );
SG_LOG( SG_GENERAL, SG_ALERT, " "+string(alutGetErrorString(error)));
working = false;
+ context = 0;
+ return;
+ }
+ else
+ {
+ working = true;
+ context = alcGetCurrentContext();
}
- context = alcGetCurrentContext();
#else
if ( (dev = alcOpenDevice( NULL )) != NULL
&& ( context = alcCreateContext( dev, NULL )) != NULL ) {
} else {
working = false;
context = 0;
- SG_LOG( SG_GENERAL, SG_ALERT, "Audio initialization failed!" );
+ SG_LOG( SG_GENERAL, SG_ALERT, "Audio initialization failed!" );
+ return;
}
#endif
alListenerfv( AL_ORIENTATION, listener_ori );
alGetError();
if ( alGetError() != AL_NO_ERROR) {
- SG_LOG( SG_GENERAL, SG_ALERT,
+ SG_LOG( SG_GENERAL, SG_ALERT,
"Oops AL error after audio initialization!" );
}
if (context) {
alcSuspendContext( context );
if ( alGetError() != AL_NO_ERROR) {
- SG_LOG( SG_GENERAL, SG_ALERT,
+ SG_LOG( SG_GENERAL, SG_ALERT,
"Oops AL error after soundmgr pause()!" );
}
}
if (context) {
alcProcessContext( context );
if ( alGetError() != AL_NO_ERROR) {
- SG_LOG( SG_GENERAL, SG_ALERT,
+ SG_LOG( SG_GENERAL, SG_ALERT,
"Oops AL error after soundmgr resume()!" );
}
}
sample_map_iterator sample_it = samples.find( refname );
if ( sample_it != samples.end() ) {
- // first stop the sound from playing (so we don't bomb the
- // audio scheduler)
+ // first stop the sound from playing (so we don't bomb the
+ // audio scheduler)
samples.erase( sample_it );
// cout << "sndmgr: removed -> " << refname << endl;
- return true;
+ return true;
} else {
// cout << "sndmgr: failed remove -> " << refname << endl;
return false;
bool SGSoundMgr::exists( const string &refname ) {
sample_map_iterator sample_it = samples.find( refname );
if ( sample_it != samples.end() ) {
- return true;
+ return true;
} else {
- return false;
+ return false;
}
}
SGSoundSample *SGSoundMgr::find( const string &refname ) {
sample_map_iterator sample_it = samples.find( refname );
if ( sample_it != samples.end() ) {
- return sample_it->second;
+ return sample_it->second;
} else {
- return NULL;
+ return NULL;
}
}
sample_map_iterator sample_current = samples.begin();
sample_map_iterator sample_end = samples.end();
for ( ; sample_current != sample_end; ++sample_current ) {
- SGSoundSample *sample = sample_current->second;
+ SGSoundSample *sample = sample_current->second;
sample->set_source_pos( pos );
}
}
sample_map_iterator sample_current = samples.begin();
sample_map_iterator sample_end = samples.end();
for ( ; sample_current != sample_end; ++sample_current ) {
- SGSoundSample *sample = sample_current->second;
- sample->set_source_vel( vel );
+ SGSoundSample *sample = sample_current->second;
+ sample->set_source_vel( vel, listener_vel );
}
}