View Javadoc

1   package net.sf.jack4j;
2   
3   /*
4   Copyright (C) 2008 Ondrej Par
5   
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU Lesser General Public License as published by
8   the Free Software Foundation; either version 2.1 of the License, or
9   (at your option) any later version.
10  
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  GNU Lesser General Public License for more details.
15  
16  You should have received a copy of the GNU Lesser General Public License
17  along with this program; if not, write to the Free Software
18  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19  
20  */
21  
22  /**
23   * Convenient implementation of {@link JackClient} that correctly defines all
24   * callbacks.
25   * 
26   * <p>
27   * Inherited classes still have to call
28   * {@link JackClient#setDefaultThreadInitCallback()} and other necessary
29   * <code>setDefaultXXXCallback</code> methods to ensure that the callbacks are
30   * actually called.
31   * 
32   * @author repa
33   * 
34   */
35  public class AbstractJackClient extends JackClient {
36  
37  	/**
38  	 * Simply calls inherited constructor.
39  	 */
40  	public AbstractJackClient(String clientName, boolean useExactName, boolean canStartServer, String serverName)
41  	        throws JackException {
42  		super(clientName, useExactName, canStartServer, serverName);
43  	}
44  
45  	/**
46  	 * This implementation only returns 0.
47  	 * 
48  	 * @see net.sf.jack4j.JackClient#bufferSizeCallback(int)
49  	 */
50  	@Override
51  	public int bufferSizeCallback(int newBufferSize) throws Exception {
52  		return 0;
53  	}
54  
55  	/**
56  	 * This implementation does nothing.
57  	 * 
58  	 * @see net.sf.jack4j.JackClient#clientRegistrationCallback(java.lang.String,
59  	 *      boolean)
60  	 */
61  	@Override
62  	public void clientRegistrationCallback(String clientName, boolean registered) throws Exception {
63  		// noop
64  	}
65  
66  	/**
67  	 * This implementation does nothing.
68  	 * 
69  	 * @see net.sf.jack4j.JackClient#freewheelCallback(boolean)
70  	 */
71  	@Override
72  	public void freewheelCallback(boolean onoff) throws Exception {
73  		// noop
74  	}
75  
76  	/**
77  	 * This implementation only returns 0.
78  	 * 
79  	 * @see net.sf.jack4j.JackClient#graphOrderCallback()
80  	 */
81  	@Override
82  	public int graphOrderCallback() throws Exception {
83  		return 0;
84  	}
85  
86  	/**
87  	 * This implementation does nothing.
88  	 * 
89  	 * @see net.sf.jack4j.JackClient#portConnectCallback(long, long, boolean)
90  	 */
91  	@Override
92  	public void portConnectCallback(long portAId, long portBId, boolean connected) throws Exception {
93  		// noop
94  	}
95  
96  	/**
97  	 * This implementation does nothing.
98  	 * 
99  	 * @see net.sf.jack4j.JackClient#portRegistrationCallback(long, boolean)
100 	 */
101 	@Override
102 	public void portRegistrationCallback(long portId, boolean registered) throws Exception {
103 		// noop
104 	}
105 
106 	/**
107 	 * This implementation only returns 0.
108 	 * 
109 	 * @see net.sf.jack4j.JackClient#process(int)
110 	 */
111 	@Override
112 	public int process(int bufferSize) throws Exception {
113 		return 0;
114 	}
115 
116 	/**
117 	 * This implementation only returns 0.
118 	 * 
119 	 * @see net.sf.jack4j.JackClient#sampleRateCallback(int)
120 	 */
121 	@Override
122 	public int sampleRateCallback(int newSampleRate) throws Exception {
123 		return 0;
124 	}
125 
126 	/**
127 	 * This implementation does nothing.
128 	 * 
129 	 * @see net.sf.jack4j.JackClient#threadInitCallback()
130 	 */
131 	@Override
132 	public void threadInitCallback() throws Exception {
133 		// noop
134 	}
135 
136 	/**
137 	 * This implementation only returns 0.
138 	 * 
139 	 * @see net.sf.jack4j.JackClient#xRunCallback()
140 	 */
141 	@Override
142 	public int xRunCallback() throws Exception {
143 		return 0;
144 	}
145 
146 }