diff options
author | Sven Gothel <[email protected]> | 2011-02-09 02:57:32 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-02-09 02:57:32 +0100 |
commit | 9d86a3325899606693ec1d9c42be64dc9f33ac9a (patch) | |
tree | a461f73f77c9be76b9f7e66b1b86d8df8ff97a25 /src/java/com/jogamp/openal/impl/ALCImpl.java | |
parent | 355f4c762ebc7964e6b91ea137d862c9cf913c8c (diff) |
Move implementation private files from com.jogamp.<module>.impl. to jogamp.<module> (1/2) - rename files
- com.jogamp.openal.impl -> jogamp.openal
This sorts implementation details from the top level, ie skipping the public 'com',
allowing a better seperation of public classes and implementation details
and also reduces strings.
This approach of public/private seperation is also used in the OpenJDK.
Diffstat (limited to 'src/java/com/jogamp/openal/impl/ALCImpl.java')
-rw-r--r-- | src/java/com/jogamp/openal/impl/ALCImpl.java | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/src/java/com/jogamp/openal/impl/ALCImpl.java b/src/java/com/jogamp/openal/impl/ALCImpl.java deleted file mode 100644 index 75fc47d..0000000 --- a/src/java/com/jogamp/openal/impl/ALCImpl.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Created on Saturday, July 10 2010 17:08 - */ -package com.jogamp.openal.impl; - -import com.jogamp.common.nio.Buffers; -import com.jogamp.openal.ALException; -import com.jogamp.openal.ALCdevice; -import java.io.UnsupportedEncodingException; -import java.nio.ByteBuffer; -import java.util.ArrayList; - -/** - * ALC implementation. - * @author Michael Bien - */ -public class ALCImpl extends ALCAbstractImpl { - - public String alcGetString(ALCdevice device, int param) { - if (device == null && param == ALC_DEVICE_SPECIFIER) { - throw new ALException("Call alcGetDeviceSpecifiers to fetch all available device names"); - } - - ByteBuffer buf = alcGetStringImpl(device, param); - if (buf == null) { - return null; - } - byte[] res = new byte[buf.capacity()]; - buf.get(res); - try { - return new String(res, "US-ASCII"); - } catch (UnsupportedEncodingException e) { - throw new ALException(e); - } - } - - /** Entry point (through function pointer) to C language function: <br> <code> const ALCchar * alcGetString(ALCdevice * device, ALCenum param); </code> */ - public ByteBuffer alcGetStringImpl(ALCdevice device, int param) { - - final long __addr_ = getALCProcAddressTable()._addressof_alcGetString; - if (__addr_ == 0) { - throw new UnsupportedOperationException("Method \"alcGetStringImpl\" not available"); - } - ByteBuffer _res; - _res = dispatch_alcGetStringImpl1(((device == null) ? null : device.getBuffer()), param, __addr_); - if (_res == null) { - return null; - } - Buffers.nativeOrder(_res); - return _res; - } - private native java.nio.ByteBuffer dispatch_alcGetStringImpl1(ByteBuffer deviceBuffer, int param, long addr); - - /** - * Fetches the names of the available ALC device specifiers. - * Equivalent to the C call alcGetString(NULL, ALC_DEVICE_SPECIFIER). - */ - public String[] alcGetDeviceSpecifiers() { - return getDoubleNullTerminatedString(ALC_DEVICE_SPECIFIER); - } - - /** - * Fetches the names of the available ALC capture device specifiers. - * Equivalent to the C call alcGetString(NULL, ALC_CAPTURE_DEVICE_SPECIFIER). - */ - public String[] alcGetCaptureDeviceSpecifiers() { - return getDoubleNullTerminatedString(ALC_CAPTURE_DEVICE_SPECIFIER); - } - - private String[] getDoubleNullTerminatedString(int which) { - ByteBuffer buf = alcGetStringImpl(null, which); - if (buf == null) { - return null; - } - byte[] bytes = new byte[buf.capacity()]; - buf.get(bytes); - try { - ArrayList/*<String>*/ res = new ArrayList/*<String>*/(); - int i = 0; - while (i < bytes.length) { - int startIndex = i; - while ((i < bytes.length) && (bytes[i] != 0)) { - i++; - } - res.add(new String(bytes, startIndex, i - startIndex, "US-ASCII")); - i++; - } - return (String[]) res.toArray(new String[res.size()]); - } catch (UnsupportedEncodingException e) { - throw new ALException(e); - } - } -} |