sample banks part 3
This commit is contained in:
parent
235a254458
commit
aa225175a8
|
|
@ -24,6 +24,8 @@
|
||||||
#include "sfWrapper.h"
|
#include "sfWrapper.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define _LE(string) (string)
|
||||||
|
|
||||||
std::vector<DivSample*> DivEngine::sampleFromFile(const char* path) {
|
std::vector<DivSample*> DivEngine::sampleFromFile(const char* path) {
|
||||||
std::vector<DivSample*> ret;
|
std::vector<DivSample*> ret;
|
||||||
|
|
||||||
|
|
@ -413,7 +415,7 @@ std::vector<DivSample*> DivEngine::sampleFromFile(const char* path) {
|
||||||
DivSample* DivEngine::sampleFromFileRaw(const char* path, DivSampleDepth depth, int channels, bool bigEndian, bool unsign, bool swapNibbles, int rate) {
|
DivSample* DivEngine::sampleFromFileRaw(const char* path, DivSampleDepth depth, int channels, bool bigEndian, bool unsign, bool swapNibbles, int rate) {
|
||||||
if (song.sample.size()>=256) {
|
if (song.sample.size()>=256) {
|
||||||
lastError="too many samples!";
|
lastError="too many samples!";
|
||||||
return ret;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (channels<1) {
|
if (channels<1) {
|
||||||
channels=1;
|
channels=1;
|
||||||
|
|
@ -470,7 +472,7 @@ DivSample* DivEngine::sampleFromFileRaw(const char* path, DivSampleDepth depth,
|
||||||
BUSY_END;
|
BUSY_END;
|
||||||
lastError="file is empty!";
|
lastError="file is empty!";
|
||||||
delete sample;
|
delete sample;
|
||||||
return ret;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (len==(SIZE_MAX>>1)) {
|
if (len==(SIZE_MAX>>1)) {
|
||||||
|
|
@ -478,7 +480,7 @@ DivSample* DivEngine::sampleFromFileRaw(const char* path, DivSampleDepth depth,
|
||||||
BUSY_END;
|
BUSY_END;
|
||||||
lastError="file is invalid!";
|
lastError="file is invalid!";
|
||||||
delete sample;
|
delete sample;
|
||||||
return ret;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fseek(f,0,SEEK_SET)<0) {
|
if (fseek(f,0,SEEK_SET)<0) {
|
||||||
|
|
@ -486,7 +488,7 @@ DivSample* DivEngine::sampleFromFileRaw(const char* path, DivSampleDepth depth,
|
||||||
BUSY_END;
|
BUSY_END;
|
||||||
lastError=fmt::sprintf("could not seek to beginning of file! (%s)",strerror(errno));
|
lastError=fmt::sprintf("could not seek to beginning of file! (%s)",strerror(errno));
|
||||||
delete sample;
|
delete sample;
|
||||||
return ret;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
lenDivided=len/channels;
|
lenDivided=len/channels;
|
||||||
|
|
@ -528,7 +530,7 @@ DivSample* DivEngine::sampleFromFileRaw(const char* path, DivSampleDepth depth,
|
||||||
BUSY_END;
|
BUSY_END;
|
||||||
lastError="this sample is too big! max sample size is 16777215.";
|
lastError="this sample is too big! max sample size is 16777215.";
|
||||||
delete sample;
|
delete sample;
|
||||||
return ret;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
sample->rate=rate;
|
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));
|
lastError=fmt::sprintf("could not read file! (%s)",strerror(errno));
|
||||||
delete[] buf;
|
delete[] buf;
|
||||||
delete sample;
|
delete sample;
|
||||||
return ret;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
|
||||||
|
|
@ -5274,8 +5274,6 @@ bool FurnaceGUI::loop() {
|
||||||
String errs=_("there were some errors while loading samples:\n");
|
String errs=_("there were some errors while loading samples:\n");
|
||||||
bool warn=false;
|
bool warn=false;
|
||||||
for (String i: fileDialog->getFileName()) {
|
for (String i: fileDialog->getFileName()) {
|
||||||
DivSample*=e->sampleFromFile(i.c_str());
|
|
||||||
if () {
|
|
||||||
std::vector<DivSample*> samples=e->sampleFromFile(i.c_str());
|
std::vector<DivSample*> samples=e->sampleFromFile(i.c_str());
|
||||||
if (samples.empty()) {
|
if (samples.empty()) {
|
||||||
if (fileDialog->getFileName().size()>1) {
|
if (fileDialog->getFileName().size()>1) {
|
||||||
|
|
@ -6503,8 +6501,6 @@ centerNextWindow(_("Select Sample"),canvasW,canvasH);
|
||||||
}
|
}
|
||||||
bool reissueSearch=false;
|
bool reissueSearch=false;
|
||||||
|
|
||||||
if (ImGui::InputTextWithHint("##SysSearch",settings.language == 0 ? "Search..." : _("Search..."),&sampleBankSearchQuery)) reissueSearch=true;
|
|
||||||
|
|
||||||
bool anySelected=false;
|
bool anySelected=false;
|
||||||
float sizeY=ImGui::GetFrameHeightWithSpacing()*pendingSamples.size();
|
float sizeY=ImGui::GetFrameHeightWithSpacing()*pendingSamples.size();
|
||||||
if (sizeY>(canvasH-180.0*dpiScale))
|
if (sizeY>(canvasH-180.0*dpiScale))
|
||||||
|
|
|
||||||
|
|
@ -1605,7 +1605,7 @@ class FurnaceGUI {
|
||||||
String folderString;
|
String folderString;
|
||||||
|
|
||||||
std::vector<DivSystem> sysSearchResults;
|
std::vector<DivSystem> sysSearchResults;
|
||||||
std::vector<std::pair><DivSample*,bool>> sampleBankSearchResults;
|
std::vector<std::pair<DivSample*,bool>> sampleBankSearchResults;
|
||||||
std::vector<FurnaceGUISysDef> newSongSearchResults;
|
std::vector<FurnaceGUISysDef> newSongSearchResults;
|
||||||
std::vector<int> paletteSearchResults;
|
std::vector<int> paletteSearchResults;
|
||||||
FixedQueue<String,32> recentFile;
|
FixedQueue<String,32> recentFile;
|
||||||
|
|
@ -2375,7 +2375,7 @@ class FurnaceGUI {
|
||||||
std::vector<DivCommand> cmdStream;
|
std::vector<DivCommand> cmdStream;
|
||||||
std::vector<Particle> particles;
|
std::vector<Particle> particles;
|
||||||
std::vector<std::pair<DivInstrument*,bool>> pendingIns;
|
std::vector<std::pair<DivInstrument*,bool>> pendingIns;
|
||||||
std::vector <std::pair<DivSample*,bool>> pendingSamples;
|
std::vector<std::pair<DivSample*,bool>> pendingSamples;
|
||||||
|
|
||||||
std::vector<FurnaceGUISysCategory> sysCategories;
|
std::vector<FurnaceGUISysCategory> sysCategories;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue