Loading ...
Sorry, an error occurred while loading the content.
 

tracking objects

Expand Messages
  • Phil Burk
    Hello James, I am CC:ing the JSyn list because these questions are of general interest. ... SynthContext as opposed to calling it on a SynthObject? The method
    Message 1 of 1 , Aug 8, 2001
      Hello James,

      I am CC:ing the JSyn list because these questions are of general interest.

      >I have a few questions about tracking and other things:

      > 1) What is the difference between calling enableTracking() on a
      SynthContext as opposed to calling it on a SynthObject?

      The method in SynthObject just calls the shared global synthContext. Here's
      the source:

      public static void enableDeletionByGarbageCollector( boolean ifEnabled )
      {
      Synth.getSharedContext().enableDeletionByGarbageCollector( ifEnabled );
      }

      So call the SynthObject.enableDeletionByGarbageCollector(f) if you are using
      a global SynthContext, in other words if you called "Synth.startEngine()".

      If you are using your own specific SynthContext, in other words if you
      called "mySynthContext.start()", then use
      "mySynthContext.enableDeletionByGarbageCollector(f)" instead.

      > When I create this SynthCircuit subclass and manually track, start and
      stop each unit, is it sufficient to call myUnit.track() or should I call
      myUnit.enableTracking()?

      If you enable tracking globally, then you you don't need to call track()
      explicitly on each unit. (Jamie, I had just meant to keep a list of units in
      your circuit-like class so you can start/stop them when you start/stop the
      container object.)

      > 2) How do you set multiple flags when calling Synth.startEngine(int
      flags)? Do you have to set up multiple SynthContext()'s?

      The flags are all powers of 2:
      public final static int FLAG_NON_REAL_TIME = (1<<2);
      public final static int FLAG_ENABLE_INPUT = (1<<5);
      public final static int FLAG_DISABLE_OUTPUT = (1<<6);

      So you can OR them together, and JSyn can still see them individually.

      Synth.startEngine( Synth.FLAG_ENABLE_INPUT |
      Synth.FLAG_DISABLE_OUTPUT );

      > 3) I am creating a piece that has 3 distinct sections. I want to make
      sure that upon finishing a section, all previous objects are deleted by the
      garbage collector (this includes both SynthObject()'s and JMSL objects, as
      well as my own objects). Is there a quick and dirty way to do this?

      1) Get rid of all references to your objects, clear out Vectors, etc.
      2) If you enabled tracking, then call SynthObject.deleteAll() or
      mySynthContext.deleteAll().
      3) Force a garbage collection by calling (several times): System.gc();


      Phil Burk
      JSyn,pForth,DSP,ASIC - http://www.softsynth.com
      Portable Audio I/O - http://www.portaudio.com
      Interaction Server - http://www.transjam.com
    Your message has been successfully submitted and would be delivered to recipients shortly.