AUI Framework  develop
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
ASampleFormat.h
    1#pragma once
    2
    3#include <type_traits>
    4#include <cstdint>
    5#include <cstddef>
    6#include "AUI/Common/AException.h"
    7
   16    I16,
   17
   21    I24,
   22
   26    I32,
   27
   31    F32,
   32};
   33
   34namespace aui::audio {
   35    constexpr size_t bytesPerSample(ASampleFormat format) {
   36        switch (format) {
   37            case ASampleFormat::I16:
   38                return 2;
   39
   40            case ASampleFormat::I24:
   41                return 3;
   42
   43            case ASampleFormat::F32:
   44            case ASampleFormat::I32:
   45                return 4;
   46        }
   47
   48        throw AException("Wrong sample format");
   49    }
   50}
ASampleFormat
Sample formats supported for mixing.
Definition ASampleFormat.h:12
@ F32
32-bit IEEE floating point.
Definition ASampleFormat.h:31
@ I16
Signed 16-bit integer.
Definition ASampleFormat.h:16
@ I24
Signed 24-bit integer.
Definition ASampleFormat.h:21
@ I32
Signed 32-bit integer.
Definition ASampleFormat.h:26