remove the goto's from the source code (came from http://github.com/thestk/stk toolkit)

add test wav file
This commit is contained in:
Erwin Coumans
2017-04-27 08:39:57 -07:00
parent 72d5366a92
commit dfc1800065
5 changed files with 63 additions and 43 deletions

View File

@@ -153,14 +153,15 @@ bool b3WriteWavFile::setWavFile(std::string fileName, int sampleRate, int numCha
char data[4] = {'d', 'a', 't', 'a'};
int dataSize = 0;
if (fwrite(&hdr, 1, bytesToWrite, m_data->m_file) != bytesToWrite) goto error;
if (fwrite(&data, 4, 1, m_data->m_file) != 1) goto error;
if (fwrite(&dataSize, 4, 1, m_data->m_file) != 1) goto error;
if (fwrite(&hdr, 1, bytesToWrite, m_data->m_file) != bytesToWrite)
return false;
if (fwrite(&data, 4, 1, m_data->m_file) != 1)
return false;
if (fwrite(&dataSize, 4, 1, m_data->m_file) != 1)
return false;
return true;
error:
return false;
}
void b3WriteWavFile::closeWavFile()