ScummVM API documentation
music.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef TEEN_MUSIC_H
23 #define TEEN_MUSIC_H
24 
25 #include "audio/mods/paula.h"
26 #include "common/array.h"
27 
28 namespace TeenAgent {
29 
30 class TeenAgentEngine;
31 
32 class MusicPlayer : public Audio::Paula {
33 public:
35  ~MusicPlayer() override;
36 
37  bool load(int id);
38  int getId() const { return _id; }
39 
40  void start();
41  void stop();
42 
43 private:
44  TeenAgentEngine *_vm;
45 
46  int _id;
47 
48  struct Row {
49  struct Channel {
50  byte sample;
51  byte volume;
52  byte note;
53  Channel(): sample(0), volume(0x40), note(0) {}
54  } channels[3];
55  };
56 
57  struct Sample {
58  byte *data;
59  uint size;
60  Sample(): data(0), size(0) {}
61  ~Sample() { delete[] data; }
62 
63  void resize(uint s) {
64  if (s != size) {
65  delete[] data;
66  data = new byte[s];
67  size = s;
68  }
69  }
70  void clear() {
71  delete[] data;
72  data = 0;
73  size = 0;
74  }
75  } _samples[256];
76 
77  Common::Array<Row> _rows;
78  uint _currRow;
79 
80  void interrupt() override;
81 };
82 
83 } // End of namespace Teen
84 
85 #endif // TEEN_MUSIC_H
Definition: music.h:32
Definition: teenagent.h:83
Definition: actor.h:29
Definition: paula.h:36