public void GetSamplesSync(out short[] samples, out int nsamp) { int nsampin = framebuffer.SoundBufferByteLength; unsafe { fixed(byte *src = framebuffer.SoundBuffer) { for (int i = 0; i < nsampin; i++) { // the buffer values don't really get very large at all, // so this doesn't overflow short s = (short)(src[i] * 200); resampler.EnqueueSample(s, s); } } } resampler.GetSamplesSync(out samples, out nsamp); dcfilter.PushThroughSamples(samples, nsamp * 2); }
public void Flush() { while (cachedCycles > 0) { // process voices and envelopes voices[0].ExecutePhase2(); voices[1].ExecutePhase2(); voices[2].ExecutePhase2(); envelopes[0].ExecutePhase2(); envelopes[1].ExecutePhase2(); envelopes[2].ExecutePhase2(); // process sync for (int i = 0; i < 3; i++) { voices[i].Synchronize(voices[syncNextTable[i]], voices[syncPrevTable[i]]); } // get output voiceOutput[0] = voices[0].Output(voices[2]); voiceOutput[1] = voices[1].Output(voices[0]); voiceOutput[2] = voices[2].Output(voices[1]); envelopeOutput[0] = envelopes[0].Level; envelopeOutput[1] = envelopes[1].Level; envelopeOutput[2] = envelopes[2].Level; mixer = ((voiceOutput[0] * envelopeOutput[0]) >> 7); mixer += ((voiceOutput[1] * envelopeOutput[1]) >> 7); mixer += ((voiceOutput[2] * envelopeOutput[2]) >> 7); mixer = (mixer * volume) >> 4; sample = (short)mixer; resampler.EnqueueSample(sample, sample); cachedCycles--; } }
private void snes_audio_sample(ushort left, ushort right) { _resampler.EnqueueSample((short)left, (short)right); }
//TODO: handle these in c++ (queue there and blast after frameadvance to c#) public void retro_audio_sample(short left, short right) { resampler.EnqueueSample(left, right); nsamprecv++; }
private void snes_audio_sample(short left, short right) { _resampler.EnqueueSample(left, right); }