From f8f04314551d9a3208d2fd42a18670b5007c0a1a Mon Sep 17 00:00:00 2001 From: Chien Yang Date: Tue, 26 Oct 2004 18:27:41 +0000 Subject: A partial fix to issue 24. - Rename AudioEngine.java, AudioEngine3D.java and AudioEngine3DL2.java to abstract class. git-svn-id: https://svn.java.net/svn/j3d-core-utils~svn/trunk@25 9497e636-51bd-65ba-982d-a4982e1767a5 --- .../com/sun/j3d/audioengines/AudioEngine.java | 12 ++----- .../com/sun/j3d/audioengines/AudioEngine3D.java | 42 +++++----------------- .../com/sun/j3d/audioengines/AudioEngine3DL2.java | 19 +++------- 3 files changed, 17 insertions(+), 56 deletions(-) (limited to 'src/classes') diff --git a/src/classes/share/com/sun/j3d/audioengines/AudioEngine.java b/src/classes/share/com/sun/j3d/audioengines/AudioEngine.java index 8d4d36f..c61115d 100644 --- a/src/classes/share/com/sun/j3d/audioengines/AudioEngine.java +++ b/src/classes/share/com/sun/j3d/audioengines/AudioEngine.java @@ -55,7 +55,7 @@ import javax.media.j3d.*; * NOTE: AudioEngine developers should not subclass this class directly. * Subclass AudioEngine3DL2 instead. */ -public class AudioEngine implements AudioDevice { +public abstract class AudioEngine implements AudioDevice { /* * This device's UNIX file descriptor @@ -107,19 +107,13 @@ public class AudioEngine implements AudioDevice { * Code to initialize the device * @return flag: true is initialized sucessfully, false if error */ - public boolean initialize() { - // Expected to be over-ridden by extending class - return true; - } + public abstract boolean initialize(); /** * Code to close the device * @return flag: true is closed sucessfully, false if error */ - public boolean close() { - // Expected to be over-ridden by extending class - return true; - } + public abstract boolean close(); /* * Audio Playback Methods diff --git a/src/classes/share/com/sun/j3d/audioengines/AudioEngine3D.java b/src/classes/share/com/sun/j3d/audioengines/AudioEngine3D.java index 2e495d5..3afdcc0 100644 --- a/src/classes/share/com/sun/j3d/audioengines/AudioEngine3D.java +++ b/src/classes/share/com/sun/j3d/audioengines/AudioEngine3D.java @@ -67,7 +67,7 @@ import java.util.ArrayList; * Subclass AudioEngine3DL2 instead. */ -public class AudioEngine3D extends AudioEngine implements AudioDevice3D +public abstract class AudioEngine3D extends AudioEngine implements AudioDevice3D { /* * Identifiers of sample associated with sound source @@ -142,10 +142,7 @@ public class AudioEngine3D extends AudioEngine implements AudioDevice3D * Removes/clears associated sound data with this sound source node * @param index device specific reference number to device driver sample */ - public void clearSound(int index) { - // This method must be overridden by device specific implementation - return; - } + public abstract void clearSound(int index); /** * Set the transform for local to virtual world coordinate space @@ -163,20 +160,14 @@ public class AudioEngine3D extends AudioEngine implements AudioDevice3D * @param index device specific reference number to device driver sample * @return status: < 0 denotes an error */ - public int startSample(int index) { - // This method must be overridden by device specific implementation - return -1; // error if not overridden - } + public abstract int startSample(int index); /** * Stop sample playing on audio device * @param index device specific reference number to device driver sample * @return status: < 0 denotes an error */ - public int stopSample(int index) { - // This method must be overridden by device specific implementation - return -1; // error if not overridden - } + public abstract int stopSample(int index); /** * Update sample. @@ -184,46 +175,31 @@ public class AudioEngine3D extends AudioEngine implements AudioDevice3D * @param index device specific reference number to device driver sample */ // TODO: The update method exists on a TEMPORARY basis. - public void updateSample(int index) { - // This method must be overridden by device specific implementation - return; - } + public abstract void updateSample(int index); /** * Mute sample. * @param index device specific reference number to device driver sample */ - public void muteSample(int index) { - // This method must be overridden by device specific implementation - return; - } + public abstract void muteSample(int index); /** * Unmute sample. * @param index device specific reference number to device driver sample */ - public void unmuteSample(int index) { - // This method must be overridden by device specific implementation - return; - } + public abstract void unmuteSample(int index); /** * Pause sample. * @param index device specific reference number to device driver sample */ - public void pauseSample(int index) { - // This method must be overridden by device specific implementation - return; - } + public abstract void pauseSample(int index); /** * Unpause sample. * @param index device specific reference number to device driver sample */ - public void unpauseSample(int index) { - // This method must be overridden by device specific implementation - return; - } + public abstract void unpauseSample(int index); /* * diff --git a/src/classes/share/com/sun/j3d/audioengines/AudioEngine3DL2.java b/src/classes/share/com/sun/j3d/audioengines/AudioEngine3DL2.java index c8865c2..e9b5d0e 100644 --- a/src/classes/share/com/sun/j3d/audioengines/AudioEngine3DL2.java +++ b/src/classes/share/com/sun/j3d/audioengines/AudioEngine3DL2.java @@ -68,7 +68,7 @@ import java.util.ArrayList; * * @since Java 3D 1.3 */ -public class AudioEngine3DL2 extends AudioEngine3D implements AudioDevice3DL2 { +public abstract class AudioEngine3DL2 extends AudioEngine3D implements AudioDevice3DL2 { /** * Construct a new AudioEngine3DL2 with the specified PhysicalEnvironment. * @param physicalEnvironment the physical environment object where we @@ -91,31 +91,22 @@ public class AudioEngine3DL2 extends AudioEngine3D implements AudioDevice3DL2 { * Causes all cached sounds to be paused and all streaming sounds to be * stopped. */ - public void pause() { - // This method must be overridden by device specific implementation - return; - } + public abstract void pause(); + /** * Resumes audio device engine (if previously paused) without * reinitializing the device. * Causes all paused cached sounds to be resumed and all streaming * sounds restarted. */ - public void resume() { - // This method must be overridden by device specific implementation - return; - } + public abstract void resume(); /** * Set overall gain control of all sounds playing on the audio device. * @param scaleFactor scale factor applied to calculated amplitudes for * all sounds playing on this device */ - public void setGain(float scaleFactor) { - // This method must be overridden by device specific implementation - return; - } - + public abstract void setGain(float scaleFactor); /* * -- cgit v1.2.3