Пример #1
0
void gui_get_clipboard(char **buffer, size_t *length)
{
	struct ContextNode *cn;
	struct CollectionItem *ci = NULL;
	struct StoredProperty *sp = NULL;
	ULONG rlen=0,error;
	struct CSet *cset;
	LONG codeset = 0;

	if(OpenIFF(iffh,IFFF_READ)) return;
	
	if(CollectionChunk(iffh,ID_FTXT,ID_CHRS)) return;
	if(PropChunk(iffh,ID_FTXT,ID_CSET)) return;
	if(CollectionChunk(iffh,ID_FTXT,ID_UTF8)) return;
	if(StopOnExit(iffh, ID_FTXT, ID_FORM)) return;
	
	error = ParseIFF(iffh,IFFPARSE_SCAN);

	if(ci = FindCollection(iffh, ID_FTXT, ID_UTF8)) {
		*buffer = ami_clipboard_cat_collection(ci, 106, length);
	} else if(ci = FindCollection(iffh, ID_FTXT, ID_CHRS)) {
		if(sp = FindProp(iffh, ID_FTXT, ID_CSET)) {
			cset = (struct CSet *)sp->sp_Data;
			codeset = cset->CodeSet;
		}
		*buffer = ami_clipboard_cat_collection(ci, codeset, length);
	}

	CloseIFF(iffh);
}
Пример #2
0
	void PhotosTab::handleAccDoneUpdating ()
	{
		if (OnUpdateCollectionId_.isEmpty () || !CurAcc_)
			return;

		const auto& idx = FindCollection (CurAcc_->GetCollectionsModel (), {}, OnUpdateCollectionId_);
		OnUpdateCollectionId_.clear ();
		if (!idx.isValid ())
			return;

		Ui_.CollectionsTree_->setCurrentIndex (idx);
	}
Пример #3
0
void IPCCollectionEvent(int argc, char** argv, PLSOBJECT Object)
{
	char* Name = argv[0];
	LSTypeDefinition* Type = pLSInterface->FindLSType(argv[1]);
	char* SubType = argv[2];
	char* Method = argv[3];

	LSOBJECT collectionobject;
	if((collectionobject.Ptr = FindCollection(Name)) == 0)
	{
		collectionobject.Ptr = new LSObjectCollection(Type, SubType);
		AddCollection(Name, (LSObjectCollection*)collectionobject.Ptr);
	}
	pCollectionType->GetMethodEx(collectionobject.GetObjectData(), Method, argc - 4, &argv[4]);
}
Пример #4
0
BOOL
ReadConfig ( struct AHIDevUnit *iounit,
             struct AHIBase *AHIBase )
{
  struct IFFHandle *iff;
  struct StoredProperty *prhd,*ahig;
  struct CollectionItem *ci;

  if(iounit)
  {
    /* Internal defaults for device unit */
    iounit->AudioMode       = AHI_INVALID_ID;   // See at the end of the function!
    iounit->Frequency       = 10000;
    iounit->Channels        = 4;
    iounit->MonitorVolume   = ~0;
    iounit->InputGain       = ~0;
    iounit->OutputVolume    = ~0;
    iounit->Input           = ~0;
    iounit->Output          = ~0;
  }
  else
  {
    /* Internal defaults for low-level mode */
    AHIBase->ahib_AudioMode       = AHI_INVALID_ID;
    AHIBase->ahib_Frequency       = 10000;
    AHIBase->ahib_MonitorVolume   = 0x00000;
    AHIBase->ahib_InputGain       = 0x10000;
    AHIBase->ahib_OutputVolume    = 0x10000;
    AHIBase->ahib_Input           = 0;
    AHIBase->ahib_Output          = 0;
  }

  if((iff=AllocIFF()))
  {
    iff->iff_Stream=Open("ENV:Sys/ahi.prefs", MODE_OLDFILE);
    if(iff->iff_Stream)
    {
      InitIFFasDOS(iff);
      if(!OpenIFF(iff,IFFF_READ))
      {
        if(!(PropChunk(iff,ID_PREF,ID_PRHD)
          || PropChunk(iff,ID_PREF,ID_AHIG)
          || CollectionChunk(iff,ID_PREF,ID_AHIU)
          || StopOnExit(iff,ID_PREF,ID_FORM)))
        {
          if(ParseIFF(iff,IFFPARSE_SCAN) == IFFERR_EOC)
          {
            prhd=FindProp(iff,ID_PREF,ID_PRHD);
            ahig=FindProp(iff,ID_PREF,ID_AHIG);
            
            if(ahig)
            {
              struct AHIGlobalPrefs *globalprefs;
              
              globalprefs = (struct AHIGlobalPrefs *)ahig->sp_Data;

              AHIBase->ahib_DebugLevel = globalprefs->ahigp_DebugLevel;

              AHIBase->ahib_Flags = 0;

              if(globalprefs->ahigp_DisableSurround)
                AHIBase->ahib_Flags |= AHIBF_NOSURROUND;

              if(globalprefs->ahigp_DisableEcho)
                AHIBase->ahib_Flags |= AHIBF_NOECHO;

              if(globalprefs->ahigp_FastEcho)
                AHIBase->ahib_Flags |= AHIBF_FASTECHO;
                
              if( (ULONG) ahig->sp_Size > offsetof( struct AHIGlobalPrefs,
                                                    ahigp_MaxCPU) )
              {
                AHIBase->ahib_MaxCPU = globalprefs->ahigp_MaxCPU;
              }
              else
              {
                AHIBase->ahib_MaxCPU = 0x10000 * 90 / 100;
              }

              if( (ULONG) ahig->sp_Size > offsetof( struct AHIGlobalPrefs, 
                                                    ahigp_ClipMasterVolume) )
              {
                if(globalprefs->ahigp_ClipMasterVolume)
                  AHIBase->ahib_Flags |= AHIBF_CLIPPING;
              }

              if( (ULONG) ahig->sp_Size > offsetof( struct AHIGlobalPrefs, 
                                                    ahigp_AntiClickTime ) )
              {
                AHIBase->ahib_AntiClickTime = globalprefs->ahigp_AntiClickTime;
              }
              else
              {
                AHIBase->ahib_AntiClickTime = 0;
              }

            }
            ci=FindCollection(iff,ID_PREF,ID_AHIU);
            while(ci)
            {
              struct AHIUnitPrefs *unitprefs;

              unitprefs = (struct AHIUnitPrefs *)ci->ci_Data;

              if(iounit)
              {
                if(unitprefs->ahiup_Unit == iounit->UnitNum)
                {
                  iounit->AudioMode       = unitprefs->ahiup_AudioMode;
                  iounit->Frequency       = unitprefs->ahiup_Frequency;
                  iounit->Channels        = unitprefs->ahiup_Channels;
                  iounit->MonitorVolume   = unitprefs->ahiup_MonitorVolume;
                  iounit->InputGain       = unitprefs->ahiup_InputGain;
                  iounit->OutputVolume    = unitprefs->ahiup_OutputVolume;
                  iounit->Input           = unitprefs->ahiup_Input;
                  iounit->Output          = unitprefs->ahiup_Output;
                }
              }
              else
              {
                if(unitprefs->ahiup_Unit == AHI_NO_UNIT)
                {
                  AHIBase->ahib_AudioMode       = unitprefs->ahiup_AudioMode;
                  AHIBase->ahib_Frequency       = unitprefs->ahiup_Frequency;
                  AHIBase->ahib_MonitorVolume   = unitprefs->ahiup_MonitorVolume;
                  AHIBase->ahib_InputGain       = unitprefs->ahiup_InputGain;
                  AHIBase->ahib_OutputVolume    = unitprefs->ahiup_OutputVolume;
                  AHIBase->ahib_Input           = unitprefs->ahiup_Input;
                  AHIBase->ahib_Output          = unitprefs->ahiup_Output;
                }
              }

              ci=ci->ci_Next;
            }
          }
Пример #5
0
int main(int argc, char *argv[])
{
  struct IFFHandle *iff;
  struct StoredProperty *ahig;
  struct CollectionItem *ci;
  LONG unit = 0;
  int rc = RETURN_OK;

  if(argc != 3) {
    Printf("Usage: %s FILE UNIT\n", argv[0]);
    return RETURN_FAIL;
  }

  StrToLong(argv[2], &unit);

  if(iff = AllocIFF())
  {
    iff->iff_Stream = Open(argv[1], MODE_OLDFILE);
    if(iff->iff_Stream)
    {
      InitIFFasDOS(iff);
      if(!OpenIFF(iff, IFFF_READ))
      {
        if(!(PropChunk(iff,ID_PREF,ID_AHIG)
          || CollectionChunk(iff,ID_PREF,ID_AHIU)
          || StopOnExit(iff,ID_PREF,ID_FORM)))
        {
          if(ParseIFF(iff, IFFPARSE_SCAN) == IFFERR_EOC)
          {

            ahig = FindProp(iff,ID_PREF,ID_AHIG);
            if(ahig)
            {
              struct AHIGlobalPrefs *globalprefs;
              globalprefs = (struct AHIGlobalPrefs *)ahig->sp_Data;

              if(globalprefs->ahigp_DebugLevel != AHI_DEBUG_NONE)
              {
                Printf("Debugging is turned on.\n");
                rc = RETURN_WARN;
              }
            }

            ci = FindCollection(iff,ID_PREF,ID_AHIU);
            while(ci)
            {
              struct AHIUnitPrefs *unitprefs;
              unitprefs = (struct AHIUnitPrefs *)ci->ci_Data;

              if(unitprefs->ahiup_Unit == unit)
              {
                if(unitprefs->ahiup_Channels < 2)
                {
                  Printf("There are less than 2 channels selected for unit %ld.\n", unit);
                  rc = RETURN_WARN;
                }
              }
              ci=ci->ci_Next;
            }

          }
        }
        CloseIFF(iff);
      }
      Close(iff->iff_Stream);
    }
    FreeIFF(iff);
  }

  return rc;
}
Пример #6
0
struct List *GetUnits(char *name) {
  struct List *list;
  struct IFFHandle *iff;
  BOOL devnodes[UNITNODES] = { FALSE, FALSE, FALSE, FALSE } ;
  BOOL lownode = FALSE;
  int i;

  globalprefs.ahigp_MaxCPU = (90 << 16) / 100;

  list = AllocVec(sizeof(struct List), MEMF_CLEAR);
  
  if(list) {
    NewList(list);
    
    if(name && (iff = AllocIFF())) {
      iff->iff_Stream = Open(name, MODE_OLDFILE);
      if(iff->iff_Stream) {
        InitIFFasDOS(iff);
        if(!OpenIFF(iff, IFFF_READ)) {
          if(!(PropChunk      (iff, ID_PREF, ID_AHIG) ||
               CollectionChunk(iff, ID_PREF, ID_AHIU) ||
               StopOnExit     (iff, ID_PREF, ID_FORM))) {
            if(ParseIFF(iff, IFFPARSE_SCAN) == IFFERR_EOC) {
              struct StoredProperty *global = FindProp(iff, ID_PREF, ID_AHIG);
              struct CollectionItem *ci = FindCollection(iff, ID_PREF, ID_AHIU);

              if(global != NULL) {
                CopyMem(global->sp_Data, &globalprefs, 
                    min( sizeof(struct AHIGlobalPrefs), global->sp_Size ));
              }

              while(ci) {
                struct AHIUnitPrefs *p = ci->ci_Data;
                struct UnitNode     *u;

                u = AllocVec(sizeof(struct UnitNode), MEMF_CLEAR);
                if(u == NULL)
                  break;
                CopyMem(p, &u->prefs, 
                    min( sizeof(struct AHIUnitPrefs), ci->ci_Size ));

                FillUnitName(u);
                
                u->node.ln_Pri = -(u->prefs.ahiup_Unit);
                Enqueue(list, (struct Node *) u);
                
                if(u->prefs.ahiup_Unit == AHI_NO_UNIT) {
                  lownode = TRUE;
                }
                else if(u->prefs.ahiup_Unit < UNITNODES) {
                  devnodes[u->prefs.ahiup_Unit] = TRUE;
                }
                
                ci=ci->ci_Next;
              }
            }
          }
          CloseIFF(iff);
        }
        Close(iff->iff_Stream);
      }
      FreeIFF(iff);
    }


    // Fill up to lowlevel + UNITNODES device nodes, if not found in prefs file

    if(!lownode) AddUnit(list, AHI_NO_UNIT);
    for(i = 0; i < UNITNODES; i++) {
      if(!devnodes[i]) AddUnit(list, i);
    }

  }

  return list;
}
Пример #7
0
bool IPCCollectionType::GetMethod(LSOBJECTDATA &ObjectData, PLSTYPEMETHOD pMethod, int argc, char *argv[])
{
/*******************************************
 * Parameters
 *
 * [in] LSOBJECTDATA ObjectData: ObjectData is a 32-bit value that can be accessed in any number of different ways
 *        by way of union.  Most commonly, ObjectData.Ptr, ObjectData.DWord, or ObjectData.CharPtr are useful.  This
 *        value is the representation of some object of this object type.  "ipcfoo" works on IPCFoo*
 *        so ObjectData is a IPCFoo*
 *
 * [in] PLSTYPEMETHOD pMethod: pMethod is a pointer to the information on the method to be retrieved, including its
 *        Name and ID.  We use the ID in a switch statement in order to quickly process the method, since the Name
 *        has already been resolved by the LavishScript engine.
 *
 * [in] int argc, char *argv[]: argc and argv are *nearly* standard C console program parameters.  The difference here
 *        is that the name of the method is NOT given as the first argument (in contrast to LavishScript commands).
 *        Therefore, argc is 0 unless arguments are specifically given to the method retrieval.
 */

/*******************************************
 * Return Value
 *
 * The return value for this function is very simple.  If the method execution fails for any reason, OR the object
 * is destroyed during execution, return false.  Otherwise, return true (indicating the object still exists AND
 * the method execution succeeded).
 *
 */
	/* Validate the pointer */
	if (!pCollection)
		return false;

	/* Perform the given member retrieval */
	switch(pMethod->ID)
	{
	case Erase:
		if(argc)
		{
			pCollection->Collection->RemoveItem(argv[0]);
			CollectionRelay(pCollection->IPCName, pCollection->Type->GetName(), pCollection->SubType, "Erase", argc, argv);
			return true;
		}
		return false;
	case Clear:
		pCollection->Collection->Clear();
		CollectionRelay(pCollection->IPCName, pCollection->Type->GetName(), pCollection->SubType, "Clear", argc, argv);
		return true;
	case Set:
		if (argc>1)
		{			
			pCollection->Collection->SetItem(argv[0], argc-1, &argv[1]);
			CollectionRelay(pCollection->IPCName, pCollection->Type->GetName(), pCollection->SubType, "Set", argc, argv);
			return true;
		}
	case SetIPCName:
		if(argc==1)
		{
			LSObjectCollection *newCollection;
			strncpy(pCollection->IPCName, argv[0], sizeof(pCollection->IPCName));
			if((newCollection=FindCollection(pCollection->IPCName))==0)
			{
				newCollection = new LSObjectCollection(pCollection->Type, pCollection->SubType);
				AddCollection(pCollection->IPCName, newCollection);
			}
			pCollection->Collection = newCollection;
			return true;
		}
		return false;
	case GetIterator:
		LSOBJECT iteratorobject;
		if(argc)
		{
			//printf("%s %s %d", argv[0], pCollection->IPCName, pCollection->Collection->GetContainerUsed());
			if(pLSInterface->DataParse(argv[0], iteratorobject))
			{
				return InitializeIterator(pCollection->Collection, 0, iteratorobject);
			}
		}
		return false;
	}
	return false;
}
Пример #8
0
                            {
                                AHIBase->ahib_AntiClickTime = 0;
                            }

                            if( (ULONG) ahig->sp_Size > offsetof( struct AHIGlobalPrefs,
                                                                  ahigp_ScaleMode ) )
                            {
                                AHIBase->ahib_ScaleMode = globalprefs->ahigp_ScaleMode;
                                EndianSwap( sizeof (UWORD), &AHIBase->ahib_ScaleMode );
                            }
                            else
                            {
                                AHIBase->ahib_ScaleMode = AHI_SCALE_FIXED_0_DB;
                            }
                        }
                        ci=FindCollection(iff,ID_PREF,ID_AHIU);
                        while(ci)
                        {
                            struct AHIUnitPrefs *unitprefs;

                            unitprefs = (struct AHIUnitPrefs *)ci->ci_Data;

                            if(iounit)
                            {
                                if(unitprefs->ahiup_Unit == iounit->UnitNum)
                                {
                                    iounit->AudioMode       = unitprefs->ahiup_AudioMode;
                                    iounit->Frequency       = unitprefs->ahiup_Frequency;
                                    iounit->Channels        = unitprefs->ahiup_Channels;
                                    iounit->MonitorVolume   = unitprefs->ahiup_MonitorVolume;
                                    iounit->InputGain       = unitprefs->ahiup_InputGain;
Пример #9
0
static ULONG
AddModeFile ( UBYTE *filename )
{
  struct IFFHandle *iff;
  struct StoredProperty *name,*data;
  struct CollectionItem *ci;
  struct TagItem *tag,*tstate;
  struct TagItem extratags[]=
  {
    { AHIDB_Driver, NULL },
    { AHIDB_Data, NULL },
    { TAG_MORE,   NULL }
  };
  ULONG rc=FALSE;

  iff = AllocIFF();

  if(iff != NULL)
  {

    iff->iff_Stream = Open(filename, MODE_OLDFILE);

    if(iff->iff_Stream != NULL)
    {
      InitIFFasDOS(iff);

      if(!OpenIFF(iff, IFFF_READ))
      {

        if(!(PropChunk(iff,       ID_AHIM, ID_AUDN)
          || PropChunk(iff,       ID_AHIM, ID_AUDD)
          || CollectionChunk(iff, ID_AHIM, ID_AUDM)
          || StopOnExit(iff,      ID_AHIM, ID_FORM)))
        {
          if(ParseIFF(iff, IFFPARSE_SCAN) == IFFERR_EOC)
          {
            name = FindProp(iff,       ID_AHIM, ID_AUDN);
            data = FindProp(iff,       ID_AHIM, ID_AUDD);
            ci   = FindCollection(iff, ID_AHIM, ID_AUDM);

            if(name != NULL)
            {
              extratags[0].ti_Data = (ULONG) name->sp_Data;
            }

            if(data != NULL)
            {
              extratags[1].ti_Data = (ULONG) data->sp_Data;
            }

            rc = TRUE;

            while(ci != NULL)
            {
              // Relocate loaded taglist

              tstate = (struct TagItem *) ci->ci_Data;
              while((tag = NextTagItem(&tstate)) != NULL )
              {
                if(tag->ti_Tag & (AHI_TagBaseR ^ AHI_TagBase))
                {
                  tag->ti_Data += (ULONG) ci->ci_Data;
                }
              }

              // Link taglists

              extratags[2].ti_Data = (ULONG) ci->ci_Data;

              rc = AHI_AddAudioMode(extratags);

              ci = ci->ci_Next;
            }
          }
        }
        CloseIFF(iff);
      }
      Close(iff->iff_Stream);
    }
    FreeIFF(iff);
  }

  return rc;
}