Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
a6441dc7
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
a6441dc7
编写于
3月 29, 2013
作者:
S
serb
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8006328: Improve robustness of sound classes
8009057: Improve MIDI event handling Reviewed-by: amenkov, art, skoivu
上级
d3205370
变更
136
展开全部
隐藏空白更改
内联
并排
Showing
136 changed file
with
1084 addition
and
1331 deletion
+1084
-1331
src/share/classes/com/sun/media/sound/AbstractDataLine.java
src/share/classes/com/sun/media/sound/AbstractDataLine.java
+21
-24
src/share/classes/com/sun/media/sound/AbstractLine.java
src/share/classes/com/sun/media/sound/AbstractLine.java
+33
-36
src/share/classes/com/sun/media/sound/AbstractMidiDevice.java
...share/classes/com/sun/media/sound/AbstractMidiDevice.java
+23
-21
src/share/classes/com/sun/media/sound/AbstractMidiDeviceProvider.java
...asses/com/sun/media/sound/AbstractMidiDeviceProvider.java
+8
-8
src/share/classes/com/sun/media/sound/AbstractMixer.java
src/share/classes/com/sun/media/sound/AbstractMixer.java
+25
-29
src/share/classes/com/sun/media/sound/AiffFileFormat.java
src/share/classes/com/sun/media/sound/AiffFileFormat.java
+5
-5
src/share/classes/com/sun/media/sound/AiffFileReader.java
src/share/classes/com/sun/media/sound/AiffFileReader.java
+7
-27
src/share/classes/com/sun/media/sound/AiffFileWriter.java
src/share/classes/com/sun/media/sound/AiffFileWriter.java
+3
-11
src/share/classes/com/sun/media/sound/AlawCodec.java
src/share/classes/com/sun/media/sound/AlawCodec.java
+6
-8
src/share/classes/com/sun/media/sound/AuFileFormat.java
src/share/classes/com/sun/media/sound/AuFileFormat.java
+3
-3
src/share/classes/com/sun/media/sound/AuFileReader.java
src/share/classes/com/sun/media/sound/AuFileReader.java
+7
-27
src/share/classes/com/sun/media/sound/AuFileWriter.java
src/share/classes/com/sun/media/sound/AuFileWriter.java
+3
-13
src/share/classes/com/sun/media/sound/AudioFileSoundbankReader.java
...classes/com/sun/media/sound/AudioFileSoundbankReader.java
+2
-2
src/share/classes/com/sun/media/sound/AudioFloatConverter.java
...hare/classes/com/sun/media/sound/AudioFloatConverter.java
+20
-19
src/share/classes/com/sun/media/sound/AudioFloatFormatConverter.java
...lasses/com/sun/media/sound/AudioFloatFormatConverter.java
+26
-25
src/share/classes/com/sun/media/sound/AudioFloatInputStream.java
...re/classes/com/sun/media/sound/AudioFloatInputStream.java
+14
-14
src/share/classes/com/sun/media/sound/AudioSynthesizerPropertyInfo.java
...ses/com/sun/media/sound/AudioSynthesizerPropertyInfo.java
+2
-2
src/share/classes/com/sun/media/sound/DLSInfo.java
src/share/classes/com/sun/media/sound/DLSInfo.java
+2
-2
src/share/classes/com/sun/media/sound/DLSInstrument.java
src/share/classes/com/sun/media/sound/DLSInstrument.java
+10
-10
src/share/classes/com/sun/media/sound/DLSModulator.java
src/share/classes/com/sun/media/sound/DLSModulator.java
+8
-8
src/share/classes/com/sun/media/sound/DLSRegion.java
src/share/classes/com/sun/media/sound/DLSRegion.java
+14
-14
src/share/classes/com/sun/media/sound/DLSSample.java
src/share/classes/com/sun/media/sound/DLSSample.java
+7
-7
src/share/classes/com/sun/media/sound/DLSSampleLoop.java
src/share/classes/com/sun/media/sound/DLSSampleLoop.java
+5
-5
src/share/classes/com/sun/media/sound/DLSSampleOptions.java
src/share/classes/com/sun/media/sound/DLSSampleOptions.java
+7
-7
src/share/classes/com/sun/media/sound/DLSSoundbank.java
src/share/classes/com/sun/media/sound/DLSSoundbank.java
+6
-6
src/share/classes/com/sun/media/sound/DLSSoundbankReader.java
...share/classes/com/sun/media/sound/DLSSoundbankReader.java
+2
-2
src/share/classes/com/sun/media/sound/DataPusher.java
src/share/classes/com/sun/media/sound/DataPusher.java
+4
-4
src/share/classes/com/sun/media/sound/DirectAudioDevice.java
src/share/classes/com/sun/media/sound/DirectAudioDevice.java
+24
-20
src/share/classes/com/sun/media/sound/DirectAudioDeviceProvider.java
...lasses/com/sun/media/sound/DirectAudioDeviceProvider.java
+35
-33
src/share/classes/com/sun/media/sound/EmergencySoundbank.java
...share/classes/com/sun/media/sound/EmergencySoundbank.java
+2
-2
src/share/classes/com/sun/media/sound/EventDispatcher.java
src/share/classes/com/sun/media/sound/EventDispatcher.java
+15
-19
src/share/classes/com/sun/media/sound/FFT.java
src/share/classes/com/sun/media/sound/FFT.java
+6
-6
src/share/classes/com/sun/media/sound/FastShortMessage.java
src/share/classes/com/sun/media/sound/FastShortMessage.java
+3
-3
src/share/classes/com/sun/media/sound/JARSoundbankReader.java
...share/classes/com/sun/media/sound/JARSoundbankReader.java
+12
-10
src/share/classes/com/sun/media/sound/JDK13Services.java
src/share/classes/com/sun/media/sound/JDK13Services.java
+3
-13
src/share/classes/com/sun/media/sound/JSSecurityManager.java
src/share/classes/com/sun/media/sound/JSSecurityManager.java
+4
-99
src/share/classes/com/sun/media/sound/JavaSoundAudioClip.java
...share/classes/com/sun/media/sound/JavaSoundAudioClip.java
+3
-9
src/share/classes/com/sun/media/sound/MidiDeviceReceiverEnvelope.java
...asses/com/sun/media/sound/MidiDeviceReceiverEnvelope.java
+2
-2
src/share/classes/com/sun/media/sound/MidiDeviceTransmitterEnvelope.java
...es/com/sun/media/sound/MidiDeviceTransmitterEnvelope.java
+2
-2
src/share/classes/com/sun/media/sound/MidiInDevice.java
src/share/classes/com/sun/media/sound/MidiInDevice.java
+3
-6
src/share/classes/com/sun/media/sound/MidiInDeviceProvider.java
...are/classes/com/sun/media/sound/MidiInDeviceProvider.java
+7
-8
src/share/classes/com/sun/media/sound/MidiOutDevice.java
src/share/classes/com/sun/media/sound/MidiOutDevice.java
+3
-3
src/share/classes/com/sun/media/sound/MidiOutDeviceProvider.java
...re/classes/com/sun/media/sound/MidiOutDeviceProvider.java
+7
-8
src/share/classes/com/sun/media/sound/MidiUtils.java
src/share/classes/com/sun/media/sound/MidiUtils.java
+8
-3
src/share/classes/com/sun/media/sound/ModelByteBuffer.java
src/share/classes/com/sun/media/sound/ModelByteBuffer.java
+4
-4
src/share/classes/com/sun/media/sound/ModelByteBufferWavetable.java
...classes/com/sun/media/sound/ModelByteBufferWavetable.java
+6
-6
src/share/classes/com/sun/media/sound/ModelConnectionBlock.java
...are/classes/com/sun/media/sound/ModelConnectionBlock.java
+2
-2
src/share/classes/com/sun/media/sound/ModelDestination.java
src/share/classes/com/sun/media/sound/ModelDestination.java
+2
-2
src/share/classes/com/sun/media/sound/ModelIdentifier.java
src/share/classes/com/sun/media/sound/ModelIdentifier.java
+2
-2
src/share/classes/com/sun/media/sound/ModelInstrument.java
src/share/classes/com/sun/media/sound/ModelInstrument.java
+4
-4
src/share/classes/com/sun/media/sound/ModelInstrumentComparator.java
...lasses/com/sun/media/sound/ModelInstrumentComparator.java
+2
-2
src/share/classes/com/sun/media/sound/ModelMappedInstrument.java
...re/classes/com/sun/media/sound/ModelMappedInstrument.java
+3
-3
src/share/classes/com/sun/media/sound/ModelPatch.java
src/share/classes/com/sun/media/sound/ModelPatch.java
+2
-2
src/share/classes/com/sun/media/sound/ModelPerformer.java
src/share/classes/com/sun/media/sound/ModelPerformer.java
+3
-3
src/share/classes/com/sun/media/sound/ModelSource.java
src/share/classes/com/sun/media/sound/ModelSource.java
+2
-2
src/share/classes/com/sun/media/sound/ModelStandardDirector.java
...re/classes/com/sun/media/sound/ModelStandardDirector.java
+2
-2
src/share/classes/com/sun/media/sound/ModelStandardIndexedDirector.java
...ses/com/sun/media/sound/ModelStandardIndexedDirector.java
+2
-2
src/share/classes/com/sun/media/sound/ModelStandardTransform.java
...e/classes/com/sun/media/sound/ModelStandardTransform.java
+2
-2
src/share/classes/com/sun/media/sound/PCMtoPCMCodec.java
src/share/classes/com/sun/media/sound/PCMtoPCMCodec.java
+4
-6
src/share/classes/com/sun/media/sound/Platform.java
src/share/classes/com/sun/media/sound/Platform.java
+20
-5
src/share/classes/com/sun/media/sound/PortMixer.java
src/share/classes/com/sun/media/sound/PortMixer.java
+15
-13
src/share/classes/com/sun/media/sound/PortMixerProvider.java
src/share/classes/com/sun/media/sound/PortMixerProvider.java
+25
-21
src/share/classes/com/sun/media/sound/Printer.java
src/share/classes/com/sun/media/sound/Printer.java
+8
-2
src/share/classes/com/sun/media/sound/RIFFInvalidDataException.java
...classes/com/sun/media/sound/RIFFInvalidDataException.java
+2
-2
src/share/classes/com/sun/media/sound/RIFFInvalidFormatException.java
...asses/com/sun/media/sound/RIFFInvalidFormatException.java
+2
-2
src/share/classes/com/sun/media/sound/RIFFReader.java
src/share/classes/com/sun/media/sound/RIFFReader.java
+4
-4
src/share/classes/com/sun/media/sound/RIFFWriter.java
src/share/classes/com/sun/media/sound/RIFFWriter.java
+8
-8
src/share/classes/com/sun/media/sound/RealTimeSequencer.java
src/share/classes/com/sun/media/sound/RealTimeSequencer.java
+43
-35
src/share/classes/com/sun/media/sound/RealTimeSequencerProvider.java
...lasses/com/sun/media/sound/RealTimeSequencerProvider.java
+2
-2
src/share/classes/com/sun/media/sound/SF2GlobalRegion.java
src/share/classes/com/sun/media/sound/SF2GlobalRegion.java
+2
-2
src/share/classes/com/sun/media/sound/SF2Instrument.java
src/share/classes/com/sun/media/sound/SF2Instrument.java
+12
-12
src/share/classes/com/sun/media/sound/SF2InstrumentRegion.java
...hare/classes/com/sun/media/sound/SF2InstrumentRegion.java
+3
-3
src/share/classes/com/sun/media/sound/SF2Layer.java
src/share/classes/com/sun/media/sound/SF2Layer.java
+5
-5
src/share/classes/com/sun/media/sound/SF2LayerRegion.java
src/share/classes/com/sun/media/sound/SF2LayerRegion.java
+3
-3
src/share/classes/com/sun/media/sound/SF2Modulator.java
src/share/classes/com/sun/media/sound/SF2Modulator.java
+7
-7
src/share/classes/com/sun/media/sound/SF2Sample.java
src/share/classes/com/sun/media/sound/SF2Sample.java
+13
-13
src/share/classes/com/sun/media/sound/SF2Soundbank.java
src/share/classes/com/sun/media/sound/SF2Soundbank.java
+18
-18
src/share/classes/com/sun/media/sound/SF2SoundbankReader.java
...share/classes/com/sun/media/sound/SF2SoundbankReader.java
+2
-2
src/share/classes/com/sun/media/sound/SoftAbstractResampler.java
...re/classes/com/sun/media/sound/SoftAbstractResampler.java
+3
-3
src/share/classes/com/sun/media/sound/SoftAudioBuffer.java
src/share/classes/com/sun/media/sound/SoftAudioBuffer.java
+2
-2
src/share/classes/com/sun/media/sound/SoftAudioPusher.java
src/share/classes/com/sun/media/sound/SoftAudioPusher.java
+4
-4
src/share/classes/com/sun/media/sound/SoftChannel.java
src/share/classes/com/sun/media/sound/SoftChannel.java
+22
-22
src/share/classes/com/sun/media/sound/SoftChannelProxy.java
src/share/classes/com/sun/media/sound/SoftChannelProxy.java
+2
-2
src/share/classes/com/sun/media/sound/SoftChorus.java
src/share/classes/com/sun/media/sound/SoftChorus.java
+7
-7
src/share/classes/com/sun/media/sound/SoftCubicResampler.java
...share/classes/com/sun/media/sound/SoftCubicResampler.java
+2
-2
src/share/classes/com/sun/media/sound/SoftEnvelopeGenerator.java
...re/classes/com/sun/media/sound/SoftEnvelopeGenerator.java
+19
-19
src/share/classes/com/sun/media/sound/SoftFilter.java
src/share/classes/com/sun/media/sound/SoftFilter.java
+3
-3
src/share/classes/com/sun/media/sound/SoftInstrument.java
src/share/classes/com/sun/media/sound/SoftInstrument.java
+4
-4
src/share/classes/com/sun/media/sound/SoftJitterCorrector.java
...hare/classes/com/sun/media/sound/SoftJitterCorrector.java
+4
-4
src/share/classes/com/sun/media/sound/SoftLanczosResampler.java
...are/classes/com/sun/media/sound/SoftLanczosResampler.java
+2
-2
src/share/classes/com/sun/media/sound/SoftLimiter.java
src/share/classes/com/sun/media/sound/SoftLimiter.java
+2
-2
src/share/classes/com/sun/media/sound/SoftLinearResampler.java
...hare/classes/com/sun/media/sound/SoftLinearResampler.java
+2
-2
src/share/classes/com/sun/media/sound/SoftLinearResampler2.java
...are/classes/com/sun/media/sound/SoftLinearResampler2.java
+2
-2
src/share/classes/com/sun/media/sound/SoftLowFrequencyOscillator.java
...asses/com/sun/media/sound/SoftLowFrequencyOscillator.java
+12
-12
src/share/classes/com/sun/media/sound/SoftMainMixer.java
src/share/classes/com/sun/media/sound/SoftMainMixer.java
+13
-13
src/share/classes/com/sun/media/sound/SoftMidiAudioFileReader.java
.../classes/com/sun/media/sound/SoftMidiAudioFileReader.java
+2
-2
src/share/classes/com/sun/media/sound/SoftMixingClip.java
src/share/classes/com/sun/media/sound/SoftMixingClip.java
+4
-4
src/share/classes/com/sun/media/sound/SoftMixingDataLine.java
...share/classes/com/sun/media/sound/SoftMixingDataLine.java
+44
-44
src/share/classes/com/sun/media/sound/SoftMixingMainMixer.java
...hare/classes/com/sun/media/sound/SoftMixingMainMixer.java
+17
-17
src/share/classes/com/sun/media/sound/SoftMixingMixer.java
src/share/classes/com/sun/media/sound/SoftMixingMixer.java
+17
-17
src/share/classes/com/sun/media/sound/SoftMixingMixerProvider.java
.../classes/com/sun/media/sound/SoftMixingMixerProvider.java
+3
-3
src/share/classes/com/sun/media/sound/SoftMixingSourceDataLine.java
...classes/com/sun/media/sound/SoftMixingSourceDataLine.java
+5
-5
src/share/classes/com/sun/media/sound/SoftPerformer.java
src/share/classes/com/sun/media/sound/SoftPerformer.java
+2
-2
src/share/classes/com/sun/media/sound/SoftPointResampler.java
...share/classes/com/sun/media/sound/SoftPointResampler.java
+2
-2
src/share/classes/com/sun/media/sound/SoftProvider.java
src/share/classes/com/sun/media/sound/SoftProvider.java
+4
-4
src/share/classes/com/sun/media/sound/SoftReceiver.java
src/share/classes/com/sun/media/sound/SoftReceiver.java
+7
-7
src/share/classes/com/sun/media/sound/SoftReverb.java
src/share/classes/com/sun/media/sound/SoftReverb.java
+5
-5
src/share/classes/com/sun/media/sound/SoftShortMessage.java
src/share/classes/com/sun/media/sound/SoftShortMessage.java
+2
-2
src/share/classes/com/sun/media/sound/SoftSincResampler.java
src/share/classes/com/sun/media/sound/SoftSincResampler.java
+2
-2
src/share/classes/com/sun/media/sound/SoftSynthesizer.java
src/share/classes/com/sun/media/sound/SoftSynthesizer.java
+30
-30
src/share/classes/com/sun/media/sound/SoftTuning.java
src/share/classes/com/sun/media/sound/SoftTuning.java
+3
-3
src/share/classes/com/sun/media/sound/SoftVoice.java
src/share/classes/com/sun/media/sound/SoftVoice.java
+67
-67
src/share/classes/com/sun/media/sound/StandardMidiFileReader.java
...e/classes/com/sun/media/sound/StandardMidiFileReader.java
+4
-25
src/share/classes/com/sun/media/sound/StandardMidiFileWriter.java
...e/classes/com/sun/media/sound/StandardMidiFileWriter.java
+2
-8
src/share/classes/com/sun/media/sound/SunCodec.java
src/share/classes/com/sun/media/sound/SunCodec.java
+7
-11
src/share/classes/com/sun/media/sound/SunFileReader.java
src/share/classes/com/sun/media/sound/SunFileReader.java
+15
-18
src/share/classes/com/sun/media/sound/SunFileWriter.java
src/share/classes/com/sun/media/sound/SunFileWriter.java
+8
-9
src/share/classes/com/sun/media/sound/Toolkit.java
src/share/classes/com/sun/media/sound/Toolkit.java
+7
-2
src/share/classes/com/sun/media/sound/UlawCodec.java
src/share/classes/com/sun/media/sound/UlawCodec.java
+4
-5
src/share/classes/com/sun/media/sound/WaveExtensibleFileReader.java
...classes/com/sun/media/sound/WaveExtensibleFileReader.java
+7
-7
src/share/classes/com/sun/media/sound/WaveFileFormat.java
src/share/classes/com/sun/media/sound/WaveFileFormat.java
+3
-19
src/share/classes/com/sun/media/sound/WaveFileReader.java
src/share/classes/com/sun/media/sound/WaveFileReader.java
+7
-27
src/share/classes/com/sun/media/sound/WaveFileWriter.java
src/share/classes/com/sun/media/sound/WaveFileWriter.java
+3
-11
src/share/classes/com/sun/media/sound/WaveFloatFileReader.java
...hare/classes/com/sun/media/sound/WaveFloatFileReader.java
+2
-2
src/share/classes/com/sun/media/sound/WaveFloatFileWriter.java
...hare/classes/com/sun/media/sound/WaveFloatFileWriter.java
+4
-4
src/share/classes/javax/sound/midi/MetaMessage.java
src/share/classes/javax/sound/midi/MetaMessage.java
+3
-15
src/share/classes/javax/sound/sampled/Mixer.java
src/share/classes/javax/sound/sampled/Mixer.java
+4
-4
src/share/classes/sun/audio/AudioData.java
src/share/classes/sun/audio/AudioData.java
+2
-2
src/share/classes/sun/audio/AudioDataStream.java
src/share/classes/sun/audio/AudioDataStream.java
+4
-6
src/share/classes/sun/audio/AudioDevice.java
src/share/classes/sun/audio/AudioDevice.java
+6
-10
src/share/classes/sun/audio/AudioPlayer.java
src/share/classes/sun/audio/AudioPlayer.java
+4
-11
src/share/classes/sun/audio/AudioStream.java
src/share/classes/sun/audio/AudioStream.java
+6
-8
src/share/classes/sun/audio/AudioStreamSequence.java
src/share/classes/sun/audio/AudioStreamSequence.java
+3
-4
src/share/classes/sun/audio/AudioTranslatorStream.java
src/share/classes/sun/audio/AudioTranslatorStream.java
+3
-6
src/share/classes/sun/audio/ContinuousAudioDataStream.java
src/share/classes/sun/audio/ContinuousAudioDataStream.java
+3
-4
src/share/classes/sun/audio/InvalidAudioFormatException.java
src/share/classes/sun/audio/InvalidAudioFormatException.java
+4
-4
未找到文件。
src/share/classes/com/sun/media/sound/AbstractDataLine.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 1999, 20
07
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 20
13
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -25,15 +25,12 @@
...
@@ -25,15 +25,12 @@
package
com.sun.media.sound
;
package
com.sun.media.sound
;
import
java.util.Vector
;
import
javax.sound.sampled.AudioFormat
;
import
javax.sound.sampled.AudioFormat
;
import
javax.sound.sampled.AudioSystem
;
import
javax.sound.sampled.AudioSystem
;
import
javax.sound.sampled.Control
;
import
javax.sound.sampled.Control
;
import
javax.sound.sampled.DataLine
;
import
javax.sound.sampled.DataLine
;
import
javax.sound.sampled.LineEvent
;
import
javax.sound.sampled.LineEvent
;
import
javax.sound.sampled.LineUnavailableException
;
import
javax.sound.sampled.LineUnavailableException
;
import
javax.sound.sampled.Mixer
;
/**
/**
...
@@ -46,13 +43,13 @@ abstract class AbstractDataLine extends AbstractLine implements DataLine {
...
@@ -46,13 +43,13 @@ abstract class AbstractDataLine extends AbstractLine implements DataLine {
// DEFAULTS
// DEFAULTS
// default format
// default format
pr
otected
/*final*/
AudioFormat
defaultFormat
;
pr
ivate
final
AudioFormat
defaultFormat
;
// default buffer size in bytes
// default buffer size in bytes
pr
otected
/*final*/
int
defaultBufferSize
;
pr
ivate
final
int
defaultBufferSize
;
// the lock for synchronization
// the lock for synchronization
protected
Object
lock
=
new
Object
();
protected
final
Object
lock
=
new
Object
();
// STATE
// STATE
...
@@ -103,7 +100,7 @@ abstract class AbstractDataLine extends AbstractLine implements DataLine {
...
@@ -103,7 +100,7 @@ abstract class AbstractDataLine extends AbstractLine implements DataLine {
// DATA LINE METHODS
// DATA LINE METHODS
public
void
open
(
AudioFormat
format
,
int
bufferSize
)
throws
LineUnavailableException
{
public
final
void
open
(
AudioFormat
format
,
int
bufferSize
)
throws
LineUnavailableException
{
//$$fb 2001-10-09: Bug #4517739: avoiding deadlock by synchronizing to mixer !
//$$fb 2001-10-09: Bug #4517739: avoiding deadlock by synchronizing to mixer !
synchronized
(
mixer
)
{
synchronized
(
mixer
)
{
if
(
Printer
.
trace
)
Printer
.
trace
(
"> AbstractDataLine.open(format, bufferSize) (class: "
+
getClass
().
getName
());
if
(
Printer
.
trace
)
Printer
.
trace
(
"> AbstractDataLine.open(format, bufferSize) (class: "
+
getClass
().
getName
());
...
@@ -152,7 +149,7 @@ abstract class AbstractDataLine extends AbstractLine implements DataLine {
...
@@ -152,7 +149,7 @@ abstract class AbstractDataLine extends AbstractLine implements DataLine {
}
}
public
void
open
(
AudioFormat
format
)
throws
LineUnavailableException
{
public
final
void
open
(
AudioFormat
format
)
throws
LineUnavailableException
{
open
(
format
,
AudioSystem
.
NOT_SPECIFIED
);
open
(
format
,
AudioSystem
.
NOT_SPECIFIED
);
}
}
...
@@ -181,7 +178,7 @@ abstract class AbstractDataLine extends AbstractLine implements DataLine {
...
@@ -181,7 +178,7 @@ abstract class AbstractDataLine extends AbstractLine implements DataLine {
}
}
public
void
start
()
{
public
final
void
start
()
{
//$$fb 2001-10-09: Bug #4517739: avoiding deadlock by synchronizing to mixer !
//$$fb 2001-10-09: Bug #4517739: avoiding deadlock by synchronizing to mixer !
synchronized
(
mixer
)
{
synchronized
(
mixer
)
{
if
(
Printer
.
trace
)
Printer
.
trace
(
"> "
+
getClass
().
getName
()+
".start() - AbstractDataLine"
);
if
(
Printer
.
trace
)
Printer
.
trace
(
"> "
+
getClass
().
getName
()+
".start() - AbstractDataLine"
);
...
@@ -205,7 +202,7 @@ abstract class AbstractDataLine extends AbstractLine implements DataLine {
...
@@ -205,7 +202,7 @@ abstract class AbstractDataLine extends AbstractLine implements DataLine {
}
}
public
void
stop
()
{
public
final
void
stop
()
{
//$$fb 2001-10-09: Bug #4517739: avoiding deadlock by synchronizing to mixer !
//$$fb 2001-10-09: Bug #4517739: avoiding deadlock by synchronizing to mixer !
synchronized
(
mixer
)
{
synchronized
(
mixer
)
{
...
@@ -249,16 +246,16 @@ abstract class AbstractDataLine extends AbstractLine implements DataLine {
...
@@ -249,16 +246,16 @@ abstract class AbstractDataLine extends AbstractLine implements DataLine {
// in MixerSourceLine and MixerClip, and I want to touch as little
// in MixerSourceLine and MixerClip, and I want to touch as little
// code as possible to change isStarted() back to isRunning().
// code as possible to change isStarted() back to isRunning().
public
boolean
isRunning
()
{
public
final
boolean
isRunning
()
{
return
started
;
return
started
;
}
}
public
boolean
isActive
()
{
public
final
boolean
isActive
()
{
return
active
;
return
active
;
}
}
public
long
getMicrosecondPosition
()
{
public
final
long
getMicrosecondPosition
()
{
long
microseconds
=
getLongFramePosition
();
long
microseconds
=
getLongFramePosition
();
if
(
microseconds
!=
AudioSystem
.
NOT_SPECIFIED
)
{
if
(
microseconds
!=
AudioSystem
.
NOT_SPECIFIED
)
{
...
@@ -268,26 +265,26 @@ abstract class AbstractDataLine extends AbstractLine implements DataLine {
...
@@ -268,26 +265,26 @@ abstract class AbstractDataLine extends AbstractLine implements DataLine {
}
}
public
AudioFormat
getFormat
()
{
public
final
AudioFormat
getFormat
()
{
return
format
;
return
format
;
}
}
public
int
getBufferSize
()
{
public
final
int
getBufferSize
()
{
return
bufferSize
;
return
bufferSize
;
}
}
/**
/**
* This implementation does NOT change the buffer size
* This implementation does NOT change the buffer size
*/
*/
public
int
setBufferSize
(
int
newSize
)
{
public
final
int
setBufferSize
(
int
newSize
)
{
return
getBufferSize
();
return
getBufferSize
();
}
}
/**
/**
* This implementation returns AudioSystem.NOT_SPECIFIED.
* This implementation returns AudioSystem.NOT_SPECIFIED.
*/
*/
public
float
getLevel
()
{
public
f
inal
f
loat
getLevel
()
{
return
(
float
)
AudioSystem
.
NOT_SPECIFIED
;
return
(
float
)
AudioSystem
.
NOT_SPECIFIED
;
}
}
...
@@ -304,7 +301,7 @@ abstract class AbstractDataLine extends AbstractLine implements DataLine {
...
@@ -304,7 +301,7 @@ abstract class AbstractDataLine extends AbstractLine implements DataLine {
// it to isStartedRunning(). This is part of backing out the
// it to isStartedRunning(). This is part of backing out the
// change denied in RFE 4297981.
// change denied in RFE 4297981.
protected
boolean
isStartedRunning
()
{
final
boolean
isStartedRunning
()
{
return
running
;
return
running
;
}
}
...
@@ -312,7 +309,7 @@ abstract class AbstractDataLine extends AbstractLine implements DataLine {
...
@@ -312,7 +309,7 @@ abstract class AbstractDataLine extends AbstractLine implements DataLine {
* This method sets the active state and generates
* This method sets the active state and generates
* events if it changes.
* events if it changes.
*/
*/
protected
void
setActive
(
boolean
active
)
{
final
void
setActive
(
boolean
active
)
{
if
(
Printer
.
trace
)
Printer
.
trace
(
"> AbstractDataLine: setActive("
+
active
+
")"
);
if
(
Printer
.
trace
)
Printer
.
trace
(
"> AbstractDataLine: setActive("
+
active
+
")"
);
...
@@ -351,7 +348,7 @@ abstract class AbstractDataLine extends AbstractLine implements DataLine {
...
@@ -351,7 +348,7 @@ abstract class AbstractDataLine extends AbstractLine implements DataLine {
* This method sets the started state and generates
* This method sets the started state and generates
* events if it changes.
* events if it changes.
*/
*/
protected
void
setStarted
(
boolean
started
)
{
final
void
setStarted
(
boolean
started
)
{
if
(
Printer
.
trace
)
Printer
.
trace
(
"> AbstractDataLine: setStarted("
+
started
+
")"
);
if
(
Printer
.
trace
)
Printer
.
trace
(
"> AbstractDataLine: setStarted("
+
started
+
")"
);
...
@@ -388,7 +385,7 @@ abstract class AbstractDataLine extends AbstractLine implements DataLine {
...
@@ -388,7 +385,7 @@ abstract class AbstractDataLine extends AbstractLine implements DataLine {
* This method generates a STOP event and sets the started state to false.
* This method generates a STOP event and sets the started state to false.
* It is here for historic reasons when an EOM event existed.
* It is here for historic reasons when an EOM event existed.
*/
*/
protected
void
setEOM
()
{
final
void
setEOM
()
{
if
(
Printer
.
trace
)
Printer
.
trace
(
"> AbstractDataLine: setEOM()"
);
if
(
Printer
.
trace
)
Printer
.
trace
(
"> AbstractDataLine: setEOM()"
);
//$$fb 2002-04-21: sometimes, 2 STOP events are generated.
//$$fb 2002-04-21: sometimes, 2 STOP events are generated.
...
@@ -408,7 +405,7 @@ abstract class AbstractDataLine extends AbstractLine implements DataLine {
...
@@ -408,7 +405,7 @@ abstract class AbstractDataLine extends AbstractLine implements DataLine {
* line is open, this should return quietly because the values
* line is open, this should return quietly because the values
* requested will match the current ones.
* requested will match the current ones.
*/
*/
public
void
open
()
throws
LineUnavailableException
{
public
final
void
open
()
throws
LineUnavailableException
{
if
(
Printer
.
trace
)
Printer
.
trace
(
"> "
+
getClass
().
getName
()+
".open() - AbstractDataLine"
);
if
(
Printer
.
trace
)
Printer
.
trace
(
"> "
+
getClass
().
getName
()+
".open() - AbstractDataLine"
);
...
@@ -422,7 +419,7 @@ abstract class AbstractDataLine extends AbstractLine implements DataLine {
...
@@ -422,7 +419,7 @@ abstract class AbstractDataLine extends AbstractLine implements DataLine {
* This should also stop the line. The closed line should not be running or active.
* This should also stop the line. The closed line should not be running or active.
* After we close the line, we reset the format and buffer size to the defaults.
* After we close the line, we reset the format and buffer size to the defaults.
*/
*/
public
void
close
()
{
public
final
void
close
()
{
//$$fb 2001-10-09: Bug #4517739: avoiding deadlock by synchronizing to mixer !
//$$fb 2001-10-09: Bug #4517739: avoiding deadlock by synchronizing to mixer !
synchronized
(
mixer
)
{
synchronized
(
mixer
)
{
if
(
Printer
.
trace
)
Printer
.
trace
(
"> "
+
getClass
().
getName
()+
".close() - in AbstractDataLine."
);
if
(
Printer
.
trace
)
Printer
.
trace
(
"> "
+
getClass
().
getName
()+
".close() - in AbstractDataLine."
);
...
...
src/share/classes/com/sun/media/sound/AbstractLine.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 1999, 20
07
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 20
13
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -25,11 +25,12 @@
...
@@ -25,11 +25,12 @@
package
com.sun.media.sound
;
package
com.sun.media.sound
;
import
java.util.Map
;
import
java.util.Vector
;
import
java.util.Vector
;
import
java.util.WeakHashMap
;
import
javax.sound.sampled.AudioSystem
;
import
javax.sound.sampled.AudioSystem
;
import
javax.sound.sampled.Control
;
import
javax.sound.sampled.Control
;
import
javax.sound.sampled.Mixer
;
import
javax.sound.sampled.Line
;
import
javax.sound.sampled.Line
;
import
javax.sound.sampled.LineEvent
;
import
javax.sound.sampled.LineEvent
;
import
javax.sound.sampled.LineListener
;
import
javax.sound.sampled.LineListener
;
...
@@ -43,28 +44,17 @@ import javax.sound.sampled.LineUnavailableException;
...
@@ -43,28 +44,17 @@ import javax.sound.sampled.LineUnavailableException;
*/
*/
abstract
class
AbstractLine
implements
Line
{
abstract
class
AbstractLine
implements
Line
{
protected
Line
.
Info
info
;
protected
final
Line
.
Info
info
;
protected
Control
[]
controls
;
protected
Control
[]
controls
;
protected
AbstractMixer
mixer
;
AbstractMixer
mixer
;
private
boolean
open
=
false
;
private
boolean
open
=
false
;
private
Vector
listeners
=
new
Vector
();
private
final
Vector
listeners
=
new
Vector
();
/**
/**
*
Global event thread
*
Contains event dispatcher per thread group.
*/
*/
private
static
final
EventDispatcher
eventDispatcher
;
private
static
final
Map
<
ThreadGroup
,
EventDispatcher
>
dispatchers
=
new
WeakHashMap
<>();
static
{
// create and start the global event thread
// $$kk: 12.21.98:
// 1) probably don't want a single global event queue
// 2) need a way to stop this thread when the engine is done
eventDispatcher
=
new
EventDispatcher
();
eventDispatcher
.
start
();
}
/**
/**
* Constructs a new AbstractLine.
* Constructs a new AbstractLine.
...
@@ -85,18 +75,17 @@ abstract class AbstractLine implements Line {
...
@@ -85,18 +75,17 @@ abstract class AbstractLine implements Line {
// LINE METHODS
// LINE METHODS
public
Line
.
Info
getLineInfo
()
{
public
final
Line
.
Info
getLineInfo
()
{
return
info
;
return
info
;
}
}
public
boolean
isOpen
()
{
public
final
boolean
isOpen
()
{
return
open
;
return
open
;
}
}
public
void
addLineListener
(
LineListener
listener
)
{
public
final
void
addLineListener
(
LineListener
listener
)
{
synchronized
(
listeners
)
{
synchronized
(
listeners
)
{
if
(
!
(
listeners
.
contains
(
listener
))
)
{
if
(
!
(
listeners
.
contains
(
listener
))
)
{
listeners
.
addElement
(
listener
);
listeners
.
addElement
(
listener
);
...
@@ -109,7 +98,7 @@ abstract class AbstractLine implements Line {
...
@@ -109,7 +98,7 @@ abstract class AbstractLine implements Line {
* Removes an audio listener.
* Removes an audio listener.
* @param listener listener to remove
* @param listener listener to remove
*/
*/
public
void
removeLineListener
(
LineListener
listener
)
{
public
final
void
removeLineListener
(
LineListener
listener
)
{
listeners
.
removeElement
(
listener
);
listeners
.
removeElement
(
listener
);
}
}
...
@@ -120,8 +109,7 @@ abstract class AbstractLine implements Line {
...
@@ -120,8 +109,7 @@ abstract class AbstractLine implements Line {
* array of length 0.
* array of length 0.
* @return control set
* @return control set
*/
*/
public
Control
[]
getControls
()
{
public
final
Control
[]
getControls
()
{
Control
[]
returnedArray
=
new
Control
[
controls
.
length
];
Control
[]
returnedArray
=
new
Control
[
controls
.
length
];
for
(
int
i
=
0
;
i
<
controls
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
controls
.
length
;
i
++)
{
...
@@ -132,8 +120,7 @@ abstract class AbstractLine implements Line {
...
@@ -132,8 +120,7 @@ abstract class AbstractLine implements Line {
}
}
public
boolean
isControlSupported
(
Control
.
Type
controlType
)
{
public
final
boolean
isControlSupported
(
Control
.
Type
controlType
)
{
// protect against a NullPointerException
// protect against a NullPointerException
if
(
controlType
==
null
)
{
if
(
controlType
==
null
)
{
return
false
;
return
false
;
...
@@ -149,8 +136,7 @@ abstract class AbstractLine implements Line {
...
@@ -149,8 +136,7 @@ abstract class AbstractLine implements Line {
}
}
public
Control
getControl
(
Control
.
Type
controlType
)
{
public
final
Control
getControl
(
Control
.
Type
controlType
)
{
// protect against a NullPointerException
// protect against a NullPointerException
if
(
controlType
!=
null
)
{
if
(
controlType
!=
null
)
{
...
@@ -172,7 +158,7 @@ abstract class AbstractLine implements Line {
...
@@ -172,7 +158,7 @@ abstract class AbstractLine implements Line {
* This method sets the open state and generates
* This method sets the open state and generates
* events if it changes.
* events if it changes.
*/
*/
protected
void
setOpen
(
boolean
open
)
{
final
void
setOpen
(
boolean
open
)
{
if
(
Printer
.
trace
)
Printer
.
trace
(
"> "
+
getClass
().
getName
()+
" (AbstractLine): setOpen("
+
open
+
") this.open: "
+
this
.
open
);
if
(
Printer
.
trace
)
Printer
.
trace
(
"> "
+
getClass
().
getName
()+
" (AbstractLine): setOpen("
+
open
+
") this.open: "
+
this
.
open
);
...
@@ -200,8 +186,8 @@ abstract class AbstractLine implements Line {
...
@@ -200,8 +186,8 @@ abstract class AbstractLine implements Line {
/**
/**
* Send line events.
* Send line events.
*/
*/
protected
void
sendEvents
(
LineEvent
event
)
{
final
void
sendEvents
(
LineEvent
event
)
{
eventDispatcher
.
sendAudioEvents
(
event
,
listeners
);
getEventDispatcher
()
.
sendAudioEvents
(
event
,
listeners
);
}
}
...
@@ -227,12 +213,23 @@ abstract class AbstractLine implements Line {
...
@@ -227,12 +213,23 @@ abstract class AbstractLine implements Line {
// $$kk: 06.03.99: returns the mixer used in construction.
// $$kk: 06.03.99: returns the mixer used in construction.
// this is a hold-over from when there was a public method like
// this is a hold-over from when there was a public method like
// this on line and should be fixed!!
// this on line and should be fixed!!
protected
AbstractMixer
getMixer
()
{
final
AbstractMixer
getMixer
()
{
return
mixer
;
return
mixer
;
}
}
protected
EventDispatcher
getEventDispatcher
()
{
final
EventDispatcher
getEventDispatcher
()
{
return
eventDispatcher
;
// create and start the global event thread
//TODO need a way to stop this thread when the engine is done
final
ThreadGroup
tg
=
Thread
.
currentThread
().
getThreadGroup
();
synchronized
(
dispatchers
)
{
EventDispatcher
eventDispatcher
=
dispatchers
.
get
(
tg
);
if
(
eventDispatcher
==
null
)
{
eventDispatcher
=
new
EventDispatcher
();
dispatchers
.
put
(
tg
,
eventDispatcher
);
eventDispatcher
.
start
();
}
return
eventDispatcher
;
}
}
}
// ABSTRACT METHODS
// ABSTRACT METHODS
...
...
src/share/classes/com/sun/media/sound/AbstractMidiDevice.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 1999, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -60,12 +60,12 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
...
@@ -60,12 +60,12 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
// DEVICE ATTRIBUTES
// DEVICE ATTRIBUTES
private
MidiDevice
.
Info
info
;
private
final
MidiDevice
.
Info
info
;
// DEVICE STATE
// DEVICE STATE
pr
otected
/*private*/
boolean
open
=
false
;
pr
ivate
boolean
open
=
false
;
private
int
openRefCount
;
private
int
openRefCount
;
/** List of Receivers and Transmitters that opened the device implicitely.
/** List of Receivers and Transmitters that opened the device implicitely.
...
@@ -102,7 +102,7 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
...
@@ -102,7 +102,7 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
// MIDI DEVICE METHODS
// MIDI DEVICE METHODS
public
MidiDevice
.
Info
getDeviceInfo
()
{
public
final
MidiDevice
.
Info
getDeviceInfo
()
{
return
info
;
return
info
;
}
}
...
@@ -111,7 +111,7 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
...
@@ -111,7 +111,7 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
* opened the the device implicitly from closing it. The only way to close the device after
* opened the the device implicitly from closing it. The only way to close the device after
* this call is a call to close().
* this call is a call to close().
*/
*/
public
void
open
()
throws
MidiUnavailableException
{
public
final
void
open
()
throws
MidiUnavailableException
{
if
(
Printer
.
trace
)
Printer
.
trace
(
"> AbstractMidiDevice: open()"
);
if
(
Printer
.
trace
)
Printer
.
trace
(
"> AbstractMidiDevice: open()"
);
synchronized
(
this
)
{
synchronized
(
this
)
{
openRefCount
=
-
1
;
openRefCount
=
-
1
;
...
@@ -159,7 +159,7 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
...
@@ -159,7 +159,7 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
}
}
public
void
close
()
{
public
final
void
close
()
{
if
(
Printer
.
trace
)
Printer
.
trace
(
"> AbstractMidiDevice: close()"
);
if
(
Printer
.
trace
)
Printer
.
trace
(
"> AbstractMidiDevice: close()"
);
synchronized
(
this
)
{
synchronized
(
this
)
{
doClose
();
doClose
();
...
@@ -181,7 +181,7 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
...
@@ -181,7 +181,7 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
* @param object The object that might have been opening the device implicitely (for now,
* @param object The object that might have been opening the device implicitely (for now,
* this may be a Transmitter or receiver).
* this may be a Transmitter or receiver).
*/
*/
public
void
closeInternal
(
Object
object
)
{
public
final
void
closeInternal
(
Object
object
)
{
if
(
Printer
.
trace
)
Printer
.
trace
(
"> AbstractMidiDevice: closeInternal()"
);
if
(
Printer
.
trace
)
Printer
.
trace
(
"> AbstractMidiDevice: closeInternal()"
);
synchronized
(
this
)
{
synchronized
(
this
)
{
if
(
getOpenKeepingObjects
().
remove
(
object
))
{
if
(
getOpenKeepingObjects
().
remove
(
object
))
{
...
@@ -197,7 +197,7 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
...
@@ -197,7 +197,7 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
}
}
public
void
doClose
()
{
public
final
void
doClose
()
{
if
(
Printer
.
trace
)
Printer
.
trace
(
"> AbstractMidiDevice: doClose()"
);
if
(
Printer
.
trace
)
Printer
.
trace
(
"> AbstractMidiDevice: doClose()"
);
synchronized
(
this
)
{
synchronized
(
this
)
{
if
(
isOpen
())
{
if
(
isOpen
())
{
...
@@ -209,7 +209,7 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
...
@@ -209,7 +209,7 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
}
}
public
boolean
isOpen
()
{
public
final
boolean
isOpen
()
{
return
open
;
return
open
;
}
}
...
@@ -329,7 +329,7 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
...
@@ -329,7 +329,7 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
// HELPER METHODS
// HELPER METHODS
long
getId
()
{
final
long
getId
()
{
return
id
;
return
id
;
}
}
...
@@ -339,7 +339,8 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
...
@@ -339,7 +339,8 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
/** Retrieve a Receiver and open the device implicitly.
/** Retrieve a Receiver and open the device implicitly.
This method is called by MidiSystem.getReceiver().
This method is called by MidiSystem.getReceiver().
*/
*/
public
Receiver
getReceiverReferenceCounting
()
throws
MidiUnavailableException
{
public
final
Receiver
getReceiverReferenceCounting
()
throws
MidiUnavailableException
{
/* Keep this order of commands! If getReceiver() throws an exception,
/* Keep this order of commands! If getReceiver() throws an exception,
openInternal() should not be called!
openInternal() should not be called!
*/
*/
...
@@ -355,7 +356,8 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
...
@@ -355,7 +356,8 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
/** Retrieve a Transmitter and open the device implicitly.
/** Retrieve a Transmitter and open the device implicitly.
This method is called by MidiSystem.getTransmitter().
This method is called by MidiSystem.getTransmitter().
*/
*/
public
Transmitter
getTransmitterReferenceCounting
()
throws
MidiUnavailableException
{
public
final
Transmitter
getTransmitterReferenceCounting
()
throws
MidiUnavailableException
{
/* Keep this order of commands! If getTransmitter() throws an exception,
/* Keep this order of commands! If getTransmitter() throws an exception,
openInternal() should not be called!
openInternal() should not be called!
*/
*/
...
@@ -422,7 +424,7 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
...
@@ -422,7 +424,7 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
/** Return the internal list of Transmitters, possibly creating it first.
/** Return the internal list of Transmitters, possibly creating it first.
*/
*/
protected
TransmitterList
getTransmitterList
()
{
final
TransmitterList
getTransmitterList
()
{
synchronized
(
traRecLock
)
{
synchronized
(
traRecLock
)
{
if
(
transmitterList
==
null
)
{
if
(
transmitterList
==
null
)
{
transmitterList
=
new
TransmitterList
();
transmitterList
=
new
TransmitterList
();
...
@@ -462,7 +464,7 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
...
@@ -462,7 +464,7 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
/**
/**
* close this device if discarded by the garbage collector
* close this device if discarded by the garbage collector
*/
*/
protected
void
finalize
()
{
protected
final
void
finalize
()
{
close
();
close
();
}
}
...
@@ -534,7 +536,7 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
...
@@ -534,7 +536,7 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
* Also, it has some optimizations regarding sending to the Receivers,
* Also, it has some optimizations regarding sending to the Receivers,
* for known Receivers, and managing itself in the TransmitterList.
* for known Receivers, and managing itself in the TransmitterList.
*/
*/
protected
class
BasicTransmitter
implements
MidiDeviceTransmitter
{
class
BasicTransmitter
implements
MidiDeviceTransmitter
{
private
Receiver
receiver
=
null
;
private
Receiver
receiver
=
null
;
TransmitterList
tlist
=
null
;
TransmitterList
tlist
=
null
;
...
@@ -546,7 +548,7 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
...
@@ -546,7 +548,7 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
this
.
tlist
=
tlist
;
this
.
tlist
=
tlist
;
}
}
public
void
setReceiver
(
Receiver
receiver
)
{
public
final
void
setReceiver
(
Receiver
receiver
)
{
if
(
tlist
!=
null
&&
this
.
receiver
!=
receiver
)
{
if
(
tlist
!=
null
&&
this
.
receiver
!=
receiver
)
{
if
(
Printer
.
debug
)
Printer
.
debug
(
"Transmitter "
+
toString
()+
": set receiver "
+
receiver
);
if
(
Printer
.
debug
)
Printer
.
debug
(
"Transmitter "
+
toString
()+
": set receiver "
+
receiver
);
tlist
.
receiverChanged
(
this
,
this
.
receiver
,
receiver
);
tlist
.
receiverChanged
(
this
,
this
.
receiver
,
receiver
);
...
@@ -554,7 +556,7 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
...
@@ -554,7 +556,7 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
}
}
}
}
public
Receiver
getReceiver
()
{
public
final
Receiver
getReceiver
()
{
return
receiver
;
return
receiver
;
}
}
...
@@ -564,7 +566,7 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
...
@@ -564,7 +566,7 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
* Therefore, subclasses that override this method must call
* Therefore, subclasses that override this method must call
* 'super.close()'.
* 'super.close()'.
*/
*/
public
void
close
()
{
public
final
void
close
()
{
AbstractMidiDevice
.
this
.
closeInternal
(
this
);
AbstractMidiDevice
.
this
.
closeInternal
(
this
);
if
(
tlist
!=
null
)
{
if
(
tlist
!=
null
)
{
tlist
.
receiverChanged
(
this
,
this
.
receiver
,
null
);
tlist
.
receiverChanged
(
this
,
this
.
receiver
,
null
);
...
@@ -573,7 +575,7 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
...
@@ -573,7 +575,7 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
}
}
}
}
public
MidiDevice
getMidiDevice
()
{
public
final
MidiDevice
getMidiDevice
()
{
return
AbstractMidiDevice
.
this
;
return
AbstractMidiDevice
.
this
;
}
}
...
@@ -583,9 +585,9 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
...
@@ -583,9 +585,9 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
/**
/**
* a class to manage a list of transmitters
* a class to manage a list of transmitters
*/
*/
class
TransmitterList
{
final
class
TransmitterList
{
private
ArrayList
<
Transmitter
>
transmitters
=
new
ArrayList
<
Transmitter
>();
private
final
ArrayList
<
Transmitter
>
transmitters
=
new
ArrayList
<
Transmitter
>();
private
MidiOutDevice
.
MidiOutReceiver
midiOutReceiver
;
private
MidiOutDevice
.
MidiOutReceiver
midiOutReceiver
;
// how many transmitters must be present for optimized
// how many transmitters must be present for optimized
...
...
src/share/classes/com/sun/media/sound/AbstractMidiDeviceProvider.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2002, 20
07
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 20
13
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -36,7 +36,7 @@ import javax.sound.midi.spi.MidiDeviceProvider;
...
@@ -36,7 +36,7 @@ import javax.sound.midi.spi.MidiDeviceProvider;
*/
*/
public
abstract
class
AbstractMidiDeviceProvider
extends
MidiDeviceProvider
{
public
abstract
class
AbstractMidiDeviceProvider
extends
MidiDeviceProvider
{
private
static
boolean
enabled
;
private
static
final
boolean
enabled
;
/**
/**
* Create objects representing all MIDI output devices on the system.
* Create objects representing all MIDI output devices on the system.
...
@@ -52,7 +52,7 @@ public abstract class AbstractMidiDeviceProvider extends MidiDeviceProvider {
...
@@ -52,7 +52,7 @@ public abstract class AbstractMidiDeviceProvider extends MidiDeviceProvider {
}
}
synchronized
void
readDeviceInfos
()
{
final
synchronized
void
readDeviceInfos
()
{
Info
[]
infos
=
getInfoCache
();
Info
[]
infos
=
getInfoCache
();
MidiDevice
[]
devices
=
getDeviceCache
();
MidiDevice
[]
devices
=
getDeviceCache
();
if
(!
enabled
)
{
if
(!
enabled
)
{
...
@@ -118,7 +118,7 @@ public abstract class AbstractMidiDeviceProvider extends MidiDeviceProvider {
...
@@ -118,7 +118,7 @@ public abstract class AbstractMidiDeviceProvider extends MidiDeviceProvider {
}
}
public
MidiDevice
.
Info
[]
getDeviceInfo
()
{
public
final
MidiDevice
.
Info
[]
getDeviceInfo
()
{
readDeviceInfos
();
readDeviceInfos
();
Info
[]
infos
=
getInfoCache
();
Info
[]
infos
=
getInfoCache
();
MidiDevice
.
Info
[]
localArray
=
new
MidiDevice
.
Info
[
infos
.
length
];
MidiDevice
.
Info
[]
localArray
=
new
MidiDevice
.
Info
[
infos
.
length
];
...
@@ -127,7 +127,7 @@ public abstract class AbstractMidiDeviceProvider extends MidiDeviceProvider {
...
@@ -127,7 +127,7 @@ public abstract class AbstractMidiDeviceProvider extends MidiDeviceProvider {
}
}
public
MidiDevice
getDevice
(
MidiDevice
.
Info
info
)
{
public
final
MidiDevice
getDevice
(
MidiDevice
.
Info
info
)
{
if
(
info
instanceof
Info
)
{
if
(
info
instanceof
Info
)
{
readDeviceInfos
();
readDeviceInfos
();
MidiDevice
[]
devices
=
getDeviceCache
();
MidiDevice
[]
devices
=
getDeviceCache
();
...
@@ -164,7 +164,7 @@ public abstract class AbstractMidiDeviceProvider extends MidiDeviceProvider {
...
@@ -164,7 +164,7 @@ public abstract class AbstractMidiDeviceProvider extends MidiDeviceProvider {
this
.
index
=
index
;
this
.
index
=
index
;
}
}
boolean
equalStrings
(
Info
info
)
{
final
boolean
equalStrings
(
Info
info
)
{
return
(
info
!=
null
return
(
info
!=
null
&&
getName
().
equals
(
info
.
getName
())
&&
getName
().
equals
(
info
.
getName
())
&&
getVendor
().
equals
(
info
.
getVendor
())
&&
getVendor
().
equals
(
info
.
getVendor
())
...
@@ -172,11 +172,11 @@ public abstract class AbstractMidiDeviceProvider extends MidiDeviceProvider {
...
@@ -172,11 +172,11 @@ public abstract class AbstractMidiDeviceProvider extends MidiDeviceProvider {
&&
getVersion
().
equals
(
info
.
getVersion
()));
&&
getVersion
().
equals
(
info
.
getVersion
()));
}
}
int
getIndex
()
{
final
int
getIndex
()
{
return
index
;
return
index
;
}
}
void
setIndex
(
int
index
)
{
final
void
setIndex
(
int
index
)
{
this
.
index
=
index
;
this
.
index
=
index
;
}
}
...
...
src/share/classes/com/sun/media/sound/AbstractMixer.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 1999, 20
07
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 20
13
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -27,14 +27,9 @@ package com.sun.media.sound;
...
@@ -27,14 +27,9 @@ package com.sun.media.sound;
import
java.util.Vector
;
import
java.util.Vector
;
import
javax.sound.sampled.AudioFormat
;
import
javax.sound.sampled.AudioSystem
;
import
javax.sound.sampled.Control
;
import
javax.sound.sampled.Control
;
import
javax.sound.sampled.DataLine
;
import
javax.sound.sampled.Mixer
;
import
javax.sound.sampled.Mixer
;
import
javax.sound.sampled.Line
;
import
javax.sound.sampled.Line
;
import
javax.sound.sampled.LineEvent
;
import
javax.sound.sampled.LineListener
;
import
javax.sound.sampled.LineUnavailableException
;
import
javax.sound.sampled.LineUnavailableException
;
/**
/**
...
@@ -95,13 +90,13 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
...
@@ -95,13 +90,13 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
/**
/**
* Source lines (ports) currently open
* Source lines (ports) currently open
*/
*/
pr
otected
Vector
sourceLines
=
new
Vector
();
pr
ivate
final
Vector
sourceLines
=
new
Vector
();
/**
/**
* Target lines currently open.
* Target lines currently open.
*/
*/
pr
otected
Vector
targetLines
=
new
Vector
();
pr
ivate
final
Vector
targetLines
=
new
Vector
();
/**
/**
...
@@ -133,19 +128,19 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
...
@@ -133,19 +128,19 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
// MIXER METHODS
// MIXER METHODS
public
Mixer
.
Info
getMixerInfo
()
{
public
final
Mixer
.
Info
getMixerInfo
()
{
return
mixerInfo
;
return
mixerInfo
;
}
}
public
Line
.
Info
[]
getSourceLineInfo
()
{
public
final
Line
.
Info
[]
getSourceLineInfo
()
{
Line
.
Info
[]
localArray
=
new
Line
.
Info
[
sourceLineInfo
.
length
];
Line
.
Info
[]
localArray
=
new
Line
.
Info
[
sourceLineInfo
.
length
];
System
.
arraycopy
(
sourceLineInfo
,
0
,
localArray
,
0
,
sourceLineInfo
.
length
);
System
.
arraycopy
(
sourceLineInfo
,
0
,
localArray
,
0
,
sourceLineInfo
.
length
);
return
localArray
;
return
localArray
;
}
}
public
Line
.
Info
[]
getTargetLineInfo
()
{
public
final
Line
.
Info
[]
getTargetLineInfo
()
{
Line
.
Info
[]
localArray
=
new
Line
.
Info
[
targetLineInfo
.
length
];
Line
.
Info
[]
localArray
=
new
Line
.
Info
[
targetLineInfo
.
length
];
System
.
arraycopy
(
targetLineInfo
,
0
,
localArray
,
0
,
targetLineInfo
.
length
);
System
.
arraycopy
(
targetLineInfo
,
0
,
localArray
,
0
,
targetLineInfo
.
length
);
...
@@ -153,7 +148,7 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
...
@@ -153,7 +148,7 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
}
}
public
Line
.
Info
[]
getSourceLineInfo
(
Line
.
Info
info
)
{
public
final
Line
.
Info
[]
getSourceLineInfo
(
Line
.
Info
info
)
{
int
i
;
int
i
;
Vector
vec
=
new
Vector
();
Vector
vec
=
new
Vector
();
...
@@ -174,7 +169,7 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
...
@@ -174,7 +169,7 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
}
}
public
Line
.
Info
[]
getTargetLineInfo
(
Line
.
Info
info
)
{
public
final
Line
.
Info
[]
getTargetLineInfo
(
Line
.
Info
info
)
{
int
i
;
int
i
;
Vector
vec
=
new
Vector
();
Vector
vec
=
new
Vector
();
...
@@ -195,7 +190,7 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
...
@@ -195,7 +190,7 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
}
}
public
boolean
isLineSupported
(
Line
.
Info
info
)
{
public
final
boolean
isLineSupported
(
Line
.
Info
info
)
{
int
i
;
int
i
;
...
@@ -227,7 +222,7 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
...
@@ -227,7 +222,7 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
protected
abstract
void
implClose
();
protected
abstract
void
implClose
();
public
Line
[]
getSourceLines
()
{
public
final
Line
[]
getSourceLines
()
{
Line
[]
localLines
;
Line
[]
localLines
;
...
@@ -244,7 +239,7 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
...
@@ -244,7 +239,7 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
}
}
public
Line
[]
getTargetLines
()
{
public
final
Line
[]
getTargetLines
()
{
Line
[]
localLines
;
Line
[]
localLines
;
...
@@ -264,7 +259,7 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
...
@@ -264,7 +259,7 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
/**
/**
* Default implementation always throws an exception.
* Default implementation always throws an exception.
*/
*/
public
void
synchronize
(
Line
[]
lines
,
boolean
maintainSync
)
{
public
final
void
synchronize
(
Line
[]
lines
,
boolean
maintainSync
)
{
throw
new
IllegalArgumentException
(
"Synchronization not supported by this mixer."
);
throw
new
IllegalArgumentException
(
"Synchronization not supported by this mixer."
);
}
}
...
@@ -272,7 +267,7 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
...
@@ -272,7 +267,7 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
/**
/**
* Default implementation always throws an exception.
* Default implementation always throws an exception.
*/
*/
public
void
unsynchronize
(
Line
[]
lines
)
{
public
final
void
unsynchronize
(
Line
[]
lines
)
{
throw
new
IllegalArgumentException
(
"Synchronization not supported by this mixer."
);
throw
new
IllegalArgumentException
(
"Synchronization not supported by this mixer."
);
}
}
...
@@ -280,7 +275,8 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
...
@@ -280,7 +275,8 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
/**
/**
* Default implementation always returns false.
* Default implementation always returns false.
*/
*/
public
boolean
isSynchronizationSupported
(
Line
[]
lines
,
boolean
maintainSync
)
{
public
final
boolean
isSynchronizationSupported
(
Line
[]
lines
,
boolean
maintainSync
)
{
return
false
;
return
false
;
}
}
...
@@ -290,14 +286,14 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
...
@@ -290,14 +286,14 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
/**
/**
* This implementation tries to open the mixer with its current format and buffer size settings.
* This implementation tries to open the mixer with its current format and buffer size settings.
*/
*/
public
synchronized
void
open
()
throws
LineUnavailableException
{
public
final
synchronized
void
open
()
throws
LineUnavailableException
{
open
(
true
);
open
(
true
);
}
}
/**
/**
* This implementation tries to open the mixer with its current format and buffer size settings.
* This implementation tries to open the mixer with its current format and buffer size settings.
*/
*/
protected
synchronized
void
open
(
boolean
manual
)
throws
LineUnavailableException
{
final
synchronized
void
open
(
boolean
manual
)
throws
LineUnavailableException
{
if
(
Printer
.
trace
)
Printer
.
trace
(
">> AbstractMixer: open()"
);
if
(
Printer
.
trace
)
Printer
.
trace
(
">> AbstractMixer: open()"
);
if
(!
isOpen
())
{
if
(!
isOpen
())
{
implOpen
();
implOpen
();
...
@@ -322,7 +318,7 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
...
@@ -322,7 +318,7 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
* The mixer may be opened at a format different than the line's
* The mixer may be opened at a format different than the line's
* format if it is a DataLine.
* format if it is a DataLine.
*/
*/
protected
synchronized
void
open
(
Line
line
)
throws
LineUnavailableException
{
final
synchronized
void
open
(
Line
line
)
throws
LineUnavailableException
{
if
(
Printer
.
trace
)
Printer
.
trace
(
">> AbstractMixer: open(line = "
+
line
+
")"
);
if
(
Printer
.
trace
)
Printer
.
trace
(
">> AbstractMixer: open(line = "
+
line
+
")"
);
...
@@ -367,7 +363,7 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
...
@@ -367,7 +363,7 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
* open target lines, if it exists in either.
* open target lines, if it exists in either.
* If the list is now empty, closes the mixer.
* If the list is now empty, closes the mixer.
*/
*/
protected
synchronized
void
close
(
Line
line
)
{
final
synchronized
void
close
(
Line
line
)
{
if
(
Printer
.
trace
)
Printer
.
trace
(
">> AbstractMixer: close("
+
line
+
")"
);
if
(
Printer
.
trace
)
Printer
.
trace
(
">> AbstractMixer: close("
+
line
+
")"
);
...
@@ -396,7 +392,7 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
...
@@ -396,7 +392,7 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
/**
/**
* Close all lines and then close this mixer.
* Close all lines and then close this mixer.
*/
*/
public
synchronized
void
close
()
{
public
final
synchronized
void
close
()
{
if
(
Printer
.
trace
)
Printer
.
trace
(
">> AbstractMixer: close()"
);
if
(
Printer
.
trace
)
Printer
.
trace
(
">> AbstractMixer: close()"
);
if
(
isOpen
())
{
if
(
isOpen
())
{
// close all source lines
// close all source lines
...
@@ -423,7 +419,7 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
...
@@ -423,7 +419,7 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
/**
/**
* Starts the mixer.
* Starts the mixer.
*/
*/
protected
synchronized
void
start
(
Line
line
)
{
final
synchronized
void
start
(
Line
line
)
{
if
(
Printer
.
trace
)
Printer
.
trace
(
">> AbstractMixer: start("
+
line
+
")"
);
if
(
Printer
.
trace
)
Printer
.
trace
(
">> AbstractMixer: start("
+
line
+
")"
);
...
@@ -447,7 +443,7 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
...
@@ -447,7 +443,7 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
/**
/**
* Stops the mixer if this was the last running line.
* Stops the mixer if this was the last running line.
*/
*/
protected
synchronized
void
stop
(
Line
line
)
{
final
synchronized
void
stop
(
Line
line
)
{
if
(
Printer
.
trace
)
Printer
.
trace
(
">> AbstractMixer: stop("
+
line
+
")"
);
if
(
Printer
.
trace
)
Printer
.
trace
(
">> AbstractMixer: stop("
+
line
+
")"
);
...
@@ -501,7 +497,7 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
...
@@ -501,7 +497,7 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
* Right now this just checks whether it's supported, but should
* Right now this just checks whether it's supported, but should
* check whether it actually belongs to this mixer....
* check whether it actually belongs to this mixer....
*/
*/
boolean
isSourceLine
(
Line
.
Info
info
)
{
final
boolean
isSourceLine
(
Line
.
Info
info
)
{
for
(
int
i
=
0
;
i
<
sourceLineInfo
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
sourceLineInfo
.
length
;
i
++)
{
if
(
info
.
matches
(
sourceLineInfo
[
i
]))
{
if
(
info
.
matches
(
sourceLineInfo
[
i
]))
{
...
@@ -518,7 +514,7 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
...
@@ -518,7 +514,7 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
* Right now this just checks whether it's supported, but should
* Right now this just checks whether it's supported, but should
* check whether it actually belongs to this mixer....
* check whether it actually belongs to this mixer....
*/
*/
boolean
isTargetLine
(
Line
.
Info
info
)
{
final
boolean
isTargetLine
(
Line
.
Info
info
)
{
for
(
int
i
=
0
;
i
<
targetLineInfo
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
targetLineInfo
.
length
;
i
++)
{
if
(
info
.
matches
(
targetLineInfo
[
i
]))
{
if
(
info
.
matches
(
targetLineInfo
[
i
]))
{
...
@@ -535,7 +531,7 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
...
@@ -535,7 +531,7 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
* matches the one specified, or null if no matching Line.Info
* matches the one specified, or null if no matching Line.Info
* object is found.
* object is found.
*/
*/
Line
.
Info
getLineInfo
(
Line
.
Info
info
)
{
final
Line
.
Info
getLineInfo
(
Line
.
Info
info
)
{
if
(
info
==
null
)
{
if
(
info
==
null
)
{
return
null
;
return
null
;
}
}
...
...
src/share/classes/com/sun/media/sound/AiffFileFormat.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 1999, 20
07
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 20
13
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -35,7 +35,7 @@ import javax.sound.sampled.AudioFormat;
...
@@ -35,7 +35,7 @@ import javax.sound.sampled.AudioFormat;
* @author Jan Borgersen
* @author Jan Borgersen
*/
*/
class
AiffFileFormat
extends
AudioFileFormat
{
final
class
AiffFileFormat
extends
AudioFileFormat
{
static
final
int
AIFF_MAGIC
=
1179603533
;
static
final
int
AIFF_MAGIC
=
1179603533
;
...
@@ -62,13 +62,13 @@ class AiffFileFormat extends AudioFileFormat {
...
@@ -62,13 +62,13 @@ class AiffFileFormat extends AudioFileFormat {
//$$fb 2001-07-13: added management of header size in this class
//$$fb 2001-07-13: added management of header size in this class
/** header size in bytes */
/** header size in bytes */
private
int
headerSize
=
AIFF_HEADERSIZE
;
private
final
int
headerSize
=
AIFF_HEADERSIZE
;
/** comm chunk size in bytes, inclusive magic and length field */
/** comm chunk size in bytes, inclusive magic and length field */
private
int
commChunkSize
=
26
;
private
final
int
commChunkSize
=
26
;
/** FVER chunk size in bytes, inclusive magic and length field */
/** FVER chunk size in bytes, inclusive magic and length field */
private
int
fverChunkSize
=
0
;
private
final
int
fverChunkSize
=
0
;
AiffFileFormat
(
AudioFileFormat
aff
)
{
AiffFileFormat
(
AudioFileFormat
aff
)
{
this
(
aff
.
getType
(),
aff
.
getByteLength
(),
aff
.
getFormat
(),
aff
.
getFrameLength
()
);
this
(
aff
.
getType
(),
aff
.
getByteLength
(),
aff
.
getFormat
(),
aff
.
getFrameLength
()
);
...
...
src/share/classes/com/sun/media/sound/AiffFileReader.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 1999, 20
07
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 20
13
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -25,28 +25,17 @@
...
@@ -25,28 +25,17 @@
package
com.sun.media.sound
;
package
com.sun.media.sound
;
import
java.util.Vector
;
import
java.io.DataInputStream
;
import
java.io.DataOutputStream
;
import
java.io.File
;
import
java.io.File
;
import
java.io.InputStream
;
import
java.io.FileInputStream
;
import
java.io.OutputStream
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.
EOFException
;
import
java.io.
InputStream
;
import
java.net.URL
;
import
java.net.URL
;
import
java.net.MalformedURLException
;
import
java.io.BufferedInputStream
;
import
java.io.BufferedOutputStream
;
import
java.io.DataInputStream
;
import
java.io.FileInputStream
;
import
java.io.DataOutputStream
;
import
java.io.FileOutputStream
;
import
java.io.ByteArrayInputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.SequenceInputStream
;
import
javax.sound.sampled.AudioFileFormat
;
import
javax.sound.sampled.AudioFileFormat
;
import
javax.sound.sampled.AudioInputStream
;
import
javax.sound.sampled.AudioFormat
;
import
javax.sound.sampled.AudioFormat
;
import
javax.sound.sampled.AudioInputStream
;
import
javax.sound.sampled.AudioSystem
;
import
javax.sound.sampled.AudioSystem
;
import
javax.sound.sampled.UnsupportedAudioFileException
;
import
javax.sound.sampled.UnsupportedAudioFileException
;
...
@@ -58,19 +47,10 @@ import javax.sound.sampled.UnsupportedAudioFileException;
...
@@ -58,19 +47,10 @@ import javax.sound.sampled.UnsupportedAudioFileException;
* @author Jan Borgersen
* @author Jan Borgersen
* @author Florian Bomers
* @author Florian Bomers
*/
*/
public
class
AiffFileReader
extends
SunFileReader
{
public
final
class
AiffFileReader
extends
SunFileReader
{
private
static
final
int
MAX_READ_LENGTH
=
8
;
private
static
final
int
MAX_READ_LENGTH
=
8
;
/**
* AIFF parser type
*/
public
static
final
AudioFileFormat
.
Type
types
[]
=
{
AudioFileFormat
.
Type
.
AIFF
};
/**
/**
* Constructs a new AiffParser object.
* Constructs a new AiffParser object.
*/
*/
...
...
src/share/classes/com/sun/media/sound/AiffFileWriter.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 1999, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -50,21 +50,13 @@ import javax.sound.sampled.AudioSystem;
...
@@ -50,21 +50,13 @@ import javax.sound.sampled.AudioSystem;
*
*
* @author Jan Borgersen
* @author Jan Borgersen
*/
*/
public
class
AiffFileWriter
extends
SunFileWriter
{
public
final
class
AiffFileWriter
extends
SunFileWriter
{
/**
* AIFF type
*/
private
static
final
AudioFileFormat
.
Type
aiffTypes
[]
=
{
AudioFileFormat
.
Type
.
AIFF
};
/**
/**
* Constructs a new AiffFileWriter object.
* Constructs a new AiffFileWriter object.
*/
*/
public
AiffFileWriter
()
{
public
AiffFileWriter
()
{
super
(
aiffTypes
);
super
(
new
AudioFileFormat
.
Type
[]{
AudioFileFormat
.
Type
.
AIFF
}
);
}
}
...
...
src/share/classes/com/sun/media/sound/AlawCodec.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 1999, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -25,14 +25,12 @@
...
@@ -25,14 +25,12 @@
package
com.sun.media.sound
;
package
com.sun.media.sound
;
import
java.io.InputStream
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.Vector
;
import
java.util.Vector
;
import
javax.sound.sampled.AudioFormat
;
import
javax.sound.sampled.AudioFormat
;
import
javax.sound.sampled.AudioSystem
;
import
javax.sound.sampled.AudioInputStream
;
import
javax.sound.sampled.AudioInputStream
;
import
javax.sound.sampled.AudioSystem
;
/**
/**
...
@@ -40,12 +38,12 @@ import javax.sound.sampled.AudioInputStream;
...
@@ -40,12 +38,12 @@ import javax.sound.sampled.AudioInputStream;
*
*
* @author Kara Kytle
* @author Kara Kytle
*/
*/
public
class
AlawCodec
extends
SunCodec
{
public
final
class
AlawCodec
extends
SunCodec
{
/* Tables used for A-law decoding */
/* Tables used for A-law decoding */
final
static
byte
ALAW_TABH
[]
=
new
byte
[
256
];
private
static
final
byte
[]
ALAW_TABH
=
new
byte
[
256
];
final
static
byte
ALAW_TABL
[]
=
new
byte
[
256
];
private
static
final
byte
[]
ALAW_TABL
=
new
byte
[
256
];
private
static
final
AudioFormat
.
Encoding
[]
alawEncodings
=
{
AudioFormat
.
Encoding
.
ALAW
,
AudioFormat
.
Encoding
.
PCM_SIGNED
};
private
static
final
AudioFormat
.
Encoding
[]
alawEncodings
=
{
AudioFormat
.
Encoding
.
ALAW
,
AudioFormat
.
Encoding
.
PCM_SIGNED
};
...
@@ -256,7 +254,7 @@ public class AlawCodec extends SunCodec {
...
@@ -256,7 +254,7 @@ public class AlawCodec extends SunCodec {
}
}
class
AlawCodecStream
extends
AudioInputStream
{
final
class
AlawCodecStream
extends
AudioInputStream
{
// tempBuffer required only for encoding (when encode is true)
// tempBuffer required only for encoding (when encode is true)
private
static
final
int
tempBufferSize
=
64
;
private
static
final
int
tempBufferSize
=
64
;
...
...
src/share/classes/com/sun/media/sound/AuFileFormat.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 1999, 20
07
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 20
13
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -36,7 +36,7 @@ import javax.sound.sampled.AudioFormat;
...
@@ -36,7 +36,7 @@ import javax.sound.sampled.AudioFormat;
* @author Jan Borgersen
* @author Jan Borgersen
*/
*/
class
AuFileFormat
extends
AudioFileFormat
{
final
class
AuFileFormat
extends
AudioFileFormat
{
// magic numbers
// magic numbers
static
final
int
AU_SUN_MAGIC
=
0x2e736e64
;
static
final
int
AU_SUN_MAGIC
=
0x2e736e64
;
...
@@ -60,7 +60,7 @@ class AuFileFormat extends AudioFileFormat {
...
@@ -60,7 +60,7 @@ class AuFileFormat extends AudioFileFormat {
static
final
int
AU_HEADERSIZE
=
24
;
static
final
int
AU_HEADERSIZE
=
24
;
int
auType
;
private
int
auType
;
AuFileFormat
(
AudioFileFormat
aff
)
{
AuFileFormat
(
AudioFileFormat
aff
)
{
...
...
src/share/classes/com/sun/media/sound/AuFileReader.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 1999, 20
07
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 20
13
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -25,28 +25,17 @@
...
@@ -25,28 +25,17 @@
package
com.sun.media.sound
;
package
com.sun.media.sound
;
import
java.util.Vector
;
import
java.io.File
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.io.IOException
;
import
java.io.EOFException
;
import
java.net.URL
;
import
java.net.MalformedURLException
;
import
java.io.BufferedInputStream
;
import
java.io.BufferedInputStream
;
import
java.io.BufferedOutputStream
;
import
java.io.DataInputStream
;
import
java.io.DataInputStream
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileInputStream
;
import
java.io.DataOutputStream
;
import
java.io.IOException
;
import
java.io.FileOutputStream
;
import
java.io.InputStream
;
import
java.io.ByteArrayInputStream
;
import
java.net.URL
;
import
java.io.ByteArrayOutputStream
;
import
java.io.SequenceInputStream
;
import
javax.sound.sampled.AudioFileFormat
;
import
javax.sound.sampled.AudioFileFormat
;
import
javax.sound.sampled.AudioInputStream
;
import
javax.sound.sampled.AudioFormat
;
import
javax.sound.sampled.AudioFormat
;
import
javax.sound.sampled.AudioInputStream
;
import
javax.sound.sampled.AudioSystem
;
import
javax.sound.sampled.AudioSystem
;
import
javax.sound.sampled.UnsupportedAudioFileException
;
import
javax.sound.sampled.UnsupportedAudioFileException
;
...
@@ -58,16 +47,7 @@ import javax.sound.sampled.UnsupportedAudioFileException;
...
@@ -58,16 +47,7 @@ import javax.sound.sampled.UnsupportedAudioFileException;
* @author Jan Borgersen
* @author Jan Borgersen
* @author Florian Bomers
* @author Florian Bomers
*/
*/
public
class
AuFileReader
extends
SunFileReader
{
public
final
class
AuFileReader
extends
SunFileReader
{
/**
* AU reader type
*/
public
static
final
AudioFileFormat
.
Type
types
[]
=
{
AudioFileFormat
.
Type
.
AU
};
/**
/**
* Constructs a new AuFileReader object.
* Constructs a new AuFileReader object.
...
...
src/share/classes/com/sun/media/sound/AuFileWriter.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 1999, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -49,28 +49,18 @@ import javax.sound.sampled.AudioSystem;
...
@@ -49,28 +49,18 @@ import javax.sound.sampled.AudioSystem;
*
*
* @author Jan Borgersen
* @author Jan Borgersen
*/
*/
public
class
AuFileWriter
extends
SunFileWriter
{
public
final
class
AuFileWriter
extends
SunFileWriter
{
//$$fb value for length field if length is not known
//$$fb value for length field if length is not known
public
final
static
int
UNKNOWN_SIZE
=-
1
;
public
final
static
int
UNKNOWN_SIZE
=-
1
;
/**
* AU type
*/
private
static
final
AudioFileFormat
.
Type
auTypes
[]
=
{
AudioFileFormat
.
Type
.
AU
};
/**
/**
* Constructs a new AuFileWriter object.
* Constructs a new AuFileWriter object.
*/
*/
public
AuFileWriter
()
{
public
AuFileWriter
()
{
super
(
auTypes
);
super
(
new
AudioFileFormat
.
Type
[]{
AudioFileFormat
.
Type
.
AU
}
);
}
}
public
AudioFileFormat
.
Type
[]
getAudioFileTypes
(
AudioInputStream
stream
)
{
public
AudioFileFormat
.
Type
[]
getAudioFileTypes
(
AudioInputStream
stream
)
{
AudioFileFormat
.
Type
[]
filetypes
=
new
AudioFileFormat
.
Type
[
types
.
length
];
AudioFileFormat
.
Type
[]
filetypes
=
new
AudioFileFormat
.
Type
[
types
.
length
];
...
...
src/share/classes/com/sun/media/sound/AudioFileSoundbankReader.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -43,7 +43,7 @@ import javax.sound.sampled.UnsupportedAudioFileException;
...
@@ -43,7 +43,7 @@ import javax.sound.sampled.UnsupportedAudioFileException;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
AudioFileSoundbankReader
extends
SoundbankReader
{
public
final
class
AudioFileSoundbankReader
extends
SoundbankReader
{
public
Soundbank
getSoundbank
(
URL
url
)
public
Soundbank
getSoundbank
(
URL
url
)
throws
InvalidMidiDataException
,
IOException
{
throws
InvalidMidiDataException
,
IOException
{
...
...
src/share/classes/com/sun/media/sound/AudioFloatConverter.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -51,7 +51,7 @@ public abstract class AudioFloatConverter {
...
@@ -51,7 +51,7 @@ public abstract class AudioFloatConverter {
private
static
class
AudioFloatLSBFilter
extends
AudioFloatConverter
{
private
static
class
AudioFloatLSBFilter
extends
AudioFloatConverter
{
private
AudioFloatConverter
converter
;
private
final
AudioFloatConverter
converter
;
final
private
int
offset
;
final
private
int
offset
;
...
@@ -61,8 +61,7 @@ public abstract class AudioFloatConverter {
...
@@ -61,8 +61,7 @@ public abstract class AudioFloatConverter {
private
byte
[]
mask_buffer
;
private
byte
[]
mask_buffer
;
public
AudioFloatLSBFilter
(
AudioFloatConverter
converter
,
AudioFloatLSBFilter
(
AudioFloatConverter
converter
,
AudioFormat
format
)
{
AudioFormat
format
)
{
int
bits
=
format
.
getSampleSizeInBits
();
int
bits
=
format
.
getSampleSizeInBits
();
boolean
bigEndian
=
format
.
isBigEndian
();
boolean
bigEndian
=
format
.
isBigEndian
();
this
.
converter
=
converter
;
this
.
converter
=
converter
;
...
@@ -740,7 +739,7 @@ public abstract class AudioFloatConverter {
...
@@ -740,7 +739,7 @@ public abstract class AudioFloatConverter {
final
int
xbytes
;
final
int
xbytes
;
public
AudioFloatConversion32xSL
(
int
xbytes
)
{
AudioFloatConversion32xSL
(
int
xbytes
)
{
this
.
xbytes
=
xbytes
;
this
.
xbytes
=
xbytes
;
}
}
...
@@ -781,7 +780,7 @@ public abstract class AudioFloatConverter {
...
@@ -781,7 +780,7 @@ public abstract class AudioFloatConverter {
final
int
xbytes
;
final
int
xbytes
;
public
AudioFloatConversion32xSB
(
int
xbytes
)
{
AudioFloatConversion32xSB
(
int
xbytes
)
{
this
.
xbytes
=
xbytes
;
this
.
xbytes
=
xbytes
;
}
}
...
@@ -823,7 +822,7 @@ public abstract class AudioFloatConverter {
...
@@ -823,7 +822,7 @@ public abstract class AudioFloatConverter {
final
int
xbytes
;
final
int
xbytes
;
public
AudioFloatConversion32xUL
(
int
xbytes
)
{
AudioFloatConversion32xUL
(
int
xbytes
)
{
this
.
xbytes
=
xbytes
;
this
.
xbytes
=
xbytes
;
}
}
...
@@ -866,7 +865,7 @@ public abstract class AudioFloatConverter {
...
@@ -866,7 +865,7 @@ public abstract class AudioFloatConverter {
final
int
xbytes
;
final
int
xbytes
;
public
AudioFloatConversion32xUB
(
int
xbytes
)
{
AudioFloatConversion32xUB
(
int
xbytes
)
{
this
.
xbytes
=
xbytes
;
this
.
xbytes
=
xbytes
;
}
}
...
@@ -1008,49 +1007,51 @@ public abstract class AudioFloatConverter {
...
@@ -1008,49 +1007,51 @@ public abstract class AudioFloatConverter {
private
AudioFormat
format
;
private
AudioFormat
format
;
public
AudioFormat
getFormat
()
{
public
final
AudioFormat
getFormat
()
{
return
format
;
return
format
;
}
}
public
abstract
float
[]
toFloatArray
(
byte
[]
in_buff
,
int
in_offset
,
public
abstract
float
[]
toFloatArray
(
byte
[]
in_buff
,
int
in_offset
,
float
[]
out_buff
,
int
out_offset
,
int
out_len
);
float
[]
out_buff
,
int
out_offset
,
int
out_len
);
public
float
[]
toFloatArray
(
byte
[]
in_buff
,
float
[]
out_buff
,
public
f
inal
f
loat
[]
toFloatArray
(
byte
[]
in_buff
,
float
[]
out_buff
,
int
out_offset
,
int
out_len
)
{
int
out_offset
,
int
out_len
)
{
return
toFloatArray
(
in_buff
,
0
,
out_buff
,
out_offset
,
out_len
);
return
toFloatArray
(
in_buff
,
0
,
out_buff
,
out_offset
,
out_len
);
}
}
public
float
[]
toFloatArray
(
byte
[]
in_buff
,
int
in_offset
,
public
f
inal
f
loat
[]
toFloatArray
(
byte
[]
in_buff
,
int
in_offset
,
float
[]
out_buff
,
int
out_len
)
{
float
[]
out_buff
,
int
out_len
)
{
return
toFloatArray
(
in_buff
,
in_offset
,
out_buff
,
0
,
out_len
);
return
toFloatArray
(
in_buff
,
in_offset
,
out_buff
,
0
,
out_len
);
}
}
public
float
[]
toFloatArray
(
byte
[]
in_buff
,
float
[]
out_buff
,
int
out_len
)
{
public
final
float
[]
toFloatArray
(
byte
[]
in_buff
,
float
[]
out_buff
,
int
out_len
)
{
return
toFloatArray
(
in_buff
,
0
,
out_buff
,
0
,
out_len
);
return
toFloatArray
(
in_buff
,
0
,
out_buff
,
0
,
out_len
);
}
}
public
float
[]
toFloatArray
(
byte
[]
in_buff
,
float
[]
out_buff
)
{
public
f
inal
f
loat
[]
toFloatArray
(
byte
[]
in_buff
,
float
[]
out_buff
)
{
return
toFloatArray
(
in_buff
,
0
,
out_buff
,
0
,
out_buff
.
length
);
return
toFloatArray
(
in_buff
,
0
,
out_buff
,
0
,
out_buff
.
length
);
}
}
public
abstract
byte
[]
toByteArray
(
float
[]
in_buff
,
int
in_offset
,
public
abstract
byte
[]
toByteArray
(
float
[]
in_buff
,
int
in_offset
,
int
in_len
,
byte
[]
out_buff
,
int
out_offset
);
int
in_len
,
byte
[]
out_buff
,
int
out_offset
);
public
byte
[]
toByteArray
(
float
[]
in_buff
,
int
in_len
,
byte
[]
out_buff
,
public
final
byte
[]
toByteArray
(
float
[]
in_buff
,
int
in_len
,
int
out_offset
)
{
byte
[]
out_buff
,
int
out_offset
)
{
return
toByteArray
(
in_buff
,
0
,
in_len
,
out_buff
,
out_offset
);
return
toByteArray
(
in_buff
,
0
,
in_len
,
out_buff
,
out_offset
);
}
}
public
byte
[]
toByteArray
(
float
[]
in_buff
,
int
in_offset
,
int
in_len
,
public
final
byte
[]
toByteArray
(
float
[]
in_buff
,
int
in_offset
,
int
in_len
,
byte
[]
out_buff
)
{
byte
[]
out_buff
)
{
return
toByteArray
(
in_buff
,
in_offset
,
in_len
,
out_buff
,
0
);
return
toByteArray
(
in_buff
,
in_offset
,
in_len
,
out_buff
,
0
);
}
}
public
byte
[]
toByteArray
(
float
[]
in_buff
,
int
in_len
,
byte
[]
out_buff
)
{
public
final
byte
[]
toByteArray
(
float
[]
in_buff
,
int
in_len
,
byte
[]
out_buff
)
{
return
toByteArray
(
in_buff
,
0
,
in_len
,
out_buff
,
0
);
return
toByteArray
(
in_buff
,
0
,
in_len
,
out_buff
,
0
);
}
}
public
byte
[]
toByteArray
(
float
[]
in_buff
,
byte
[]
out_buff
)
{
public
final
byte
[]
toByteArray
(
float
[]
in_buff
,
byte
[]
out_buff
)
{
return
toByteArray
(
in_buff
,
0
,
in_buff
.
length
,
out_buff
,
0
);
return
toByteArray
(
in_buff
,
0
,
in_buff
.
length
,
out_buff
,
0
);
}
}
}
}
src/share/classes/com/sun/media/sound/AudioFloatFormatConverter.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2008, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -42,19 +42,19 @@ import javax.sound.sampled.spi.FormatConversionProvider;
...
@@ -42,19 +42,19 @@ import javax.sound.sampled.spi.FormatConversionProvider;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
AudioFloatFormatConverter
extends
FormatConversionProvider
{
public
final
class
AudioFloatFormatConverter
extends
FormatConversionProvider
{
private
static
class
AudioFloatFormatConverterInputStream
extends
private
static
class
AudioFloatFormatConverterInputStream
extends
InputStream
{
InputStream
{
private
AudioFloatConverter
converter
;
private
final
AudioFloatConverter
converter
;
private
AudioFloatInputStream
stream
;
private
final
AudioFloatInputStream
stream
;
private
float
[]
readfloatbuffer
;
private
float
[]
readfloatbuffer
;
private
int
fsize
=
0
;
private
final
int
fsize
;
public
AudioFloatFormatConverterInputStream
(
AudioFormat
targetFormat
,
AudioFloatFormatConverterInputStream
(
AudioFormat
targetFormat
,
AudioFloatInputStream
stream
)
{
AudioFloatInputStream
stream
)
{
this
.
stream
=
stream
;
this
.
stream
=
stream
;
converter
=
AudioFloatConverter
.
getConverter
(
targetFormat
);
converter
=
AudioFloatConverter
.
getConverter
(
targetFormat
);
...
@@ -116,17 +116,17 @@ public class AudioFloatFormatConverter extends FormatConversionProvider {
...
@@ -116,17 +116,17 @@ public class AudioFloatFormatConverter extends FormatConversionProvider {
private
static
class
AudioFloatInputStreamChannelMixer
extends
private
static
class
AudioFloatInputStreamChannelMixer
extends
AudioFloatInputStream
{
AudioFloatInputStream
{
private
int
targetChannels
;
private
final
int
targetChannels
;
private
int
sourceChannels
;
private
final
int
sourceChannels
;
private
AudioFloatInputStream
ais
;
private
final
AudioFloatInputStream
ais
;
private
AudioFormat
targetFormat
;
private
final
AudioFormat
targetFormat
;
private
float
[]
conversion_buffer
;
private
float
[]
conversion_buffer
;
public
AudioFloatInputStreamChannelMixer
(
AudioFloatInputStream
ais
,
AudioFloatInputStreamChannelMixer
(
AudioFloatInputStream
ais
,
int
targetChannels
)
{
int
targetChannels
)
{
this
.
sourceChannels
=
ais
.
getFormat
().
getChannels
();
this
.
sourceChannels
=
ais
.
getFormat
().
getChannels
();
this
.
targetChannels
=
targetChannels
;
this
.
targetChannels
=
targetChannels
;
...
@@ -226,37 +226,37 @@ public class AudioFloatFormatConverter extends FormatConversionProvider {
...
@@ -226,37 +226,37 @@ public class AudioFloatFormatConverter extends FormatConversionProvider {
private
static
class
AudioFloatInputStreamResampler
extends
private
static
class
AudioFloatInputStreamResampler
extends
AudioFloatInputStream
{
AudioFloatInputStream
{
private
AudioFloatInputStream
ais
;
private
final
AudioFloatInputStream
ais
;
private
AudioFormat
targetFormat
;
private
final
AudioFormat
targetFormat
;
private
float
[]
skipbuffer
;
private
float
[]
skipbuffer
;
private
SoftAbstractResampler
resampler
;
private
SoftAbstractResampler
resampler
;
private
float
[]
pitch
=
new
float
[
1
];
private
f
inal
f
loat
[]
pitch
=
new
float
[
1
];
private
float
[]
ibuffer2
;
private
f
inal
f
loat
[]
ibuffer2
;
private
float
[][]
ibuffer
;
private
f
inal
f
loat
[][]
ibuffer
;
private
float
ibuffer_index
=
0
;
private
float
ibuffer_index
=
0
;
private
int
ibuffer_len
=
0
;
private
int
ibuffer_len
=
0
;
private
int
nrofchannels
=
0
;
private
final
int
nrofchannels
;
private
float
[][]
cbuffer
;
private
float
[][]
cbuffer
;
private
int
buffer_len
=
512
;
private
final
int
buffer_len
=
512
;
private
int
pad
;
private
final
int
pad
;
private
int
pad2
;
private
final
int
pad2
;
private
float
[]
ix
=
new
float
[
1
];
private
f
inal
f
loat
[]
ix
=
new
float
[
1
];
private
int
[]
ox
=
new
int
[
1
];
private
final
int
[]
ox
=
new
int
[
1
];
private
float
[][]
mark_ibuffer
=
null
;
private
float
[][]
mark_ibuffer
=
null
;
...
@@ -264,7 +264,7 @@ public class AudioFloatFormatConverter extends FormatConversionProvider {
...
@@ -264,7 +264,7 @@ public class AudioFloatFormatConverter extends FormatConversionProvider {
private
int
mark_ibuffer_len
=
0
;
private
int
mark_ibuffer_len
=
0
;
public
AudioFloatInputStreamResampler
(
AudioFloatInputStream
ais
,
AudioFloatInputStreamResampler
(
AudioFloatInputStream
ais
,
AudioFormat
format
)
{
AudioFormat
format
)
{
this
.
ais
=
ais
;
this
.
ais
=
ais
;
AudioFormat
sourceFormat
=
ais
.
getFormat
();
AudioFormat
sourceFormat
=
ais
.
getFormat
();
...
@@ -468,8 +468,9 @@ public class AudioFloatFormatConverter extends FormatConversionProvider {
...
@@ -468,8 +468,9 @@ public class AudioFloatFormatConverter extends FormatConversionProvider {
}
}
private
Encoding
[]
formats
=
{
Encoding
.
PCM_SIGNED
,
Encoding
.
PCM_UNSIGNED
,
private
final
Encoding
[]
formats
=
{
Encoding
.
PCM_SIGNED
,
Encoding
.
PCM_FLOAT
};
Encoding
.
PCM_UNSIGNED
,
Encoding
.
PCM_FLOAT
};
public
AudioInputStream
getAudioInputStream
(
Encoding
targetEncoding
,
public
AudioInputStream
getAudioInputStream
(
Encoding
targetEncoding
,
AudioInputStream
sourceStream
)
{
AudioInputStream
sourceStream
)
{
...
...
src/share/classes/com/sun/media/sound/AudioFloatInputStream.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -48,14 +48,14 @@ public abstract class AudioFloatInputStream {
...
@@ -48,14 +48,14 @@ public abstract class AudioFloatInputStream {
private
int
pos
=
0
;
private
int
pos
=
0
;
private
int
markpos
=
0
;
private
int
markpos
=
0
;
private
AudioFloatConverter
converter
;
private
final
AudioFloatConverter
converter
;
private
AudioFormat
format
;
private
final
AudioFormat
format
;
private
byte
[]
buffer
;
private
final
byte
[]
buffer
;
private
int
buffer_offset
;
private
final
int
buffer_offset
;
private
int
buffer_len
;
private
final
int
buffer_len
;
private
int
framesize_pc
;
private
final
int
framesize_pc
;
public
BytaArrayAudioFloatInputStream
(
AudioFloatConverter
converter
,
BytaArrayAudioFloatInputStream
(
AudioFloatConverter
converter
,
byte
[]
buffer
,
int
offset
,
int
len
)
{
byte
[]
buffer
,
int
offset
,
int
len
)
{
this
.
converter
=
converter
;
this
.
converter
=
converter
;
this
.
format
=
converter
.
getFormat
();
this
.
format
=
converter
.
getFormat
();
...
@@ -125,12 +125,12 @@ public abstract class AudioFloatInputStream {
...
@@ -125,12 +125,12 @@ public abstract class AudioFloatInputStream {
private
static
class
DirectAudioFloatInputStream
private
static
class
DirectAudioFloatInputStream
extends
AudioFloatInputStream
{
extends
AudioFloatInputStream
{
private
AudioInputStream
stream
;
private
final
AudioInputStream
stream
;
private
AudioFloatConverter
converter
;
private
AudioFloatConverter
converter
;
private
int
framesize_pc
;
// framesize / channels
private
final
int
framesize_pc
;
// framesize / channels
private
byte
[]
buffer
;
private
byte
[]
buffer
;
public
DirectAudioFloatInputStream
(
AudioInputStream
stream
)
{
DirectAudioFloatInputStream
(
AudioInputStream
stream
)
{
converter
=
AudioFloatConverter
.
getConverter
(
stream
.
getFormat
());
converter
=
AudioFloatConverter
.
getConverter
(
stream
.
getFormat
());
if
(
converter
==
null
)
{
if
(
converter
==
null
)
{
AudioFormat
format
=
stream
.
getFormat
();
AudioFormat
format
=
stream
.
getFormat
();
...
@@ -255,11 +255,11 @@ public abstract class AudioFloatInputStream {
...
@@ -255,11 +255,11 @@ public abstract class AudioFloatInputStream {
public
abstract
int
read
(
float
[]
b
,
int
off
,
int
len
)
throws
IOException
;
public
abstract
int
read
(
float
[]
b
,
int
off
,
int
len
)
throws
IOException
;
public
int
read
(
float
[]
b
)
throws
IOException
{
public
final
int
read
(
float
[]
b
)
throws
IOException
{
return
read
(
b
,
0
,
b
.
length
);
return
read
(
b
,
0
,
b
.
length
);
}
}
public
float
read
()
throws
IOException
{
public
f
inal
f
loat
read
()
throws
IOException
{
float
[]
b
=
new
float
[
1
];
float
[]
b
=
new
float
[
1
];
int
ret
=
read
(
b
,
0
,
1
);
int
ret
=
read
(
b
,
0
,
1
);
if
(
ret
==
-
1
||
ret
==
0
)
if
(
ret
==
-
1
||
ret
==
0
)
...
...
src/share/classes/com/sun/media/sound/AudioSynthesizerPropertyInfo.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -29,7 +29,7 @@ package com.sun.media.sound;
...
@@ -29,7 +29,7 @@ package com.sun.media.sound;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
AudioSynthesizerPropertyInfo
{
public
final
class
AudioSynthesizerPropertyInfo
{
/**
/**
* Constructs a <code>AudioSynthesizerPropertyInfo</code> object with a given
* Constructs a <code>AudioSynthesizerPropertyInfo</code> object with a given
...
...
src/share/classes/com/sun/media/sound/DLSInfo.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -30,7 +30,7 @@ package com.sun.media.sound;
...
@@ -30,7 +30,7 @@ package com.sun.media.sound;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
DLSInfo
{
public
final
class
DLSInfo
{
/**
/**
* (INAM) Title or subject.
* (INAM) Title or subject.
...
...
src/share/classes/com/sun/media/sound/DLSInstrument.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -40,15 +40,15 @@ import javax.sound.midi.Patch;
...
@@ -40,15 +40,15 @@ import javax.sound.midi.Patch;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
DLSInstrument
extends
ModelInstrument
{
public
final
class
DLSInstrument
extends
ModelInstrument
{
protected
int
preset
=
0
;
int
preset
=
0
;
protected
int
bank
=
0
;
int
bank
=
0
;
protected
boolean
druminstrument
=
false
;
boolean
druminstrument
=
false
;
protected
byte
[]
guid
=
null
;
byte
[]
guid
=
null
;
protected
DLSInfo
info
=
new
DLSInfo
();
DLSInfo
info
=
new
DLSInfo
();
protected
List
<
DLSRegion
>
regions
=
new
ArrayList
<
DLSRegion
>();
List
<
DLSRegion
>
regions
=
new
ArrayList
<
DLSRegion
>();
protected
List
<
DLSModulator
>
modulators
=
new
ArrayList
<
DLSModulator
>();
List
<
DLSModulator
>
modulators
=
new
ArrayList
<
DLSModulator
>();
public
DLSInstrument
()
{
public
DLSInstrument
()
{
super
(
null
,
null
,
null
,
null
);
super
(
null
,
null
,
null
,
null
);
...
...
src/share/classes/com/sun/media/sound/DLSModulator.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -33,7 +33,7 @@ package com.sun.media.sound;
...
@@ -33,7 +33,7 @@ package com.sun.media.sound;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
DLSModulator
{
public
final
class
DLSModulator
{
// DLS1 Destinations
// DLS1 Destinations
public
static
final
int
CONN_DST_NONE
=
0x000
;
// 0
public
static
final
int
CONN_DST_NONE
=
0x000
;
// 0
...
@@ -102,12 +102,12 @@ public class DLSModulator {
...
@@ -102,12 +102,12 @@ public class DLSModulator {
public
static
final
int
DST_FORMAT_CENT
=
1
;
public
static
final
int
DST_FORMAT_CENT
=
1
;
public
static
final
int
DST_FORMAT_TIMECENT
=
2
;
public
static
final
int
DST_FORMAT_TIMECENT
=
2
;
public
static
final
int
DST_FORMAT_PERCENT
=
3
;
public
static
final
int
DST_FORMAT_PERCENT
=
3
;
protected
int
source
;
int
source
;
protected
int
control
;
int
control
;
protected
int
destination
;
int
destination
;
protected
int
transform
;
int
transform
;
protected
int
scale
;
int
scale
;
protected
int
version
=
1
;
int
version
=
1
;
public
int
getControl
()
{
public
int
getControl
()
{
return
control
;
return
control
;
...
...
src/share/classes/com/sun/media/sound/DLSRegion.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -36,21 +36,21 @@ import java.util.List;
...
@@ -36,21 +36,21 @@ import java.util.List;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
DLSRegion
{
public
final
class
DLSRegion
{
public
final
static
int
OPTION_SELFNONEXCLUSIVE
=
0x0001
;
public
final
static
int
OPTION_SELFNONEXCLUSIVE
=
0x0001
;
protected
List
<
DLSModulator
>
modulators
=
new
ArrayList
<
DLSModulator
>();
List
<
DLSModulator
>
modulators
=
new
ArrayList
<
DLSModulator
>();
protected
int
keyfrom
;
int
keyfrom
;
protected
int
keyto
;
int
keyto
;
protected
int
velfrom
;
int
velfrom
;
protected
int
velto
;
int
velto
;
protected
int
options
;
int
options
;
protected
int
exclusiveClass
;
int
exclusiveClass
;
protected
int
fusoptions
;
int
fusoptions
;
protected
int
phasegroup
;
int
phasegroup
;
protected
long
channel
;
long
channel
;
protected
DLSSample
sample
=
null
;
DLSSample
sample
=
null
;
protected
DLSSampleOptions
sampleoptions
;
DLSSampleOptions
sampleoptions
;
public
List
<
DLSModulator
>
getModulators
()
{
public
List
<
DLSModulator
>
getModulators
()
{
return
modulators
;
return
modulators
;
...
...
src/share/classes/com/sun/media/sound/DLSSample.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -40,13 +40,13 @@ import javax.sound.sampled.AudioInputStream;
...
@@ -40,13 +40,13 @@ import javax.sound.sampled.AudioInputStream;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
DLSSample
extends
SoundbankResource
{
public
final
class
DLSSample
extends
SoundbankResource
{
protected
byte
[]
guid
=
null
;
byte
[]
guid
=
null
;
protected
DLSInfo
info
=
new
DLSInfo
();
DLSInfo
info
=
new
DLSInfo
();
protected
DLSSampleOptions
sampleoptions
;
DLSSampleOptions
sampleoptions
;
protected
ModelByteBuffer
data
;
ModelByteBuffer
data
;
protected
AudioFormat
format
;
AudioFormat
format
;
public
DLSSample
(
Soundbank
soundBank
)
{
public
DLSSample
(
Soundbank
soundBank
)
{
super
(
soundBank
,
null
,
AudioInputStream
.
class
);
super
(
soundBank
,
null
,
AudioInputStream
.
class
);
...
...
src/share/classes/com/sun/media/sound/DLSSampleLoop.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -29,13 +29,13 @@ package com.sun.media.sound;
...
@@ -29,13 +29,13 @@ package com.sun.media.sound;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
DLSSampleLoop
{
public
final
class
DLSSampleLoop
{
public
final
static
int
LOOP_TYPE_FORWARD
=
0
;
public
final
static
int
LOOP_TYPE_FORWARD
=
0
;
public
final
static
int
LOOP_TYPE_RELEASE
=
1
;
public
final
static
int
LOOP_TYPE_RELEASE
=
1
;
protected
long
type
;
long
type
;
protected
long
start
;
long
start
;
protected
long
length
;
long
length
;
public
long
getLength
()
{
public
long
getLength
()
{
return
length
;
return
length
;
...
...
src/share/classes/com/sun/media/sound/DLSSampleOptions.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -34,13 +34,13 @@ import java.util.List;
...
@@ -34,13 +34,13 @@ import java.util.List;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
DLSSampleOptions
{
public
final
class
DLSSampleOptions
{
protected
int
unitynote
;
int
unitynote
;
protected
short
finetune
;
short
finetune
;
protected
int
attenuation
;
int
attenuation
;
protected
long
options
;
long
options
;
protected
List
<
DLSSampleLoop
>
loops
=
new
ArrayList
<
DLSSampleLoop
>();
List
<
DLSSampleLoop
>
loops
=
new
ArrayList
<
DLSSampleLoop
>();
public
int
getAttenuation
()
{
public
int
getAttenuation
()
{
return
attenuation
;
return
attenuation
;
...
...
src/share/classes/com/sun/media/sound/DLSSoundbank.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -51,7 +51,7 @@ import javax.sound.sampled.AudioFormat.Encoding;
...
@@ -51,7 +51,7 @@ import javax.sound.sampled.AudioFormat.Encoding;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
DLSSoundbank
implements
Soundbank
{
public
final
class
DLSSoundbank
implements
Soundbank
{
static
private
class
DLSID
{
static
private
class
DLSID
{
long
i1
;
long
i1
;
...
@@ -69,7 +69,7 @@ public class DLSSoundbank implements Soundbank {
...
@@ -69,7 +69,7 @@ public class DLSSoundbank implements Soundbank {
private
DLSID
()
{
private
DLSID
()
{
}
}
public
DLSID
(
long
i1
,
int
s1
,
int
s2
,
int
x1
,
int
x2
,
int
x3
,
int
x4
,
DLSID
(
long
i1
,
int
s1
,
int
s2
,
int
x1
,
int
x2
,
int
x3
,
int
x4
,
int
x5
,
int
x6
,
int
x7
,
int
x8
)
{
int
x5
,
int
x6
,
int
x7
,
int
x8
)
{
this
.
i1
=
i1
;
this
.
i1
=
i1
;
this
.
s1
=
s1
;
this
.
s1
=
s1
;
...
@@ -174,10 +174,10 @@ public class DLSSoundbank implements Soundbank {
...
@@ -174,10 +174,10 @@ public class DLSSoundbank implements Soundbank {
private
long
major
=
-
1
;
private
long
major
=
-
1
;
private
long
minor
=
-
1
;
private
long
minor
=
-
1
;
private
DLSInfo
info
=
new
DLSInfo
();
private
final
DLSInfo
info
=
new
DLSInfo
();
private
List
<
DLSInstrument
>
instruments
=
new
ArrayList
<
DLSInstrument
>();
private
final
List
<
DLSInstrument
>
instruments
=
new
ArrayList
<
DLSInstrument
>();
private
List
<
DLSSample
>
samples
=
new
ArrayList
<
DLSSample
>();
private
final
List
<
DLSSample
>
samples
=
new
ArrayList
<
DLSSample
>();
private
boolean
largeFormat
=
false
;
private
boolean
largeFormat
=
false
;
private
File
sampleFile
;
private
File
sampleFile
;
...
...
src/share/classes/com/sun/media/sound/DLSSoundbankReader.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -39,7 +39,7 @@ import javax.sound.midi.spi.SoundbankReader;
...
@@ -39,7 +39,7 @@ import javax.sound.midi.spi.SoundbankReader;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
DLSSoundbankReader
extends
SoundbankReader
{
public
final
class
DLSSoundbankReader
extends
SoundbankReader
{
public
Soundbank
getSoundbank
(
URL
url
)
public
Soundbank
getSoundbank
(
URL
url
)
throws
InvalidMidiDataException
,
IOException
{
throws
InvalidMidiDataException
,
IOException
{
...
...
src/share/classes/com/sun/media/sound/DataPusher.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2002, 20
07
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 20
13
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -37,13 +37,13 @@ import javax.sound.sampled.*;
...
@@ -37,13 +37,13 @@ import javax.sound.sampled.*;
* @author Florian Bomers
* @author Florian Bomers
*/
*/
public
class
DataPusher
implements
Runnable
{
public
final
class
DataPusher
implements
Runnable
{
private
static
final
int
AUTO_CLOSE_TIME
=
5000
;
private
static
final
int
AUTO_CLOSE_TIME
=
5000
;
private
static
final
boolean
DEBUG
=
false
;
private
static
final
boolean
DEBUG
=
false
;
private
SourceDataLine
source
=
null
;
private
final
SourceDataLine
source
;
private
AudioFormat
format
=
null
;
private
final
AudioFormat
format
;
// stream as source data
// stream as source data
private
AudioInputStream
ais
=
null
;
private
AudioInputStream
ais
=
null
;
...
...
src/share/classes/com/sun/media/sound/DirectAudioDevice.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2002, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -42,7 +42,7 @@ import javax.sound.sampled.*;
...
@@ -42,7 +42,7 @@ import javax.sound.sampled.*;
*
*
* @author Florian Bomers
* @author Florian Bomers
*/
*/
class
DirectAudioDevice
extends
AbstractMixer
{
final
class
DirectAudioDevice
extends
AbstractMixer
{
// CONSTANTS
// CONSTANTS
private
static
final
int
CLIP_BUFFER_TIME
=
1000
;
// in milliseconds
private
static
final
int
CLIP_BUFFER_TIME
=
1000
;
// in milliseconds
...
@@ -335,8 +335,8 @@ class DirectAudioDevice extends AbstractMixer {
...
@@ -335,8 +335,8 @@ class DirectAudioDevice extends AbstractMixer {
* but isFormatSupported() also returns true
* but isFormatSupported() also returns true
* for formats with wrong endianness.
* for formats with wrong endianness.
*/
*/
private
static
class
DirectDLI
extends
DataLine
.
Info
{
private
static
final
class
DirectDLI
extends
DataLine
.
Info
{
AudioFormat
[]
hardwareFormats
;
final
AudioFormat
[]
hardwareFormats
;
private
DirectDLI
(
Class
clazz
,
AudioFormat
[]
formatArray
,
private
DirectDLI
(
Class
clazz
,
AudioFormat
[]
formatArray
,
AudioFormat
[]
hardwareFormatArray
,
AudioFormat
[]
hardwareFormatArray
,
...
@@ -370,12 +370,12 @@ class DirectAudioDevice extends AbstractMixer {
...
@@ -370,12 +370,12 @@ class DirectAudioDevice extends AbstractMixer {
* Private inner class as base class for direct lines
* Private inner class as base class for direct lines
*/
*/
private
static
class
DirectDL
extends
AbstractDataLine
implements
EventDispatcher
.
LineMonitor
{
private
static
class
DirectDL
extends
AbstractDataLine
implements
EventDispatcher
.
LineMonitor
{
protected
int
mixerIndex
;
protected
final
int
mixerIndex
;
protected
int
deviceID
;
protected
final
int
deviceID
;
protected
long
id
;
protected
long
id
;
protected
int
waitTime
;
protected
int
waitTime
;
protected
volatile
boolean
flushing
=
false
;
protected
volatile
boolean
flushing
=
false
;
protected
boolean
isSource
;
// true for SourceDataLine, false for TargetDataLine
protected
final
boolean
isSource
;
// true for SourceDataLine, false for TargetDataLine
protected
volatile
long
bytePosition
;
protected
volatile
long
bytePosition
;
protected
volatile
boolean
doIO
=
false
;
// true in between start() and stop() calls
protected
volatile
boolean
doIO
=
false
;
// true in between start() and stop() calls
protected
volatile
boolean
stoppedWritten
=
false
;
// true if a write occured in stopped state
protected
volatile
boolean
stoppedWritten
=
false
;
// true if a write occured in stopped state
...
@@ -387,10 +387,10 @@ class DirectAudioDevice extends AbstractMixer {
...
@@ -387,10 +387,10 @@ class DirectAudioDevice extends AbstractMixer {
protected
int
softwareConversionSize
=
0
;
protected
int
softwareConversionSize
=
0
;
protected
AudioFormat
hardwareFormat
;
protected
AudioFormat
hardwareFormat
;
private
Gain
gainControl
=
new
Gain
();
private
final
Gain
gainControl
=
new
Gain
();
private
Mute
muteControl
=
new
Mute
();
private
final
Mute
muteControl
=
new
Mute
();
private
Balance
balanceControl
=
new
Balance
();
private
final
Balance
balanceControl
=
new
Balance
();
private
Pan
panControl
=
new
Pan
();
private
final
Pan
panControl
=
new
Pan
();
private
float
leftGain
,
rightGain
;
private
float
leftGain
,
rightGain
;
protected
volatile
boolean
noService
=
false
;
// do not run the nService method
protected
volatile
boolean
noService
=
false
;
// do not run the nService method
...
@@ -829,7 +829,7 @@ class DirectAudioDevice extends AbstractMixer {
...
@@ -829,7 +829,7 @@ class DirectAudioDevice extends AbstractMixer {
/////////////////// CONTROLS /////////////////////////////
/////////////////// CONTROLS /////////////////////////////
protected
class
Gain
extends
FloatControl
{
protected
final
class
Gain
extends
FloatControl
{
private
float
linearGain
=
1.0f
;
private
float
linearGain
=
1.0f
;
...
@@ -862,7 +862,7 @@ class DirectAudioDevice extends AbstractMixer {
...
@@ -862,7 +862,7 @@ class DirectAudioDevice extends AbstractMixer {
}
// class Gain
}
// class Gain
private
class
Mute
extends
BooleanControl
{
private
final
class
Mute
extends
BooleanControl
{
private
Mute
()
{
private
Mute
()
{
super
(
BooleanControl
.
Type
.
MUTE
,
false
,
"True"
,
"False"
);
super
(
BooleanControl
.
Type
.
MUTE
,
false
,
"True"
,
"False"
);
...
@@ -874,7 +874,7 @@ class DirectAudioDevice extends AbstractMixer {
...
@@ -874,7 +874,7 @@ class DirectAudioDevice extends AbstractMixer {
}
}
}
// class Mute
}
// class Mute
private
class
Balance
extends
FloatControl
{
private
final
class
Balance
extends
FloatControl
{
private
Balance
()
{
private
Balance
()
{
super
(
FloatControl
.
Type
.
BALANCE
,
-
1.0f
,
1.0f
,
(
1.0f
/
128.0f
),
-
1
,
0.0f
,
super
(
FloatControl
.
Type
.
BALANCE
,
-
1.0f
,
1.0f
,
(
1.0f
/
128.0f
),
-
1
,
0.0f
,
...
@@ -893,7 +893,7 @@ class DirectAudioDevice extends AbstractMixer {
...
@@ -893,7 +893,7 @@ class DirectAudioDevice extends AbstractMixer {
}
// class Balance
}
// class Balance
private
class
Pan
extends
FloatControl
{
private
final
class
Pan
extends
FloatControl
{
private
Pan
()
{
private
Pan
()
{
super
(
FloatControl
.
Type
.
PAN
,
-
1.0f
,
1.0f
,
(
1.0f
/
128.0f
),
-
1
,
0.0f
,
super
(
FloatControl
.
Type
.
PAN
,
-
1.0f
,
1.0f
,
(
1.0f
/
128.0f
),
-
1
,
0.0f
,
...
@@ -918,7 +918,8 @@ class DirectAudioDevice extends AbstractMixer {
...
@@ -918,7 +918,8 @@ class DirectAudioDevice extends AbstractMixer {
/**
/**
* Private inner class representing a SourceDataLine
* Private inner class representing a SourceDataLine
*/
*/
private
static
class
DirectSDL
extends
DirectDL
implements
SourceDataLine
{
private
static
final
class
DirectSDL
extends
DirectDL
implements
SourceDataLine
{
// CONSTRUCTOR
// CONSTRUCTOR
private
DirectSDL
(
DataLine
.
Info
info
,
private
DirectSDL
(
DataLine
.
Info
info
,
...
@@ -934,7 +935,8 @@ class DirectAudioDevice extends AbstractMixer {
...
@@ -934,7 +935,8 @@ class DirectAudioDevice extends AbstractMixer {
/**
/**
* Private inner class representing a TargetDataLine
* Private inner class representing a TargetDataLine
*/
*/
private
static
class
DirectTDL
extends
DirectDL
implements
TargetDataLine
{
private
static
final
class
DirectTDL
extends
DirectDL
implements
TargetDataLine
{
// CONSTRUCTOR
// CONSTRUCTOR
private
DirectTDL
(
DataLine
.
Info
info
,
private
DirectTDL
(
DataLine
.
Info
info
,
...
@@ -1012,7 +1014,9 @@ class DirectAudioDevice extends AbstractMixer {
...
@@ -1012,7 +1014,9 @@ class DirectAudioDevice extends AbstractMixer {
* Private inner class representing a Clip
* Private inner class representing a Clip
* This clip is realized in software only
* This clip is realized in software only
*/
*/
private
static
class
DirectClip
extends
DirectDL
implements
Clip
,
Runnable
,
AutoClosingClip
{
private
static
final
class
DirectClip
extends
DirectDL
implements
Clip
,
Runnable
,
AutoClosingClip
{
private
Thread
thread
;
private
Thread
thread
;
private
byte
[]
audioData
=
null
;
private
byte
[]
audioData
=
null
;
private
int
frameSize
;
// size of one frame in bytes
private
int
frameSize
;
// size of one frame in bytes
...
@@ -1045,7 +1049,7 @@ class DirectAudioDevice extends AbstractMixer {
...
@@ -1045,7 +1049,7 @@ class DirectAudioDevice extends AbstractMixer {
byte
[]
newData
=
new
byte
[
bufferSize
];
byte
[]
newData
=
new
byte
[
bufferSize
];
System
.
arraycopy
(
data
,
offset
,
newData
,
0
,
bufferSize
);
System
.
arraycopy
(
data
,
offset
,
newData
,
0
,
bufferSize
);
open
(
format
,
d
ata
,
bufferSize
/
format
.
getFrameSize
());
open
(
format
,
newD
ata
,
bufferSize
/
format
.
getFrameSize
());
}
}
// this method does not copy the data array
// this method does not copy the data array
...
@@ -1443,7 +1447,7 @@ class DirectAudioDevice extends AbstractMixer {
...
@@ -1443,7 +1447,7 @@ class DirectAudioDevice extends AbstractMixer {
* which allows retrieval of the internal array
* which allows retrieval of the internal array
*/
*/
private
static
class
DirectBAOS
extends
ByteArrayOutputStream
{
private
static
class
DirectBAOS
extends
ByteArrayOutputStream
{
public
DirectBAOS
()
{
DirectBAOS
()
{
super
();
super
();
}
}
...
...
src/share/classes/com/sun/media/sound/DirectAudioDeviceProvider.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2002, 20
07
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 20
13
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -25,8 +25,6 @@
...
@@ -25,8 +25,6 @@
package
com.sun.media.sound
;
package
com.sun.media.sound
;
import
java.util.Vector
;
import
javax.sound.sampled.Mixer
;
import
javax.sound.sampled.Mixer
;
import
javax.sound.sampled.spi.MixerProvider
;
import
javax.sound.sampled.spi.MixerProvider
;
...
@@ -36,7 +34,7 @@ import javax.sound.sampled.spi.MixerProvider;
...
@@ -36,7 +34,7 @@ import javax.sound.sampled.spi.MixerProvider;
*
*
* @author Florian Bomers
* @author Florian Bomers
*/
*/
public
class
DirectAudioDeviceProvider
extends
MixerProvider
{
public
final
class
DirectAudioDeviceProvider
extends
MixerProvider
{
// STATIC VARIABLES
// STATIC VARIABLES
...
@@ -66,16 +64,17 @@ public class DirectAudioDeviceProvider extends MixerProvider {
...
@@ -66,16 +64,17 @@ public class DirectAudioDeviceProvider extends MixerProvider {
* Required public no-arg constructor.
* Required public no-arg constructor.
*/
*/
public
DirectAudioDeviceProvider
()
{
public
DirectAudioDeviceProvider
()
{
//if (Printer.trace) Printer.trace("DirectAudioDeviceProvider: constructor");
synchronized
(
DirectAudioDeviceProvider
.
class
)
{
if
(
Platform
.
isDirectAudioEnabled
())
{
if
(
Platform
.
isDirectAudioEnabled
())
{
init
();
init
();
}
else
{
}
else
{
infos
=
new
DirectAudioDeviceInfo
[
0
];
infos
=
new
DirectAudioDeviceInfo
[
0
];
devices
=
new
DirectAudioDevice
[
0
];
devices
=
new
DirectAudioDevice
[
0
];
}
}
}
}
}
private
s
ynchronized
s
tatic
void
init
()
{
private
static
void
init
()
{
// get the number of input devices
// get the number of input devices
int
numDevices
=
nGetNumDevices
();
int
numDevices
=
nGetNumDevices
();
...
@@ -94,36 +93,39 @@ public class DirectAudioDeviceProvider extends MixerProvider {
...
@@ -94,36 +93,39 @@ public class DirectAudioDeviceProvider extends MixerProvider {
}
}
public
Mixer
.
Info
[]
getMixerInfo
()
{
public
Mixer
.
Info
[]
getMixerInfo
()
{
Mixer
.
Info
[]
localArray
=
new
Mixer
.
Info
[
infos
.
length
];
synchronized
(
DirectAudioDeviceProvider
.
class
)
{
System
.
arraycopy
(
infos
,
0
,
localArray
,
0
,
infos
.
length
);
Mixer
.
Info
[]
localArray
=
new
Mixer
.
Info
[
infos
.
length
];
return
localArray
;
System
.
arraycopy
(
infos
,
0
,
localArray
,
0
,
infos
.
length
);
return
localArray
;
}
}
}
public
Mixer
getMixer
(
Mixer
.
Info
info
)
{
public
Mixer
getMixer
(
Mixer
.
Info
info
)
{
// if the default device is asked, we provide the mixer
synchronized
(
DirectAudioDeviceProvider
.
class
)
{
// with SourceDataLine's
// if the default device is asked, we provide the mixer
if
(
info
==
null
)
{
// with SourceDataLine's
for
(
int
i
=
0
;
i
<
infos
.
length
;
i
++)
{
if
(
info
==
null
)
{
Mixer
mixer
=
getDevice
(
infos
[
i
]);
for
(
int
i
=
0
;
i
<
infos
.
length
;
i
++)
{
if
(
mixer
.
getSourceLineInfo
().
length
>
0
)
{
Mixer
mixer
=
getDevice
(
infos
[
i
]);
return
mixer
;
if
(
mixer
.
getSourceLineInfo
().
length
>
0
)
{
return
mixer
;
}
}
}
}
}
}
// otherwise get the first mixer that matches
// otherwise get the first mixer that matches
// the requested info object
// the requested info object
for
(
int
i
=
0
;
i
<
infos
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
infos
.
length
;
i
++
)
{
if
(
infos
[
i
].
equals
(
info
)
)
{
if
(
infos
[
i
].
equals
(
info
))
{
return
getDevice
(
infos
[
i
]);
return
getDevice
(
infos
[
i
]);
}
}
}
}
}
throw
new
IllegalArgumentException
(
"Mixer "
+
info
.
toString
()
+
" not supported by this provider."
);
throw
new
IllegalArgumentException
(
"Mixer "
+
info
.
toString
()
+
" not supported by this provider."
);
}
}
private
Mixer
getDevice
(
DirectAudioDeviceInfo
info
)
{
private
static
Mixer
getDevice
(
DirectAudioDeviceInfo
info
)
{
int
index
=
info
.
getIndex
();
int
index
=
info
.
getIndex
();
if
(
devices
[
index
]
==
null
)
{
if
(
devices
[
index
]
==
null
)
{
devices
[
index
]
=
new
DirectAudioDevice
(
info
);
devices
[
index
]
=
new
DirectAudioDevice
(
info
);
...
@@ -139,12 +141,12 @@ public class DirectAudioDeviceProvider extends MixerProvider {
...
@@ -139,12 +141,12 @@ public class DirectAudioDeviceProvider extends MixerProvider {
* making native references to a particular device.
* making native references to a particular device.
* This constructor is called from native.
* This constructor is called from native.
*/
*/
static
class
DirectAudioDeviceInfo
extends
Mixer
.
Info
{
static
final
class
DirectAudioDeviceInfo
extends
Mixer
.
Info
{
private
int
index
;
private
final
int
index
;
private
int
maxSimulLines
;
private
final
int
maxSimulLines
;
// For ALSA, the deviceID contains the encoded card index, device index, and sub-device-index
// For ALSA, the deviceID contains the encoded card index, device index, and sub-device-index
private
int
deviceID
;
private
final
int
deviceID
;
private
DirectAudioDeviceInfo
(
int
index
,
int
deviceID
,
int
maxSimulLines
,
private
DirectAudioDeviceInfo
(
int
index
,
int
deviceID
,
int
maxSimulLines
,
String
name
,
String
vendor
,
String
name
,
String
vendor
,
...
...
src/share/classes/com/sun/media/sound/EmergencySoundbank.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -35,7 +35,7 @@ import javax.sound.sampled.AudioFormat;
...
@@ -35,7 +35,7 @@ import javax.sound.sampled.AudioFormat;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
EmergencySoundbank
{
public
final
class
EmergencySoundbank
{
private
final
static
String
[]
general_midi_instruments
=
{
private
final
static
String
[]
general_midi_instruments
=
{
"Acoustic Grand Piano"
,
"Acoustic Grand Piano"
,
...
...
src/share/classes/com/sun/media/sound/EventDispatcher.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 1998, 20
07
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 20
13
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -25,19 +25,15 @@
...
@@ -25,19 +25,15 @@
package
com.sun.media.sound
;
package
com.sun.media.sound
;
import
java.util.EventObject
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
javax.sound.sampled.Clip
;
import
javax.sound.midi.ControllerEventListener
;
import
javax.sound.sampled.Line
;
import
javax.sound.midi.MetaEventListener
;
import
javax.sound.sampled.LineEvent
;
import
javax.sound.sampled.LineListener
;
import
javax.sound.midi.MetaMessage
;
import
javax.sound.midi.MetaMessage
;
import
javax.sound.midi.ShortMessage
;
import
javax.sound.midi.ShortMessage
;
import
javax.sound.
midi.MetaEventListener
;
import
javax.sound.
sampled.LineEvent
;
import
javax.sound.
midi.ControllerEvent
Listener
;
import
javax.sound.
sampled.Line
Listener
;
...
@@ -49,7 +45,7 @@ import javax.sound.midi.ControllerEventListener;
...
@@ -49,7 +45,7 @@ import javax.sound.midi.ControllerEventListener;
* @author Kara Kytle
* @author Kara Kytle
* @author Florian Bomers
* @author Florian Bomers
*/
*/
class
EventDispatcher
implements
Runnable
{
final
class
EventDispatcher
implements
Runnable
{
/**
/**
* time of inactivity until the auto closing clips
* time of inactivity until the auto closing clips
...
@@ -61,7 +57,7 @@ class EventDispatcher implements Runnable {
...
@@ -61,7 +57,7 @@ class EventDispatcher implements Runnable {
/**
/**
* List of events
* List of events
*/
*/
private
ArrayList
eventQueue
=
new
ArrayList
();
private
final
ArrayList
eventQueue
=
new
ArrayList
();
/**
/**
...
@@ -73,12 +69,12 @@ class EventDispatcher implements Runnable {
...
@@ -73,12 +69,12 @@ class EventDispatcher implements Runnable {
/*
/*
* support for auto-closing Clips
* support for auto-closing Clips
*/
*/
private
ArrayList
<
ClipInfo
>
autoClosingClips
=
new
ArrayList
<
ClipInfo
>();
private
final
ArrayList
<
ClipInfo
>
autoClosingClips
=
new
ArrayList
<
ClipInfo
>();
/*
/*
* support for monitoring data lines
* support for monitoring data lines
*/
*/
private
ArrayList
<
LineMonitor
>
lineMonitors
=
new
ArrayList
<
LineMonitor
>();
private
final
ArrayList
<
LineMonitor
>
lineMonitors
=
new
ArrayList
<
LineMonitor
>();
/**
/**
* Approximate interval between calls to LineMonitor.checkLine
* Approximate interval between calls to LineMonitor.checkLine
...
@@ -105,7 +101,7 @@ class EventDispatcher implements Runnable {
...
@@ -105,7 +101,7 @@ class EventDispatcher implements Runnable {
* Invoked when there is at least one event in the queue.
* Invoked when there is at least one event in the queue.
* Implement this as a callback to process one event.
* Implement this as a callback to process one event.
*/
*/
protected
void
processEvent
(
EventInfo
eventInfo
)
{
void
processEvent
(
EventInfo
eventInfo
)
{
int
count
=
eventInfo
.
getListenerCount
();
int
count
=
eventInfo
.
getListenerCount
();
// process an LineEvent
// process an LineEvent
...
@@ -166,7 +162,7 @@ class EventDispatcher implements Runnable {
...
@@ -166,7 +162,7 @@ class EventDispatcher implements Runnable {
* exclusive access over the code where an event is removed from the
* exclusive access over the code where an event is removed from the
*queue.
*queue.
*/
*/
protected
void
dispatchEvents
()
{
void
dispatchEvents
()
{
EventInfo
eventInfo
=
null
;
EventInfo
eventInfo
=
null
;
...
@@ -388,8 +384,8 @@ class EventDispatcher implements Runnable {
...
@@ -388,8 +384,8 @@ class EventDispatcher implements Runnable {
*/
*/
private
class
EventInfo
{
private
class
EventInfo
{
private
Object
event
;
private
final
Object
event
;
private
Object
[]
listeners
;
private
final
Object
[]
listeners
;
/**
/**
* Create a new instance of this event Info class
* Create a new instance of this event Info class
...
@@ -421,8 +417,8 @@ class EventDispatcher implements Runnable {
...
@@ -421,8 +417,8 @@ class EventDispatcher implements Runnable {
*/
*/
private
class
ClipInfo
{
private
class
ClipInfo
{
private
AutoClosingClip
clip
;
private
final
AutoClosingClip
clip
;
private
long
expiration
;
private
final
long
expiration
;
/**
/**
* Create a new instance of this clip Info class
* Create a new instance of this clip Info class
...
...
src/share/classes/com/sun/media/sound/FFT.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -31,11 +31,11 @@ package com.sun.media.sound;
...
@@ -31,11 +31,11 @@ package com.sun.media.sound;
*/
*/
public
final
class
FFT
{
public
final
class
FFT
{
private
double
[]
w
;
private
final
double
[]
w
;
private
int
fftFrameSize
;
private
final
int
fftFrameSize
;
private
int
sign
;
private
final
int
sign
;
private
int
[]
bitm_array
;
private
final
int
[]
bitm_array
;
private
int
fftFrameSize2
;
private
final
int
fftFrameSize2
;
// Sign = -1 is FFT, 1 is IFFT (inverse FFT)
// Sign = -1 is FFT, 1 is IFFT (inverse FFT)
// Data = Interlaced double array to be transformed.
// Data = Interlaced double array to be transformed.
...
...
src/share/classes/com/sun/media/sound/FastShortMessage.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2002, 20
07
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 20
13
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -35,13 +35,13 @@ import javax.sound.midi.*;
...
@@ -35,13 +35,13 @@ import javax.sound.midi.*;
final
class
FastShortMessage
extends
ShortMessage
{
final
class
FastShortMessage
extends
ShortMessage
{
private
int
packedMsg
;
private
int
packedMsg
;
public
FastShortMessage
(
int
packedMsg
)
throws
InvalidMidiDataException
{
FastShortMessage
(
int
packedMsg
)
throws
InvalidMidiDataException
{
this
.
packedMsg
=
packedMsg
;
this
.
packedMsg
=
packedMsg
;
getDataLength
(
packedMsg
&
0xFF
);
// to check for validity
getDataLength
(
packedMsg
&
0xFF
);
// to check for validity
}
}
/** Creates a FastShortMessage from this ShortMessage */
/** Creates a FastShortMessage from this ShortMessage */
public
FastShortMessage
(
ShortMessage
msg
)
{
FastShortMessage
(
ShortMessage
msg
)
{
this
.
packedMsg
=
msg
.
getStatus
()
this
.
packedMsg
=
msg
.
getStatus
()
|
(
msg
.
getData1
()
<<
8
)
|
(
msg
.
getData1
()
<<
8
)
|
(
msg
.
getData2
()
<<
16
);
|
(
msg
.
getData2
()
<<
16
);
...
...
src/share/classes/com/sun/media/sound/JARSoundbankReader.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -36,14 +36,16 @@ import javax.sound.midi.InvalidMidiDataException;
...
@@ -36,14 +36,16 @@ import javax.sound.midi.InvalidMidiDataException;
import
javax.sound.midi.Soundbank
;
import
javax.sound.midi.Soundbank
;
import
javax.sound.midi.spi.SoundbankReader
;
import
javax.sound.midi.spi.SoundbankReader
;
import
sun.reflect.misc.ReflectUtil
;
/**
/**
* JarSoundbankReader is used to read sounbank object from jar files.
* JarSoundbankReader is used to read soun
d
bank object from jar files.
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
JARSoundbankReader
extends
SoundbankReader
{
public
final
class
JARSoundbankReader
extends
SoundbankReader
{
p
ubl
ic
boolean
isZIP
(
URL
url
)
{
p
rivate
stat
ic
boolean
isZIP
(
URL
url
)
{
boolean
ok
=
false
;
boolean
ok
=
false
;
try
{
try
{
InputStream
stream
=
url
.
openStream
();
InputStream
stream
=
url
.
openStream
();
...
@@ -81,14 +83,14 @@ public class JARSoundbankReader extends SoundbankReader {
...
@@ -81,14 +83,14 @@ public class JARSoundbankReader extends SoundbankReader {
while
(
line
!=
null
)
{
while
(
line
!=
null
)
{
if
(!
line
.
startsWith
(
"#"
))
{
if
(!
line
.
startsWith
(
"#"
))
{
try
{
try
{
Class
c
=
Class
.
forName
(
line
.
trim
(),
tru
e
,
ucl
);
Class
<?>
c
=
Class
.
forName
(
line
.
trim
(),
fals
e
,
ucl
);
Object
o
=
c
.
newInstance
();
if
(
Soundbank
.
class
.
isAssignableFrom
(
c
))
{
if
(
o
instanceof
Soundbank
)
{
Object
o
=
ReflectUtil
.
newInstance
(
c
);
soundbanks
.
add
((
Soundbank
)
o
);
soundbanks
.
add
((
Soundbank
)
o
);
}
}
}
catch
(
ClassNotFoundException
e
)
{
}
catch
(
ClassNotFoundException
ignored
)
{
}
catch
(
InstantiationException
e
)
{
}
catch
(
InstantiationException
ignored
)
{
}
catch
(
IllegalAccessException
e
)
{
}
catch
(
IllegalAccessException
ignored
)
{
}
}
}
}
line
=
r
.
readLine
();
line
=
r
.
readLine
();
...
...
src/share/classes/com/sun/media/sound/JDK13Services.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 1999, 20
09
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 20
13
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -31,16 +31,6 @@ import java.util.List;
...
@@ -31,16 +31,6 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Properties
;
import
java.util.Properties
;
import
javax.sound.sampled.spi.AudioFileReader
;
import
javax.sound.sampled.spi.AudioFileWriter
;
import
javax.sound.sampled.spi.FormatConversionProvider
;
import
javax.sound.sampled.spi.MixerProvider
;
import
javax.sound.midi.spi.MidiFileReader
;
import
javax.sound.midi.spi.MidiFileWriter
;
import
javax.sound.midi.spi.SoundbankReader
;
import
javax.sound.midi.spi.MidiDeviceProvider
;
import
javax.sound.midi.Receiver
;
import
javax.sound.midi.Receiver
;
import
javax.sound.midi.Sequencer
;
import
javax.sound.midi.Sequencer
;
import
javax.sound.midi.Synthesizer
;
import
javax.sound.midi.Synthesizer
;
...
@@ -62,7 +52,7 @@ import javax.sound.sampled.TargetDataLine;
...
@@ -62,7 +52,7 @@ import javax.sound.sampled.TargetDataLine;
*
*
* @author Matthias Pfisterer
* @author Matthias Pfisterer
*/
*/
public
class
JDK13Services
{
public
final
class
JDK13Services
{
/** The default for the length of the period to hold the cache.
/** The default for the length of the period to hold the cache.
This value is given in milliseconds. It is equivalent to
This value is given in milliseconds. It is equivalent to
...
@@ -80,7 +70,7 @@ public class JDK13Services {
...
@@ -80,7 +70,7 @@ public class JDK13Services {
Class objects of the provider type (MixerProvider, MidiDeviceProvider
Class objects of the provider type (MixerProvider, MidiDeviceProvider
...) are used as keys. The values are instances of ProviderCache.
...) are used as keys. The values are instances of ProviderCache.
*/
*/
private
static
Map
providersCacheMap
=
new
HashMap
();
private
static
final
Map
providersCacheMap
=
new
HashMap
();
/** The length of the period to hold the cache.
/** The length of the period to hold the cache.
...
...
src/share/classes/com/sun/media/sound/JSSecurityManager.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 1999, 20
09
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 20
13
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -47,7 +47,7 @@ import javax.sound.sampled.AudioPermission;
...
@@ -47,7 +47,7 @@ import javax.sound.sampled.AudioPermission;
*
*
* @author Matthias Pfisterer
* @author Matthias Pfisterer
*/
*/
class
JSSecurityManager
{
final
class
JSSecurityManager
{
/** Prevent instantiation.
/** Prevent instantiation.
*/
*/
...
@@ -73,30 +73,6 @@ class JSSecurityManager {
...
@@ -73,30 +73,6 @@ class JSSecurityManager {
}
}
}
}
static
void
loadLibrary
(
final
String
libName
)
{
try
{
if
(
hasSecurityManager
())
{
if
(
Printer
.
debug
)
Printer
.
debug
(
"using security manager to load library"
);
PrivilegedAction
<
Void
>
action
=
new
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
libName
);
return
null
;
}
};
AccessController
.
doPrivileged
(
action
);
}
else
{
if
(
Printer
.
debug
)
Printer
.
debug
(
"not using security manager to load library"
);
System
.
loadLibrary
(
libName
);
}
if
(
Printer
.
debug
)
Printer
.
debug
(
"loaded library "
+
libName
);
}
catch
(
UnsatisfiedLinkError
e2
)
{
if
(
Printer
.
err
)
Printer
.
err
(
"UnsatisfiedLinkError loading native library "
+
libName
);
throw
(
e2
);
}
}
static
String
getProperty
(
final
String
propertyName
)
{
static
String
getProperty
(
final
String
propertyName
)
{
String
propertyValue
;
String
propertyValue
;
if
(
hasSecurityManager
())
{
if
(
hasSecurityManager
())
{
...
@@ -189,83 +165,13 @@ class JSSecurityManager {
...
@@ -189,83 +165,13 @@ class JSSecurityManager {
if
(
Printer
.
trace
)
Printer
.
trace
(
"<< JSSecurityManager: loadPropertiesImpl() completed"
);
if
(
Printer
.
trace
)
Printer
.
trace
(
"<< JSSecurityManager: loadPropertiesImpl() completed"
);
}
}
/** Create a Thread in the current ThreadGroup.
private
static
ThreadGroup
getTopmostThreadGroup
()
{
ThreadGroup
topmostThreadGroup
;
if
(
hasSecurityManager
())
{
try
{
// invoke the privileged action using 1.2 security
PrivilegedAction
<
ThreadGroup
>
action
=
new
PrivilegedAction
<
ThreadGroup
>()
{
public
ThreadGroup
run
()
{
try
{
return
getTopmostThreadGroupImpl
();
}
catch
(
Throwable
t
)
{
return
null
;
}
}
};
topmostThreadGroup
=
AccessController
.
doPrivileged
(
action
);
if
(
Printer
.
debug
)
Printer
.
debug
(
"Got topmost thread group with JDK 1.2 security"
);
}
catch
(
Exception
e
)
{
if
(
Printer
.
debug
)
Printer
.
debug
(
"Exception getting topmost thread group with JDK 1.2 security"
);
// try without using JDK 1.2 security
topmostThreadGroup
=
getTopmostThreadGroupImpl
();
}
}
else
{
// not JDK 1.2 security, assume we already have permission
topmostThreadGroup
=
getTopmostThreadGroupImpl
();
}
return
topmostThreadGroup
;
}
private
static
ThreadGroup
getTopmostThreadGroupImpl
()
{
if
(
Printer
.
trace
)
Printer
.
trace
(
">> JSSecurityManager: getTopmostThreadGroupImpl()"
);
ThreadGroup
g
=
Thread
.
currentThread
().
getThreadGroup
();
while
((
g
.
getParent
()
!=
null
)
&&
(
g
.
getParent
().
getParent
()
!=
null
))
{
g
=
g
.
getParent
();
}
if
(
Printer
.
trace
)
Printer
.
trace
(
"<< JSSecurityManager: getTopmostThreadGroupImpl() completed"
);
return
g
;
}
/** Create a Thread in the topmost ThreadGroup.
*/
*/
static
Thread
createThread
(
final
Runnable
runnable
,
static
Thread
createThread
(
final
Runnable
runnable
,
final
String
threadName
,
final
String
threadName
,
final
boolean
isDaemon
,
final
int
priority
,
final
boolean
isDaemon
,
final
int
priority
,
final
boolean
doStart
)
{
final
boolean
doStart
)
{
Thread
thread
=
null
;
Thread
thread
=
new
Thread
(
runnable
);
if
(
hasSecurityManager
())
{
PrivilegedAction
<
Thread
>
action
=
new
PrivilegedAction
<
Thread
>()
{
public
Thread
run
()
{
try
{
return
createThreadImpl
(
runnable
,
threadName
,
isDaemon
,
priority
,
doStart
);
}
catch
(
Throwable
t
)
{
return
null
;
}
}
};
thread
=
AccessController
.
doPrivileged
(
action
);
if
(
Printer
.
debug
)
Printer
.
debug
(
"created thread with JDK 1.2 security"
);
}
else
{
if
(
Printer
.
debug
)
Printer
.
debug
(
"not using JDK 1.2 security"
);
thread
=
createThreadImpl
(
runnable
,
threadName
,
isDaemon
,
priority
,
doStart
);
}
return
thread
;
}
private
static
Thread
createThreadImpl
(
Runnable
runnable
,
String
threadName
,
boolean
isDaemon
,
int
priority
,
boolean
doStart
)
{
ThreadGroup
threadGroup
=
getTopmostThreadGroupImpl
();
Thread
thread
=
new
Thread
(
threadGroup
,
runnable
);
if
(
threadName
!=
null
)
{
if
(
threadName
!=
null
)
{
thread
.
setName
(
threadName
);
thread
.
setName
(
threadName
);
}
}
...
@@ -279,7 +185,6 @@ class JSSecurityManager {
...
@@ -279,7 +185,6 @@ class JSSecurityManager {
return
thread
;
return
thread
;
}
}
static
<
T
>
List
<
T
>
getProviders
(
final
Class
<
T
>
providerClass
)
{
static
<
T
>
List
<
T
>
getProviders
(
final
Class
<
T
>
providerClass
)
{
List
<
T
>
p
=
new
ArrayList
<>();
List
<
T
>
p
=
new
ArrayList
<>();
// ServiceLoader creates "lazy" iterator instance, so it doesn't,
// ServiceLoader creates "lazy" iterator instance, so it doesn't,
...
...
src/share/classes/com/sun/media/sound/JavaSoundAudioClip.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 1999, 20
07
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 20
13
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -28,25 +28,19 @@ package com.sun.media.sound;
...
@@ -28,25 +28,19 @@ package com.sun.media.sound;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.io.BufferedInputStream
;
import
java.io.BufferedInputStream
;
import
java.io.ByteArrayInputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.applet.AudioClip
;
import
java.applet.AudioClip
;
import
java.lang.InterruptedException
;
import
javax.sound.sampled.AudioSystem
;
import
javax.sound.sampled.AudioSystem
;
import
javax.sound.sampled.Mixer
;
import
javax.sound.sampled.Clip
;
import
javax.sound.sampled.Clip
;
import
javax.sound.sampled.Control
;
import
javax.sound.sampled.AudioInputStream
;
import
javax.sound.sampled.AudioInputStream
;
import
javax.sound.sampled.AudioFormat
;
import
javax.sound.sampled.AudioFormat
;
import
javax.sound.sampled.DataLine
;
import
javax.sound.sampled.DataLine
;
import
javax.sound.sampled.SourceDataLine
;
import
javax.sound.sampled.SourceDataLine
;
import
javax.sound.sampled.LineEvent
;
import
javax.sound.sampled.LineEvent
;
import
javax.sound.sampled.LineListener
;
import
javax.sound.sampled.LineListener
;
import
javax.sound.sampled.LineUnavailableException
;
import
javax.sound.sampled.UnsupportedAudioFileException
;
import
javax.sound.sampled.UnsupportedAudioFileException
;
import
javax.sound.midi.MidiSystem
;
import
javax.sound.midi.MidiSystem
;
import
javax.sound.midi.MidiFileFormat
;
import
javax.sound.midi.MidiFileFormat
;
import
javax.sound.midi.MetaMessage
;
import
javax.sound.midi.MetaMessage
;
...
@@ -63,7 +57,7 @@ import javax.sound.midi.MetaEventListener;
...
@@ -63,7 +57,7 @@ import javax.sound.midi.MetaEventListener;
* @author Florian Bomers
* @author Florian Bomers
*/
*/
public
class
JavaSoundAudioClip
implements
AudioClip
,
MetaEventListener
,
LineListener
{
public
final
class
JavaSoundAudioClip
implements
AudioClip
,
MetaEventListener
,
LineListener
{
private
static
final
boolean
DEBUG
=
false
;
private
static
final
boolean
DEBUG
=
false
;
private
static
final
int
BUFFER_SIZE
=
16384
;
// number of bytes written each time to the source data line
private
static
final
int
BUFFER_SIZE
=
16384
;
// number of bytes written each time to the source data line
...
@@ -476,7 +470,7 @@ public class JavaSoundAudioClip implements AudioClip, MetaEventListener, LineLis
...
@@ -476,7 +470,7 @@ public class JavaSoundAudioClip implements AudioClip, MetaEventListener, LineLis
* which allows retrieval of the internal array
* which allows retrieval of the internal array
*/
*/
private
static
class
DirectBAOS
extends
ByteArrayOutputStream
{
private
static
class
DirectBAOS
extends
ByteArrayOutputStream
{
public
DirectBAOS
()
{
DirectBAOS
()
{
super
();
super
();
}
}
...
...
src/share/classes/com/sun/media/sound/MidiDeviceReceiverEnvelope.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -33,7 +33,7 @@ import javax.sound.midi.*;
...
@@ -33,7 +33,7 @@ import javax.sound.midi.*;
*
*
* @author Alex Menkov
* @author Alex Menkov
*/
*/
public
class
MidiDeviceReceiverEnvelope
implements
MidiDeviceReceiver
{
public
final
class
MidiDeviceReceiverEnvelope
implements
MidiDeviceReceiver
{
private
final
MidiDevice
device
;
private
final
MidiDevice
device
;
private
final
Receiver
receiver
;
private
final
Receiver
receiver
;
...
...
src/share/classes/com/sun/media/sound/MidiDeviceTransmitterEnvelope.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -33,7 +33,7 @@ import javax.sound.midi.*;
...
@@ -33,7 +33,7 @@ import javax.sound.midi.*;
*
*
* @author Alex Menkov
* @author Alex Menkov
*/
*/
public
class
MidiDeviceTransmitterEnvelope
implements
MidiDeviceTransmitter
{
public
final
class
MidiDeviceTransmitterEnvelope
implements
MidiDeviceTransmitter
{
private
final
MidiDevice
device
;
private
final
MidiDevice
device
;
private
final
Transmitter
transmitter
;
private
final
Transmitter
transmitter
;
...
...
src/share/classes/com/sun/media/sound/MidiInDevice.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 1999, 20
07
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 20
13
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -25,9 +25,6 @@
...
@@ -25,9 +25,6 @@
package
com.sun.media.sound
;
package
com.sun.media.sound
;
import
java.util.ArrayList
;
import
java.util.List
;
import
javax.sound.midi.*
;
import
javax.sound.midi.*
;
...
@@ -39,7 +36,7 @@ import javax.sound.midi.*;
...
@@ -39,7 +36,7 @@ import javax.sound.midi.*;
* @author Kara Kytle
* @author Kara Kytle
* @author Florian Bomers
* @author Florian Bomers
*/
*/
class
MidiInDevice
extends
AbstractMidiDevice
implements
Runnable
{
final
class
MidiInDevice
extends
AbstractMidiDevice
implements
Runnable
{
private
Thread
midiInThread
=
null
;
private
Thread
midiInThread
=
null
;
...
@@ -127,7 +124,7 @@ class MidiInDevice extends AbstractMidiDevice implements Runnable {
...
@@ -127,7 +124,7 @@ class MidiInDevice extends AbstractMidiDevice implements Runnable {
* An own class to distinguish the class name from
* An own class to distinguish the class name from
* the transmitter of other devices
* the transmitter of other devices
*/
*/
private
class
MidiInTransmitter
extends
BasicTransmitter
{
private
final
class
MidiInTransmitter
extends
BasicTransmitter
{
private
MidiInTransmitter
()
{
private
MidiInTransmitter
()
{
super
();
super
();
}
}
...
...
src/share/classes/com/sun/media/sound/MidiInDeviceProvider.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 1999, 20
07
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 20
13
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -26,7 +26,6 @@
...
@@ -26,7 +26,6 @@
package
com.sun.media.sound
;
package
com.sun.media.sound
;
import
javax.sound.midi.MidiDevice
;
import
javax.sound.midi.MidiDevice
;
import
javax.sound.midi.spi.MidiDeviceProvider
;
/**
/**
...
@@ -35,15 +34,15 @@ import javax.sound.midi.spi.MidiDeviceProvider;
...
@@ -35,15 +34,15 @@ import javax.sound.midi.spi.MidiDeviceProvider;
* @author Kara Kytle
* @author Kara Kytle
* @author Florian Bomers
* @author Florian Bomers
*/
*/
public
class
MidiInDeviceProvider
extends
AbstractMidiDeviceProvider
{
public
final
class
MidiInDeviceProvider
extends
AbstractMidiDeviceProvider
{
/** Cache of info objects for all MIDI output devices on the system. */
/** Cache of info objects for all MIDI output devices on the system. */
static
Info
[]
infos
=
null
;
private
static
Info
[]
infos
=
null
;
/** Cache of open MIDI input devices on the system. */
/** Cache of open MIDI input devices on the system. */
static
MidiDevice
[]
devices
=
null
;
private
static
MidiDevice
[]
devices
=
null
;
private
static
boolean
enabled
;
private
static
final
boolean
enabled
;
// STATIC
// STATIC
...
@@ -106,8 +105,8 @@ public class MidiInDeviceProvider extends AbstractMidiDeviceProvider {
...
@@ -106,8 +105,8 @@ public class MidiInDeviceProvider extends AbstractMidiDeviceProvider {
* previous instance may still exist and be open / in use / etc.,
* previous instance may still exist and be open / in use / etc.,
* the new instance will not reflect that state...
* the new instance will not reflect that state...
*/
*/
static
class
MidiInDeviceInfo
extends
AbstractMidiDeviceProvider
.
Info
{
static
final
class
MidiInDeviceInfo
extends
AbstractMidiDeviceProvider
.
Info
{
private
Class
providerClass
;
private
final
Class
providerClass
;
private
MidiInDeviceInfo
(
int
index
,
Class
providerClass
)
{
private
MidiInDeviceInfo
(
int
index
,
Class
providerClass
)
{
super
(
nGetName
(
index
),
nGetVendor
(
index
),
nGetDescription
(
index
),
nGetVersion
(
index
),
index
);
super
(
nGetName
(
index
),
nGetVendor
(
index
),
nGetDescription
(
index
),
nGetVersion
(
index
),
index
);
...
...
src/share/classes/com/sun/media/sound/MidiOutDevice.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 1999, 20
07
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 20
13
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -36,7 +36,7 @@ import javax.sound.midi.*;
...
@@ -36,7 +36,7 @@ import javax.sound.midi.*;
* @author Kara Kytle
* @author Kara Kytle
* @author Florian Bomers
* @author Florian Bomers
*/
*/
class
MidiOutDevice
extends
AbstractMidiDevice
{
final
class
MidiOutDevice
extends
AbstractMidiDevice
{
// CONSTRUCTOR
// CONSTRUCTOR
...
@@ -101,7 +101,7 @@ class MidiOutDevice extends AbstractMidiDevice {
...
@@ -101,7 +101,7 @@ class MidiOutDevice extends AbstractMidiDevice {
// INNER CLASSES
// INNER CLASSES
class
MidiOutReceiver
extends
AbstractReceiver
{
final
class
MidiOutReceiver
extends
AbstractReceiver
{
void
implSend
(
final
MidiMessage
message
,
final
long
timeStamp
)
{
void
implSend
(
final
MidiMessage
message
,
final
long
timeStamp
)
{
final
int
length
=
message
.
getLength
();
final
int
length
=
message
.
getLength
();
...
...
src/share/classes/com/sun/media/sound/MidiOutDeviceProvider.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 1999, 20
07
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 20
13
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -26,7 +26,6 @@
...
@@ -26,7 +26,6 @@
package
com.sun.media.sound
;
package
com.sun.media.sound
;
import
javax.sound.midi.MidiDevice
;
import
javax.sound.midi.MidiDevice
;
import
javax.sound.midi.spi.MidiDeviceProvider
;
/**
/**
...
@@ -35,15 +34,15 @@ import javax.sound.midi.spi.MidiDeviceProvider;
...
@@ -35,15 +34,15 @@ import javax.sound.midi.spi.MidiDeviceProvider;
* @author Kara Kytle
* @author Kara Kytle
* @author Florian Bomers
* @author Florian Bomers
*/
*/
public
class
MidiOutDeviceProvider
extends
AbstractMidiDeviceProvider
{
public
final
class
MidiOutDeviceProvider
extends
AbstractMidiDeviceProvider
{
/** Cache of info objects for all MIDI output devices on the system. */
/** Cache of info objects for all MIDI output devices on the system. */
static
Info
[]
infos
=
null
;
private
static
Info
[]
infos
=
null
;
/** Cache of open MIDI output devices on the system. */
/** Cache of open MIDI output devices on the system. */
static
MidiDevice
[]
devices
=
null
;
private
static
MidiDevice
[]
devices
=
null
;
private
static
boolean
enabled
;
private
final
static
boolean
enabled
;
// STATIC
// STATIC
...
@@ -104,8 +103,8 @@ public class MidiOutDeviceProvider extends AbstractMidiDeviceProvider {
...
@@ -104,8 +103,8 @@ public class MidiOutDeviceProvider extends AbstractMidiDeviceProvider {
* previous instance may still exist and be open / in use / etc.,
* previous instance may still exist and be open / in use / etc.,
* the new instance will not reflect that state...
* the new instance will not reflect that state...
*/
*/
static
class
MidiOutDeviceInfo
extends
AbstractMidiDeviceProvider
.
Info
{
static
final
class
MidiOutDeviceInfo
extends
AbstractMidiDeviceProvider
.
Info
{
private
Class
providerClass
;
private
final
Class
providerClass
;
private
MidiOutDeviceInfo
(
int
index
,
Class
providerClass
)
{
private
MidiOutDeviceInfo
(
int
index
,
Class
providerClass
)
{
super
(
nGetName
(
index
),
nGetVendor
(
index
),
nGetDescription
(
index
),
nGetVersion
(
index
),
index
);
super
(
nGetName
(
index
),
nGetVendor
(
index
),
nGetDescription
(
index
),
nGetVersion
(
index
),
index
);
...
...
src/share/classes/com/sun/media/sound/MidiUtils.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2003, 20
07
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 20
13
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -36,12 +36,17 @@ import java.util.ArrayList;
...
@@ -36,12 +36,17 @@ import java.util.ArrayList;
*
*
* @author Florian Bomers
* @author Florian Bomers
*/
*/
public
class
MidiUtils
{
public
final
class
MidiUtils
{
public
final
static
int
DEFAULT_TEMPO_MPQ
=
500000
;
// 120bpm
public
final
static
int
DEFAULT_TEMPO_MPQ
=
500000
;
// 120bpm
public
final
static
int
META_END_OF_TRACK_TYPE
=
0x2F
;
public
final
static
int
META_END_OF_TRACK_TYPE
=
0x2F
;
public
final
static
int
META_TEMPO_TYPE
=
0x51
;
public
final
static
int
META_TEMPO_TYPE
=
0x51
;
/**
* Suppresses default constructor, ensuring non-instantiability.
*/
private
MidiUtils
()
{
}
/** return true if the passed message is Meta End Of Track */
/** return true if the passed message is Meta End Of Track */
public
static
boolean
isMetaEndOfTrack
(
MidiMessage
midiMsg
)
{
public
static
boolean
isMetaEndOfTrack
(
MidiMessage
midiMsg
)
{
...
@@ -262,7 +267,7 @@ public class MidiUtils {
...
@@ -262,7 +267,7 @@ public class MidiUtils {
}
}
public
static
class
TempoCache
{
public
static
final
class
TempoCache
{
long
[]
ticks
;
long
[]
ticks
;
int
[]
tempos
;
// in MPQ
int
[]
tempos
;
// in MPQ
// index in ticks/tempos at the snapshot
// index in ticks/tempos at the snapshot
...
...
src/share/classes/com/sun/media/sound/ModelByteBuffer.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -38,7 +38,7 @@ import java.util.Collection;
...
@@ -38,7 +38,7 @@ import java.util.Collection;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
ModelByteBuffer
{
public
final
class
ModelByteBuffer
{
private
ModelByteBuffer
root
=
this
;
private
ModelByteBuffer
root
=
this
;
private
File
file
;
private
File
file
;
...
@@ -49,12 +49,12 @@ public class ModelByteBuffer {
...
@@ -49,12 +49,12 @@ public class ModelByteBuffer {
private
class
RandomFileInputStream
extends
InputStream
{
private
class
RandomFileInputStream
extends
InputStream
{
private
RandomAccessFile
raf
;
private
final
RandomAccessFile
raf
;
private
long
left
;
private
long
left
;
private
long
mark
=
0
;
private
long
mark
=
0
;
private
long
markleft
=
0
;
private
long
markleft
=
0
;
public
RandomFileInputStream
()
throws
IOException
{
RandomFileInputStream
()
throws
IOException
{
raf
=
new
RandomAccessFile
(
root
.
file
,
"r"
);
raf
=
new
RandomAccessFile
(
root
.
file
,
"r"
);
raf
.
seek
(
root
.
fileoffset
+
arrayOffset
());
raf
.
seek
(
root
.
fileoffset
+
arrayOffset
());
left
=
capacity
();
left
=
capacity
();
...
...
src/share/classes/com/sun/media/sound/ModelByteBufferWavetable.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -36,18 +36,18 @@ import javax.sound.sampled.AudioFormat.Encoding;
...
@@ -36,18 +36,18 @@ import javax.sound.sampled.AudioFormat.Encoding;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
ModelByteBufferWavetable
implements
ModelWavetable
{
public
final
class
ModelByteBufferWavetable
implements
ModelWavetable
{
private
class
Buffer8PlusInputStream
extends
InputStream
{
private
class
Buffer8PlusInputStream
extends
InputStream
{
private
boolean
bigendian
;
private
final
boolean
bigendian
;
private
int
framesize_pc
;
private
final
int
framesize_pc
;
int
pos
=
0
;
int
pos
=
0
;
int
pos2
=
0
;
int
pos2
=
0
;
int
markpos
=
0
;
int
markpos
=
0
;
int
markpos2
=
0
;
int
markpos2
=
0
;
public
Buffer8PlusInputStream
()
{
Buffer8PlusInputStream
()
{
framesize_pc
=
format
.
getFrameSize
()
/
format
.
getChannels
();
framesize_pc
=
format
.
getFrameSize
()
/
format
.
getChannels
();
bigendian
=
format
.
isBigEndian
();
bigendian
=
format
.
isBigEndian
();
}
}
...
@@ -127,7 +127,7 @@ public class ModelByteBufferWavetable implements ModelWavetable {
...
@@ -127,7 +127,7 @@ public class ModelByteBufferWavetable implements ModelWavetable {
private
float
loopStart
=
-
1
;
private
float
loopStart
=
-
1
;
private
float
loopLength
=
-
1
;
private
float
loopLength
=
-
1
;
private
ModelByteBuffer
buffer
;
private
final
ModelByteBuffer
buffer
;
private
ModelByteBuffer
buffer8
=
null
;
private
ModelByteBuffer
buffer8
=
null
;
private
AudioFormat
format
=
null
;
private
AudioFormat
format
=
null
;
private
float
pitchcorrection
=
0
;
private
float
pitchcorrection
=
0
;
...
...
src/share/classes/com/sun/media/sound/ModelConnectionBlock.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -34,7 +34,7 @@ import java.util.Arrays;
...
@@ -34,7 +34,7 @@ import java.util.Arrays;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
ModelConnectionBlock
{
public
final
class
ModelConnectionBlock
{
//
//
// source1 * source2 * scale -> destination
// source1 * source2 * scale -> destination
...
...
src/share/classes/com/sun/media/sound/ModelDestination.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -30,7 +30,7 @@ package com.sun.media.sound;
...
@@ -30,7 +30,7 @@ package com.sun.media.sound;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
ModelDestination
{
public
final
class
ModelDestination
{
public
static
final
ModelIdentifier
DESTINATION_NONE
=
null
;
public
static
final
ModelIdentifier
DESTINATION_NONE
=
null
;
public
static
final
ModelIdentifier
DESTINATION_KEYNUMBER
public
static
final
ModelIdentifier
DESTINATION_KEYNUMBER
...
...
src/share/classes/com/sun/media/sound/ModelIdentifier.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -30,7 +30,7 @@ package com.sun.media.sound;
...
@@ -30,7 +30,7 @@ package com.sun.media.sound;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
ModelIdentifier
{
public
final
class
ModelIdentifier
{
/*
/*
* Object Variable
* Object Variable
...
...
src/share/classes/com/sun/media/sound/ModelInstrument.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -69,7 +69,7 @@ public abstract class ModelInstrument extends Instrument {
...
@@ -69,7 +69,7 @@ public abstract class ModelInstrument extends Instrument {
}
}
// Get General MIDI 2 Alias patch for this instrument.
// Get General MIDI 2 Alias patch for this instrument.
public
Patch
getPatchAlias
()
{
public
final
Patch
getPatchAlias
()
{
Patch
patch
=
getPatch
();
Patch
patch
=
getPatch
();
int
program
=
patch
.
getProgram
();
int
program
=
patch
.
getProgram
();
int
bank
=
patch
.
getBank
();
int
bank
=
patch
.
getBank
();
...
@@ -87,7 +87,7 @@ public abstract class ModelInstrument extends Instrument {
...
@@ -87,7 +87,7 @@ public abstract class ModelInstrument extends Instrument {
// Return name of all the keys.
// Return name of all the keys.
// This information is generated from ModelPerformer.getName()
// This information is generated from ModelPerformer.getName()
// returned from getPerformers().
// returned from getPerformers().
public
String
[]
getKeys
()
{
public
final
String
[]
getKeys
()
{
String
[]
keys
=
new
String
[
128
];
String
[]
keys
=
new
String
[
128
];
for
(
ModelPerformer
performer
:
getPerformers
())
{
for
(
ModelPerformer
performer
:
getPerformers
())
{
for
(
int
k
=
performer
.
getKeyFrom
();
k
<=
performer
.
getKeyTo
();
k
++)
{
for
(
int
k
=
performer
.
getKeyFrom
();
k
<=
performer
.
getKeyTo
();
k
++)
{
...
@@ -104,7 +104,7 @@ public abstract class ModelInstrument extends Instrument {
...
@@ -104,7 +104,7 @@ public abstract class ModelInstrument extends Instrument {
// Return what channels this instrument will probably response
// Return what channels this instrument will probably response
// on General MIDI synthesizer.
// on General MIDI synthesizer.
public
boolean
[]
getChannels
()
{
public
final
boolean
[]
getChannels
()
{
boolean
percussion
=
false
;
boolean
percussion
=
false
;
if
(
getPatch
()
instanceof
ModelPatch
)
if
(
getPatch
()
instanceof
ModelPatch
)
percussion
=
((
ModelPatch
)
getPatch
()).
isPercussion
();
percussion
=
((
ModelPatch
)
getPatch
()).
isPercussion
();
...
...
src/share/classes/com/sun/media/sound/ModelInstrumentComparator.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -34,7 +34,7 @@ import javax.sound.midi.Patch;
...
@@ -34,7 +34,7 @@ import javax.sound.midi.Patch;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
ModelInstrumentComparator
implements
Comparator
<
Instrument
>
{
public
final
class
ModelInstrumentComparator
implements
Comparator
<
Instrument
>
{
public
int
compare
(
Instrument
arg0
,
Instrument
arg1
)
{
public
int
compare
(
Instrument
arg0
,
Instrument
arg1
)
{
Patch
p0
=
arg0
.
getPatch
();
Patch
p0
=
arg0
.
getPatch
();
...
...
src/share/classes/com/sun/media/sound/ModelMappedInstrument.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -33,9 +33,9 @@ import javax.sound.sampled.AudioFormat;
...
@@ -33,9 +33,9 @@ import javax.sound.sampled.AudioFormat;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
ModelMappedInstrument
extends
ModelInstrument
{
public
final
class
ModelMappedInstrument
extends
ModelInstrument
{
private
ModelInstrument
ins
;
private
final
ModelInstrument
ins
;
public
ModelMappedInstrument
(
ModelInstrument
ins
,
Patch
patch
)
{
public
ModelMappedInstrument
(
ModelInstrument
ins
,
Patch
patch
)
{
super
(
ins
.
getSoundbank
(),
patch
,
ins
.
getName
(),
ins
.
getDataClass
());
super
(
ins
.
getSoundbank
(),
patch
,
ins
.
getName
(),
ins
.
getDataClass
());
...
...
src/share/classes/com/sun/media/sound/ModelPatch.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -33,7 +33,7 @@ import javax.sound.midi.Patch;
...
@@ -33,7 +33,7 @@ import javax.sound.midi.Patch;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
ModelPatch
extends
Patch
{
public
final
class
ModelPatch
extends
Patch
{
private
boolean
percussion
=
false
;
private
boolean
percussion
=
false
;
...
...
src/share/classes/com/sun/media/sound/ModelPerformer.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -33,9 +33,9 @@ import java.util.List;
...
@@ -33,9 +33,9 @@ import java.util.List;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
ModelPerformer
{
public
final
class
ModelPerformer
{
private
List
<
ModelOscillator
>
oscillators
=
new
ArrayList
<
ModelOscillator
>();
private
final
List
<
ModelOscillator
>
oscillators
=
new
ArrayList
<
ModelOscillator
>();
private
List
<
ModelConnectionBlock
>
connectionBlocks
private
List
<
ModelConnectionBlock
>
connectionBlocks
=
new
ArrayList
<
ModelConnectionBlock
>();
=
new
ArrayList
<
ModelConnectionBlock
>();
private
int
keyFrom
=
0
;
private
int
keyFrom
=
0
;
...
...
src/share/classes/com/sun/media/sound/ModelSource.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -30,7 +30,7 @@ package com.sun.media.sound;
...
@@ -30,7 +30,7 @@ package com.sun.media.sound;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
ModelSource
{
public
final
class
ModelSource
{
public
static
final
ModelIdentifier
SOURCE_NONE
=
null
;
public
static
final
ModelIdentifier
SOURCE_NONE
=
null
;
public
static
final
ModelIdentifier
SOURCE_NOTEON_KEYNUMBER
=
public
static
final
ModelIdentifier
SOURCE_NOTEON_KEYNUMBER
=
...
...
src/share/classes/com/sun/media/sound/ModelStandardDirector.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -30,7 +30,7 @@ package com.sun.media.sound;
...
@@ -30,7 +30,7 @@ package com.sun.media.sound;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
ModelStandardDirector
implements
ModelDirector
{
public
final
class
ModelStandardDirector
implements
ModelDirector
{
ModelPerformer
[]
performers
;
ModelPerformer
[]
performers
;
ModelDirectedPlayer
player
;
ModelDirectedPlayer
player
;
...
...
src/share/classes/com/sun/media/sound/ModelStandardIndexedDirector.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -30,7 +30,7 @@ package com.sun.media.sound;
...
@@ -30,7 +30,7 @@ package com.sun.media.sound;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
ModelStandardIndexedDirector
implements
ModelDirector
{
public
final
class
ModelStandardIndexedDirector
implements
ModelDirector
{
ModelPerformer
[]
performers
;
ModelPerformer
[]
performers
;
ModelDirectedPlayer
player
;
ModelDirectedPlayer
player
;
...
...
src/share/classes/com/sun/media/sound/ModelStandardTransform.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -36,7 +36,7 @@ package com.sun.media.sound;
...
@@ -36,7 +36,7 @@ package com.sun.media.sound;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
ModelStandardTransform
implements
ModelTransform
{
public
final
class
ModelStandardTransform
implements
ModelTransform
{
public
static
final
boolean
DIRECTION_MIN2MAX
=
false
;
public
static
final
boolean
DIRECTION_MIN2MAX
=
false
;
public
static
final
boolean
DIRECTION_MAX2MIN
=
true
;
public
static
final
boolean
DIRECTION_MAX2MIN
=
true
;
...
...
src/share/classes/com/sun/media/sound/PCMtoPCMCodec.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 1999, 20
07
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 20
13
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -25,14 +25,12 @@
...
@@ -25,14 +25,12 @@
package
com.sun.media.sound
;
package
com.sun.media.sound
;
import
java.io.InputStream
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.Vector
;
import
java.util.Vector
;
import
javax.sound.sampled.AudioFormat
;
import
javax.sound.sampled.AudioFormat
;
import
javax.sound.sampled.AudioSystem
;
import
javax.sound.sampled.AudioInputStream
;
import
javax.sound.sampled.AudioInputStream
;
import
javax.sound.sampled.AudioSystem
;
/**
/**
...
@@ -40,7 +38,7 @@ import javax.sound.sampled.AudioInputStream;
...
@@ -40,7 +38,7 @@ import javax.sound.sampled.AudioInputStream;
*
*
* @author Jan Borgersen
* @author Jan Borgersen
*/
*/
public
class
PCMtoPCMCodec
extends
SunCodec
{
public
final
class
PCMtoPCMCodec
extends
SunCodec
{
private
static
final
AudioFormat
.
Encoding
[]
inputEncodings
=
{
private
static
final
AudioFormat
.
Encoding
[]
inputEncodings
=
{
...
@@ -356,7 +354,7 @@ public class PCMtoPCMCodec extends SunCodec {
...
@@ -356,7 +354,7 @@ public class PCMtoPCMCodec extends SunCodec {
private
final
int
PCM_UNSIGNED_BE2SIGNED_LE
=
7
;
private
final
int
PCM_UNSIGNED_BE2SIGNED_LE
=
7
;
private
final
int
PCM_SIGNED_BE2UNSIGNED_LE
=
8
;
private
final
int
PCM_SIGNED_BE2UNSIGNED_LE
=
8
;
private
int
sampleSizeInBytes
=
0
;
private
final
int
sampleSizeInBytes
;
private
int
conversionType
=
0
;
private
int
conversionType
=
0
;
...
...
src/share/classes/com/sun/media/sound/Platform.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 1999, 20
07
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 20
13
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -25,6 +25,8 @@
...
@@ -25,6 +25,8 @@
package
com.sun.media.sound
;
package
com.sun.media.sound
;
import
java.security.AccessController
;
import
java.security.PrivilegedAction
;
import
java.util.StringTokenizer
;
import
java.util.StringTokenizer
;
...
@@ -35,7 +37,7 @@ import java.util.StringTokenizer;
...
@@ -35,7 +37,7 @@ import java.util.StringTokenizer;
* @author Kara Kytle
* @author Kara Kytle
* @author Florian Bomers
* @author Florian Bomers
*/
*/
class
Platform
{
final
class
Platform
{
// STATIC FINAL CHARACTERISTICS
// STATIC FINAL CHARACTERISTICS
...
@@ -157,7 +159,13 @@ class Platform {
...
@@ -157,7 +159,13 @@ class Platform {
try
{
try
{
// load the main library
// load the main library
JSSecurityManager
.
loadLibrary
(
libNameMain
);
AccessController
.
doPrivileged
(
new
PrivilegedAction
<
Void
>()
{
@Override
public
Void
run
()
{
System
.
loadLibrary
(
libNameMain
);
return
null
;
}
});
// just for the heck of it...
// just for the heck of it...
loadedLibs
|=
LIB_MAIN
;
loadedLibs
|=
LIB_MAIN
;
}
catch
(
SecurityException
e
)
{
}
catch
(
SecurityException
e
)
{
...
@@ -171,9 +179,16 @@ class Platform {
...
@@ -171,9 +179,16 @@ class Platform {
// the string is the libraries, separated by white space
// the string is the libraries, separated by white space
StringTokenizer
st
=
new
StringTokenizer
(
extraLibs
);
StringTokenizer
st
=
new
StringTokenizer
(
extraLibs
);
while
(
st
.
hasMoreTokens
())
{
while
(
st
.
hasMoreTokens
())
{
String
lib
=
st
.
nextToken
();
final
String
lib
=
st
.
nextToken
();
try
{
try
{
JSSecurityManager
.
loadLibrary
(
lib
);
AccessController
.
doPrivileged
(
new
PrivilegedAction
<
Void
>()
{
@Override
public
Void
run
()
{
System
.
loadLibrary
(
lib
);
return
null
;
}
});
if
(
lib
.
equals
(
libNameALSA
))
{
if
(
lib
.
equals
(
libNameALSA
))
{
loadedLibs
|=
LIB_ALSA
;
loadedLibs
|=
LIB_ALSA
;
if
(
Printer
.
debug
)
Printer
.
debug
(
"Loaded ALSA lib successfully."
);
if
(
Printer
.
debug
)
Printer
.
debug
(
"Loaded ALSA lib successfully."
);
...
...
src/share/classes/com/sun/media/sound/PortMixer.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2002, 20
07
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 20
13
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -41,7 +41,7 @@ import javax.sound.sampled.FloatControl;
...
@@ -41,7 +41,7 @@ import javax.sound.sampled.FloatControl;
*
*
* @author Florian Bomers
* @author Florian Bomers
*/
*/
class
PortMixer
extends
AbstractMixer
{
final
class
PortMixer
extends
AbstractMixer
{
// CONSTANTS
// CONSTANTS
private
static
final
int
SRC_UNKNOWN
=
0x01
;
private
static
final
int
SRC_UNKNOWN
=
0x01
;
...
@@ -228,8 +228,10 @@ class PortMixer extends AbstractMixer {
...
@@ -228,8 +228,10 @@ class PortMixer extends AbstractMixer {
/**
/**
* Private inner class representing a Port for the PortMixer.
* Private inner class representing a Port for the PortMixer.
*/
*/
private
static
class
PortMixerPort
extends
AbstractLine
implements
Port
{
private
static
final
class
PortMixerPort
extends
AbstractLine
private
int
portIndex
;
implements
Port
{
private
final
int
portIndex
;
private
long
id
;
private
long
id
;
// CONSTRUCTOR
// CONSTRUCTOR
...
@@ -342,9 +344,9 @@ class PortMixer extends AbstractMixer {
...
@@ -342,9 +344,9 @@ class PortMixer extends AbstractMixer {
/**
/**
* Private inner class representing a BooleanControl for PortMixerPort
* Private inner class representing a BooleanControl for PortMixerPort
*/
*/
private
static
class
BoolCtrl
extends
BooleanControl
{
private
static
final
class
BoolCtrl
extends
BooleanControl
{
// the handle to the native control function
// the handle to the native control function
private
long
controlID
;
private
final
long
controlID
;
private
boolean
closed
=
false
;
private
boolean
closed
=
false
;
private
static
BooleanControl
.
Type
createType
(
String
name
)
{
private
static
BooleanControl
.
Type
createType
(
String
name
)
{
...
@@ -386,7 +388,7 @@ class PortMixer extends AbstractMixer {
...
@@ -386,7 +388,7 @@ class PortMixer extends AbstractMixer {
/**
/**
* inner class for custom types
* inner class for custom types
*/
*/
private
static
class
BCT
extends
BooleanControl
.
Type
{
private
static
final
class
BCT
extends
BooleanControl
.
Type
{
private
BCT
(
String
name
)
{
private
BCT
(
String
name
)
{
super
(
name
);
super
(
name
);
}
}
...
@@ -396,7 +398,7 @@ class PortMixer extends AbstractMixer {
...
@@ -396,7 +398,7 @@ class PortMixer extends AbstractMixer {
/**
/**
* Private inner class representing a CompoundControl for PortMixerPort
* Private inner class representing a CompoundControl for PortMixerPort
*/
*/
private
static
class
CompCtrl
extends
CompoundControl
{
private
static
final
class
CompCtrl
extends
CompoundControl
{
private
CompCtrl
(
String
name
,
Control
[]
controls
)
{
private
CompCtrl
(
String
name
,
Control
[]
controls
)
{
super
(
new
CCT
(
name
),
controls
);
super
(
new
CCT
(
name
),
controls
);
}
}
...
@@ -404,7 +406,7 @@ class PortMixer extends AbstractMixer {
...
@@ -404,7 +406,7 @@ class PortMixer extends AbstractMixer {
/**
/**
* inner class for custom compound control types
* inner class for custom compound control types
*/
*/
private
static
class
CCT
extends
CompoundControl
.
Type
{
private
static
final
class
CCT
extends
CompoundControl
.
Type
{
private
CCT
(
String
name
)
{
private
CCT
(
String
name
)
{
super
(
name
);
super
(
name
);
}
}
...
@@ -414,9 +416,9 @@ class PortMixer extends AbstractMixer {
...
@@ -414,9 +416,9 @@ class PortMixer extends AbstractMixer {
/**
/**
* Private inner class representing a BooleanControl for PortMixerPort
* Private inner class representing a BooleanControl for PortMixerPort
*/
*/
private
static
class
FloatCtrl
extends
FloatControl
{
private
static
final
class
FloatCtrl
extends
FloatControl
{
// the handle to the native control function
// the handle to the native control function
private
long
controlID
;
private
final
long
controlID
;
private
boolean
closed
=
false
;
private
boolean
closed
=
false
;
// predefined float control types. See also Ports.h
// predefined float control types. See also Ports.h
...
@@ -462,7 +464,7 @@ class PortMixer extends AbstractMixer {
...
@@ -462,7 +464,7 @@ class PortMixer extends AbstractMixer {
/**
/**
* inner class for custom types
* inner class for custom types
*/
*/
private
static
class
FCT
extends
FloatControl
.
Type
{
private
static
final
class
FCT
extends
FloatControl
.
Type
{
private
FCT
(
String
name
)
{
private
FCT
(
String
name
)
{
super
(
name
);
super
(
name
);
}
}
...
@@ -472,7 +474,7 @@ class PortMixer extends AbstractMixer {
...
@@ -472,7 +474,7 @@ class PortMixer extends AbstractMixer {
/**
/**
* Private inner class representing a port info
* Private inner class representing a port info
*/
*/
private
static
class
PortInfo
extends
Port
.
Info
{
private
static
final
class
PortInfo
extends
Port
.
Info
{
private
PortInfo
(
String
name
,
boolean
isSource
)
{
private
PortInfo
(
String
name
,
boolean
isSource
)
{
super
(
Port
.
class
,
name
,
isSource
);
super
(
Port
.
class
,
name
,
isSource
);
}
}
...
...
src/share/classes/com/sun/media/sound/PortMixerProvider.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2002, 20
07
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 20
13
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -25,8 +25,6 @@
...
@@ -25,8 +25,6 @@
package
com.sun.media.sound
;
package
com.sun.media.sound
;
import
java.util.Vector
;
import
javax.sound.sampled.Mixer
;
import
javax.sound.sampled.Mixer
;
import
javax.sound.sampled.spi.MixerProvider
;
import
javax.sound.sampled.spi.MixerProvider
;
...
@@ -36,7 +34,7 @@ import javax.sound.sampled.spi.MixerProvider;
...
@@ -36,7 +34,7 @@ import javax.sound.sampled.spi.MixerProvider;
*
*
* @author Florian Bomers
* @author Florian Bomers
*/
*/
public
class
PortMixerProvider
extends
MixerProvider
{
public
final
class
PortMixerProvider
extends
MixerProvider
{
// STATIC VARIABLES
// STATIC VARIABLES
...
@@ -66,16 +64,17 @@ public class PortMixerProvider extends MixerProvider {
...
@@ -66,16 +64,17 @@ public class PortMixerProvider extends MixerProvider {
* Required public no-arg constructor.
* Required public no-arg constructor.
*/
*/
public
PortMixerProvider
()
{
public
PortMixerProvider
()
{
//if (Printer.trace) Printer.trace("PortMixerProvider: constructor");
synchronized
(
PortMixerProvider
.
class
)
{
if
(
Platform
.
isPortsEnabled
())
{
if
(
Platform
.
isPortsEnabled
())
{
init
();
init
();
}
else
{
}
else
{
infos
=
new
PortMixerInfo
[
0
];
infos
=
new
PortMixerInfo
[
0
];
devices
=
new
PortMixer
[
0
];
devices
=
new
PortMixer
[
0
];
}
}
}
}
}
private
static
synchronized
void
init
()
{
private
static
void
init
()
{
// get the number of input devices
// get the number of input devices
int
numDevices
=
nGetNumDevices
();
int
numDevices
=
nGetNumDevices
();
...
@@ -95,23 +94,28 @@ public class PortMixerProvider extends MixerProvider {
...
@@ -95,23 +94,28 @@ public class PortMixerProvider extends MixerProvider {
}
}
public
Mixer
.
Info
[]
getMixerInfo
()
{
public
Mixer
.
Info
[]
getMixerInfo
()
{
Mixer
.
Info
[]
localArray
=
new
Mixer
.
Info
[
infos
.
length
];
synchronized
(
PortMixerProvider
.
class
)
{
System
.
arraycopy
(
infos
,
0
,
localArray
,
0
,
infos
.
length
);
Mixer
.
Info
[]
localArray
=
new
Mixer
.
Info
[
infos
.
length
];
return
localArray
;
System
.
arraycopy
(
infos
,
0
,
localArray
,
0
,
infos
.
length
);
return
localArray
;
}
}
}
public
Mixer
getMixer
(
Mixer
.
Info
info
)
{
public
Mixer
getMixer
(
Mixer
.
Info
info
)
{
for
(
int
i
=
0
;
i
<
infos
.
length
;
i
++)
{
synchronized
(
PortMixerProvider
.
class
)
{
if
(
infos
[
i
].
equals
(
info
))
{
for
(
int
i
=
0
;
i
<
infos
.
length
;
i
++)
{
return
getDevice
(
infos
[
i
]);
if
(
infos
[
i
].
equals
(
info
))
{
return
getDevice
(
infos
[
i
]);
}
}
}
}
}
throw
new
IllegalArgumentException
(
"Mixer "
+
info
.
toString
()
+
" not supported by this provider."
);
throw
new
IllegalArgumentException
(
"Mixer "
+
info
.
toString
()
+
" not supported by this provider."
);
}
}
private
Mixer
getDevice
(
PortMixerInfo
info
)
{
private
static
Mixer
getDevice
(
PortMixerInfo
info
)
{
int
index
=
info
.
getIndex
();
int
index
=
info
.
getIndex
();
if
(
devices
[
index
]
==
null
)
{
if
(
devices
[
index
]
==
null
)
{
devices
[
index
]
=
new
PortMixer
(
info
);
devices
[
index
]
=
new
PortMixer
(
info
);
...
@@ -127,8 +131,8 @@ public class PortMixerProvider extends MixerProvider {
...
@@ -127,8 +131,8 @@ public class PortMixerProvider extends MixerProvider {
* making native references to a particular device.
* making native references to a particular device.
* This constructor is called from native.
* This constructor is called from native.
*/
*/
static
class
PortMixerInfo
extends
Mixer
.
Info
{
static
final
class
PortMixerInfo
extends
Mixer
.
Info
{
private
int
index
;
private
final
int
index
;
private
PortMixerInfo
(
int
index
,
String
name
,
String
vendor
,
String
description
,
String
version
)
{
private
PortMixerInfo
(
int
index
,
String
name
,
String
vendor
,
String
description
,
String
version
)
{
super
(
"Port "
+
name
,
vendor
,
description
,
version
);
super
(
"Port "
+
name
,
vendor
,
description
,
version
);
...
...
src/share/classes/com/sun/media/sound/Printer.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 1998, 20
07
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 20
13
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -32,7 +32,7 @@ package com.sun.media.sound;
...
@@ -32,7 +32,7 @@ package com.sun.media.sound;
* @author David Rivas
* @author David Rivas
* @author Kara Kytle
* @author Kara Kytle
*/
*/
class
Printer
{
final
class
Printer
{
static
final
boolean
err
=
false
;
static
final
boolean
err
=
false
;
static
final
boolean
debug
=
false
;
static
final
boolean
debug
=
false
;
...
@@ -68,6 +68,12 @@ class Printer {
...
@@ -68,6 +68,12 @@ class Printer {
release = on;
release = on;
}*/
}*/
/**
* Suppresses default constructor, ensuring non-instantiability.
*/
private
Printer
()
{
}
public
static
void
err
(
String
str
)
{
public
static
void
err
(
String
str
)
{
if
(
err
)
if
(
err
)
...
...
src/share/classes/com/sun/media/sound/RIFFInvalidDataException.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -29,7 +29,7 @@ package com.sun.media.sound;
...
@@ -29,7 +29,7 @@ package com.sun.media.sound;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
RIFFInvalidDataException
extends
InvalidDataException
{
public
final
class
RIFFInvalidDataException
extends
InvalidDataException
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
...
...
src/share/classes/com/sun/media/sound/RIFFInvalidFormatException.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -30,7 +30,7 @@ package com.sun.media.sound;
...
@@ -30,7 +30,7 @@ package com.sun.media.sound;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
RIFFInvalidFormatException
extends
InvalidFormatException
{
public
final
class
RIFFInvalidFormatException
extends
InvalidFormatException
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
...
...
src/share/classes/com/sun/media/sound/RIFFReader.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -33,11 +33,11 @@ import java.io.InputStream;
...
@@ -33,11 +33,11 @@ import java.io.InputStream;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
RIFFReader
extends
InputStream
{
public
final
class
RIFFReader
extends
InputStream
{
private
RIFFReader
root
;
private
final
RIFFReader
root
;
private
long
filepointer
=
0
;
private
long
filepointer
=
0
;
private
String
fourcc
;
private
final
String
fourcc
;
private
String
riff_type
=
null
;
private
String
riff_type
=
null
;
private
long
ckSize
=
0
;
private
long
ckSize
=
0
;
private
InputStream
stream
;
private
InputStream
stream
;
...
...
src/share/classes/com/sun/media/sound/RIFFWriter.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -35,7 +35,7 @@ import java.io.RandomAccessFile;
...
@@ -35,7 +35,7 @@ import java.io.RandomAccessFile;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
RIFFWriter
extends
OutputStream
{
public
final
class
RIFFWriter
extends
OutputStream
{
private
interface
RandomAccessWriter
{
private
interface
RandomAccessWriter
{
...
@@ -60,11 +60,11 @@ public class RIFFWriter extends OutputStream {
...
@@ -60,11 +60,11 @@ public class RIFFWriter extends OutputStream {
RandomAccessFile
raf
;
RandomAccessFile
raf
;
public
RandomAccessFileWriter
(
File
file
)
throws
FileNotFoundException
{
RandomAccessFileWriter
(
File
file
)
throws
FileNotFoundException
{
this
.
raf
=
new
RandomAccessFile
(
file
,
"rw"
);
this
.
raf
=
new
RandomAccessFile
(
file
,
"rw"
);
}
}
public
RandomAccessFileWriter
(
String
name
)
throws
FileNotFoundException
{
RandomAccessFileWriter
(
String
name
)
throws
FileNotFoundException
{
this
.
raf
=
new
RandomAccessFile
(
name
,
"rw"
);
this
.
raf
=
new
RandomAccessFile
(
name
,
"rw"
);
}
}
...
@@ -107,9 +107,9 @@ public class RIFFWriter extends OutputStream {
...
@@ -107,9 +107,9 @@ public class RIFFWriter extends OutputStream {
int
length
=
0
;
int
length
=
0
;
int
pos
=
0
;
int
pos
=
0
;
byte
[]
s
;
byte
[]
s
;
OutputStream
stream
;
final
OutputStream
stream
;
public
RandomAccessByteWriter
(
OutputStream
stream
)
{
RandomAccessByteWriter
(
OutputStream
stream
)
{
this
.
stream
=
stream
;
this
.
stream
=
stream
;
}
}
...
@@ -163,8 +163,8 @@ public class RIFFWriter extends OutputStream {
...
@@ -163,8 +163,8 @@ public class RIFFWriter extends OutputStream {
}
}
private
int
chunktype
=
0
;
// 0=RIFF, 1=LIST; 2=CHUNK
private
int
chunktype
=
0
;
// 0=RIFF, 1=LIST; 2=CHUNK
private
RandomAccessWriter
raf
;
private
RandomAccessWriter
raf
;
private
long
chunksizepointer
;
private
final
long
chunksizepointer
;
private
long
startpointer
;
private
final
long
startpointer
;
private
RIFFWriter
childchunk
=
null
;
private
RIFFWriter
childchunk
=
null
;
private
boolean
open
=
true
;
private
boolean
open
=
true
;
private
boolean
writeoverride
=
false
;
private
boolean
writeoverride
=
false
;
...
...
src/share/classes/com/sun/media/sound/RealTimeSequencer.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2003, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -25,14 +25,13 @@
...
@@ -25,14 +25,13 @@
package
com.sun.media.sound
;
package
com.sun.media.sound
;
import
java.io.ByteArrayOutputStream
;
import
java.io.ByteArrayInputStream
;
import
java.io.DataOutputStream
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.WeakHashMap
;
import
javax.sound.midi.*
;
import
javax.sound.midi.*
;
...
@@ -46,7 +45,8 @@ import javax.sound.midi.*;
...
@@ -46,7 +45,8 @@ import javax.sound.midi.*;
/* TODO:
/* TODO:
* - rename PlayThread to PlayEngine (because isn't a thread)
* - rename PlayThread to PlayEngine (because isn't a thread)
*/
*/
class
RealTimeSequencer
extends
AbstractMidiDevice
implements
Sequencer
,
AutoConnectSequencer
{
final
class
RealTimeSequencer
extends
AbstractMidiDevice
implements
Sequencer
,
AutoConnectSequencer
{
// STATIC VARIABLES
// STATIC VARIABLES
...
@@ -58,7 +58,8 @@ class RealTimeSequencer extends AbstractMidiDevice implements Sequencer, AutoCon
...
@@ -58,7 +58,8 @@ class RealTimeSequencer extends AbstractMidiDevice implements Sequencer, AutoCon
* Event Dispatcher thread. Should be using a shared event
* Event Dispatcher thread. Should be using a shared event
* dispatcher instance with a factory in EventDispatcher
* dispatcher instance with a factory in EventDispatcher
*/
*/
private
static
final
EventDispatcher
eventDispatcher
;
private
static
final
Map
<
ThreadGroup
,
EventDispatcher
>
dispatchers
=
new
WeakHashMap
<>();
/**
/**
* All RealTimeSequencers share this info object.
* All RealTimeSequencers share this info object.
...
@@ -66,11 +67,11 @@ class RealTimeSequencer extends AbstractMidiDevice implements Sequencer, AutoCon
...
@@ -66,11 +67,11 @@ class RealTimeSequencer extends AbstractMidiDevice implements Sequencer, AutoCon
static
final
RealTimeSequencerInfo
info
=
new
RealTimeSequencerInfo
();
static
final
RealTimeSequencerInfo
info
=
new
RealTimeSequencerInfo
();
private
static
Sequencer
.
SyncMode
[]
masterSyncModes
=
{
Sequencer
.
SyncMode
.
INTERNAL_CLOCK
};
private
static
final
Sequencer
.
SyncMode
[]
masterSyncModes
=
{
Sequencer
.
SyncMode
.
INTERNAL_CLOCK
};
private
static
Sequencer
.
SyncMode
[]
slaveSyncModes
=
{
Sequencer
.
SyncMode
.
NO_SYNC
};
private
static
final
Sequencer
.
SyncMode
[]
slaveSyncModes
=
{
Sequencer
.
SyncMode
.
NO_SYNC
};
private
static
Sequencer
.
SyncMode
masterSyncMode
=
Sequencer
.
SyncMode
.
INTERNAL_CLOCK
;
private
static
final
Sequencer
.
SyncMode
masterSyncMode
=
Sequencer
.
SyncMode
.
INTERNAL_CLOCK
;
private
static
Sequencer
.
SyncMode
slaveSyncMode
=
Sequencer
.
SyncMode
.
NO_SYNC
;
private
static
final
Sequencer
.
SyncMode
slaveSyncMode
=
Sequencer
.
SyncMode
.
NO_SYNC
;
/**
/**
...
@@ -100,7 +101,7 @@ class RealTimeSequencer extends AbstractMidiDevice implements Sequencer, AutoCon
...
@@ -100,7 +101,7 @@ class RealTimeSequencer extends AbstractMidiDevice implements Sequencer, AutoCon
private
boolean
[]
trackSolo
=
null
;
private
boolean
[]
trackSolo
=
null
;
/** tempo cache for getMicrosecondPosition */
/** tempo cache for getMicrosecondPosition */
private
MidiUtils
.
TempoCache
tempoCache
=
new
MidiUtils
.
TempoCache
();
private
final
MidiUtils
.
TempoCache
tempoCache
=
new
MidiUtils
.
TempoCache
();
/**
/**
* True if the sequence is running.
* True if the sequence is running.
...
@@ -121,7 +122,7 @@ class RealTimeSequencer extends AbstractMidiDevice implements Sequencer, AutoCon
...
@@ -121,7 +122,7 @@ class RealTimeSequencer extends AbstractMidiDevice implements Sequencer, AutoCon
/**
/**
* List of tracks to which we're recording
* List of tracks to which we're recording
*/
*/
private
List
recordingTracks
=
new
ArrayList
();
private
final
List
recordingTracks
=
new
ArrayList
();
private
long
loopStart
=
0
;
private
long
loopStart
=
0
;
...
@@ -132,13 +133,13 @@ class RealTimeSequencer extends AbstractMidiDevice implements Sequencer, AutoCon
...
@@ -132,13 +133,13 @@ class RealTimeSequencer extends AbstractMidiDevice implements Sequencer, AutoCon
/**
/**
* Meta event listeners
* Meta event listeners
*/
*/
private
ArrayList
metaEventListeners
=
new
ArrayList
();
private
final
ArrayList
metaEventListeners
=
new
ArrayList
();
/**
/**
* Control change listeners
* Control change listeners
*/
*/
private
ArrayList
controllerEventListeners
=
new
ArrayList
();
private
final
ArrayList
controllerEventListeners
=
new
ArrayList
();
/** automatic connection support */
/** automatic connection support */
...
@@ -151,16 +152,9 @@ class RealTimeSequencer extends AbstractMidiDevice implements Sequencer, AutoCon
...
@@ -151,16 +152,9 @@ class RealTimeSequencer extends AbstractMidiDevice implements Sequencer, AutoCon
Receiver
autoConnectedReceiver
=
null
;
Receiver
autoConnectedReceiver
=
null
;
static
{
// create and start the global event thread
eventDispatcher
=
new
EventDispatcher
();
eventDispatcher
.
start
();
}
/* ****************************** CONSTRUCTOR ****************************** */
/* ****************************** CONSTRUCTOR ****************************** */
protected
RealTimeSequencer
()
throws
MidiUnavailableException
{
RealTimeSequencer
()
throws
MidiUnavailableException
{
super
(
info
);
super
(
info
);
if
(
Printer
.
trace
)
Printer
.
trace
(
">> RealTimeSequencer CONSTRUCTOR"
);
if
(
Printer
.
trace
)
Printer
.
trace
(
">> RealTimeSequencer CONSTRUCTOR"
);
...
@@ -574,7 +568,7 @@ class RealTimeSequencer extends AbstractMidiDevice implements Sequencer, AutoCon
...
@@ -574,7 +568,7 @@ class RealTimeSequencer extends AbstractMidiDevice implements Sequencer, AutoCon
return
returnedModes
;
return
returnedModes
;
}
}
protected
int
getTrackCount
()
{
int
getTrackCount
()
{
Sequence
seq
=
getSequence
();
Sequence
seq
=
getSequence
();
if
(
seq
!=
null
)
{
if
(
seq
!=
null
)
{
// $$fb wish there was a nicer way to get the number of tracks...
// $$fb wish there was a nicer way to get the number of tracks...
...
@@ -872,7 +866,7 @@ class RealTimeSequencer extends AbstractMidiDevice implements Sequencer, AutoCon
...
@@ -872,7 +866,7 @@ class RealTimeSequencer extends AbstractMidiDevice implements Sequencer, AutoCon
if
(
Printer
.
trace
)
Printer
.
trace
(
"<< RealTimeSequencer: implClose() completed"
);
if
(
Printer
.
trace
)
Printer
.
trace
(
"<< RealTimeSequencer: implClose() completed"
);
}
}
protected
void
implStart
()
{
void
implStart
()
{
if
(
Printer
.
trace
)
Printer
.
trace
(
">> RealTimeSequencer: implStart()"
);
if
(
Printer
.
trace
)
Printer
.
trace
(
">> RealTimeSequencer: implStart()"
);
if
(
playThread
==
null
)
{
if
(
playThread
==
null
)
{
...
@@ -889,7 +883,7 @@ class RealTimeSequencer extends AbstractMidiDevice implements Sequencer, AutoCon
...
@@ -889,7 +883,7 @@ class RealTimeSequencer extends AbstractMidiDevice implements Sequencer, AutoCon
}
}
protected
void
implStop
()
{
void
implStop
()
{
if
(
Printer
.
trace
)
Printer
.
trace
(
">> RealTimeSequencer: implStop()"
);
if
(
Printer
.
trace
)
Printer
.
trace
(
">> RealTimeSequencer: implStop()"
);
if
(
playThread
==
null
)
{
if
(
playThread
==
null
)
{
...
@@ -905,22 +899,36 @@ class RealTimeSequencer extends AbstractMidiDevice implements Sequencer, AutoCon
...
@@ -905,22 +899,36 @@ class RealTimeSequencer extends AbstractMidiDevice implements Sequencer, AutoCon
if
(
Printer
.
trace
)
Printer
.
trace
(
"<< RealTimeSequencer: implStop() completed"
);
if
(
Printer
.
trace
)
Printer
.
trace
(
"<< RealTimeSequencer: implStop() completed"
);
}
}
private
static
EventDispatcher
getEventDispatcher
()
{
// create and start the global event thread
//TODO need a way to stop this thread when the engine is done
final
ThreadGroup
tg
=
Thread
.
currentThread
().
getThreadGroup
();
synchronized
(
dispatchers
)
{
EventDispatcher
eventDispatcher
=
dispatchers
.
get
(
tg
);
if
(
eventDispatcher
==
null
)
{
eventDispatcher
=
new
EventDispatcher
();
dispatchers
.
put
(
tg
,
eventDispatcher
);
eventDispatcher
.
start
();
}
return
eventDispatcher
;
}
}
/**
/**
* Send midi player events.
* Send midi player events.
* must not be synchronized on "this"
* must not be synchronized on "this"
*/
*/
protected
void
sendMetaEvents
(
MidiMessage
message
)
{
void
sendMetaEvents
(
MidiMessage
message
)
{
if
(
metaEventListeners
.
size
()
==
0
)
return
;
if
(
metaEventListeners
.
size
()
==
0
)
return
;
//if (Printer.debug) Printer.debug("sending a meta event");
//if (Printer.debug) Printer.debug("sending a meta event");
eventDispatcher
.
sendAudioEvents
(
message
,
metaEventListeners
);
getEventDispatcher
()
.
sendAudioEvents
(
message
,
metaEventListeners
);
}
}
/**
/**
* Send midi player events.
* Send midi player events.
*/
*/
protected
void
sendControllerEvents
(
MidiMessage
message
)
{
void
sendControllerEvents
(
MidiMessage
message
)
{
int
size
=
controllerEventListeners
.
size
();
int
size
=
controllerEventListeners
.
size
();
if
(
size
==
0
)
return
;
if
(
size
==
0
)
return
;
...
@@ -942,7 +950,7 @@ class RealTimeSequencer extends AbstractMidiDevice implements Sequencer, AutoCon
...
@@ -942,7 +950,7 @@ class RealTimeSequencer extends AbstractMidiDevice implements Sequencer, AutoCon
}
}
}
}
}
}
eventDispatcher
.
sendAudioEvents
(
message
,
sendToListeners
);
getEventDispatcher
()
.
sendAudioEvents
(
message
,
sendToListeners
);
}
}
...
@@ -1024,7 +1032,7 @@ class RealTimeSequencer extends AbstractMidiDevice implements Sequencer, AutoCon
...
@@ -1024,7 +1032,7 @@ class RealTimeSequencer extends AbstractMidiDevice implements Sequencer, AutoCon
}
}
class
SequencerReceiver
extends
AbstractReceiver
{
final
class
SequencerReceiver
extends
AbstractReceiver
{
void
implSend
(
MidiMessage
message
,
long
timeStamp
)
{
void
implSend
(
MidiMessage
message
,
long
timeStamp
)
{
if
(
recording
)
{
if
(
recording
)
{
...
@@ -1092,7 +1100,7 @@ class RealTimeSequencer extends AbstractMidiDevice implements Sequencer, AutoCon
...
@@ -1092,7 +1100,7 @@ class RealTimeSequencer extends AbstractMidiDevice implements Sequencer, AutoCon
// easier to deal with than turning all the
// easier to deal with than turning all the
// ints into objects to use a Vector
// ints into objects to use a Vector
int
[]
controllers
;
int
[]
controllers
;
ControllerEventListener
listener
;
final
ControllerEventListener
listener
;
private
ControllerListElement
(
ControllerEventListener
listener
,
int
[]
controllers
)
{
private
ControllerListElement
(
ControllerEventListener
listener
,
int
[]
controllers
)
{
...
@@ -1197,7 +1205,7 @@ class RealTimeSequencer extends AbstractMidiDevice implements Sequencer, AutoCon
...
@@ -1197,7 +1205,7 @@ class RealTimeSequencer extends AbstractMidiDevice implements Sequencer, AutoCon
static
class
RecordingTrack
{
static
class
RecordingTrack
{
private
Track
track
;
private
final
Track
track
;
private
int
channel
;
private
int
channel
;
RecordingTrack
(
Track
track
,
int
channel
)
{
RecordingTrack
(
Track
track
,
int
channel
)
{
...
@@ -1237,15 +1245,15 @@ class RealTimeSequencer extends AbstractMidiDevice implements Sequencer, AutoCon
...
@@ -1237,15 +1245,15 @@ class RealTimeSequencer extends AbstractMidiDevice implements Sequencer, AutoCon
}
}
class
PlayThread
implements
Runnable
{
final
class
PlayThread
implements
Runnable
{
private
Thread
thread
;
private
Thread
thread
;
private
Object
lock
=
new
Object
();
private
final
Object
lock
=
new
Object
();
/** true if playback is interrupted (in close) */
/** true if playback is interrupted (in close) */
boolean
interrupted
=
false
;
boolean
interrupted
=
false
;
boolean
isPumping
=
false
;
boolean
isPumping
=
false
;
private
DataPump
dataPump
=
new
DataPump
();
private
final
DataPump
dataPump
=
new
DataPump
();
PlayThread
()
{
PlayThread
()
{
...
...
src/share/classes/com/sun/media/sound/RealTimeSequencerProvider.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2003, 20
07
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 20
13
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -34,7 +34,7 @@ import javax.sound.midi.spi.MidiDeviceProvider;
...
@@ -34,7 +34,7 @@ import javax.sound.midi.spi.MidiDeviceProvider;
*
*
* @author Florian Bomers
* @author Florian Bomers
*/
*/
public
class
RealTimeSequencerProvider
extends
MidiDeviceProvider
{
public
final
class
RealTimeSequencerProvider
extends
MidiDeviceProvider
{
public
MidiDevice
.
Info
[]
getDeviceInfo
()
{
public
MidiDevice
.
Info
[]
getDeviceInfo
()
{
...
...
src/share/classes/com/sun/media/sound/SF2GlobalRegion.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -29,5 +29,5 @@ package com.sun.media.sound;
...
@@ -29,5 +29,5 @@ package com.sun.media.sound;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
SF2GlobalRegion
extends
SF2Region
{
public
final
class
SF2GlobalRegion
extends
SF2Region
{
}
}
src/share/classes/com/sun/media/sound/SF2Instrument.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -36,16 +36,16 @@ import javax.sound.midi.Patch;
...
@@ -36,16 +36,16 @@ import javax.sound.midi.Patch;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
SF2Instrument
extends
ModelInstrument
{
public
final
class
SF2Instrument
extends
ModelInstrument
{
protected
String
name
=
""
;
String
name
=
""
;
protected
int
preset
=
0
;
int
preset
=
0
;
protected
int
bank
=
0
;
int
bank
=
0
;
protected
long
library
=
0
;
long
library
=
0
;
protected
long
genre
=
0
;
long
genre
=
0
;
protected
long
morphology
=
0
;
long
morphology
=
0
;
protected
SF2GlobalRegion
globalregion
=
null
;
SF2GlobalRegion
globalregion
=
null
;
protected
List
<
SF2InstrumentRegion
>
regions
List
<
SF2InstrumentRegion
>
regions
=
new
ArrayList
<
SF2InstrumentRegion
>();
=
new
ArrayList
<
SF2InstrumentRegion
>();
public
SF2Instrument
()
{
public
SF2Instrument
()
{
...
@@ -730,7 +730,7 @@ public class SF2Instrument extends ModelInstrument {
...
@@ -730,7 +730,7 @@ public class SF2Instrument extends ModelInstrument {
return
msrc
;
return
msrc
;
}
}
protected
static
ModelDestination
convertDestination
(
int
dst
,
static
ModelDestination
convertDestination
(
int
dst
,
double
[]
amountcorrection
,
ModelSource
[]
extrasrc
)
{
double
[]
amountcorrection
,
ModelSource
[]
extrasrc
)
{
ModelIdentifier
id
=
null
;
ModelIdentifier
id
=
null
;
switch
(
dst
)
{
switch
(
dst
)
{
...
...
src/share/classes/com/sun/media/sound/SF2InstrumentRegion.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -29,9 +29,9 @@ package com.sun.media.sound;
...
@@ -29,9 +29,9 @@ package com.sun.media.sound;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
SF2InstrumentRegion
extends
SF2Region
{
public
final
class
SF2InstrumentRegion
extends
SF2Region
{
protected
SF2Layer
layer
;
SF2Layer
layer
;
public
SF2Layer
getLayer
()
{
public
SF2Layer
getLayer
()
{
return
layer
;
return
layer
;
...
...
src/share/classes/com/sun/media/sound/SF2Layer.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -34,11 +34,11 @@ import javax.sound.midi.SoundbankResource;
...
@@ -34,11 +34,11 @@ import javax.sound.midi.SoundbankResource;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
SF2Layer
extends
SoundbankResource
{
public
final
class
SF2Layer
extends
SoundbankResource
{
protected
String
name
=
""
;
String
name
=
""
;
protected
SF2GlobalRegion
globalregion
=
null
;
SF2GlobalRegion
globalregion
=
null
;
protected
List
<
SF2LayerRegion
>
regions
=
new
ArrayList
<
SF2LayerRegion
>();
List
<
SF2LayerRegion
>
regions
=
new
ArrayList
<
SF2LayerRegion
>();
public
SF2Layer
(
SF2Soundbank
soundBank
)
{
public
SF2Layer
(
SF2Soundbank
soundBank
)
{
super
(
soundBank
,
null
,
null
);
super
(
soundBank
,
null
,
null
);
...
...
src/share/classes/com/sun/media/sound/SF2LayerRegion.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -29,9 +29,9 @@ package com.sun.media.sound;
...
@@ -29,9 +29,9 @@ package com.sun.media.sound;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
SF2LayerRegion
extends
SF2Region
{
public
final
class
SF2LayerRegion
extends
SF2Region
{
protected
SF2Sample
sample
;
SF2Sample
sample
;
public
SF2Sample
getSample
()
{
public
SF2Sample
getSample
()
{
return
sample
;
return
sample
;
...
...
src/share/classes/com/sun/media/sound/SF2Modulator.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -29,7 +29,7 @@ package com.sun.media.sound;
...
@@ -29,7 +29,7 @@ package com.sun.media.sound;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
SF2Modulator
{
public
final
class
SF2Modulator
{
public
final
static
int
SOURCE_NONE
=
0
;
public
final
static
int
SOURCE_NONE
=
0
;
public
final
static
int
SOURCE_NOTE_ON_VELOCITY
=
2
;
public
final
static
int
SOURCE_NOTE_ON_VELOCITY
=
2
;
...
@@ -49,11 +49,11 @@ public class SF2Modulator {
...
@@ -49,11 +49,11 @@ public class SF2Modulator {
public
final
static
int
SOURCE_TYPE_SWITCH
=
1024
*
3
;
public
final
static
int
SOURCE_TYPE_SWITCH
=
1024
*
3
;
public
final
static
int
TRANSFORM_LINEAR
=
0
;
public
final
static
int
TRANSFORM_LINEAR
=
0
;
public
final
static
int
TRANSFORM_ABSOLUTE
=
2
;
public
final
static
int
TRANSFORM_ABSOLUTE
=
2
;
protected
int
sourceOperator
;
int
sourceOperator
;
protected
int
destinationOperator
;
int
destinationOperator
;
protected
short
amount
;
short
amount
;
protected
int
amountSourceOperator
;
int
amountSourceOperator
;
protected
int
transportOperator
;
int
transportOperator
;
public
short
getAmount
()
{
public
short
getAmount
()
{
return
amount
;
return
amount
;
...
...
src/share/classes/com/sun/media/sound/SF2Sample.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -36,18 +36,18 @@ import javax.sound.sampled.AudioInputStream;
...
@@ -36,18 +36,18 @@ import javax.sound.sampled.AudioInputStream;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
SF2Sample
extends
SoundbankResource
{
public
final
class
SF2Sample
extends
SoundbankResource
{
protected
String
name
=
""
;
String
name
=
""
;
protected
long
startLoop
=
0
;
long
startLoop
=
0
;
protected
long
endLoop
=
0
;
long
endLoop
=
0
;
protected
long
sampleRate
=
44100
;
long
sampleRate
=
44100
;
protected
int
originalPitch
=
60
;
int
originalPitch
=
60
;
protected
byte
pitchCorrection
=
0
;
byte
pitchCorrection
=
0
;
protected
int
sampleLink
=
0
;
int
sampleLink
=
0
;
protected
int
sampleType
=
0
;
int
sampleType
=
0
;
protected
ModelByteBuffer
data
;
ModelByteBuffer
data
;
protected
ModelByteBuffer
data24
;
ModelByteBuffer
data24
;
public
SF2Sample
(
Soundbank
soundBank
)
{
public
SF2Sample
(
Soundbank
soundBank
)
{
super
(
soundBank
,
null
,
AudioInputStream
.
class
);
super
(
soundBank
,
null
,
AudioInputStream
.
class
);
...
...
src/share/classes/com/sun/media/sound/SF2Soundbank.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -50,40 +50,40 @@ import javax.sound.midi.SoundbankResource;
...
@@ -50,40 +50,40 @@ import javax.sound.midi.SoundbankResource;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
SF2Soundbank
implements
Soundbank
{
public
final
class
SF2Soundbank
implements
Soundbank
{
// version of the Sound Font RIFF file
// version of the Sound Font RIFF file
protected
int
major
=
2
;
int
major
=
2
;
protected
int
minor
=
1
;
int
minor
=
1
;
// target Sound Engine
// target Sound Engine
protected
String
targetEngine
=
"EMU8000"
;
String
targetEngine
=
"EMU8000"
;
// Sound Font Bank Name
// Sound Font Bank Name
protected
String
name
=
"untitled"
;
String
name
=
"untitled"
;
// Sound ROM Name
// Sound ROM Name
protected
String
romName
=
null
;
String
romName
=
null
;
// Sound ROM Version
// Sound ROM Version
protected
int
romVersionMajor
=
-
1
;
int
romVersionMajor
=
-
1
;
protected
int
romVersionMinor
=
-
1
;
int
romVersionMinor
=
-
1
;
// Date of Creation of the Bank
// Date of Creation of the Bank
protected
String
creationDate
=
null
;
String
creationDate
=
null
;
// Sound Designers and Engineers for the Bank
// Sound Designers and Engineers for the Bank
protected
String
engineers
=
null
;
String
engineers
=
null
;
// Product for which the Bank was intended
// Product for which the Bank was intended
protected
String
product
=
null
;
String
product
=
null
;
// Copyright message
// Copyright message
protected
String
copyright
=
null
;
String
copyright
=
null
;
// Comments
// Comments
protected
String
comments
=
null
;
String
comments
=
null
;
// The SoundFont tools used to create and alter the bank
// The SoundFont tools used to create and alter the bank
protected
String
tools
=
null
;
String
tools
=
null
;
// The Sample Data loaded from the SoundFont
// The Sample Data loaded from the SoundFont
private
ModelByteBuffer
sampleData
=
null
;
private
ModelByteBuffer
sampleData
=
null
;
private
ModelByteBuffer
sampleData24
=
null
;
private
ModelByteBuffer
sampleData24
=
null
;
private
File
sampleFile
=
null
;
private
File
sampleFile
=
null
;
private
boolean
largeFormat
=
false
;
private
boolean
largeFormat
=
false
;
private
List
<
SF2Instrument
>
instruments
=
new
ArrayList
<
SF2Instrument
>();
private
final
List
<
SF2Instrument
>
instruments
=
new
ArrayList
<
SF2Instrument
>();
private
List
<
SF2Layer
>
layers
=
new
ArrayList
<
SF2Layer
>();
private
final
List
<
SF2Layer
>
layers
=
new
ArrayList
<
SF2Layer
>();
private
List
<
SF2Sample
>
samples
=
new
ArrayList
<
SF2Sample
>();
private
final
List
<
SF2Sample
>
samples
=
new
ArrayList
<
SF2Sample
>();
public
SF2Soundbank
()
{
public
SF2Soundbank
()
{
}
}
...
...
src/share/classes/com/sun/media/sound/SF2SoundbankReader.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -38,7 +38,7 @@ import javax.sound.midi.spi.SoundbankReader;
...
@@ -38,7 +38,7 @@ import javax.sound.midi.spi.SoundbankReader;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
SF2SoundbankReader
extends
SoundbankReader
{
public
final
class
SF2SoundbankReader
extends
SoundbankReader
{
public
Soundbank
getSoundbank
(
URL
url
)
public
Soundbank
getSoundbank
(
URL
url
)
throws
InvalidMidiDataException
,
IOException
{
throws
InvalidMidiDataException
,
IOException
{
...
...
src/share/classes/com/sun/media/sound/SoftAbstractResampler.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -67,7 +67,7 @@ public abstract class SoftAbstractResampler implements SoftResampler {
...
@@ -67,7 +67,7 @@ public abstract class SoftAbstractResampler implements SoftResampler {
float
samplerateconv
=
1
;
float
samplerateconv
=
1
;
float
pitchcorrection
=
0
;
float
pitchcorrection
=
0
;
public
ModelAbstractResamplerStream
()
{
ModelAbstractResamplerStream
()
{
pad
=
getPadding
();
pad
=
getPadding
();
pad2
=
getPadding
()
*
2
;
pad2
=
getPadding
()
*
2
;
ibuffer
=
new
float
[
2
][
sector_size
+
pad2
];
ibuffer
=
new
float
[
2
][
sector_size
+
pad2
];
...
@@ -384,7 +384,7 @@ public abstract class SoftAbstractResampler implements SoftResampler {
...
@@ -384,7 +384,7 @@ public abstract class SoftAbstractResampler implements SoftResampler {
float
in_end
,
float
[]
pitch
,
float
pitchstep
,
float
[]
out
,
float
in_end
,
float
[]
pitch
,
float
pitchstep
,
float
[]
out
,
int
[]
out_offset
,
int
out_end
);
int
[]
out_offset
,
int
out_end
);
public
SoftResamplerStreamer
openStreamer
()
{
public
final
SoftResamplerStreamer
openStreamer
()
{
return
new
ModelAbstractResamplerStream
();
return
new
ModelAbstractResamplerStream
();
}
}
}
}
src/share/classes/com/sun/media/sound/SoftAudioBuffer.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -33,7 +33,7 @@ import javax.sound.sampled.AudioFormat;
...
@@ -33,7 +33,7 @@ import javax.sound.sampled.AudioFormat;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
SoftAudioBuffer
{
public
final
class
SoftAudioBuffer
{
private
int
size
;
private
int
size
;
private
float
[]
buffer
;
private
float
[]
buffer
;
...
...
src/share/classes/com/sun/media/sound/SoftAudioPusher.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -34,13 +34,13 @@ import javax.sound.sampled.SourceDataLine;
...
@@ -34,13 +34,13 @@ import javax.sound.sampled.SourceDataLine;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
SoftAudioPusher
implements
Runnable
{
public
final
class
SoftAudioPusher
implements
Runnable
{
private
volatile
boolean
active
=
false
;
private
volatile
boolean
active
=
false
;
private
SourceDataLine
sourceDataLine
=
null
;
private
SourceDataLine
sourceDataLine
=
null
;
private
Thread
audiothread
;
private
Thread
audiothread
;
private
AudioInputStream
ais
;
private
final
AudioInputStream
ais
;
private
byte
[]
buffer
;
private
final
byte
[]
buffer
;
public
SoftAudioPusher
(
SourceDataLine
sourceDataLine
,
AudioInputStream
ais
,
public
SoftAudioPusher
(
SourceDataLine
sourceDataLine
,
AudioInputStream
ais
,
int
workbuffersizer
)
{
int
workbuffersizer
)
{
...
...
src/share/classes/com/sun/media/sound/SoftChannel.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -39,7 +39,7 @@ import javax.sound.midi.Patch;
...
@@ -39,7 +39,7 @@ import javax.sound.midi.Patch;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
SoftChannel
implements
MidiChannel
,
ModelDirectedPlayer
{
public
final
class
SoftChannel
implements
MidiChannel
,
ModelDirectedPlayer
{
private
static
boolean
[]
dontResetControls
=
new
boolean
[
128
];
private
static
boolean
[]
dontResetControls
=
new
boolean
[
128
];
static
{
static
{
...
@@ -90,15 +90,15 @@ public class SoftChannel implements MidiChannel, ModelDirectedPlayer {
...
@@ -90,15 +90,15 @@ public class SoftChannel implements MidiChannel, ModelDirectedPlayer {
private
static
final
int
RPN_NULL_VALUE
=
(
127
<<
7
)
+
127
;
private
static
final
int
RPN_NULL_VALUE
=
(
127
<<
7
)
+
127
;
private
int
rpn_control
=
RPN_NULL_VALUE
;
private
int
rpn_control
=
RPN_NULL_VALUE
;
private
int
nrpn_control
=
RPN_NULL_VALUE
;
private
int
nrpn_control
=
RPN_NULL_VALUE
;
protected
double
portamento_time
=
1
;
// keyschanges per control buffer time
double
portamento_time
=
1
;
// keyschanges per control buffer time
protected
int
[]
portamento_lastnote
=
new
int
[
128
];
int
[]
portamento_lastnote
=
new
int
[
128
];
protected
int
portamento_lastnote_ix
=
0
;
int
portamento_lastnote_ix
=
0
;
private
boolean
portamento
=
false
;
private
boolean
portamento
=
false
;
private
boolean
mono
=
false
;
private
boolean
mono
=
false
;
private
boolean
mute
=
false
;
private
boolean
mute
=
false
;
private
boolean
solo
=
false
;
private
boolean
solo
=
false
;
private
boolean
solomute
=
false
;
private
boolean
solomute
=
false
;
private
Object
control_mutex
;
private
final
Object
control_mutex
;
private
int
channel
;
private
int
channel
;
private
SoftVoice
[]
voices
;
private
SoftVoice
[]
voices
;
private
int
bank
;
private
int
bank
;
...
@@ -111,21 +111,21 @@ public class SoftChannel implements MidiChannel, ModelDirectedPlayer {
...
@@ -111,21 +111,21 @@ public class SoftChannel implements MidiChannel, ModelDirectedPlayer {
private
int
pitchbend
;
private
int
pitchbend
;
private
double
[]
co_midi_pitch
=
new
double
[
1
];
private
double
[]
co_midi_pitch
=
new
double
[
1
];
private
double
[]
co_midi_channel_pressure
=
new
double
[
1
];
private
double
[]
co_midi_channel_pressure
=
new
double
[
1
];
protected
SoftTuning
tuning
=
new
SoftTuning
();
SoftTuning
tuning
=
new
SoftTuning
();
protected
int
tuning_bank
=
0
;
int
tuning_bank
=
0
;
protected
int
tuning_program
=
0
;
int
tuning_program
=
0
;
protected
SoftInstrument
current_instrument
=
null
;
SoftInstrument
current_instrument
=
null
;
protected
ModelChannelMixer
current_mixer
=
null
;
ModelChannelMixer
current_mixer
=
null
;
protected
ModelDirector
current_director
=
null
;
ModelDirector
current_director
=
null
;
// Controller Destination Settings
// Controller Destination Settings
protected
int
cds_control_number
=
-
1
;
int
cds_control_number
=
-
1
;
protected
ModelConnectionBlock
[]
cds_control_connections
=
null
;
ModelConnectionBlock
[]
cds_control_connections
=
null
;
protected
ModelConnectionBlock
[]
cds_channelpressure_connections
=
null
;
ModelConnectionBlock
[]
cds_channelpressure_connections
=
null
;
protected
ModelConnectionBlock
[]
cds_polypressure_connections
=
null
;
ModelConnectionBlock
[]
cds_polypressure_connections
=
null
;
protected
boolean
sustain
=
false
;
boolean
sustain
=
false
;
protected
boolean
[][]
keybasedcontroller_active
=
null
;
boolean
[][]
keybasedcontroller_active
=
null
;
protected
double
[][]
keybasedcontroller_value
=
null
;
double
[][]
keybasedcontroller_value
=
null
;
private
class
MidiControlObject
implements
SoftControl
{
private
class
MidiControlObject
implements
SoftControl
{
double
[]
pitch
=
co_midi_pitch
;
double
[]
pitch
=
co_midi_pitch
;
...
@@ -336,7 +336,7 @@ public class SoftChannel implements MidiChannel, ModelDirectedPlayer {
...
@@ -336,7 +336,7 @@ public class SoftChannel implements MidiChannel, ModelDirectedPlayer {
}
}
protected
void
initVoice
(
SoftVoice
voice
,
SoftPerformer
p
,
int
voiceID
,
void
initVoice
(
SoftVoice
voice
,
SoftPerformer
p
,
int
voiceID
,
int
noteNumber
,
int
velocity
,
int
delay
,
ModelConnectionBlock
[]
connectionBlocks
,
int
noteNumber
,
int
velocity
,
int
delay
,
ModelConnectionBlock
[]
connectionBlocks
,
ModelChannelMixer
channelmixer
,
boolean
releaseTriggered
)
{
ModelChannelMixer
channelmixer
,
boolean
releaseTriggered
)
{
if
(
voice
.
active
)
{
if
(
voice
.
active
)
{
...
@@ -414,7 +414,7 @@ public class SoftChannel implements MidiChannel, ModelDirectedPlayer {
...
@@ -414,7 +414,7 @@ public class SoftChannel implements MidiChannel, ModelDirectedPlayer {
/* A special noteOn with delay parameter, which is used to
/* A special noteOn with delay parameter, which is used to
* start note within control buffers.
* start note within control buffers.
*/
*/
protected
void
noteOn
(
int
noteNumber
,
int
velocity
,
int
delay
)
{
void
noteOn
(
int
noteNumber
,
int
velocity
,
int
delay
)
{
noteNumber
=
restrict7Bit
(
noteNumber
);
noteNumber
=
restrict7Bit
(
noteNumber
);
velocity
=
restrict7Bit
(
velocity
);
velocity
=
restrict7Bit
(
velocity
);
noteOn_internal
(
noteNumber
,
velocity
,
delay
);
noteOn_internal
(
noteNumber
,
velocity
,
delay
);
...
@@ -707,7 +707,7 @@ public class SoftChannel implements MidiChannel, ModelDirectedPlayer {
...
@@ -707,7 +707,7 @@ public class SoftChannel implements MidiChannel, ModelDirectedPlayer {
}
}
}
}
protected
void
applyInstrumentCustomization
()
{
void
applyInstrumentCustomization
()
{
if
(
cds_control_connections
==
null
if
(
cds_control_connections
==
null
&&
cds_channelpressure_connections
==
null
&&
cds_channelpressure_connections
==
null
&&
cds_polypressure_connections
==
null
)
{
&&
cds_polypressure_connections
==
null
)
{
...
...
src/share/classes/com/sun/media/sound/SoftChannelProxy.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -32,7 +32,7 @@ import javax.sound.midi.MidiChannel;
...
@@ -32,7 +32,7 @@ import javax.sound.midi.MidiChannel;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
SoftChannelProxy
implements
MidiChannel
{
public
final
class
SoftChannelProxy
implements
MidiChannel
{
private
MidiChannel
channel
=
null
;
private
MidiChannel
channel
=
null
;
...
...
src/share/classes/com/sun/media/sound/SoftChorus.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -32,11 +32,11 @@ import java.util.Arrays;
...
@@ -32,11 +32,11 @@ import java.util.Arrays;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
SoftChorus
implements
SoftAudioProcessor
{
public
final
class
SoftChorus
implements
SoftAudioProcessor
{
private
static
class
VariableDelay
{
private
static
class
VariableDelay
{
private
float
[]
delaybuffer
;
private
f
inal
f
loat
[]
delaybuffer
;
private
int
rovepos
=
0
;
private
int
rovepos
=
0
;
private
float
gain
=
1
;
private
float
gain
=
1
;
private
float
rgain
=
0
;
private
float
rgain
=
0
;
...
@@ -44,7 +44,7 @@ public class SoftChorus implements SoftAudioProcessor {
...
@@ -44,7 +44,7 @@ public class SoftChorus implements SoftAudioProcessor {
private
float
lastdelay
=
0
;
private
float
lastdelay
=
0
;
private
float
feedback
=
0
;
private
float
feedback
=
0
;
public
VariableDelay
(
int
maxbuffersize
)
{
VariableDelay
(
int
maxbuffersize
)
{
delaybuffer
=
new
float
[
maxbuffersize
];
delaybuffer
=
new
float
[
maxbuffersize
];
}
}
...
@@ -119,10 +119,10 @@ public class SoftChorus implements SoftAudioProcessor {
...
@@ -119,10 +119,10 @@ public class SoftChorus implements SoftAudioProcessor {
private
double
phase_step
=
0
;
private
double
phase_step
=
0
;
private
double
depth
=
0
;
private
double
depth
=
0
;
private
VariableDelay
vdelay
;
private
VariableDelay
vdelay
;
private
double
samplerate
;
private
final
double
samplerate
;
private
double
controlrate
;
private
final
double
controlrate
;
public
LFODelay
(
double
samplerate
,
double
controlrate
)
{
LFODelay
(
double
samplerate
,
double
controlrate
)
{
this
.
samplerate
=
samplerate
;
this
.
samplerate
=
samplerate
;
this
.
controlrate
=
controlrate
;
this
.
controlrate
=
controlrate
;
// vdelay = new VariableDelay((int)(samplerate*4));
// vdelay = new VariableDelay((int)(samplerate*4));
...
...
src/share/classes/com/sun/media/sound/SoftCubicResampler.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -29,7 +29,7 @@ package com.sun.media.sound;
...
@@ -29,7 +29,7 @@ package com.sun.media.sound;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
SoftCubicResampler
extends
SoftAbstractResampler
{
public
final
class
SoftCubicResampler
extends
SoftAbstractResampler
{
public
int
getPadding
()
{
public
int
getPadding
()
{
return
3
;
return
3
;
...
...
src/share/classes/com/sun/media/sound/SoftEnvelopeGenerator.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -29,7 +29,7 @@ package com.sun.media.sound;
...
@@ -29,7 +29,7 @@ package com.sun.media.sound;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
SoftEnvelopeGenerator
implements
SoftProcess
{
public
final
class
SoftEnvelopeGenerator
implements
SoftProcess
{
public
final
static
int
EG_OFF
=
0
;
public
final
static
int
EG_OFF
=
0
;
public
final
static
int
EG_DELAY
=
1
;
public
final
static
int
EG_DELAY
=
1
;
...
@@ -42,23 +42,23 @@ public class SoftEnvelopeGenerator implements SoftProcess {
...
@@ -42,23 +42,23 @@ public class SoftEnvelopeGenerator implements SoftProcess {
public
final
static
int
EG_END
=
8
;
public
final
static
int
EG_END
=
8
;
int
max_count
=
10
;
int
max_count
=
10
;
int
used_count
=
0
;
int
used_count
=
0
;
private
int
[]
stage
=
new
int
[
max_count
];
private
final
int
[]
stage
=
new
int
[
max_count
];
private
int
[]
stage_ix
=
new
int
[
max_count
];
private
final
int
[]
stage_ix
=
new
int
[
max_count
];
private
double
[]
stage_v
=
new
double
[
max_count
];
private
final
double
[]
stage_v
=
new
double
[
max_count
];
private
int
[]
stage_count
=
new
int
[
max_count
];
private
final
int
[]
stage_count
=
new
int
[
max_count
];
private
double
[][]
on
=
new
double
[
max_count
][
1
];
private
final
double
[][]
on
=
new
double
[
max_count
][
1
];
private
double
[][]
active
=
new
double
[
max_count
][
1
];
private
final
double
[][]
active
=
new
double
[
max_count
][
1
];
private
double
[][]
out
=
new
double
[
max_count
][
1
];
private
final
double
[][]
out
=
new
double
[
max_count
][
1
];
private
double
[][]
delay
=
new
double
[
max_count
][
1
];
private
final
double
[][]
delay
=
new
double
[
max_count
][
1
];
private
double
[][]
attack
=
new
double
[
max_count
][
1
];
private
final
double
[][]
attack
=
new
double
[
max_count
][
1
];
private
double
[][]
hold
=
new
double
[
max_count
][
1
];
private
final
double
[][]
hold
=
new
double
[
max_count
][
1
];
private
double
[][]
decay
=
new
double
[
max_count
][
1
];
private
final
double
[][]
decay
=
new
double
[
max_count
][
1
];
private
double
[][]
sustain
=
new
double
[
max_count
][
1
];
private
final
double
[][]
sustain
=
new
double
[
max_count
][
1
];
private
double
[][]
release
=
new
double
[
max_count
][
1
];
private
final
double
[][]
release
=
new
double
[
max_count
][
1
];
private
double
[][]
shutdown
=
new
double
[
max_count
][
1
];
private
final
double
[][]
shutdown
=
new
double
[
max_count
][
1
];
private
double
[][]
release2
=
new
double
[
max_count
][
1
];
private
final
double
[][]
release2
=
new
double
[
max_count
][
1
];
private
double
[][]
attack2
=
new
double
[
max_count
][
1
];
private
final
double
[][]
attack2
=
new
double
[
max_count
][
1
];
private
double
[][]
decay2
=
new
double
[
max_count
][
1
];
private
final
double
[][]
decay2
=
new
double
[
max_count
][
1
];
private
double
control_time
=
0
;
private
double
control_time
=
0
;
public
void
reset
()
{
public
void
reset
()
{
...
...
src/share/classes/com/sun/media/sound/SoftFilter.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -33,7 +33,7 @@ package com.sun.media.sound;
...
@@ -33,7 +33,7 @@ package com.sun.media.sound;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
SoftFilter
{
public
final
class
SoftFilter
{
public
final
static
int
FILTERTYPE_LP6
=
0x00
;
public
final
static
int
FILTERTYPE_LP6
=
0x00
;
public
final
static
int
FILTERTYPE_LP12
=
0x01
;
public
final
static
int
FILTERTYPE_LP12
=
0x01
;
...
@@ -55,7 +55,7 @@ public class SoftFilter {
...
@@ -55,7 +55,7 @@ public class SoftFilter {
// 0x30 = NP, Notch or Band Elimination Filter
// 0x30 = NP, Notch or Band Elimination Filter
//
//
private
int
filtertype
=
FILTERTYPE_LP6
;
private
int
filtertype
=
FILTERTYPE_LP6
;
private
float
samplerate
;
private
f
inal
f
loat
samplerate
;
private
float
x1
;
private
float
x1
;
private
float
x2
;
private
float
x2
;
private
float
y1
;
private
float
y1
;
...
...
src/share/classes/com/sun/media/sound/SoftInstrument.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -32,12 +32,12 @@ import javax.sound.midi.MidiChannel;
...
@@ -32,12 +32,12 @@ import javax.sound.midi.MidiChannel;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
SoftInstrument
extends
Instrument
{
public
final
class
SoftInstrument
extends
Instrument
{
private
SoftPerformer
[]
performers
;
private
SoftPerformer
[]
performers
;
private
ModelPerformer
[]
modelperformers
;
private
ModelPerformer
[]
modelperformers
;
private
Object
data
;
private
final
Object
data
;
private
ModelInstrument
ins
;
private
final
ModelInstrument
ins
;
public
SoftInstrument
(
ModelInstrument
ins
)
{
public
SoftInstrument
(
ModelInstrument
ins
)
{
super
(
ins
.
getSoundbank
(),
ins
.
getPatch
(),
ins
.
getName
(),
super
(
ins
.
getSoundbank
(),
ins
.
getPatch
(),
ins
.
getName
(),
...
...
src/share/classes/com/sun/media/sound/SoftJitterCorrector.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -36,7 +36,7 @@ import javax.sound.sampled.AudioInputStream;
...
@@ -36,7 +36,7 @@ import javax.sound.sampled.AudioInputStream;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
SoftJitterCorrector
extends
AudioInputStream
{
public
final
class
SoftJitterCorrector
extends
AudioInputStream
{
private
static
class
JitterStream
extends
InputStream
{
private
static
class
JitterStream
extends
InputStream
{
...
@@ -48,7 +48,7 @@ public class SoftJitterCorrector extends AudioInputStream {
...
@@ -48,7 +48,7 @@ public class SoftJitterCorrector extends AudioInputStream {
int
writepos
=
0
;
int
writepos
=
0
;
int
readpos
=
0
;
int
readpos
=
0
;
byte
[][]
buffers
;
byte
[][]
buffers
;
Object
buffers_mutex
=
new
Object
();
private
final
Object
buffers_mutex
=
new
Object
();
// Adapative Drift Statistics
// Adapative Drift Statistics
int
w_count
=
1000
;
int
w_count
=
1000
;
...
@@ -112,7 +112,7 @@ public class SoftJitterCorrector extends AudioInputStream {
...
@@ -112,7 +112,7 @@ public class SoftJitterCorrector extends AudioInputStream {
}
}
}
}
public
JitterStream
(
AudioInputStream
s
,
int
buffersize
,
JitterStream
(
AudioInputStream
s
,
int
buffersize
,
int
smallbuffersize
)
{
int
smallbuffersize
)
{
this
.
w_count
=
10
*
(
buffersize
/
smallbuffersize
);
this
.
w_count
=
10
*
(
buffersize
/
smallbuffersize
);
if
(
w_count
<
100
)
if
(
w_count
<
100
)
...
...
src/share/classes/com/sun/media/sound/SoftLanczosResampler.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -29,7 +29,7 @@ package com.sun.media.sound;
...
@@ -29,7 +29,7 @@ package com.sun.media.sound;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
SoftLanczosResampler
extends
SoftAbstractResampler
{
public
final
class
SoftLanczosResampler
extends
SoftAbstractResampler
{
float
[][]
sinc_table
;
float
[][]
sinc_table
;
int
sinc_table_fsize
=
2000
;
int
sinc_table_fsize
=
2000
;
...
...
src/share/classes/com/sun/media/sound/SoftLimiter.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -30,7 +30,7 @@ package com.sun.media.sound;
...
@@ -30,7 +30,7 @@ package com.sun.media.sound;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
SoftLimiter
implements
SoftAudioProcessor
{
public
final
class
SoftLimiter
implements
SoftAudioProcessor
{
float
lastmax
=
0
;
float
lastmax
=
0
;
float
gain
=
1
;
float
gain
=
1
;
...
...
src/share/classes/com/sun/media/sound/SoftLinearResampler.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -29,7 +29,7 @@ package com.sun.media.sound;
...
@@ -29,7 +29,7 @@ package com.sun.media.sound;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
SoftLinearResampler
extends
SoftAbstractResampler
{
public
final
class
SoftLinearResampler
extends
SoftAbstractResampler
{
public
int
getPadding
()
{
public
int
getPadding
()
{
return
2
;
return
2
;
...
...
src/share/classes/com/sun/media/sound/SoftLinearResampler2.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -31,7 +31,7 @@ package com.sun.media.sound;
...
@@ -31,7 +31,7 @@ package com.sun.media.sound;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
SoftLinearResampler2
extends
SoftAbstractResampler
{
public
final
class
SoftLinearResampler2
extends
SoftAbstractResampler
{
public
int
getPadding
()
{
public
int
getPadding
()
{
return
2
;
return
2
;
...
...
src/share/classes/com/sun/media/sound/SoftLowFrequencyOscillator.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -29,21 +29,21 @@ package com.sun.media.sound;
...
@@ -29,21 +29,21 @@ package com.sun.media.sound;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
SoftLowFrequencyOscillator
implements
SoftProcess
{
public
final
class
SoftLowFrequencyOscillator
implements
SoftProcess
{
private
int
max_count
=
10
;
private
final
int
max_count
=
10
;
private
int
used_count
=
0
;
private
int
used_count
=
0
;
private
double
[][]
out
=
new
double
[
max_count
][
1
];
private
final
double
[][]
out
=
new
double
[
max_count
][
1
];
private
double
[][]
delay
=
new
double
[
max_count
][
1
];
private
final
double
[][]
delay
=
new
double
[
max_count
][
1
];
private
double
[][]
delay2
=
new
double
[
max_count
][
1
];
private
final
double
[][]
delay2
=
new
double
[
max_count
][
1
];
private
double
[][]
freq
=
new
double
[
max_count
][
1
];
private
final
double
[][]
freq
=
new
double
[
max_count
][
1
];
private
int
[]
delay_counter
=
new
int
[
max_count
];
private
final
int
[]
delay_counter
=
new
int
[
max_count
];
private
double
[]
sin_phase
=
new
double
[
max_count
];
private
final
double
[]
sin_phase
=
new
double
[
max_count
];
private
double
[]
sin_stepfreq
=
new
double
[
max_count
];
private
final
double
[]
sin_stepfreq
=
new
double
[
max_count
];
private
double
[]
sin_step
=
new
double
[
max_count
];
private
final
double
[]
sin_step
=
new
double
[
max_count
];
private
double
control_time
=
0
;
private
double
control_time
=
0
;
private
double
sin_factor
=
0
;
private
double
sin_factor
=
0
;
private
static
double
PI2
=
2.0
*
Math
.
PI
;
private
static
final
double
PI2
=
2.0
*
Math
.
PI
;
public
SoftLowFrequencyOscillator
()
{
public
SoftLowFrequencyOscillator
()
{
// If sin_step is 0 then sin_stepfreq must be -INF
// If sin_step is 0 then sin_stepfreq must be -INF
...
...
src/share/classes/com/sun/media/sound/SoftMainMixer.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -43,7 +43,7 @@ import javax.sound.sampled.AudioSystem;
...
@@ -43,7 +43,7 @@ import javax.sound.sampled.AudioSystem;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
SoftMainMixer
{
public
final
class
SoftMainMixer
{
// A private class thats contains a ModelChannelMixer and it's private buffers.
// A private class thats contains a ModelChannelMixer and it's private buffers.
// This becomes necessary when we want to have separate delay buffers for each channel mixer.
// This becomes necessary when we want to have separate delay buffers for each channel mixer.
...
@@ -67,13 +67,13 @@ public class SoftMainMixer {
...
@@ -67,13 +67,13 @@ public class SoftMainMixer {
public
final
static
int
CHANNEL_RIGHT_DRY
=
11
;
public
final
static
int
CHANNEL_RIGHT_DRY
=
11
;
public
final
static
int
CHANNEL_SCRATCH1
=
12
;
public
final
static
int
CHANNEL_SCRATCH1
=
12
;
public
final
static
int
CHANNEL_SCRATCH2
=
13
;
public
final
static
int
CHANNEL_SCRATCH2
=
13
;
protected
boolean
active_sensing_on
=
false
;
boolean
active_sensing_on
=
false
;
private
long
msec_last_activity
=
-
1
;
private
long
msec_last_activity
=
-
1
;
private
boolean
pusher_silent
=
false
;
private
boolean
pusher_silent
=
false
;
private
int
pusher_silent_count
=
0
;
private
int
pusher_silent_count
=
0
;
private
long
sample_pos
=
0
;
private
long
sample_pos
=
0
;
protected
boolean
readfully
=
true
;
boolean
readfully
=
true
;
private
Object
control_mutex
;
private
final
Object
control_mutex
;
private
SoftSynthesizer
synth
;
private
SoftSynthesizer
synth
;
private
float
samplerate
=
44100
;
private
float
samplerate
=
44100
;
private
int
nrofchannels
=
2
;
private
int
nrofchannels
=
2
;
...
@@ -84,7 +84,7 @@ public class SoftMainMixer {
...
@@ -84,7 +84,7 @@ public class SoftMainMixer {
private
SoftAudioProcessor
agc
;
private
SoftAudioProcessor
agc
;
private
long
msec_buffer_len
=
0
;
private
long
msec_buffer_len
=
0
;
private
int
buffer_len
=
0
;
private
int
buffer_len
=
0
;
protected
TreeMap
<
Long
,
Object
>
midimessages
=
new
TreeMap
<
Long
,
Object
>();
TreeMap
<
Long
,
Object
>
midimessages
=
new
TreeMap
<
Long
,
Object
>();
private
int
delay_midievent
=
0
;
private
int
delay_midievent
=
0
;
private
int
max_delay_midievent
=
0
;
private
int
max_delay_midievent
=
0
;
double
last_volume_left
=
1.0
;
double
last_volume_left
=
1.0
;
...
@@ -97,7 +97,7 @@ public class SoftMainMixer {
...
@@ -97,7 +97,7 @@ public class SoftMainMixer {
private
Set
<
SoftChannelMixerContainer
>
registeredMixers
=
null
;
private
Set
<
SoftChannelMixerContainer
>
registeredMixers
=
null
;
private
Set
<
ModelChannelMixer
>
stoppedMixers
=
null
;
private
Set
<
ModelChannelMixer
>
stoppedMixers
=
null
;
private
SoftChannelMixerContainer
[]
cur_registeredMixers
=
null
;
private
SoftChannelMixerContainer
[]
cur_registeredMixers
=
null
;
protected
SoftControl
co_master
=
new
SoftControl
()
{
SoftControl
co_master
=
new
SoftControl
()
{
double
[]
balance
=
co_master_balance
;
double
[]
balance
=
co_master_balance
;
double
[]
volume
=
co_master_volume
;
double
[]
volume
=
co_master_volume
;
...
@@ -438,7 +438,7 @@ public class SoftMainMixer {
...
@@ -438,7 +438,7 @@ public class SoftMainMixer {
delay_midievent
=
0
;
delay_midievent
=
0
;
}
}
protected
void
processAudioBuffers
()
{
void
processAudioBuffers
()
{
if
(
synth
.
weakstream
!=
null
&&
synth
.
weakstream
.
silent_samples
!=
0
)
if
(
synth
.
weakstream
!=
null
&&
synth
.
weakstream
.
silent_samples
!=
0
)
{
{
...
@@ -859,16 +859,16 @@ public class SoftMainMixer {
...
@@ -859,16 +859,16 @@ public class SoftMainMixer {
InputStream
in
=
new
InputStream
()
{
InputStream
in
=
new
InputStream
()
{
private
SoftAudioBuffer
[]
buffers
=
SoftMainMixer
.
this
.
buffers
;
private
final
SoftAudioBuffer
[]
buffers
=
SoftMainMixer
.
this
.
buffers
;
private
int
nrofchannels
private
final
int
nrofchannels
=
SoftMainMixer
.
this
.
synth
.
getFormat
().
getChannels
();
=
SoftMainMixer
.
this
.
synth
.
getFormat
().
getChannels
();
private
int
buffersize
=
buffers
[
0
].
getSize
();
private
final
int
buffersize
=
buffers
[
0
].
getSize
();
private
byte
[]
bbuffer
=
new
byte
[
buffersize
private
final
byte
[]
bbuffer
=
new
byte
[
buffersize
*
(
SoftMainMixer
.
this
.
synth
.
getFormat
()
*
(
SoftMainMixer
.
this
.
synth
.
getFormat
()
.
getSampleSizeInBits
()
/
8
)
.
getSampleSizeInBits
()
/
8
)
*
nrofchannels
];
*
nrofchannels
];
private
int
bbuffer_pos
=
0
;
private
int
bbuffer_pos
=
0
;
private
byte
[]
single
=
new
byte
[
1
];
private
final
byte
[]
single
=
new
byte
[
1
];
public
void
fillBuffer
()
{
public
void
fillBuffer
()
{
/*
/*
...
...
src/share/classes/com/sun/media/sound/SoftMidiAudioFileReader.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -50,7 +50,7 @@ import javax.sound.sampled.spi.AudioFileReader;
...
@@ -50,7 +50,7 @@ import javax.sound.sampled.spi.AudioFileReader;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
SoftMidiAudioFileReader
extends
AudioFileReader
{
public
final
class
SoftMidiAudioFileReader
extends
AudioFileReader
{
public
static
final
Type
MIDI
=
new
Type
(
"MIDI"
,
"mid"
);
public
static
final
Type
MIDI
=
new
Type
(
"MIDI"
,
"mid"
);
private
static
AudioFormat
format
=
new
AudioFormat
(
44100
,
16
,
2
,
true
,
false
);
private
static
AudioFormat
format
=
new
AudioFormat
(
44100
,
16
,
2
,
true
,
false
);
...
...
src/share/classes/com/sun/media/sound/SoftMixingClip.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -42,7 +42,7 @@ import javax.sound.sampled.LineUnavailableException;
...
@@ -42,7 +42,7 @@ import javax.sound.sampled.LineUnavailableException;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
SoftMixingClip
extends
SoftMixingDataLine
implements
Clip
{
public
final
class
SoftMixingClip
extends
SoftMixingDataLine
implements
Clip
{
private
AudioFormat
format
;
private
AudioFormat
format
;
...
@@ -50,7 +50,7 @@ public class SoftMixingClip extends SoftMixingDataLine implements Clip {
...
@@ -50,7 +50,7 @@ public class SoftMixingClip extends SoftMixingDataLine implements Clip {
private
byte
[]
data
;
private
byte
[]
data
;
private
InputStream
datastream
=
new
InputStream
()
{
private
final
InputStream
datastream
=
new
InputStream
()
{
public
int
read
()
throws
IOException
{
public
int
read
()
throws
IOException
{
byte
[]
b
=
new
byte
[
1
];
byte
[]
b
=
new
byte
[
1
];
...
@@ -162,7 +162,7 @@ public class SoftMixingClip extends SoftMixingDataLine implements Clip {
...
@@ -162,7 +162,7 @@ public class SoftMixingClip extends SoftMixingDataLine implements Clip {
private
AudioFloatInputStream
afis
;
private
AudioFloatInputStream
afis
;
protected
SoftMixingClip
(
SoftMixingMixer
mixer
,
DataLine
.
Info
info
)
{
SoftMixingClip
(
SoftMixingMixer
mixer
,
DataLine
.
Info
info
)
{
super
(
mixer
,
info
);
super
(
mixer
,
info
);
}
}
...
...
src/share/classes/com/sun/media/sound/SoftMixingDataLine.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -50,22 +50,22 @@ public abstract class SoftMixingDataLine implements DataLine {
...
@@ -50,22 +50,22 @@ public abstract class SoftMixingDataLine implements DataLine {
"Chorus Send"
)
{
"Chorus Send"
)
{
};
};
protected
static
class
AudioFloatInputStreamResampler
extends
protected
static
final
class
AudioFloatInputStreamResampler
extends
AudioFloatInputStream
{
AudioFloatInputStream
{
private
AudioFloatInputStream
ais
;
private
final
AudioFloatInputStream
ais
;
private
AudioFormat
targetFormat
;
private
final
AudioFormat
targetFormat
;
private
float
[]
skipbuffer
;
private
float
[]
skipbuffer
;
private
SoftAbstractResampler
resampler
;
private
SoftAbstractResampler
resampler
;
private
float
[]
pitch
=
new
float
[
1
];
private
f
inal
f
loat
[]
pitch
=
new
float
[
1
];
private
float
[]
ibuffer2
;
private
f
inal
f
loat
[]
ibuffer2
;
private
float
[][]
ibuffer
;
private
f
inal
f
loat
[][]
ibuffer
;
private
float
ibuffer_index
=
0
;
private
float
ibuffer_index
=
0
;
...
@@ -75,15 +75,15 @@ public abstract class SoftMixingDataLine implements DataLine {
...
@@ -75,15 +75,15 @@ public abstract class SoftMixingDataLine implements DataLine {
private
float
[][]
cbuffer
;
private
float
[][]
cbuffer
;
private
int
buffer_len
=
512
;
private
final
int
buffer_len
=
512
;
private
int
pad
;
private
final
int
pad
;
private
int
pad2
;
private
final
int
pad2
;
private
float
[]
ix
=
new
float
[
1
];
private
f
inal
f
loat
[]
ix
=
new
float
[
1
];
private
int
[]
ox
=
new
int
[
1
];
private
final
int
[]
ox
=
new
int
[
1
];
private
float
[][]
mark_ibuffer
=
null
;
private
float
[][]
mark_ibuffer
=
null
;
...
@@ -294,7 +294,7 @@ public abstract class SoftMixingDataLine implements DataLine {
...
@@ -294,7 +294,7 @@ public abstract class SoftMixingDataLine implements DataLine {
}
}
private
class
Gain
extends
FloatControl
{
private
final
class
Gain
extends
FloatControl
{
private
Gain
()
{
private
Gain
()
{
...
@@ -308,7 +308,7 @@ public abstract class SoftMixingDataLine implements DataLine {
...
@@ -308,7 +308,7 @@ public abstract class SoftMixingDataLine implements DataLine {
}
}
}
}
private
class
Mute
extends
BooleanControl
{
private
final
class
Mute
extends
BooleanControl
{
private
Mute
()
{
private
Mute
()
{
super
(
BooleanControl
.
Type
.
MUTE
,
false
,
"True"
,
"False"
);
super
(
BooleanControl
.
Type
.
MUTE
,
false
,
"True"
,
"False"
);
...
@@ -320,7 +320,7 @@ public abstract class SoftMixingDataLine implements DataLine {
...
@@ -320,7 +320,7 @@ public abstract class SoftMixingDataLine implements DataLine {
}
}
}
}
private
class
ApplyReverb
extends
BooleanControl
{
private
final
class
ApplyReverb
extends
BooleanControl
{
private
ApplyReverb
()
{
private
ApplyReverb
()
{
super
(
BooleanControl
.
Type
.
APPLY_REVERB
,
false
,
"True"
,
"False"
);
super
(
BooleanControl
.
Type
.
APPLY_REVERB
,
false
,
"True"
,
"False"
);
...
@@ -333,7 +333,7 @@ public abstract class SoftMixingDataLine implements DataLine {
...
@@ -333,7 +333,7 @@ public abstract class SoftMixingDataLine implements DataLine {
}
}
private
class
Balance
extends
FloatControl
{
private
final
class
Balance
extends
FloatControl
{
private
Balance
()
{
private
Balance
()
{
super
(
FloatControl
.
Type
.
BALANCE
,
-
1.0f
,
1.0f
,
(
1.0f
/
128.0f
),
-
1
,
super
(
FloatControl
.
Type
.
BALANCE
,
-
1.0f
,
1.0f
,
(
1.0f
/
128.0f
),
-
1
,
...
@@ -347,7 +347,7 @@ public abstract class SoftMixingDataLine implements DataLine {
...
@@ -347,7 +347,7 @@ public abstract class SoftMixingDataLine implements DataLine {
}
}
private
class
Pan
extends
FloatControl
{
private
final
class
Pan
extends
FloatControl
{
private
Pan
()
{
private
Pan
()
{
super
(
FloatControl
.
Type
.
PAN
,
-
1.0f
,
1.0f
,
(
1.0f
/
128.0f
),
-
1
,
super
(
FloatControl
.
Type
.
PAN
,
-
1.0f
,
1.0f
,
(
1.0f
/
128.0f
),
-
1
,
...
@@ -365,7 +365,7 @@ public abstract class SoftMixingDataLine implements DataLine {
...
@@ -365,7 +365,7 @@ public abstract class SoftMixingDataLine implements DataLine {
}
}
private
class
ReverbSend
extends
FloatControl
{
private
final
class
ReverbSend
extends
FloatControl
{
private
ReverbSend
()
{
private
ReverbSend
()
{
super
(
FloatControl
.
Type
.
REVERB_SEND
,
-
80
f
,
6.0206f
,
80
f
/
128.0f
,
super
(
FloatControl
.
Type
.
REVERB_SEND
,
-
80
f
,
6.0206f
,
80
f
/
128.0f
,
...
@@ -379,7 +379,7 @@ public abstract class SoftMixingDataLine implements DataLine {
...
@@ -379,7 +379,7 @@ public abstract class SoftMixingDataLine implements DataLine {
}
}
private
class
ChorusSend
extends
FloatControl
{
private
final
class
ChorusSend
extends
FloatControl
{
private
ChorusSend
()
{
private
ChorusSend
()
{
super
(
CHORUS_SEND
,
-
80
f
,
6.0206f
,
80
f
/
128.0f
,
-
1
,
-
80
f
,
"dB"
,
super
(
CHORUS_SEND
,
-
80
f
,
6.0206f
,
80
f
/
128.0f
,
-
1
,
-
80
f
,
"dB"
,
...
@@ -393,43 +393,43 @@ public abstract class SoftMixingDataLine implements DataLine {
...
@@ -393,43 +393,43 @@ public abstract class SoftMixingDataLine implements DataLine {
}
}
private
Gain
gain_control
=
new
Gain
();
private
final
Gain
gain_control
=
new
Gain
();
private
Mute
mute_control
=
new
Mute
();
private
final
Mute
mute_control
=
new
Mute
();
private
Balance
balance_control
=
new
Balance
();
private
final
Balance
balance_control
=
new
Balance
();
private
Pan
pan_control
=
new
Pan
();
private
final
Pan
pan_control
=
new
Pan
();
private
ReverbSend
reverbsend_control
=
new
ReverbSend
();
private
final
ReverbSend
reverbsend_control
=
new
ReverbSend
();
private
ChorusSend
chorussend_control
=
new
ChorusSend
();
private
final
ChorusSend
chorussend_control
=
new
ChorusSend
();
private
ApplyReverb
apply_reverb
=
new
ApplyReverb
();
private
final
ApplyReverb
apply_reverb
=
new
ApplyReverb
();
private
Control
[]
controls
;
private
final
Control
[]
controls
;
protected
float
leftgain
=
1
;
float
leftgain
=
1
;
protected
float
rightgain
=
1
;
float
rightgain
=
1
;
protected
float
eff1gain
=
0
;
float
eff1gain
=
0
;
protected
float
eff2gain
=
0
;
float
eff2gain
=
0
;
protected
List
<
LineListener
>
listeners
=
new
ArrayList
<
LineListener
>();
List
<
LineListener
>
listeners
=
new
ArrayList
<
LineListener
>();
protected
Object
control_mutex
;
final
Object
control_mutex
;
protected
SoftMixingMixer
mixer
;
SoftMixingMixer
mixer
;
protected
DataLine
.
Info
info
;
DataLine
.
Info
info
;
protected
abstract
void
processControlLogic
();
protected
abstract
void
processControlLogic
();
protected
abstract
void
processAudioLogic
(
SoftAudioBuffer
[]
buffers
);
protected
abstract
void
processAudioLogic
(
SoftAudioBuffer
[]
buffers
);
protected
SoftMixingDataLine
(
SoftMixingMixer
mixer
,
DataLine
.
Info
info
)
{
SoftMixingDataLine
(
SoftMixingMixer
mixer
,
DataLine
.
Info
info
)
{
this
.
mixer
=
mixer
;
this
.
mixer
=
mixer
;
this
.
info
=
info
;
this
.
info
=
info
;
this
.
control_mutex
=
mixer
.
control_mutex
;
this
.
control_mutex
=
mixer
.
control_mutex
;
...
@@ -440,7 +440,7 @@ public abstract class SoftMixingDataLine implements DataLine {
...
@@ -440,7 +440,7 @@ public abstract class SoftMixingDataLine implements DataLine {
calcVolume
();
calcVolume
();
}
}
protected
void
calcVolume
()
{
final
void
calcVolume
()
{
synchronized
(
control_mutex
)
{
synchronized
(
control_mutex
)
{
double
gain
=
Math
.
pow
(
10.0
,
gain_control
.
getValue
()
/
20.0
);
double
gain
=
Math
.
pow
(
10.0
,
gain_control
.
getValue
()
/
20.0
);
if
(
mute_control
.
getValue
())
if
(
mute_control
.
getValue
())
...
@@ -466,7 +466,7 @@ public abstract class SoftMixingDataLine implements DataLine {
...
@@ -466,7 +466,7 @@ public abstract class SoftMixingDataLine implements DataLine {
}
}
}
}
protected
void
sendEvent
(
LineEvent
event
)
{
final
void
sendEvent
(
LineEvent
event
)
{
if
(
listeners
.
size
()
==
0
)
if
(
listeners
.
size
()
==
0
)
return
;
return
;
LineListener
[]
listener_array
=
listeners
LineListener
[]
listener_array
=
listeners
...
@@ -476,23 +476,23 @@ public abstract class SoftMixingDataLine implements DataLine {
...
@@ -476,23 +476,23 @@ public abstract class SoftMixingDataLine implements DataLine {
}
}
}
}
public
void
addLineListener
(
LineListener
listener
)
{
public
final
void
addLineListener
(
LineListener
listener
)
{
synchronized
(
control_mutex
)
{
synchronized
(
control_mutex
)
{
listeners
.
add
(
listener
);
listeners
.
add
(
listener
);
}
}
}
}
public
void
removeLineListener
(
LineListener
listener
)
{
public
final
void
removeLineListener
(
LineListener
listener
)
{
synchronized
(
control_mutex
)
{
synchronized
(
control_mutex
)
{
listeners
.
add
(
listener
);
listeners
.
add
(
listener
);
}
}
}
}
public
javax
.
sound
.
sampled
.
Line
.
Info
getLineInfo
()
{
public
final
javax
.
sound
.
sampled
.
Line
.
Info
getLineInfo
()
{
return
info
;
return
info
;
}
}
public
Control
getControl
(
Type
control
)
{
public
final
Control
getControl
(
Type
control
)
{
if
(
control
!=
null
)
{
if
(
control
!=
null
)
{
for
(
int
i
=
0
;
i
<
controls
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
controls
.
length
;
i
++)
{
if
(
controls
[
i
].
getType
()
==
control
)
{
if
(
controls
[
i
].
getType
()
==
control
)
{
...
@@ -504,11 +504,11 @@ public abstract class SoftMixingDataLine implements DataLine {
...
@@ -504,11 +504,11 @@ public abstract class SoftMixingDataLine implements DataLine {
+
control
);
+
control
);
}
}
public
Control
[]
getControls
()
{
public
final
Control
[]
getControls
()
{
return
Arrays
.
copyOf
(
controls
,
controls
.
length
);
return
Arrays
.
copyOf
(
controls
,
controls
.
length
);
}
}
public
boolean
isControlSupported
(
Type
control
)
{
public
final
boolean
isControlSupported
(
Type
control
)
{
if
(
control
!=
null
)
{
if
(
control
!=
null
)
{
for
(
int
i
=
0
;
i
<
controls
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
controls
.
length
;
i
++)
{
if
(
controls
[
i
].
getType
()
==
control
)
{
if
(
controls
[
i
].
getType
()
==
control
)
{
...
...
src/share/classes/com/sun/media/sound/SoftMixingMainMixer.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -37,7 +37,7 @@ import javax.sound.sampled.AudioSystem;
...
@@ -37,7 +37,7 @@ import javax.sound.sampled.AudioSystem;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
SoftMixingMainMixer
{
public
final
class
SoftMixingMainMixer
{
public
final
static
int
CHANNEL_LEFT
=
0
;
public
final
static
int
CHANNEL_LEFT
=
0
;
...
@@ -63,23 +63,23 @@ public class SoftMixingMainMixer {
...
@@ -63,23 +63,23 @@ public class SoftMixingMainMixer {
public
final
static
int
CHANNEL_CHANNELMIXER_RIGHT
=
15
;
public
final
static
int
CHANNEL_CHANNELMIXER_RIGHT
=
15
;
private
SoftMixingMixer
mixer
;
private
final
SoftMixingMixer
mixer
;
private
AudioInputStream
ais
;
private
final
AudioInputStream
ais
;
private
SoftAudioBuffer
[]
buffers
;
private
final
SoftAudioBuffer
[]
buffers
;
private
SoftAudioProcessor
reverb
;
private
final
SoftAudioProcessor
reverb
;
private
SoftAudioProcessor
chorus
;
private
final
SoftAudioProcessor
chorus
;
private
SoftAudioProcessor
agc
;
private
final
SoftAudioProcessor
agc
;
private
int
nrofchannels
;
private
final
int
nrofchannels
;
private
Object
control_mutex
;
private
final
Object
control_mutex
;
private
List
<
SoftMixingDataLine
>
openLinesList
=
new
ArrayList
<
SoftMixingDataLine
>();
private
final
List
<
SoftMixingDataLine
>
openLinesList
=
new
ArrayList
<
SoftMixingDataLine
>();
private
SoftMixingDataLine
[]
openLines
=
new
SoftMixingDataLine
[
0
];
private
SoftMixingDataLine
[]
openLines
=
new
SoftMixingDataLine
[
0
];
...
@@ -87,7 +87,7 @@ public class SoftMixingMainMixer {
...
@@ -87,7 +87,7 @@ public class SoftMixingMainMixer {
return
ais
;
return
ais
;
}
}
protected
void
processAudioBuffers
()
{
void
processAudioBuffers
()
{
for
(
int
i
=
0
;
i
<
buffers
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
buffers
.
length
;
i
++)
{
buffers
[
i
].
clear
();
buffers
[
i
].
clear
();
}
}
...
@@ -162,20 +162,20 @@ public class SoftMixingMainMixer {
...
@@ -162,20 +162,20 @@ public class SoftMixingMainMixer {
InputStream
in
=
new
InputStream
()
{
InputStream
in
=
new
InputStream
()
{
private
SoftAudioBuffer
[]
buffers
=
SoftMixingMainMixer
.
this
.
buffers
;
private
final
SoftAudioBuffer
[]
buffers
=
SoftMixingMainMixer
.
this
.
buffers
;
private
int
nrofchannels
=
SoftMixingMainMixer
.
this
.
mixer
private
final
int
nrofchannels
=
SoftMixingMainMixer
.
this
.
mixer
.
getFormat
().
getChannels
();
.
getFormat
().
getChannels
();
private
int
buffersize
=
buffers
[
0
].
getSize
();
private
final
int
buffersize
=
buffers
[
0
].
getSize
();
private
byte
[]
bbuffer
=
new
byte
[
buffersize
private
final
byte
[]
bbuffer
=
new
byte
[
buffersize
*
(
SoftMixingMainMixer
.
this
.
mixer
.
getFormat
()
*
(
SoftMixingMainMixer
.
this
.
mixer
.
getFormat
()
.
getSampleSizeInBits
()
/
8
)
*
nrofchannels
];
.
getSampleSizeInBits
()
/
8
)
*
nrofchannels
];
private
int
bbuffer_pos
=
0
;
private
int
bbuffer_pos
=
0
;
private
byte
[]
single
=
new
byte
[
1
];
private
final
byte
[]
single
=
new
byte
[
1
];
public
void
fillBuffer
()
{
public
void
fillBuffer
()
{
processAudioBuffers
();
processAudioBuffers
();
...
...
src/share/classes/com/sun/media/sound/SoftMixingMixer.java
浏览文件 @
a6441dc7
/*
/*
* Copyright (c) 2008, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -48,27 +48,27 @@ import javax.sound.sampled.Control.Type;
...
@@ -48,27 +48,27 @@ import javax.sound.sampled.Control.Type;
*
*
* @author Karl Helgason
* @author Karl Helgason
*/
*/
public
class
SoftMixingMixer
implements
Mixer
{
public
final
class
SoftMixingMixer
implements
Mixer
{
private
static
class
Info
extends
Mixer
.
Info
{
private
static
class
Info
extends
Mixer
.
Info
{
public
Info
()
{
Info
()
{
super
(
INFO_NAME
,
INFO_VENDOR
,
INFO_DESCRIPTION
,
INFO_VERSION
);
super
(
INFO_NAME
,
INFO_VENDOR
,
INFO_DESCRIPTION
,
INFO_VERSION
);
}
}
}
}
protected
static
final
String
INFO_NAME
=
"Gervill Sound Mixer"
;
static
final
String
INFO_NAME
=
"Gervill Sound Mixer"
;
protected
static
final
String
INFO_VENDOR
=
"OpenJDK Proposal"
;
static
final
String
INFO_VENDOR
=
"OpenJDK Proposal"
;
protected
static
final
String
INFO_DESCRIPTION
=
"Software Sound Mixer"
;
static
final
String
INFO_DESCRIPTION
=
"Software Sound Mixer"
;
protected
static
final
String
INFO_VERSION
=
"1.0"
;
static
final
String
INFO_VERSION
=
"1.0"
;
protected
final
static
Mixer
.
Info
info
=
new
Info
();
static
final
Mixer
.
Info
info
=
new
Info
();
protected
Object
control_mutex
=
this
;
final
Object
control_mutex
=
this
;
protected
boolean
implicitOpen
=
false
;
boolean
implicitOpen
=
false
;
private
boolean
open
=
false
;
private
boolean
open
=
false
;
...
@@ -82,15 +82,15 @@ public class SoftMixingMixer implements Mixer {
...
@@ -82,15 +82,15 @@ public class SoftMixingMixer implements Mixer {
private
AudioInputStream
pusher_stream
=
null
;
private
AudioInputStream
pusher_stream
=
null
;
private
float
controlrate
=
147
f
;
private
f
inal
f
loat
controlrate
=
147
f
;
private
long
latency
=
100000
;
// 100 msec
private
final
long
latency
=
100000
;
// 100 msec
private
boolean
jitter_correction
=
false
;
private
final
boolean
jitter_correction
=
false
;
private
List
<
LineListener
>
listeners
=
new
ArrayList
<
LineListener
>();
private
final
List
<
LineListener
>
listeners
=
new
ArrayList
<
LineListener
>();
private
javax
.
sound
.
sampled
.
Line
.
Info
[]
sourceLineInfo
;
private
final
javax
.
sound
.
sampled
.
Line
.
Info
[]
sourceLineInfo
;
public
SoftMixingMixer
()
{
public
SoftMixingMixer
()
{
...
@@ -516,11 +516,11 @@ public class SoftMixingMixer implements Mixer {
...
@@ -516,11 +516,11 @@ public class SoftMixingMixer implements Mixer {
}
}
}
}
protected
float
getControlRate
()
{
float
getControlRate
()
{
return
controlrate
;
return
controlrate
;
}
}
protected
SoftMixingMainMixer
getMainMixer
()
{
SoftMixingMainMixer
getMainMixer
()
{
if
(!
isOpen
())
if
(!
isOpen
())
return
null
;
return
null
;
return
mainmixer
;
return
mainmixer
;
...
...
src/share/classes/com/sun/media/sound/SoftMixingMixerProvider.java
浏览文件 @
a6441dc7
此差异已折叠。
点击以展开。
src/share/classes/com/sun/media/sound/SoftMixingSourceDataLine.java
浏览文件 @
a6441dc7
此差异已折叠。
点击以展开。
src/share/classes/com/sun/media/sound/SoftPerformer.java
浏览文件 @
a6441dc7
此差异已折叠。
点击以展开。
src/share/classes/com/sun/media/sound/SoftPointResampler.java
浏览文件 @
a6441dc7
此差异已折叠。
点击以展开。
src/share/classes/com/sun/media/sound/SoftProvider.java
浏览文件 @
a6441dc7
此差异已折叠。
点击以展开。
src/share/classes/com/sun/media/sound/SoftReceiver.java
浏览文件 @
a6441dc7
此差异已折叠。
点击以展开。
src/share/classes/com/sun/media/sound/SoftReverb.java
浏览文件 @
a6441dc7
此差异已折叠。
点击以展开。
src/share/classes/com/sun/media/sound/SoftShortMessage.java
浏览文件 @
a6441dc7
此差异已折叠。
点击以展开。
src/share/classes/com/sun/media/sound/SoftSincResampler.java
浏览文件 @
a6441dc7
此差异已折叠。
点击以展开。
src/share/classes/com/sun/media/sound/SoftSynthesizer.java
浏览文件 @
a6441dc7
此差异已折叠。
点击以展开。
src/share/classes/com/sun/media/sound/SoftTuning.java
浏览文件 @
a6441dc7
此差异已折叠。
点击以展开。
src/share/classes/com/sun/media/sound/SoftVoice.java
浏览文件 @
a6441dc7
此差异已折叠。
点击以展开。
src/share/classes/com/sun/media/sound/StandardMidiFileReader.java
浏览文件 @
a6441dc7
此差异已折叠。
点击以展开。
src/share/classes/com/sun/media/sound/StandardMidiFileWriter.java
浏览文件 @
a6441dc7
此差异已折叠。
点击以展开。
src/share/classes/com/sun/media/sound/SunCodec.java
浏览文件 @
a6441dc7
此差异已折叠。
点击以展开。
src/share/classes/com/sun/media/sound/SunFileReader.java
浏览文件 @
a6441dc7
此差异已折叠。
点击以展开。
src/share/classes/com/sun/media/sound/SunFileWriter.java
浏览文件 @
a6441dc7
此差异已折叠。
点击以展开。
src/share/classes/com/sun/media/sound/Toolkit.java
浏览文件 @
a6441dc7
此差异已折叠。
点击以展开。
src/share/classes/com/sun/media/sound/UlawCodec.java
浏览文件 @
a6441dc7
此差异已折叠。
点击以展开。
src/share/classes/com/sun/media/sound/WaveExtensibleFileReader.java
浏览文件 @
a6441dc7
此差异已折叠。
点击以展开。
src/share/classes/com/sun/media/sound/WaveFileFormat.java
浏览文件 @
a6441dc7
此差异已折叠。
点击以展开。
src/share/classes/com/sun/media/sound/WaveFileReader.java
浏览文件 @
a6441dc7
此差异已折叠。
点击以展开。
src/share/classes/com/sun/media/sound/WaveFileWriter.java
浏览文件 @
a6441dc7
此差异已折叠。
点击以展开。
src/share/classes/com/sun/media/sound/WaveFloatFileReader.java
浏览文件 @
a6441dc7
此差异已折叠。
点击以展开。
src/share/classes/com/sun/media/sound/WaveFloatFileWriter.java
浏览文件 @
a6441dc7
此差异已折叠。
点击以展开。
src/share/classes/javax/sound/midi/MetaMessage.java
浏览文件 @
a6441dc7
此差异已折叠。
点击以展开。
src/share/classes/javax/sound/sampled/Mixer.java
浏览文件 @
a6441dc7
此差异已折叠。
点击以展开。
src/share/classes/sun/audio/AudioData.java
浏览文件 @
a6441dc7
此差异已折叠。
点击以展开。
src/share/classes/sun/audio/AudioDataStream.java
浏览文件 @
a6441dc7
此差异已折叠。
点击以展开。
src/share/classes/sun/audio/AudioDevice.java
浏览文件 @
a6441dc7
此差异已折叠。
点击以展开。
src/share/classes/sun/audio/AudioPlayer.java
浏览文件 @
a6441dc7
此差异已折叠。
点击以展开。
src/share/classes/sun/audio/AudioStream.java
浏览文件 @
a6441dc7
此差异已折叠。
点击以展开。
src/share/classes/sun/audio/AudioStreamSequence.java
浏览文件 @
a6441dc7
此差异已折叠。
点击以展开。
src/share/classes/sun/audio/AudioTranslatorStream.java
浏览文件 @
a6441dc7
此差异已折叠。
点击以展开。
src/share/classes/sun/audio/ContinuousAudioDataStream.java
浏览文件 @
a6441dc7
此差异已折叠。
点击以展开。
src/share/classes/sun/audio/InvalidAudioFormatException.java
浏览文件 @
a6441dc7
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录