MythTV  master
freesurround.h
Go to the documentation of this file.
1 /*
2 Copyright (C) 2007 Christian Kothe, Mark Spieth
3 
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
8 
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13 
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18 
19 #ifndef FREESURROUND_H
20 #define FREESURROUND_H
21 
22 #include "compat.h" // instead of sys/types.h, for MinGW compatibility
23 
24 #define SURROUND_BUFSIZE 8192
25 
27 {
28 public:
29  typedef enum
30  {
35  } SurroundMode;
36 public:
37  FreeSurround(uint srate, bool moviemode, SurroundMode mode);
38  ~FreeSurround();
39 
40  // put frames in buffer, returns number of frames used
41  uint putFrames(void* buffer, uint numFrames, uint numChannels);
42  // get a number of frames
43  uint receiveFrames(void *buffer, uint maxFrames);
44  // flush unprocessed samples
45  void flush();
47  uint numFrames();
48 
49  long long getLatency();
51 
53 
54 protected:
55  void process_block();
56  void open();
57  void close();
58  void SetParams();
59 
60 private:
61 
62  // the changeable parameters
64  int32_t center_width; // presence of the center channel
65  int32_t dimension; // dimension
66  float coeff_a,coeff_b; // surround mixing coefficients
67  int32_t phasemode; // phase shifting mode
68  int32_t steering; // steering mode (0=simple, 1=linear)
69  int32_t front_sep, rear_sep; // front/rear stereo separation
70  // (default) constructor
71  fsurround_params(int32_t center_width=100, int32_t dimension=0);
72  } params;
73 
74  // additional settings
76 
77  // info about the current setup
78  struct buffers *bufs; // our buffers
79  class fsurround_decoder *decoder; // the surround decoder
80  int in_count; // amount in lt,rt
81  int out_count; // amount in output bufs
82  bool processed; // whether processing is enabled for latency calc
83  int processed_size; // amount processed
84  SurroundMode surround_mode; // 1 of 3 surround modes supported
85  int latency_frames; // number of frames of incurred latency
86  int channels;
87 };
88 
89 #endif
SurroundMode surround_mode
Definition: freesurround.h:84
uint putFrames(void *buffer, uint numFrames, uint numChannels)
uint frameLatency()
void process_block()
struct buffers * bufs
Definition: freesurround.h:78
unsigned int uint
Definition: compat.h:140
class fsurround_decoder * decoder
Definition: freesurround.h:79
uint receiveFrames(void *buffer, uint maxFrames)
int latency_frames
Definition: freesurround.h:85
struct FreeSurround::fsurround_params params
FreeSurround(uint srate, bool moviemode, SurroundMode mode)
long long getLatency()
uint numUnprocessedFrames()
fsurround_params(int32_t center_width=100, int32_t dimension=0)
int processed_size
Definition: freesurround.h:83
uint framesPerBlock()