ScummVM API documentation
fm_towns_decoder_stream.h
1 #ifndef __FMtownsDecoderStream_h__
2 #define __FMtownsDecoderStream_h__
3 /* Created by Eric Fry
4  * Copyright (C) 2011 The Nuvie Team
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19  *
20  */
21 
22 #include "ultima/nuvie/sound/decoder/random_collection_audio_stream.h"
23 
24 namespace Ultima {
25 namespace Nuvie {
26 
27 class U6Lib_n;
28 class U6Lzw;
29 class NuvieIOBuffer;
30 
32 public:
34  should_free_raw_data = false;
35  raw_audio_buf = nullptr;
36  }
37 
38  FMtownsDecoderStream(unsigned char *buf, uint32 len);
39  FMtownsDecoderStream(const Common::Path &filename, uint16 sample_num, bool isCompressed = true);
40  ~FMtownsDecoderStream() override;
41 
42  uint32 getLengthInMsec();
43 
44  int readBuffer(sint16 *buffer, const int numSamples) override;
45 
47  bool isStereo() const override {
48  return false;
49  }
50 
52  int getRate() const override {
53  return 14700;
54  }
55 
63  bool endOfData() const override {
64  return buf_pos >= buf_len;
65  }
66 
67  bool rewind() override {
68  buf_pos = 0;
69  return true;
70  }
71 
72 protected:
73 
74  bool should_free_raw_data;
75  unsigned char *raw_audio_buf;
76  uint32 buf_len;
77  uint32 buf_pos;
78 
79 private:
80  inline sint16 convertSample(uint16 rawSample) const;
81 };
82 
83 } // End of namespace Nuvie
84 } // End of namespace Ultima
85 
86 #endif
Definition: fm_towns_decoder_stream.h:31
Definition: path.h:52
bool isStereo() const override
Definition: fm_towns_decoder_stream.h:47
Definition: detection.h:27
int getRate() const override
Definition: fm_towns_decoder_stream.h:52
bool rewind() override
Definition: fm_towns_decoder_stream.h:67
Definition: audiostream.h:109
int readBuffer(sint16 *buffer, const int numSamples) override
bool endOfData() const override
Definition: fm_towns_decoder_stream.h:63