Java Doc for Line.java in  » 6.0-JDK-Core » sound » javax » sound » sampled » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » sound » javax.sound.sampled 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


javax.sound.sampled.Line

Line
public interface Line (Code)
The Line interface represents a mono or multi-channel audio feed. A line is an element of the digital audio "pipeline," such as a mixer, an input or output port, or a data path into or out of a mixer.

A line can have controls, such as gain, pan, and reverb. The controls themselves are instances of classes that extend the base Control class. The Line interface provides two accessor methods for obtaining the line's controls: Line.getControls getControls returns the entire set, and Line.getControl getControl returns a single control of specified type.

Lines exist in various states at different times. When a line opens, it reserves system resources for itself, and when it closes, these resources are freed for other objects or applications. The Line.isOpen() method lets you discover whether a line is open or closed. An open line need not be processing data, however. Such processing is typically initiated by subinterface methods such as SourceDataLine.write SourceDataLine.write and TargetDataLine.read TargetDataLine.read .

You can register an object to receive notifications whenever the line's state changes. The object must implement the LineListener interface, which consists of the single method LineListener.update update . This method will be invoked when a line opens and closes (and, if it's a DataLine , when it starts and stops).

An object can be registered to listen to multiple lines. The event it receives in its update method will specify which line created the event, what type of event it was (OPEN, CLOSE, START, or STOP), and how many sample frames the line had processed at the time the event occurred.

Certain line operations, such as open and close, can generate security exceptions if invoked by unprivileged code when the line is a shared audio resource.
author:
   Kara Kytle
version:
   1.36, 07/05/05
See Also:   LineEvent
since:
   1.3


Inner Class :public static class Info



Method Summary
public  voidaddLineListener(LineListener listener)
     Adds a listener to this line.
public  voidclose()
     Closes the line, indicating that any system resources in use by the line can be released.
public  ControlgetControl(Control.Type control)
     Obtains a control of the specified type, if there is any.
public  Control[]getControls()
     Obtains the set of controls associated with this line.
public  Line.InfogetLineInfo()
     Obtains the Line.Info object describing this line.
public  booleanisControlSupported(Control.Type control)
     Indicates whether the line supports a control of the specified type.
public  booleanisOpen()
     Indicates whether the line is open, meaning that it has reserved system resources and is operational, although it might not currently be playing or capturing sound.
public  voidopen()
     Opens the line, indicating that it should acquire any required system resources and become operational. If this operation succeeds, the line is marked as open, and an OPEN event is dispatched to the line's listeners.

Note that some lines, once closed, cannot be reopened.

public  voidremoveLineListener(LineListener listener)
     Removes the specified listener from this line's list of listeners.



Method Detail
addLineListener
public void addLineListener(LineListener listener)(Code)
Adds a listener to this line. Whenever the line's status changes, the listener's update() method is called with a LineEvent object that describes the change.
Parameters:
  listener - the object to add as a listener to this line
See Also:   Line.removeLineListener
See Also:   LineListener.update
See Also:   LineEvent



close
public void close()(Code)
Closes the line, indicating that any system resources in use by the line can be released. If this operation succeeds, the line is marked closed and a CLOSE event is dispatched to the line's listeners.
throws:
  SecurityException - if the line cannot beclosed due to security restrictions.
See Also:   Line.open
See Also:   Line.isOpen
See Also:   LineEvent



getControl
public Control getControl(Control.Type control)(Code)
Obtains a control of the specified type, if there is any. Some controls may only be available when the line is open.
Parameters:
  control - the type of the requested control a control of the specified type
throws:
  IllegalArgumentException - if a control of the specified typeis not supported
See Also:   Line.getControls
See Also:   Line.isControlSupported(Control.Type control)



getControls
public Control[] getControls()(Code)
Obtains the set of controls associated with this line. Some controls may only be available when the line is open. If there are no controls, this method returns an array of length 0. the array of controls
See Also:   Line.getControl



getLineInfo
public Line.Info getLineInfo()(Code)
Obtains the Line.Info object describing this line. description of the line



isControlSupported
public boolean isControlSupported(Control.Type control)(Code)
Indicates whether the line supports a control of the specified type. Some controls may only be available when the line is open.
Parameters:
  control - the type of the control for which support is queried true if at least one control of the specified type issupported, otherwise false.



isOpen
public boolean isOpen()(Code)
Indicates whether the line is open, meaning that it has reserved system resources and is operational, although it might not currently be playing or capturing sound. true if the line is open, otherwise false
See Also:   Line.open()
See Also:   Line.close()



open
public void open() throws LineUnavailableException(Code)
Opens the line, indicating that it should acquire any required system resources and become operational. If this operation succeeds, the line is marked as open, and an OPEN event is dispatched to the line's listeners.

Note that some lines, once closed, cannot be reopened. Attempts to reopen such a line will always result in an LineUnavailableException.

Some types of lines have configurable properties that may affect resource allocation. For example, a DataLine must be opened with a particular format and buffer size. Such lines should provide a mechanism for configuring these properties, such as an additional open method or methods which allow an application to specify the desired settings.

This method takes no arguments, and opens the line with the current settings. For SourceDataLine and TargetDataLine objects, this means that the line is opened with default settings. For a Clip , however, the buffer size is determined when data is loaded. Since this method does not allow the application to specify any data to load, an IllegalArgumentException is thrown. Therefore, you should instead use one of the open methods provided in the Clip interface to load data into the Clip.

For DataLine's, if the DataLine.Info object which was used to retrieve the line, specifies at least one fully qualified audio format, the last one will be used as the default format.
throws:
  IllegalArgumentException - if this method is called on a Clip instance.
throws:
  LineUnavailableException - if the line cannot beopened due to resource restrictions.
throws:
  SecurityException - if the line cannot beopened due to security restrictions.
See Also:   Line.close
See Also:   Line.isOpen
See Also:   LineEvent
See Also:   DataLine
See Also:   Clip.open(AudioFormatbyte[]intint)
See Also:   Clip.open(AudioInputStream)




removeLineListener
public void removeLineListener(LineListener listener)(Code)
Removes the specified listener from this line's list of listeners.
Parameters:
  listener - listener to remove
See Also:   Line.addLineListener



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.