01: /*
02: * Copyright 1990-2007 Sun Microsystems, Inc. All Rights Reserved.
03: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
04: *
05: * This program is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU General Public License version
07: * 2 only, as published by the Free Software Foundation.
08: *
09: * This program is distributed in the hope that it will be useful, but
10: * WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * General Public License version 2 for more details (a copy is
13: * included at /legal/license.txt).
14: *
15: * You should have received a copy of the GNU General Public License
16: * version 2 along with this work; if not, write to the Free Software
17: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18: * 02110-1301 USA
19: *
20: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
21: * Clara, CA 95054 or visit www.sun.com if you need additional
22: * information or have any questions.
23: */
24: package com.sun.mmedia;
25:
26: /**
27: * Parent interface that should be implemented by all DataSinks.
28: * It does not define any methods but only constants for the known
29: * DataSink types
30: */
31: public interface PCMAudioOut {
32: /**
33: * Default DataSink type
34: */
35: public final int DATASINK_DEFAULT = 0;
36:
37: /**
38: * Sound 3D DataSink type
39: */
40: public final int DATASINK_SOUND3D = 1;
41:
42: /**
43: * Media Processor DataSink
44: */
45: public final int DATASINK_EFFECTS = 2;
46:
47: /**
48: * Open connection to the DataSink with the given parameters.
49: *
50: * @param sampleRate sample rate of the outpus stream
51: * @param bits number bits per channel
52: * @param channels number of channels in the stream, e.g. 1 for mono,
53: * 2 for stereo, etc.
54: */
55: public boolean open(int sampleRate, int bits, int channels);
56:
57: public boolean open(int sampleRate, int bits, int channels,
58: boolean isSigned, boolean isBigEndian);
59:
60: /**
61: * Writes data to the data sink
62: */
63: public int write(byte[] data, int offset, int len);
64:
65: /**
66: * Pauses the data processing by the data sink
67: */
68: public void pause();
69:
70: /**
71: * Resumes the data processing by the data sink
72: */
73: public void resume();
74:
75: /**
76: * Flashes any data buffered in the data sink buffers
77: */
78: public void flush();
79:
80: public int drain();
81:
82: public void drainLoop();
83:
84: public long getSamplesPlayed();
85:
86: public int getVolume();
87:
88: public void setVolume(int level);
89:
90: public long getMediaTime();
91:
92: public void setMediaTime(long mediaTime);
93:
94: public void setRate(int rate);
95:
96: public void close();
97:
98: }
|