コード例 #1
0
ファイル: ISoundDevice.cpp プロジェクト: pdumais/dhas
void ISoundDevice::play(const char *filename, Dumais::Sound::SoundFormat format)
{
    if (this->getSampleSize() == 0) return;
    LOG("Adding " << filename << " in sound device queue");
    SoundFile *file = new SoundFile();
    if (file->open(filename,format))
    {
        this->mSoundQueue.put(file);
        this->setWorking();
    } else {
        delete file;
    }
}
コード例 #2
0
static VALUE SoundFile_open(VALUE self, VALUE filename) 
{
  // We want a string here...
  Check_Type(filename, T_STRING);
  // get the Unit instance
  SoundFile *ugen;
  Data_Get_Struct(self, SoundFile, ugen);

  // Open the file, rethrowing errors as necessary  
  try {
    ugen->open(StringValuePtr(filename));  
  }
  catch(StkError &error) {
    return self;
  }
	return self;
}
コード例 #3
0
static VALUE SoundFile_initialize(int argc, VALUE *argv, VALUE self)
{
  VALUE options;
  /* One mandatory, one optional argument */
  rb_scan_args(argc, argv, "01", &options);
  
  SoundFile *soundfileugen;
  Data_Get_Struct(self, SoundFile, soundfileugen);
  
  if(options != Qnil){
    Check_Type(options, T_HASH);
    VALUE filename = rb_hash_aref(options, ID2SYM(rb_intern("file")));     
    
    soundfileugen->open(StringValuePtr(filename));
  }    
	return self;
}