Exemplo n.º 1
0
int main(void)
{
    initSignal();
    
    // Initialise les mutex
    pthread_mutex_init(&mutex_received, NULL);
    pthread_mutex_init(&mutex_give, NULL);
    
    // Cree un thread qui ecoutera ce que la station 1 et 3 lui dira
    if(pthread_create(&receive_1, NULL, receiveFrom1, NULL) != 0 ||
       pthread_create(&receive_3, NULL, receiveFrom3, NULL) != 0) {
        printf("Erreur thread\n");
        return 1;
    }
    
    // Attend que le serveur d'~coute soit lanc~
    printf("Appuyez sur une touche lorsque station 1 et station 3 seront lance ...\n");
    while(kbhit() == 0);
    
    initSend(&station_1, ADDR_STATION_1, PORT_LISTEN_1_2);
    initSend(&station_3, ADDR_STATION_3, PORT_LISTEN_3_2);
    
    initLink();
        
    // Boucle principale
    while(1) {
        reinitialise();
        processPiece();
    }
    
    return 0;
}
Exemplo n.º 2
0
AudioBody::AudioBody (const std::string &filename, bool ambient)
      : resource(NULL),
        position(Vector3(0,0,0)),
        orientation(Quaternion(1,0,0,0)),
        separation(0.0f),
        velocity(Vector3(0,0,0)),
        looping(false),
        pitch(1.0f),
        volume(1.0f),
        ambient(ambient),
        referenceDistance(1),
        rollOff(1),
        destroyed(false)
{
    resource = disk_resource_use<AudioDiskResource>(filename);
    if (resource == nullptr) {
        EXCEPT << "Not an audio resource: \"" << filename << "\"" << ENDL;
    }

    alGenSources(1, &alSourceLeft);
    alGenSources(1, &alSourceRight);

    reinitialise();

    resource->registerReloadWatcher(this);

}
Exemplo n.º 3
0
void AudioBody::notifyReloaded (const DiskResource *r)
{
    (void) r;
    bool was_playing = playing();
    if (was_playing) stop();
    reinitialise();
    if (was_playing) play();
}
    HeadlessRenderSystem::HeadlessRenderSystem() :
        RenderSystem(),
        mTextureManager(0),
        mHardwareBufferManager(0)
    {
        LogManager::getSingleton().logMessage("HeadlessRenderSystem ctor", Ogre::LML_TRIVIAL);

        reinitialise();
    }
Exemplo n.º 5
0
/* This function changes the file currently being paged. direction can be one of the following:
 * -1: go back one file
 *  0: go to the first file
 *  1: go forward one file
*/
static void change_file(int direction)
{
	if (current_file != ((direction > 0) ? num_files : 1)) {
		current_file = direction ? current_file + direction : 1;
		strcpy(filename, files[current_file - 1]);
		reinitialise();
	}
	else {
		clear_line();
		printf("%s%s%s", HIGHLIGHT, (direction > 0) ? "No next file" : "No previous file", NORMAL);
	}
}
Exemplo n.º 6
0
  void 
  GCellsShearing::initialise(size_t nID)
  {
    ID=nID;

    if (!std::tr1::dynamic_pointer_cast<BCLeesEdwards>(Sim->BCs))
      derr << "You should not use the shearing neighbour list"
	   << " in a system without Lees Edwards BC's" << std::endl;

    if (overlink != 1) M_throw() << "Cannot shear with overlinking yet";

    reinitialise();
  }
Exemplo n.º 7
0
  void 
  GCells::initialise(size_t nID)
  {
    ID=nID;
    typedef void (GCells::*CallBackType)(size_t);

    _particleAdded = Sim->particle_added_signal()
      .connect(boost::bind(CallBackType(&GCells::addToCell), this, _1));
    _particleRemoved = Sim->particle_removed_signal()
      .connect(boost::bind(CallBackType(&GCells::removeFromCell), this, _1));

    reinitialise();

    dout << "Neighbourlist contains " << partCellData.size() 
	 << " particle entries"
	 << std::endl;
  }
Exemplo n.º 8
0
QWidget *ShaderVertexComponentType::createEditor(ProjectInterface *ifc, CreateInterface *c)
  {
  QWidget *w = new QWidget();
  QVBoxLayout *l = new QVBoxLayout();
  l->setContentsMargins(0, 0, 0, 0);
  w->setLayout(l);

  auto box = new AssetSelector(ifc, c, &_layout, VertexDescriptionType::staticTypeInformation(), w);
  QObject::connect(box, &AssetSelector::assetChanged, [this, c]()
    {
    reinitialise(source(), c);
    });
  l->addWidget(box);

  auto editor = ExternalSourceAsset::createEditor(ifc, c);
  editor->setParent(w);
  l->addWidget(editor);

  return w;
  }
Exemplo n.º 9
0
static void examine_file(void)
{
	int newline_offset;

	clear_line();
	printf("Examine: ");
	fgets(filename, 256, inp);

	/* As fgets adds a newline to the end of an input string, we
	   need to remove it */
	newline_offset = strlen(filename) - 1;
	filename[newline_offset] = '\0';

	files[num_files] = bb_xstrdup(filename);
	current_file = num_files + 1;
	num_files++;

	inp_stdin = 0;
	reinitialise();
}
Exemplo n.º 10
0
GfxBody::GfxBody (const DiskResourcePtr<GfxMeshDiskResource> &gdr, const GfxStringMap &sm,
                  const GfxNodePtr &par_)
  : GfxFertileNode(par_), initialMaterialMap(sm), gdr(gdr)
{
    node->attachObject(this);

    mesh = gdr->getOgreMeshPtr();

    mesh->load();

    memset(colours, 0, sizeof(colours));

    fade = 1;
    enabled = true;
    castShadows = true;
    skeleton = NULL;
    wireframe = false;
    firstPerson = false;

    reinitialise();
}
Exemplo n.º 11
0
 /*! \brief Set the minimum range this neighbourlist is to support.
   
   This is the minimum as neighbourlists usually must support a
   slightly larger distance.
   
   \sa getMaxSupportedInteractionLength()
  */
 void setMaxInteractionRange(double range)
 {
   _maxInteractionRange = range;
   if (_initialised) reinitialise();
 }
Exemplo n.º 12
0
void Client::setConfiguration(const session::Configuration &value)
{
  configuration->setConfiguration(value);

  reinitialise(configuration->deviceId().c_str(), true);
}