trunk/src/emu/sound.c
| r18945 | r18946 | |
| 651 | 651 | int gain = (input.m_gain * input.m_user_gain * output.m_gain) >> 16; |
| 652 | 652 | |
| 653 | 653 | // determine the time at which the current sample begins, accounting for the |
| 654 | | // latency we calculated between the input and output streams |
| 654 | // latency we calculated between the input and output streams |
| 655 | 655 | attoseconds_t basetime = m_output_sampindex * m_attoseconds_per_sample - input.m_latency_attoseconds; |
| 656 | 656 | |
| 657 | 657 | // now convert that time into a sample in the input stream |
| r18945 | r18946 | |
| 665 | 665 | assert(basesample >= input_stream.m_output_base_sampindex); |
| 666 | 666 | stream_sample_t *source = &output.m_buffer[basesample - input_stream.m_output_base_sampindex]; |
| 667 | 667 | |
| 668 | | // determine the current fraction of a sample |
| 668 | // determine the current fraction of a sample, expressed as a fraction of FRAC_ONE |
| 669 | // (Note: this formula is valid as long as input_stream.m_attoseconds_per_sample signficantly exceeds FRAC_ONE > attoseconds = 4.2E-12 s) |
| 669 | 670 | UINT32 basefrac = (basetime - basesample * input_stream.m_attoseconds_per_sample) / ((input_stream.m_attoseconds_per_sample + FRAC_ONE - 1) >> FRAC_BITS); |
| 670 | 671 | assert(basefrac < FRAC_ONE); |
| 671 | 672 | |