Beatmup
Beatmup::Audio::WAV::InvalidWavFile Class Reference

Communicates an error related to a WAV file content. More...

#include <wav_utilities.h>

Inheritance diagram for Beatmup::Audio::WAV::InvalidWavFile:
Beatmup::Exception

Public Member Functions

 InvalidWavFile (const char *message)
 
- Public Member Functions inherited from Beatmup::Exception
virtual const char * what () const NOEXCEPT override
 

Static Public Member Functions

static void check (Header &header)
 

Additional Inherited Members

- Protected Member Functions inherited from Beatmup::Exception
 Exception (const char *message)
 
template<typename ... Args>
 Exception (const char *message, const Args &... args)
 

Detailed Description

Communicates an error related to a WAV file content.

Definition at line 68 of file wav_utilities.h.

Constructor & Destructor Documentation

◆ InvalidWavFile()

Beatmup::Audio::WAV::InvalidWavFile::InvalidWavFile ( const char *  message)
inline

Definition at line 70 of file wav_utilities.h.

70 : Exception(message) {};
Exception(const char *message)
Definition: exception.h:41
std::string message
Definition: exception.h:39

Member Function Documentation

◆ check()

void InvalidWavFile::check ( Header header)
static

Definition at line 42 of file wav_utilities.cpp.

42  {
43  if (header.m_RIFF != Header::__RIFF)
44  throw InvalidWavFile("Incorrect WAV file: 'RIFF' marker missing");
45 
46  if (header.m_WAVE != Header::__WAVE)
47  throw InvalidWavFile("Incorrect WAV file: 'WAVE' marker missing");
48 
49  if (header.m_fmt_ != Header::__fmt_)
50  throw InvalidWavFile("Incorrect WAV file: 'fmt ' marker missing");
51 
52  if (header.m_data != Header::__data)
53  throw InvalidWavFile("Incorrect WAV file: 'data' marker missing");
54 
55  if (header.__16 != 16)
56  throw InvalidWavFile("Incorrect WAV file: bad subchunk size");
57 
58  if (header.audioFormat != 1)
59  throw InvalidWavFile("Incorrect WAV file: unsupported audio format");
60 
61  if (sizeof(header) + header.dataSizeBytes != header.chunkSize + 8)
62  throw InvalidWavFile("Incorrect WAV file: size mismatch");
63 }
static const uint32_t __RIFF
Definition: wav_utilities.h:56
static const uint32_t __fmt_
Definition: wav_utilities.h:58
static const uint32_t __WAVE
Definition: wav_utilities.h:57
static const uint32_t __data
Definition: wav_utilities.h:59
InvalidWavFile(const char *message)
Definition: wav_utilities.h:70

The documentation for this class was generated from the following files: