Example #1
0
bool Sequence::GetRMS(sampleCount start, sampleCount len,
                         float * outRMS) const
{
   if (len == 0 || mBlock->Count() == 0) {
      *outRMS = float(0.0);
      return true;
   }

   double sumsq = 0.0;
   sampleCount length = 0;

   unsigned int block0 = FindBlock(start);
   unsigned int block1 = FindBlock(start + len);

   sampleCount s0, l0, maxl0;

   // First calculate the rms of the blocks in the middle of this region;
   // this is very fast because we have the rms of every entire block
   // already in memory.
   unsigned int b;

   for (b = block0 + 1; b < block1; b++) {
      float blockMin, blockMax, blockRMS;
      mBlock->Item(b)->f->GetMinMax(&blockMin, &blockMax, &blockRMS);

      sumsq += blockRMS * blockRMS * mBlock->Item(block0)->f->GetLength();
      length += mBlock->Item(block0)->f->GetLength();
   }

   // Now we take the first and last blocks into account, noting that the
   // selection may only partly overlap these blocks.
   // If not, we need read some samples and summaries from disk.
   s0 = start - mBlock->Item(block0)->start;
   l0 = len;
   maxl0 = mBlock->Item(block0)->start + mBlock->Item(block0)->f->GetLength() - start;
   if (l0 > maxl0)
      l0 = maxl0;

   float partialMin, partialMax, partialRMS;
   mBlock->Item(block0)->f->GetMinMax(s0, l0, &partialMin, &partialMax, &partialRMS);

   sumsq += partialRMS * partialRMS * l0;
   length += l0;

   if (block1 > block0) {
      s0 = 0;
      l0 = (start + len) - mBlock->Item(block1)->start;

      mBlock->Item(block1)->f->GetMinMax(s0, l0,
                                         &partialMin, &partialMax, &partialRMS);
      sumsq += partialRMS * partialRMS * l0;
      length += l0;
   }

   *outRMS = sqrt(sumsq/length);

   return true;
}
Example #2
0
bool Sequence::Copy(sampleCount s0, sampleCount s1, Sequence **dest)
{
   *dest = 0;

   if (s0 >= s1 || s0 >= mNumSamples || s1 < 0)
      return false;

   int numBlocks = mBlock->Count();
   int b0 = FindBlock(s0);
   int b1 = FindBlock(s1);

   if (s1 == mNumSamples)
      b1 = numBlocks;

   *dest = new Sequence(mDirManager, mSampleFormat);

   samplePtr buffer = NewSamples(mMaxSamples, mSampleFormat);

   int blocklen;

   // Do the first block

   if (b0 >= 0 && b0 < numBlocks && s0 != mBlock->Item(b0)->start) {

      blocklen = (mBlock->Item(b0)->start + mBlock->Item(b0)->f->GetLength() - s0);
      if (blocklen > (s1 - s0))
         blocklen = s1 - s0;
      Get(buffer, mSampleFormat, s0, blocklen);

      (*dest)->Append(buffer, mSampleFormat, blocklen);
   }

   if (b0 >= 0 && b0 < numBlocks && s0 == mBlock->Item(b0)->start) {
      b0--;
   }
   // If there are blocks in the middle, copy the blockfiles directly
   for (int b = b0 + 1; b < b1; b++)
      ((Sequence *)*dest)->AppendBlock(mBlock->Item(b));

   // Do the last block
   if (b1 > b0 && b1 < numBlocks) {
      blocklen = (s1 - mBlock->Item(b1)->start);
      Get(buffer, mSampleFormat, mBlock->Item(b1)->start, blocklen);
      (*dest)->Append(buffer, mSampleFormat, blocklen);
   }
   
   DeleteSamples(buffer);
   
   return true;
}
Example #3
0
int WaveTrack::FindBlock(sampleCount pos, sampleCount lo,
                         sampleCount guess, sampleCount hi)
{
   wxASSERT(block->Item(guess)->len > 0);
   wxASSERT(lo <= guess && guess <= hi && lo <= hi);

   if (pos >= block->Item(guess)->start &&
       pos < block->Item(guess)->start + block->Item(guess)->len)
      return guess;

   if (pos < block->Item(guess)->start)
      return FindBlock(pos, lo, (lo + guess) / 2, guess);
   else
      return FindBlock(pos, guess + 1, (guess + 1 + hi) / 2, hi);
}
Example #4
0
int Sequence::FindBlock(sampleCount pos, sampleCount lo,
                        sampleCount guess, sampleCount hi) const
{
   wxASSERT(mBlock->Item(guess)->len > 0);
   wxASSERT(lo <= guess && guess <= hi && lo <= hi);

   if (pos >= mBlock->Item(guess)->start &&
       pos < mBlock->Item(guess)->start + mBlock->Item(guess)->len)
      return guess;

   if (pos < mBlock->Item(guess)->start)
      return FindBlock(pos, lo, (lo + guess) / 2, guess);
   else
      return FindBlock(pos, guess + 1, (guess + 1 + hi) / 2, hi);
}
Example #5
0
//======================================================
int ParmFile::GetIntParm(const char* parm_nam)
{
  int num;
  char parm_str[20];

  if(GetParmStr(parm_nam, parm_str)!=0)
    {
    FindBlock(Block_Name);
    if(GetParmStr(parm_nam, parm_str) !=0)
      {
      ErrorStream <<  "Error: parameter '" << parm_nam 
                  << "' not found after 2 attempts" << endl;
      exit(-1);
      }
    }
  cout << "str = " << parm_str << endl;
//  for(c_ptr=parm_str; c_ptr<parm_str+strlen(parm_str);c_ptr++) {
//   if(!isdigit(*c_ptr)) {
//      ErrorStream << "Error: non-numeric data where numeric expected" << endl;
//      exit(-1);
//      }
//   }
   if(!isnumeric(parm_str)) {
      ErrorStream << "Error: non-numeric data where numeric expected" << endl;
      exit(-1);
      }
  num = atoi(parm_str);
  cout << "num = " << num << endl;
  return(num);
}
Example #6
0
BOOL CSysinfo::GetProcessName (pid_t pid, char *dest, int sz)
{
	// this code is deprecated. It was causing ACCESS_VIOLATIONS
	// on Windows XP.
#if 0
	DWORD *block;
	Refresh();
	block = FindBlock (pid);
	if (!block)
	{
		dest[0] = '\0';
		return FALSE;
	}
	MakeAnsiString ((WORD*)(*(block+15)), dest);
#endif
	HANDLE Hnd;

	if( ! (Hnd = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid))) {
		return FALSE;
	}

	if ( ! GetModuleBaseName(Hnd, NULL, dest, sz) ) {
		return FALSE;
	}
	
	return TRUE;
}
Example #7
0
bool Sequence::Get(samplePtr buffer, sampleFormat format,
                   sampleCount start, sampleCount len) const
{
   if (start < 0 || start > mNumSamples ||
       start+len > mNumSamples)
      return false;
   int b = FindBlock(start);

   while (len) {
      sampleCount blen =
          mBlock->Item(b)->start + mBlock->Item(b)->f->GetLength() - start;
      if (blen > len)
         blen = len;
      sampleCount bstart = (start - (mBlock->Item(b)->start));

      Read(buffer, format, mBlock->Item(b), bstart, blen);

      len -= blen;
      buffer += (blen * SAMPLE_SIZE(format));
      b++;
      start += blen;
   }

   return true;
}
Example #8
0
/*
 * Copy data in specified file to specified block in channel data memory map
 */
void CopyFileToMappedBlock(char *blockName, char *inputFilename) {
	if (!FileExists(inputFilename)) {
		printf( "ERROR: Input file %s does not exist!\n" );
		return;
	}

	int fd = open(inputFilename, O_RDONLY);

	if (fd < 0) {
		printf( "ERROR: Unable to open input file %s: %s",
			inputFilename, strerror(errno));
		return;
	}

	if (OpenChannelControlMemoryMap() < 0) {
		close(fd);
		return;
	}

	if (OpenChannelMemoryMap() < 0) {
		CloseChannelControlMemoryMap();
		close(fd);
		return;
	}

	if (OpenChannelPixelMap() < 0) {
		CloseChannelMemoryMap();
		CloseChannelControlMemoryMap();
		close(fd);
		return;
	}

	FPPChannelMemoryMapControlBlock *cb = FindBlock(blockName);

	if (cb) {
		char data[FPPD_MAX_CHANNELS];
		int r = read(fd, data, cb->channelCount);
		if (r != cb->channelCount) {
			printf( "WARNING: Expected %d bytes of data but only read %d.\n",
				cb->channelCount, r);
		} else {
			int i;
			int limit = cb->channelCount - 3;
			for (i = 0; i <= limit; ) {
				dataMap[pixelMap[cb->startChannel - 1 + i]] = data[i]; i++; // R |
				dataMap[pixelMap[cb->startChannel - 1 + i]] = data[i]; i++; // G |- triplet
				dataMap[pixelMap[cb->startChannel - 1 + i]] = data[i]; i++; // B |
			}
			printf( "Data imported\n" );
		}
	} else {
		printf( "ERROR: Could not find MAP %s\n", blockName);
	}

	CloseChannelMemoryMap();
	CloseChannelControlMemoryMap();
	close(fd);
}
Example #9
0
int CSysinfo::GetTIDs (pid_t pid, ExtArray<DWORD> & tids)
{
	DWORD s = 0;

	if ( !IsWin2k ) {
		/*** Window NT 4.0 Specific Code -- this does not work on Win2k! ***/
		DWORD *block;
		Refresh();
		block = FindBlock (pid);
		if (!block)
			return 0;
		for (s=0; s < *(block+1); s++)
		{
			tids[s] = *(block+43+s*16);	
			// tstatus[s] = *(block+48+s*16) + (*(block+47+s*16)<<8);
		}
		return (int)s;
	}
			
	/******** Win2k Specific Code -- use spiffy new Toolhelp32 calls ***/

	HANDLE        hThreadSnap = NULL; 
    THREADENTRY32 te32        = {0}; 
 
    // Take a snapshot of all threads currently in the system. 

    hThreadSnap = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0); 
    if (hThreadSnap == (HANDLE)-1) 
	{
		// dprintf(D_DAEMONCORE,"CreateToolhelp32Snapshot failed\n");
        return 0;
	}
 
    // Fill in the size of the structure before using it. 

    te32.dwSize = sizeof(THREADENTRY32); 
 
    // Walk the thread snapshot to find all threads of the process. 
    // If the thread belongs to the process, add its information 
    // to the list.
    if (Thread32First(hThreadSnap, &te32)) 
    { 
        do 
        { 
            if (te32.th32OwnerProcessID == pid) 
            { 
				tids[s] = te32.th32ThreadID;	
				s++;
            } 
        } 
        while (Thread32Next(hThreadSnap, &te32)); 
    } 
 
    // Do not forget to clean up the snapshot object. 
	CloseHandle (hThreadSnap); 
	
	return (int)s;		
}
Example #10
0
DWORD CSysinfo::GetHandleCount (pid_t pid)
{
	DWORD *block;
	Refresh();
	block = FindBlock (pid);
	if (!block)
		return 0;
	return block[19];
}
Example #11
0
int Sequence::FindBlock(sampleCount pos, sampleCount lo,
                        sampleCount guess, sampleCount hi) const
{
   wxASSERT(mBlock->Item(guess)->f->GetLength() > 0);
   wxASSERT(lo <= guess && guess <= hi && lo <= hi);

   if (pos >= mBlock->Item(guess)->start &&
       pos < mBlock->Item(guess)->start + mBlock->Item(guess)->f->GetLength())
      return guess;

   //this is a binary search, but we probably could benefit by something more like
   //dictionary search where we guess something smarter than the binary division
   //of the unsearched area, since samples are usually proportional to block file number.
   if (pos < mBlock->Item(guess)->start)
      return FindBlock(pos, lo, (lo + guess) / 2, guess);
   else
      return FindBlock(pos, guess + 1, (guess + 1 + hi) / 2, hi);
}
Example #12
0
status_t
Volume::FindBlock(off_t logical, fsblock_t &physicalBlock)
{
	off_t physical;
	status_t status = FindBlock(logical, physical);
	if (status != B_OK)
		return status;
	physicalBlock = physical / fBlockSize;
	return B_OK;
}
Example #13
0
DWORD CSysinfo::NumThreads (pid_t pid)
{
	DWORD *block;
	Refresh();
	block = FindBlock (pid);
	if (block)
		return *(block+1);
	else
		return 0;
}
Example #14
0
// Pass NULL to set silence
bool Sequence::Set(samplePtr buffer, sampleFormat format,
                   sampleCount start, sampleCount len)
{
   if (start < 0 || start > mNumSamples ||
       start+len > mNumSamples)
      return false;

   samplePtr temp = NULL;
   if (format != mSampleFormat) {
      temp = NewSamples(mMaxSamples, mSampleFormat);
      wxASSERT(temp);
   }

   samplePtr silence = NULL;
   if (!buffer) {
      silence = NewSamples(mMaxSamples, format);
      wxASSERT(silence);
      ClearSamples(silence, format, 0, mMaxSamples);
   }

   int b = FindBlock(start);

   while (len) {
      int blen = mBlock->Item(b)->start + mBlock->Item(b)->len - start;
      if (blen > len)
         blen = len;

      if (buffer) {
         if (format == mSampleFormat)
            CopyWrite(buffer, mBlock->Item(b), start - mBlock->Item(b)->start,
                      blen);
         else {
            CopySamples(buffer, format, temp, mSampleFormat, blen);
            CopyWrite(temp, mBlock->Item(b), start - mBlock->Item(b)->start,
                      blen);
         }
         buffer += (blen * SAMPLE_SIZE(format));
      } else
         CopyWrite(silence, mBlock->Item(b), start - mBlock->Item(b)->start,
                   blen);

      len -= blen;
      start += blen;
      b++;
   }

   if (!buffer)
      DeleteSamples(silence);

   if (format != mSampleFormat)
      DeleteSamples(temp);

   return ConsistencyCheck("Set");
}
void FIndirectLightingCache::UpdateCacheAllocation(
	const FBoxSphereBounds& Bounds, 
	int32 BlockSize,
	bool bOpaqueRelevance,
	FIndirectLightingCacheAllocation*& Allocation, 
	TMap<FIntVector, FBlockUpdateInfo>& BlocksToUpdate,
	TArray<FIndirectLightingCacheAllocation*>& TransitionsOverTimeToUpdate)
{
	if (Allocation && Allocation->IsValid())
	{
		FIndirectLightingCacheBlock& Block = FindBlock(Allocation->MinTexel);

		// Calculate a potentially new min and size based on the current bounds
		FVector NewMin;
		FVector NewSize;
		CalculateBlockPositionAndSize(Bounds, Block.TexelSize, NewMin, NewSize);

		// If the primitive has moved enough to change its block min and size, we need to interpolate it again
		if (Allocation->bIsDirty || GCacheUpdateEveryFrame || !Block.Min.Equals(NewMin) || !Block.Size.Equals(NewSize))
		{
			// Update the block and primitive allocation with the new bounds
			Block.Min = NewMin;
			Block.Size = NewSize;

			FVector NewScale;
			FVector NewAdd;
			FVector MinUV;
			FVector MaxUV;
			CalculateBlockScaleAndAdd(Allocation->MinTexel, Allocation->AllocationTexelSize, NewMin, NewSize, NewScale, NewAdd, MinUV, MaxUV);

			Allocation->SetParameters(Allocation->MinTexel, Allocation->AllocationTexelSize, NewScale, NewAdd, MinUV, MaxUV, bOpaqueRelevance);
			BlocksToUpdate.Add(Block.MinTexel, FBlockUpdateInfo(Block, Allocation));
		}

		if ((Allocation->SingleSamplePosition - Allocation->TargetPosition).SizeSquared() > DELTA)
		{
			TransitionsOverTimeToUpdate.AddUnique(Allocation);
		}
	}
	else
	{
		delete Allocation;
		Allocation = CreateAllocation(BlockSize, Bounds, bOpaqueRelevance);

		if (Allocation->IsValid())
		{
			// Must interpolate lighting for this new block
			BlocksToUpdate.Add(Allocation->MinTexel, FBlockUpdateInfo(VolumeBlocks.FindChecked(Allocation->MinTexel), Allocation));
		}
	}
}
Example #16
0
/*
 * Set a channel data map block as active/inactive.
 */
void SetMappedBlockActive(char *blockName, int active) {
	if (OpenChannelControlMemoryMap() < 0)
		return;

	FPPChannelMemoryMapControlBlock *cb = FindBlock(blockName);

	if (cb) {
		cb->isActive = active;
	} else {
		printf( "ERROR: Could not find MAP %s\n", blockName);
	}

	CloseChannelControlMemoryMap();
}
Example #17
0
void CSysinfo::Explore(pid_t pid)
{
	DWORD *block;
	int i;

	Refresh();
	block = FindBlock (pid);
	if (!block)
		return;

	for (i=0;i<43;i++) {
		printf("Offset %d - %d \n",i,block[i]);
	}
}
Example #18
0
afs_int32
ka_LookupKey(struct ubik_trans *tt,
	     char *name,
	     char *inst,
	     afs_int32 *kvno, 			/* returned */
	     struct ktc_encryptionKey *key)	/* copied out */
{
    int i;
    afs_int32 to;
    struct kaentry tentry;
    afs_int32 code = 0;

    ObtainReadLock(&keycache_lock);
    if (keyCacheVersion != ntohl(cheader.specialKeysVersion))
	code = KAKEYCACHEINVALID;
    else {
	for (i = 0; i < maxCachedKeys; i++) {
	    if (keyCache[i].used) {	/* zero used date means invalid */
		if ((keyCache[i].superseded == NEVERDATE)
		    && (strcmp(keyCache[i].name, name) == 0)
		    && (strcmp(keyCache[i].inst, inst) == 0)) {
		    memcpy(key, &keyCache[i].key, sizeof(*key));
		    *kvno = keyCache[i].kvno;
		    keyCache[i].used = time(0);
		    ReleaseReadLock(&keycache_lock);
		    return 0;
		}
	    }
	}
	code = KAUNKNOWNKEY;
    }
    ReleaseReadLock(&keycache_lock);
    if (!tt)
	return code;

    /* we missed in the cache so need to look in the Ubik database */
    code = FindBlock(tt, name, inst, &to, &tentry);
    if (code)
	return code;
    if (to == 0)
	return KANOENT;
    memcpy(key, &tentry.key, sizeof(*key));
    *kvno = ntohl(tentry.key_version);
    ka_Encache(name, inst, *kvno, key, NEVERDATE);
    return 0;
}
Example #19
0
File: heap.c Project: Renlor/ccl
static int FreeObject(ContainerHeap *heap,void *element)
{
    ListElement *le = element;

    le->Next = INVALID_POINTER_VALUE;
#ifdef DEBUG_HEAP_FREELIST
    { size_t idx,blockNr;
        blockNr = FindBlock(heap,element,&idx);
        if (blockNr > heap->CurrentBlock) return -1;
    }
#endif
    memcpy(le->Data, &heap->FreeList,sizeof(ListElement *));
	le->Next = heap->FreeList;
    heap->FreeList = le;
    heap->timestamp++;
    return 1;
}
Example #20
0
void WaveTrack::Get(sampleType * buffer, sampleCount start,
                    sampleCount len)
{
   wxASSERT(start < numSamples && start + len <= numSamples);
   int b = FindBlock(start);

   while (len) {
      sampleCount blen =
          block->Item(b)->start + block->Item(b)->len - start;
      if (blen > len)
         blen = len;
      sampleCount bstart = (start - (block->Item(b)->start));
      Read(buffer, block->Item(b), bstart, blen);
      len -= blen;
      buffer += blen;
      b++;
      start += blen;
   }
}
Example #21
0
int WaveTrack::FindBlock(sampleCount pos)
{
   wxASSERT(pos >= 0 && pos <= numSamples);

   int numBlocks = block->Count();

   if (pos == 0)
      return 0;

   if (pos == numSamples)
      return (numBlocks - 1);

   int rval = FindBlock(pos, 0, numBlocks / 2, numBlocks);

   wxASSERT(rval >= 0 && rval < numBlocks &&
            pos >= block->Item(rval)->start &&
            pos < block->Item(rval)->start + block->Item(rval)->len);

   return rval;
}
Example #22
0
int Sequence::FindBlock(sampleCount pos) const
{
   wxASSERT(pos >= 0 && pos <= mNumSamples);

   int numBlocks = mBlock->Count();

   if (pos == 0)
      return 0;

   if (pos == mNumSamples)
      return (numBlocks - 1);

   int rval = FindBlock(pos, 0, numBlocks / 2, numBlocks);

   wxASSERT(rval >= 0 && rval < numBlocks &&
            pos >= mBlock->Item(rval)->start &&
            pos < mBlock->Item(rval)->start + mBlock->Item(rval)->f->GetLength());

   return rval;
}
Example #23
0
// Pass NULL to set silence
void WaveTrack::Set(sampleType * buffer, sampleCount start,
                    sampleCount len)
{
   wxASSERT(start < numSamples && start + len <= numSamples);

#if wxUSE_THREADS
   wxMutexLocker lock(*blockMutex);
#endif

   int b = FindBlock(start);

   sampleType *silence;
   if (!buffer) {
      silence = new sampleType[maxSamples];
      for (int i = 0; i < maxSamples; i++)
         silence[i] = 0;
   }

   while (len) {
      int blen = block->Item(b)->start + block->Item(b)->len - start;
      if (blen > len)
         blen = len;

      if (buffer) {
         CopyWrite(buffer, block->Item(b), start - block->Item(b)->start,
                   blen);
         buffer += blen;
      } else
         CopyWrite(silence, block->Item(b), start - block->Item(b)->start,
                   blen);

      len -= blen;
      start += blen;
      b++;
   }

   if (!buffer)
      delete[]silence;

   ConsistencyCheck("Set");
}
Example #24
0
sampleCount Sequence::GetBestBlockSize(sampleCount start) const
{
   // This method returns a nice number of samples you should try to grab in
   // one big chunk in order to land on a block boundary, based on the starting
   // sample.  The value returned will always be nonzero and will be no larger
   // than the value of GetMaxBlockSize();
   int b = FindBlock(start);
   int numBlocks = mBlock->Count();
   
   sampleCount result = (mBlock->Item(b)->start + mBlock->Item(b)->f->GetLength() - start);
   
   while(result < mMinSamples && b+1<numBlocks &&
         (mBlock->Item(b+1)->f->GetLength()+result) <= mMaxSamples) {
      b++;
      result += mBlock->Item(b)->f->GetLength();
   }
   
   wxASSERT(result > 0 && result <= mMaxSamples);
   
   return result;
}
Example #25
0
bool CheckBlockList(struct in_addr* piaPeer)
{
	block_node* pBlock = FindBlock(piaPeer);

	// true means not blocked and can connect
	// false means block still in effect

	if (!pBlock)
		return true;

	if (pBlock->iExpires < 0)
		return false;

	if (pBlock->iExpires <= GetTime())
	{
		DeleteBlock(piaPeer);
		return true;
	}

	return false;
}
Example #26
0
//======================================================
char* ParmFile::GetStringParm(const char* parm_nam)
{
  //int num;
  char parm_str[30];
  char *ret_str;

  if(GetParmStr(parm_nam, parm_str)!=0)
    {
    FindBlock(Block_Name);
    if(GetParmStr(parm_nam, parm_str) !=0)
      {
      ErrorStream <<  "Error: parameter '" << parm_nam 
                  << "' not found after 2 attempts" << endl;
      exit(-1);
      }
    }
  cout << "str = " << parm_str << endl;
  ret_str = new char[strlen(parm_str)+20];
  strcpy(ret_str, parm_str);
  return(ret_str);
}
Example #27
0
/*
 * Fill a channel data block with a single specified value
 */
void FillMappedBlock(char *blockName, int channelData) {
	if (OpenChannelControlMemoryMap() < 0) {
		return;
	}

	if (OpenChannelMemoryMap() < 0) {
		CloseChannelControlMemoryMap();
		return;
	}

	FPPChannelMemoryMapControlBlock *cb = FindBlock(blockName);

	if (cb) {
		memset(dataMap + cb->startChannel - 1, channelData, cb->channelCount);
	} else {
		printf( "ERROR: Could not find MAP %s\n", blockName);
	}

	CloseChannelMemoryMap();
	CloseChannelControlMemoryMap();
}
Example #28
0
/*
 * Display info on a named channel data block
 */
void DumpMappedBlockInfo(char *blockName) {
	if (OpenChannelControlMemoryMap() < 0) {
		return;
	}

	FPPChannelMemoryMapControlBlock *cb = FindBlock(blockName);

	if (cb) {
		printf( "Block Name: %s\n", cb->blockName);
		printf( "Channels  : %lld-%lld (%lld channels)\n",
			cb->startChannel, cb->startChannel + cb->channelCount - 1,
			cb->channelCount);

		printf( "Status    : ");
		switch (cb->isActive) {
			case 0: printf("Idle");
					break;
			case 1: printf("Active");
					break;
			case 2: printf("Active (Transparent)");
					break;
			case 3: printf("Active (Transparent RGB)");
					break;
		}
		printf( "\n");

		printf( "Is Locked : ");
		switch (cb->isLocked) {
			case 0: printf("No");
					break;
			case 1: printf("Yes");
					break;
		}
		printf("\n");
	} else {
		printf( "ERROR: Could not find MAP %s\n", blockName);
	}

	CloseChannelControlMemoryMap();
}
Example #29
0
//======================================================
double* ParmFile::GetDoubleParmArray(  const char* parm_nam, 
                                double* array_ptr, 
                                const int array_len)
{
  double num;
  int idx;
  char *token;
  char parm_str[80];

  if(GetParmArrayStr(parm_nam, parm_str)!=0)
    {
    FindBlock(Block_Name);
    if(GetParmArrayStr(parm_nam, parm_str) !=0)
      {
      ErrorStream <<  "Error: parameter '" << parm_nam 
                  << "' not found after 2 attempts" << endl;
      exit(-1);
      }
    }
  cout << "xxstr = " << parm_str << endl;
  token = strtok(parm_str," ,\n");
   if(!isnumeric(token)) {
      ErrorStream << "Error: non-numeric data where numeric expected [GetDoubleParmArray(1)]" << endl;
      exit(-1);
      }
  num = atof(token);
  cout << "num = " << num << endl;
  array_ptr[0] = num;
  for(idx=1; idx<array_len; idx++)
    {
    token = strtok( NULL, " ,\n");
   if(!isnumeric(token)) {
      ErrorStream << "Error: non-numeric data where numeric expected [GetDoubleParmArray(2)]" << endl;
      exit(-1);
      }
    array_ptr[idx] = atof(token);
    }
  return(array_ptr);
}
Example #30
0
//======================================================
bool ParmFile::GetBoolParm(const char* parm_nam)
{
  bool num;
  char parm_str[20];

  if(GetParmStr(parm_nam, parm_str)!=0)
    {
    FindBlock(Block_Name);
    if(GetParmStr(parm_nam, parm_str) !=0)
      {
      ErrorStream <<  "Error: parameter '" << parm_nam 
                  << "' not found after 2 attempts" << endl;
      exit(-1);
      }
    }
  if(!strcmp(parm_str,"true"))
    num = true;
  else
    num = false;
  cout << "num = " << num << endl;
  return(num);
}