src/mess/machine/isa_gus.c
| r14509 | r14510 | |
| 229 | 229 | |
| 230 | 230 | for(x=0;x<32;x++) // for each voice |
| 231 | 231 | { |
| 232 | | if(!(m_voice[x].voice_ctrl & 0x01)) |
| 232 | stream_sample_t* left = outputl; |
| 233 | stream_sample_t* right = outputr; |
| 234 | UINT16 vol = (m_volume_table[(m_voice[x].current_vol & 0xfff0) >> 4]); |
| 235 | for(y=samples-1; y>=0; y--) |
| 233 | 236 | { |
| 234 | | stream_sample_t* left = outputl; |
| 235 | | stream_sample_t* right = outputr; |
| 236 | | UINT16 vol = (m_volume_table[(m_voice[x].current_vol & 0xfff0) >> 4]); |
| 237 | | for(y=samples-1; y>=0; y--) |
| 237 | UINT32 current = m_voice[x].current_addr >> 9; |
| 238 | // TODO: implement proper panning |
| 239 | (*left) += ((m_voice[x].sample) * (vol/8192.0)); |
| 240 | (*right) += ((m_voice[x].sample) * (vol/8192.0)); |
| 241 | left++; |
| 242 | right++; |
| 243 | if((!(m_voice[x].voice_ctrl & 0x40)) && (m_voice[x].current_addr >= m_voice[x].end_addr) && !m_voice[x].rollover && !(m_voice[x].voice_ctrl & 0x01)) |
| 238 | 244 | { |
| 239 | | UINT32 current = m_voice[x].current_addr >> 9; |
| 240 | | // TODO: implement proper panning |
| 241 | | (*left) += ((m_voice[x].sample) * (vol/8192.0)); |
| 242 | | (*right) += ((m_voice[x].sample) * (vol/8192.0)); |
| 243 | | left++; |
| 244 | | right++; |
| 245 | | if((!(m_voice[x].voice_ctrl & 0x40)) && (m_voice[x].current_addr >= m_voice[x].end_addr) && !m_voice[x].rollover && !(m_voice[x].voice_ctrl & 0x01)) |
| 245 | if(m_voice[x].vol_ramp_ctrl & 0x04) |
| 246 | 246 | { |
| 247 | | if(m_voice[x].vol_ramp_ctrl & 0x04) |
| 247 | m_voice[x].rollover = true; // set roll over condition - generate IRQ, but keep voice playing |
| 248 | } |
| 249 | |
| 250 | if(m_voice[x].voice_ctrl & 0x20) |
| 251 | set_irq(IRQ_WAVETABLE,x); |
| 252 | |
| 253 | // end voice, unless looping, or rollover is active, which disables looping |
| 254 | if(!m_voice[x].rollover) |
| 255 | { |
| 256 | if(!(m_voice[x].voice_ctrl & 0x08)) |
| 248 | 257 | { |
| 249 | | m_voice[x].rollover = true; // set roll over condition - generate IRQ, but keep voice playing |
| 258 | m_voice[x].voice_ctrl |= 0x01; |
| 259 | // m_voice[x].current_addr = m_voice[x].end_addr; |
| 250 | 260 | } |
| 251 | | |
| 252 | | // end voice, unless looping, or rollover is active, which disables looping |
| 253 | | if(!m_voice[x].rollover) |
| 261 | else |
| 254 | 262 | { |
| 255 | | if(!(m_voice[x].voice_ctrl & 0x08)) |
| 256 | | m_voice[x].voice_ctrl |= 0x01; |
| 263 | if(m_voice[x].voice_ctrl & 0x10) |
| 264 | m_voice[x].voice_ctrl |= 0x40; // change direction |
| 257 | 265 | else |
| 258 | | { |
| 259 | | if(m_voice[x].voice_ctrl & 0x10) |
| 260 | | m_voice[x].voice_ctrl |= 0x40; // change direction |
| 261 | | else |
| 262 | | m_voice[x].current_addr = m_voice[x].start_addr; // start sample again |
| 263 | | } |
| 266 | m_voice[x].current_addr = m_voice[x].start_addr; // start sample again |
| 264 | 267 | } |
| 265 | | if(m_voice[x].voice_ctrl & 0x20) |
| 266 | | set_irq(IRQ_WAVETABLE,x); |
| 267 | 268 | } |
| 268 | | if((m_voice[x].voice_ctrl & 0x40) && (m_voice[x].current_addr <= m_voice[x].start_addr) && !m_voice[x].rollover && !(m_voice[x].voice_ctrl & 0x01)) |
| 269 | } |
| 270 | if((m_voice[x].voice_ctrl & 0x40) && (m_voice[x].current_addr <= m_voice[x].start_addr) && !m_voice[x].rollover && !(m_voice[x].voice_ctrl & 0x01)) |
| 271 | { |
| 272 | if(m_voice[x].vol_ramp_ctrl & 0x04) |
| 269 | 273 | { |
| 270 | | if(m_voice[x].vol_ramp_ctrl & 0x04) |
| 274 | m_voice[x].rollover = true; // set roll over condition - generate IRQ, but keep voice playing |
| 275 | } |
| 276 | |
| 277 | if(m_voice[x].voice_ctrl & 0x20) |
| 278 | set_irq(IRQ_WAVETABLE,x); |
| 279 | |
| 280 | // end voice, unless looping, or rollover is active, which disables looping |
| 281 | if(!m_voice[x].rollover) |
| 282 | { |
| 283 | // end voice, unless looping |
| 284 | if(!(m_voice[x].voice_ctrl & 0x08)) |
| 271 | 285 | { |
| 272 | | m_voice[x].rollover = true; // set roll over condition - generate IRQ, but keep voice playing |
| 286 | m_voice[x].voice_ctrl |= 0x01; |
| 287 | // m_voice[x].current_addr = m_voice[x].start_addr; |
| 273 | 288 | } |
| 274 | | |
| 275 | | // end voice, unless looping, or rollover is active, which disables looping |
| 276 | | if(!m_voice[x].rollover) |
| 289 | else |
| 277 | 290 | { |
| 278 | | // end voice, unless looping |
| 279 | | if(!(m_voice[x].voice_ctrl & 0x08)) |
| 280 | | m_voice[x].voice_ctrl |= 0x01; |
| 291 | if(m_voice[x].voice_ctrl & 0x10) |
| 292 | m_voice[x].voice_ctrl &= ~0x40; // change direction |
| 281 | 293 | else |
| 282 | | { |
| 283 | | if(m_voice[x].voice_ctrl & 0x10) |
| 284 | | m_voice[x].voice_ctrl &= ~0x40; // change direction |
| 285 | | else |
| 286 | | m_voice[x].current_addr = m_voice[x].end_addr; // start sample again |
| 287 | | } |
| 294 | m_voice[x].current_addr = m_voice[x].end_addr; // start sample again |
| 288 | 295 | } |
| 289 | | if(m_voice[x].voice_ctrl & 0x20) |
| 290 | | set_irq(IRQ_WAVETABLE,x); |
| 291 | 296 | } |
| 297 | } |
| 298 | if(!(m_voice[x].voice_ctrl & 0x01)) |
| 299 | { |
| 292 | 300 | if(m_voice[x].voice_ctrl & 0x04) |
| 293 | 301 | { // 16-bit PCM |
| 294 | 302 | current = ((m_voice[x].current_addr >> 9) & 0xc0000) + (((m_voice[x].current_addr >> 9) & 0x1ffff) << 1); |
| r14509 | r14510 | |
| 302 | 310 | m_voice[x].current_addr -= (m_voice[x].freq_ctrl >> 1); |
| 303 | 311 | else |
| 304 | 312 | m_voice[x].current_addr += (m_voice[x].freq_ctrl >> 1); |
| 313 | } |
| 305 | 314 | #ifdef LOG_SOUND |
| 306 | | INT16 smp = (m_voice[x].sample) * (vol / 8192.0); |
| 307 | | fwrite(&smp,4,1,f); |
| 315 | INT16 smp = (m_voice[x].sample) * (vol / 8192.0); |
| 316 | fwrite(&smp,4,1,f); |
| 308 | 317 | #endif |
| 309 | | } |
| 310 | 318 | } |
| 311 | 319 | } |
| 312 | 320 | } |
| r14509 | r14510 | |
| 411 | 419 | { |
| 412 | 420 | m_voice[x].voice_ctrl = 0x01; // stop all voices |
| 413 | 421 | m_voice[x].vol_ramp_ctrl = 0x01; // stop all volume ramps |
| 422 | m_voice[x].current_vol = 0; // silence all voices |
| 414 | 423 | } |
| 415 | 424 | m_irq_source = 0xe0; |
| 416 | 425 | m_reg_ctrl = 0; |