From aa225175a877c90f9bd9e4ecc6b2b3be30e97dcd Mon Sep 17 00:00:00 2001 From: freq-mod Date: Mon, 12 Aug 2024 19:23:52 +0200 Subject: [PATCH] sample banks part 3 --- src/engine/fileOpsSample.cpp | 14 ++++++++------ src/gui/gui.cpp | 4 ---- src/gui/gui.h | 4 ++-- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/engine/fileOpsSample.cpp b/src/engine/fileOpsSample.cpp index 711ea74b3..560eb7870 100644 --- a/src/engine/fileOpsSample.cpp +++ b/src/engine/fileOpsSample.cpp @@ -24,6 +24,8 @@ #include "sfWrapper.h" #endif +#define _LE(string) (string) + std::vector DivEngine::sampleFromFile(const char* path) { std::vector ret; @@ -413,7 +415,7 @@ std::vector DivEngine::sampleFromFile(const char* path) { DivSample* DivEngine::sampleFromFileRaw(const char* path, DivSampleDepth depth, int channels, bool bigEndian, bool unsign, bool swapNibbles, int rate) { if (song.sample.size()>=256) { lastError="too many samples!"; - return ret; + return NULL; } if (channels<1) { channels=1; @@ -470,7 +472,7 @@ DivSample* DivEngine::sampleFromFileRaw(const char* path, DivSampleDepth depth, BUSY_END; lastError="file is empty!"; delete sample; - return ret; + return NULL; } if (len==(SIZE_MAX>>1)) { @@ -478,7 +480,7 @@ DivSample* DivEngine::sampleFromFileRaw(const char* path, DivSampleDepth depth, BUSY_END; lastError="file is invalid!"; delete sample; - return ret; + return NULL; } if (fseek(f,0,SEEK_SET)<0) { @@ -486,7 +488,7 @@ DivSample* DivEngine::sampleFromFileRaw(const char* path, DivSampleDepth depth, BUSY_END; lastError=fmt::sprintf("could not seek to beginning of file! (%s)",strerror(errno)); delete sample; - return ret; + return NULL; } lenDivided=len/channels; @@ -528,7 +530,7 @@ DivSample* DivEngine::sampleFromFileRaw(const char* path, DivSampleDepth depth, BUSY_END; lastError="this sample is too big! max sample size is 16777215."; delete sample; - return ret; + return NULL; } sample->rate=rate; @@ -543,7 +545,7 @@ DivSample* DivEngine::sampleFromFileRaw(const char* path, DivSampleDepth depth, lastError=fmt::sprintf("could not read file! (%s)",strerror(errno)); delete[] buf; delete sample; - return ret; + return NULL; } fclose(f); diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 8b2ce9ef0..efe8c8883 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -5274,8 +5274,6 @@ bool FurnaceGUI::loop() { String errs=_("there were some errors while loading samples:\n"); bool warn=false; for (String i: fileDialog->getFileName()) { - DivSample*=e->sampleFromFile(i.c_str()); - if () { std::vector samples=e->sampleFromFile(i.c_str()); if (samples.empty()) { if (fileDialog->getFileName().size()>1) { @@ -6503,8 +6501,6 @@ centerNextWindow(_("Select Sample"),canvasW,canvasH); } bool reissueSearch=false; - if (ImGui::InputTextWithHint("##SysSearch",settings.language == 0 ? "Search..." : _("Search..."),&sampleBankSearchQuery)) reissueSearch=true; - bool anySelected=false; float sizeY=ImGui::GetFrameHeightWithSpacing()*pendingSamples.size(); if (sizeY>(canvasH-180.0*dpiScale)) diff --git a/src/gui/gui.h b/src/gui/gui.h index 8eeb5b113..233b7bd85 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -1605,7 +1605,7 @@ class FurnaceGUI { String folderString; std::vector sysSearchResults; - std::vector> sampleBankSearchResults; + std::vector> sampleBankSearchResults; std::vector newSongSearchResults; std::vector paletteSearchResults; FixedQueue recentFile; @@ -2375,7 +2375,7 @@ class FurnaceGUI { std::vector cmdStream; std::vector particles; std::vector> pendingIns; - std::vector > pendingSamples; + std::vector> pendingSamples; std::vector sysCategories;