Plugin: Move deallocation into core.
[gemrb.git] / gemrb / plugins / ACMReader / ACMReader.h
blobf99aaf467723d5a313bdbf3e9dc9e5fd95a5db84
1 /* GemRB - Infinity Engine Emulator
2 * Copyright (C) 2003 The GemRB Project
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.
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.
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.
19 #ifndef ACMREADER_H
20 #define ACMREADER_H
22 #include <stdio.h>
23 #include <string.h>
24 #include <stdlib.h>
25 #include "unpacker.h"
26 #include "decoder.h"
27 #include "general.h"
28 #include "DataStream.h"
29 #include "SoundMgr.h"
31 // IP's ACM files
32 class ACMReader : public SoundMgr {
33 private:
34 int samples_left; // count of unread samples
35 int levels, subblocks;
36 int block_size;
37 int* block, * values;
38 int samples_ready;
39 CValueUnpacker* unpacker; // ACM-stream unpacker
40 CSubbandDecoder* decoder; // IP's subband decoder
42 int make_new_samples();
43 public:
44 ACMReader()
45 : samples_left( 0 ), block( NULL ), values( NULL ),
46 samples_ready( 0 ), unpacker( NULL ), decoder( NULL )
49 virtual ~ACMReader()
51 Close();
53 void Close()
55 if (block) {
56 free(block);
58 if (unpacker) {
59 delete unpacker;
61 if (decoder) {
62 delete decoder;
66 bool Open(DataStream* stream);
67 virtual int read_samples(short* buffer, int count);
70 #endif