Browse Source

sfzero Sound class almost done

tags/v1.9.11
falkTX 6 years ago
parent
commit
08901df28f
3 changed files with 10 additions and 22 deletions
  1. +1
    -1
      source/modules/sfzero/Makefile
  2. +5
    -13
      source/modules/sfzero/sfzero/SFZSound.cpp
  3. +4
    -8
      source/modules/sfzero/sfzero/SFZSound.h

+ 1
- 1
source/modules/sfzero/Makefile View File

@@ -10,7 +10,7 @@ include ../Makefile.mk

# ----------------------------------------------------------------------------------------------------------------------------

BUILD_CXX_FLAGS += -I$(CWD)/modules
BUILD_CXX_FLAGS += -I$(CWD)/modules -Wno-unused-variable -Wno-unused-parameter

# ----------------------------------------------------------------------------------------------------------------------------



+ 5
- 13
source/modules/sfzero/sfzero/SFZSound.cpp View File

@@ -20,12 +20,10 @@ sfzero::Sound::~Sound()
regions_.set(i, nullptr);
}

#if 0
for (water::HashMap<water::String, sfzero::Sample *>::Iterator i(samples_); i.next();)
{
delete i.getValue();
}
#endif
}

bool sfzero::Sound::appliesToNote(int /*midiNoteNumber*/)
@@ -36,7 +34,6 @@ bool sfzero::Sound::appliesToNote(int /*midiNoteNumber*/)

bool sfzero::Sound::appliesToChannel(int /*midiChannel*/) { return true; }
void sfzero::Sound::addRegion(sfzero::Region *region) { regions_.add(region); }
#if 0
sfzero::Sample *sfzero::Sound::addSample(water::String path, water::String defaultPath)
{
path = path.replaceCharacter('\\', '/');
@@ -60,11 +57,9 @@ sfzero::Sample *sfzero::Sound::addSample(water::String path, water::String defau
}
return sample;
}
#endif

void sfzero::Sound::addError(const water::String &message) { errors_.add(message); }

#if 0
void sfzero::Sound::addUnsupportedOpcode(const water::String &opcode)
{
if (!unsupportedOpcodes_.contains(opcode))
@@ -75,7 +70,6 @@ void sfzero::Sound::addUnsupportedOpcode(const water::String &opcode)
warnings_.add(warning);
}
}
#endif

void sfzero::Sound::loadRegions()
{
@@ -84,8 +78,7 @@ void sfzero::Sound::loadRegions()
reader.read(file_);
}

#if 0
void sfzero::Sound::loadSamples(water::AudioFormatManager *formatManager, double *progressVar, water::Thread *thread)
void sfzero::Sound::loadSamples(water::AudioFormatManager* formatManager, double* progressVar, CarlaThread* thread)
{
if (progressVar)
{
@@ -96,18 +89,20 @@ void sfzero::Sound::loadSamples(water::AudioFormatManager *formatManager, double
for (water::HashMap<water::String, sfzero::Sample *>::Iterator i(samples_); i.next();)
{
sfzero::Sample *sample = i.getValue();
#if 0
bool ok = sample->load(formatManager);
if (!ok)
{
addError("Couldn't load sample \"" + sample->getShortName() + "\"");
}
#endif

numSamplesLoaded += 1.0;
if (progressVar)
if (progressVar != nullptr)
{
*progressVar = numSamplesLoaded / numSamples;
}
if (thread && thread->threadShouldExit())
if (thread != nullptr && thread->shouldThreadExit())
{
return;
}
@@ -118,7 +113,6 @@ void sfzero::Sound::loadSamples(water::AudioFormatManager *formatManager, double
*progressVar = 1.0;
}
}
#endif

sfzero::Region *sfzero::Sound::getRegionFor(int note, int velocity, sfzero::Region::Trigger trigger)
{
@@ -187,7 +181,6 @@ water::String sfzero::Sound::dump()
info << "no regions.\n";
}

#if 0
if (samples_.size() > 0)
{
info << samples_.size() << " samples: \n";
@@ -197,7 +190,6 @@ water::String sfzero::Sound::dump()
}
}
else
#endif
{
info << "no samples.\n";
}


+ 4
- 8
source/modules/sfzero/sfzero/SFZSound.h View File

@@ -9,10 +9,12 @@

#include "SFZRegion.h"

#include "water/containers/HashMap.h"
#include "water/memory/ReferenceCountedObject.h"
#include "water/text/StringArray.h"

#include "CarlaJuceUtils.hpp"
#include "CarlaThread.hpp"

#if 1
namespace water {
@@ -46,10 +48,8 @@ public:
void addUnsupportedOpcode(const water::String &opcode);

virtual void loadRegions();
#if 0
virtual void loadSamples(water::AudioFormatManager *formatManager, double *progressVar = nullptr,
water::Thread *thread = nullptr);
#endif
virtual void loadSamples(water::AudioFormatManager* formatManager, double* progressVar = nullptr,
CarlaThread* thread = nullptr);

Region *getRegionFor(int note, int velocity, Region::Trigger trigger = Region::attack);
int getNumRegions();
@@ -70,14 +70,10 @@ public:
private:
water::File file_;
water::Array<Region *> regions_;
#if 0
water::HashMap<water::String, Sample *> samples_;
#endif
water::StringArray errors_;
water::StringArray warnings_;
#if 0
water::HashMap<water::String, water::String> unsupportedOpcodes_;
#endif

CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(Sound)
};


Loading…
Cancel
Save