Previous 199869 Revisions Next

r18946 Tuesday 13th November, 2012 at 21:52:44 UTC by Tafoid
Added more comment to lessen confusion regarding sound_stream::generate_resampled_data (emu/sound.c)  [Anders Hallstrom]
[src/emu]sound.c

trunk/src/emu/sound.c
r18945r18946
651651   int gain = (input.m_gain * input.m_user_gain * output.m_gain) >> 16;
652652
653653   // 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
655655   attoseconds_t basetime = m_output_sampindex * m_attoseconds_per_sample - input.m_latency_attoseconds;
656656
657657   // now convert that time into a sample in the input stream
r18945r18946
665665   assert(basesample >= input_stream.m_output_base_sampindex);
666666   stream_sample_t *source = &output.m_buffer[basesample - input_stream.m_output_base_sampindex];
667667
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)
669670   UINT32 basefrac = (basetime - basesample * input_stream.m_attoseconds_per_sample) / ((input_stream.m_attoseconds_per_sample + FRAC_ONE - 1) >> FRAC_BITS);
670671   assert(basefrac < FRAC_ONE);
671672

Previous 199869 Revisions Next


© 1997-2024 The MAME Team