Beispiel #1
0
            bool validate(std::basic_ostream<Char>& out) const {
                typename std::basic_ostream<Char>::streampos current =
                    out.tellp();
                out.seekp(0, std::ios::end);
                uint32_t file_size = static_cast<uint32_t>(out.tellp());
                out.seekp(current, std::ios::beg);
                uint32_t supposed_size =
                    data_subchunk.size + sizeof(header_type);

                if (file_size != supposed_size) {
                    DBGLOG("There is a difference between the wav file size"
                            " and the size of data that is written in the"
                            " header: "
                            << file_size << " != " << supposed_size);
                    return false;
                }

                return true;
            }