This project has moved and is read-only. For the latest updates, please go here.

Sinus generating quasi real time - is it possible to know currently played sample

Feb 15, 2017 at 11:13 AM
Edited Feb 15, 2017 at 11:17 AM

I would like to know the following process is possible or not:

those I know:
I can generate sinus in left and/or right channel and I can change amplitude during generating as in sinus wave generating sexample code (level * Math.Sin(wt - fi)) I count the samples for calculating the current sample.

Now, I generate 10 seconds samples in an object list and the overridden Read function uses that as sample source.... The amplitude changes in samples during this 10 seconds. Same amplitude is in 2 full periods of sinus and then increases. I know exactly which sample has how many amplitude (level) in samples.

The question:
I should stop playing samples if user press a button on keyboard and then I should know amplitude (level) of the actually played sample (not value). So I should know which sample is playing currently... then I would know to calculate the amplitude from current sample number.

How can I determine which sample was played in sample list when user pressed a button? What is the sample number of current played sample?
Mar 2, 2017 at 10:38 AM
Mar 4, 2017 at 4:47 PM
Divide by Math.Sin(wt - fi) and get the amplitude (=level) from your overridden read sampleprovider?