add Autosave continuous backups by Andras Reuss and Andrew-R
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / samples.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2009 Adam Williams <broadcast at earthling dot net>
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 2 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, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  */
21
22
23 #ifndef SAMPLES_H
24 #define SAMPLES_H
25
26 // An object which contains samples
27
28
29
30 class Samples
31 {
32 public:
33 // Allocate 0 samples
34         Samples();
35 // Allocate number of samples
36         Samples(int samples);
37 // Share memory with another buffer
38         Samples(Samples *src);
39         virtual ~Samples();
40
41         void reset();
42         void clear_objects();
43         void share(int shmid);
44         void share(double *buffer);
45         void allocate(int samples, int use_shm);
46 // Get the buffer
47         double* get_data();
48 // Get number of samples allocated
49         int get_allocated();
50         void set_allocated(int allocated);
51         int get_shmid();
52         void set_offset(int offset);
53         int get_offset();
54
55 private:
56         int shmid;
57         double *data;
58         int allocated;
59 // Offset to 1st sample in samples.
60         int offset;
61         int use_shm;
62 };
63
64
65
66 #endif
67
68
69
70