srecord noeq SampleIteratorToQuerySound(int channels, ShortIterator it) is IQuerySound { int idx = 0; // points to the one we haven't queried yet public int channels() { ret channels; } public double getSample(int channel, double time) { int t = ifloor(time); if (t < idx) fail("Earlier time queried: " + t + " / " + idx); if (it == null) ret 0; // we're done while ping (true) { if (!it.hasNext()) { it = null; ret 0; } // we're done double sample = it.next(); if (t == idx++) ret sample; } } }