Пример #1
0
void ompl::base::Planner::printProperties(std::ostream &out) const
{
    out << "Planner " + getName() + " specs:" << std::endl;
    out << "Multithreaded:                 " << (getSpecs().multithreaded ? "Yes" : "No") << std::endl;
    out << "Reports approximate solutions: " << (getSpecs().approximateSolutions ? "Yes" : "No") << std::endl;
    out << "Can optimize solutions:        " << (getSpecs().optimizingPaths ? "Yes" : "No") << std::endl;
    out << "Aware of the following parameters:";
    std::vector<std::string> params;
    params_.getParamNames(params);
    for (auto &param : params)
        out << " " << param;
    out << std::endl;
}
Пример #2
0
void AUD_ReverseReader::read(int & length, sample_t* & buffer)
{
	// first correct the length
	if(m_position + length > m_length)
		length = m_length - m_position;

	if(length <= 0)
	{
		length = 0;
		return;
	}

	AUD_Specs specs = getSpecs();
	int samplesize = AUD_SAMPLE_SIZE(specs);

	// resize buffer if needed
	if(m_buffer.getSize() < length * samplesize)
		m_buffer.resize(length * samplesize);

	buffer = m_buffer.getBuffer();

	sample_t* buf;
	int len = length;

	// read from reader
	m_reader->seek(m_length - m_position - len);
	m_reader->read(len, buf);

	// set null if reader didn't give enough data
	if(len < length)
	{
		memset(buffer, 0, (length - len) * samplesize);
		buffer += (length - len) * specs.channels;
	}

	// copy the samples reverted
	for(int i = 0; i < len; i++)
		memcpy(buffer + i * specs.channels,
			   buf + (len - 1 - i) * specs.channels,
			   samplesize);

	m_position += length;

	buffer = m_buffer.getBuffer();
}
Пример #3
0
void ReverseReader::read(int& length, bool& eos, sample_t* buffer)
{
    // first correct the length
    if(m_position + length > m_length)
        length = m_length - m_position;

    if(length <= 0)
    {
        length = 0;
        eos = true;
        return;
    }

    const Specs specs = getSpecs();
    const int samplesize = AUD_SAMPLE_SIZE(specs);

    sample_t temp[CHANNEL_MAX];

    int len = length;

    // read from reader
    m_reader->seek(m_length - m_position - len);
    m_reader->read(len, eos, buffer);

    // set null if reader didn't give enough data
    if(len < length)
        std::memset(buffer, 0, (length - len) * samplesize);

    // copy the samples reverted
    for(int i = 0; i < length / 2; i++)
    {
        std::memcpy(temp, buffer + (len - 1 - i) * specs.channels, samplesize);
        std::memcpy(buffer + (len - 1 - i) * specs.channels, buffer + i * specs.channels, samplesize);
        std::memcpy(buffer + i * specs.channels, temp, samplesize);
    }

    m_position += length;
    eos = false;
}