mirror of
https://github.com/holub/mame
synced 2025-07-03 17:08:39 +03:00
Merge pull request #232 from mixxmaster/master
fixed SAA1099 driver to actually use clock (nw); corrected Game Blaster/SB1.0 clock to 7.159mhz [NewRisingSun]
This commit is contained in:
commit
760ffa97f4
@ -20,9 +20,9 @@
|
||||
*/
|
||||
static MACHINE_CONFIG_FRAGMENT( game_blaster_config )
|
||||
MCFG_SPEAKER_STANDARD_MONO("mono")
|
||||
MCFG_SAA1099_ADD("saa1099.1", 4772720)
|
||||
MCFG_SAA1099_ADD("saa1099.1", 7159000)
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
|
||||
MCFG_SAA1099_ADD("saa1099.2", 4772720)
|
||||
MCFG_SAA1099_ADD("saa1099.2", 7159000)
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
|
@ -66,10 +66,10 @@ static MACHINE_CONFIG_FRAGMENT( sblaster1_0_config )
|
||||
MCFG_SOUND_ADD("ym3812", YM3812, ym3812_StdClock)
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 3.00)
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 3.00)
|
||||
MCFG_SAA1099_ADD("saa1099.1", 4772720)
|
||||
MCFG_SAA1099_ADD("saa1099.1", 7159000)
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.50)
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.50)
|
||||
MCFG_SAA1099_ADD("saa1099.2", 4772720)
|
||||
MCFG_SAA1099_ADD("saa1099.2", 7159000)
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.50)
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.50)
|
||||
|
||||
|
@ -63,6 +63,13 @@
|
||||
0x1c | ---- ---x | All channels enable (0 = off, 1 = on)
|
||||
0x1c | ---- --x- | Synch & Reset generators
|
||||
|
||||
Version History:
|
||||
================
|
||||
??-??-200? - First version of the driver submitted for MESS (GPL/MESS license)
|
||||
??-??-200? - Submitted to DOSBOX for Creative Music System/Game Blaster emulation
|
||||
??-??-201? - Driver relicensed to BSD 3 Clause (GPL+ compatible)
|
||||
06-27-2015 - Applied clock divisor fix from DOSBOX SVN, http://www.vogons.org/viewtopic.php?p=344227#p344227
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
@ -159,6 +166,7 @@ saa1099_device::saa1099_device(const machine_config &mconfig, const char *tag, d
|
||||
void saa1099_device::device_start()
|
||||
{
|
||||
/* copy global parameters */
|
||||
m_master_clock = clock();
|
||||
m_sample_rate = clock() / 256;
|
||||
|
||||
/* for each chip allocate one stream */
|
||||
@ -204,7 +212,6 @@ void saa1099_device::device_start()
|
||||
void saa1099_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
|
||||
{
|
||||
int j, ch;
|
||||
|
||||
/* if the channels are disabled we're done */
|
||||
if (!m_all_ch_enable)
|
||||
{
|
||||
@ -218,9 +225,9 @@ void saa1099_device::sound_stream_update(sound_stream &stream, stream_sample_t *
|
||||
{
|
||||
switch (m_noise_params[ch])
|
||||
{
|
||||
case 0: m_noise[ch].freq = 31250.0 * 2; break;
|
||||
case 1: m_noise[ch].freq = 15625.0 * 2; break;
|
||||
case 2: m_noise[ch].freq = 7812.5 * 2; break;
|
||||
case 0: m_noise[ch].freq = m_master_clock/256.0 * 2; break;
|
||||
case 1: m_noise[ch].freq = m_master_clock/512.0 * 2; break;
|
||||
case 2: m_noise[ch].freq = m_master_clock/1024.0 * 2; break;
|
||||
case 3: m_noise[ch].freq = m_channels[ch * 3].freq; break;
|
||||
}
|
||||
}
|
||||
@ -234,7 +241,7 @@ void saa1099_device::sound_stream_update(sound_stream &stream, stream_sample_t *
|
||||
for (ch = 0; ch < 6; ch++)
|
||||
{
|
||||
if (m_channels[ch].freq == 0.0)
|
||||
m_channels[ch].freq = (double)((2 * 15625) << m_channels[ch].octave) /
|
||||
m_channels[ch].freq = (double)((2 * m_master_clock / 512) << m_channels[ch].octave) /
|
||||
(511.0 - (double)m_channels[ch].frequency);
|
||||
|
||||
/* check the actual position in the square wave */
|
||||
@ -242,7 +249,7 @@ void saa1099_device::sound_stream_update(sound_stream &stream, stream_sample_t *
|
||||
while (m_channels[ch].counter < 0)
|
||||
{
|
||||
/* calculate new frequency now after the half wave is updated */
|
||||
m_channels[ch].freq = (double)((2 * 15625) << m_channels[ch].octave) /
|
||||
m_channels[ch].freq = (double)((2 * m_master_clock / 512) << m_channels[ch].octave) /
|
||||
(511.0 - (double)m_channels[ch].frequency);
|
||||
|
||||
m_channels[ch].counter += m_sample_rate;
|
||||
@ -255,26 +262,25 @@ void saa1099_device::sound_stream_update(sound_stream &stream, stream_sample_t *
|
||||
envelope_w(1);
|
||||
}
|
||||
|
||||
/* if the noise is enabled */
|
||||
if (m_channels[ch].noise_enable)
|
||||
// if the noise is enabled
|
||||
if (m->channels[ch].noise_enable)
|
||||
{
|
||||
/* if the noise level is high (noise 0: chan 0-2, noise 1: chan 3-5) */
|
||||
if (m_noise[ch/3].level & 1)
|
||||
// if the noise level is high (noise 0: chan 0-2, noise 1: chan 3-5)
|
||||
if (m->noise[ch/3].level & 1)
|
||||
{
|
||||
/* subtract to avoid overflows, also use only half amplitude */
|
||||
output_l -= m_channels[ch].amplitude[ LEFT] * m_channels[ch].envelope[ LEFT] / 16 / 2;
|
||||
output_r -= m_channels[ch].amplitude[RIGHT] * m_channels[ch].envelope[RIGHT] / 16 / 2;
|
||||
// subtract to avoid overflows, also use only half amplitude
|
||||
output_l -= m->channels[ch].amplitude[ LEFT] * m->channels[ch].envelope[ LEFT] / 16 / 2;
|
||||
output_r -= m->channels[ch].amplitude[RIGHT] * m->channels[ch].envelope[RIGHT] / 16 / 2;
|
||||
}
|
||||
}
|
||||
|
||||
/* if the square wave is enabled */
|
||||
if (m_channels[ch].freq_enable)
|
||||
// if the square wave is enabled
|
||||
if (m->channels[ch].freq_enable)
|
||||
{
|
||||
/* if the channel level is high */
|
||||
if (m_channels[ch].level & 1)
|
||||
// if the channel level is high
|
||||
if (m->channels[ch].level & 1)
|
||||
{
|
||||
output_l += m_channels[ch].amplitude[ LEFT] * m_channels[ch].envelope[ LEFT] / 16;
|
||||
output_r += m_channels[ch].amplitude[RIGHT] * m_channels[ch].envelope[RIGHT] / 16;
|
||||
output_l += m->channels[ch].amplitude[ LEFT] * m->channels[ch].envelope[ LEFT] / 16;
|
||||
output_r += m->channels[ch].amplitude[RIGHT] * m->channels[ch].envelope[RIGHT] / 16;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -103,6 +103,7 @@ private:
|
||||
saa1099_channel m_channels[6]; /* channels */
|
||||
saa1099_noise m_noise[2]; /* noise generators */
|
||||
double m_sample_rate;
|
||||
int m_master_clock;
|
||||
};
|
||||
|
||||
extern const device_type SAA1099;
|
||||
|
Loading…
Reference in New Issue
Block a user