wavTypes.h (3091B)
1 #pragma once 2 3 #include <cstdint> 4 5 namespace synthLib 6 { 7 #ifdef _MSC_VER 8 // TODO: gcc and others 9 #pragma pack(push, 1) 10 #endif 11 12 struct SWaveFormatHeader 13 { 14 uint8_t str_riff[4]; // ASCII string "RIFF" 15 uint32_t file_size; // File size - 8 16 uint8_t str_wave[4]; // ASCII string "WAVE" 17 }; 18 19 struct SWaveFormatChunkInfo 20 { 21 uint8_t chunkName[4]; // chunk name 22 uint32_t chunkSize; // chunk length 23 }; 24 25 struct SWaveFormatChunkFormat // "fmt ", size = 16 (0x10) 26 { 27 uint16_t wave_type; // PCM = 1 28 uint16_t num_channels; // number of channels 29 uint32_t sample_rate; // sample rate 30 uint32_t bytes_per_sec; // bytes per sample (it's second, isn't it?!) 31 uint16_t block_alignment; // bytes, that must be sent at a single time 32 uint16_t bits_per_sample; // bits per sample 33 }; 34 35 struct SWaveFormatChunkCue 36 { 37 uint32_t cuePointCount; // number of cue points in list 38 }; 39 40 struct SWaveFormatChunkCuePoint 41 { 42 uint32_t cueId; // unique identification value 43 uint32_t playOrderPosition; // play order position 44 int8_t dataChunkId[4]; // RIFF ID of corresponding data chunk 45 uint32_t chunkStart; // byte offset of data chunk* 46 uint32_t blockStart; // byte offset to sample of First Channel 47 uint32_t sampleOffset; // byte offset to sample byte of First Channel 48 }; 49 50 struct SWaveFormatChunkLabel 51 { 52 uint32_t cuePointId; // unique identification value 53 }; 54 55 struct SWaveFormatChunkList 56 { 57 uint8_t typeId[4]; // "adtl" (0x6164746C) => associated data list 58 }; 59 60 #ifdef _MSC_VER 61 #pragma pack(pop) 62 #endif 63 64 enum EWaveFormat 65 { 66 eFormat_PCM = 0x0001, 67 eFormat_MS_ADPCM = 0x0002, 68 eFormat_IEEE_FLOAT = 0x0003, 69 eFormat_IBM_CVSD = 0x0005, 70 eFormat_ALAW = 0x0006, 71 eFormat_MULAW = 0x0007, 72 eFormat_OKI_ADPCM = 0x0010, 73 eFormat_DVI_IMA_ADPCM = 0x0011, 74 eFormat_MEDIASPACE_ADPCM = 0x0012, 75 eFormat_SIERRA_ADPCM = 0x0013, 76 eFormat_G723_ADPCM = 0x0014, 77 eFormat_DIGISTD = 0x0015, 78 eFormat_DIGIFIX = 0x0016, 79 eFormat_DIALOGIC_OKI_ADPCM = 0x0017, 80 eFormat_YAMAHA_ADPCM = 0x0020, 81 eFormat_SONARC = 0x0021, 82 eFormat_DSPGROUP_TRUESPEECH = 0x0022, 83 eFormat_ECHOSC1 = 0x0023, 84 eFormat_AUDIOFILE_AF36 = 0x0024, 85 eFormat_APTX = 0x0025, 86 eFormat_AUDIOFILE_AF10 = 0x0026, 87 eFormat_DOLBY_AC2 = 0x0030, 88 eFormat_GSM610 = 0x0031, 89 eFormat_ANTEX_ADPCME = 0x0033, 90 eFormat_CONTROL_RES_VQLPC = 0x0034, 91 eFormat_CONTROL_RES_VQLPC_2 = 0x0035, 92 eFormat_DIGIADPCM = 0x0036, 93 eFormat_CONTROL_RES_CR10 = 0x0037, 94 eFormat_NMS_VBXADPCM = 0x0038, 95 eFormat_CS_IMAADPCM = 0x0039, 96 eFormat_G721_ADPCM = 0x0040, 97 eFormat_MPEG = 0x0050, 98 eFormat_Xbox_ADPCM = 0x0069, 99 eFormat_CREATIVE_ADPCM = 0x0200, 100 eFormat_CREATIVE_FASTSPEECH8 = 0x0202, 101 eFormat_CREATIVE_FASTSPEECH10 = 0x0203, 102 eFormat_FM_TOWNS_SND = 0x0300, 103 eFormat_OLIGSM = 0x1000, 104 eFormat_OLIADPCM = 0x1001, 105 eFormat_OLICELP = 0x1002, 106 eFormat_OLISBC = 0x1003, 107 eFormat_OLIOPR = 0x1004 108 }; 109 }