BOOLEAN init_scsi() { /* Defaults setzen */ SetBlockSize(512L); return init_scsiio(); }
void * cdecl malloc(size_t tSize) #endif { USHORT usSel; void * pRet; /* CheckHeap();*/ GetMemAccess(); if (tSize % 2) tSize++; if( tSize > 0 ) { for (usSel = 0; usSel < MAX_SELECTORS; usSel++) { if (rgpSegment[usSel] && rgpSegment[usSel] != RESERVED_SEGMENT) { pRet = FindFreeSpace(rgpSegment[usSel], tSize); if (pRet) goto malloc_exit; } } for (usSel = 0; usSel < MAX_SELECTORS; usSel++) { if (!rgpSegment[usSel]) { rgpSegment[usSel] = RESERVED_SEGMENT; rgpSegment[usSel] = gdtAlloc(HEAP_SIZE, TRUE); if (!rgpSegment[usSel]) { CritMessage("FAT32: No gdtSelector for heap!"); pRet = NULL; goto malloc_exit; } SetBlockSize(rgpSegment[usSel], HEAP_SIZE - sizeof (ULONG)); SetFree(rgpSegment[usSel]); pRet = FindFreeSpace(rgpSegment[usSel], tSize); if (pRet) goto malloc_exit; } } } if (f32Parms.fMessageActive & LOG_MEM) Message("Malloc failed, calling gdtAlloc"); pRet = gdtAlloc(tSize ? ( ULONG )tSize : 65536L, TRUE); malloc_exit: if (f32Parms.fMessageActive & LOG_MEM) Message("malloc %lu bytes at %lX", tSize ? ( ULONG )tSize : 65536L, pRet); ReleaseMemAccess(); return pRet; }
bool EffectBassTreble::RealtimeInitialize() { SetBlockSize(512); mSlaves.clear(); return true; }
bool EffectPhaser::RealtimeInitialize() { SetBlockSize(512); mSlaves.Clear(); return true; }
bool EffectWahwah::RealtimeInitialize() { SetBlockSize(512); mSlaves.clear(); return true; }
bool EffectDistortion::RealtimeInitialize() { SetBlockSize(512); mSlaves.Clear(); return true; }
IPlugVST::IPlugVST(IPlugInstanceInfo instanceInfo, int nParams, const char* channelIOStr, int nPresets, const char* effectName, const char* productName, const char* mfrName, int vendorVersion, int uniqueID, int mfrID, int latency, int plugDoesMidi, bool plugDoesChunks, bool plugIsInst) : IPlugBase(nParams, channelIOStr, nPresets, effectName, productName, mfrName, vendorVersion, uniqueID, mfrID, latency, plugDoesMidi, plugDoesChunks, plugIsInst), mHostCallback(instanceInfo.mVSTHostCallback), mHostSpecificInitDone(false) { Trace(TRACELOC, "%s", effectName); mHasVSTExtensions = VSTEXT_NONE; int nInputs = NInChannels(), nOutputs = NOutChannels(); memset(&mAEffect, 0, sizeof(AEffect)); mAEffect.object = this; mAEffect.magic = kEffectMagic; mAEffect.dispatcher = VSTDispatcher; mAEffect.getParameter = VSTGetParameter; mAEffect.setParameter = VSTSetParameter; mAEffect.numPrograms = nPresets; mAEffect.numParams = nParams; mAEffect.numInputs = nInputs; mAEffect.numOutputs = nOutputs; mAEffect.uniqueID = uniqueID; mAEffect.version = GetEffectVersion(true); mAEffect.__ioRatioDeprecated = 1.0f; mAEffect.__processDeprecated = VSTProcess; mAEffect.processReplacing = VSTProcessReplacing; mAEffect.processDoubleReplacing = VSTProcessDoubleReplacing; mAEffect.initialDelay = latency; mAEffect.flags = effFlagsCanReplacing | effFlagsCanDoubleReplacing; if (plugDoesChunks) { mAEffect.flags |= effFlagsProgramChunks; } if (LegalIO(1, -1)) { mAEffect.flags |= __effFlagsCanMonoDeprecated; } if (plugIsInst) { mAEffect.flags |= effFlagsIsSynth; } memset(&mEditRect, 0, sizeof(ERect)); memset(&mInputSpkrArr, 0, sizeof(VstSpeakerArrangement)); memset(&mOutputSpkrArr, 0, sizeof(VstSpeakerArrangement)); mInputSpkrArr.numChannels = nInputs; mOutputSpkrArr.numChannels = nOutputs; mInputSpkrArr.type = VSTSpkrArrType(nInputs); mOutputSpkrArr.type = VSTSpkrArrType(nOutputs); // Default everything to connected, then disconnect pins if the host says to. SetInputChannelConnections(0, nInputs, true); SetOutputChannelConnections(0, nOutputs, true); SetBlockSize(DEFAULT_BLOCK_SIZE); }
// constructor ResourceItem::ResourceItem() : BMallocIO(), fOffset(0), fInitialSize(0), fType(0), fID(0), fName(), fIsLoaded(false), fIsModified(false) { SetBlockSize(1); }
/********************************************************************* * FindFreeSpace *********************************************************************/ void * FindFreeSpace(void * pStart, size_t tSize) { BYTE _huge * pHeapStart; BYTE _huge * pHeapEnd; BYTE _huge * pWork; BYTE _huge * pNext; USHORT rc; pHeapStart = pStart; pHeapEnd = pHeapStart + HEAP_SIZE; rc = MY_PROBEBUF(PB_OPREAD, (PBYTE)pHeapStart, HEAP_SIZE); if (rc) { CritMessage("FAT32: Protection VIOLATION in FindFreeSpace (SYS%d)", rc); Message("FAT32: Protection VIOLATION in FindFreeSpace (SYS%d)", rc); return NULL; } pWork = pHeapStart; while (pWork < pHeapEnd) { if (BlockSize(pWork) >= tSize && IsBlockFree(pWork)) { ULONG ulRemaining = BlockSize(pWork) - tSize; if (ulRemaining > sizeof (ULONG)) { pNext = pWork + sizeof (ULONG) + tSize; SetBlockSize(pNext, BlockSize(pWork) - tSize - sizeof (ULONG)); SetFree(pNext); SetBlockSize(pWork, tSize); } SetInUse(pWork); return pWork + sizeof (ULONG); } pWork += BlockSize(pWork) + sizeof (ULONG); } return NULL; }
CNFORenderer::CNFORenderer(bool a_classicMode) : m_classic(a_classicMode), m_partial(NRP_RENDER_EVERYTHING), m_forceGPUOff(false), m_allowCPUFallback(true), m_onDemandRendering(false), m_preRenderThread(NULL), m_gridData(NULL), m_rendered(false), m_linesPerStripe(0), m_stripeHeight(0), m_numStripes(0), m_fontSize(-1), m_zoomFactor(1.0f), m_hasBlocks(false), m_stopPreRendering(true), m_preRenderingStripe((size_t)-1), m_cancelRenderingImmediately(false) { // default settings: SetFontAntiAlias(true); SetBackColor(_S_COLOR_RGB(0xFF, 0xFF, 0xFF)); SetTextColor(_S_COLOR_RGB(0, 0, 0)); SetArtColor(_S_COLOR_RGB(0, 0, 0)); SetHilightHyperLinks(true); SetHyperLinkColor(_S_COLOR_RGB(0, 0, 0xFF)); SetUnderlineHyperLinks(true); if(!m_classic) { SetBlockSize(7, 12); m_settings.uFontSize = 0; SetEnableGaussShadow(true); SetGaussColor(_S_COLOR_RGB(128, 128, 128)); SetGaussBlurRadius(15); m_padding = 8; } else { SetFontSize(ms_defaultClassicFontSize); m_settings.uBlockHeight = m_settings.uBlockWidth = 0; m_settings.uGaussBlurRadius = 0; SetEnableGaussShadow(false); m_padding = 5; } }
/********************************************************************* * Malloc *********************************************************************/ void * cdecl Malloc(size_t tSize) { USHORT usSel; void * pRet; if (tSize % 2) tSize++; for (usSel = 0; usSel < MAX_SELECTORS; usSel++) { if (rgpSegment[usSel]) { pRet = FindFreeSpace(rgpSegment[usSel], tSize); if (pRet) goto Malloc_exit; } } for (usSel = 0; usSel < MAX_SELECTORS; usSel++) { if (!rgpSegment[usSel]) { rgpSegment[usSel] = gdtAlloc(HEAP_SIZE, TRUE); if (!rgpSegment[usSel]) { errmsg("FAT32: No gdtSelector for heap!"); return NULL; } SetBlockSize(rgpSegment[usSel], HEAP_SIZE - sizeof (ULONG)); SetFree(rgpSegment[usSel]); pRet = FindFreeSpace(rgpSegment[usSel], tSize); if (pRet) goto Malloc_exit; } } pRet = NULL; Malloc_exit: if (pRet) ulMem += tSize; sprintf(szLast, "malloc %u bytes %p", tSize, pRet); printf("%s\n", szLast); return pRet; }
/********************************************************************* * FindFreeSpace *********************************************************************/ void * FindFreeSpace(void * pStart, size_t tSize) { BYTE _huge * pHeapStart; BYTE _huge * pHeapEnd; BYTE _huge * pWork; BYTE _huge * pNext; pHeapStart = pStart; pHeapEnd = pHeapStart + HEAP_SIZE; pWork = pHeapStart; while (pWork < pHeapEnd) { if (BlockSize(pWork) >= tSize && IsBlockFree(pWork)) { ULONG ulRemaining = BlockSize(pWork) - tSize; if (ulRemaining > sizeof (ULONG)) { pNext = pWork + sizeof (ULONG) + tSize; SetBlockSize(pNext, BlockSize(pWork) - tSize - sizeof (ULONG)); SetFree(pNext); SetBlockSize(pWork, tSize); } else { printf("Remaining %lu bytes\n", ulRemaining); ulMem += ulRemaining; } SetInUse(pWork); return pWork + sizeof (ULONG); } pWork += BlockSize(pWork) + sizeof (ULONG); } return NULL; }
IPlugAAX::IPlugAAX(IPlugInstanceInfo instanceInfo, int nParams, const char* channelIOStr, int nPresets, const char* effectName, const char* productName, const char* mfrName, int vendorVersion, int uniqueID, int mfrID, int latency, bool plugDoesMidi, bool plugDoesChunks, bool plugIsInst, int plugScChans) : IPlugBase(nParams, channelIOStr, nPresets, effectName, productName, mfrName, vendorVersion, uniqueID, mfrID, latency, plugDoesMidi, plugDoesChunks, plugIsInst, kAPIAAX) , AAX_CIPlugParameters() , mTransport(0) { Trace(TRACELOC, "%s%s", effectName, channelIOStr); SetInputChannelConnections(0, NInChannels(), true); SetOutputChannelConnections(0, NOutChannels(), true); if (NInChannels()) { mDelay = new NChanDelayLine(NInChannels(), NOutChannels()); mDelay->SetDelayTime(latency); } SetBlockSize(DEFAULT_BLOCK_SIZE); SetHost("ProTools", vendorVersion); // TODO:vendor version correct? }
IPlugStandalone::IPlugStandalone(IPlugInstanceInfo instanceInfo, int nParams, const char* channelIOStr, int nPresets, const char* effectName, const char* productName, const char* mfrName, int vendorVersion, int uniqueID, int mfrID, int latency, bool plugDoesMidi, bool plugDoesChunks, bool plugIsInst, int plugScChans) : IPlugBase(nParams, channelIOStr, nPresets, effectName, productName, mfrName, vendorVersion, uniqueID, mfrID, latency, plugDoesMidi, plugDoesChunks, plugIsInst, kAPISA) { Trace(TRACELOC, "%s%s", effectName, channelIOStr); SetInputChannelConnections(0, NInChannels(), true); SetOutputChannelConnections(0, NOutChannels(), true); SetBlockSize(DEFAULT_BLOCK_SIZE); SetHost("standalone", vendorVersion); #ifdef OS_IOS mIOSLink = instanceInfo.mIOSLink; #else mMidiOutChan = instanceInfo.mMidiOutChan; mMidiOut = instanceInfo.mRTMidiOut; #endif }
Void BonkEnc::ConfigureFLAC::SetStreamableSubset() { if (streamable_subset) { edit_blocksize->Deactivate(); slider_blocksize->SetRange(24, 576); slider_max_lpc_order->SetRange(0, 12); } else { edit_blocksize->Activate(); slider_blocksize->SetRange(24, 4096); slider_max_lpc_order->SetRange(0, 32); } SetBlockSize(); }
int COMPRESSION_METHOD::server() { char *service = p._str("service"); // Global services if (strequ (service, "register")) return FREEARC_OK; //to do: Register(); // Invocation-specific services if (strequ (service, "decompress")) {parse_method(); return decompress (p._callback("callback"), p);} #ifndef FREEARC_DECOMPRESS_ONLY if (strequ (service, "compress")) {parse_method(); return compress (p._callback("callback"), p);} if (strequ (service, "canonize")) {parse_method(); char a[1000]; ShowCompressionMethod(a); return p._return(a);} if (strequ (service, "SetCompressionMem")) {parse_method(); SetCompressionMem (p._int("mem")); char a[1000]; ShowCompressionMethod(a); return p._return(a);} if (strequ (service, "SetDictionary")) {parse_method(); SetDictionary (p._int("mem")); char a[1000]; ShowCompressionMethod(a); return p._return(a);} if (strequ (service, "SetBlockSize")) {parse_method(); SetBlockSize (p._int("mem")); char a[1000]; ShowCompressionMethod(a); return p._return(a);} if (strequ (service, "SetDecompressionMem")) {parse_method(); SetDecompressionMem(p._int("mem")); char a[1000]; ShowCompressionMethod(a); return p._return(a);} if (strequ (service, "GetCompressionMem")) {parse_method(); return p._return (GetCompressionMem());} if (strequ (service, "GetDictionary")) {parse_method(); return p._return (GetDictionary());} if (strequ (service, "GetBlockSize")) {parse_method(); return p._return (GetBlockSize());} #endif if (strequ (service, "GetDecompressionMem")) {parse_method(); return p._return (GetDecompressionMem());} return FREEARC_ERRCODE_NOT_IMPLEMENTED; }
BonkEnc::ConfigureFLAC::ConfigureFLAC() { Point pos; Size size; currentConfig = BonkEnc::currentConfig; preset = currentConfig->flac_preset; streamable_subset = currentConfig->flac_streamable_subset; do_mid_side_stereo = currentConfig->flac_do_mid_side_stereo; loose_mid_side_stereo = currentConfig->flac_loose_mid_side_stereo; blocksize = currentConfig->flac_blocksize / 8; max_lpc_order = currentConfig->flac_max_lpc_order; qlp_coeff_precision = currentConfig->flac_qlp_coeff_precision; do_qlp_coeff_prec_search = currentConfig->flac_do_qlp_coeff_prec_search; do_exhaustive_model_search = currentConfig->flac_do_exhaustive_model_search; min_residual_partition_order = currentConfig->flac_min_residual_partition_order; max_residual_partition_order = currentConfig->flac_max_residual_partition_order; mainWnd = new Window(String(BonkEnc::i18n->TranslateString("%1 encoder configuration")).Replace("%1", "FLAC"), currentConfig->wndPos + Point(80, 80), Size(520, 332)); mainWnd->SetRightToLeft(BonkEnc::i18n->IsActiveLanguageRightToLeft()); mainWnd_titlebar = new Titlebar(TB_CLOSEBUTTON); divbar = new Divider(39, OR_HORZ | OR_BOTTOM); layer_simple = new Layer(BonkEnc::i18n->TranslateString("Basic")); layer_format = new Layer(BonkEnc::i18n->TranslateString("Format")); layer_advanced = new Layer(BonkEnc::i18n->TranslateString("Expert")); pos.x = 175; pos.y = 29; size.cx = 0; size.cy = 0; btn_cancel = new Button(BonkEnc::i18n->TranslateString("Cancel"), NIL, pos, size); btn_cancel->onAction.Connect(&ConfigureFLAC::Cancel, this); btn_cancel->SetOrientation(OR_LOWERRIGHT); pos.x -= 88; btn_ok = new Button(BonkEnc::i18n->TranslateString("OK"), NIL, pos, size); btn_ok->onAction.Connect(&ConfigureFLAC::OK, this); btn_ok->SetOrientation(OR_LOWERRIGHT); pos.x = 7; pos.y = 7; size.cx = 498; size.cy = 245; tabwidget = new TabWidget(pos, size); pos.x = 7; pos.y = 11; size.cx = 480; size.cy = 39; group_preset = new GroupBox(BonkEnc::i18n->TranslateString("Presets"), pos, size); pos.x += 9; pos.y += 13; text_preset = new Text(BonkEnc::i18n->TranslateString("Use preset:"), pos); pos.x += (text_preset->textSize.cx + 8); pos.y -= 3; size.cx = 453 - text_preset->textSize.cx; size.cy = 0; combo_preset = new ComboBox(pos, size); combo_preset->AddEntry(BonkEnc::i18n->TranslateString("Custom settings")); combo_preset->AddEntry(String("0").Append(", ").Append(BonkEnc::i18n->TranslateString("Fastest encoding"))); combo_preset->AddEntry("1"); combo_preset->AddEntry("2"); combo_preset->AddEntry("3"); combo_preset->AddEntry("4"); combo_preset->AddEntry("5"); combo_preset->AddEntry("6"); combo_preset->AddEntry("7"); combo_preset->AddEntry(String("8").Append(", ").Append(BonkEnc::i18n->TranslateString("Best compression"))); combo_preset->SelectNthEntry(currentConfig->flac_preset + 1); combo_preset->onSelectEntry.Connect(&ConfigureFLAC::SetPreset, this); pos.x = 7; pos.y = 62; size.cx = 150; size.cy = 65; group_stereo = new GroupBox(BonkEnc::i18n->TranslateString("Stereo mode"), pos, size); pos.x += 10; pos.y += 13; size.cx = 130; size.cy = 0; check_mid_side_stereo = new CheckBox(BonkEnc::i18n->TranslateString("Joint Stereo"), pos, size, &do_mid_side_stereo); check_mid_side_stereo->onAction.Connect(&ConfigureFLAC::SetStereoMode, this); pos.y += 25; check_loose_mid_side = new CheckBox(BonkEnc::i18n->TranslateString("Adaptive Joint Stereo"), pos, size, &loose_mid_side_stereo); pos.x = 7; pos.y = 11; size.cx = 480; size.cy = 66; group_format = new GroupBox(BonkEnc::i18n->TranslateString("Format"), pos, size); pos.x += 10; pos.y += 13; size.cy = 0; check_streamable_subset = new CheckBox(BonkEnc::i18n->TranslateString("Use streamable subset"), pos, size, &streamable_subset); check_streamable_subset->onAction.Connect(&ConfigureFLAC::SetStreamableSubset, this); check_streamable_subset->SetWidth(check_streamable_subset->textSize.cx + 21); pos.x -= 1; pos.y += 27; text_blocksize = new Text(BonkEnc::i18n->TranslateString("Blocksize:"), pos); pos.x += text_blocksize->textSize.cx + 7; pos.y -= 2; size.cx = 319; slider_blocksize = new Slider(pos, size, OR_HORZ, &blocksize, 24, 4096); slider_blocksize->onValueChange.Connect(&ConfigureFLAC::SetBlockSize, this); pos.x += 328; pos.y -= 1; size.cx = 37; edit_blocksize = new EditBox("", pos, size, 5); edit_blocksize->onInput.Connect(&ConfigureFLAC::EditBlockSize, this); pos.x += 44; pos.y += 3; text_blocksize_bytes = new Text(BonkEnc::i18n->TranslateString("bytes"), pos); pos.x = 7; pos.y = 11; size.cx = 480; size.cy = 56; group_apodization = new GroupBox(BonkEnc::i18n->TranslateString("Apodization"), pos, size); pos.x += 9; pos.y += 13; size.cy = 0; text_apodization = new Text(BonkEnc::i18n->TranslateString("Apodization function(s):"), pos); pos.x += text_apodization->textSize.cx + 7; pos.y -= 3; size.cx = 454 - text_apodization->textSize.cx; edit_apodization = new EditBox(currentConfig->flac_apodization, pos, size); list_apodization = new ListBox(pos, size); list_apodization->AddEntry("bartlett"); list_apodization->AddEntry("bartlett_hann"); list_apodization->AddEntry("blackman"); list_apodization->AddEntry("blackman_harris_4term_92db"); list_apodization->AddEntry("connes"); list_apodization->AddEntry("flattop"); list_apodization->AddEntry("gauss(0.2)"); list_apodization->AddEntry("hamming"); list_apodization->AddEntry("hann"); list_apodization->AddEntry("kaiser_bessel"); list_apodization->AddEntry("nuttall"); list_apodization->AddEntry("rectangle"); list_apodization->AddEntry("triangle"); list_apodization->AddEntry("tukey(0.5)"); list_apodization->AddEntry("welch"); edit_apodization->SetDropDownList(list_apodization); pos.x += 2; pos.y += 25; text_apodization_explain= new Text(String(BonkEnc::i18n->TranslateString("Note:")).Append(" ").Append(BonkEnc::i18n->TranslateString("You can specify multiple functions separated by semicolons.")), pos); pos.x = 7; pos.y = 79; size.cx = 480; size.cy = 62; group_lpc = new GroupBox(BonkEnc::i18n->TranslateString("Linear predictor"), pos, size); pos.x += 9; pos.y += 13; text_max_lpc_order = new Text(String(BonkEnc::i18n->TranslateString("Maximum LPC order")).Append(":"), pos); pos.x += 7; pos.y -= 2; size.cx = 250; slider_max_lpc_order = new Slider(pos, size, OR_HORZ, &max_lpc_order, 0, 32); slider_max_lpc_order->onValueChange.Connect(&ConfigureFLAC::SetLPCOrder, this); pos.x += 257; pos.y += 2; text_max_lpc_order_value= new Text(BonkEnc::i18n->TranslateString("disabled"), pos); pos.x += 50; pos.y -= 2; size.cx = 150; size.cy = 0; check_exhaustive_model = new CheckBox(BonkEnc::i18n->TranslateString("Exhaustive model search"), pos, size, &do_exhaustive_model_search); pos.x -= 314; pos.y += 25; text_qlp_precision = new Text(String(BonkEnc::i18n->TranslateString("Quantized LPC precision")).Append(":"), pos); pos.x += 7; pos.y -= 2; size.cx = 250; slider_qlp_precision = new Slider(pos, size, OR_HORZ, &qlp_coeff_precision, 0, 32); slider_qlp_precision->onValueChange.Connect(&ConfigureFLAC::SetQLPPrecision, this); pos.x += 257; pos.y += 2; text_qlp_precision_value= new Text(BonkEnc::i18n->TranslateString("auto"), pos); pos.x += 50; pos.y -= 2; size.cx = 150; size.cy = 0; check_qlp_precision_search= new CheckBox(BonkEnc::i18n->TranslateString("Optimize LPC quantization"), pos, size, &do_qlp_coeff_prec_search); check_qlp_precision_search->onAction.Connect(&ConfigureFLAC::SetQLPSearch, this); Int maxTextSize = Math::Max(text_max_lpc_order_value->textSize.cx, text_qlp_precision_value->textSize.cx); check_exhaustive_model->SetX(text_max_lpc_order_value->GetX() + maxTextSize + 8); check_exhaustive_model->SetWidth(189 - maxTextSize); check_qlp_precision_search->SetX(text_max_lpc_order_value->GetX() + maxTextSize + 8); check_qlp_precision_search->SetWidth(189 - maxTextSize); pos.x = 7; pos.y = 153; size.cx = 296; size.cy = 62; group_rice = new GroupBox(BonkEnc::i18n->TranslateString("Residual coding"), pos, size); pos.x += 9; pos.y += 13; text_min_part_order = new Text(String(BonkEnc::i18n->TranslateString("Minimum partition order")).Append(":"), pos); pos.x += 7; pos.y -= 2; size.cx = 250; slider_min_part_order = new Slider(pos, size, OR_HORZ, &min_residual_partition_order, 0, 16); slider_min_part_order->onValueChange.Connect(&ConfigureFLAC::SetRiceOrder, this); pos.x += 257; pos.y += 2; text_min_part_order_value= new Text("", pos); pos.x -= 264; pos.y += 23; text_max_part_order = new Text(String(BonkEnc::i18n->TranslateString("Maximum partition order")).Append(":"), pos); pos.x += 7; pos.y -= 2; size.cx = 250; slider_max_part_order = new Slider(pos, size, OR_HORZ, &max_residual_partition_order, 0, 16); slider_max_part_order->onValueChange.Connect(&ConfigureFLAC::SetRiceOrder, this); pos.x += 257; pos.y += 2; text_max_part_order_value= new Text("", pos); maxTextSize = Math::Max(Math::Max(text_min_part_order->textSize.cx, text_max_part_order->textSize.cx), Math::Max(text_max_lpc_order->textSize.cx, text_qlp_precision->textSize.cx)); slider_min_part_order->SetX(group_lpc->GetX() + 16 + maxTextSize); slider_min_part_order->SetWidth(250 - maxTextSize); slider_max_part_order->SetX(group_lpc->GetX() + 16 + maxTextSize); slider_max_part_order->SetWidth(250 - maxTextSize); slider_max_lpc_order->SetX(group_lpc->GetX() + 16 + maxTextSize); slider_max_lpc_order->SetWidth(250 - maxTextSize); slider_qlp_precision->SetX(group_lpc->GetX() + 16 + maxTextSize); slider_qlp_precision->SetWidth(250 - maxTextSize); SetStereoMode(); SetStreamableSubset(); SetBlockSize(); SetRiceOrder(); SetLPCOrder(); SetQLPSearch(); SetQLPPrecision(); SetPreset(); Add(mainWnd); mainWnd->Add(btn_ok); mainWnd->Add(btn_cancel); mainWnd->Add(tabwidget); mainWnd->Add(mainWnd_titlebar); mainWnd->Add(divbar); tabwidget->Add(layer_simple); tabwidget->Add(layer_format); tabwidget->Add(layer_advanced); layer_simple->Add(group_preset); layer_simple->Add(text_preset); layer_simple->Add(combo_preset); layer_simple->Add(group_stereo); layer_simple->Add(check_mid_side_stereo); layer_simple->Add(check_loose_mid_side); layer_format->Add(group_format); layer_format->Add(check_streamable_subset); layer_format->Add(text_blocksize); layer_format->Add(slider_blocksize); layer_format->Add(edit_blocksize); layer_format->Add(text_blocksize_bytes); layer_advanced->Add(group_apodization); layer_advanced->Add(text_apodization); layer_advanced->Add(edit_apodization); layer_advanced->Add(text_apodization_explain); layer_advanced->Add(group_lpc); layer_advanced->Add(text_max_lpc_order); layer_advanced->Add(slider_max_lpc_order); layer_advanced->Add(text_max_lpc_order_value); layer_advanced->Add(check_exhaustive_model); layer_advanced->Add(check_qlp_precision_search); layer_advanced->Add(text_qlp_precision); layer_advanced->Add(slider_qlp_precision); layer_advanced->Add(text_qlp_precision_value); layer_advanced->Add(group_rice); layer_advanced->Add(text_min_part_order); layer_advanced->Add(text_max_part_order); layer_advanced->Add(slider_min_part_order); layer_advanced->Add(text_min_part_order_value); layer_advanced->Add(slider_max_part_order); layer_advanced->Add(text_max_part_order_value); mainWnd->SetFlags(mainWnd->GetFlags() | WF_NOTASKBUTTON); mainWnd->SetIcon(ImageLoader::Load("freac.pci:0")); }
void cdecl Free(void * pntr) { USHORT usSel; BYTE _huge * pHeapStart; BYTE _huge * pHeapEnd; BYTE _huge * pWork; BYTE _huge * pToFree = pntr; BYTE _huge * pPrev; BYTE _huge * pNext; #if 0 if (OFFSETOF(pntr) == 0) return Freeseg(pntr); #endif for (usSel = 0; usSel < MAX_SELECTORS; usSel++) { if (SELECTOROF(pntr) == SELECTOROF(rgpSegment[usSel])) break; } if (usSel == MAX_SELECTORS) errmsg("FAT32: %lX not found in Free!", pntr); ulMem -= *(PULONG)((PBYTE)pntr - sizeof (ULONG)); sprintf(szLast, "Free %lu bytes", *(PULONG)((PBYTE)pntr - sizeof (ULONG))); printf("%s\n", szLast); pHeapStart = rgpSegment[usSel]; pHeapEnd = pHeapStart + HEAP_SIZE; pWork = pHeapStart; pPrev = NULL; while (pWork < pHeapEnd) { if (pWork + sizeof (ULONG) == pToFree) { if (pPrev && IsBlockFree(pPrev)) { SetBlockSize(pPrev, BlockSize(pPrev) + BlockSize(pWork) + sizeof (ULONG)); pWork = pPrev; } pNext = pWork + BlockSize(pWork) + sizeof (ULONG); if (pNext < pHeapEnd && IsBlockFree(pNext)) SetBlockSize(pWork, BlockSize(pWork) + BlockSize(pNext) + sizeof (ULONG)); SetFree(pWork); break; } else pPrev = pWork; pWork += BlockSize(pWork) + sizeof (ULONG); } if (pWork >= pHeapEnd) { errmsg("FAT32: ERROR: Address not found in Free"); return; } /* Free selector if no longer needed */ if (usSel > 0 && BlockSize(rgpSegment[usSel]) == (HEAP_SIZE - sizeof (ULONG)) && IsBlockFree(rgpSegment[usSel])) { Freeseg(rgpSegment[usSel]); rgpSegment[usSel] = NULL; } }
int main(int argc,char *argv[]) { double val; double ts; void *data_set; int size; int c; int curr; int ierr; char fname[255]; if(argc < 2) { fprintf(stderr,"usage: testinput -f filename\n"); fflush(stderr); exit(1); } fname[0] = 0; memset(fname,0,sizeof(fname)); while((c = getopt(argc,argv,PRED_ARGS)) != EOF) { switch(c) { case 'f': strncpy(fname,optarg,sizeof(fname)); break; default: fprintf(stderr,"unrecognized argument %c\n", c); fflush(stderr); break; } } if(fname[0] == 0) { fprintf(stderr,"usage: testinput -f fname\n"); fflush(stderr); exit(1); } ierr = InitDataSet(&data_set,2); if(ierr == 0) { fprintf(stderr,"testinput error: InitDataSet failed\n"); exit(1); } SetBlockSize(data_set,14); ierr = LoadDataSet(fname,data_set); if(ierr == 0) { fprintf(stderr, "testinput error: LoadDataSet failed for %s\n", fname); exit(1); } while(ReadEntry(data_set,&ts,&val)) { fprintf(stdout,"%d %f\n",(int)ts,val); fflush(stdout); } FreeDataSet(data_set); exit(0); }
void cdecl free(void * pntr) #endif { USHORT usSel; BYTE _huge * pHeapStart; BYTE _huge * pHeapEnd; BYTE _huge * pWork; BYTE _huge * pToFree = pntr; BYTE _huge * pPrev; BYTE _huge * pNext; USHORT rc; if (f32Parms.fMessageActive & LOG_MEM) Message("free %lX", pntr); // CheckHeap(); if (OFFSETOF(pntr) == 0) { freeseg(pntr); return; } GetMemAccess(); for (usSel = 0; usSel < MAX_SELECTORS; usSel++) { if (SELECTOROF(pntr) == SELECTOROF(rgpSegment[usSel])) break; } if (usSel == MAX_SELECTORS) { CritMessage("FAT32: %lX not found in free!", pntr); Message("FAT32: %lX not found in free!", pntr); ReleaseMemAccess(); return; } pHeapStart = rgpSegment[usSel]; pHeapEnd = pHeapStart + HEAP_SIZE; rc = MY_PROBEBUF(PB_OPREAD, (PBYTE)pHeapStart, HEAP_SIZE); if (rc) { CritMessage("FAT32: Protection VIOLATION in free (SYS%d)", rc); Message("FAT32: Protection VIOLATION in free (SYS%d)", rc); ReleaseMemAccess(); return; } pWork = pHeapStart; pPrev = NULL; while (pWork < pHeapEnd) { if (pWork + sizeof (ULONG) == pToFree) { if (pPrev && IsBlockFree(pPrev)) { SetBlockSize(pPrev, BlockSize(pPrev) + BlockSize(pWork) + sizeof (ULONG)); pWork = pPrev; } pNext = pWork + BlockSize(pWork) + sizeof (ULONG); if (pNext < pHeapEnd && IsBlockFree(pNext)) SetBlockSize(pWork, BlockSize(pWork) + BlockSize(pNext) + sizeof (ULONG)); SetFree(pWork); break; } else pPrev = pWork; pWork += BlockSize(pWork) + sizeof (ULONG); } if (pWork >= pHeapEnd) { CritMessage("FAT32: ERROR: Address not found in free"); Message("ERROR: Address not found in free"); ReleaseMemAccess(); return; } /* free selector if no longer needed */ if (usSel > 0 && BlockSize(rgpSegment[usSel]) == (HEAP_SIZE - sizeof (ULONG)) && IsBlockFree(rgpSegment[usSel])) { PBYTE p = rgpSegment[usSel]; rgpSegment[usSel] = NULL; freeseg(p); } ReleaseMemAccess(); }