1 /*
2  * libInstPatch
3  * Copyright (C) 1999-2014 Element Green <element@elementsofsound.org>
4  *
5  * Author of this file: (C) 2012 BALATON Zoltan <balaton@eik.bme.hu>
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * as published by the Free Software Foundation; version 2.1
10  * of the License only.
11  *
12  * This library 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 Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20  * 02110-1301, USA or on the web at http://www.gnu.org.
21  */
22 #ifndef __IPATCH_SLI_WRITER_H__
23 #define __IPATCH_SLI_WRITER_H__
24 
25 #include <glib.h>
26 #include <libinstpatch/IpatchSLIFile.h>
27 #include <libinstpatch/IpatchSLI.h>
28 #include <libinstpatch/IpatchList.h>
29 
30 typedef struct _IpatchSLIWriter IpatchSLIWriter; /* private structure */
31 typedef struct _IpatchSLIWriterClass IpatchSLIWriterClass;
32 
33 #define IPATCH_TYPE_SLI_WRITER   (ipatch_sli_writer_get_type ())
34 #define IPATCH_SLI_WRITER(obj) \
35   (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_SLI_WRITER, \
36    IpatchSLIWriter))
37 #define IPATCH_SLI_WRITER_CLASS(klass) \
38   (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_SLI_WRITER, \
39    IpatchSLIWriterClass))
40 #define IPATCH_IS_SLI_WRITER(obj) \
41   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_SLI_WRITER))
42 #define IPATCH_IS_SLI_WRITER_CLASS(klass) \
43   (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_SLI_WRITER))
44 
45 /* Spectralis SLI/SLC writer object
46  * Spectralis files do not sufficiently follow RIFF format
47  * so this object is not derived from IpatchRiff class */
48 struct _IpatchSLIWriter
49 {
50     GObject parent_instance;      /* derived from GObject */
51     IpatchFileHandle *handle;     /* file object being written */
52     IpatchSLI *orig_sli;	        /* original SLI object */
53     IpatchSLI *sli;	        /* duplicated SLI object to save */
54     GHashTable *sample_hash;	/* sample => SampleHashValue hash */
55     IpatchList *store_list;       /* list of stores, only set if ipatch_sli_writer_get_stores() was called */
56 };
57 
58 /* Spectralis SLI/SLC writer class */
59 struct _IpatchSLIWriterClass
60 {
61     GObjectClass parent_class;
62 };
63 
64 GType ipatch_sli_writer_get_type(void);
65 IpatchSLIWriter *ipatch_sli_writer_new(IpatchFileHandle *handle, IpatchSLI *sli);
66 void ipatch_sli_writer_set_patch(IpatchSLIWriter *writer, IpatchSLI *sli);
67 void ipatch_sli_writer_set_file_handle(IpatchSLIWriter *writer, IpatchFileHandle *handle);
68 gboolean ipatch_sli_writer_save(IpatchSLIWriter *writer, GError **err);
69 IpatchList *ipatch_sli_writer_create_stores(IpatchSLIWriter *writer);
70 
71 #endif
72