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 "common/str.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
30namespace Ultima {
31namespace Nuvie {
32
33class U6Lib_n;
34class U6Lzw;
35class NuvieIOBuffer;
36
38public:
40 opl = nullptr;
41 player = nullptr;
42 player_refresh_count = 0;
43 }
44
45 U6AdPlugDecoderStream(CEmuopl *o, const Common::Path &filename, uint16 song_num);
46 ~U6AdPlugDecoderStream() override;
47
48 int readBuffer(sint16 *buffer, const int numSamples) override;
49
51 bool isStereo() const override {
52 return true;
53 }
54
56 int getRate() const override {
57 return opl->getRate();
58 }
59
60 bool rewind() override {
61 if (player) {
62 player->rewind(); //FIXME this would need to be locked if called outside mixer thread.
63 return true;
64 }
65 return false;
66 }
67
75 bool endOfData() const override {
76 return false;
77 }
78private:
79 void update_opl(short *data, int num_samples);
80protected:
81
82 uint16 samples_left;
83 CEmuopl *opl;
84 CPlayer *player;
85 int player_refresh_count;
86 int interrupt_rate;
87 int interrupt_samples_left;
88 bool is_midi_track;
89};
90
91} // End of namespace Nuvie
92} // End of namespace Ultima
93
94#endif
Definition: audiostream.h:109
Definition: path.h:52
Definition: emu_opl.h:31
Definition: adplug_player.h:35
Definition: u6_adplug_decoder_stream.h:37
int readBuffer(sint16 *buffer, const int numSamples) override
bool rewind() override
Definition: u6_adplug_decoder_stream.h:60
int getRate() const override
Definition: u6_adplug_decoder_stream.h:56
bool isStereo() const override
Definition: u6_adplug_decoder_stream.h:51
bool endOfData() const override
Definition: u6_adplug_decoder_stream.h:75