예제 #1
0
void AddEdgeToInstance(ULONG edgeIndex, Edge *edge, Instance *instance2)
{
   Instance *instance1;

   // convert edge to instance
   if (edge->vertex1 == edge->vertex2) 
   { // self-edge
      instance1 = AllocateInstance(1, 1);
      instance1->vertices[0] = edge->vertex1;
   } 
   else 
   {
      instance1 = AllocateInstance(2, 1);
      if (edge->vertex1 < edge->vertex2) 
      {
         instance1->vertices[0] = edge->vertex1;
         instance1->vertices[1] = edge->vertex2;
      } 
      else 
      {
         instance1->vertices[0] = edge->vertex2;
         instance1->vertices[1] = edge->vertex1;
      }
   }
   instance1->edges[0] = edgeIndex;
   AddInstanceToInstance(instance1, instance2);
   FreeInstance(instance1);
}
예제 #2
0
void FreeInstanceListNode(InstanceListNode *instanceListNode)
{
   if (instanceListNode != NULL) 
   {
      if (instanceListNode->instance != NULL)
         instanceListNode->instance->refCount--;
      FreeInstance(instanceListNode->instance);
      free(instanceListNode);
   }
}
예제 #3
0
bool LadspaEffect::RealtimeFinalize()
{
   for (size_t i = 0, cnt = mSlaves.GetCount(); i < cnt; i++)
   {
      FreeInstance(mSlaves[i]);
   }
   mSlaves.Clear();

   return true;
}
예제 #4
0
bool LadspaEffect::ProcessFinalize()
{
   if (mReady)
   {
      mReady = false;

      FreeInstance(mMaster);
      mMaster = NULL;
   }

   return true;
}
예제 #5
0
void AddRecursiveInstancePair(ULONG i1, ULONG i2,
                              Instance *instance1, Instance *instance2,
                              ULONG edgeIndex, Edge *edge,
                              ULONG numInstances, Instance **instanceMap)
{
   Instance *tmpInstance = NULL;
   ULONG i;

   if ((instanceMap[i1] == instance1) && (instanceMap[i2] == instance2)) 
   {
      // instances not yet linked to a new recursive instance
      tmpInstance = AllocateInstance(0, 0);
      AddInstanceToInstance(instance1, tmpInstance);
      AddInstanceToInstance(instance2, tmpInstance);
      AddEdgeToInstance(edgeIndex, edge, tmpInstance);
      instanceMap[i1] = tmpInstance;
      instanceMap[i2] = tmpInstance;
   } 
   else if (instanceMap[i1] == instance1) 
   {
      // instance1 to be linked to new instance at instanceMap[i2]
      AddInstanceToInstance(instance1, instanceMap[i2]);
      AddEdgeToInstance(edgeIndex, edge, instanceMap[i2]);
      instanceMap[i1] = instanceMap[i2];
   } 
   else if (instanceMap[i2] == instance2) 
   {
      // instance2 to be linked to new instance at instanceMap[i1]
      AddInstanceToInstance(instance2, instanceMap[i1]);
      AddEdgeToInstance(edgeIndex, edge, instanceMap[i1]);
      instanceMap[i2] = instanceMap[i1];
   } 
   else if (instanceMap[i1] != instanceMap[i2]) 
   {
      // both instances already belong to new different recursive instances
      AddInstanceToInstance(instanceMap[i2], instanceMap[i1]);
      AddEdgeToInstance(edgeIndex, edge, instanceMap[i1]);
      tmpInstance = instanceMap[i2];
      for (i = 0; i < numInstances; i++)
         if (instanceMap[i] == tmpInstance)
      instanceMap[i] = instanceMap[i1];
      FreeInstance(tmpInstance);
   } 
   else 
   {
      // both instances already in same new recursive instance
      AddEdgeToInstance(edgeIndex, edge, instanceMap[i1]);
   }
}
예제 #6
0
void InstanceListInsert(Instance *instance, InstanceList *instanceList,
                        BOOLEAN unique)
{
   InstanceListNode *instanceListNode;

   if ((! unique) ||
       (unique && (! MemberOfInstanceList(instance, instanceList)))) 
   {
      instanceListNode = AllocateInstanceListNode(instance);
      instanceListNode->next = instanceList->head;
      instanceList->head = instanceListNode;
   } 
   else 
      FreeInstance(instance);
}