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; }
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; } }
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; }
static void readDatabaseFile(Entries entries, struct IFFHandle *iff) { struct ContextNode *cn; struct _Entry entry; struct StoredProperty *sp; struct _Automatic automatic; char *data; LONG *p; int error, n, i; PropChunk(iff, ID_FTXT, ID_AUTO); StopChunk(iff, ID_FTXT, ID_CHRS); error = ParseIFF(iff, IFFPARSE_SCAN); /* Read AUTO entries first */ sp = FindProp(iff, ID_FTXT, ID_AUTO); n = AUTO_SIZE; if (sp -> sp_Size && sp -> sp_Size % n) myMsg1("auto sizes don't match. Old version? Doing my best..."); p = (LONG *) sp -> sp_Data; for (i = 0; i < sp -> sp_Size; i += n) { automatic.first.ds_Days = *p++; automatic.first.ds_Minute = *p++; automatic.first.ds_Tick = *p++; automatic.last.ds_Days = *p++; automatic.last.ds_Minute = *p++; automatic.last.ds_Tick = *p++; automatic.repeatDays = *p++; automatic.repeatWeeks = *p++; automatic.repeatMonths = *p++; automatic.repeatYears = *p++; memcpy(automatic.amount, p, AMOUNTL); p += (AMOUNTL/ sizeof(p)); memcpy(automatic.transaction,p, TRANSACTIONL);p += (TRANSACTIONL/sizeof(p)); memcpy(automatic.imputation, p,IMPUTATIONL); p += (IMPUTATIONL / sizeof(p)); DB_AddEntry((DataBase) entries -> automatic, & automatic); } /* And then the database itself */ cn = CurrentChunk(iff); n = ENTRY_SIZE; if (cn -> cn_Size && cn -> cn_Size % n) myMsg1("entry sizes don't match. Old version? Doing my best..."); for (i=0; i < cn -> cn_Size; i += n) { struct DateStamp *ds = & entry.date; ReadChunkBytes(iff, & ds -> ds_Days, sizeof(LONG)); ReadChunkBytes(iff, & ds -> ds_Minute, sizeof(LONG)); ReadChunkBytes(iff, & ds -> ds_Tick, sizeof(LONG)); ReadChunkBytes(iff, & entry.transaction, TRANSACTIONL); ReadChunkBytes(iff, & entry.amount, AMOUNTL); ReadChunkBytes(iff, & entry.checkNumber, CHECKNUMBERL); ReadChunkBytes(iff, & entry.imputation, IMPUTATIONL); ReadChunkBytes(iff, & entry.reason, REASONL); ReadChunkBytes(iff, & entry.validated, 4); addEntryDatabase(entries, & entry, 0, 0); /* not a fake entry */ } }
CWideString RTFuserprops::GetOriginalSource() { CWideString sValue(""); FindProp( DELTAVIEW_ORIGINAL_SOURCE, NULL, &sValue ); return sValue; }
CWideString RTFuserprops::GetModifiedSource() { CWideString sValue(""); FindProp( DELTAVIEW_MODIFIED_SOURCE, NULL, &sValue ); return sValue; }
CWideString RTFuserprops::GetDateSent() { CWideString sValue(""); FindProp( DELTAVIEW_DATESENT, NULL, &sValue ); return sValue; }
int RTFuserprops::GetModality() { int iVal; FindProp( DELTAVIEW_MODALITY, &iVal, NULL ); return iVal; }
CWideString RTFuserprops::GetDeltaViewFileSender() { CWideString sValue(""); FindProp( DELTAVIEW_SENDER, NULL, &sValue ); return sValue; }
bool RTFuserprops::IsDeltaViewFile() { int iVal; return (FindProp( DELTAVIEW_MARKER, &iVal, NULL ) == rtfec_OK); }
BOOL ReadConfig ( struct AHIDevUnit *iounit, struct AHIBase *AHIBase ) { struct IFFHandle *iff; struct StoredProperty *prhd,*ahig; struct CollectionItem *ci; ULONG *mode; 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=(ULONG) 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; UWORD debug_level; globalprefs = (struct AHIGlobalPrefs *)ahig->sp_Data; debug_level = globalprefs->ahigp_DebugLevel; EndianSwap( sizeof (UWORD), &debug_level ); AHIBase->ahib_DebugLevel = debug_level; AHIBase->ahib_Flags = 0; /* Not used in version 5: * * 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; EndianSwap( sizeof (Fixed), &AHIBase->ahib_MaxCPU ); } else { AHIBase->ahib_MaxCPU = 0x10000 * 90 / 100; } /* In version 5: Clipping is always used * * 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; EndianSwap( sizeof (Fixed), &AHIBase->ahib_AntiClickTime ); } else { 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; } }
base::PropertyBase* PropertyBag::getProperty(const std::string& name) const { const_iterator i( std::find_if(mproperties.begin(), mproperties.end(), std::bind2nd(FindProp(), name ) ) ); if ( i != mproperties.end() ) return *i; return 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; }