Files
CgeSample/CgeSample.h
Mikhail Romanko 072d068dcd
All checks were successful
CI / build-and-analyze (push) Successful in 1m19s
Initial commit
2026-08-19 09:22:12 +03:00

47 lines
1.5 KiB
C

#ifndef CGE_SAMPLE_H
#define CGE_SAMPLE_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <stddef.h>
enum CgeSampleFormat {
CGE_SAMPLE_UNKNOWN, /* Invalid or unknown format */
CGE_SAMPLE_S8, /* 8-bit signed integer, range: -128 to 127 */
CGE_SAMPLE_U8, /* 8-bit unsigned integer, range: 0 to 255 */
CGE_SAMPLE_S16, /* 16-bit signed integer, range: -32768 to 32767 */
CGE_SAMPLE_U16, /* 16-bit unsigned integer, range: 0 to 65535 */
CGE_SAMPLE_S24, /* 24-bit signed integer */
CGE_SAMPLE_U24, /* 24-bit unsigned integer */
CGE_SAMPLE_S32, /* 32-bit signed integer */
CGE_SAMPLE_U32, /* 32-bit unsigned integer */
CGE_SAMPLE_F32, /* 32-bit IEEE 754 float */
CGE_SAMPLE_F64, /* 64-bit IEEE 754 double */
};
typedef struct CgeSampleBuf {
void *data;
int format;
size_t count;
size_t stride;
} CgeSampleBuf;
size_t CgeSampleInitLayout(CgeSampleBuf *buf, int format, size_t count);
float CgeSampleGetF32(const CgeSampleBuf *buf, size_t index);
void CgeSampleSetF32(CgeSampleBuf *buf, size_t index, float value);
int16_t CgeSampleGetS16(const CgeSampleBuf *buf, size_t index);
void CgeSampleSetS16(CgeSampleBuf *buf, size_t index, int16_t value);
void CgeSampleConvert(void *src, int srcFormat, size_t srcStride,
void *dst, int dstFormat, size_t dstStride,
size_t count);
#ifdef __cplusplus
}
#endif
#endif /* CGE_SAMPLE_H */