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 JackTransportClient} that correctly
24 * defines all 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 public abstract class AbstractJackTransportClient extends JackTransportClient {
35
36 /**
37 * Simply calls inherited constructor.
38 *
39 * @see JackClient#JackClient(String, boolean, boolean, String)
40 */
41 public AbstractJackTransportClient(String clientName, boolean useExactName, boolean canStartServer,
42 String serverName) throws JackException {
43 super(clientName, useExactName, canStartServer, serverName);
44 }
45
46 /**
47 * Always returns true.
48 */
49 @Override
50 public boolean syncCallback(JackTransportState state, TransportPosition position) {
51 return true;
52 }
53
54 /**
55 * Does nothing.
56 */
57 @Override
58 public void timebaseCallback(JackTransportState state, int nframes, TransportPosition pos, boolean newPos) {
59 // noop
60 }
61
62 /**
63 * This implementation only returns 0.
64 *
65 * @see net.sf.jack4j.JackClient#bufferSizeCallback(int)
66 */
67 @Override
68 public int bufferSizeCallback(int newBufferSize) throws Exception {
69 return 0;
70 }
71
72 /**
73 * This implementation does nothing.
74 *
75 * @see net.sf.jack4j.JackClient#clientRegistrationCallback(java.lang.String,
76 * boolean)
77 */
78 @Override
79 public void clientRegistrationCallback(String clientName, boolean registered) throws Exception {
80 // noop
81 }
82
83 /**
84 * This implementation does nothing.
85 *
86 * @see net.sf.jack4j.JackClient#freewheelCallback(boolean)
87 */
88 @Override
89 public void freewheelCallback(boolean onoff) throws Exception {
90 // noop
91 }
92
93 /**
94 * This implementation only returns 0.
95 *
96 * @see net.sf.jack4j.JackClient#graphOrderCallback()
97 */
98 @Override
99 public int graphOrderCallback() throws Exception {
100 return 0;
101 }
102
103 /**
104 * This implementation does nothing.
105 *
106 * @see net.sf.jack4j.JackClient#portConnectCallback(long, long, boolean)
107 */
108 @Override
109 public void portConnectCallback(long portAId, long portBId, boolean connected) throws Exception {
110 // noop
111 }
112
113 /**
114 * This implementation does nothing.
115 *
116 * @see net.sf.jack4j.JackClient#portRegistrationCallback(long, boolean)
117 */
118 @Override
119 public void portRegistrationCallback(long portId, boolean registered) throws Exception {
120 // noop
121 }
122
123 /**
124 * This implementation only returns 0.
125 *
126 * @see net.sf.jack4j.JackClient#process(int)
127 */
128 @Override
129 public int process(int bufferSize) throws Exception {
130 return 0;
131 }
132
133 /**
134 * This implementation only returns 0.
135 *
136 * @see net.sf.jack4j.JackClient#sampleRateCallback(int)
137 */
138 @Override
139 public int sampleRateCallback(int newSampleRate) throws Exception {
140 return 0;
141 }
142
143 /**
144 * This implementation does nothing.
145 *
146 * @see net.sf.jack4j.JackClient#threadInitCallback()
147 */
148 @Override
149 public void threadInitCallback() throws Exception {
150 // noop
151 }
152
153 /**
154 * This implementation only returns 0.
155 *
156 * @see net.sf.jack4j.JackClient#xRunCallback()
157 */
158 @Override
159 public int xRunCallback() throws Exception {
160 return 0;
161 }
162
163 }