ScummVM API documentation
u6_adplug_decoder_stream.h
1 /* Created by Eric Fry
2  * Copyright (C) 2011 The Nuvie Team
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (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, see <http://www.gnu.org/licenses/>.
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  *
18  */
19 
20 #ifndef NUVIE_SOUND_ADPLUG_ADPLUG_DECODER_STREAM_H
21 #define NUVIE_SOUND_ADPLUG_ADPLUG_DECODER_STREAM_H
22 
23 #include "ultima/shared/std/string.h"
24 #include "ultima/nuvie/sound/adplug/emu_opl.h"
25 #include "ultima/nuvie/sound/adplug/opl.h"
26 #include "ultima/nuvie/sound/adplug/u6m.h"
27 #include "ultima/nuvie/sound/adplug/mid.h"
28 #include "audio/audiostream.h"
29 
30 namespace Ultima {
31 namespace Nuvie {
32 
33 class U6Lib_n;
34 class U6Lzw;
35 class NuvieIOBuffer;
36 using Std::string;
37 
39 public:
41  opl = nullptr;
42  player = nullptr;
43  player_refresh_count = 0;
44  }
45 
46  U6AdPlugDecoderStream(CEmuopl *o, const Common::Path &filename, uint16 song_num);
47  ~U6AdPlugDecoderStream() override;
48 
49  int readBuffer(sint16 *buffer, const int numSamples) override;
50 
52  bool isStereo() const override {
53  return true;
54  }
55 
57  int getRate() const override {
58  return opl->getRate();
59  }
60 
61  bool rewind() override {
62  if (player) {
63  player->rewind(); //FIXME this would need to be locked if called outside mixer thread.
64  return true;
65  }
66  return false;
67  }
68 
76  bool endOfData() const override {
77  return false;
78  }
79 private:
80  void update_opl(short *data, int num_samples);
81 protected:
82 
83  uint16 samples_left;
84  CEmuopl *opl;
85  CPlayer *player;
86  int player_refresh_count;
87  int interrupt_rate;
88  int interrupt_samples_left;
89  bool is_midi_track;
90 };
91 
92 } // End of namespace Nuvie
93 } // End of namespace Ultima
94 
95 #endif
bool rewind() override
Definition: u6_adplug_decoder_stream.h:61
bool isStereo() const override
Definition: u6_adplug_decoder_stream.h:52
Definition: u6_adplug_decoder_stream.h:38
Definition: path.h:52
int getRate() const override
Definition: u6_adplug_decoder_stream.h:57
Definition: detection.h:27
int readBuffer(sint16 *buffer, const int numSamples) override
Definition: adplug_player.h:35
bool endOfData() const override
Definition: u6_adplug_decoder_stream.h:76
Definition: audiostream.h:109
Definition: emu_opl.h:31