[Bug c++/22351] New: Failing compilation

gcc-bugzilla at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Thu Jul 7 17:44:00 GMT 2005


# g++ -Wp,-MMD,"backends/midi/mt32/.deps/i386.d",-MQ,"backends/midi/mt32/i386.o",-MP -Wall -g -ansi -W -Wno-unused-parameter -DDYNAMIC_MODULES -fpic -O -Wuninitialized -Wno-long-long -Wno-multichar -Wno-unknown-pragmas -pedantic -Wpointer-arith -Wcast-qual -Wconversion -Wshadow -Wimplicit -Wundef -Wnon-virtual-dtor -Wno-reorder -Wwrite-strings -fcheck-new -Wctor-dtor-privacy  -DHAVE_CONFIG_H -DUNIX -DDISABLE_SAGA -I. -I. -I./common -I./backends/midi/mt32        -I/usr/include/SDL -D_REENTRANT -Itest/cxxtest -c backends/midi/mt32/i386.cpp -o backends/midi/mt32/i386.o -save-temps
backends/midi/mt32/i386.cpp: In function `bool MT32Emu::Detect3DNow()':
backends/midi/mt32/i386.cpp:466: internal compiler error: in
   verify_local_live_at_start, at flow.c:601
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

Environment:
System: Linux xenon 2.6.7 #2 Wed Sep 8 23:52:45 EEST 2004 i686 unknown unknown GNU/Linux
Architecture: i686

	
host: i486-slackware-linux-gnu
build: i486-slackware-linux-gnu
target: i486-slackware-linux-gnu
configured with: ../gcc-3.3.5/configure --prefix=/usr --enable-shared --enable-threads=posix --enable-__cxa_atexit --disable-checking --with-gnu-ld --verbose --target=i486-slackware-linux --host=i486-slackware-linux

How-To-Repeat:
# 1 "backends/midi/mt32/i386.cpp"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "backends/midi/mt32/i386.cpp"
# 22 "backends/midi/mt32/i386.cpp"
# 1 "backends/midi/mt32/mt32emu.h" 1
# 59 "backends/midi/mt32/mt32emu.h"
# 1 "backends/midi/mt32/freeverb.h" 1
# 41 "backends/midi/mt32/freeverb.h"
class comb {
public:
        comb();
        void setbuffer(float *buf, int size);
        inline float process(float inp);
        void mute();
        void setdamp(float val);
        float getdamp();
        void setfeedback(float val);
        float getfeedback();
private:
        float feedback;
        float filterstore;
        float damp1;
        float damp2;
        float *buffer;
        int bufsize;
        int bufidx;
};




inline float comb::process(float input) {
        float output;

        output = buffer[bufidx];
        if (((*(unsigned int*)&output) & 0x7f800000) == 0) output = 0.0f;

        filterstore = (output * damp2) + (filterstore * damp1);
        if (((*(unsigned int*)&filterstore) & 0x7f800000) == 0) filterstore = 0.0f;

        buffer[bufidx] = input + (filterstore * feedback);

        if (++bufidx >= bufsize)
                bufidx = 0;

        return output;
}



class allpass {
public:
        allpass();
        void setbuffer(float *buf, int size);
        inline float process(float inp);
        void mute();
        void setfeedback(float val);
        float getfeedback();
private:
        float feedback;
        float *buffer;
        int bufsize;
        int bufidx;
};




inline float allpass::process(float input) {
        float output;
        float bufout;

        bufout = buffer[bufidx];
        if (((*(unsigned int*)&bufout) & 0x7f800000) == 0) bufout = 0.0f;

        output = -input + bufout;
        buffer[bufidx] = input + (bufout * feedback);

        if (++bufidx >= bufsize)
                bufidx = 0;

        return output;
}




const int numcombs = 8;
const int numallpasses = 4;
const float muted = 0;
const float fixedgain = 0.015f;
const float scalewet = 3;
const float scaledry = 2;
const float scaledamp = 0.4f;
const float scaleroom = 0.28f;
const float offsetroom = 0.7f;
const float initialroom = 0.5f;
const float initialdamp = 0.5f;
const float initialwet = 1 / scalewet;
const float initialdry = 0;
const float initialwidth = 1;
const float initialmode = 0;
const float freezemode = 0.5f;
const int stereospread = 23;





const int combtuningL1 = 1116;
const int combtuningR1 = 1116 + stereospread;
const int combtuningL2 = 1188;
const int combtuningR2 = 1188 + stereospread;
const int combtuningL3 = 1277;
const int combtuningR3 = 1277 + stereospread;
const int combtuningL4 = 1356;
const int combtuningR4 = 1356 + stereospread;
const int combtuningL5 = 1422;
const int combtuningR5 = 1422 + stereospread;
const int combtuningL6 = 1491;
const int combtuningR6 = 1491 + stereospread;
const int combtuningL7 = 1557;
const int combtuningR7 = 1557 + stereospread;
const int combtuningL8 = 1617;
const int combtuningR8 = 1617 + stereospread;
const int allpasstuningL1 = 556;
const int allpasstuningR1 = 556 + stereospread;
const int allpasstuningL2 = 441;
const int allpasstuningR2 = 441 + stereospread;
const int allpasstuningL3 = 341;
const int allpasstuningR3 = 341 + stereospread;
const int allpasstuningL4 = 225;
const int allpasstuningR4 = 225 + stereospread;




class revmodel {
public:
        revmodel();
        void mute();
        void processmix(float *inputL, float *inputR, float *outputL, float *outputR, long numsamples, int skip);
        void processreplace(float *inputL, float *inputR, float *outputL, float *outputR, long numsamples, int skip);
        void setroomsize(float value);
        float getroomsize();
        void setdamp(float value);
        float getdamp();
        void setwet(float value);
        float getwet();
        void setdry(float value);
        float getdry();
        void setwidth(float value);
        float getwidth();
        void setmode(float value);
        float getmode();
private:
        void update();

        float gain;
        float roomsize, roomsize1;
        float damp, damp1;
        float wet, wet1, wet2;
        float dry;
        float width;
        float mode;






        comb combL[numcombs];
        comb combR[numcombs];


        allpass allpassL[numallpasses];
        allpass allpassR[numallpasses];


        float bufcombL1[combtuningL1];
        float bufcombR1[combtuningR1];
        float bufcombL2[combtuningL2];
        float bufcombR2[combtuningR2];
        float bufcombL3[combtuningL3];
        float bufcombR3[combtuningR3];
        float bufcombL4[combtuningL4];
        float bufcombR4[combtuningR4];
        float bufcombL5[combtuningL5];
        float bufcombR5[combtuningR5];
        float bufcombL6[combtuningL6];
        float bufcombR6[combtuningR6];
        float bufcombL7[combtuningL7];
        float bufcombR7[combtuningR7];
        float bufcombL8[combtuningL8];
        float bufcombR8[combtuningR8];


        float bufallpassL1[allpasstuningL1];
        float bufallpassR1[allpasstuningR1];
        float bufallpassL2[allpasstuningL2];
        float bufallpassR2[allpasstuningR2];
        float bufallpassL3[allpasstuningL3];
        float bufallpassR3[allpasstuningR3];
        float bufallpassL4[allpasstuningL4];
        float bufallpassR4[allpasstuningR4];
};
# 60 "backends/midi/mt32/mt32emu.h" 2

# 1 "backends/midi/mt32/structures.h" 1
# 25 "backends/midi/mt32/structures.h"
namespace MT32Emu {

const unsigned int MAX_SAMPLE_OUTPUT = 4096;







typedef unsigned long long Bit64u;
typedef signed long long Bit64s;


typedef unsigned int Bit32u;
typedef signed int Bit32s;
typedef unsigned short int Bit16u;
typedef signed short int Bit16s;
typedef unsigned char Bit8u;
typedef signed char Bit8s;
# 53 "backends/midi/mt32/structures.h"
#pragma pack(1)


struct TimbreParam {
        struct commonParam {
                char name[10];
                Bit8u pstruct12;
                Bit8u pstruct34;
                Bit8u pmute;
                Bit8u nosustain;
        } __attribute__((packed)) common;

        struct partialParam {
                struct wgParam {
                        Bit8u coarse;
                        Bit8u fine;
                        Bit8u keyfollow;
                        Bit8u bender;
                        Bit8u waveform;
                        Bit8u pcmwave;
                        Bit8u pulsewid;
                        Bit8u pwvelo;
                } __attribute__((packed)) wg;

                struct envParam {
                        Bit8u depth;
                        Bit8u sensitivity;
                        Bit8u timekeyfollow;
                        Bit8u time[4];
                        Bit8u level[5];
                } __attribute__((packed)) env;

                struct lfoParam {
                        Bit8u rate;
                        Bit8u depth;
                        Bit8u modsense;
                } __attribute__((packed)) lfo;

                struct tvfParam {
                        Bit8u cutoff;
                        Bit8u resonance;
                        Bit8u keyfollow;
                        Bit8u biaspoint;
                        Bit8u biaslevel;
                        Bit8u envdepth;
                        Bit8u envsense;
                        Bit8u envdkf;
                        Bit8u envtkf;
                        Bit8u envtime[5];
                        Bit8u envlevel[4];
                } __attribute__((packed)) tvf;

                struct tvaParam {
                        Bit8u level;
                        Bit8u velosens;
                        Bit8u biaspoint1;
                        Bit8u biaslevel1;
                        Bit8u biaspoint2;
                        Bit8u biaslevel2;
                        Bit8u envtkf;
                        Bit8u envvkf;
                        Bit8u envtime[5];
                        Bit8u envlevel[4];
                } __attribute__((packed)) tva;
        } __attribute__((packed)) partial[4];
} __attribute__((packed));

struct PatchParam {
        Bit8u timbreGroup;
        Bit8u timbreNum;
        Bit8u keyShift;
        Bit8u fineTune;
        Bit8u benderRange;
        Bit8u assignMode;
        Bit8u reverbSwitch;
        Bit8u dummy;
} __attribute__((packed));

struct MemParams {
        struct PatchTemp {
                PatchParam patch;
                Bit8u outlevel;
                Bit8u panpot;
                Bit8u dummyv[6];
        } __attribute__((packed)) patchSettings[8];

        struct RhythmTemp {
                Bit8u timbre;
                Bit8u outlevel;
                Bit8u panpot;
                Bit8u reverbSwitch;
        } __attribute__((packed)) rhythmSettings[86];

        TimbreParam __attribute__((packed)) timbreSettings[8];

        PatchParam __attribute__((packed)) patches[128];

        struct PaddedTimbre {
                TimbreParam timbre;
                Bit8u padding[10];
        } __attribute__((packed)) timbres[64 + 64 + 64 + 30];

        struct SystemArea {
                Bit8u masterTune;
                Bit8u reverbMode;
                Bit8u reverbTime;
                Bit8u reverbLevel;
                Bit8u reserveSettings[9];
                Bit8u chanAssign[9];
                Bit8u masterVol;
        } __attribute__((packed)) system;
};

struct MemBanks {
        Bit8u pTemp[8][sizeof(MemParams::PatchTemp)];
        Bit8u rTemp[86][sizeof(MemParams::RhythmTemp)];
        Bit8u tTemp[8][sizeof(TimbreParam)];
        Bit8u patchBank[128][sizeof(PatchParam)];
        Bit8u timbreBank[64 + 64 + 64 + 30][sizeof(MemParams::PaddedTimbre)];
        Bit8u systemBank[sizeof(MemParams::SystemArea)];



};




#pragma pack()


struct PCMWaveEntry {
        Bit32u addr;
        Bit32u len;
        double tune;
        bool loop;
};

struct soundaddr {
        Bit16u pcmplace;
        Bit16u pcmoffset;
};

struct StereoVolume {
        Bit16s leftvol;
        Bit16s rightvol;
};


struct PatchCache {
        bool playPartial;
        bool PCMPartial;
        int pcm;
        char waveform;
        int pulsewidth;
        int pwsens;

        float pitch;

        int lfodepth;
        int lforate;
        Bit32u lfoperiod;
        int modsense;

        float pitchKeyfollow;

        int filtkeyfollow;

        int tvfbias;
        int tvfblevel;
        int tvfdir;

        int ampbias[2];
        int ampblevel[2];
        int ampdir[2];

        int ampdepth;
        int ampenvdir;
        int amplevel;
        int tvfdepth;

        bool useBender;
        float benderRange;

        TimbreParam::partialParam::envParam pitchEnv;
        TimbreParam::partialParam::tvaParam ampEnv;
        TimbreParam::partialParam::tvfParam filtEnv;

        Bit32s ampsustain;
        Bit32s pitchsustain;
        Bit32s filtsustain;

        Bit32u structureMix;
        int structurePosition;
        int structurePair;


        bool dirty;
        Bit32u partialCount;
        bool sustain;
        float pitchShift;
        bool reverb;
        const StereoVolume *pansetptr;
};

class Partial;

struct dpoly {
        bool isPlaying;

        unsigned int key;
        int freqnum;
        int vel;

        bool isDecay;

        const Bit32u *volumeptr;

        Partial *partials[4];

        bool pedalhold;
        bool sustain;

        bool isActive() const;
        Bit32u getAge() const;
};

}
# 62 "backends/midi/mt32/mt32emu.h" 2
# 1 "backends/midi/mt32/i386.h" 1
# 25 "backends/midi/mt32/i386.h"
namespace MT32Emu {



bool DetectSIMD();

bool Detect3DNow();

float iir_filter_sse(float input,float *hist1_ptr, float *coef_ptr, int revLevel);
float iir_filter_3dnow(float input,float *hist1_ptr, float *coef_ptr, int revLevel);
float iir_filter_normal(float input,float *hist1_ptr, float *coef_ptr, int revLevel);


int i386_partialProductOutput(int len, Bit16s leftvol, Bit16s rightvol, Bit16s *partialBuf, Bit16s *mixedBuf);
int i386_mixBuffers(Bit16s * buf1, Bit16s *buf2, int len);
int i386_mixBuffersRingMix(Bit16s * buf1, Bit16s *buf2, int len);
int i386_mixBuffersRing(Bit16s * buf1, Bit16s *buf2, int len);
int i386_produceOutput1(Bit16s *useBuf, Bit16s *stream, Bit32u len, Bit16s volume);




}
# 63 "backends/midi/mt32/mt32emu.h" 2
# 1 "backends/midi/mt32/mt32_file.h" 1
# 25 "backends/midi/mt32/mt32_file.h"
# 1 "/usr/include/stdio.h" 1 3 4
# 28 "/usr/include/stdio.h" 3 4
# 1 "/usr/include/features.h" 1 3 4
# 308 "/usr/include/features.h" 3 4
# 1 "/usr/include/sys/cdefs.h" 1 3 4
# 309 "/usr/include/features.h" 2 3 4
# 331 "/usr/include/features.h" 3 4
# 1 "/usr/include/gnu/stubs.h" 1 3 4
# 332 "/usr/include/features.h" 2 3 4
# 29 "/usr/include/stdio.h" 2 3 4

extern "C" {



# 1 "/usr/lib/gcc-lib/i486-slackware-linux/3.3.5/include/stddef.h" 1 3 4
# 213 "/usr/lib/gcc-lib/i486-slackware-linux/3.3.5/include/stddef.h" 3 4
typedef unsigned int size_t;
# 35 "/usr/include/stdio.h" 2 3 4

# 1 "/usr/include/bits/types.h" 1 3 4
# 28 "/usr/include/bits/types.h" 3 4
# 1 "/usr/include/bits/wordsize.h" 1 3 4
# 29 "/usr/include/bits/types.h" 2 3 4


# 1 "/usr/lib/gcc-lib/i486-slackware-linux/3.3.5/include/stddef.h" 1 3 4
# 32 "/usr/include/bits/types.h" 2 3 4


typedef unsigned char __u_char;
typedef unsigned short int __u_short;
typedef unsigned int __u_int;
typedef unsigned long int __u_long;


typedef signed char __int8_t;
typedef unsigned char __uint8_t;
typedef signed short int __int16_t;
typedef unsigned short int __uint16_t;
typedef signed int __int32_t;
typedef unsigned int __uint32_t;




__extension__ typedef signed long long int __int64_t;
__extension__ typedef unsigned long long int __uint64_t;







__extension__ typedef long long int __quad_t;
__extension__ typedef unsigned long long int __u_quad_t;
# 129 "/usr/include/bits/types.h" 3 4
# 1 "/usr/include/bits/typesizes.h" 1 3 4
# 130 "/usr/include/bits/types.h" 2 3 4






__extension__ typedef __u_quad_t __dev_t;
__extension__ typedef unsigned int __uid_t;
__extension__ typedef unsigned int __gid_t;
__extension__ typedef unsigned long int __ino_t;
__extension__ typedef __u_quad_t __ino64_t;
__extension__ typedef unsigned int __mode_t;
__extension__ typedef unsigned int __nlink_t;
__extension__ typedef long int __off_t;
__extension__ typedef __quad_t __off64_t;
__extension__ typedef int __pid_t;
__extension__ typedef struct { int __val[2]; } __fsid_t;
__extension__ typedef long int __clock_t;
__extension__ typedef unsigned long int __rlim_t;
__extension__ typedef __u_quad_t __rlim64_t;
__extension__ typedef unsigned int __id_t;
__extension__ typedef long int __time_t;
__extension__ typedef unsigned int __useconds_t;
__extension__ typedef long int __suseconds_t;

__extension__ typedef int __daddr_t;
__extension__ typedef long int __swblk_t;
__extension__ typedef int __key_t;


__extension__ typedef int __clockid_t;


__extension__ typedef int __timer_t;


__extension__ typedef long int __blksize_t;




__extension__ typedef long int __blkcnt_t;
__extension__ typedef __quad_t __blkcnt64_t;


__extension__ typedef unsigned long int __fsblkcnt_t;
__extension__ typedef __u_quad_t __fsblkcnt64_t;


__extension__ typedef unsigned long int __fsfilcnt_t;
__extension__ typedef __u_quad_t __fsfilcnt64_t;

__extension__ typedef int __ssize_t;



typedef __off64_t __loff_t;
typedef __quad_t *__qaddr_t;
typedef char *__caddr_t;


__extension__ typedef int __intptr_t;


__extension__ typedef unsigned int __socklen_t;
# 37 "/usr/include/stdio.h" 2 3 4









typedef struct _IO_FILE FILE;





# 62 "/usr/include/stdio.h" 3 4
typedef struct _IO_FILE __FILE;
# 72 "/usr/include/stdio.h" 3 4
# 1 "/usr/include/libio.h" 1 3 4
# 32 "/usr/include/libio.h" 3 4
# 1 "/usr/include/_G_config.h" 1 3 4
# 14 "/usr/include/_G_config.h" 3 4
# 1 "/usr/lib/gcc-lib/i486-slackware-linux/3.3.5/include/stddef.h" 1 3 4
# 354 "/usr/lib/gcc-lib/i486-slackware-linux/3.3.5/include/stddef.h" 3 4
typedef unsigned int wint_t;
# 15 "/usr/include/_G_config.h" 2 3 4
# 24 "/usr/include/_G_config.h" 3 4
# 1 "/usr/include/wchar.h" 1 3 4
# 48 "/usr/include/wchar.h" 3 4
# 1 "/usr/lib/gcc-lib/i486-slackware-linux/3.3.5/include/stddef.h" 1 3 4
# 49 "/usr/include/wchar.h" 2 3 4

# 1 "/usr/include/bits/wchar.h" 1 3 4
# 51 "/usr/include/wchar.h" 2 3 4
# 76 "/usr/include/wchar.h" 3 4
typedef struct
{
  int __count;
  union
  {
    wint_t __wch;
    char __wchb[4];
  } __value;
} __mbstate_t;
# 25 "/usr/include/_G_config.h" 2 3 4

typedef struct
{
  __off_t __pos;
  __mbstate_t __state;
} _G_fpos_t;
typedef struct
{
  __off64_t __pos;
  __mbstate_t __state;
} _G_fpos64_t;
# 44 "/usr/include/_G_config.h" 3 4
# 1 "/usr/include/gconv.h" 1 3 4
# 28 "/usr/include/gconv.h" 3 4
# 1 "/usr/include/wchar.h" 1 3 4
# 48 "/usr/include/wchar.h" 3 4
# 1 "/usr/lib/gcc-lib/i486-slackware-linux/3.3.5/include/stddef.h" 1 3 4
# 49 "/usr/include/wchar.h" 2 3 4
# 29 "/usr/include/gconv.h" 2 3 4


# 1 "/usr/lib/gcc-lib/i486-slackware-linux/3.3.5/include/stddef.h" 1 3 4
# 32 "/usr/include/gconv.h" 2 3 4





enum
{
  __GCONV_OK = 0,
  __GCONV_NOCONV,
  __GCONV_NODB,
  __GCONV_NOMEM,

  __GCONV_EMPTY_INPUT,
  __GCONV_FULL_OUTPUT,
  __GCONV_ILLEGAL_INPUT,
  __GCONV_INCOMPLETE_INPUT,

  __GCONV_ILLEGAL_DESCRIPTOR,
  __GCONV_INTERNAL_ERROR
};



enum
{
  __GCONV_IS_LAST = 0x0001,
  __GCONV_IGNORE_ERRORS = 0x0002
};



struct __gconv_step;
struct __gconv_step_data;
struct __gconv_loaded_object;
struct __gconv_trans_data;



typedef int (*__gconv_fct) (struct __gconv_step *, struct __gconv_step_data *,
                            __const unsigned char **, __const unsigned char *,
                            unsigned char **, size_t *, int, int);


typedef wint_t (*__gconv_btowc_fct) (struct __gconv_step *, unsigned char);


typedef int (*__gconv_init_fct) (struct __gconv_step *);
typedef void (*__gconv_end_fct) (struct __gconv_step *);



typedef int (*__gconv_trans_fct) (struct __gconv_step *,
                                  struct __gconv_step_data *, void *,
                                  __const unsigned char *,
                                  __const unsigned char **,
                                  __const unsigned char *, unsigned char **,
                                  size_t *);


typedef int (*__gconv_trans_context_fct) (void *, __const unsigned char *,
                                          __const unsigned char *,
                                          unsigned char *, unsigned char *);


typedef int (*__gconv_trans_query_fct) (__const char *, __const char ***,
                                        size_t *);


typedef int (*__gconv_trans_init_fct) (void **, const char *);
typedef void (*__gconv_trans_end_fct) (void *);

struct __gconv_trans_data
{

  __gconv_trans_fct __trans_fct;
  __gconv_trans_context_fct __trans_context_fct;
  __gconv_trans_end_fct __trans_end_fct;
  void *__data;
  struct __gconv_trans_data *__next;
};



struct __gconv_step
{
  struct __gconv_loaded_object *__shlib_handle;
  __const char *__modname;

  int __counter;

  char *__from_name;
  char *__to_name;

  __gconv_fct __fct;
  __gconv_btowc_fct __btowc_fct;
  __gconv_init_fct __init_fct;
  __gconv_end_fct __end_fct;



  int __min_needed_from;
  int __max_needed_from;
  int __min_needed_to;
  int __max_needed_to;


  int __stateful;

  void *__data;
};



struct __gconv_step_data
{
  unsigned char *__outbuf;
  unsigned char *__outbufend;



  int __flags;



  int __invocation_counter;



  int __internal_use;

  __mbstate_t *__statep;
  __mbstate_t __state;



  struct __gconv_trans_data *__trans;
};



typedef struct __gconv_info
{
  size_t __nsteps;
  struct __gconv_step *__steps;
  __extension__ struct __gconv_step_data __data [];
} *__gconv_t;
# 45 "/usr/include/_G_config.h" 2 3 4
typedef union
{
  struct __gconv_info __cd;
  struct
  {
    struct __gconv_info __cd;
    struct __gconv_step_data __data;
  } __combined;
} _G_iconv_t;

typedef int _G_int16_t __attribute__ ((__mode__ (__HI__)));
typedef int _G_int32_t __attribute__ ((__mode__ (__SI__)));
typedef unsigned int _G_uint16_t __attribute__ ((__mode__ (__HI__)));
typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
# 33 "/usr/include/libio.h" 2 3 4
# 53 "/usr/include/libio.h" 3 4
# 1 "/usr/lib/gcc-lib/i486-slackware-linux/3.3.5/include/stdarg.h" 1 3 4
# 43 "/usr/lib/gcc-lib/i486-slackware-linux/3.3.5/include/stdarg.h" 3 4
typedef __builtin_va_list __gnuc_va_list;
# 54 "/usr/include/libio.h" 2 3 4
# 166 "/usr/include/libio.h" 3 4
struct _IO_jump_t; struct _IO_FILE;
# 176 "/usr/include/libio.h" 3 4
typedef void _IO_lock_t;





struct _IO_marker {
  struct _IO_marker *_next;
  struct _IO_FILE *_sbuf;



  int _pos;
# 199 "/usr/include/libio.h" 3 4
};


enum __codecvt_result
{
  __codecvt_ok,
  __codecvt_partial,
  __codecvt_error,
  __codecvt_noconv
};
# 267 "/usr/include/libio.h" 3 4
struct _IO_FILE {
  int _flags;




  char* _IO_read_ptr;
  char* _IO_read_end;
  char* _IO_read_base;
  char* _IO_write_base;
  char* _IO_write_ptr;
  char* _IO_write_end;
  char* _IO_buf_base;
  char* _IO_buf_end;

  char *_IO_save_base;
  char *_IO_backup_base;
  char *_IO_save_end;

  struct _IO_marker *_markers;

  struct _IO_FILE *_chain;

  int _fileno;



  int _flags2;

  __off_t _old_offset;



  unsigned short _cur_column;
  signed char _vtable_offset;
  char _shortbuf[1];



  _IO_lock_t *_lock;
# 315 "/usr/include/libio.h" 3 4
  __off64_t _offset;





  void *__pad1;
  void *__pad2;

  int _mode;

  char _unused2[15 * sizeof (int) - 2 * sizeof (void *)];

};





struct _IO_FILE_plus;

extern struct _IO_FILE_plus _IO_2_1_stdin_;
extern struct _IO_FILE_plus _IO_2_1_stdout_;
extern struct _IO_FILE_plus _IO_2_1_stderr_;
# 354 "/usr/include/libio.h" 3 4
typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes);







typedef __ssize_t __io_write_fn (void *__cookie, __const char *__buf,
                                 size_t __n);







typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w);


typedef int __io_close_fn (void *__cookie);




typedef __io_read_fn cookie_read_function_t;
typedef __io_write_fn cookie_write_function_t;
typedef __io_seek_fn cookie_seek_function_t;
typedef __io_close_fn cookie_close_function_t;


typedef struct
{
  __io_read_fn *read;
  __io_write_fn *write;
  __io_seek_fn *seek;
  __io_close_fn *close;
} _IO_cookie_io_functions_t;
typedef _IO_cookie_io_functions_t cookie_io_functions_t;

struct _IO_cookie_file;


extern void _IO_cookie_init (struct _IO_cookie_file *__cfile, int __read_write,
                             void *__cookie, _IO_cookie_io_functions_t __fns);




extern "C" {


extern int __underflow (_IO_FILE *) throw ();
extern int __uflow (_IO_FILE *) throw ();
extern int __overflow (_IO_FILE *, int) throw ();
extern wint_t __wunderflow (_IO_FILE *) throw ();
extern wint_t __wuflow (_IO_FILE *) throw ();
extern wint_t __woverflow (_IO_FILE *, wint_t) throw ();
# 444 "/usr/include/libio.h" 3 4
extern int _IO_getc (_IO_FILE *__fp) throw ();
extern int _IO_putc (int __c, _IO_FILE *__fp) throw ();
extern int _IO_feof (_IO_FILE *__fp) throw ();
extern int _IO_ferror (_IO_FILE *__fp) throw ();

extern int _IO_peekc_locked (_IO_FILE *__fp) throw ();





extern void _IO_flockfile (_IO_FILE *) throw ();
extern void _IO_funlockfile (_IO_FILE *) throw ();
extern int _IO_ftrylockfile (_IO_FILE *) throw ();
# 474 "/usr/include/libio.h" 3 4
extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict,
                        __gnuc_va_list, int *__restrict) throw ();
extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict,
                         __gnuc_va_list) throw ();
extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t) throw ();
extern size_t _IO_sgetn (_IO_FILE *, void *, size_t) throw ();

extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int) throw ();
extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int) throw ();

extern void _IO_free_backup_area (_IO_FILE *) throw ();
# 532 "/usr/include/libio.h" 3 4
}
# 73 "/usr/include/stdio.h" 2 3 4




typedef __gnuc_va_list va_list;
# 86 "/usr/include/stdio.h" 3 4


typedef _G_fpos_t fpos_t;





typedef _G_fpos64_t fpos64_t;
# 138 "/usr/include/stdio.h" 3 4
# 1 "/usr/include/bits/stdio_lim.h" 1 3 4
# 139 "/usr/include/stdio.h" 2 3 4



extern struct _IO_FILE *stdin;
extern struct _IO_FILE *stdout;
extern struct _IO_FILE *stderr;







extern int remove (__const char *__filename) throw ();

extern int rename (__const char *__old, __const char *__new) throw ();









extern FILE *tmpfile (void);
# 174 "/usr/include/stdio.h" 3 4
extern FILE *tmpfile64 (void);



extern char *tmpnam (char *__s) throw ();





extern char *tmpnam_r (char *__s) throw ();
# 196 "/usr/include/stdio.h" 3 4
extern char *tempnam (__const char *__dir, __const char *__pfx)
     throw () __attribute__ ((__malloc__));








extern int fclose (FILE *__stream);




extern int fflush (FILE *__stream);

# 221 "/usr/include/stdio.h" 3 4
extern int fflush_unlocked (FILE *__stream);
# 231 "/usr/include/stdio.h" 3 4
extern int fcloseall (void);









extern FILE *fopen (__const char *__restrict __filename,
                    __const char *__restrict __modes);




extern FILE *freopen (__const char *__restrict __filename,
                      __const char *__restrict __modes,
                      FILE *__restrict __stream);
# 262 "/usr/include/stdio.h" 3 4


extern FILE *fopen64 (__const char *__restrict __filename,
                      __const char *__restrict __modes);
extern FILE *freopen64 (__const char *__restrict __filename,
                        __const char *__restrict __modes,
                        FILE *__restrict __stream);




extern FILE *fdopen (int __fd, __const char *__modes) throw ();





extern FILE *fopencookie (void *__restrict __magic_cookie,
                          __const char *__restrict __modes,
                          _IO_cookie_io_functions_t __io_funcs) throw ();


extern FILE *fmemopen (void *__s, size_t __len, __const char *__modes) throw ();




extern FILE *open_memstream (char **__restrict __bufloc,
                             size_t *__restrict __sizeloc) throw ();






extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) throw ();



extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,
                    int __modes, size_t __n) throw ();





extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
                       size_t __size) throw ();


extern void setlinebuf (FILE *__stream) throw ();








extern int fprintf (FILE *__restrict __stream,
                    __const char *__restrict __format, ...);




extern int printf (__const char *__restrict __format, ...);

extern int sprintf (char *__restrict __s,
                    __const char *__restrict __format, ...) throw ();





extern int vfprintf (FILE *__restrict __s, __const char *__restrict __format,
                     __gnuc_va_list __arg);




extern int vprintf (__const char *__restrict __format, __gnuc_va_list __arg);

extern int vsprintf (char *__restrict __s, __const char *__restrict __format,
                     __gnuc_va_list __arg) throw ();





extern int snprintf (char *__restrict __s, size_t __maxlen,
                     __const char *__restrict __format, ...)
     throw () __attribute__ ((__format__ (__printf__, 3, 4)));

extern int vsnprintf (char *__restrict __s, size_t __maxlen,
                      __const char *__restrict __format, __gnuc_va_list __arg)
     throw () __attribute__ ((__format__ (__printf__, 3, 0)));






extern int vasprintf (char **__restrict __ptr, __const char *__restrict __f,
                      __gnuc_va_list __arg)
     throw () __attribute__ ((__format__ (__printf__, 2, 0)));
extern int __asprintf (char **__restrict __ptr,
                       __const char *__restrict __fmt, ...)
     throw () __attribute__ ((__format__ (__printf__, 2, 3)));
extern int asprintf (char **__restrict __ptr,
                     __const char *__restrict __fmt, ...)
     throw () __attribute__ ((__format__ (__printf__, 2, 3)));







extern int vdprintf (int __fd, __const char *__restrict __fmt,
                     __gnuc_va_list __arg)
     __attribute__ ((__format__ (__printf__, 2, 0)));
extern int dprintf (int __fd, __const char *__restrict __fmt, ...)
     __attribute__ ((__format__ (__printf__, 2, 3)));








extern int fscanf (FILE *__restrict __stream,
                   __const char *__restrict __format, ...);




extern int scanf (__const char *__restrict __format, ...);

extern int sscanf (__const char *__restrict __s,
                   __const char *__restrict __format, ...) throw ();








extern int vfscanf (FILE *__restrict __s, __const char *__restrict __format,
                    __gnuc_va_list __arg)
     __attribute__ ((__format__ (__scanf__, 2, 0)));





extern int vscanf (__const char *__restrict __format, __gnuc_va_list __arg)
     __attribute__ ((__format__ (__scanf__, 1, 0)));


extern int vsscanf (__const char *__restrict __s,
                    __const char *__restrict __format, __gnuc_va_list __arg)
     throw () __attribute__ ((__format__ (__scanf__, 2, 0)));









extern int fgetc (FILE *__stream);
extern int getc (FILE *__stream);





extern int getchar (void);

# 454 "/usr/include/stdio.h" 3 4
extern int getc_unlocked (FILE *__stream);
extern int getchar_unlocked (void);
# 465 "/usr/include/stdio.h" 3 4
extern int fgetc_unlocked (FILE *__stream);











extern int fputc (int __c, FILE *__stream);
extern int putc (int __c, FILE *__stream);





extern int putchar (int __c);

# 498 "/usr/include/stdio.h" 3 4
extern int fputc_unlocked (int __c, FILE *__stream);







extern int putc_unlocked (int __c, FILE *__stream);
extern int putchar_unlocked (int __c);






extern int getw (FILE *__stream);


extern int putw (int __w, FILE *__stream);








extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream);






extern char *gets (char *__s);

# 543 "/usr/include/stdio.h" 3 4
extern char *fgets_unlocked (char *__restrict __s, int __n,
                             FILE *__restrict __stream);
# 559 "/usr/include/stdio.h" 3 4
extern __ssize_t __getdelim (char **__restrict __lineptr,
                               size_t *__restrict __n, int __delimiter,
                               FILE *__restrict __stream);
extern __ssize_t getdelim (char **__restrict __lineptr,
                             size_t *__restrict __n, int __delimiter,
                             FILE *__restrict __stream);







extern __ssize_t getline (char **__restrict __lineptr,
                            size_t *__restrict __n,
                            FILE *__restrict __stream);








extern int fputs (__const char *__restrict __s, FILE *__restrict __stream);





extern int puts (__const char *__s);






extern int ungetc (int __c, FILE *__stream);






extern size_t fread (void *__restrict __ptr, size_t __size,
                     size_t __n, FILE *__restrict __stream);




extern size_t fwrite (__const void *__restrict __ptr, size_t __size,
                      size_t __n, FILE *__restrict __s);

# 620 "/usr/include/stdio.h" 3 4
extern int fputs_unlocked (__const char *__restrict __s,
                           FILE *__restrict __stream);
# 631 "/usr/include/stdio.h" 3 4
extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
                              size_t __n, FILE *__restrict __stream);
extern size_t fwrite_unlocked (__const void *__restrict __ptr, size_t __size,
                               size_t __n, FILE *__restrict __stream);








extern int fseek (FILE *__stream, long int __off, int __whence);




extern long int ftell (FILE *__stream);




extern void rewind (FILE *__stream);

# 667 "/usr/include/stdio.h" 3 4
extern int fseeko (FILE *__stream, __off_t __off, int __whence);




extern __off_t ftello (FILE *__stream);
# 686 "/usr/include/stdio.h" 3 4






extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos);




extern int fsetpos (FILE *__stream, __const fpos_t *__pos);
# 709 "/usr/include/stdio.h" 3 4



extern int fseeko64 (FILE *__stream, __off64_t __off, int __whence);
extern __off64_t ftello64 (FILE *__stream);
extern int fgetpos64 (FILE *__restrict __stream, fpos64_t *__restrict __pos);
extern int fsetpos64 (FILE *__stream, __const fpos64_t *__pos);




extern void clearerr (FILE *__stream) throw ();

extern int feof (FILE *__stream) throw ();

extern int ferror (FILE *__stream) throw ();




extern void clearerr_unlocked (FILE *__stream) throw ();
extern int feof_unlocked (FILE *__stream) throw ();
extern int ferror_unlocked (FILE *__stream) throw ();








extern void perror (__const char *__s);






# 1 "/usr/include/bits/sys_errlist.h" 1 3 4
# 27 "/usr/include/bits/sys_errlist.h" 3 4
extern int sys_nerr;
extern __const char *__const sys_errlist[];


extern int _sys_nerr;
extern __const char *__const _sys_errlist[];
# 748 "/usr/include/stdio.h" 2 3 4




extern int fileno (FILE *__stream) throw ();




extern int fileno_unlocked (FILE *__stream) throw ();
# 767 "/usr/include/stdio.h" 3 4
extern FILE *popen (__const char *__command, __const char *__modes);





extern int pclose (FILE *__stream);





extern char *ctermid (char *__s) throw ();





extern char *cuserid (char *__s);




struct obstack;


extern int obstack_printf (struct obstack *__restrict __obstack,
                           __const char *__restrict __format, ...)
     throw () __attribute__ ((__format__ (__printf__, 2, 3)));
extern int obstack_vprintf (struct obstack *__restrict __obstack,
                            __const char *__restrict __format,
                            __gnuc_va_list __args)
     throw () __attribute__ ((__format__ (__printf__, 2, 0)));







extern void flockfile (FILE *__stream) throw ();



extern int ftrylockfile (FILE *__stream) throw ();


extern void funlockfile (FILE *__stream) throw ();
# 828 "/usr/include/stdio.h" 3 4
# 1 "/usr/include/bits/stdio.h" 1 3 4
# 33 "/usr/include/bits/stdio.h" 3 4
inline int
vprintf (__const char *__restrict __fmt, __gnuc_va_list __arg)
{
  return vfprintf (stdout, __fmt, __arg);
}


inline int
getchar (void)
{
  return _IO_getc (stdin);
}




inline int
getc_unlocked (FILE *__fp)
{
  return (__builtin_expect ((__fp)->_IO_read_ptr >= (__fp)->_IO_read_end, 0) ? __uflow (__fp) : *(unsigned char *) (__fp)->_IO_read_ptr++);
}


inline int
getchar_unlocked (void)
{
  return (__builtin_expect ((stdin)->_IO_read_ptr >= (stdin)->_IO_read_end, 0) ? __uflow (stdin) : *(unsigned char *) (stdin)->_IO_read_ptr++);
}




inline int
putchar (int __c)
{
  return _IO_putc (__c, stdout);
}




inline int
fputc_unlocked (int __c, FILE *__stream)
{
  return (__builtin_expect ((__stream)->_IO_write_ptr >= (__stream)->_IO_write_end, 0) ? __overflow (__stream, (unsigned char) (__c)) : (unsigned char) (*(__stream)->_IO_write_ptr++ = (__c)));
}





inline int
putc_unlocked (int __c, FILE *__stream)
{
  return (__builtin_expect ((__stream)->_IO_write_ptr >= (__stream)->_IO_write_end, 0) ? __overflow (__stream, (unsigned char) (__c)) : (unsigned char) (*(__stream)->_IO_write_ptr++ = (__c)));
}


inline int
putchar_unlocked (int __c)
{
  return (__builtin_expect ((stdout)->_IO_write_ptr >= (stdout)->_IO_write_end, 0) ? __overflow (stdout, (unsigned char) (__c)) : (unsigned char) (*(stdout)->_IO_write_ptr++ = (__c)));
}





inline __ssize_t
getline (char **__lineptr, size_t *__n, FILE *__stream)
{
  return __getdelim (__lineptr, __n, '\n', __stream);
}





inline int
feof_unlocked (FILE *__stream) throw ()
{
  return (((__stream)->_flags & 0x10) != 0);
}


inline int
ferror_unlocked (FILE *__stream) throw ()
{
  return (((__stream)->_flags & 0x20) != 0);
}
# 829 "/usr/include/stdio.h" 2 3 4





}
# 26 "backends/midi/mt32/mt32_file.h" 2

namespace MT32Emu {

class File {
public:
        enum OpenMode {
                OpenMode_read = 0,
                OpenMode_write = 1
        };
        virtual ~File() {}
        virtual void close() = 0;
        virtual size_t read(void *in, size_t size) = 0;
        virtual bool readLine(char *in, size_t size) = 0;
        virtual bool readBit8u(Bit8u *in) = 0;
        virtual bool readBit16u(Bit16u *in);
        virtual bool readBit32u(Bit32u *in);
        virtual size_t write(const void *out, size_t size) = 0;
        virtual bool writeBit8u(Bit8u out) = 0;

        virtual bool writeBit16u(Bit16u out);

        virtual bool writeBit32u(Bit32u out);
        virtual bool isEOF() = 0;
};

class ANSIFile: public File {
private:
        FILE *fp;
public:
        bool open(const char *filename, OpenMode mode);
        void close();
        size_t read(void *in, size_t size);
        bool readLine(char *in, size_t size);
        bool readBit8u(Bit8u *in);
        size_t write(const void *out, size_t size);
        bool writeBit8u(unsigned char out);
        bool isEOF();
};

}
# 64 "backends/midi/mt32/mt32emu.h" 2
# 1 "backends/midi/mt32/tables.h" 1
# 25 "backends/midi/mt32/tables.h"
namespace MT32Emu {


const double DOUBLE_PI = 3.1415926535897932384626433832795;
const double DOUBLE_LN = 2.3025850929940456840179914546844;
const float FLOAT_PI = 3.1415926535897932384626433832795f;
const float FLOAT_LN = 2.3025850929940456840179914546844f;


const int FILTERGRAN = 512;

const int MIDDLEC = 60;
const int MIDDLEA = 69;





const int LOWEST_NOTE = 12;
const int HIGHEST_NOTE = 127;
const int NUM_NOTES = HIGHEST_NOTE - LOWEST_NOTE + 1;


const int WGAMP = 7168;

class Synth;

extern Bit16s smallnoise[MAX_SAMPLE_OUTPUT];


extern Bit32s keytable[217];
extern Bit16s sintable[65536];
extern Bit32u lfotable[101];
extern Bit32s penvtable[16][101];
extern Bit32s filveltable[128][101];
extern Bit32s veltkeytable[5][128];
extern Bit32s pulsetable[101];
extern Bit32s ampbiastable[13][128];
extern Bit32s fbiastable[15][128];
extern float filtcoeff[FILTERGRAN][31][8];
extern Bit32s finetable[201];
extern Bit32u lfoptable[101][101];
extern Bit32s ampveltable[128][64];
extern Bit32s pwveltable[15][128];
extern Bit32s envtimetable[101];
extern Bit32s decaytimetable[101];
extern Bit32s lasttimetable[101];
extern Bit32s voltable[128];
extern float ResonInv[31];

struct NoteLookup {
        Bit32u div;
        Bit32u wavTable[128];
        Bit32s sawTable[101];
        Bit32s fildepTable[5];
        Bit32s timekeyTable[5];
        int filtTable[2][201];
        int nfiltTable[101][101];
        Bit16s *waveforms[3];
        Bit32u waveformSize[3];
};

extern NoteLookup noteLookups[NUM_NOTES];

class TableInitialiser {
        static void initMT32ConstantTables(Synth *synth);
        static File *initWave(Synth *synth, NoteLookup *noteLookup, float ampsize, float div, File *file);
        static bool initNotes(Synth *synth, PCMWaveEntry pcmWaves[128], float rate, float tuning);
public:
        static bool initMT32Tables(Synth *synth, PCMWaveEntry pcmWaves[128], float sampleRate, float masterTune);
        static File *initNote(Synth *synth, NoteLookup *noteLookup, float note, float rate, float tuning, PCMWaveEntry pcmWaves[128], File *file);
        static void freeNotes();
};

}
# 65 "backends/midi/mt32/mt32emu.h" 2
# 1 "backends/midi/mt32/partial.h" 1
# 25 "backends/midi/mt32/partial.h"
namespace MT32Emu {

class Synth;
struct NoteLookup;

enum EnvelopeType {
        EnvelopeType_amp = 0,
        EnvelopeType_filt = 1,
        EnvelopeType_pitch = 2
};

struct EnvelopeStatus {
        Bit32s envpos;
        Bit32s envstat;
        Bit32s envbase;
        Bit32s envdist;
        Bit32s envsize;

        bool sustaining;
        bool decaying;
        Bit32s prevlevel;

        Bit32s counter;
        Bit32s count;
};


class Partial {
private:
        Synth *synth;

        int ownerPart;
        int mixType;
        int structurePosition;
        bool useNoisePair;

        Bit16s myBuffer[MAX_SAMPLE_OUTPUT];

        bool play;






        int noteVal;
        int fineShift;

        const NoteLookup *noteLookup;


        int realVal;
        int filtVal;

        EnvelopeStatus envs[3];

        int pulsewidth;

        Bit32u lfoPos;
        soundaddr partialOff;

        Bit32u ampEnvVal;
        Bit32u pitchEnvVal;

        float history[32];

        bool pitchSustain;

        int loopPos;

        dpoly *poly;

        int bendShift;

        Bit16s *mixBuffers(Bit16s *buf1, Bit16s *buf2, int len);
        Bit16s *mixBuffersRingMix(Bit16s *buf1, Bit16s *buf2, int len);
        Bit16s *mixBuffersRing(Bit16s *buf1, Bit16s *buf2, int len);
        void mixBuffersStereo(Bit16s *buf1, Bit16s *buf2, Bit16s *outBuf, int len);

        Bit32s getFiltEnvelope();
        Bit32u getAmpEnvelope();
        Bit32s getPitchEnvelope();

        void initKeyFollow(int freqNum);

public:
        const PatchCache *patchCache;
        PatchCache cachebackup;

        Partial *pair;
        bool alreadyOutputed;
        Bit32u age;

        Partial(Synth *synth);
        ~Partial();

        int getOwnerPart();
        bool isActive();
        void activate(int part);
        void deactivate(void);
        void startPartial(dpoly *usePoly, const PatchCache *useCache, Partial *pairPartial);
        void startDecay(EnvelopeType envnum, Bit32s startval);
        void startDecayAll();
        void setBend(float factor);
        bool shouldReverb();




        bool produceOutput(Bit16s * partialBuf, long length);


        Bit16s *generateSamples(long length);
};

}
# 66 "backends/midi/mt32/mt32emu.h" 2
# 1 "backends/midi/mt32/partialManager.h" 1
# 25 "backends/midi/mt32/partialManager.h"
namespace MT32Emu {

class Synth;

class PartialManager {
private:
        Synth *synth;

        Partial *partialTable[32];
        Bit32s partialReserveTable[32];
        Bit32s partialPart[9];

public:
        PartialManager(Synth *synth);
        ~PartialManager();
        Partial *allocPartial(int partNum);
        unsigned int getFreePartialCount(void);
        bool freePartials(unsigned int needed, int partNum);
        unsigned int setReserve(Bit8u *rset);
        void deactivateAll();
        void ageAll();
        bool produceOutput(int i, Bit16s *buffer, Bit32u bufferLength);
        bool shouldReverb(int i);
        void clearAlreadyOutputed();
        void getPerPartPartialUsage(int usage[9]);
};

}
# 67 "backends/midi/mt32/mt32emu.h" 2
# 1 "backends/midi/mt32/part.h" 1
# 25 "backends/midi/mt32/part.h"
namespace MT32Emu {

class PartialManager;
class Synth;

class Part {
private:

        MemParams::PatchTemp *patchTemp;
        TimbreParam *timbreTemp;


        unsigned int partNum;

        bool holdpedal;

        StereoVolume volumesetting;

        PatchCache patchCache[4];

        float bend;

        dpoly polyTable[32];

        void abortPoly(dpoly *poly);

        static int fixKeyfollow(int srckey);
        static int fixBiaslevel(int srcpnt, int *dir);

        void setPatch(const PatchParam *patch);

protected:
        Synth *synth;
        char name[8];
        char currentInstr[11];
        Bit32u volume;
        void backupCacheToPartials(PatchCache cache[4]);
        void cacheTimbre(PatchCache cache[4], const TimbreParam *timbre);
        void playPoly(const PatchCache cache[4], unsigned int key, int freqNum, int vel);
        const char *getName() const;

public:
        Part(Synth *synth, unsigned int usePartNum);
        virtual void playNote(unsigned int key, int vel);
        void stopNote(unsigned int key);
        void allStop();
        void setVolume(int vol);
        virtual void setPan(unsigned int midiPan);
        virtual void setBend(unsigned int midiBend);
        virtual void setModulation(unsigned int midiModulation);
        virtual void setProgram(unsigned int patchNum);
        void setHoldPedal(bool pedalval);
        void stopPedalHold();
        virtual void refresh();
        virtual void refreshTimbre(unsigned int absTimbreNum);
        void setTimbre(TimbreParam *timbre);
        virtual unsigned int getAbsTimbreNum() const;
};

class RhythmPart: public Part {

        const MemParams::RhythmTemp *rhythmTemp;


        PatchCache drumCache[64][4];
        StereoVolume drumPan[64];
public:
        RhythmPart(Synth *synth, unsigned int usePartNum);
        void refreshTimbre(unsigned int timbreNum);
        void refresh();
        void playNote(unsigned int key, int vel);
        unsigned int getAbsTimbreNum() const;
        void setPan(unsigned int midiPan);
        void setBend(unsigned int midiBend);
        void setModulation(unsigned int midiModulation);
        void setProgram(unsigned int patchNum);
};

}
# 68 "backends/midi/mt32/mt32emu.h" 2
# 1 "backends/midi/mt32/synth.h" 1
# 25 "backends/midi/mt32/synth.h"
# 1 "/usr/lib/gcc-lib/i486-slackware-linux/3.3.5/include/stdarg.h" 1 3 4
# 26 "backends/midi/mt32/synth.h" 2

class revmodel;

namespace MT32Emu {

const int ROMSIZE = 512 * 1024;
const int PCMSIZE = ROMSIZE / 2;
const int GRAN = 512;

class File;
class TableInitialiser;
class Partial;
class PartialManager;
class Part;

enum ReportType {

        ReportType_errorControlROM = 1,
        ReportType_errorPCMROM,
        ReportType_errorSampleRate,


        ReportType_progressInit,


        ReportType_availableSSE,
        ReportType_available3DNow,
        ReportType_usingSSE,
        ReportType_using3DNow,


        ReportType_lcdMessage,
        ReportType_devReset,
        ReportType_devReconfig,
        ReportType_newReverbMode,
        ReportType_newReverbTime,
        ReportType_newReverbLevel
};

struct SynthProperties {

        int sampleRate;


        bool useReverb;


        bool useDefaultReverb;


        unsigned char reverbType;

        unsigned char reverbTime;

        unsigned char reverbLevel;


        char *baseDir;

        void *userData;

        int (*report)(void *userData, ReportType type, const void *reportData);

        void (*printDebug)(void *userData, const char *fmt, va_list list);


        File *(*openFile)(void *userData, const char *filename, File::OpenMode mode);

        void (*closeFile)(void *userData, File *file);
};



typedef void (*recalcStatusCallback)(int percDone);





bool RecalcWaveforms(char * baseDir, int sampRate, recalcStatusCallback callBack);

typedef float (*iir_filter_type)(float input,float *hist1_ptr, float *coef_ptr, int revLevel);

class Synth {
friend class Part;
friend class RhythmPart;
friend class Partial;
friend class TableInitialiser;
private:
        bool isEnabled;

        iir_filter_type iirFilter;

        PCMWaveEntry PCMList[128];

        Bit8u controlROMData[64 * 1024];
        Bit16s romfile[PCMSIZE + GRAN];
        Bit8s chantable[32];





        MemParams mt32ram, mt32default;

        revmodel *reverbModel;

        float masterTune;
        Bit16u masterVolume;

        bool isOpen;

        PartialManager *partialManager;
        Part *parts[9];

        Bit16s tmpBuffer[MAX_SAMPLE_OUTPUT * 2];
        float sndbufl[MAX_SAMPLE_OUTPUT];
        float sndbufr[MAX_SAMPLE_OUTPUT];
        float outbufl[MAX_SAMPLE_OUTPUT];
        float outbufr[MAX_SAMPLE_OUTPUT];

        SynthProperties myProp;

        bool loadPreset(File *file);
        void initReverb(Bit8u newRevMode, Bit8u newRevTime, Bit8u newRevLevel);
        void doRender(Bit16s * stream, Bit32u len);
        void playMsgOnPart(unsigned char part, unsigned char code, unsigned char note, unsigned char velocity);
        void playSysexWithoutHeader(unsigned char channel, const Bit8u *sysex, Bit32u len);

        bool loadControlROM(const char *filename);
        bool loadPCMROM(const char *filename);
        bool dumpTimbre(File *file, const TimbreParam *timbre, Bit32u addr);
        int dumpTimbres(const char *filename, int start, int len);

        void initPCMList();
        void initRhythmTimbres();
        void initTimbres(Bit16u mapAddress, int startTimbre);
        void initRhythmTimbre(int drumNum, const Bit8u *mem);
        bool refreshSystem();
protected:
        int report(ReportType type, const void *reportData);
        File *openFile(const char *filename, File::OpenMode mode);
        void closeFile(File *file);
        void printDebug(const char *fmt, ...);

public:
        static Bit8u calcSysexChecksum(const Bit8u *data, Bit32u len, Bit8u checksum);

        Synth();
        ~Synth();



        bool open(SynthProperties &useProp);


        void close(void);


        void playMsg(Bit32u msg);



        void playSysex(const Bit8u *sysex, Bit32u len);
        void playSysexWithoutFraming(const Bit8u *sysex, Bit32u len);




        void render(Bit16s * stream, Bit32u len);
};

}
# 69 "backends/midi/mt32/mt32emu.h" 2
# 23 "backends/midi/mt32/i386.cpp" 2



namespace MT32Emu {






static inline bool atti386_DetectCPUID() {
        unsigned int result;


        result = (1 << 21);
        __asm__ __volatile__("pushfl \n popfl \n" : : "a"(result));
        if (!(result & (1 << 21)))
                return false;

        result = 0;
        __asm__ __volatile__("pushfl \n popfl \n" : : "a"(result));
        if (result & (1 << 21))
                return false;

        return true;
}

static inline bool atti386_DetectSIMD() {
        unsigned int result;

        if (atti386_DetectCPUID() == false)
                return false;


        __asm__ __volatile__(
                "movl   $1, %%eax        \n" "cpuid                   \n" "movl   %%edx, %0        \n" : "=r"(result) : : "eax", "ebx", "ecx", "edx");




        if (result & (1 << 25))
                return true;

        return false;
}

static inline bool atti386_Detect3DNow() {
        unsigned int result;

        if (atti386_DetectCPUID() == false)
                return false;


        __asm__ __volatile__(
                "movl   $0x80000001, %%eax \n" "cpuid                     \n" "movl   %%edx, %0          \n" : "=r"(result) : : "eax", "ebx", "ecx", "edx");




        if (result & 0x80000000)
                return true;

        return false;
}


static inline float atti386_iir_filter_sse(float *output, float *hist1_ptr, float *coef_ptr) {
        __asm__ __volatile__ (
                "pushl  %1                      \n" "pushl  %2                      \n" "movss  0(%0), %%xmm1           \n" "movups 0(%1), %%xmm2           \n" "movlps 0(%2), %%xmm3           \n" "                               \n" "shufps $0x44, %%xmm3, %%xmm3   \n" "                               \n" "mulps  %%xmm3, %%xmm2          \n" "                               \n" "subss  %%xmm2, %%xmm1          \n" "shufps $0x39,  %%xmm2, %%xmm2  \n" "subss  %%xmm2, %%xmm1          \n" "                               \n" "movss  %%xmm1, 0(%2)           \n" "                               \n" "shufps $0x39,  %%xmm2, %%xmm2  \n" "addss  %%xmm2, %%xmm1          \n" "                               \n" "shufps $0x39,  %%xmm2, %%xmm2  \n" "addss  %%xmm2, %%xmm1          \n" "                               \n" "movss  %%xmm3, 4(%2)           \n" "                               \n" "addl   $16, %1                 \n" "addl   $8, %2                  \n" "                               \n" "!
 movups 0(%1), %%xmm2           \n" "                               \n" "movlps 0(%2), %%xmm3           \n" "shufps $0x44, %%xmm3, %%xmm3   \n" "                               \n" "mulps %%xmm3, %%xmm2           \n" "                               \n" "subss  %%xmm2, %%xmm1          \n" "shufps $0x39,  %%xmm2, %%xmm2  \n" "subss  %%xmm2, %%xmm1          \n" "                               \n" "movss %%xmm1, 0(%2)            \n" "                               \n" "shufps $0x39, %%xmm2, %%xmm2   \n" "addss %%xmm2, %%xmm1           \n" "                               \n" "shufps $0x39, %%xmm2, %%xmm2   \n" "addss %%xmm2, %%xmm1           \n" "                               \n" "movss %%xmm3, 4(%2)            \n" "movss %%xmm1, 0(%0)            \n" "popl %2                        \n" "popl %1                        \n" : : "r"(output), "r"(coef_ptr), "r"(hist1_ptr)
# 142 "backends/midi/mt32/i386.cpp"
                : "xmm1", "xmm2", "xmm3", "memory");

        return *output;
}

static inline float atti386_iir_filter_3DNow(float output, float *hist1_ptr, float *coef_ptr) {
        float tmp;

        __asm__ __volatile__ (
                "movq %0, %%mm1       \n" "                     \n" "movl  %1, %%ebx      \n" "movq 0(%%ebx), %%mm2 \n" "                     \n" "movl %2, %%eax;      \n" "movq 0(%%eax), %%mm3 \n" "                     \n" "pfmul %%mm3, %%mm2   \n" "pfsub %%mm2, %%mm1   \n" "                     \n" "psrlq $32, %%mm2     \n" "pfsub %%mm2, %%mm1   \n" "                     \n" "movd %%mm1, %3       \n" "                     \n" "addl  $8, %%ebx      \n" "movq 0(%%ebx), %%mm2 \n" "movq 0(%%eax), %%mm3 \n" "                     \n" "pfmul %%mm3, %%mm2   \n" "pfadd %%mm2, %%mm1   \n" "                     \n" "psrlq $32, %%mm2     \n" "pfadd %%mm2, %%mm1   \n" "                     \n" "pushl %3             \n" "popl 0(%%eax)        \n" "                     \n" "movd %%mm3, 4(%%eax) \n" "                     \n" "addl $8, %%ebx       \n" "addl $8, %%eax       \n" "                     \n" "movq 0(%%ebx), %%mm2 \n" "movq 0(%%eax), %%mm3 \n" "                     \n" "pfmul %%mm!
 3, %%mm2   \n" "pfsub %%mm2, %%mm1   \n" "                     \n" "psrlq $32, %%mm2     \n" "pfsub %%mm2, %%mm1   \n" "                     \n" "movd %%mm1, %3       \n" "                     \n" "addl $8, %%ebx       \n" "movq 0(%%ebx), %%mm2 \n" "movq 0(%%eax), %%mm3 \n" "                     \n" "pfmul %%mm3, %%mm2   \n" "pfadd %%mm2, %%mm1   \n" "                     \n" "psrlq $32, %%mm2     \n" "pfadd %%mm2, %%mm1   \n" "                     \n" "pushl %3             \n" "popl 0(%%eax)        \n" "movd %%mm3, 4(%%eax) \n" "                     \n" "movd %%mm1, %0       \n" "femms                \n" : "=m"(output) : "g"(coef_ptr), "g"(hist1_ptr), "m"(tmp)
# 213 "backends/midi/mt32/i386.cpp"
                : "eax", "ebx", "mm1", "mm2", "mm3", "memory");

        return output;
}

static inline void atti386_produceOutput1(int tmplen, Bit16s myvolume, Bit16s *useBuf, Bit16s *snd) {
        __asm__ __volatile__(
                "movl %0,  %%ecx      \n" "movw %1,  %%ax       \n" "shll $16, %%eax      \n" "movw %1,  %%ax       \n" "movd %%eax, %%mm3    \n" "movd %%eax, %%mm2    \n" "psllq $32, %%mm3     \n" "por %%mm2, %%mm3     \n" "movl %2, %%esi       \n" "movl %3, %%edi       \n" "1:                   \n" "movq 0(%%esi), %%mm1 \n" "movq 0(%%edi), %%mm2 \n" "pmulhw %%mm3, %%mm1  \n" "paddw %%mm2, %%mm1   \n" "movq %%mm1, 0(%%edi) \n" "                     \n" "addl $8, %%esi       \n" "addl $8, %%edi       \n" "                     \n" "decl %%ecx           \n" "cmpl $0, %%ecx       \n" "jg   1b              \n" "emms                 \n" : : "g"(tmplen), "g"(myvolume), "g"(useBuf), "g"(snd)
# 245 "backends/midi/mt32/i386.cpp"
                : "eax", "ecx", "edi", "esi", "mm1", "mm2", "mm3", "memory");
}

static inline void atti386_produceOutput2(Bit32u len, Bit16s *snd, float *sndbufl, float *sndbufr, float *multFactor) {
        __asm__ __volatile__(
                "movl  %4, %%ecx         \n" "shrl  $1, %%ecx         \n" "addl  $4, %%ecx         \n" "pushl %%ecx             \n" "                        \n" "movl %0, %%esi          \n" "movups 0(%%esi), %%xmm1 \n" "                        \n" "movl %1, %%esi          \n" "movl %2, %%edi          \n" "1:                      \n" "xorl %%eax, %%eax       \n" "movw 0(%1), %%ax        \n" "cwde                    \n" "incl %1                 \n" "incl %1                 \n" "movd  %%eax, %%mm1      \n" "psrlq $32, %%mm1        \n" "movw 0(%1), %%ax        \n" "incl %1                 \n" "incl %1                 \n" "movd %%eax, %%mm2       \n" "por %%mm2, %%mm1        \n" "                        \n" "decl %%ecx              \n" "jnz 1b                  \n" "                        \n" "popl %%ecx              \n" "movl %1, %%esi          \n" "movl %3, %%edi          \n" "incl %%esi              \n" "2:                      \n" "decl %%ecx              \n" "jnz 2b         !
          \n" : : "g"(multFactor), "r"(snd), "g"(sndbufl), "g"(sndbufr), "g"(len)
# 285 "backends/midi/mt32/i386.cpp"
                : "eax", "ecx", "edi", "esi", "mm1", "mm2", "xmm1", "memory");
}

static inline void atti386_mixBuffers(Bit16s * buf1, Bit16s *buf2, int len) {
        __asm__ __volatile__(
                "movl %0, %%ecx       \n" "movl %1, %%esi       \n" "movl %2, %%edi       \n" "1:                   \n" "movq 0(%%edi), %%mm1 \n" "movq 0(%%esi), %%mm2 \n" "paddw %%mm2, %%mm1   \n" "movq %%mm1, 0(%%esi) \n" "addl $8, %%edi       \n" "addl $8, %%esi       \n" "decl %%ecx           \n" "cmpl $0, %%ecx       \n" "jg   1b              \n" "emms                 \n" : : "g"(len), "g"(buf1), "g"(buf2)
# 305 "backends/midi/mt32/i386.cpp"
                : "ecx", "edi", "esi", "mm1", "mm2", "memory");
}

static inline void atti386_mixBuffersRingMix(Bit16s * buf1, Bit16s *buf2, int len) {
        __asm__ __volatile__(
                "movl %0, %%ecx       \n" "movl %1, %%esi       \n" "movl %2, %%edi       \n" "1:                   \n" "movq 0(%%esi), %%mm1 \n" "movq 0(%%edi), %%mm2 \n" "movq %%mm1, %%mm3    \n" "pmulhw %%mm2, %%mm1  \n" "paddw %%mm3, %%mm1   \n" "movq %%mm1, 0(%%esi) \n" "addl $8, %%edi       \n" "addl $8, %%esi       \n" "decl %%ecx           \n" "cmpl $0, %%ecx       \n" "jg   1b              \n" "emms                 \n" : : "g"(len), "g"(buf1), "g"(buf2)
# 327 "backends/midi/mt32/i386.cpp"
                : "ecx", "edi", "esi", "mm1", "mm2", "mm3", "memory");
}

static inline void atti386_mixBuffersRing(Bit16s * buf1, Bit16s *buf2, int len) {
        __asm__ __volatile__(
                "movl %0, %%ecx       \n" "movl %1, %%esi       \n" "movl %2, %%edi       \n" "1:                   \n" "movq 0(%%esi), %%mm1 \n" "movq 0(%%edi), %%mm2 \n" "pmulhw %%mm2, %%mm1  \n" "movq %%mm1, 0(%%esi) \n" "addl $8, %%edi       \n" "addl $8, %%esi       \n" "decl %%ecx           \n" "cmpl $0, %%ecx       \n" "jg   1b              \n" "emms                 \n" : : "g"(len), "g"(buf1), "g"(buf2)
# 347 "backends/midi/mt32/i386.cpp"
                : "ecx", "edi", "esi", "mm1", "mm2", "memory");
}

static inline void atti386_partialProductOutput(int quadlen, Bit16s leftvol, Bit16s rightvol, Bit16s *partialBuf, Bit16s *p1buf) {
        __asm__ __volatile__(
                "movl %0, %%ecx       \n" "movw %1, %%ax        \n" "shll $16, %%eax      \n" "movw %2, %%ax        \n" "movd %%eax, %%mm1    \n" "movd %%eax, %%mm2    \n" "psllq $32, %%mm1     \n" "por  %%mm2, %%mm1    \n" "movl %3, %%edi       \n" "movl %4, %%esi       \n" "1:                   \n" "movw 0(%%esi), %%bx  \n" "addl $2, %%esi       \n" "movw 0(%%esi), %%dx  \n" "addl $2, %%esi       \n" "" "movw %%dx, %%ax      \n" "shll $16, %%eax      \n" "movw %%dx, %%ax      \n" "movd %%eax, %%mm2    \n" "psllq $32, %%mm2     \n" "movw %%bx, %%ax      \n" "shll $16, %%eax      \n" "movw %%bx, %%ax      \n" "movd %%eax, %%mm3    \n" "por  %%mm3, %%mm2    \n" "" "pmulhw %%mm1, %%mm2  \n" "movq %%mm2, 0(%%edi) \n" "addl $8, %%edi       \n" "" "decl %%ecx           \n" "cmpl $0, %%ecx       \n" "jg 1b                \n" "emms                 \n" : : "g"(quadlen), "g"(leftvol), "g"(rightvol), "g"(partialBuf), "g"(p1buf)
# 388 "backends/midi/mt32/i386.cpp"
                : "eax", "ebx", "ecx", "edx", "edi", "esi", "mm1", "mm2", "mm3", "memory");
}



bool DetectSIMD() {
# 429 "backends/midi/mt32/i386.cpp"
        return atti386_DetectSIMD();

}

bool Detect3DNow() {
# 464 "backends/midi/mt32/i386.cpp"
        return atti386_Detect3DNow();

}

float iir_filter_sse(float input,float *hist1_ptr, float *coef_ptr, int revLevel) {
        float output;


        output = input * (*coef_ptr++);
# 543 "backends/midi/mt32/i386.cpp"
        output = atti386_iir_filter_sse(&output, hist1_ptr, coef_ptr);

        output *= ResonInv[revLevel];
        return output;
}

float iir_filter_3dnow(float input,float *hist1_ptr, float *coef_ptr, int revLevel) {
        float output;


        output = input * (*coef_ptr++);
# 625 "backends/midi/mt32/i386.cpp"
        output = atti386_iir_filter_3DNow(output, hist1_ptr, coef_ptr);

        output *= ResonInv[revLevel];
        return output;
}



int i386_partialProductOutput(int len, Bit16s leftvol, Bit16s rightvol, Bit16s *partialBuf, Bit16s *mixedBuf) {
        int tmplen = len >> 1;
        if (tmplen == 0) {
                return 0;
        }
# 677 "backends/midi/mt32/i386.cpp"
        atti386_partialProductOutput(tmplen, leftvol, rightvol, partialBuf, mixedBuf);

        return tmplen << 1;
}

int i386_mixBuffers(Bit16s * buf1, Bit16s *buf2, int len) {
        int tmplen = len >> 2;
        if (tmplen == 0) {
                return 0;
        }
# 707 "backends/midi/mt32/i386.cpp"
        atti386_mixBuffers(buf1, buf2, tmplen);

        return tmplen << 2;
}


int i386_mixBuffersRingMix(Bit16s * buf1, Bit16s *buf2, int len) {
        int tmplen = len >> 2;
        if (tmplen == 0) {
                return 0;
        }
# 740 "backends/midi/mt32/i386.cpp"
        atti386_mixBuffersRingMix(buf1, buf2, tmplen);

        return tmplen << 2;
}

int i386_mixBuffersRing(Bit16s * buf1, Bit16s *buf2, int len) {
        int tmplen = len >> 2;
        if (tmplen == 0) {
                return 0;
        }
# 770 "backends/midi/mt32/i386.cpp"
        atti386_mixBuffersRing(buf1, buf2, tmplen);

        return tmplen << 2;
}

int i386_produceOutput1(Bit16s *useBuf, Bit16s *stream, Bit32u len, Bit16s volume) {
        int tmplen = (len >> 1);
        if (tmplen == 0) {
                return 0;
        }
# 808 "backends/midi/mt32/i386.cpp"
        atti386_produceOutput1(tmplen, volume, useBuf, stream);

        return tmplen << 1;
}



}

-- 
           Summary: Failing compilation
           Product: gcc
           Version: 3.3.5
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: exabyte at 3mhz dot net
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i486-slackware-linux-gnu
  GCC host triplet: i486-slackware-linux-gnu
GCC target triplet: i486-slackware-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22351



More information about the Gcc-bugs mailing list