Logo Search packages:      
Sourcecode: vdrift version File versions

Sample.cc

//  Sample.cc - an audio sample class.
//
//  Vamos Automotive Simulator
//  Copyright (C) 2003 Sam Varner
//
//  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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

#include <vamos/geometry/Sample.h>

Vamos_Geometry::
Sample::Sample (std::string file, double base_volume, double base_pitch,
                bool volume_envelope, bool pitch_envelope) 
                        /*:
  m_base_volume (base_volume),
  m_base_pitch (base_pitch),
  m_loop (false),
  mp_volume_envelope (volume_envelope ? new slEnvelope () : 0),
  mp_pitch_envelope (pitch_envelope ? new slEnvelope () : 0),
  mp_scheduler (0)*/
{
  /*if (!loadFile (const_cast <char*> (file.c_str ())))
    {
      throw (Missing_Sound_File (file));
    }*/
}     

Vamos_Geometry::
Sample::~Sample ()
{
  /*if (mp_scheduler != 0)
    {
      // Stop the scheduler playing the sample before deleting.
      mp_scheduler->stopSample (this);
      mp_scheduler->update ();

      // Remove the envelopes (by adding a null envelope) before deleting.
      if (mp_volume_envelope != 0)
        {
          mp_scheduler->addSampleEnvelope (this, 0, 1, 0, SL_VOLUME_ENVELOPE);
        }
      if (mp_pitch_envelope != 0)
        {
          mp_scheduler->addSampleEnvelope (this, 0, 0, 0, SL_PITCH_ENVELOPE);
        }
    }
  delete mp_pitch_envelope;
  delete mp_volume_envelope;*/
}

void Vamos_Geometry::
Sample::schedule (slScheduler* scheduler, bool loop, int priority)
{
  /*mp_scheduler = scheduler;
  m_loop = loop;

  if (m_loop)
    {
      mp_scheduler->loopSample (this, priority);
    }

  if (mp_volume_envelope != 0)
    {
      mp_scheduler->addSampleEnvelope (this, 0, 1, mp_volume_envelope,
                                       SL_VOLUME_ENVELOPE);
    }
  if (mp_pitch_envelope != 0)
    {
      mp_scheduler->addSampleEnvelope (this, 0, 0, mp_pitch_envelope,
                                       SL_PITCH_ENVELOPE);
    }*/
}

void Vamos_Geometry::
Sample::volume (double volume_factor)
{
  //mp_volume_envelope->setStep (0, 0.0, volume_factor * m_base_volume); 
}

void Vamos_Geometry::
Sample::pitch (double pitch_factor)
{
  //mp_pitch_envelope->setStep (0, 0.0, pitch_factor * m_base_pitch); 
}

void Vamos_Geometry::
Sample::play ()
{
  /*if (mp_scheduler != 0)
    {
      if (m_loop)
        {
          mp_scheduler->resumeSample (this);
        }
      else
        {
          mp_scheduler->playSample (this);
        }
    }*/
}

void Vamos_Geometry::
Sample::pause ()
{
  /*if (mp_scheduler != 0)
    {
      mp_scheduler->pauseSample (this);
    }*/
}

void Vamos_Geometry::
Sample::stop ()
{
  /*if (mp_scheduler != 0)
    {
      mp_scheduler->stopSample (this);
    }*/
}

Generated by  Doxygen 1.6.0   Back to index