mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2025-01-31 13:40:35 +00:00
Use stdint type names instead of sint8, sint16, etc
This commit is contained in:
parent
30c0a72039
commit
4ee44a24a5
7 changed files with 32 additions and 25 deletions
1
CMakeLists.txt
Normal file → Executable file
1
CMakeLists.txt
Normal file → Executable file
|
@ -127,6 +127,7 @@ check_include_file ( limits.h HAVE_LIMITS_H )
|
||||||
check_include_file ( pthread.h HAVE_PTHREAD_H )
|
check_include_file ( pthread.h HAVE_PTHREAD_H )
|
||||||
check_include_file ( signal.h HAVE_SIGNAL_H )
|
check_include_file ( signal.h HAVE_SIGNAL_H )
|
||||||
check_include_file ( getopt.h HAVE_GETOPT_H )
|
check_include_file ( getopt.h HAVE_GETOPT_H )
|
||||||
|
check_include_file ( stdint.h HAVE_STDINT_H )
|
||||||
include ( TestInline )
|
include ( TestInline )
|
||||||
include ( TestVLA )
|
include ( TestVLA )
|
||||||
include ( TestBigEndian )
|
include ( TestBigEndian )
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
* It is a 64 bit number. The higher 32 bits contain the 'index' (number of
|
* It is a 64 bit number. The higher 32 bits contain the 'index' (number of
|
||||||
* the current sample), the lower 32 bits the fractional part.
|
* the current sample), the lower 32 bits the fractional part.
|
||||||
*/
|
*/
|
||||||
typedef unsigned long long fluid_phase_t;
|
typedef uint64_t fluid_phase_t;
|
||||||
|
|
||||||
/* Purpose:
|
/* Purpose:
|
||||||
* Set a to b.
|
* Set a to b.
|
||||||
|
@ -56,26 +56,26 @@ typedef unsigned long long fluid_phase_t;
|
||||||
*/
|
*/
|
||||||
#define fluid_phase_set(a,b) a=b;
|
#define fluid_phase_set(a,b) a=b;
|
||||||
|
|
||||||
#define fluid_phase_set_int(a, b) ((a) = ((unsigned long long)(b)) << 32)
|
#define fluid_phase_set_int(a, b) ((a) = ((uint64_t)(b)) << 32)
|
||||||
|
|
||||||
/* Purpose:
|
/* Purpose:
|
||||||
* Sets the phase a to a phase increment given in b.
|
* Sets the phase a to a phase increment given in b.
|
||||||
* For example, assume b is 0.9. After setting a to it, adding a to
|
* For example, assume b is 0.9. After setting a to it, adding a to
|
||||||
* the playing pointer will advance it by 0.9 samples. */
|
* the playing pointer will advance it by 0.9 samples. */
|
||||||
#define fluid_phase_set_float(a, b) \
|
#define fluid_phase_set_float(a, b) \
|
||||||
(a) = (((unsigned long long)(b)) << 32) \
|
(a) = (((uint64_t)(b)) << 32) \
|
||||||
| (uint32) (((double)(b) - (int)(b)) * (double)FLUID_FRACT_MAX)
|
| (uint32_t) (((double)(b) - (int)(b)) * (double)FLUID_FRACT_MAX)
|
||||||
|
|
||||||
/* create a fluid_phase_t from an index and a fraction value */
|
/* create a fluid_phase_t from an index and a fraction value */
|
||||||
#define fluid_phase_from_index_fract(index, fract) \
|
#define fluid_phase_from_index_fract(index, fract) \
|
||||||
((((unsigned long long)(index)) << 32) + (fract))
|
((((uint64_t)(index)) << 32) + (fract))
|
||||||
|
|
||||||
/* Purpose:
|
/* Purpose:
|
||||||
* Return the index and the fractional part, respectively. */
|
* Return the index and the fractional part, respectively. */
|
||||||
#define fluid_phase_index(_x) \
|
#define fluid_phase_index(_x) \
|
||||||
((unsigned int)((_x) >> 32))
|
((unsigned int)((_x) >> 32))
|
||||||
#define fluid_phase_fract(_x) \
|
#define fluid_phase_fract(_x) \
|
||||||
((uint32)((_x) & 0xFFFFFFFF))
|
((uint32_t)((_x) & 0xFFFFFFFF))
|
||||||
|
|
||||||
/* Get the phase index with fractional rounding */
|
/* Get the phase index with fractional rounding */
|
||||||
#define fluid_phase_index_round(_x) \
|
#define fluid_phase_index_round(_x) \
|
||||||
|
@ -108,7 +108,7 @@ typedef unsigned long long fluid_phase_t;
|
||||||
/* Purpose:
|
/* Purpose:
|
||||||
* Subtract b samples from a.
|
* Subtract b samples from a.
|
||||||
*/
|
*/
|
||||||
#define fluid_phase_sub_int(a, b) ((a) -= (unsigned long long)(b) << 32)
|
#define fluid_phase_sub_int(a, b) ((a) -= (uint64_t)(b) << 32)
|
||||||
|
|
||||||
/* Purpose:
|
/* Purpose:
|
||||||
* Creates the expression a.index++. */
|
* Creates the expression a.index++. */
|
||||||
|
|
|
@ -2031,14 +2031,14 @@ fluid_sample_import_sfont(fluid_sample_t* sample, SFSample* sfsample, fluid_defs
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
#define READD(var,fd) do { \
|
#define READD(var,fd) do { \
|
||||||
uint32 _temp; \
|
uint32_t _temp; \
|
||||||
if (!safe_fread(&_temp, 4, fd)) \
|
if (!safe_fread(&_temp, 4, fd)) \
|
||||||
return(FAIL); \
|
return(FAIL); \
|
||||||
var = FLUID_LE32TOH(_temp); \
|
var = FLUID_LE32TOH(_temp); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
#define READW(var,fd) do { \
|
#define READW(var,fd) do { \
|
||||||
uint16 _temp; \
|
uint16_t _temp; \
|
||||||
if (!safe_fread(&_temp, 2, fd)) \
|
if (!safe_fread(&_temp, 2, fd)) \
|
||||||
return(FAIL); \
|
return(FAIL); \
|
||||||
var = FLUID_LE16TOH(_temp); \
|
var = FLUID_LE16TOH(_temp); \
|
||||||
|
|
|
@ -1410,7 +1410,7 @@ fluid_synth_sysex_midi_tuning (fluid_synth_t *synth, const char *data, int len,
|
||||||
int keys[128];
|
int keys[128];
|
||||||
char name[17];
|
char name[17];
|
||||||
int note, frac, frac2;
|
int note, frac, frac2;
|
||||||
uint8 chksum;
|
uint8_t chksum;
|
||||||
int i, count, index;
|
int i, count, index;
|
||||||
const char *dataptr;
|
const char *dataptr;
|
||||||
char *resptr;;
|
char *resptr;;
|
||||||
|
|
|
@ -1227,7 +1227,7 @@ fluid_str_hash (const void *v)
|
||||||
{
|
{
|
||||||
/* 31 bit hash function */
|
/* 31 bit hash function */
|
||||||
const signed char *p = v;
|
const signed char *p = v;
|
||||||
uint32 h = *p;
|
uint32_t h = *p;
|
||||||
|
|
||||||
if (h)
|
if (h)
|
||||||
for (p += 1; *p != '\0'; p++)
|
for (p += 1; *p != '\0'; p++)
|
||||||
|
|
|
@ -273,7 +273,7 @@ typedef GStaticPrivate fluid_private_t;
|
||||||
static FLUID_INLINE void
|
static FLUID_INLINE void
|
||||||
fluid_atomic_float_set(volatile float *fptr, float val)
|
fluid_atomic_float_set(volatile float *fptr, float val)
|
||||||
{
|
{
|
||||||
sint32 ival;
|
int32_t ival;
|
||||||
memcpy (&ival, &val, 4);
|
memcpy (&ival, &val, 4);
|
||||||
fluid_atomic_int_set ((volatile int *)fptr, ival);
|
fluid_atomic_int_set ((volatile int *)fptr, ival);
|
||||||
}
|
}
|
||||||
|
@ -281,7 +281,7 @@ fluid_atomic_float_set(volatile float *fptr, float val)
|
||||||
static FLUID_INLINE float
|
static FLUID_INLINE float
|
||||||
fluid_atomic_float_get(volatile float *fptr)
|
fluid_atomic_float_get(volatile float *fptr)
|
||||||
{
|
{
|
||||||
sint32 ival;
|
int32_t ival;
|
||||||
float fval;
|
float fval;
|
||||||
ival = fluid_atomic_int_get ((volatile int *)fptr);
|
ival = fluid_atomic_int_get ((volatile int *)fptr);
|
||||||
memcpy (&fval, &ival, 4);
|
memcpy (&fval, &ival, 4);
|
||||||
|
|
|
@ -112,6 +112,24 @@
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/** Integer types */
|
||||||
|
#if HAVE_STDINT_H
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#elif defined _MSC_VER
|
||||||
|
|
||||||
|
/* Emulate with standard MSVC types */
|
||||||
|
typedef signed __int8 int8_t;
|
||||||
|
typedef unsigned __int8 uint8_t;
|
||||||
|
typedef signed __int16 int16_t;
|
||||||
|
typedef unsigned __int16 uint16_t;
|
||||||
|
typedef signed __int32 int32_t;
|
||||||
|
typedef unsigned __int32 uint32_t;
|
||||||
|
typedef signed __int64 int64_t;
|
||||||
|
typedef unsigned __int64 uint64_t;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(WIN32) && HAVE_WINDOWS_H
|
#if defined(WIN32) && HAVE_WINDOWS_H
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
|
@ -121,8 +139,6 @@
|
||||||
/* MinGW32 special defines */
|
/* MinGW32 special defines */
|
||||||
#ifdef MINGW32
|
#ifdef MINGW32
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#define DSOUND_SUPPORT 1
|
#define DSOUND_SUPPORT 1
|
||||||
#define WINMIDI_SUPPORT 1
|
#define WINMIDI_SUPPORT 1
|
||||||
#define STDIN_FILENO 0
|
#define STDIN_FILENO 0
|
||||||
|
@ -170,16 +186,6 @@ typedef int fluid_socket_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/** Integer types */
|
|
||||||
//typedef gint8 sint8;
|
|
||||||
typedef guint8 uint8;
|
|
||||||
//typedef gint16 sint16;
|
|
||||||
typedef guint16 uint16;
|
|
||||||
typedef gint32 sint32;
|
|
||||||
typedef guint32 uint32;
|
|
||||||
//typedef gint64 sint64;
|
|
||||||
//typedef guint64 uint64;
|
|
||||||
|
|
||||||
/** Atomic types */
|
/** Atomic types */
|
||||||
typedef int fluid_atomic_int_t;
|
typedef int fluid_atomic_int_t;
|
||||||
typedef unsigned int fluid_atomic_uint_t;
|
typedef unsigned int fluid_atomic_uint_t;
|
||||||
|
|
Loading…
Reference in a new issue