2018-02-19 21:14:22 +00:00
|
|
|
/*
|
|
|
|
TiMidity++ -- MIDI to WAVE converter and player
|
|
|
|
Copyright (C) 1999-2002 Masanao Izumo <mo@goice.co.jp>
|
|
|
|
Copyright (C) 1995 Tuukka Toivonen <tt@cgs.fi>
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
|
|
|
|
|
|
|
|
common.h
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef ___COMMON_H_
|
|
|
|
#define ___COMMON_H_
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
#include <stdint.h>
|
2019-09-23 11:53:28 +00:00
|
|
|
#include "timidity_file.h"
|
2018-02-19 21:14:22 +00:00
|
|
|
|
|
|
|
namespace TimidityPlus
|
|
|
|
{
|
2019-09-23 11:53:28 +00:00
|
|
|
inline char* tf_gets(char* buff, int n, struct timidity_file* tf)
|
|
|
|
{
|
|
|
|
return tf->gets(buff, n);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline long tf_read(void* buff, int32_t size, int32_t nitems, struct timidity_file* tf)
|
|
|
|
{
|
|
|
|
return (long)tf->read(buff, size, nitems);
|
|
|
|
}
|
2018-02-19 21:14:22 +00:00
|
|
|
|
2019-09-23 11:53:28 +00:00
|
|
|
inline long tf_seek(struct timidity_file* tf, long offset, int whence)
|
2018-02-19 21:14:22 +00:00
|
|
|
{
|
2019-09-23 11:53:28 +00:00
|
|
|
return (long)tf->seek(offset, whence);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline long tf_tell(struct timidity_file* tf)
|
|
|
|
{
|
|
|
|
return (long)tf->tell();
|
|
|
|
}
|
2018-02-19 21:14:22 +00:00
|
|
|
|
2019-09-23 09:27:57 +00:00
|
|
|
extern struct timidity_file *open_file(const char *name, SoundFontReaderInterface *);
|
2018-03-10 19:10:17 +00:00
|
|
|
extern void tf_close(struct timidity_file *tf);
|
2018-02-19 21:14:22 +00:00
|
|
|
extern void skip(struct timidity_file *tf, size_t len);
|
|
|
|
int tf_getc(struct timidity_file *tf);
|
|
|
|
extern int int_rand(int n); /* random [0..n-1] */
|
|
|
|
double flt_rand();
|
|
|
|
|
|
|
|
extern void *safe_malloc(size_t count);
|
|
|
|
extern void *safe_realloc(void *old_ptr, size_t new_size);
|
|
|
|
extern void *safe_large_malloc(size_t count);
|
|
|
|
extern char *safe_strdup(const char *s);
|
|
|
|
extern void free_ptr_list(void *ptr_list, int count);
|
|
|
|
extern int string_to_7bit_range(const char *s, int *start, int *end);
|
|
|
|
extern int load_table(char *file);
|
|
|
|
|
|
|
|
}
|
|
|
|
#endif /* ___COMMON_H_ */
|