28 char IdentifierString[4] =
"";
29 uint32_t dwLength = 0;
38 uint16_t wFormatTag = 0;
39 uint16_t wChannels = 0;
40 uint32_t dwSamplesPerSec = 0;
41 uint32_t dwAvgBytesPerSec = 0;
42 uint16_t wBlockAlign = 0;
43 uint16_t wBitsPerSample = 0;
52 uint16_t wFormatTag = 0;
53 uint16_t nChannels = 0;
54 uint32_t nSamplesPerSec = 0;
55 uint32_t nAvgBytesPerSec = 0;
56 uint16_t nBlockAlign = 0;
57 uint16_t wBitsPerSample = 0;
68 char *pSampleData =
nullptr;
72 uint32_t bPlaying = 0;
117 const float* getSampleBuffer() {
return pcmSampleBuffer; }
120 void setPitchless(
bool _pitchlessSample) { pitchlessSample = _pitchlessSample; }
121 bool isPitchless() {
return pitchlessSample; }
161 uint32_t numChannels = 0;
162 uint32_t sampleRate = 0;
163 uint32_t sampleCount = 0;
164 uint32_t loopCount = 0;
165 uint32_t loopStartIndex = 0;
166 uint32_t loopEndIndex = 0;
167 uint32_t loopType = 0;
168 uint32_t unityMIDINote = 0;
169 uint32_t unityMIDIPitchFraction = 0;
170 uint32_t smpteFormat = 0;
171 uint32_t smpteOffset = 0;
172 bool sampleLoaded =
false;
175 float* pcmSampleBuffer =
nullptr;
176 bool pitchlessSample =
false;
184 void operator()(
char& c) { c = toupper((
unsigned char)c); }
211 const char* _waveFolderName) {
212 waveFolderPath = _waveFolderPath;
213 waveFolderName = _waveFolderName;
222 void addNextFileToMap(std::string fileFolderPath, std::string fileName,
bool aubioSlices, std::map<int, std::string>* wavFilePaths,
int& fileCount);
225 void eraseSubStr(std::string & mainStr,
const std::string & toErase)
228 size_t pos = mainStr.find(toErase);
229 if (pos != std::string::npos)
232 mainStr.erase(pos, toErase.length());
237 const char* waveFolderPath;
238 const char* waveFolderName;
Definition: pcmsample.h:79
Opens a folder full of WAV files and gleans information about the files to prep them for parsing and ...
Definition: pcmsample.h:202
Definition: pcmsample.h:36
Opens a WAV file and extracts contents into a floating point buffer, regardless of original datatypes...
Definition: pcmsample.h:109
uint32_t getSmpteOffset()
Immutable variables can only be set during file parse.
Definition: pcmsample.h:136
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
std::string noteTableFlats[120]
table with characters used to decode filenames with flats
Definition: pcmsample.h:241
void buildNoteTables()
Sets up the tables for trying to suss out the MIDI note number from a filename that attempts to inclu...
Definition: pcmsample.cpp:675
void setUnityMIDIPitchFraction(uint32_t u)
Mutable variables that may need to be re-calculated after parsing.
Definition: pcmsample.h:157
Definition: addosccore.cpp:4
uint32_t getNumChannels()
Immutable variables can only be set during file parse.
Definition: pcmsample.h:131
void addNextFileToMap(std::string fileFolderPath, std::string fileName, bool aubioSlices, std::map< int, std::string > *wavFilePaths, int &fileCount)
Adds information about a WAV file in the folder to a map that is later used to parse the files in suc...
Definition: pcmsample.cpp:752
Definition: pcmsample.h:50
uint32_t getUnityMIDINote()
Mutable variables that may need to be re-calculated after parsing.
Definition: pcmsample.h:153
Definition: pcmsample.h:26
uint32_t getUnityMIDIPitchFraction()
Mutable variables that may need to be re-calculated after parsing.
Definition: pcmsample.h:156
uint32_t getLoopEndIndex()
Mutable variables that may need to be re-calculated after parsing.
Definition: pcmsample.h:150
uint32_t getSampleRate()
Immutable variables can only be set during file parse.
Definition: pcmsample.h:132
bool loadPCMSample(const char *filePath)
Opens a WAV file and extracts the audio guts into a buffer of floats. Anytime later, you can use isSampleLoaded( ) to see if the sample data is valid.
Definition: pcmsample.cpp:40
uint32_t getLoopStartIndex()
Mutable variables that may need to be re-calculated after parsing.
Definition: pcmsample.h:147
uint32_t getSmpteFormat()
Immutable variables can only be set during file parse.
Definition: pcmsample.h:135
uint32_t getSampleCount()
Immutable variables can only be set during file parse.
Definition: pcmsample.h:133
int32_t findNoteNumberInName(const char *filename, bool shiftUpOctave=true)
figure out MIDI note number from string
Definition: pcmsample.cpp:710
void setLoopEndIndex(uint32_t u)
Mutable variables that may need to be re-calculated after parsing.
Definition: pcmsample.h:151
void setLoopCount(uint32_t u)
Mutable variables that may need to be re-calculated after parsing.
Definition: pcmsample.h:145
Definition: pcmsample.h:65
uint32_t getLoopType()
Immutable variables can only be set during file parse.
Definition: pcmsample.h:134
void setLoopStartIndex(uint32_t u)
Mutable variables that may need to be re-calculated after parsing.
Definition: pcmsample.h:148
void setPitchless(bool _pitchlessSample)
Definition: pcmsample.h:120
void setUnityMIDINote(uint32_t u)
Mutable variables that may need to be re-calculated after parsing.
Definition: pcmsample.h:154
uint32_t getLoopCount()
Mutable variables that may need to be re-calculated after parsing.
Definition: pcmsample.h:144
std::string noteTableSharps[120]
table with characters used to decode filenames with sharps
Definition: pcmsample.h:240
bool isSampleLoaded()
Definition: pcmsample.h:124
Definition: pcmsample.h:183