⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 segar.c

📁 这个是延伸mame的在wince平台下的游戏模拟器的代码
💻 C
📖 第 1 页 / 共 2 页
字号:
            return;
        }
     }
    speechQueue[newPtr] = sound;
}

void astrob_speech_port_w( int offset, int val )
{
        if( Machine->samples == 0 )
                return;

        switch (val)
        {
                case 0x01:      astrob_queue_speech(v01); break;
                case 0x02:      astrob_queue_speech(v02); break;
                case 0x03:      astrob_queue_speech(v03); break;
                case 0x04:      astrob_queue_speech(v04); break;
                case 0x05:      astrob_queue_speech(v05); break;
                case 0x06:      astrob_queue_speech(v06); break;
                case 0x07:      astrob_queue_speech(v07); break;
                case 0x08:      astrob_queue_speech(v08); break;
                case 0x09:      astrob_queue_speech(v09); break;
                case 0x0a:      astrob_queue_speech(v0a); break;
                case 0x0b:      astrob_queue_speech(v0b); break;
                case 0x0c:      astrob_queue_speech(v0c); break;
                case 0x0d:      astrob_queue_speech(v0d); break;
                case 0x0e:      astrob_queue_speech(v0e); break;
                case 0x0f:      astrob_queue_speech(v0f); break;
                case 0x10:      astrob_queue_speech(v10); break;
                case 0x11:      astrob_queue_speech(v11); break;
                case 0x12:      astrob_queue_speech(v12); break;
                case 0x13:      astrob_queue_speech(v13); break;
                case 0x14:      astrob_queue_speech(v14); break;
                case 0x15:      astrob_queue_speech(v15); break;
                case 0x16:      astrob_queue_speech(v16); break;
                case 0x17:      astrob_queue_speech(v17); break;
                case 0x18:      astrob_queue_speech(v18); break;
                case 0x19:      astrob_queue_speech(v19); break;
                case 0x1a:      astrob_queue_speech(v1a); break;
                case 0x1b:      astrob_queue_speech(v1b); break;
                case 0x1c:      astrob_queue_speech(v1c); break;
                case 0x1d:      astrob_queue_speech(v1d); break;
                case 0x1e:      astrob_queue_speech(v1e); break;
                case 0x1f:      astrob_queue_speech(v1f); break;
                case 0x20:      astrob_queue_speech(v20); break;
                case 0x22:      astrob_queue_speech(v22); break;
                case 0x23:      astrob_queue_speech(v23); break;

        }

}

void astrob_audio_ports_w( int offset, int data )
{
        int line;
        int noise;
        int warp = 0;

        /* First, handle special control lines: */

        /* MUTE */
        if ((offset == 0) && (data & 0x20))
        {
                /* Note that this also stops our speech from playing. */
                /* (If our speech ever gets synthesized, this will probably
                   need to call some type of speech_mute function) */
                for (noise = 0; noise < TOTAL_SOUNDS; noise++)
                        sample_stop(astrob_sa[noise].channel);
                return;
        }

        /* WARP */
        if ((offset == 0) && (!(data & 0x80)))
        {
                warp = 1;
        }

        /* ATTACK RATE */
        if ((offset == 1) && (!(data & 0x10)))
        {
                /* TODO: this seems to modify the speed of the invader sounds */
        }

        /* RATE RESET */
        if ((offset == 1) && (!(data & 0x20)))
        {
                /* TODO: this seems to modify the speed of the invader sounds */
        }

        /* Now, play our discrete sounds */

        for (line = 0;line < 8;line++)
        {
                noise = 8 * offset + line;

                if (astrob_sa[noise].channel != -1)
                {
                        /* trigger sound */
                        if ((data & (1 << line)) == 0)
                        {
                                /* Special case: If we're on Invaders sounds, modify with warp */
                                if ((astrob_sa[noise].num >= invadr1) &&
                                        (astrob_sa[noise].num <= invadr4))
                                {
                                        if (astrob_sa[noise].restartable || !sample_playing(astrob_sa[noise].channel))
                                                sample_start(astrob_sa[noise].channel, astrob_sa[noise].num + warp, astrob_sa[noise].looped);
                                }
                                /* All other sounds are normal */
                                else
                                {
                                        if (astrob_sa[noise].restartable || !sample_playing(astrob_sa[noise].channel))
                                                sample_start(astrob_sa[noise].channel, astrob_sa[noise].num, astrob_sa[noise].looped);
                                }
                        }
                        else
                        {
                                if (sample_playing(astrob_sa[noise].channel) && astrob_sa[noise].stoppable)
                                        sample_stop(astrob_sa[noise].channel);
                        }
                }
        }
}

/* Monster Bash uses an 8255 to control the sounds, much like Zaxxon */
void monsterb_audio_8255_w( int offset, int data )
{
        static unsigned char mb_rom[] =
        { 0xC0, 0x5E, 0xE0, 0x82, 0xB2, 0x21, 0x05, 0x06,
        0xD6, 0x04, 0x6A, 0x21, 0xC1, 0xFE, 0xA0, 0x00 };

        /* Port A controls the special TMS3617 music chip */
        if (offset == 0)
        {
                int enable_val,i;

                TMS3617_doupdate();

                /* Lower four data lines get decoded into 13 control lines */
                TMS3617_pitch_w(0, ((data & 0x0F)+1) % 16);

                /* Top four data lines address an 82S123 ROM that enables/disables voices */
                enable_val = mb_rom[(data & 0xF0) >> 4];

                for (i=2; i<8; i++)
                {
                        if (enable_val & (1<<i))
                                TMS3617_voice_enable(i-2,1);
                        else
                                TMS3617_voice_enable(i-2,0);
                }
        }
        /* Port B controls the two discrete sound circuits */
        else if (offset == 1)
        {
                if (!(data & 0x01))     sample_start(1, mbzap, 0);

                if (!(data & 0x02))     sample_start(2, mbjumpdown, 0);

                /* TODO: D7 on Port B might affect TMS3617 output (mute?) */
        }
        /* Port C controls a NEC7751, which is probably an ADPCM decoder */
        /* (TODO: switch from samples to a true ADPCM decoder) */
        else if (offset == 2)
        {
                switch (data & 0x0F)
                {
                        case 0x0F:      sample_start(3, mblaughter, 0); break;
                        case 0x0E:      sample_start(3, mbwolfman, 0); break;
                        case 0x0C:      sample_start(3, mbwarping, 0); break;
                        case 0x0D:      sample_start(3, mbtongue, 0); break;
                        default:                sample_stop(3);
                }
        }
}

int monsterb_audio_8255_r( int offset )
{
        /* TODO: this should be returning some type of response from the NEC chip */
        if (sample_playing(3))
                return 0x00;
        else
                return 0xFF;
}


void spaceod_audio_ports_w(int offset,int data)
{
        int line;
        int noise;

        for (line = 0;line < 8;line++)
        {
                noise = 8 * offset + line;

                if (spaceod_sa[noise].channel != -1)
                {
                        /* trigger sound */
                        if ((data & (1 << line)) == 0)
                        {
                                if (spaceod_sa[noise].restartable || !sample_playing(spaceod_sa[noise].channel))
                                        sample_start(spaceod_sa[noise].channel, spaceod_sa[noise].num, spaceod_sa[noise].looped);
                        }
                        else
                        {
                                if (sample_playing(spaceod_sa[noise].channel) && spaceod_sa[noise].stoppable)
                                        sample_stop(spaceod_sa[noise].channel);
                        }
                }
        }
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -