Hi!
OK, modified it to handle c-style includes. Try to apply the attached diff.
---
Sincerely yours,
Sergey
On 03/02/2014 11:41 PM, Andreas Persson wrote:
Even though it isn't listed on their custom opcodes page, Aria seems to
have an include statement, as one of the instrument in the Free Sounds
for ARIA pack shows:
//and the files...
#include "BD.sfz"
#include "SD.sfz"
#include "LT.sfz"
So, I agree we can apply the patch, but it would be nice if it used the
same syntax as the Aria file uses.
/Andreas
------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
_______________________________________________
Linuxsampler-devel mailing list
Linuxsampler-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxsampler-devel
Index: sfz.h
===================================================================
--- sfz.h (revision 2526)
+++ sfz.h (working copy)
@@ -761,6 +761,7 @@
/// Load an existing SFZ file
File(std::string file, SampleManager* pSampleManager = NULL);
+ void parseFile(std::string file, SampleManager* pSampleManager);
virtual ~File();
/// Returns a pointer to the instrument object
Index: sfz.cpp
===================================================================
--- sfz.cpp (revision 2526)
+++ sfz.cpp (working copy)
@@ -874,12 +874,17 @@
_instrument = new Instrument(LinuxSampler::Path::getBaseName(file), pSampleManager);
_current_group = new Group();
pCurDef = _current_group;
+ currentDir = LinuxSampler::Path::stripLastName(file);
+
+ parseFile(file,pSampleManager);
+ }
+
+ void File::parseFile(std::string file, SampleManager* pSampleManager){
enum token_type_t { HEADER, OPCODE };
token_type_t token_type;
std::string token_string;
std::ifstream fs(file.c_str());
- currentDir = LinuxSampler::Path::stripLastName(file);
std::string token;
std::string line;
currentLine = 0;
@@ -892,12 +897,38 @@
if (slash_index != std::string::npos)
line.resize(slash_index);
+ // #include
+ if(line.find("#include ")==0)
+ {
+ std::string::size_type fname_start=line.find("\"");
+ if(fname_start==std::string::npos) continue;
+
+ std::string::size_type fname_end=line.find("\"", fname_start + 1);
+ if(fname_end==std::string::npos || fname_start==fname_end) continue;
+ std::string fname = line.substr(fname_start + 1,fname_end - fname_start - 1);
+
+ #ifndef WIN32
+ std::string separator = "/";
+ #else
+ std::string separator = "\\";
+ #endif
+
+ if(!currentDir.empty())
+ {
+ fname = currentDir + separator + fname;
+ }
+
+ parseFile(fname, pSampleManager);
+ continue;
+ }
+
// DEFINITION
std::stringstream linestream(line);
int spaces = 0;
while (linestream >> token)
{
linestream >> std::noskipws;
+
if (token[0] == '<' && token[token.size()-1] == '>')
{
// HEAD
------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works.
Faster operations. Version large binaries. Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
_______________________________________________
Linuxsampler-devel mailing list
Linuxsampler-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxsampler-devel