Audacity  2.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 {
19 public:
20  typedef enum
21  {
22  Little = 0,
24  } EndiannessT;
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,
66  } FormatT;
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
MultiFormatReader(const char *filename)
Definition: MultiFormatReader.cpp:40
MachineEndianness mEnd
Definition: MultiFormatReader.h:52
MultiFormatReader reads raw audio files in different formats and machine endianness representations...
Definition: MultiFormatReader.h:49
EndiannessT mFlag
Definition: MultiFormatReader.h:46
~MachineEndianness()
Definition: MultiFormatReader.h:27
size_t ReadSamples(void *buffer, size_t len, MultiFormatReader::FormatT format, MachineEndianness::EndiannessT end)
Definition: MultiFormatReader.cpp:67
Definition: MultiFormatReader.h:62
Definition: MultiFormatReader.h:58
Definition: MultiFormatReader.h:22
int IsLittle()
Definition: MultiFormatReader.h:30
Definition: MultiFormatReader.h:64
size_t Read(void *buffer, size_t size, size_t len, size_t stride)
Definition: MultiFormatReader.cpp:110
FILE * mpFid
Definition: MultiFormatReader.h:51
Definition: MultiFormatReader.h:61
int IsBig()
Definition: MultiFormatReader.h:35
FormatT
Definition: MultiFormatReader.h:56
int format
Definition: ExportPCM.cpp:56
Definition: MultiFormatReader.h:23
Definition: MultiFormatReader.h:60
Definition: MultiFormatReader.h:59
uint8_t mSwapBuffer[8]
Definition: MultiFormatReader.h:53
EndiannessT
Definition: MultiFormatReader.h:20
EndiannessT Which()
Definition: MultiFormatReader.h:40
MachineEndianness()
Definition: MultiFormatReader.cpp:27
~MultiFormatReader()
Definition: MultiFormatReader.cpp:51
Definition: MultiFormatReader.h:63
void Reset()
Definition: MultiFormatReader.cpp:59
void SwapBytes(void *buffer, size_t size, size_t len)
Definition: MultiFormatReader.cpp:136
Definition: MultiFormatReader.h:17
Definition: MultiFormatReader.h:65