1. /*
  2. * @(#)Soundbank.java 1.24 03/12/19
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.sound.midi;
  8. import java.net.URL;
  9. /**
  10. * A <code>Soundbank</code> contains a set of <code>Instruments</code>
  11. * that can be loaded into a <code>Synthesizer</code>.
  12. * Note that a Java Sound <code>Soundbank</code> is different from a MIDI bank.
  13. * MIDI permits up to 16383 banks, each containing up to 128 instruments
  14. * (also sometimes called programs, patches, or timbres).
  15. * However, a <code>Soundbank</code> can contain 16383 times 128 instruments,
  16. * because the instruments within a <code>Soundbank</code> are indexed by both
  17. * a MIDI program number and a MIDI bank number (via a <code>Patch</code>
  18. * object). Thus, a <code>Soundbank</code> can be thought of as a collection
  19. * of MIDI banks.
  20. * <p>
  21. * <code>Soundbank</code> includes methods that return <code>String</code>
  22. * objects containing the sound bank's name, manufacturer, version number, and
  23. * description. The precise content and format of these strings is left
  24. * to the implementor.
  25. * <p>
  26. * Different synthesizers use a variety of synthesis techniques. A common
  27. * one is wavetable synthesis, in which a segment of recorded sound is
  28. * played back, often with looping and pitch change. The Downloadable Sound
  29. * (DLS) format uses segments of recorded sound, as does the Headspace Engine.
  30. * <code>Soundbanks</code> and <code>Instruments</code> that are based on
  31. * wavetable synthesis (or other uses of stored sound recordings) should
  32. * typically implement the <code>getResources()</code>
  33. * method to provide access to these recorded segments. This is optional,
  34. * however; the method can return an zero-length array if the synthesis technique
  35. * doesn't use sampled sound (FM synthesis and physical modeling are examples
  36. * of such techniques), or if it does but the implementor chooses not to make the
  37. * samples accessible.
  38. *
  39. * @see Synthesizer#getDefaultSoundbank
  40. * @see Synthesizer#isSoundbankSupported
  41. * @see Synthesizer#loadInstruments(Soundbank, Patch[])
  42. * @see Patch
  43. * @see Instrument
  44. * @see SoundbankResource
  45. *
  46. * @version 1.24, 03/12/19
  47. * @author David Rivas
  48. * @author Kara Kytle
  49. */
  50. public interface Soundbank {
  51. /**
  52. * Obtains the name of the sound bank.
  53. * @return a <code>String</code> naming the sound bank
  54. */
  55. public String getName();
  56. /**
  57. * Obtains the version string for the sound bank.
  58. * @return a <code>String</code> that indicates the sound bank's version
  59. */
  60. public String getVersion();
  61. /**
  62. * Obtains a <code>string</code> naming the company that provides the
  63. * sound bank
  64. * @return the vendor string
  65. */
  66. public String getVendor();
  67. /**
  68. * Obtains a textual description of the sound bank, suitable for display.
  69. * @return a <code>String</code> that describes the sound bank
  70. */
  71. public String getDescription();
  72. /**
  73. * Extracts a list of non-Instrument resources contained in the sound bank.
  74. * @return an array of resources, exclusing instruments. If the sound bank contains
  75. * no resources (other than instruments), returns an array of length 0.
  76. */
  77. public SoundbankResource[] getResources();
  78. /**
  79. * Obtains a list of instruments contained in this sound bank.
  80. * @return an array of the <code>Instruments</code> in this
  81. * <code>SoundBank</code>
  82. * If the sound bank contains no instruments, returns an array of length 0.
  83. *
  84. * @see Synthesizer#getLoadedInstruments
  85. * @see #getInstrument(Patch)
  86. */
  87. public Instrument[] getInstruments();
  88. /**
  89. * Obtains an <code>Instrument</code> from the given <code>Patch</code>.
  90. * @param patch a <code>Patch</code> object specifying the bank index
  91. * and program change number
  92. * @return the requested instrument, or <code>null</code> if the
  93. * sound bank doesn't contain that instrument
  94. *
  95. * @see #getInstruments
  96. * @see Synthesizer#loadInstruments(Soundbank, Patch[])
  97. */
  98. public Instrument getInstrument(Patch patch);
  99. }