Debian Codegraph @

src/engine/sfWrapper.h

raw
1 /**
2 * Furnace Tracker - multi-system chiptune tracker
3 * Copyright (C) 2021-2025 tildearrow and contributors
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 // sfWrapper.h: libsndfile FILE* wrapper to work around Windows issue with
21 // non-ASCII chars in file path
22 // I wanted to do this in sndfile directly, but it's a
23 // submodule...
24
25 #ifndef _SFWRAPPER_H
26 #define _SFWRAPPER_H
27 #include <stdio.h>
28 #include <stdlib.h>
29 #include <stdint.h>
30 #include <sndfile.h>
31 #include "../ta-utils.h"
32
33 class SFWrapper {
34 FILE* f;
35 size_t len;
36 SF_VIRTUAL_IO vio;
37 SNDFILE* sf;
38 int fileMode;
39
40 public:
41 sf_count_t ioGetSize();
42 sf_count_t ioSeek(sf_count_t offset, int whence);
43 sf_count_t ioRead(void* ptr, sf_count_t count);
44 sf_count_t ioWrite(const void* ptr, sf_count_t count);
45 sf_count_t ioTell();
46
47 int doClose();
48 SNDFILE* doOpen(const char* path, int mode, SF_INFO* sfinfo);
49 SFWrapper():
50 f(NULL),
51 len(0),
52 sf(NULL),
53 fileMode(0) {}
54 };
55
56 #endif