| 791 | |
| 792 | |
| 793 | void WavOutFile::write(const unsigned char *buffer, int numElems) |
| 794 | { |
| 795 | int res; |
| 796 | |
| 797 | if (header.format.bits_per_sample != 8) |
| 798 | { |
| 799 | ST_THROW_RT_ERROR("Error: WavOutFile::write(const char*, int) accepts only 8bit samples."); |
| 800 | } |
| 801 | assert(sizeof(char) == 1); |
| 802 | |
| 803 | res = (int)fwrite(buffer, 1, numElems, fptr); |
| 804 | if (res != numElems) |
| 805 | { |
| 806 | ST_THROW_RT_ERROR("Error while writing to a wav file."); |
| 807 | } |
| 808 | |
| 809 | bytesWritten += numElems; |
| 810 | } |
| 811 | |
| 812 | |
| 813 |