Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
JDK 17 java.desktop.jmod - Desktop Module
JDK 17 java.desktop.jmod is the JMOD file for JDK 17 Desktop module.
JDK 17 Desktop module compiled class files are stored in \fyicenter\jdk-17.0.5\jmods\java.desktop.jmod.
JDK 17 Desktop module compiled class files are also linked and stored in the \fyicenter\jdk-17.0.5\lib\modules JImage file.
JDK 17 Desktop module source code files are stored in \fyicenter\jdk-17.0.5\lib\src.zip\java.desktop.
You can click and view the content of each source code file in the list below.
✍: FYIcenter
⏎ com/sun/media/sound/ModelByteBufferWavetable.java
/*
* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package com.sun.media.sound;
import java.io.IOException;
import java.io.InputStream;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioFormat.Encoding;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
/**
* Wavetable oscillator for pre-loaded data.
*
* @author Karl Helgason
*/
public final class ModelByteBufferWavetable implements ModelWavetable {
private class Buffer8PlusInputStream extends InputStream {
private final boolean bigendian;
private final int framesize_pc;
int pos = 0;
int pos2 = 0;
int markpos = 0;
int markpos2 = 0;
Buffer8PlusInputStream() {
framesize_pc = format.getFrameSize() / format.getChannels();
bigendian = format.isBigEndian();
}
@Override
public int read(byte[] b, int off, int len) throws IOException {
int avail = available();
if (avail <= 0)
return -1;
if (len > avail)
len = avail;
byte[] buff1 = buffer.array();
byte[] buff2 = buffer8.array();
pos += buffer.arrayOffset();
pos2 += buffer8.arrayOffset();
if (bigendian) {
for (int i = 0; i < len; i += (framesize_pc + 1)) {
System.arraycopy(buff1, pos, b, i, framesize_pc);
System.arraycopy(buff2, pos2, b, i + framesize_pc, 1);
pos += framesize_pc;
pos2 += 1;
}
} else {
for (int i = 0; i < len; i += (framesize_pc + 1)) {
System.arraycopy(buff2, pos2, b, i, 1);
System.arraycopy(buff1, pos, b, i + 1, framesize_pc);
pos += framesize_pc;
pos2 += 1;
}
}
pos -= buffer.arrayOffset();
pos2 -= buffer8.arrayOffset();
return len;
}
@Override
public long skip(long n) throws IOException {
int avail = available();
if (avail <= 0)
return -1;
if (n > avail)
n = avail;
pos += (n / (framesize_pc + 1)) * (framesize_pc);
pos2 += n / (framesize_pc + 1);
return super.skip(n);
}
@Override
public int read(byte[] b) throws IOException {
return read(b, 0, b.length);
}
@Override
public int read() throws IOException {
byte[] b = new byte[1];
int ret = read(b, 0, 1);
if (ret == -1)
return -1;
return 0 & 0xFF;
}
@Override
public boolean markSupported() {
return true;
}
@Override
public int available() throws IOException {
return (int)buffer.capacity() + (int)buffer8.capacity() - pos - pos2;
}
@Override
public synchronized void mark(int readlimit) {
markpos = pos;
markpos2 = pos2;
}
@Override
public synchronized void reset() throws IOException {
pos = markpos;
pos2 = markpos2;
}
}
private float loopStart = -1;
private float loopLength = -1;
private final ModelByteBuffer buffer;
private ModelByteBuffer buffer8 = null;
private AudioFormat format = null;
private float pitchcorrection = 0;
private float attenuation = 0;
private int loopType = LOOP_TYPE_OFF;
public ModelByteBufferWavetable(ModelByteBuffer buffer) {
this.buffer = buffer;
}
public ModelByteBufferWavetable(ModelByteBuffer buffer,
float pitchcorrection) {
this.buffer = buffer;
this.pitchcorrection = pitchcorrection;
}
public ModelByteBufferWavetable(ModelByteBuffer buffer, AudioFormat format) {
this.format = format;
this.buffer = buffer;
}
public ModelByteBufferWavetable(ModelByteBuffer buffer, AudioFormat format,
float pitchcorrection) {
this.format = format;
this.buffer = buffer;
this.pitchcorrection = pitchcorrection;
}
public void set8BitExtensionBuffer(ModelByteBuffer buffer) {
buffer8 = buffer;
}
public ModelByteBuffer get8BitExtensionBuffer() {
return buffer8;
}
public ModelByteBuffer getBuffer() {
return buffer;
}
public AudioFormat getFormat() {
if (format == null) {
if (buffer == null)
return null;
InputStream is = buffer.getInputStream();
AudioFormat format = null;
try {
format = AudioSystem.getAudioFileFormat(is).getFormat();
} catch (Exception e) {
//e.printStackTrace();
}
try {
is.close();
} catch (IOException e) {
//e.printStackTrace();
}
return format;
}
return format;
}
@Override
public AudioFloatInputStream openStream() {
if (buffer == null)
return null;
if (format == null) {
InputStream is = buffer.getInputStream();
AudioInputStream ais = null;
try {
ais = AudioSystem.getAudioInputStream(is);
} catch (Exception e) {
//e.printStackTrace();
return null;
}
return AudioFloatInputStream.getInputStream(ais);
}
if (buffer.array() == null) {
return AudioFloatInputStream.getInputStream(new AudioInputStream(
buffer.getInputStream(), format,
buffer.capacity() / format.getFrameSize()));
}
if (buffer8 != null) {
if (format.getEncoding().equals(Encoding.PCM_SIGNED)
|| format.getEncoding().equals(Encoding.PCM_UNSIGNED)) {
InputStream is = new Buffer8PlusInputStream();
AudioFormat format2 = new AudioFormat(
format.getEncoding(),
format.getSampleRate(),
format.getSampleSizeInBits() + 8,
format.getChannels(),
format.getFrameSize() + (1 * format.getChannels()),
format.getFrameRate(),
format.isBigEndian());
AudioInputStream ais = new AudioInputStream(is, format2,
buffer.capacity() / format.getFrameSize());
return AudioFloatInputStream.getInputStream(ais);
}
}
return AudioFloatInputStream.getInputStream(format, buffer.array(),
(int)buffer.arrayOffset(), (int)buffer.capacity());
}
@Override
public int getChannels() {
return getFormat().getChannels();
}
@Override
public ModelOscillatorStream open(float samplerate) {
// ModelWavetableOscillator doesn't support ModelOscillatorStream
return null;
}
// attenuation is in cB
@Override
public float getAttenuation() {
return attenuation;
}
// attenuation is in cB
public void setAttenuation(float attenuation) {
this.attenuation = attenuation;
}
@Override
public float getLoopLength() {
return loopLength;
}
public void setLoopLength(float loopLength) {
this.loopLength = loopLength;
}
@Override
public float getLoopStart() {
return loopStart;
}
public void setLoopStart(float loopStart) {
this.loopStart = loopStart;
}
public void setLoopType(int loopType) {
this.loopType = loopType;
}
@Override
public int getLoopType() {
return loopType;
}
@Override
public float getPitchcorrection() {
return pitchcorrection;
}
public void setPitchcorrection(float pitchcorrection) {
this.pitchcorrection = pitchcorrection;
}
}
⏎ com/sun/media/sound/ModelByteBufferWavetable.java
Or download all of them as a single archive file:
File name: java.desktop-17.0.5-src.zip File size: 9152233 bytes Release date: 2022-09-13 Download
⇒ JDK 17 java.instrument.jmod - Instrument Module
2023-09-16, ≈888🔥, 0💬
Popular Posts:
Woodstox 6.4.0 Source Code Files are provided at the Woodstox GitHub Website . You can download them...
Java Servlet 3.0 Specification API. JAR File Size and Download Location: File name: servlet-api.jar,...
JSP(tm) Standard Tag Library 1.0 implementation - Jakarta Taglibs hosts the Standard Taglib 1.0, an ...
JDK 11 jdk.jlink.jmod is the JMOD file for JDK 11 JLink tool, which can be invoked by the "jlink" co...
Apache Commons Codec library provides implementations of common encoders and decoders such as Base64...