// constructor
FGSimpleSound::FGSimpleSound( string file )
: pitch(1.0),
- volume(1.0),
- requests(0)
+ volume(1.0)
{
SGPath slfile( globals->get_fg_root() );
slfile.append( file );
FGSimpleSound::FGSimpleSound( unsigned char *buffer, int len )
: pitch(1.0),
- volume(1.0),
- requests(0)
+ volume(1.0)
{
sample = new slSample ( buffer, len );
pitch_envelope = new slEnvelope( 1, SL_SAMPLE_ONE_SHOT );
void FGSimpleSound::play( slScheduler *sched, bool looped ) {
- requests++;
-
// make sure sound isn't already playing
if ( sample->getPlayCount() > 0 ) {
- return;
+ sched->stopSample(sample);
+ // return;
}
- // sched->stopSample(sample);
if ( looped ) {
sched->loopSample(sample);
} else {
void FGSimpleSound::stop( slScheduler *sched, bool quick ) {
- if ( quick ) {
- requests = 0;
- } else {
- if ( --requests < 0 ) {
- requests = 0;
- }
- }
-
- if ( requests > 0 ) {
- return;
- }
-
sched->stopSample( sample );
}
// run the audio scheduler
-void FGSoundMgr::update(int dt) {
+void FGSoundMgr::update(double dt) {
+ // FIXME: use dt supplied (seconds)
SGTimeStamp current;
current.stamp();