Exemplo n.º 1
0
void WaterUseEquipmentItem::setModelObject( model::OptionalModelObject modelObject )
{
  if( modelObject )
  {
    setDeletable(true);
  }
  else
  {
    setDeletable(false);
  }

  GridItem::setModelObject(modelObject);
}
Exemplo n.º 2
0
WaterUseConnectionsItem::WaterUseConnectionsItem(QGraphicsItem * parent)
  : GridItem(parent)
{
  setHGridLength(2);

  setDeletable(true);
}
Exemplo n.º 3
0
/**
 * synthesize is invoked by the Sequencer for rendering a non-sequenced
 * BaseSynthEvent into a single buffer
 *
 * aBufferLength {int} length of the buffer to synthesize
 */
AudioBuffer* BaseSynthEvent::synthesize( int aBufferLength )
{
    // in case buffer length is unequal to cached length, create new write buffer
    if ( aBufferLength != AudioEngineProps::BUFFER_SIZE || _buffer == 0 )
    {
        destroyBuffer();
        _buffer = new AudioBuffer( AudioEngineProps::OUTPUT_CHANNELS, aBufferLength );
    }
    lock();

    // when an event has no fixed length and the decay is short
    // we deactivate the decay envelope completely (for now)
    float decay    = _synthInstrument->adsr->getDecay();
    bool undoDecay = decay < .75;

    if ( undoDecay )
        _synthInstrument->adsr->setDecay( 0 );

    _synthInstrument->synthesizer->render( _buffer, this );

    if ( undoDecay )
        _synthInstrument->adsr->setDecay( decay );

    // keep track of the rendered samples, in case of a key up event
    // we still want to have the sound ring for the minimum period
    // defined in the constructor instead of cut off immediately

    if ( _queuedForDeletion && _minLength > 0 )
        _minLength -= aBufferLength;

    if ( _minLength <= 0 )
    {
        _hasMinLength = true;
        setDeletable( _queuedForDeletion );

        // this event is about to be deleted, apply a tiny fadeout
        if ( _queuedForDeletion )
        {
            int amt = ceil( aBufferLength / 4 );

            SAMPLE_TYPE envIncr = MAX_PHASE / amt;
            SAMPLE_TYPE amp     = MAX_PHASE;

            for ( int i = aBufferLength - amt; i < aBufferLength; ++i )
            {
                for ( int c = 0, nc = _buffer->amountOfChannels; c < nc; ++c )
                    _buffer->getBufferForChannel( c )[ i ] *= amp;

                amp -= envIncr;
            }
        }
    }
    unlock();

    return _buffer;
}
Exemplo n.º 4
0
bool ConfigDatabase::createSystemItems(PServer server, bool forceCreate)
{
	checkCheckedOut();
	bool dbChanged = NormalDatabase::createSystemItems(server, forceCreate);

	if (getName() == Server::NAME_CONFIG_DATABASE) {
		PDatabase db = COMMITABLE_CAST(Database, shared_from_this());

		checkAndCreateDimension(server, db, NAME_CONNECTIONS_DIMENSION, 0, 0, CONNECTIONS_ATTR_ITEMS, CONNECTIONS_ATTR_ITEMS + array_size(CONNECTIONS_ATTR_ITEMS), dbChanged);
		checkAndCreateDimension(server, db, NAME_CONFIG_DIMENSION, CONFIG_ITEMS, CONFIG_ITEMS + array_size(CONFIG_ITEMS), CONFIG_ATTR_ITEMS, CONFIG_ATTR_ITEMS + array_size(CONFIG_ATTR_ITEMS), dbChanged);
		PDimension taskPropsDim = checkAndCreateDimension(server, db, NAME_TASKPROPS_DIMENSION, TASKPROPS_ITEMS, TASKPROPS_ITEMS + array_size(TASKPROPS_ITEMS), dbChanged);
		PDimension notifTypesDim = checkAndCreateDimension(server, db, NAME_NOTIFTYPES_DIMENSION, NOTIFTYPES_ITEMS, NOTIFTYPES_ITEMS + array_size(NOTIFTYPES_ITEMS), dbChanged);
		PDimension tasksDim = checkAndCreateDimension(server, db, NAME_TASKS_DIMENSION, 0, 0, dbChanged);
		checkAndCreateDimension(server, db, NAME_VARSETS_DIMENSION, 0, 0, VARSETS_ATTR_ITEMS, VARSETS_ATTR_ITEMS + array_size(VARSETS_ATTR_ITEMS), dbChanged);
		PDimension etls = checkAndCreateDimension(server, db, NAME_ETLS_DIMENSION, 0, 0, dbChanged);
		PDimension etlprops = checkAndCreateDimension(server, db, NAME_ETLPROPS_DIMENSION, ETLPROPS_ITEMS, ETLPROPS_ITEMS + array_size(ETLPROPS_ITEMS), dbChanged);

		IdentifiersType dims;
		dims.push_back(etls->getId());
		dims.push_back(etlprops->getId());
		checkAndCreateCube(server, db, NAME_ETLS_CUBE, dims, dbChanged);

		dims[0] = tasksDim->getId();
		dims[1] = taskPropsDim->getId();
		checkAndCreateCube(server, db, NAME_TASKS_CUBE, dims, dbChanged);

		PDimension userDim = lookupDimensionByName(SystemDatabase::NAME_USER_DIMENSION, false);
		dims[1] = notifTypesDim->getId();
		dims.push_back(userDim->getId());
		checkAndCreateCube(server, db, NAME_TASKS_NOTIF_CUBE, dims, dbChanged);

		dims[1] = taskPropsDim->getId();
		checkAndCreateCube(server, db, NAME_TASKS_PRIVATE_CUBE, dims, dbChanged);

		checkConfigCube(server, db, dbChanged);

		if (isDeletable()) {
			setDeletable(false);
			dbChanged = true;
		}
		if (isRenamable()) {
			setRenamable(false);
			dbChanged = true;
		}
		protect = true;
	}
	return dbChanged;
}
Exemplo n.º 5
0
/**
 * synthesize is invoked by the Sequencer for rendering a non-sequenced
 * BaseSynthEvent into a single buffer
 *
 * aBufferLength {int} length of the buffer to synthesize
 */
AudioBuffer* BaseSynthEvent::synthesize( int aBufferLength )
{
    // in case buffer length is unequal to cached length, create new write buffer
    if ( aBufferLength != AudioEngineProps::BUFFER_SIZE || _buffer == 0 )
    {
        destroyBuffer();
        _buffer = new AudioBuffer( AudioEngineProps::OUTPUT_CHANNELS, aBufferLength );
    }
    render( _buffer ); // synthesize, also overwrites old buffer contents

    // keep track of the rendered bytes, in case of a key up event
    // we still want to have the sound ring for the minimum period
    // defined in the constructor instead of cut off immediately

    if ( _queuedForDeletion && _minLength > 0 )
        _minLength -= aBufferLength;

    if ( _minLength <= 0 )
    {
        _hasMinLength = true;
        setDeletable( _queuedForDeletion );

        // this event is about to be deleted, apply a tiny fadeout
        if ( _queuedForDeletion )
        {
            int amt = ceil( aBufferLength / 4 );

            SAMPLE_TYPE envIncr = MAX_PHASE / amt;
            SAMPLE_TYPE amp     = MAX_PHASE;

            for ( int i = aBufferLength - amt; i < aBufferLength; ++i )
            {
                for ( int c = 0, nc = _buffer->amountOfChannels; c < nc; ++c )
                    _buffer->getBufferForChannel( c )[ i ] *= amp;

                amp -= envIncr;
            }
        }
    }
    return _buffer;
}