Esempio n. 1
0
void Item::serializeItemAttributes_OTMM(const IOMap& maphandle, NodeFileWriteHandle& stream) const
{
	if(getSubtype() > 0)
	{
		stream.addU8(OTMM_ATTR_SUBTYPE);
		stream.addU16(getSubtype());
	}

	if(getActionID())
	{
		stream.addU8(OTMM_ATTR_ACTION_ID);
		stream.addU16(getActionID());
	}

	if(getUniqueID())
	{
		stream.addU8(OTMM_ATTR_UNIQUE_ID);
		stream.addU16(getUniqueID());
	}

	if(getText().length() > 0)
	{
		stream.addU8(OTMM_ATTR_TEXT);
		stream.addString(getText());
	}
}
Esempio n. 2
0
// returns 0 if everything's OK
// return -1 if error
int  AmAudioFile::open(const string& filename, OpenMode mode, bool is_tmp)
{
  close();

  this->close_on_exit = true;
  on_close_done = false;

  FILE* n_fp = NULL;

  string f_name = filename;
  string subtype = getSubtype(f_name);

  if(!is_tmp){
    n_fp = fopen(f_name.c_str(),mode == AmAudioFile::Read ? "r" : "w+");
    if(!n_fp){
      if(mode == AmAudioFile::Read)
	ERROR("file not found: %s\n",f_name.c_str());
      else
	ERROR("could not create/overwrite file: %s\n",f_name.c_str());
      return -1;
    }
  } else {	
    n_fp = tmpfile();
    if(!n_fp){
      ERROR("could not create temporary file: %s\n",strerror(errno));
      return -1;
    }
  }

  return fpopen_int(f_name, mode, n_fp, subtype);
}
Esempio n. 3
0
int AmAudioFile::fpopen(const string& filename, OpenMode mode, FILE* n_fp)
{
  close();
  on_close_done = false;
  string f_name = filename;
  string subtype = getSubtype(f_name);
  return fpopen_int(f_name, mode, n_fp, subtype);
}
Esempio n. 4
0
int AmAudioFileFormat::getCodecId()
{
  if(!name.empty()){
    getSubtype();
    if(p_subtype)
      return p_subtype->codec_id;
  }
    
  return -1;
}
Esempio n. 5
0
void AmAudioFileFormat::setSubtypeId(int subtype_id)  { 
  if (subtype != subtype_id) {
    DBG("changing file subtype to ID %d\n", subtype_id);
    destroyCodec();
    subtype = subtype_id; 
    p_subtype = 0;
    getSubtype();
    codec = getCodec();
  }
}
Esempio n. 6
0
CurrencyUnit::CurrencyUnit(const MeasureUnit& other, UErrorCode& ec) : MeasureUnit(other) {
    // Make sure this is a currency.
    // OK to hard-code the string because we are comparing against another hard-coded string.
    if (uprv_strcmp("currency", getType()) != 0) {
        ec = U_ILLEGAL_ARGUMENT_ERROR;
        isoCode[0] = 0;
    } else {
        // Get the ISO Code from the subtype field.
        u_charsToUChars(getSubtype(), isoCode, 4);
        isoCode[3] = 0; // make 100% sure it is NUL-terminated
    }
}
Esempio n. 7
0
AmAudioFileFormat::AmAudioFileFormat(const string& name, int subtype)
  : name(name), subtype(subtype), p_subtype(0)
{
  getSubtype();
  codec = getCodec();
    
  if(p_subtype && codec){
    rate = p_subtype->sample_rate;
    channels = p_subtype->channels;
    subtype = p_subtype->type;
  } 
}
Esempio n. 8
0
std::string Type::getTypeName() const {

    switch (getType()) {

    case Array: {
        if (getSubtype() != nullptr) {
            return std::string("array(") + getSubtype()->getTypeName() + ")";
        } else {
            return "array(unresolved-type)";
        }
    }

    case FunctionReferenceType: {
        return "__fnptr";
    }

    case StructureType:
        //StructureType overrides getTypeName. This should never execute.
        return "INVALID-SHOULD-HAVE-BEEN-OVERWRITTEN";
    case ValueType::Int:
        return "int";
    case ValueType::Boolean:
        return "bool";
    case ValueType::StringType:
        return "string";
    case ValueType::Void:
        return "void";
    case ValueType::NilType:
        return "nil";
    case ValueType::Float32:
        return "float32";
    case ValueType::TypeUnresolved:
        return "unresolved-type";
    case ValueType::ValueTypeMax:
    default:
        return "invalid";
    }

}
Esempio n. 9
0
AmAudioFileFormat::AmAudioFileFormat(const string& name, int subtype)
  : name(name), subtype(subtype), p_subtype(0)
{
  getSubtype();
  codec = getCodec();
    
  if(p_subtype && codec){
    rate = p_subtype->sample_rate;
    channels = p_subtype->channels;
    subtype = p_subtype->type;
  } 
  DBG("created AmAudioFileFormat of subtype %i, with rate %u, channels %u\n",
      subtype, rate, channels);
}
Esempio n. 10
0
bool Card::match(const QString &pattern) const{
    return objectName() == pattern || getType() == pattern || getSubtype() == pattern;
}