On Thu, Dec 5, 2019 at 10:48 AM <rael.gimenes@xxxxxxxxx> wrote:
> I need to create a Sound File Player in a GUI that we can use buttons like Play, Pause (to play/pause/resume) and Stop (to stop stream and send stream to it's beginning to a new play) to control the audio Stream, but I also need a chronometer synchronized with the audio stream and with the play/pause/resume/stop functions. I'm trying to figure out how to do that using SoundFileView. I have tried to find some ideas at the forum or other documents and could figure out how to solve this problem. I'm also trying to understand how to synchronize the .timeCursorPostion with an audio stream and how to use this cursor to position the audio stream. Anyone could send me some tips, or documentation, to help me find a way to solve this problem?
If loading the whole soundfile into a buffer:
b = Buffer.read(s, "...");
a = {
var dur = BufDur.kr(b),
phase = Line.ar(0, dur, dur, doneAction: 2);
// 10 times per second, send back current frame
SendReply.ar(Impulse.ar(10), '/phase', phase);
BufRd.ar(2, b, phase);
}.play;
OSCdef(\sfviewUpdater, { |msg|
{ sfview.timeCursorPosition = msg[3] }.defer
}, '/phase');
If streaming from disk:
b = Buffer.cueSoundFile(s, "...", bufferSize: 65536);
a = { VDiskIn.ar(2, b) }.play;
OSCdef(\sfviewUpdater, { |msg|
{ sfview.timeCursorPosition = msg[3] }.defer
}, '/diskin'); // '/diskin' is documented under VDiskIn
hjh
_______________________________________________
sc-users mailing list
info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/