@@ -35,7 +35,7 @@ wswan_sound_device::wswan_sound_device(const machine_config &mconfig, const char
35
35
device_rom_interface(mconfig, *this ),
36
36
m_channel(nullptr ),
37
37
m_sweep_step(0 ),
38
- m_sweep_time(0 ),
38
+ m_sweep_time(8192 ),
39
39
m_sweep_count(0 ),
40
40
m_noise_type(0 ),
41
41
m_noise_reset(0 ),
@@ -54,7 +54,7 @@ wswan_sound_device::wswan_sound_device(const machine_config &mconfig, const char
54
54
{
55
55
}
56
56
57
- static constexpr int clk_div = 64 ;
57
+ static constexpr int clk_div = 128 ;
58
58
59
59
// -------------------------------------------------
60
60
// device_start - device-specific startup
@@ -138,9 +138,9 @@ void wswan_sound_device::sound_stream_update(sound_stream &stream, std::vector<r
138
138
139
139
if (m_audio[0 ].on )
140
140
{
141
- s32 sample = m_audio[0 ].signal ;
141
+ s32 const sample = m_audio[0 ].signal ;
142
142
m_audio[0 ].pos += clk_div;
143
- if (m_audio[0 ].pos >= m_audio[0 ].period )
143
+ while (m_audio[0 ].pos >= m_audio[0 ].period )
144
144
{
145
145
m_audio[0 ].pos -= m_audio[0 ].period ;
146
146
m_audio[0 ].signal = fetch_sample (0 , m_audio[0 ].offset ++);
@@ -153,15 +153,15 @@ void wswan_sound_device::sound_stream_update(sound_stream &stream, std::vector<r
153
153
{
154
154
if (m_audio2_voice)
155
155
{
156
- u8 voice_data = (m_audio[1 ].vol_left << 4 ) | m_audio[1 ].vol_right ;
156
+ u8 const voice_data = (m_audio[1 ].vol_left << 4 ) | m_audio[1 ].vol_right ;
157
157
left += voice_data * (m_master_volume & 0x0f );
158
158
right += voice_data * (m_master_volume & 0x0f );
159
159
}
160
160
else
161
161
{
162
- s32 sample = m_audio[1 ].signal ;
162
+ s32 const sample = m_audio[1 ].signal ;
163
163
m_audio[1 ].pos += clk_div;
164
- if (m_audio[1 ].pos >= m_audio[1 ].period )
164
+ while (m_audio[1 ].pos >= m_audio[1 ].period )
165
165
{
166
166
m_audio[1 ].pos -= m_audio[1 ].period ;
167
167
m_audio[1 ].signal = fetch_sample (1 , m_audio[1 ].offset ++);
@@ -173,17 +173,17 @@ void wswan_sound_device::sound_stream_update(sound_stream &stream, std::vector<r
173
173
174
174
if (m_audio[2 ].on )
175
175
{
176
- s32 sample = m_audio[2 ].signal ;
176
+ s32 const sample = m_audio[2 ].signal ;
177
177
m_audio[2 ].pos += clk_div;
178
- if (m_audio[2 ].pos >= m_audio[2 ].period )
178
+ while (m_audio[2 ].pos >= m_audio[2 ].period )
179
179
{
180
180
m_audio[2 ].pos -= m_audio[2 ].period ;
181
181
m_audio[2 ].signal = fetch_sample (2 , m_audio[2 ].offset ++);
182
182
}
183
183
if (m_audio3_sweep && m_sweep_time)
184
184
{
185
185
m_sweep_count += clk_div;
186
- if (m_sweep_count >= m_sweep_time)
186
+ while (m_sweep_count >= m_sweep_time)
187
187
{
188
188
m_sweep_count -= m_sweep_time;
189
189
m_audio[2 ].freq += m_sweep_step;
@@ -197,9 +197,9 @@ void wswan_sound_device::sound_stream_update(sound_stream &stream, std::vector<r
197
197
198
198
if (m_audio[3 ].on )
199
199
{
200
- s32 sample = m_audio[3 ].signal ;
200
+ s32 const sample = m_audio[3 ].signal ;
201
201
m_audio[3 ].pos += clk_div;
202
- if (m_audio[3 ].pos >= m_audio[3 ].period )
202
+ while (m_audio[3 ].pos >= m_audio[3 ].period )
203
203
{
204
204
if (m_audio4_noise)
205
205
m_audio[3 ].signal = m_noise_output ? 0xf : 0 ;
@@ -323,7 +323,7 @@ void wswan_sound_device::port_w(offs_t offset, u16 data, u16 mem_mask)
323
323
// Sweep step
324
324
if (ACCESSING_BITS_0_7)
325
325
{
326
- m_sweep_step = ( int8_t ) (data & 0xff );
326
+ m_sweep_step = s8 (data & 0xff );
327
327
}
328
328
// Sweep time
329
329
if (ACCESSING_BITS_8_15)
0 commit comments