1 #ifndef _SynthLabSMPLSource_h 2 #define _SynthLabSMPLSource_h 57 SynthLabPCMSource(
const char* _sampleFolderPath,
const char* _sampleFolderName,
double _sampleRate,
58 bool pitchlessLoops =
false,
bool aubioSlices =
false)
61 init(_sampleFolderPath, _sampleFolderName, _sampleRate, pitchlessLoops, aubioSlices);
74 void init(
const char* _sampleFolderPath,
const char* _sampleFolderName,
75 double _sampleRate,
bool pitchlessLoops =
false,
bool aubioSlices =
false)
109 if (pSample != pDeletedSample)
111 pDeletedSample = pSample;
175 inc = oscFrequency / dUnityFrequency;
214 if (
loopMode == SampleLoopMode::sustain)
220 else if (
loopMode == SampleLoopMode::loop)
228 if (
loopMode == SampleLoopMode::sustain)
236 else if (
loopMode == SampleLoopMode::oneShot)
244 else if (
loopMode == SampleLoopMode::loop)
253 double dIntPart = 0.0;
254 double fracPart = modf(readIndex, &dIntPart);
255 uint32_t nReadIndex = (uint32_t)dIntPart;
271 int nReadIndexLeft = (int)readIndex * 2;
281 int nReadIndexRight = nReadIndexLeft + 1;
Opens a folder full of WAV files and gleans information about the files to prep them for parsing and ...
Definition: pcmsample.h:202
uint32_t numActiveChannels
number of active channels; not used in SynthLab but available
Definition: synthbase.h:736
Opens a WAV file and extracts contents into a floating point buffer, regardless of original datatypes...
Definition: pcmsample.h:109
uint32_t parseFolder(PCMSample **sampleSet, bool pitchlessLoops, bool aubioSlices=false)
The main function that opens a folder, creates the WAV information map, and then parses the files in ...
Definition: pcmsample.cpp:822
PCMSample * selectedSample
currently selected sample
Definition: synthlabpcmsource.h:301
virtual void deleteSamples()
Delete all samples from memory.
Definition: synthlabpcmsource.h:98
double doLinearInterpolation(double x1, double x2, double y1, double y2, double x)
performs linear interpolation of x distance between two (x,y) points; returns interpolated value ...
Definition: synthfunctions.h:1387
See also Designing Software Synthesizers in C++ 2nd Ed. by Will Pirkle.
Storage for a set of PCM samples that constitute a patch or instrument.
Definition: synthlabpcmsource.h:41
Interface for PCM sample sources.
Definition: synthbase.h:766
virtual void setSampleLoopMode(SampleLoopMode _loopMode)
Definition: synthlabpcmsource.h:296
virtual bool haveValidSamples()
Find all non-null sample pointers.
Definition: synthlabpcmsource.h:138
PCMSample * sampleSet[NUM_MIDI_NOTES]
one PCM sample pointer per note
Definition: synthlabpcmsource.h:300
Definition: addosccore.cpp:4
uint32_t getNumChannels()
Immutable variables can only be set during file parse.
Definition: pcmsample.h:131
std::string sampleFolderPath
folder of wave files
Definition: synthlabpcmsource.h:302
virtual PCMSampleOutput readSample(double &readIndex, double inc)
Read and interpolate the table; uses linear interpolation but could be changed to 4th order LaGrange ...
Definition: synthlabpcmsource.h:194
std::string sampleFolderName
name of patch
Definition: synthlabpcmsource.h:303
uint32_t getUnityMIDINote()
Mutable variables that may need to be re-calculated after parsing.
Definition: pcmsample.h:153
virtual uint32_t getValidSampleCount()
query for valid sample count (not used in SynthLab but avialable)
Definition: synthlabpcmsource.h:124
uint32_t getLoopEndIndex()
Mutable variables that may need to be re-calculated after parsing.
Definition: pcmsample.h:150
uint32_t getLoopStartIndex()
Mutable variables that may need to be re-calculated after parsing.
Definition: pcmsample.h:147
Holds the audio output samples from reading a PCM sample file.
Definition: synthbase.h:733
SampleLoopMode
Definition: synthbase.h:741
virtual double selectSample(double oscFrequency)
Selects a PCM sample based on the target oscillator frequency.
Definition: synthlabpcmsource.h:157
uint32_t getSampleCount()
Immutable variables can only be set during file parse.
Definition: pcmsample.h:133
SynthLabPCMSource(const char *_sampleFolderPath, const char *_sampleFolderName, double _sampleRate, bool pitchlessLoops=false, bool aubioSlices=false)
Parses a folder full of wave files and extracts the PCM samples.
Definition: synthlabpcmsource.h:57
uint32_t midiNoteNumberFromOscFrequency(double oscillatorFrequency, double frequencyA440=440.0)
use lookup table to find pitch shift multipliers, uses linear interpolation
Definition: synthfunctions.h:1485
const uint32_t NUM_MIDI_NOTES
Definition: synthconstants.h:618
double sampleRate
fs
Definition: synthlabpcmsource.h:304
~SynthLabPCMSource()
Destructor nothing to do, samples were deleted prior to destruction here.
Definition: synthlabpcmsource.h:149
SampleLoopMode loopMode
different looping modes
Definition: synthlabpcmsource.h:305
uint32_t getLoopCount()
Mutable variables that may need to be re-calculated after parsing.
Definition: pcmsample.h:144
void init(const char *_sampleFolderPath, const char *_sampleFolderName, double _sampleRate, bool pitchlessLoops=false, bool aubioSlices=false)
Separated initializer, parses a folder full of wave files and extracts the PCM samples.
Definition: synthlabpcmsource.h:74
hard-coded arrays of FIR filter coefficients for the sample rate conversion objects (Interpolator and...
double audioOutput[STEREO_CHANNELS]
array of audio output samples
Definition: synthbase.h:735
double midiNoteNumberToOscFrequency(uint32_t midiNoteNumber, double frequencyA440=440.0)
converts a MIDI note number into a corresponding oscillator frequency in Hz
Definition: synthfunctions.h:1513