vgmstream/cli/wav_utils.h

30 lines
775 B
C
Raw Normal View History

2024-07-21 18:22:42 +02:00
#ifndef _WAV_UTILS_H_
#define _WAV_UTILS_H_
2024-07-21 22:20:29 +02:00
#include <stdlib.h>
2024-07-21 18:22:42 +02:00
#include <stdint.h>
#include <stdbool.h>
typedef struct {
bool is_float;
int sample_size;
int32_t sample_count;
int32_t sample_rate;
int channels;
bool write_smpl_chunk;
int32_t loop_start;
int32_t loop_end;
} wav_header_t;
/* make a RIFF header for .wav; returns final RIFF size or 0 if buffer is too small */
size_t wav_make_header(uint8_t* buf, size_t buf_size, wav_header_t* wav);
/* swap big endian samples to little endian. Does nothing if machine is already LE.
* Used when writting .WAV files, where samples in memory/buf may be BE while RIFF
* is expected to have LE samples. */
2024-07-25 17:15:49 +02:00
void wav_swap_samples_le(void* samples, int samples_len, int sample_size);
2024-07-21 18:22:42 +02:00
#endif