< prev index next >

src/java.desktop/share/classes/javax/sound/midi/MidiDevice.java

Print this page




 117      * @throws MidiUnavailableException thrown if the device cannot be opened
 118      *         due to resource restrictions
 119      * @throws SecurityException thrown if the device cannot be opened due to
 120      *         security restrictions
 121      * @see #close
 122      * @see #isOpen
 123      */
 124     void open() throws MidiUnavailableException;
 125 
 126     /**
 127      * Closes the device, indicating that the device should now release any
 128      * system resources it is using.
 129      * <p>
 130      * All {@code Receiver} and {@code Transmitter} instances open from this
 131      * device are closed. This includes instances retrieved via
 132      * {@code MidiSystem}.
 133      *
 134      * @see #open
 135      * @see #isOpen
 136      */

 137     void close();
 138 
 139     /**
 140      * Reports whether the device is open.
 141      *
 142      * @return {@code true} if the device is open, otherwise {@code false}
 143      * @see #open
 144      * @see #close
 145      */
 146     boolean isOpen();
 147 
 148     /**
 149      * Obtains the current time-stamp of the device, in microseconds. If a
 150      * device supports time-stamps, it should start counting at 0 when the
 151      * device is opened and continue incrementing its time-stamp in microseconds
 152      * until the device is closed. If it does not support time-stamps, it should
 153      * always return -1.
 154      *
 155      * @return the current time-stamp of the device in microseconds, or -1 if
 156      *         time-stamping is not supported by the device


 235      * Usually the returned transmitters implement the
 236      * {@code MidiDeviceTransmitter} interface.
 237      *
 238      * @return an unmodifiable list of the open transmitters
 239      * @since 1.5
 240      */
 241     List<Transmitter> getTransmitters();
 242 
 243     /**
 244      * A {@code MidiDevice.Info} object contains assorted data about a
 245      * {@link MidiDevice}, including its name, the company who created it, and
 246      * descriptive text.
 247      *
 248      * @see MidiDevice#getDeviceInfo
 249      */
 250     class Info {
 251 
 252         /**
 253          * The device's name.
 254          */
 255         private String name;
 256 
 257         /**
 258          * The name of the company who provides the device.
 259          */
 260         private String vendor;
 261 
 262         /**
 263          * A description of the device.
 264          */
 265         private String description;
 266 
 267         /**
 268          * Device version.
 269          */
 270         private String version;
 271 
 272         /**
 273          * Constructs a device info object.
 274          *
 275          * @param  name the name of the device
 276          * @param  vendor the name of the company who provides the device
 277          * @param  description a description of the device
 278          * @param  version version information for the device
 279          */
 280         protected Info(String name, String vendor, String description,
 281                        String version) {
 282 
 283             this.name = name;
 284             this.vendor = vendor;
 285             this.description = description;
 286             this.version = version;
 287         }
 288 
 289         /**
 290          * Reports whether two objects are equal. Returns {@code true} if the
 291          * objects are identical.
 292          *
 293          * @param  obj the reference object with which to compare this object
 294          * @return {@code true} if this object is the same as the {@code obj}
 295          *         argument; {@code false} otherwise
 296          */

 297         public final boolean equals(Object obj) {
 298             return super.equals(obj);
 299         }
 300 
 301         /**
 302          * Finalizes the hashcode method.
 303          */

 304         public final int hashCode() {
 305             return super.hashCode();
 306         }
 307 
 308         /**
 309          * Obtains the name of the device.
 310          *
 311          * @return a string containing the device's name
 312          */
 313         public final String getName() {
 314             return name;
 315         }
 316 
 317         /**
 318          * Obtains the name of the company who supplies the device.
 319          *
 320          * @return device the vendor's name
 321          */
 322         public final String getVendor() {
 323             return vendor;


 329          * @return a description of the device
 330          */
 331         public final String getDescription() {
 332             return description;
 333         }
 334 
 335         /**
 336          * Obtains the version of the device.
 337          *
 338          * @return textual version information for the device
 339          */
 340         public final String getVersion() {
 341             return version;
 342         }
 343 
 344         /**
 345          * Provides a string representation of the device information.
 346          *
 347          * @return a description of the info object
 348          */

 349         public final String toString() {
 350             return name;
 351         }
 352     } // class Info
 353 }


 117      * @throws MidiUnavailableException thrown if the device cannot be opened
 118      *         due to resource restrictions
 119      * @throws SecurityException thrown if the device cannot be opened due to
 120      *         security restrictions
 121      * @see #close
 122      * @see #isOpen
 123      */
 124     void open() throws MidiUnavailableException;
 125 
 126     /**
 127      * Closes the device, indicating that the device should now release any
 128      * system resources it is using.
 129      * <p>
 130      * All {@code Receiver} and {@code Transmitter} instances open from this
 131      * device are closed. This includes instances retrieved via
 132      * {@code MidiSystem}.
 133      *
 134      * @see #open
 135      * @see #isOpen
 136      */
 137     @Override
 138     void close();
 139 
 140     /**
 141      * Reports whether the device is open.
 142      *
 143      * @return {@code true} if the device is open, otherwise {@code false}
 144      * @see #open
 145      * @see #close
 146      */
 147     boolean isOpen();
 148 
 149     /**
 150      * Obtains the current time-stamp of the device, in microseconds. If a
 151      * device supports time-stamps, it should start counting at 0 when the
 152      * device is opened and continue incrementing its time-stamp in microseconds
 153      * until the device is closed. If it does not support time-stamps, it should
 154      * always return -1.
 155      *
 156      * @return the current time-stamp of the device in microseconds, or -1 if
 157      *         time-stamping is not supported by the device


 236      * Usually the returned transmitters implement the
 237      * {@code MidiDeviceTransmitter} interface.
 238      *
 239      * @return an unmodifiable list of the open transmitters
 240      * @since 1.5
 241      */
 242     List<Transmitter> getTransmitters();
 243 
 244     /**
 245      * A {@code MidiDevice.Info} object contains assorted data about a
 246      * {@link MidiDevice}, including its name, the company who created it, and
 247      * descriptive text.
 248      *
 249      * @see MidiDevice#getDeviceInfo
 250      */
 251     class Info {
 252 
 253         /**
 254          * The device's name.
 255          */
 256         private final String name;
 257 
 258         /**
 259          * The name of the company who provides the device.
 260          */
 261         private final String vendor;
 262 
 263         /**
 264          * A description of the device.
 265          */
 266         private final String description;
 267 
 268         /**
 269          * Device version.
 270          */
 271         private final String version;
 272 
 273         /**
 274          * Constructs a device info object.
 275          *
 276          * @param  name the name of the device
 277          * @param  vendor the name of the company who provides the device
 278          * @param  description a description of the device
 279          * @param  version version information for the device
 280          */
 281         protected Info(String name, String vendor, String description,
 282                        String version) {
 283 
 284             this.name = name;
 285             this.vendor = vendor;
 286             this.description = description;
 287             this.version = version;
 288         }
 289 
 290         /**
 291          * Reports whether two objects are equal. Returns {@code true} if the
 292          * objects are identical.
 293          *
 294          * @param  obj the reference object with which to compare this object
 295          * @return {@code true} if this object is the same as the {@code obj}
 296          *         argument; {@code false} otherwise
 297          */
 298         @Override
 299         public final boolean equals(Object obj) {
 300             return super.equals(obj);
 301         }
 302 
 303         /**
 304          * Finalizes the hashcode method.
 305          */
 306         @Override
 307         public final int hashCode() {
 308             return super.hashCode();
 309         }
 310 
 311         /**
 312          * Obtains the name of the device.
 313          *
 314          * @return a string containing the device's name
 315          */
 316         public final String getName() {
 317             return name;
 318         }
 319 
 320         /**
 321          * Obtains the name of the company who supplies the device.
 322          *
 323          * @return device the vendor's name
 324          */
 325         public final String getVendor() {
 326             return vendor;


 332          * @return a description of the device
 333          */
 334         public final String getDescription() {
 335             return description;
 336         }
 337 
 338         /**
 339          * Obtains the version of the device.
 340          *
 341          * @return textual version information for the device
 342          */
 343         public final String getVersion() {
 344             return version;
 345         }
 346 
 347         /**
 348          * Provides a string representation of the device information.
 349          *
 350          * @return a description of the info object
 351          */
 352         @Override
 353         public final String toString() {
 354             return name;
 355         }
 356     } // class Info
 357 }
< prev index next >