A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd
at master 56 lines 2.0 kB view raw
1 2#ifndef SFORMAT_H__ 3#define SFORMAT_H__ 4 5typedef unsigned short uint16; 6typedef unsigned long uint32; 7 8#define FORMAT_WAVE 0 9#define FORMAT_AIFF 1 10#define FORMAT_NEXT 2 11 12/* the NeXTStep sound header structure; can be big or little endian */ 13 14typedef struct _nextstep 15{ 16 char ns_fileid[4]; /* magic number '.snd' if file is big-endian */ 17 uint32 ns_onset; /* byte offset of first sample */ 18 uint32 ns_length; /* length of sound in bytes */ 19 uint32 ns_format; /* format; see below */ 20 uint32 ns_sr; /* sample rate */ 21 uint32 ns_nchans; /* number of channels */ 22 char ns_info[4]; /* comment */ 23} t_nextstep; 24 25#define NS_FORMAT_LINEAR_16 3 26#define NS_FORMAT_LINEAR_24 4 27#define NS_FORMAT_FLOAT 6 28#define SCALE (1./(1024. * 1024. * 1024. * 2.)) 29 30/* the WAVE header. All Wave files are little endian. We assume 31 the "fmt" chunk comes first which is usually the case but perhaps not 32 always; same for AIFF and the "COMM" chunk. */ 33 34typedef unsigned word; 35typedef unsigned long dword; 36 37typedef struct _wave 38{ 39 char w_fileid[4]; /* chunk id 'RIFF' */ 40 uint32 w_chunksize; /* chunk size */ 41 char w_waveid[4]; /* wave chunk id 'WAVE' */ 42 char w_fmtid[4]; /* format chunk id 'fmt ' */ 43 uint32 w_fmtchunksize; /* format chunk size */ 44 uint16 w_fmttag; /* format tag, 1 for PCM */ 45 uint16 w_nchannels; /* number of channels */ 46 uint32 w_samplespersec; /* sample rate in hz */ 47 uint32 w_navgbytespersec; /* average bytes per second */ 48 uint16 w_nblockalign; /* number of bytes per sample */ 49 uint16 w_nbitspersample; /* number of bits in a sample */ 50 char w_datachunkid[4]; /* data chunk id 'data' */ 51 uint32 w_datachunksize; /* length of data chunk */ 52} t_wave; 53 54 55#endif 56