PatchSet 7363 
Date: 2006/07/17 19:16:03
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
added missing core files

Members: 
        
libraries/javalib/tritonus-sound/org/tritonus/core/Service.java:INITIAL->1.1 
        
libraries/javalib/tritonus-sound/org/tritonus/core/TAudioConfig.java:INITIAL->1.1
 
        
libraries/javalib/tritonus-sound/org/tritonus/core/TInit.java:INITIAL->1.1 
        
libraries/javalib/tritonus-sound/org/tritonus/core/TMidiConfig.java:INITIAL->1.1
 
        
libraries/javalib/tritonus-sound/org/tritonus/core/package.html:INITIAL->1.1 

===================================================================
Checking out 
kaffe/libraries/javalib/tritonus-sound/org/tritonus/core/Service.java
RCS:  
/home/cvs/kaffe/kaffe/libraries/javalib/tritonus-sound/org/tritonus/core/Service.java,v
VERS: 1.1
***************
--- /dev/null   Sun Aug  4 19:57:58 2002
+++ kaffe/libraries/javalib/tritonus-sound/org/tritonus/core/Service.java       
Mon Jul 17 19:35:37 2006
@@ -0,0 +1,191 @@
+/*
+ *     Service.java
+ */
+
+/*
+ *  Copyright (c) 2000 by Matthias Pfisterer <[EMAIL PROTECTED]>
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU Library General Public License as published
+ *   by the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU Library General Public License for more details.
+ *
+ *   You should have received a copy of the GNU Library General Public
+ *   License along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+
+package        org.tritonus.core;
+
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.tritonus.share.ArraySet;
+import org.tritonus.share.TDebug;
+
+
+
+public class Service
+{
+       private static final String     BASE_NAME = "META-INF/services/";
+
+
+       /**     Determines if the order of service providers is reversed.
+               If this is true, the Iterator returned by providers(Class)
+               iterates through the service provider classes backwards.
+               This means that service providers that are in the user class
+               path are first, then service providers in the extension class
+               path, then those in the boot class path.
+               This behaviour has the advantage that 'built-in' providers
+               (those in the boot class path) can be 'shadowed' by
+               providers in the extension and user class path.
+        */
+       private static final boolean    REVERSE_ORDER = true;
+
+
+
+       public static Iterator providers(Class cls)
+       {
+               if (TDebug.TraceService) { TDebug.out("Service.providers(): 
begin"); }
+               String  strFullName = BASE_NAME + cls.getName();
+               if (TDebug.TraceService) { TDebug.out("Service.providers(): 
full name: " + strFullName); }
+               List    instancesList = createInstancesList(strFullName);
+               Iterator        iterator = instancesList.iterator();
+               if (TDebug.TraceService) { TDebug.out("Service.providers(): 
end"); }
+               return iterator;
+       }
+
+
+
+       private static List createInstancesList(String strFullName)
+       {
+               if (TDebug.TraceService) { 
TDebug.out("Service.createInstancesList(): begin"); }
+               List    providers = new ArrayList();
+               Iterator        classNames = createClassNames(strFullName);
+               if (classNames != null)
+               {
+                       while (classNames.hasNext())
+                       {
+                               String  strClassName = (String) 
classNames.next();
+                               if (TDebug.TraceService) { 
TDebug.out("Service.createInstancesList(): Class name: " + strClassName); }
+                               try
+                               {
+                                       ClassLoader     systemClassLoader = 
ClassLoader.getSystemClassLoader();
+                                       Class   cls = 
Class.forName(strClassName, true, systemClassLoader);
+                                       if (TDebug.TraceService) { 
TDebug.out("Service.createInstancesList(): now creating instance of " + cls); }
+                                       Object  instance = cls.newInstance();
+                                       if (REVERSE_ORDER)
+                                       {
+                                               providers.add(0, instance);
+                                       }
+                                       else
+                                       {
+                                               providers.add(instance);
+                                       }
+                               }
+                               catch (ClassNotFoundException e)
+                               {
+                                       if (TDebug.TraceService || 
TDebug.TraceAllExceptions) { TDebug.out(e); }
+                               }
+                               catch (InstantiationException e)
+                               {
+                                       if (TDebug.TraceService || 
TDebug.TraceAllExceptions) { TDebug.out(e); }
+                               }
+                               catch (IllegalAccessException e)
+                               {
+                                       if (TDebug.TraceService || 
TDebug.TraceAllExceptions) { TDebug.out(e); }
+                               }
+                               catch (Throwable e)
+                               {
+                                       if (TDebug.TraceService || 
TDebug.TraceAllExceptions) { TDebug.out(e); }
+                               }
+                       }
+               }
+               if (TDebug.TraceService) { 
TDebug.out("Service.createInstancesList(): end"); }
+               return providers;
+       }
+
+
+
+       private static Iterator createClassNames(String strFullName)
+       {
+               if (TDebug.TraceService) { 
TDebug.out("Service.createClassNames(): begin"); }
+               Set     providers = new ArraySet();
+               Enumeration     configs = null;
+               try
+               {
+                       configs = ClassLoader.getSystemResources(strFullName);
+               }
+               catch (IOException e)
+               {
+                       if (TDebug.TraceService || TDebug.TraceAllExceptions) { 
TDebug.out(e); }
+               }
+               if (configs != null)
+               {
+                       while (configs.hasMoreElements())
+                       {
+                               URL     configFileUrl = (URL) 
configs.nextElement();
+                               if (TDebug.TraceService) { 
TDebug.out("Service.createClassNames(): config: " + configFileUrl); }
+                               InputStream     input = null;
+                               try
+                               {
+                                       input = configFileUrl.openStream();
+                               }
+                               catch (IOException e)
+                               {
+                                       if (TDebug.TraceService || 
TDebug.TraceAllExceptions) { TDebug.out(e); }
+                               }
+                               if (input != null)
+                               {
+                                       BufferedReader  reader = new 
BufferedReader(new InputStreamReader(input));
+                                       try
+                                       {
+                                               String  strLine = 
reader.readLine();
+                                               while (strLine != null)
+                                               {
+                                                       strLine = 
strLine.trim();
+                                                       int     nPos = 
strLine.indexOf('#');
+                                                       if (nPos >= 0)
+                                                       {
+                                                               strLine = 
strLine.substring(0, nPos);
+                                                       }
+                                                       if (strLine.length() > 
0)
+                                                       {
+                                                               
providers.add(strLine);
+                                                               if 
(TDebug.TraceService) { TDebug.out("Service.createClassNames(): adding class 
name: " + strLine); }
+                                                       }
+                                                       strLine = 
reader.readLine();
+                                               }
+                                       }
+                                       catch (IOException e)
+                                       {
+                                               if (TDebug.TraceService || 
TDebug.TraceAllExceptions) { TDebug.out(e); }
+                                       }
+                               }
+                       }
+               }
+               Iterator        iterator = providers.iterator();
+               if (TDebug.TraceService) { 
TDebug.out("Service.createClassNames(): end"); }
+               return iterator;
+       }
+}
+
+
+
+/*** Service.java ***/
===================================================================
Checking out 
kaffe/libraries/javalib/tritonus-sound/org/tritonus/core/TAudioConfig.java
RCS:  
/home/cvs/kaffe/kaffe/libraries/javalib/tritonus-sound/org/tritonus/core/TAudioConfig.java,v
VERS: 1.1
***************
--- /dev/null   Sun Aug  4 19:57:58 2002
+++ kaffe/libraries/javalib/tritonus-sound/org/tritonus/core/TAudioConfig.java  
Mon Jul 17 19:35:38 2006
@@ -0,0 +1,272 @@
+/*
+ *     TAudioConfig.java
+ */
+
+/*
+ *  Copyright (c) 1999 - 2001 by Matthias Pfisterer <[EMAIL PROTECTED]>
+ *
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU Library General Public License as published
+ *   by the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU Library General Public License for more details.
+ *
+ *   You should have received a copy of the GNU Library General Public
+ *   License along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+
+package        org.tritonus.core;
+
+
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.sound.sampled.Mixer;
+import javax.sound.sampled.spi.AudioFileReader;
+import javax.sound.sampled.spi.AudioFileWriter;
+import javax.sound.sampled.spi.FormatConversionProvider;
+import javax.sound.sampled.spi.MixerProvider;
+
+import org.tritonus.core.TInit.ProviderRegistrationAction;
+import org.tritonus.share.ArraySet;
+
+
+/** TODO:
+ */
+public class TAudioConfig
+{
+       private static Set              sm_audioFileWriters = null;
+       private static Set              sm_audioFileReaders = null;
+       private static Set              sm_formatConversionProviders = null;
+       private static Set              sm_mixerProviders = null;
+
+       private static Mixer.Info       sm_defaultMixerInfo;
+
+
+
+       /** Constructor to prevent instantiation.
+        */
+       private TAudioConfig()
+       {
+       }
+
+       private static void registerAudioFileReaders()
+       {
+               ProviderRegistrationAction      action = null;
+               action = new ProviderRegistrationAction()
+                       {
+                               public void register(Object obj)
+                                       throws  Exception
+                                       {
+                                               AudioFileReader provider = 
(AudioFileReader) obj;
+                                               
TAudioConfig.addAudioFileReader(provider);
+                                       }
+                       };
+               TInit.registerClasses(AudioFileReader.class, action);
+       }
+
+
+
+       private static void registerAudioFileWriters()
+       {
+               ProviderRegistrationAction      action = null;
+               action = new ProviderRegistrationAction()
+                       {
+                               public void register(Object obj)
+                                       throws  Exception
+                                       {
+                                               AudioFileWriter provider = 
(AudioFileWriter) obj;
+                                               
TAudioConfig.addAudioFileWriter(provider);
+                                       }
+                       };
+               TInit.registerClasses(AudioFileWriter.class, action);
+       }
+
+
+
+       private static void registerFormatConversionProviders()
+       {
+               ProviderRegistrationAction      action = null;
+               action = new ProviderRegistrationAction()
+                       {
+                               public void register(Object obj)
+                                       throws  Exception
+                                       {
+                                               FormatConversionProvider        
provider = (FormatConversionProvider) obj;
+                                               
TAudioConfig.addFormatConversionProvider(provider);
+                                       }
+                       };
+               TInit.registerClasses(FormatConversionProvider.class, action);
+       }
+
+
+
+       private static void registerMixerProviders()
+       {
+               ProviderRegistrationAction      action = null;
+               action = new ProviderRegistrationAction()
+                       {
+                               public void register(Object obj)
+                                       throws  Exception
+                                       {
+                                               MixerProvider   provider = 
(MixerProvider) obj;
+                                               
TAudioConfig.addMixerProvider(provider);
+                                       }
+                       };
+               TInit.registerClasses(MixerProvider.class, action);
+       }
+
+
+       ////////////////////////////////////////////////////////////////
+
+
+       public static synchronized void addAudioFileReader(AudioFileReader 
provider)
+       {
+               getAudioFileReadersImpl().add(provider);
+       }
+
+
+
+       public static synchronized void removeAudioFileReader(AudioFileReader 
provider)
+       {
+               getAudioFileReadersImpl().remove(provider);
+       }
+
+
+
+       public static synchronized Iterator getAudioFileReaders()
+       {
+               return getAudioFileReadersImpl().iterator();
+       }
+
+
+
+       private static synchronized Set getAudioFileReadersImpl()
+       {
+               if (sm_audioFileReaders == null)
+               {
+                       sm_audioFileReaders = new ArraySet();
+                       registerAudioFileReaders();
+               }
+               return sm_audioFileReaders;
+       }
+
+
+
+       public static synchronized void addAudioFileWriter(AudioFileWriter 
provider)
+       {
+               getAudioFileWritersImpl().add(provider);
+       }
+
+
+
+       public static synchronized void removeAudioFileWriter(AudioFileWriter 
provider)
+       {
+               getAudioFileWritersImpl().remove(provider);
+       }
+
+
+
+       public static synchronized Iterator getAudioFileWriters()
+       {
+               return getAudioFileWritersImpl().iterator();
+       }
+
+
+
+       private static synchronized Set getAudioFileWritersImpl()
+       {
+               if (sm_audioFileWriters == null)
+               {
+                       sm_audioFileWriters = new ArraySet();
+                       registerAudioFileWriters();
+               }
+               return sm_audioFileWriters;
+       }
+
+
+
+       public static synchronized void 
addFormatConversionProvider(FormatConversionProvider provider)
+       {
+               getFormatConversionProvidersImpl().add(provider);
+       }
+
+
+
+       public static synchronized void 
removeFormatConversionProvider(FormatConversionProvider provider)
+       {
+               getFormatConversionProvidersImpl().remove(provider);
+       }
+
+
+
+       public static synchronized Iterator getFormatConversionProviders()
+       {
+               return getFormatConversionProvidersImpl().iterator();
+       }
+
+
+
+       private static synchronized Set getFormatConversionProvidersImpl()
+       {
+               if (sm_formatConversionProviders == null)
+               {
+                       sm_formatConversionProviders = new ArraySet();
+                       registerFormatConversionProviders();
+               }
+               return sm_formatConversionProviders;
+       }
+
+
+
+       public static synchronized void addMixerProvider(MixerProvider provider)
+       {
+               getMixerProvidersImpl().add(provider);
+       }
+
+
+
+       public static synchronized void removeMixerProvider(MixerProvider 
provider)
+       {
+               getMixerProvidersImpl().remove(provider);
+       }
+
+
+
+       public static synchronized Iterator getMixerProviders()
+       {
+               return getMixerProvidersImpl().iterator();
+       }
+
+
+       private static synchronized Set getMixerProvidersImpl()
+       {
+               if (sm_mixerProviders == null)
+               {
+                       sm_mixerProviders = new ArraySet();
+                       registerMixerProviders();
+               }
+               return sm_mixerProviders;
+       }
+
+
+
+       // TODO: a way to set the default mixer
+       public static Mixer.Info getDefaultMixerInfo()
+       {
+               return sm_defaultMixerInfo;
+       }
+
+}
+
+
+
+/*** TAudioConfig.java ***/
===================================================================
Checking out kaffe/libraries/javalib/tritonus-sound/org/tritonus/core/TInit.java
RCS:  
/home/cvs/kaffe/kaffe/libraries/javalib/tritonus-sound/org/tritonus/core/TInit.java,v
VERS: 1.1
***************
--- /dev/null   Sun Aug  4 19:57:58 2002
+++ kaffe/libraries/javalib/tritonus-sound/org/tritonus/core/TInit.java Mon Jul 
17 19:35:38 2006
@@ -0,0 +1,98 @@
+/*
+ *     TInit.java
+ */
+
+/*
+ *  Copyright (c) 1999 - 2001 by Matthias Pfisterer <[EMAIL PROTECTED]>
+ *
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU Library General Public License as published
+ *   by the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU Library General Public License for more details.
+ *
+ *   You should have received a copy of the GNU Library General Public
+ *   License along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+package        org.tritonus.core;
+
+import java.util.Iterator;
+
+import org.tritonus.share.TDebug;
+
+
+
+/** Helper methods for provider registration.
+ */
+public class TInit
+{
+       /** Constructor to prevent instantiation.
+        */
+       private TInit()
+       {
+       }
+
+
+
+       /** Register all service providers of a certain type.
+           This method retrieves instances of all service providers of
+           the type given as providerClass. It registers them by
+           calling action with the provider instance as actual parameter.
+
+           @param providerClass Type of the service providers that should
+           be registered. For instance, this could be the class object for
+           javax.sound.sampled.spi.MixerProvider. However, the mechanism
+           is not restricted to the Java Sound types of service providers.
+
+           @param action A ProviderRegistrationAction that should to be
+           called to register the service providers. Typically, this is
+           something like adding the provider to a collection, but in
+           theorie, could be anything.
+       */
+       public static void registerClasses(Class providerClass,
+                                           ProviderRegistrationAction action)
+       {
+               if (TDebug.TraceInit) { TDebug.out("TInit.registerClasses(): 
registering for: " + providerClass); }
+               Iterator        providers = Service.providers(providerClass);
+               if (providers != null)
+               {
+                       while (providers.hasNext())
+                       {
+                               Object  provider = providers.next();
+                               try
+                               {
+                                       action.register(provider);
+                               }
+                               catch (Throwable e)
+                               {
+                                       if (TDebug.TraceInit || 
TDebug.TraceAllExceptions) { TDebug.out(e); }
+                               }
+                       }
+               }
+       }
+
+
+
+       /** Action to be taken on registration of a provider.
+           Strategy objects of this type has to be passed to
+           [EMAIL PROTECTED] #registerClasses registerClasses}. The 
implementation
+           is called for each provider that has to be registered.
+        */
+       public static interface ProviderRegistrationAction
+       {
+               public void register(Object provider)
+                       throws Exception;
+       }
+}
+
+
+
+/*** TInit.java ***/
===================================================================
Checking out 
kaffe/libraries/javalib/tritonus-sound/org/tritonus/core/TMidiConfig.java
RCS:  
/home/cvs/kaffe/kaffe/libraries/javalib/tritonus-sound/org/tritonus/core/TMidiConfig.java,v
VERS: 1.1
***************
--- /dev/null   Sun Aug  4 19:57:58 2002
+++ kaffe/libraries/javalib/tritonus-sound/org/tritonus/core/TMidiConfig.java   
Mon Jul 17 19:35:38 2006
@@ -0,0 +1,364 @@
+/*
+ *     TMidiConfig.java
+ */
+
+/*
+ *  Copyright (c) 1999 by Matthias Pfisterer <[EMAIL PROTECTED]>
+ *
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU Library General Public License as published
+ *   by the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU Library General Public License for more details.
+ *
+ *   You should have received a copy of the GNU Library General Public
+ *   License along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+package        org.tritonus.core;
+
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.sound.midi.MidiDevice;
+import javax.sound.midi.Sequencer;
+import javax.sound.midi.Synthesizer;
+import javax.sound.midi.spi.MidiDeviceProvider;
+import javax.sound.midi.spi.MidiFileReader;
+import javax.sound.midi.spi.MidiFileWriter;
+import javax.sound.midi.spi.SoundbankReader;
+
+import org.tritonus.core.TInit.ProviderRegistrationAction;
+import org.tritonus.share.ArraySet;
+import org.tritonus.share.TDebug;
+
+
+/** TODO:
+ */
+public class TMidiConfig
+{
+       private static Set              sm_midiDeviceProviders = null;
+       private static Set              sm_midiFileReaders = null;
+       private static Set              sm_midiFileWriters = null;
+       private static Set              sm_soundbankReaders = null;
+
+       private static MidiDevice.Info  sm_defaultMidiDeviceInfo = null;
+       private static MidiDevice.Info  sm_defaultSequencerInfo = null;
+       private static MidiDevice.Info  sm_defaultSynthesizerInfo = null;
+
+
+       static
+       {
+               init();
+       }
+
+       /** Constructor to prevent instantiation.
+        */
+       private TMidiConfig()
+       {
+       }
+
+
+       /** Initialize the collections of providers and the default devices.
+        */
+       private static void init()
+       {
+               // init providers from scanning the class path
+               // note: this already sets the default devices
+               getMidiDeviceProvidersImpl();
+               getMidiFileReadersImpl();
+               getMidiFileWritersImpl();
+               getSoundbankReadersImpl();
+               // now check properties for default devices
+               // ... TODO:
+       }
+
+
+
+       private static void registerMidiDeviceProviders()
+       {
+               ProviderRegistrationAction      action = null;
+               action = new ProviderRegistrationAction()
+                       {
+                               public void register(Object obj)
+                                       throws  Exception
+                               {
+                                       MidiDeviceProvider      
midiDeviceProvider = (MidiDeviceProvider) obj;
+                                       
TMidiConfig.addMidiDeviceProvider(midiDeviceProvider);
+                               }
+                       };
+               TInit.registerClasses(MidiDeviceProvider.class, action);
+       }
+
+
+       
+       private static void registerMidiFileReaders()
+       {
+               ProviderRegistrationAction      action = null;
+               action = new ProviderRegistrationAction()
+                       {
+                               public void register(Object obj)
+                                       throws  Exception
+                               {
+                                       MidiFileReader  provider = 
(MidiFileReader) obj;
+                                       TMidiConfig.addMidiFileReader(provider);
+                               }
+                       };
+               TInit.registerClasses(MidiFileReader.class, action);
+       }
+
+
+
+       private static void registerMidiFileWriters()
+       {
+               ProviderRegistrationAction      action = null;
+               action = new ProviderRegistrationAction()
+                       {
+                               public void register(Object obj)
+                                       throws  Exception
+                               {
+                                       MidiFileWriter  provider = 
(MidiFileWriter) obj;
+                                       TMidiConfig.addMidiFileWriter(provider);
+                               }
+                       };
+               TInit.registerClasses(MidiFileWriter.class, action);
+       }
+
+
+
+       private static void registerSoundbankReaders()
+       {
+               ProviderRegistrationAction      action = null;
+               action = new ProviderRegistrationAction()
+                       {
+                               public void register(Object obj)
+                                       throws  Exception
+                               {
+                                       SoundbankReader provider = 
(SoundbankReader) obj;
+                                       
TMidiConfig.addSoundbankReader(provider);
+                               }
+                       };
+               TInit.registerClasses(SoundbankReader.class, action);
+       }
+
+
+       //////////////////////////////////////////////////////////////////
+
+
+       public static synchronized void 
addMidiDeviceProvider(MidiDeviceProvider provider)
+       {
+               // TDebug.out("MidiDeviceProvider: " + provider);
+               getMidiDeviceProvidersImpl().add(provider);
+               if (getDefaultMidiDeviceInfo() == null ||
+                   getDefaultSynthesizerInfo() == null ||
+                   getDefaultSequencerInfo() == null)
+               {
+                       // TDebug.out("hello");
+                       MidiDevice.Info[]       infos = 
provider.getDeviceInfo();
+                       // TDebug.out("#infos: " + infos.length);
+                       for (int i = 0; i < infos.length; i++)
+                       {
+                               MidiDevice      device = null;
+                               try
+                               {
+                                       device = provider.getDevice(infos[i]);
+                               }
+                               catch (IllegalArgumentException e)
+                               {
+                                       if (TDebug.TraceAllExceptions)
+                                       {
+                                               TDebug.out(e);
+                                       }
+                               }
+                               if (device instanceof Synthesizer)
+                               {
+                                       if (getDefaultSynthesizerInfo() == null)
+                                       {
+                                               sm_defaultSynthesizerInfo = 
infos[i];
+                                       }
+                               }
+                               else if (device instanceof Sequencer)
+                               {
+                                       if (getDefaultSequencerInfo() == null)
+                                       {
+                                               sm_defaultSequencerInfo = 
infos[i];
+                                       }
+                               }
+                               else
+                               {
+                                       if (getDefaultMidiDeviceInfo() == null)
+                                       {
+                                               sm_defaultMidiDeviceInfo = 
infos[i];
+                                       }
+                               }
+                       }
+               }
+       }
+
+
+
+       public static synchronized void 
removeMidiDeviceProvider(MidiDeviceProvider provider)
+       {
+               getMidiDeviceProvidersImpl().remove(provider);
+               // TODO: change default infos
+       }
+
+
+
+       public static synchronized Iterator getMidiDeviceProviders()
+       {
+               return getMidiDeviceProvidersImpl().iterator();
+       }
+
+
+
+
+       private static synchronized Set getMidiDeviceProvidersImpl()
+       {
+               if (sm_midiDeviceProviders == null)
+               {
+                       sm_midiDeviceProviders = new ArraySet();
+                       registerMidiDeviceProviders();
+               }
+               return sm_midiDeviceProviders;
+       }
+
+
+
+
+       public static synchronized void addMidiFileReader(MidiFileReader reader)
+       {
+               if (TDebug.TraceMidiConfig)
+               {
+                       TDebug.out("TMidiConfig.addMidiFileReader(): adding " + 
reader);
+               }
+               getMidiFileReadersImpl().add(reader);
+               if (TDebug.TraceMidiConfig)
+               {
+                       TDebug.out("TMidiConfig.addMidiFileReader(): size " + 
sm_midiFileReaders.size());
+               }
+       }
+
+
+
+       public static synchronized void removeMidiFileReader(MidiFileReader 
reader)
+       {
+               getMidiFileReadersImpl().remove(reader);
+       }
+
+
+
+       public static synchronized Iterator getMidiFileReaders()
+       {
+               return getMidiFileReadersImpl().iterator();
+       }
+
+
+
+       private static synchronized Set getMidiFileReadersImpl()
+       {
+               if (sm_midiFileReaders == null)
+               {
+                       sm_midiFileReaders = new ArraySet();
+                       registerMidiFileReaders();
+               }
+               return sm_midiFileReaders;
+       }
+
+
+
+       public static synchronized void addMidiFileWriter(MidiFileWriter reader)
+       {
+               getMidiFileWritersImpl().add(reader);
+       }
+
+
+
+       public static synchronized void removeMidiFileWriter(MidiFileWriter 
reader)
+       {
+               getMidiFileWritersImpl().remove(reader);
+       }
+
+
+
+       public static synchronized Iterator getMidiFileWriters()
+       {
+               return getMidiFileWritersImpl().iterator();
+       }
+
+
+       private static synchronized Set getMidiFileWritersImpl()
+       {
+               if (sm_midiFileWriters == null)
+               {
+                       sm_midiFileWriters = new ArraySet();
+                       registerMidiFileWriters();
+               }
+               return sm_midiFileWriters;
+       }
+
+
+
+
+       public static synchronized void addSoundbankReader(SoundbankReader 
reader)
+       {
+               getSoundbankReadersImpl().add(reader);
+       }
+
+
+
+       public static synchronized void removeSoundbankReader(SoundbankReader 
reader)
+       {
+               getSoundbankReadersImpl().remove(reader);
+       }
+
+
+
+       public static synchronized Iterator getSoundbankReaders()
+       {
+               return getSoundbankReadersImpl().iterator();
+       }
+
+
+
+       private static synchronized Set getSoundbankReadersImpl()
+       {
+               if (sm_soundbankReaders == null)
+               {
+                       sm_soundbankReaders = new ArraySet();
+                       registerSoundbankReaders();
+               }
+               return sm_soundbankReaders;
+       }
+
+
+
+       public static MidiDevice.Info getDefaultMidiDeviceInfo()
+       {
+               return sm_defaultMidiDeviceInfo;
+       }
+
+
+
+       public static MidiDevice.Info getDefaultSynthesizerInfo()
+       {
+               return sm_defaultSynthesizerInfo;
+       }
+
+
+
+       public static MidiDevice.Info getDefaultSequencerInfo()
+       {
+               return sm_defaultSequencerInfo;
+       }
+}
+
+
+/*** TMidiConfig.java ***/
===================================================================
Checking out 
kaffe/libraries/javalib/tritonus-sound/org/tritonus/core/package.html
RCS:  
/home/cvs/kaffe/kaffe/libraries/javalib/tritonus-sound/org/tritonus/core/package.html,v
VERS: 1.1
***************
--- /dev/null   Sun Aug  4 19:57:58 2002
+++ kaffe/libraries/javalib/tritonus-sound/org/tritonus/core/package.html       
Mon Jul 17 19:35:38 2006
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+  <body>
+    <p>Initialization and Plug-in loading infrastructure. The classes
+    provided here are used to load available plug-ins
+    (AudioFileReader, AudioFileWriter, FormatConversionProvider,
+    MixerProvider, MidiDeviceProvider, MidiFileReader, MidiFileWriter,
+    SoundbankReader) and maintain lists of them. These classes are
+    needed by Tritonus only if it is used as a stand-alone Java Sound
+    implementation. They are called by AudioSystem and MidiSystem.</p>
+  </body>
+</html>

_______________________________________________
kaffe mailing list
kaffe@kaffe.org
http://kaffe.org/cgi-bin/mailman/listinfo/kaffe

Reply via email to