[jsyn] how to tell when an envelope is finished?

jsyn at music.columbia.edu jsyn at music.columbia.edu
Fri Apr 22 05:05:19 EDT 2011


The new API for the data queue callback is still a bit fluid.  You can 
currently request a callback for completion but not for a loop. What 
would like to have? I am open to suggestions. I plan to make a release 
in the next few days...

Here is an example of the new Pure Java JSyn API that queues data with a 
callback. It is for a sample but the same port and call is used for 
envelopes.



float[] data = { 0.2f, -8.9f, 2.7f };
FloatSample sample = new FloatSample( data.length, 1 );
sample.write( data );

UnitDataQueuePort dataQueue = new UnitDataQueuePort( "test" );
gotData = false;

// Create an object to be called when the queued data is done.
UnitDataQueueCallback callback = new UnitDataQueueCallback(){
	public void finished()
	{
		System.out.println("Callback complete.");
		gotData = true;
	}
};
dataQueue.queueData( sample, 0, data.length, 0, callback );

Phil Burk

On 4/22/11 7:57 AM, jsyn at music.columbia.edu wrote:
> I'm seeing this bullet point in the migrating from... to pure-java jsyn doc:
>
> * You can request a completion callback when you queue data.
>
> Seems like just what the doctor ordered but I can't find it in the
> EnvelopePlayer class - using Pure Java V16.3 (build 418, 2010-10-01)
>
> will this be rolled out soon?
>
> thanks!
>
> C>T>
>
> On Thu, Apr 21, 2011 at 9:21 PM, jsyn at music.columbia.edu
> <jsyn at music.columbia.edu>  wrote:
>> The problem for me is knowing when an envelope is finished so that I
>> can detect loops using queueLoop()
>>
>> Has there been any creative solutions to this by anyone?
>>
>> An observer pattern would seem ideal once some transition state is
>> detected...I remember the old difficulties described by Phil in the
>> old thread on this.
>>
>> Sorry, can't figure out how to get the old thread in here...
>>
>> C>T>
>> _______________________________________________
>> JSyn mailing list
>> JSyn at music.columbia.edu
>> To change digest mode or to make other administrative changes visit:
>> http://music.columbia.edu/mailman/listinfo/jsyn
>>
> _______________________________________________
> JSyn mailing list
> JSyn at music.columbia.edu
> To change digest mode or to make other administrative changes visit:
> http://music.columbia.edu/mailman/listinfo/jsyn
>
>


More information about the JSyn mailing list