Audacity 3.2.0
MultiFormatReader.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 MultiFormatReader.h
6
7 Philipp Sibler
8
9**********************************************************************/
10
11#ifndef __AUDACITY_MULTIFORMATREADER_H__
12#define __AUDACITY_MULTIFORMATREADER_H__
13
14#include <stdio.h>
15#include <stdint.h>
16
18{
19public:
20 typedef enum
21 {
22 Little = 0,
23 Big
25
28 {}
29
31 {
32 return (mFlag == MachineEndianness::Little) ? 1 : 0;
33 }
34
35 int IsBig()
36 {
37 return (mFlag == MachineEndianness::Big) ? 1 : 0;
38 }
39
41 {
42 return mFlag;
43 }
44
45private:
47};
48
50{
51 FILE* mpFid;
53 uint8_t mSwapBuffer[8];
54
55public:
56 typedef enum
57 {
58 Int8 = 0,
65 Double
67
68 MultiFormatReader(const char* filename);
70
71 void Reset();
72 size_t ReadSamples(void* buffer, size_t len,
75 size_t ReadSamples(void* buffer, size_t len, size_t stride,
78
79private:
80 size_t Read(void* buffer, size_t size, size_t len, size_t stride);
81 void SwapBytes(void* buffer, size_t size, size_t len);
82};
83
84#endif
EndiannessT Which()
MultiFormatReader reads raw audio files in different formats and machine endianness representations.
MultiFormatReader(const char *filename)
size_t ReadSamples(void *buffer, size_t len, MultiFormatReader::FormatT format, MachineEndianness::EndiannessT end)
MachineEndianness mEnd
void SwapBytes(void *buffer, size_t size, size_t len)
size_t Read(void *buffer, size_t size, size_t len, size_t stride)
const char * end(const char *str) noexcept
Definition: StringUtils.h:106