Exemple #1
0
// ---------------------------------------------------------------------------
//  Synthesizer constructor
// ---------------------------------------------------------------------------
//!	Construct a Synthesizer using the specified sampling rate, sample
//!	buffer (a standard library vector), and the default fade time 
//!	stored in the DefaultParameters. Since Partials generated by the Loris 
//!	Analyzer generally begin and end at non-zero amplitude, zero-amplitude
//!	Breakpoints are inserted at either end of the Partial, at a temporal
//!	distance equal to the fade time, to reduce turn-on and turn-off
//!	artifacts.
//!
//!	\param	srate The rate (Hz) at which to synthesize samples
//!			   (must be positive).
//!	\param	buffer The vector (of doubles) into which rendered samples
//!			   should be accumulated.
//!	\throw	InvalidArgument if the specfied sample rate is non-positive.
Synthesizer::Synthesizer( double samplerate, std::vector<double> & buffer ) :
    m_sampleBuffer( & buffer ),
    m_fadeTimeSec( DefaultParameters().fadeTime ),
    m_srateHz( samplerate )
{
    //  check to make sure that the sample rate is valid:
    if ( m_srateHz <= 0. ) 
    {
        Throw( InvalidArgument, "Synthesizer sample rate must be positive." );
    }

    //  assign the default bw enhancement filter to the Oscillator
    m_osc.filter() = DefaultParameters().filter;
    
}
Exemple #2
0
// Gets parameters from a cfg file if available, from defaults otherwise.
void
GetParameters (int ControllerNumber)
{
  char Filename[33];
  char s[81];
  FILE *File;
  int iValue;
  
  DefaultParameters ();
  
  sprintf (Filename, "yaACA3-%d.cfg", ControllerNumber);
  File = fopen (Filename, "r");
  if (File != NULL)
    {
      CfgExisted = 1;
      while (NULL != fgets (s, sizeof (s), File))
        {
	  if (1 == sscanf (s, "Roll.Axis=%d", &iValue))
	    Roll.Axis = iValue;
	  else if (1 == sscanf (s, "Roll.PositiveSense=%d", &iValue))
	    Roll.PositiveSense = iValue;
	  else if (1 == sscanf (s, "Pitch.Axis=%d", &iValue))
	    Pitch.Axis = iValue;
	  else if (1 == sscanf (s, "Pitch.PositiveSense=%d", &iValue))
	    Pitch.PositiveSense = iValue;
	  else if (1 == sscanf (s, "Yaw.Axis=%d", &iValue))
	    Yaw.Axis = iValue;
	  else if (1 == sscanf (s, "Yaw.PositiveSense=%d", &iValue))
	    Yaw.PositiveSense = iValue;
	}
      fclose (File);
    }
}
Exemple #3
0
void yaAcaFrameClass::OnDefaultPressed (wxCommandEvent &event)
{
  DefaultParameters ();
  RollAxisCtrl->SetValue (Roll.Axis);
  RollPolarityBox->SetSelection (Roll.PositiveSense ? 0 : 1);
  PitchAxisCtrl->SetValue (Pitch.Axis);
  PitchPolarityBox->SetSelection (Pitch.PositiveSense ? 0 : 1);
  YawAxisCtrl->SetValue (Yaw.Axis);
  YawPolarityBox->SetSelection (Yaw.PositiveSense ? 0 : 1);
  WriteParameters (ControllerNumber);
}
Exemple #4
0
void
GetParameters (int ControllerNumber)
{
  char Filename[33];
  char s[81];
  FILE *File;
  int iValue;
  float Factor;
  
  DefaultParameters ();
  
  sprintf (Filename, "yaACA-%d.cfg", ControllerNumber);
  File = fopen (Filename, "r");
  if (File != NULL)
    {
      CfgExisted = 1;
      while (NULL != fgets (s, sizeof (s), File))
        {
	  if (1 == sscanf (s, "Roll.Stick=%d", &iValue))
	    RollStick = iValue;
	  else if (1 == sscanf (s, "Roll.Axis=%d", &iValue))
	    RollAxis = iValue;
	  else if (1 == sscanf (s, "Roll.Offset=%d", &iValue))
	    RollOffset = iValue;
	  else if (1 == sscanf (s, "Roll.Factor=%f", &Factor))
	    RollFactor = Factor;
	  else if (1 == sscanf (s, "Pitch.Stick=%d", &iValue))
	    PitchStick = iValue;
	  else if (1 == sscanf (s, "Pitch.Axis=%d", &iValue))
	    PitchAxis = iValue;
	  else if (1 == sscanf (s, "Pitch.Offset=%d", &iValue))
	    PitchOffset = iValue;
	  else if (1 == sscanf (s, "Pitch.Factor=%f", &Factor))
	    PitchFactor = Factor;
	  else if (1 == sscanf (s, "Yaw.Stick=%d", &iValue))
	    YawStick = iValue;
	  else if (1 == sscanf (s, "Yaw.Axis=%d", &iValue))
	    YawAxis = iValue;
	  else if (1 == sscanf (s, "Yaw.Offset=%d", &iValue))
	    YawOffset = iValue;
	  else if (1 == sscanf (s, "Yaw.Factor=%f", &Factor))
	    YawFactor = Factor;
	}
      fclose (File);
    }
    
  Roll = &joy[Controller].stick[RollStick].axis[RollAxis].pos;
  Pitch = &joy[Controller].stick[PitchStick].axis[PitchAxis].pos;
  Yaw = &joy[Controller].stick[YawStick].axis[YawAxis].pos;
}
Exemple #5
0
// Gets parameters from a cfg file if available, from defaults otherwise.
void
yaAcaFrameClass::GetParameters (int ControllerNumber)
{

  DefaultParameters ();
  
  wxTextFile File;
  wxString Filename;
  Filename = wxString::Format (wxT ("yaACA2-%d.cfg"), ControllerNumber);
  if (wxFileExists (Filename))
    {
      wxString Dummy, Name, Value;
      int LineCount, i;
      long iValue;
      
      File.Open (Filename);
      LineCount = File.GetLineCount ();
      for (i = 0; i < LineCount; i++)
        {
	  Dummy = File.GetLine (i);
	  Name = Dummy.BeforeLast ('=');
	  Value = Dummy.AfterLast ('=');
	  if (!Value.ToLong (&iValue))
	    iValue = 0;
	  if (Name.IsSameAs (wxT ("Roll.Axis")))
	    Roll.Axis = iValue;
	  else if (Name.IsSameAs (wxT ("Roll.PositiveSense")))
	    Roll.PositiveSense = (iValue == 0);
	  else if (Name.IsSameAs (wxT ("Pitch.Axis")))
	    Pitch.Axis = iValue;
	  else if (Name.IsSameAs (wxT ("Pitch.PositiveSense")))
	    Pitch.PositiveSense = (iValue == 0);
	  else if (Name.IsSameAs (wxT ("Yaw.Axis")))
	    Yaw.Axis = iValue;
	  else if (Name.IsSameAs (wxT ("Yaw.PositiveSense")))
	    Yaw.PositiveSense = (iValue == 0);
	}
      
      File.Close ();
    }
}
SimpleDeviceWindow::SimpleDeviceWindow(HINSTANCE hInstance, int width /*= 800*/, int height /*= 600*/, bool fullscreen /*= false*/ )
{
	m_hInstance = hInstance;
	DefaultParameters(width,height,fullscreen);
}
Exemple #7
0
// ---------------------------------------------------------------------------
//  Synthesizer constructor
// ---------------------------------------------------------------------------
//!	Construct a Synthesizer using the default parameters and sample
//!	buffer (a standard library vector). Since Partials generated by the 
//! Loris Analyzer generally begin and end at non-zero amplitude, zero-amplitude
//!	Breakpoints are inserted at either end of the Partial, at a temporal
//!	distance equal to the fade time, to reduce turn-on and turn-off
//!	artifacts.
//!
//! \sa Synthesizer::Parameters
//!
//!	\param	buffer The vector (of doubles) into which rendered samples
//!			   should be accumulated.
//!	\throw	InvalidArgument if any of the parameters is invalid.
Synthesizer::Synthesizer( std::vector<double> & buffer ) :
    m_sampleBuffer( & buffer ),
    m_fadeTimeSec( DefaultParameters().fadeTime ),
    m_srateHz( DefaultParameters().sampleRate )
{
}