AUTO-ADMIN: Non-MP3, WAV, OGG, SoundCloud, YouTube, Vimeo, Twitter and Facebook links in this post have been protected automatically. Once the member reaches 5 posts the links will function as normal.
can't get any other audio file to work with the file wav player example other than audio.wav provided even when i put in full path to file in the same folder as audio.wav. what am i doing wrong or any help? it just says Error: failed to initialize script but the ui loads.Code: Select all (#)
#include "../library/WaveFile.hxx"
string name="Sample Player1";
string description="Plays an audio sample loaded from the script data folder (sample script).";
array<string> inputParametersNames={"Play"};
array<double> inputParameters(inputParametersNames.length);
array<double> inputParametersMin={0};
array<double> inputParametersDefault={0};
array<double> inputParametersMax={1};
array<int> inputParametersSteps={2};
array<string> inputParametersEnums={"Pause;Play"};
WaveFileReader wavReader;
uint channelsToPlay=0;
bool playing=true;
bool initialize()
{
// load sample file
string filePath= "/Users/eoinodowd/Desktop/plugin/sample/haha.wav"; // but replacing haha.wav with audio.wav works
print(filePath);
bool ok=wavReader.openFile(filePath,audioOutputsCount);
if(ok)
{
channelsToPlay=wavReader.channelsCount;
if(channelsToPlay>audioOutputsCount)
channelsToPlay=audioOutputsCount;
}
return ok;
}
void processSample(array<double>& ioSample)
{
if(playing)
{
// read samples
wavReader.readSample(ioSample);
// silence unused channels
for(uint ch=channelsToPlay;ch<audioOutputsCount;ch++)
{
ioSample[ch]=2;;
}
}
// loop back to beginning if end of file was reached
if(wavReader.isEndOfFile())
wavReader.setPos(0);
}
void updateInputParameters()
{
playing=(inputParameters[0]!=0);
}
int getTailSize()
{
// infinite tail, as we generate audio data whatever the input
return -1;
}