Audacity  3.0.3
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 {
19 public:
20  typedef enum
21  {
22  Little = 0,
23  Big
25 
28  {}
29 
30  int IsLittle()
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 
45 private:
47 };
48 
50 {
51  FILE* mpFid;
53  uint8_t mSwapBuffer[8];
54 
55 public:
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 
79 private:
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
size
size_t size
Definition: ffmpeg-2.3.6-single-header.h:412
MachineEndianness::Little
@ Little
Definition: MultiFormatReader.h:22
MultiFormatReader::ReadSamples
size_t ReadSamples(void *buffer, size_t len, MultiFormatReader::FormatT format, MachineEndianness::EndiannessT end)
Definition: MultiFormatReader.cpp:67
MachineEndianness
Definition: MultiFormatReader.h:18
MultiFormatReader::Uint8
@ Uint8
Definition: MultiFormatReader.h:61
MultiFormatReader::Double
@ Double
Definition: MultiFormatReader.h:65
MultiFormatReader::mSwapBuffer
uint8_t mSwapBuffer[8]
Definition: MultiFormatReader.h:53
MachineEndianness::IsLittle
int IsLittle()
Definition: MultiFormatReader.h:30
MultiFormatReader::Uint16
@ Uint16
Definition: MultiFormatReader.h:62
MultiFormatReader::~MultiFormatReader
~MultiFormatReader()
Definition: MultiFormatReader.cpp:51
MultiFormatReader::Int32
@ Int32
Definition: MultiFormatReader.h:60
MultiFormatReader::Int16
@ Int16
Definition: MultiFormatReader.h:59
MultiFormatReader::Float
@ Float
Definition: MultiFormatReader.h:64
MachineEndianness::Big
@ Big
Definition: MultiFormatReader.h:23
MultiFormatReader::MultiFormatReader
MultiFormatReader(const char *filename)
Definition: MultiFormatReader.cpp:40
MachineEndianness::mFlag
EndiannessT mFlag
Definition: MultiFormatReader.h:46
MachineEndianness::MachineEndianness
MachineEndianness()
Definition: MultiFormatReader.cpp:27
format
int format
Definition: ExportPCM.cpp:56
MultiFormatReader::Read
size_t Read(void *buffer, size_t size, size_t len, size_t stride)
Definition: MultiFormatReader.cpp:110
MultiFormatReader::Uint32
@ Uint32
Definition: MultiFormatReader.h:63
MachineEndianness::IsBig
int IsBig()
Definition: MultiFormatReader.h:35
MachineEndianness::Which
EndiannessT Which()
Definition: MultiFormatReader.h:40
MachineEndianness::~MachineEndianness
~MachineEndianness()
Definition: MultiFormatReader.h:27
MultiFormatReader::mEnd
MachineEndianness mEnd
Definition: MultiFormatReader.h:52
MachineEndianness::EndiannessT
EndiannessT
Definition: MultiFormatReader.h:21
MultiFormatReader::Reset
void Reset()
Definition: MultiFormatReader.cpp:59
MultiFormatReader::SwapBytes
void SwapBytes(void *buffer, size_t size, size_t len)
Definition: MultiFormatReader.cpp:136
MultiFormatReader
MultiFormatReader reads raw audio files in different formats and machine endianness representations.
Definition: MultiFormatReader.h:50
MultiFormatReader::FormatT
FormatT
Definition: MultiFormatReader.h:57
MultiFormatReader::mpFid
FILE * mpFid
Definition: MultiFormatReader.h:51
MultiFormatReader::Int8
@ Int8
Definition: MultiFormatReader.h:58