Hi, I have an issue writing audio files in Windows 7. It works great in my develop setup with Windows 10, VS2013 and VS2017, cinder 9.1 and dev9.2. But when deploying to a windows 7 machine it breaks, throws AudioFileExc.
I modified the InputAnalyzer to see if my messy code was to blame, but its the same.
The audio file gets to be created, but with 0 Kb, then it throws the exception.
Here is the code:
new funtions and member variables:
void keyDown(KeyEvent event) override;
void startRecord();
void stopRecord();
ci::audio::BufferRecorderNodeRef mRecorder;
ci::audio::GainNodeRef mGain;
In setup():
// InputDeviceNode (and all InputNode subclasses) need to be enabled()'s to process audio. So does the Context:
mInputDeviceNode->enable();
//Begins edit
mRecorder = ctx->makeNode(new ci::audio::BufferRecorderNode(2 * ctx->getSampleRate()));
mRecorder->setNumSeconds(20); // can also set seconds afterwards, which causes a lock and buffer resize
mGain = ctx->makeNode(new ci::audio::GainNode(0.6f));
mMonitorSpectralNode >> mGain >> mRecorder;
//Ends edit
ctx->enable();
The new functions:
void InputAnalyzer::keyDown(KeyEvent event){
if (event.getCode() == event.KEY_SPACE){
startRecord();
}else if (event.getCode() == event.KEY_s){
stopRecord();
}
}
void InputAnalyzer::startRecord(){
mRecorder->enable();
mRecorder->start();
};
void InputAnalyzer::stopRecord(){
ci::fs::path audioFile = getDocumentsDirectory() / ("audioTest.wav");
mRecorder->writeToFile(audioFile, ci::audio::SampleType::INT_16);
mRecorder->disable();
};
If anyone has come with this kind of situation any hints would be appreciated. For now I think wi will just look for anothe machine.