Mercurial > hg > release > icedtea6-1.9
changeset 2073:f882c327935a
overlays/openjdk/jdk/test/com: Removed because correct
version of these tests are now available in OpenJDK itself.
author | ptisnovs |
---|---|
date | Thu, 29 Apr 2010 08:59:57 +0200 |
parents | b86fa01ca5ca |
children | d1be9b22e65a |
files | AUTHORS ChangeLog overlays/openjdk/jdk/test/com/sun/media/sound/AudioFloatConverter/GetFormat.java overlays/openjdk/jdk/test/com/sun/media/sound/AudioFloatConverter/ToFloatArray.java overlays/openjdk/jdk/test/com/sun/media/sound/AudioFloatInputStream/Available.java overlays/openjdk/jdk/test/com/sun/media/sound/AudioFloatInputStream/Close.java overlays/openjdk/jdk/test/com/sun/media/sound/AudioFloatInputStream/GetFormat.java overlays/openjdk/jdk/test/com/sun/media/sound/AudioFloatInputStream/GetFrameLength.java overlays/openjdk/jdk/test/com/sun/media/sound/AudioFloatInputStream/MarkSupported.java overlays/openjdk/jdk/test/com/sun/media/sound/AudioFloatInputStream/Read.java overlays/openjdk/jdk/test/com/sun/media/sound/AudioFloatInputStream/ReadFloatArray.java overlays/openjdk/jdk/test/com/sun/media/sound/AudioFloatInputStream/ReadFloatArrayIntInt.java overlays/openjdk/jdk/test/com/sun/media/sound/AudioFloatInputStream/Reset.java overlays/openjdk/jdk/test/com/sun/media/sound/AudioFloatInputStream/Skip.java overlays/openjdk/jdk/test/com/sun/media/sound/DLSSoundbankReader/TestGetSoundbankFile.java overlays/openjdk/jdk/test/com/sun/media/sound/DLSSoundbankReader/TestGetSoundbankInputStream.java overlays/openjdk/jdk/test/com/sun/media/sound/DLSSoundbankReader/TestGetSoundbankInputStream2.java overlays/openjdk/jdk/test/com/sun/media/sound/DLSSoundbankReader/TestGetSoundbankUrl.java overlays/openjdk/jdk/test/com/sun/media/sound/DLSSoundbankReader/ding.dls overlays/openjdk/jdk/test/com/sun/media/sound/EmergencySoundbank/TestCreateSoundbank.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBuffer/GetInputStream.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBuffer/GetRoot.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBuffer/Load.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBuffer/LoadAll.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBuffer/NewModelByteBufferByteArray.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBuffer/NewModelByteBufferByteArrayIntInt.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBuffer/NewModelByteBufferFile.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBuffer/NewModelByteBufferFileLongLong.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBuffer/RandomFileInputStream/Available.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBuffer/RandomFileInputStream/Close.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBuffer/RandomFileInputStream/MarkReset.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBuffer/RandomFileInputStream/MarkSupported.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBuffer/RandomFileInputStream/Read.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBuffer/RandomFileInputStream/ReadByte.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBuffer/RandomFileInputStream/ReadByteIntInt.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBuffer/RandomFileInputStream/Skip.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBuffer/SubbufferLong.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBuffer/SubbufferLongLong.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBuffer/SubbufferLongLongBoolean.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBuffer/Unload.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBuffer/WriteTo.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBufferWavetable/GetAttenuation.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBufferWavetable/GetChannels.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBufferWavetable/GetLoopLength.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBufferWavetable/GetLoopStart.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBufferWavetable/GetPitchCorrection.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBufferWavetable/NewModelByteBufferWavetableModelByteBuffer.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBufferWavetable/NewModelByteBufferWavetableModelByteBufferAudioFormat.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBufferWavetable/NewModelByteBufferWavetableModelByteBufferAudioFormatFloat.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBufferWavetable/NewModelByteBufferWavetableModelByteBufferFloat.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBufferWavetable/Open.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBufferWavetable/Set8BitExtensionBuffer.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBufferWavetable/SetLoopType.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelDestination/NewModelDestination.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelDestination/NewModelDestinationModelIdentifier.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelDestination/SetIdentifier.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelDestination/SetTransform.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelIdentifier/EqualsObject.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelIdentifier/NewModelIdentifierString.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelIdentifier/NewModelIdentifierStringInt.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelIdentifier/NewModelIdentifierStringString.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelIdentifier/NewModelIdentifierStringStringInt.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelIdentifier/SetInstance.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelIdentifier/SetObject.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelIdentifier/SetVariable.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelPerformer/GetOscillators.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelPerformer/SetConnectionBlocks.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelPerformer/SetDefaultConnectionsEnabled.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelPerformer/SetExclusiveClass.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelPerformer/SetKeyFrom.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelPerformer/SetKeyTo.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelPerformer/SetName.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelPerformer/SetSelfNonExclusive.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelPerformer/SetVelFrom.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelPerformer/SetVelTo.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelSource/NewModelSource.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelSource/NewModelSourceModelIdentifier.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelSource/NewModelSourceModelIdentifierBoolean.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelSource/NewModelSourceModelIdentifierBooleanBoolean.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelSource/NewModelSourceModelIdentifierBooleanBooleanInt.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelSource/NewModelSourceModelIdentifierModelTransform.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelSource/SetIdentifier.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelSource/SetTransform.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelStandardTransform/NewModelStandardTransform.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelStandardTransform/NewModelStandardTransformBoolean.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelStandardTransform/NewModelStandardTransformBooleanBoolean.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelStandardTransform/NewModelStandardTransformBooleanBooleanInt.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelStandardTransform/SetDirection.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelStandardTransform/SetPolarity.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelStandardTransform/SetTransform.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelStandardTransform/TransformAbsolute.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelStandardTransform/TransformConcave.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelStandardTransform/TransformConvex.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelStandardTransform/TransformLinear.java overlays/openjdk/jdk/test/com/sun/media/sound/ModelStandardTransform/TransformSwitch.java overlays/openjdk/jdk/test/com/sun/media/sound/RiffReaderWriter/Available.java overlays/openjdk/jdk/test/com/sun/media/sound/RiffReaderWriter/Close.java overlays/openjdk/jdk/test/com/sun/media/sound/RiffReaderWriter/GetFilePointer.java overlays/openjdk/jdk/test/com/sun/media/sound/RiffReaderWriter/GetSize.java overlays/openjdk/jdk/test/com/sun/media/sound/RiffReaderWriter/HasNextChunk.java overlays/openjdk/jdk/test/com/sun/media/sound/RiffReaderWriter/Read.java overlays/openjdk/jdk/test/com/sun/media/sound/RiffReaderWriter/ReadByte.java overlays/openjdk/jdk/test/com/sun/media/sound/RiffReaderWriter/ReadByteArrayIntInt.java overlays/openjdk/jdk/test/com/sun/media/sound/RiffReaderWriter/ReadInt.java overlays/openjdk/jdk/test/com/sun/media/sound/RiffReaderWriter/ReadLong.java overlays/openjdk/jdk/test/com/sun/media/sound/RiffReaderWriter/ReadShort.java overlays/openjdk/jdk/test/com/sun/media/sound/RiffReaderWriter/ReadString.java overlays/openjdk/jdk/test/com/sun/media/sound/RiffReaderWriter/ReadUnsignedByte.java overlays/openjdk/jdk/test/com/sun/media/sound/RiffReaderWriter/ReadUnsignedInt.java overlays/openjdk/jdk/test/com/sun/media/sound/RiffReaderWriter/ReadUnsignedShort.java overlays/openjdk/jdk/test/com/sun/media/sound/RiffReaderWriter/Skip.java overlays/openjdk/jdk/test/com/sun/media/sound/RiffReaderWriter/WriteOutputStream.java overlays/openjdk/jdk/test/com/sun/media/sound/SF2SoundbankReader/TestGetSoundbankFile.java overlays/openjdk/jdk/test/com/sun/media/sound/SF2SoundbankReader/TestGetSoundbankInputStream.java overlays/openjdk/jdk/test/com/sun/media/sound/SF2SoundbankReader/TestGetSoundbankInputStream2.java overlays/openjdk/jdk/test/com/sun/media/sound/SF2SoundbankReader/TestGetSoundbankUrl.java overlays/openjdk/jdk/test/com/sun/media/sound/SF2SoundbankReader/ding.sf2 overlays/openjdk/jdk/test/com/sun/media/sound/SimpleInstrument/AddModelInstrument.java overlays/openjdk/jdk/test/com/sun/media/sound/SimpleInstrument/AddModelInstrumentIntInt.java overlays/openjdk/jdk/test/com/sun/media/sound/SimpleInstrument/AddModelInstrumentIntIntIntInt.java overlays/openjdk/jdk/test/com/sun/media/sound/SimpleInstrument/AddModelInstrumentIntIntIntIntInt.java overlays/openjdk/jdk/test/com/sun/media/sound/SimpleInstrument/AddModelPerformer.java overlays/openjdk/jdk/test/com/sun/media/sound/SimpleInstrument/AddModelPerformerArray.java overlays/openjdk/jdk/test/com/sun/media/sound/SimpleInstrument/AddModelPerformerArrayIntInt.java overlays/openjdk/jdk/test/com/sun/media/sound/SimpleInstrument/AddModelPerformerArrayIntIntIntInt.java overlays/openjdk/jdk/test/com/sun/media/sound/SimpleInstrument/AddModelPerformerArrayIntIntIntIntInt.java overlays/openjdk/jdk/test/com/sun/media/sound/SimpleInstrument/AddModelPerformerIntInt.java overlays/openjdk/jdk/test/com/sun/media/sound/SimpleInstrument/AddModelPerformerIntIntIntInt.java overlays/openjdk/jdk/test/com/sun/media/sound/SimpleInstrument/AddModelPerformerIntIntIntIntInt.java overlays/openjdk/jdk/test/com/sun/media/sound/SimpleInstrument/Clear.java overlays/openjdk/jdk/test/com/sun/media/sound/SimpleInstrument/SetName.java overlays/openjdk/jdk/test/com/sun/media/sound/SimpleInstrument/SetPatch.java overlays/openjdk/jdk/test/com/sun/media/sound/SimpleSoundbank/AddInstrument.java overlays/openjdk/jdk/test/com/sun/media/sound/SimpleSoundbank/AddResource.java overlays/openjdk/jdk/test/com/sun/media/sound/SimpleSoundbank/GetInstrument.java overlays/openjdk/jdk/test/com/sun/media/sound/SimpleSoundbank/RemoveInstrument.java overlays/openjdk/jdk/test/com/sun/media/sound/SimpleSoundbank/SetDescription.java overlays/openjdk/jdk/test/com/sun/media/sound/SimpleSoundbank/SetName.java overlays/openjdk/jdk/test/com/sun/media/sound/SimpleSoundbank/SetVendor.java overlays/openjdk/jdk/test/com/sun/media/sound/SimpleSoundbank/SetVersion.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftAudioBuffer/Array.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftAudioBuffer/Clear.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftAudioBuffer/Get.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftAudioBuffer/NewSoftAudioBuffer.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftAudioSynthesizer/DummySourceDataLine.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftAudioSynthesizer/GetFormat.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftAudioSynthesizer/GetPropertyInfo.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftAudioSynthesizer/Open.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftAudioSynthesizer/OpenStream.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftChannel/AllNotesOff.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftChannel/AllSoundOff.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftChannel/ChannelPressure.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftChannel/Controller.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftChannel/LocalControl.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftChannel/Mono.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftChannel/Mute.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftChannel/NoteOff.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftChannel/NoteOff2.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftChannel/NoteOn.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftChannel/Omni.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftChannel/PitchBend.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftChannel/PolyPressure.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftChannel/ProgramChange.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftChannel/ResetAllControllers.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftChannel/SoftTestUtils.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftChannel/Solo.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftCubicResampler/Interpolate.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftFilter/TestProcessAudio.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftLanczosResampler/Interpolate.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_mix.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_mix_mono.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_mix_mono_overdrive.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_mix_overdrive.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_normal.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_normal_mono.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_overdrive.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_overdrive_mono.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftLinearResampler/Interpolate.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftLinearResampler2/Interpolate.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftLowFrequencyOscillator/TestProcessControlLogic.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftPointResampler/Interpolate.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftProvider/GetDevice.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftReceiver/Close.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftReceiver/Send_ActiveSense.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftReceiver/Send_AllNotesOff.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftReceiver/Send_AllSoundOff.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftReceiver/Send_ChannelPressure.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftReceiver/Send_Controller.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftReceiver/Send_Mono.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftReceiver/Send_NoteOff.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftReceiver/Send_NoteOn.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftReceiver/Send_NoteOn_AllChannels.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftReceiver/Send_NoteOn_Delayed.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftReceiver/Send_NoteOn_Multiple.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftReceiver/Send_Omni.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftReceiver/Send_PitchBend.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftReceiver/Send_PolyPressure.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftReceiver/Send_ProgramChange.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftReceiver/Send_ResetAllControllers.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftReceiver/SoftTestUtils.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftSincResampler/Interpolate.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/Close.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/DummySourceDataLine.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/GetAvailableInstruments.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/GetChannels.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/GetDefaultSoundbank.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/GetDeviceInfo.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/GetLatency.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/GetLoadedInstruments.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/GetMaxPolyphony.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/GetMaxReceivers.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/GetMaxTransmitters.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/GetMicrosecondPosition.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/GetReceiver.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/GetReceiver2.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/GetReceivers.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/GetTransmitter.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/GetTransmitters.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/GetVoiceStatus.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/ImplicitOpenClose.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/IsOpen.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/IsSoundbankSupported.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/LoadAllInstruments.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/LoadInstrument.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/LoadInstruments.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/Open.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/OpenStream.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/RemapInstrument.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/TestRender1.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/UnloadAllInstruments.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/UnloadInstrument.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/UnloadInstruments.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/ding.sf2 overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/expresso.mid overlays/openjdk/jdk/test/com/sun/media/sound/SoftTuning/GetName.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftTuning/GetTuning.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftTuning/GetTuningInt.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftTuning/Load1.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftTuning/Load2.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftTuning/Load4.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftTuning/Load5.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftTuning/Load6.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftTuning/Load7.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftTuning/Load8.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftTuning/Load9.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftTuning/NewSoftTuning.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftTuning/NewSoftTuningByteArray.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftTuning/NewSoftTuningPatch.java overlays/openjdk/jdk/test/com/sun/media/sound/SoftTuning/NewSoftTuningPatchByteArray.java |
diffstat | 249 files changed, 7 insertions(+), 18407 deletions(-) [+] |
line wrap: on
line diff
--- a/AUTHORS Wed Apr 28 14:20:33 2010 +0100 +++ b/AUTHORS Thu Apr 29 08:59:57 2010 +0200 @@ -31,6 +31,7 @@ Marc Schoenefeld <mschoene@redhat.com> Keith Seitz <keiths@redhat.com> Joshua Sumali <jsumali@redhat.com> +Pavel Tisnovsky <ptisnovs@redhat.com> Christian Thalinger <twisti@complang.tuwien.ac.at> Dalibor Topic <robilad@kaffe.org> Arnaud Vandyck <avdyk@debian.org>
--- a/ChangeLog Wed Apr 28 14:20:33 2010 +0100 +++ b/ChangeLog Thu Apr 29 08:59:57 2010 +0200 @@ -1,3 +1,9 @@ +2010-04-29 Pavel Tisnovsky <ptisnovs@redhat.com> + + * overlays/openjdk/jdk/test/com: Removed, correct + version of these tests are now available in OpenJDK + itself. + 2010-04-28 Andrew John Hughes <ahughes@redhat.com> * Makefile.am:
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/AudioFloatConverter/GetFormat.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test AudioFloatConverter getFormat method */ - -import javax.sound.sampled.*; -import com.sun.media.sound.*; - -public class GetFormat { - - public static void main(String[] args) throws Exception { - AudioFormat frm = new AudioFormat(8000, 16, 1, true, false); - AudioFloatConverter conv = AudioFloatConverter.getConverter(frm); - if(!conv.getFormat().matches(frm)) - throw new RuntimeException("Incorrect audio format returned."); - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/AudioFloatConverter/ToFloatArray.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,162 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test AudioFloatConverter toFloatArray method */ - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class ToFloatArray { - - public static void main(String[] args) throws Exception { - - float[] testarray = new float[1024]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - testarray[i] = (float)Math.sin(10*ii*2*Math.PI); - testarray[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - testarray[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - testarray[i] *= 0.3; - } - - // Check conversion using PCM_FLOAT - for (int big = 0; big < 2; big+=1) - for (int bits = 32; bits <= 64; bits+=32) { - AudioFormat frm = new AudioFormat( - AudioFloatConverter.PCM_FLOAT, - 44100, bits, 1, bits/8, - 44100, big==1); - byte[] buff = new byte[testarray.length * frm.getFrameSize()]; - float[] testarray2 = new float[testarray.length]; - AudioFloatConverter conv = AudioFloatConverter.getConverter(frm); - conv.toByteArray(testarray, buff); - conv.toFloatArray(buff, testarray2); - for (int i = 0; i < testarray2.length; i++) { - if(Math.abs(testarray[i] - testarray2[i]) > 0.05) - throw new RuntimeException("Conversion failed for " + frm +" , arrays not equal enough!\n"); - } - - } - - // Check conversion from float2byte and byte2float. - for (int big = 0; big < 2; big+=1) - for (int signed = 0; signed < 2; signed+=1) - for (int bits = 6; bits <= 40; bits+=2) { - AudioFormat frm = new AudioFormat(44100, bits, 1, signed==1, big==1); - byte[] buff = new byte[testarray.length * frm.getFrameSize()]; - float[] testarray2 = new float[testarray.length]; - AudioFloatConverter conv = AudioFloatConverter.getConverter(frm); - conv.toByteArray(testarray, buff); - conv.toFloatArray(buff, testarray2); - for (int i = 0; i < testarray2.length; i++) { - if(Math.abs(testarray[i] - testarray2[i]) > 0.05) - throw new RuntimeException("Conversion failed for " + frm +" , arrays not equal enough!\n"); - } - } - - // Check big/little - for (int big = 0; big < 2; big+=1) - for (int signed = 0; signed < 2; signed+=1) - for (int bits = 6; bits <= 40; bits+=2) { - AudioFormat frm = new AudioFormat(44100, bits, 1, signed==1, big==1); - byte[] buff = new byte[testarray.length * frm.getFrameSize()]; - AudioFloatConverter conv = AudioFloatConverter.getConverter(frm); - conv.toByteArray(testarray, buff); - byte[] buff2 = new byte[testarray.length * frm.getFrameSize()]; - int fs = frm.getFrameSize(); - for (int i = 0; i < buff2.length; i+=fs) { - for (int j = 0; j < fs; j++) { - buff2[i+(fs-j-1)] = buff[i+j]; - } - } - float[] testarray2 = new float[testarray.length]; - AudioFormat frm2 = new AudioFormat(44100, bits, 1, signed==1, big==0); - AudioFloatConverter.getConverter(frm2).toFloatArray(buff2, testarray2); - for (int i = 0; i < testarray2.length; i++) { - if(Math.abs(testarray[i] - testarray2[i]) > 0.05) - { - throw new RuntimeException("Conversion failed for " + frm +" to " + frm2 + " , arrays not equal enough!\n"); - } - } - } - - // Check signed/unsigned - for (int big = 0; big < 2; big+=1) - for (int signed = 0; signed < 2; signed+=1) - for (int bits = 6; bits <= 40; bits+=2) { - AudioFormat frm = new AudioFormat(44100, bits, 1, signed==1, big==1); - byte[] b = new byte[testarray.length * frm.getFrameSize()]; - AudioFloatConverter conv = AudioFloatConverter.getConverter(frm); - conv.toByteArray(testarray, b); - int fs = frm.getFrameSize(); - if(big==1) - { - for(int i=0; i < b.length; i+= fs ) - b[i] = (b[i] >= 0) ? (byte)(0x80 | b[i]) : (byte)(0x7F & b[i]); - } - else - { - for(int i=(0+fs-1); i < b.length; i+= fs ) - b[i] = (b[i] >= 0) ? (byte)(0x80 | b[i]) : (byte)(0x7F & b[i]); - } - float[] testarray2 = new float[testarray.length]; - AudioFormat frm2 = new AudioFormat(44100, bits, 1, signed==0, big==1); - AudioFloatConverter.getConverter(frm2).toFloatArray(b, testarray2); - for (int i = 0; i < testarray2.length; i++) { - if(Math.abs(testarray[i] - testarray2[i]) > 0.05) - { - throw new RuntimeException("Conversion failed for " + frm +" to " + frm2 + " , arrays not equal enough!\n"); - } - } - } - - // Check if conversion 32->24, 24->16, 16->8 result in same float data - AudioFormat frm = new AudioFormat(44100, 40, 1, true, true); - byte[] b = new byte[testarray.length * frm.getFrameSize()]; - AudioFloatConverter.getConverter(frm).toByteArray(testarray, b); - for (int bits = 6; bits <= 40; bits+=2) { - AudioFormat frm2 = new AudioFormat(44100, bits, 1, true, true); - byte[] b2 = new byte[testarray.length * frm2.getFrameSize()]; - int fs1 = frm.getFrameSize(); - int fs2 = frm2.getFrameSize(); - int ii = 0; - for (int i = 0; i < b.length; i+=fs1) - for (int j = 0; j < fs2; j++) - b2[ii++] = b[i+j]; - float[] testarray2 = new float[testarray.length]; - AudioFloatConverter.getConverter(frm2).toFloatArray(b2, testarray2); - for (int i = 0; i < testarray2.length; i++) { - if(Math.abs(testarray[i] - testarray2[i]) > 0.05) - { - throw new RuntimeException("Conversion failed for " + frm +" to " + frm2 + " , arrays not equal enough!\n"); - } - } - } - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/AudioFloatInputStream/Available.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test AudioFloatInputStream available method */ - -import java.io.*; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Available { - - static float[] test_float_array; - static byte[] test_byte_array; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - - static AudioFloatInputStream getStream1() - { - return AudioFloatInputStream.getInputStream(format, test_byte_array, 0, test_byte_array.length); - } - - static AudioFloatInputStream getStream2() - { - AudioInputStream strm = new AudioInputStream(new ByteArrayInputStream(test_byte_array), format, 1024); - return AudioFloatInputStream.getInputStream(strm); - } - - static void setUp() throws Exception { - test_float_array = new float[1024]; - test_byte_array = new byte[1024*format.getFrameSize()]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - test_float_array[i] = (float)Math.sin(10*ii*2*Math.PI); - test_float_array[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - test_float_array[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - test_float_array[i] *= 0.3; - } - AudioFloatConverter.getConverter(format).toByteArray(test_float_array, test_byte_array); - } - - public static void main(String[] args) throws Exception { - setUp(); - for (int i = 0; i < 2; i++) { - AudioFloatInputStream stream = null; - if(i == 0) stream = getStream1(); - if(i == 1) stream = getStream2(); - float[] buff = new float[512]; - if(stream.available() != 1024) - throw new RuntimeException("stream.available return incorrect value."); - stream.read(buff); - if(stream.available() != 512) - throw new RuntimeException("stream.available return incorrect value."); - } - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/AudioFloatInputStream/Close.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test AudioFloatInputStream close method */ - -import java.io.*; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Close { - - static float[] test_float_array; - static byte[] test_byte_array; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - - static AudioFloatInputStream getStream1() - { - return AudioFloatInputStream.getInputStream(format, test_byte_array, 0, test_byte_array.length); - } - - static AudioFloatInputStream getStream2() - { - AudioInputStream strm = new AudioInputStream(new ByteArrayInputStream(test_byte_array), format, 1024); - return AudioFloatInputStream.getInputStream(strm); - } - - static void setUp() throws Exception { - test_float_array = new float[1024]; - test_byte_array = new byte[1024*format.getFrameSize()]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - test_float_array[i] = (float)Math.sin(10*ii*2*Math.PI); - test_float_array[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - test_float_array[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - test_float_array[i] *= 0.3; - } - AudioFloatConverter.getConverter(format).toByteArray(test_float_array, test_byte_array); - } - - public static void main(String[] args) throws Exception { - setUp(); - getStream1().close(); - getStream2().close(); - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/AudioFloatInputStream/GetFormat.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test AudioFloatInputStream getFormat method */ - -import java.io.*; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class GetFormat { - - static float[] test_float_array; - static byte[] test_byte_array; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - - static AudioFloatInputStream getStream1() - { - return AudioFloatInputStream.getInputStream(format, test_byte_array, 0, test_byte_array.length); - } - - static AudioFloatInputStream getStream2() - { - AudioInputStream strm = new AudioInputStream(new ByteArrayInputStream(test_byte_array), format, 1024); - return AudioFloatInputStream.getInputStream(strm); - } - - static void setUp() throws Exception { - test_float_array = new float[1024]; - test_byte_array = new byte[1024*format.getFrameSize()]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - test_float_array[i] = (float)Math.sin(10*ii*2*Math.PI); - test_float_array[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - test_float_array[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - test_float_array[i] *= 0.3; - } - AudioFloatConverter.getConverter(format).toByteArray(test_float_array, test_byte_array); - } - - public static void main(String[] args) throws Exception { - setUp(); - if(!getStream1().getFormat().matches(format)) - throw new RuntimeException("Incorrect audio format returned."); - if(!getStream2().getFormat().matches(format)) - throw new RuntimeException("Incorrect audio format returned."); - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/AudioFloatInputStream/GetFrameLength.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test AudioFloatInputStream getFrameLength method */ - -import java.io.*; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class GetFrameLength { - - static float[] test_float_array; - static byte[] test_byte_array; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - - static AudioFloatInputStream getStream1() - { - return AudioFloatInputStream.getInputStream(format, test_byte_array, 0, test_byte_array.length); - } - - static AudioFloatInputStream getStream2() - { - AudioInputStream strm = new AudioInputStream(new ByteArrayInputStream(test_byte_array), format, 1024); - return AudioFloatInputStream.getInputStream(strm); - } - - static void setUp() throws Exception { - test_float_array = new float[1024]; - test_byte_array = new byte[1024*format.getFrameSize()]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - test_float_array[i] = (float)Math.sin(10*ii*2*Math.PI); - test_float_array[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - test_float_array[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - test_float_array[i] *= 0.3; - } - AudioFloatConverter.getConverter(format).toByteArray(test_float_array, test_byte_array); - } - - public static void main(String[] args) throws Exception { - setUp(); - if(getStream1().getFrameLength() != 1024L) - throw new RuntimeException("Incorrect frame length returned."); - if(getStream2().getFrameLength() != 1024L) - throw new RuntimeException("Incorrect frame length returned."); - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/AudioFloatInputStream/MarkSupported.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test AudioFloatInputStream markSupported method */ - -import java.io.*; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class MarkSupported { - - static float[] test_float_array; - static byte[] test_byte_array; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - - static AudioFloatInputStream getStream1() - { - return AudioFloatInputStream.getInputStream(format, test_byte_array, 0, test_byte_array.length); - } - - static AudioFloatInputStream getStream2() - { - AudioInputStream strm = new AudioInputStream(new ByteArrayInputStream(test_byte_array), format, 1024); - return AudioFloatInputStream.getInputStream(strm); - } - - static void setUp() throws Exception { - test_float_array = new float[1024]; - test_byte_array = new byte[1024*format.getFrameSize()]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - test_float_array[i] = (float)Math.sin(10*ii*2*Math.PI); - test_float_array[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - test_float_array[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - test_float_array[i] *= 0.3; - } - AudioFloatConverter.getConverter(format).toByteArray(test_float_array, test_byte_array); - } - - public static void main(String[] args) throws Exception { - setUp(); - if(!getStream1().markSupported()) - throw new RuntimeException("Mark not supported."); - if(!getStream2().markSupported()) - throw new RuntimeException("Mark not supported."); - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/AudioFloatInputStream/Read.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test AudioFloatInputStream read method */ - -import java.io.*; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Read { - - static float[] test_float_array; - static byte[] test_byte_array; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - - static AudioFloatInputStream getStream1() - { - return AudioFloatInputStream.getInputStream(format, test_byte_array, 0, test_byte_array.length); - } - - static AudioFloatInputStream getStream2() - { - AudioInputStream strm = new AudioInputStream(new ByteArrayInputStream(test_byte_array), format, 1024); - return AudioFloatInputStream.getInputStream(strm); - } - - static void setUp() throws Exception { - test_float_array = new float[1024]; - test_byte_array = new byte[1024*format.getFrameSize()]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - test_float_array[i] = (float)Math.sin(10*ii*2*Math.PI); - test_float_array[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - test_float_array[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - test_float_array[i] *= 0.3; - } - AudioFloatConverter.getConverter(format).toByteArray(test_float_array, test_byte_array); - } - - public static void main(String[] args) throws Exception { - setUp(); - - for (int i = 0; i < 2; i++) { - AudioFloatInputStream stream = null; - if(i == 0) stream = getStream1(); - if(i == 1) stream = getStream2(); - float v = 0; - stream.skip(512); - v = stream.read(); - if(!(Math.abs(v - test_float_array[512]) < 0.0001)) - { - throw new RuntimeException("Read returned unexpected value."); - } - } - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/AudioFloatInputStream/ReadFloatArray.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test AudioFloatInputStream read(float[]) method */ - -import java.io.*; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class ReadFloatArray { - - static float[] test_float_array; - static byte[] test_byte_array; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - - static AudioFloatInputStream getStream1() - { - return AudioFloatInputStream.getInputStream(format, test_byte_array, 0, test_byte_array.length); - } - - static AudioFloatInputStream getStream2() - { - AudioInputStream strm = new AudioInputStream(new ByteArrayInputStream(test_byte_array), format, 1024); - return AudioFloatInputStream.getInputStream(strm); - } - - static void setUp() throws Exception { - test_float_array = new float[1024]; - test_byte_array = new byte[1024*format.getFrameSize()]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - test_float_array[i] = (float)Math.sin(10*ii*2*Math.PI); - test_float_array[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - test_float_array[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - test_float_array[i] *= 0.3; - } - AudioFloatConverter.getConverter(format).toByteArray(test_float_array, test_byte_array); - } - - public static void main(String[] args) throws Exception { - setUp(); - - for (int i = 0; i < 2; i++) { - AudioFloatInputStream stream = null; - if(i == 0) stream = getStream1(); - if(i == 1) stream = getStream2(); - float[] buff = new float[1024]; - stream.read(buff); - for (int j = 0; j < buff.length; j++) - if(!(Math.abs(buff[j] - test_float_array[j]) < 0.0001)) - throw new RuntimeException("Incorrect data in buffer."); - } - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/AudioFloatInputStream/ReadFloatArrayIntInt.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test AudioFloatInputStream read(float[], int, int) method */ - -import java.io.*; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class ReadFloatArrayIntInt { - - static float[] test_float_array; - static byte[] test_byte_array; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - - static AudioFloatInputStream getStream1() - { - return AudioFloatInputStream.getInputStream(format, test_byte_array, 0, test_byte_array.length); - } - - static AudioFloatInputStream getStream2() - { - AudioInputStream strm = new AudioInputStream(new ByteArrayInputStream(test_byte_array), format, 1024); - return AudioFloatInputStream.getInputStream(strm); - } - - static void setUp() throws Exception { - test_float_array = new float[1024]; - test_byte_array = new byte[1024*format.getFrameSize()]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - test_float_array[i] = (float)Math.sin(10*ii*2*Math.PI); - test_float_array[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - test_float_array[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - test_float_array[i] *= 0.3; - } - AudioFloatConverter.getConverter(format).toByteArray(test_float_array, test_byte_array); - } - - public static void main(String[] args) throws Exception { - setUp(); - - for (int i = 0; i < 2; i++) { - AudioFloatInputStream stream = null; - if(i == 0) stream = getStream1(); - if(i == 1) stream = getStream2(); - float[] buff = new float[1024]; - stream.read(buff,0,512); - stream.read(buff,512,512); - for (int j = 0; j < buff.length; j++) - if(!(Math.abs(buff[j] - test_float_array[j]) < 0.0001)) - throw new RuntimeException("Incorrect data in buffer."); - - } - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/AudioFloatInputStream/Reset.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test AudioFloatInputStream reset method */ - -import java.io.*; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Reset { - - static float[] test_float_array; - static byte[] test_byte_array; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - - static AudioFloatInputStream getStream1() - { - return AudioFloatInputStream.getInputStream(format, test_byte_array, 0, test_byte_array.length); - } - - static AudioFloatInputStream getStream2() - { - AudioInputStream strm = new AudioInputStream(new ByteArrayInputStream(test_byte_array), format, 1024); - return AudioFloatInputStream.getInputStream(strm); - } - - static void setUp() throws Exception { - test_float_array = new float[1024]; - test_byte_array = new byte[1024*format.getFrameSize()]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - test_float_array[i] = (float)Math.sin(10*ii*2*Math.PI); - test_float_array[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - test_float_array[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - test_float_array[i] *= 0.3; - } - AudioFloatConverter.getConverter(format).toByteArray(test_float_array, test_byte_array); - } - - public static void main(String[] args) throws Exception { - setUp(); - - for (int i = 0; i < 2; i++) { - AudioFloatInputStream stream = null; - if(i == 0) stream = getStream1(); - if(i == 1) stream = getStream2(); - float[] buff = new float[512]; - float[] buff2 = new float[512]; - stream.read(buff); - stream.mark(512); - stream.read(buff); - stream.reset(); - stream.read(buff2); - for (int j = 0; j < buff2.length; j++) - if(!(Math.abs(buff[j] - buff2[j]) < 0.0001)) - throw new RuntimeException("Incorrect data in buffer."); - - } - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/AudioFloatInputStream/Skip.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test AudioFloatInputStream skip method */ - -import java.io.*; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Skip { - - static float[] test_float_array; - static byte[] test_byte_array; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - - static AudioFloatInputStream getStream1() - { - return AudioFloatInputStream.getInputStream(format, test_byte_array, 0, test_byte_array.length); - } - - static AudioFloatInputStream getStream2() - { - AudioInputStream strm = new AudioInputStream(new ByteArrayInputStream(test_byte_array), format, 1024); - return AudioFloatInputStream.getInputStream(strm); - } - - static void setUp() throws Exception { - test_float_array = new float[1024]; - test_byte_array = new byte[1024*format.getFrameSize()]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - test_float_array[i] = (float)Math.sin(10*ii*2*Math.PI); - test_float_array[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - test_float_array[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - test_float_array[i] *= 0.3; - } - AudioFloatConverter.getConverter(format).toByteArray(test_float_array, test_byte_array); - } - - public static void main(String[] args) throws Exception { - setUp(); - - for (int i = 0; i < 2; i++) { - AudioFloatInputStream stream = null; - if(i == 0) stream = getStream1(); - if(i == 1) stream = getStream2(); - float[] buff = new float[512]; - stream.skip(512); - stream.read(buff); - for (int j = 0; j < buff.length; j++) - if(!(Math.abs(buff[j] - test_float_array[j+512]) < 0.0001)) - throw new RuntimeException("Incorrect data in buffer."); - - } - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/DLSSoundbankReader/TestGetSoundbankFile.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test DLSSoundbankReader getSoundbank(File) method */ - -import java.io.File; - -import javax.sound.midi.Patch; -import javax.sound.midi.Soundbank; - -import com.sun.media.sound.DLSSoundbankReader; - -public class TestGetSoundbankFile { - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - File file = new File(System.getProperty("test.src", "."), "ding.dls"); - Soundbank dls = new DLSSoundbankReader().getSoundbank(file); - assertTrue(dls.getInstruments().length == 1); - Patch patch = dls.getInstruments()[0].getPatch(); - assertTrue(patch.getProgram() == 0); - assertTrue(patch.getBank() == 0); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/DLSSoundbankReader/TestGetSoundbankInputStream.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test DLSSoundbankReader getSoundbank(InputStream) method */ - -import java.io.BufferedInputStream; -import java.io.File; -import java.io.FileInputStream; - -import javax.sound.midi.Patch; -import javax.sound.midi.Soundbank; - -import com.sun.media.sound.DLSSoundbankReader; - -public class TestGetSoundbankInputStream { - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - File file = new File(System.getProperty("test.src", "."), "ding.dls"); - FileInputStream fis = new FileInputStream(file); - BufferedInputStream bis = new BufferedInputStream(fis); - try - { - Soundbank dls = new DLSSoundbankReader().getSoundbank(bis); - assertTrue(dls.getInstruments().length == 1); - Patch patch = dls.getInstruments()[0].getPatch(); - assertTrue(patch.getProgram() == 0); - assertTrue(patch.getBank() == 0); - } - finally - { - bis.close(); - } - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/DLSSoundbankReader/TestGetSoundbankInputStream2.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,119 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test DLSSoundbankReader getSoundbank(InputStream) method using - very bad InputStream which can only read 1 byte at time */ - -import java.io.BufferedInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; - -import javax.sound.midi.Patch; -import javax.sound.midi.Soundbank; - -import com.sun.media.sound.DLSSoundbankReader; - -public class TestGetSoundbankInputStream2 { - - private static class BadInputStream extends InputStream - { - - InputStream is; - - public BadInputStream(InputStream is) - { - this.is = is; - } - - public int read() throws IOException { - return is.read(); - } - - public int read(byte[] b, int off, int len) throws IOException { - if(len > 1) len = 1; - return is.read(b, off, len); - } - - public int read(byte[] b) throws IOException { - return read(b, 0, b.length); - } - - public long skip(long n) throws IOException { - if(n > 1) n = 1; - return is.skip(n); - } - - public int available() throws IOException { - int avail = is.available(); - if(avail > 1) avail = 1; - return avail; - } - - public void close() throws IOException { - is.close(); - } - - public synchronized void mark(int readlimit) { - is.mark(readlimit); - } - - public boolean markSupported() { - return is.markSupported(); - } - - public synchronized void reset() throws IOException { - is.reset(); - } - - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - File file = new File(System.getProperty("test.src", "."), "ding.dls"); - FileInputStream fis = new FileInputStream(file); - BufferedInputStream bis = new BufferedInputStream(fis); - try - { - InputStream badis = new BadInputStream(bis); - Soundbank dls = new DLSSoundbankReader().getSoundbank(badis); - assertTrue(dls.getInstruments().length == 1); - Patch patch = dls.getInstruments()[0].getPatch(); - assertTrue(patch.getProgram() == 0); - assertTrue(patch.getBank() == 0); - } - finally - { - bis.close(); - } - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/DLSSoundbankReader/TestGetSoundbankUrl.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test DLSSoundbankReader getSoundbank(File) method */ - -import java.io.File; -import java.net.URL; - -import javax.sound.midi.Patch; -import javax.sound.midi.Soundbank; - -import com.sun.media.sound.DLSSoundbankReader; - -public class TestGetSoundbankUrl { - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - File file = new File(System.getProperty("test.src", "."), "ding.dls"); - URL url = file.toURI().toURL(); - Soundbank dls = new DLSSoundbankReader().getSoundbank(url); - assertTrue(dls.getInstruments().length == 1); - Patch patch = dls.getInstruments()[0].getPatch(); - assertTrue(patch.getProgram() == 0); - assertTrue(patch.getBank() == 0); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/EmergencySoundbank/TestCreateSoundbank.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test EmergencySoundbank createSoundbank() method */ - -import java.io.File; - -import javax.sound.midi.Instrument; -import javax.sound.midi.Patch; -import javax.sound.midi.Soundbank; - -import com.sun.media.sound.EmergencySoundbank; -import com.sun.media.sound.ModelInstrument; -import com.sun.media.sound.ModelPatch; - -public class TestCreateSoundbank { - - public static void main(String[] args) throws Exception { - - Soundbank soundbank = EmergencySoundbank.createSoundbank(); - for (int i = 0; i < 128; i++) { - Patch patch = new ModelPatch(0, i, false); - ModelInstrument ins = (ModelInstrument)soundbank.getInstrument(patch); - if(ins == null) - throw new Exception("Instrument " + i + " is missing!"); - if(ins.getPerformers().length == 0) - throw new Exception("Instrument " + i + " doesn't have any performers!"); - } - Patch patch = new ModelPatch(0, 0, true); - ModelInstrument ins = (ModelInstrument)soundbank.getInstrument(patch); - if(ins == null) - throw new Exception("Drumkit instrument is missing!"); - if(ins.getPerformers().length == 0) - throw new Exception("Drumkit instrument doesn't have any performers!"); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBuffer/GetInputStream.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelByteBuffer getInputStream method */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class GetInputStream { - - static float[] testarray; - static byte[] test_byte_array; - static File test_file; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - - static void setUp() throws Exception { - testarray = new float[1024]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - testarray[i] = (float)Math.sin(10*ii*2*Math.PI); - testarray[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - testarray[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - testarray[i] *= 0.3; - } - test_byte_array = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); - test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); - } - - static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); - } - - public static void main(String[] args) throws Exception { - try - { - setUp(); - - for (int i = 0; i < 2; i++) { - ModelByteBuffer buff; - if(i == 0) - buff = new ModelByteBuffer(test_file); - else - buff = new ModelByteBuffer(test_byte_array); - - byte[] b = new byte[test_byte_array.length]; - buff.getInputStream().read(b); - for (int j = 0; j < b.length; j++) - if(b[i] != test_byte_array[i]) - throw new RuntimeException("Byte array compare fails!"); - } - } - finally - { - tearDown(); - } - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBuffer/GetRoot.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelByteBuffer getRoot method */ - -import java.io.File; -import java.io.FileOutputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class GetRoot { - - static float[] testarray; - static byte[] test_byte_array; - static File test_file; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - - static void setUp() throws Exception { - testarray = new float[1024]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - testarray[i] = (float)Math.sin(10*ii*2*Math.PI); - testarray[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - testarray[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - testarray[i] *= 0.3; - } - test_byte_array = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); - test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); - } - - static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); - } - - public static void main(String[] args) throws Exception { - try - { - setUp(); - - ModelByteBuffer buff = new ModelByteBuffer(test_file); - ModelByteBuffer buff2 = buff.subbuffer(10, 10); - ModelByteBuffer buff3 = buff2.subbuffer(2, 2); - if(buff != buff3.getRoot()) - throw new RuntimeException("ModelByteBuffer doesn't return correct root!"); - } - finally - { - tearDown(); - } - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBuffer/Load.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelByteBuffer load method */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Load { - - static float[] testarray; - static byte[] test_byte_array; - static File test_file; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - - static void setUp() throws Exception { - testarray = new float[1024]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - testarray[i] = (float)Math.sin(10*ii*2*Math.PI); - testarray[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - testarray[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - testarray[i] *= 0.3; - } - test_byte_array = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); - test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); - } - - static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); - } - - public static void main(String[] args) throws Exception { - try - { - setUp(); - - ModelByteBuffer buff = new ModelByteBuffer(test_file); - - buff.load(); - if(buff.array() == null) - throw new RuntimeException("buf is null!"); - if(buff.array().length != test_byte_array.length) - throw new RuntimeException("buff.array().length length is incorrect!"); - byte[] b = buff.array(); - for (int i = 0; i < b.length; i++) - if(test_byte_array[i] != b[i]) - throw new RuntimeException("buff.array() incorrect!"); - } - finally - { - tearDown(); - } - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBuffer/LoadAll.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelByteBuffer loadAll method */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class LoadAll { - - static float[] testarray; - static byte[] test_byte_array; - static File test_file; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - - static void setUp() throws Exception { - testarray = new float[1024]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - testarray[i] = (float)Math.sin(10*ii*2*Math.PI); - testarray[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - testarray[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - testarray[i] *= 0.3; - } - test_byte_array = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); - test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); - } - - static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); - } - - public static void main(String[] args) throws Exception { - try - { - setUp(); - - ModelByteBuffer buff = new ModelByteBuffer(test_file); - List<ModelByteBuffer> col = new ArrayList<ModelByteBuffer>(); - col.add(buff); - ModelByteBuffer.loadAll(col); - if(buff.array() == null) - throw new RuntimeException("buf is null!"); - if(buff.array().length != test_byte_array.length) - throw new RuntimeException("buff.array().length length is incorrect!"); - byte[] b = buff.array(); - for (int i = 0; i < b.length; i++) - if(test_byte_array[i] != b[i]) - throw new RuntimeException("buff.array() incorrect!"); - - } - finally - { - tearDown(); - } - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBuffer/NewModelByteBufferByteArray.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelByteBuffer(byte[]) constructor */ - -import java.io.File; -import java.io.FileOutputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class NewModelByteBufferByteArray { - - static float[] testarray; - static byte[] test_byte_array; - static File test_file; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - - static void setUp() throws Exception { - testarray = new float[1024]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - testarray[i] = (float)Math.sin(10*ii*2*Math.PI); - testarray[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - testarray[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - testarray[i] *= 0.3; - } - test_byte_array = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); - test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); - } - - static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); - } - - public static void main(String[] args) throws Exception { - try - { - setUp(); - - ModelByteBuffer buff = new ModelByteBuffer(test_byte_array); - if(buff.array() != test_byte_array) - throw new RuntimeException("buff.bytearray incorrect!"); - if(buff.capacity() != test_byte_array.length) - throw new RuntimeException("buff.capacity() incorrect!"); - if(buff.arrayOffset() != 0) - throw new RuntimeException("buff.arrayOffset not 0!"); - } - finally - { - tearDown(); - } - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBuffer/NewModelByteBufferByteArrayIntInt.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelByteBuffer(byte[],int,int) constructor */ - -import java.io.File; -import java.io.FileOutputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class NewModelByteBufferByteArrayIntInt { - - static float[] testarray; - static byte[] test_byte_array; - static File test_file; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - - static void setUp() throws Exception { - testarray = new float[1024]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - testarray[i] = (float)Math.sin(10*ii*2*Math.PI); - testarray[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - testarray[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - testarray[i] *= 0.3; - } - test_byte_array = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); - test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); - } - - static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); - } - - public static void main(String[] args) throws Exception { - try - { - setUp(); - - ModelByteBuffer buff = new ModelByteBuffer(test_byte_array,10,20); - if(buff.array() != test_byte_array) - throw new RuntimeException("buff.array() incorrect!"); - if(buff.capacity() != 20) - throw new RuntimeException("buff.capacity() not 20!"); - if(buff.arrayOffset() != 10) - throw new RuntimeException("buff.arrayOffset() not 10!"); - if(buff.getFile() != null) - throw new RuntimeException("buff.getFile() not null!"); - } - finally - { - tearDown(); - } - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBuffer/NewModelByteBufferFile.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelByteBuffer(File) constructor */ - -import java.io.File; -import java.io.FileOutputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class NewModelByteBufferFile { - - static float[] testarray; - static byte[] test_byte_array; - static File test_file; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - - static void setUp() throws Exception { - testarray = new float[1024]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - testarray[i] = (float)Math.sin(10*ii*2*Math.PI); - testarray[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - testarray[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - testarray[i] *= 0.3; - } - test_byte_array = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); - test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); - } - - static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); - } - - public static void main(String[] args) throws Exception { - try - { - setUp(); - - ModelByteBuffer buff = new ModelByteBuffer(test_file); - if(buff.array() != null) - throw new RuntimeException("buff.array() not null!"); - if(buff.capacity() != test_file.length()) - throw new RuntimeException("buff.capacity() incorrect!"); - if(buff.arrayOffset() != 0) - throw new RuntimeException("buff.arrayOffset() not 0!"); - if(buff.getFile() != test_file) - throw new RuntimeException("buff.getFile() incorrect!"); - if(buff.getFilePointer() != 0) - throw new RuntimeException("buff.getFilePointer() not 0!"); - } - finally - { - tearDown(); - } - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBuffer/NewModelByteBufferFileLongLong.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelByteBuffer(File,long,long) constructor */ - -import java.io.File; -import java.io.FileOutputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class NewModelByteBufferFileLongLong { - - static float[] testarray; - static byte[] test_byte_array; - static File test_file; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - - static void setUp() throws Exception { - testarray = new float[1024]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - testarray[i] = (float)Math.sin(10*ii*2*Math.PI); - testarray[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - testarray[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - testarray[i] *= 0.3; - } - test_byte_array = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); - test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); - } - - static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); - } - - public static void main(String[] args) throws Exception { - try - { - setUp(); - - ModelByteBuffer buff = new ModelByteBuffer(test_file,10,20); - if(buff.array() != null) - throw new RuntimeException("buff.array() not null!"); - if(buff.capacity() != 20) - throw new RuntimeException("buff.capacity() not 20!"); - if(buff.arrayOffset() != 0) - throw new RuntimeException("buff.arrayOffset() not 0!"); - if(buff.getFile() != test_file) - throw new RuntimeException("buff.getFile incorrect!"); - if(buff.getFilePointer() != 10) - throw new RuntimeException("buff.getFilePointer not 10!"); - } - finally - { - tearDown(); - } - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBuffer/RandomFileInputStream/Available.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelByteBuffer.RandomFileInputStream available() method */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Available { - - static float[] testarray; - static byte[] test_byte_array; - static File test_file; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - - static void setUp() throws Exception { - testarray = new float[1024]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - testarray[i] = (float)Math.sin(10*ii*2*Math.PI); - testarray[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - testarray[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - testarray[i] *= 0.3; - } - test_byte_array = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); - test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); - } - - static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); - } - - public static void main(String[] args) throws Exception { - try - { - setUp(); - - for (int i = 0; i < 8; i++) { - ModelByteBuffer buff; - if(i % 2 == 0) - buff = new ModelByteBuffer(test_file); - else - buff = new ModelByteBuffer(test_byte_array); - if((i / 2) == 1) - buff.subbuffer(5); - if((i / 2) == 2) - buff.subbuffer(5,500); - if((i / 2) == 3) - buff.subbuffer(5,600,true); - - long capacity = buff.capacity(); - InputStream is = buff.getInputStream(); - try - { - int ret = is.available(); - if(ret != capacity) - throw new RuntimeException("is.available() return unexpected value!"); - } - finally - { - is.close(); - } - if(buff.capacity() != capacity) - throw new RuntimeException("Capacity variable should not change!"); - } - } - finally - { - tearDown(); - } - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBuffer/RandomFileInputStream/Close.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,104 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelByteBuffer.RandomFileInputStream close method */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Close { - - static float[] testarray; - static byte[] test_byte_array; - static File test_file; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - - static void setUp() throws Exception { - testarray = new float[1024]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - testarray[i] = (float)Math.sin(10*ii*2*Math.PI); - testarray[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - testarray[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - testarray[i] *= 0.3; - } - test_byte_array = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); - test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); - } - - static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); - } - - public static void main(String[] args) throws Exception { - try - { - setUp(); - - for (int i = 0; i < 8; i++) { - ModelByteBuffer buff; - if(i % 2 == 0) - buff = new ModelByteBuffer(test_file); - else - buff = new ModelByteBuffer(test_byte_array); - if((i / 2) == 1) - buff.subbuffer(5); - if((i / 2) == 2) - buff.subbuffer(5,500); - if((i / 2) == 3) - buff.subbuffer(5,600,true); - - long capacity = buff.capacity(); - InputStream is = buff.getInputStream(); - try - { - } - finally - { - is.close(); - } - if(buff.capacity() != capacity) - throw new RuntimeException("Capacity variable should not change!"); - } - } - finally - { - tearDown(); - } - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBuffer/RandomFileInputStream/MarkReset.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,129 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelByteBuffer.RandomFileInputStream mark and reset methods */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class MarkReset { - - static float[] testarray; - static byte[] test_byte_array; - static File test_file; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - - static void setUp() throws Exception { - testarray = new float[1024]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - testarray[i] = (float)Math.sin(10*ii*2*Math.PI); - testarray[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - testarray[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - testarray[i] *= 0.3; - } - test_byte_array = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); - test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); - } - - static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); - } - - public static void main(String[] args) throws Exception { - try - { - setUp(); - - for (int i = 0; i < 8; i++) { - ModelByteBuffer buff; - if(i % 2 == 0) - buff = new ModelByteBuffer(test_file); - else - buff = new ModelByteBuffer(test_byte_array); - if((i / 2) == 1) - buff.subbuffer(5); - if((i / 2) == 2) - buff.subbuffer(5,500); - if((i / 2) == 3) - buff.subbuffer(5,600,true); - - long capacity = buff.capacity(); - InputStream is = buff.getInputStream(); - try - { - is.mark(1000); - int ret = is.available(); - int a = is.read(); - is.skip(75); - is.reset(); - if(is.available() != ret) - throw new RuntimeException( - "is.available() returns incorrect value (" - + is.available() + "!="+(ret)+") !"); - int b = is.read(); - if(a != b) - throw new RuntimeException( - "is doesn't return same value after reset (" - + a + "!="+b+") !"); - - is.skip(15); - ret = is.available(); - is.mark(1000); - is.reset(); - if(is.available() != ret) - throw new RuntimeException( - "is.available() returns incorrect value (" - + is.available() + "!="+(ret)+") !"); - - - } - finally - { - is.close(); - } - if(buff.capacity() != capacity) - throw new RuntimeException("Capacity variable should not change!"); - } - } - finally - { - tearDown(); - } - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBuffer/RandomFileInputStream/MarkSupported.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,106 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelByteBuffer.RandomFileInputStream markSupported() method */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class MarkSupported { - - static float[] testarray; - static byte[] test_byte_array; - static File test_file; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - - static void setUp() throws Exception { - testarray = new float[1024]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - testarray[i] = (float)Math.sin(10*ii*2*Math.PI); - testarray[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - testarray[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - testarray[i] *= 0.3; - } - test_byte_array = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); - test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); - } - - static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); - } - - public static void main(String[] args) throws Exception { - try - { - setUp(); - - for (int i = 0; i < 8; i++) { - ModelByteBuffer buff; - if(i % 2 == 0) - buff = new ModelByteBuffer(test_file); - else - buff = new ModelByteBuffer(test_byte_array); - if((i / 2) == 1) - buff.subbuffer(5); - if((i / 2) == 2) - buff.subbuffer(5,500); - if((i / 2) == 3) - buff.subbuffer(5,600,true); - - long capacity = buff.capacity(); - InputStream is = buff.getInputStream(); - try - { - if(!is.markSupported()) - throw new RuntimeException("InputStream doesn't support mark/reset!"); - } - finally - { - is.close(); - } - if(buff.capacity() != capacity) - throw new RuntimeException("Capacity variable should not change!"); - } - } - finally - { - tearDown(); - } - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBuffer/RandomFileInputStream/Read.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,117 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelByteBuffer.RandomFileInputStream read() method */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Read { - - static float[] testarray; - static byte[] test_byte_array; - static File test_file; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - - static void setUp() throws Exception { - testarray = new float[1024]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - testarray[i] = (float)Math.sin(10*ii*2*Math.PI); - testarray[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - testarray[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - testarray[i] *= 0.3; - } - test_byte_array = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); - test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); - } - - static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); - } - - public static void main(String[] args) throws Exception { - try - { - setUp(); - - for (int i = 0; i < 8; i++) { - ModelByteBuffer buff; - if(i % 2 == 0) - buff = new ModelByteBuffer(test_file); - else - buff = new ModelByteBuffer(test_byte_array); - if((i / 2) == 1) - buff.subbuffer(5); - if((i / 2) == 2) - buff.subbuffer(5,500); - if((i / 2) == 3) - buff.subbuffer(5,600,true); - - long capacity = buff.capacity(); - InputStream is = buff.getInputStream(); - try - { - byte[] b = new byte[100]; - int ret = is.available(); - int n = is.read(); - if(n == -1) - throw new RuntimeException("is.read shouldn't return -1!"); - if(is.available() != ret - 1) - throw new RuntimeException( - "is.available() returns incorrect value (" - + is.available() + "!="+(ret - 1)+") !"); - is.skip(5000); - if(is.read() != -1) - throw new RuntimeException( - "is.read() doesn't return -1!"); - } - finally - { - is.close(); - } - if(buff.capacity() != capacity) - throw new RuntimeException("Capacity variable should not change!"); - } - } - finally - { - tearDown(); - } - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBuffer/RandomFileInputStream/ReadByte.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,118 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelByteBuffer.RandomFileInputStream read(byte[]) method */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class ReadByte { - - static float[] testarray; - static byte[] test_byte_array; - static File test_file; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - - static void setUp() throws Exception { - testarray = new float[1024]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - testarray[i] = (float)Math.sin(10*ii*2*Math.PI); - testarray[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - testarray[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - testarray[i] *= 0.3; - } - test_byte_array = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); - test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); - } - - static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); - } - - public static void main(String[] args) throws Exception { - try - { - setUp(); - - for (int i = 0; i < 8; i++) { - ModelByteBuffer buff; - if(i % 2 == 0) - buff = new ModelByteBuffer(test_file); - else - buff = new ModelByteBuffer(test_byte_array); - if((i / 2) == 1) - buff.subbuffer(5); - if((i / 2) == 2) - buff.subbuffer(5,500); - if((i / 2) == 3) - buff.subbuffer(5,600,true); - - long capacity = buff.capacity(); - InputStream is = buff.getInputStream(); - try - { - byte[] b = new byte[100]; - int ret = is.available(); - int n = is.read(b); - if(n == -1) - throw new RuntimeException("is.read shouldn't return -1!"); - if(is.available() != ret - n) - throw new RuntimeException( - "is.available() returns incorrect value (" - + is.available() + "!="+(ret - n)+") !"); - is.skip(5000); - if(is.read(b) != -1) - throw new RuntimeException( - "is.read() doesn't return -1!"); - - } - finally - { - is.close(); - } - if(buff.capacity() != capacity) - throw new RuntimeException("Capacity variable should not change!"); - } - } - finally - { - tearDown(); - } - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBuffer/RandomFileInputStream/ReadByteIntInt.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,118 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelByteBuffer.RandomFileInputStream read(byte[], int, int) method */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class ReadByteIntInt { - - static float[] testarray; - static byte[] test_byte_array; - static File test_file; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - - static void setUp() throws Exception { - testarray = new float[1024]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - testarray[i] = (float)Math.sin(10*ii*2*Math.PI); - testarray[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - testarray[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - testarray[i] *= 0.3; - } - test_byte_array = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); - test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); - } - - static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); - } - - public static void main(String[] args) throws Exception { - try - { - setUp(); - - for (int i = 0; i < 8; i++) { - ModelByteBuffer buff; - if(i % 2 == 0) - buff = new ModelByteBuffer(test_file); - else - buff = new ModelByteBuffer(test_byte_array); - if((i / 2) == 1) - buff.subbuffer(5); - if((i / 2) == 2) - buff.subbuffer(5,500); - if((i / 2) == 3) - buff.subbuffer(5,600,true); - - long capacity = buff.capacity(); - InputStream is = buff.getInputStream(); - try - { - byte[] b = new byte[100]; - int ret = is.available(); - int n = is.read(b, 7, 50); - if(n == -1) - throw new RuntimeException("is.read shouldn't return -1!"); - if(is.available() != ret - n) - throw new RuntimeException( - "is.available() returns incorrect value (" - + is.available() + "!="+(ret - n)+") !"); - is.skip(5000); - if(is.read(b, 7, 50) != -1) - throw new RuntimeException( - "is.read() doesn't return -1!"); - - } - finally - { - is.close(); - } - if(buff.capacity() != capacity) - throw new RuntimeException("Capacity variable should not change!"); - } - } - finally - { - tearDown(); - } - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBuffer/RandomFileInputStream/Skip.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,131 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelByteBuffer.RandomFileInputStream skip(long) method */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Skip { - - static float[] testarray; - static byte[] test_byte_array; - static File test_file; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - - static void setUp() throws Exception { - testarray = new float[1024]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - testarray[i] = (float)Math.sin(10*ii*2*Math.PI); - testarray[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - testarray[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - testarray[i] *= 0.3; - } - test_byte_array = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); - test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); - } - - static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); - } - - public static void main(String[] args) throws Exception { - try - { - setUp(); - - for (int i = 0; i < 8; i++) { - ModelByteBuffer buff; - if(i % 2 == 0) - buff = new ModelByteBuffer(test_file); - else - buff = new ModelByteBuffer(test_byte_array); - if((i / 2) == 1) - buff.subbuffer(5); - if((i / 2) == 2) - buff.subbuffer(5,500); - if((i / 2) == 3) - buff.subbuffer(5,600,true); - - long capacity = buff.capacity(); - InputStream is = buff.getInputStream(); - try - { - int ret = is.available(); - long n = is.skip(75); - if(n == -1) - throw new RuntimeException("is.read shouldn't return -1!"); - if(is.available() != ret - n) - throw new RuntimeException( - "is.available() returns incorrect value (" - + is.available() + "!="+(ret - n)+") !"); - - ret = is.available(); - n = is.skip(-100); - if(n != 0) - throw new RuntimeException("is.skip(-100) shouldn't skip values!"); - if(is.available() != ret - n) - throw new RuntimeException( - "is.available() returns incorrect value (" - + is.available() + "!="+(ret - n)+") !"); - - ret = is.available(); - n = is.skip(5000); - if(is.available() != ret - n) - throw new RuntimeException( - "is.available() returns incorrect value (" - + is.available() + "!="+(ret - n)+") !"); - if(is.available() != 0) - throw new RuntimeException( - "is.available() returns incorrect value (" - + is.available() + "!="+(0)+") !"); } - finally - { - is.close(); - } - if(buff.capacity() != capacity) - throw new RuntimeException("Capacity variable should not change!"); - } - } - finally - { - tearDown(); - } - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBuffer/SubbufferLong.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelByteBuffer subbuffer(long) method */ - -import java.io.File; -import java.io.FileOutputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class SubbufferLong { - - static float[] testarray; - static byte[] test_byte_array; - static File test_file; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - - static void setUp() throws Exception { - testarray = new float[1024]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - testarray[i] = (float)Math.sin(10*ii*2*Math.PI); - testarray[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - testarray[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - testarray[i] *= 0.3; - } - test_byte_array = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); - test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); - } - - static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); - } - - public static void main(String[] args) throws Exception { - try - { - setUp(); - - for (int i = 0; i < 2; i++) { - ModelByteBuffer buff; - if(i == 0) - buff = new ModelByteBuffer(test_file); - else - buff = new ModelByteBuffer(test_byte_array); - - ModelByteBuffer buff2 = buff.subbuffer(10); - if(buff2.getFilePointer() != buff.getFilePointer()) - throw new RuntimeException("buff2.getFilePointer() incorreect!"); - if(buff2.arrayOffset() != 10) - throw new RuntimeException("buff2.arrayOffset() not 10!"); - if(buff2.capacity() != buff.capacity()-10) - throw new RuntimeException("buff2.capacity() not correct!"); - } - } - finally - { - tearDown(); - } - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBuffer/SubbufferLongLong.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelByteBuffer subbuffer(long,long) method */ - -import java.io.File; -import java.io.FileOutputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class SubbufferLongLong { - - static float[] testarray; - static byte[] test_byte_array; - static File test_file; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - - static void setUp() throws Exception { - testarray = new float[1024]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - testarray[i] = (float)Math.sin(10*ii*2*Math.PI); - testarray[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - testarray[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - testarray[i] *= 0.3; - } - test_byte_array = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); - test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); - } - - static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); - } - - public static void main(String[] args) throws Exception { - try - { - setUp(); - - for (int i = 0; i < 2; i++) { - ModelByteBuffer buff; - if(i == 0) - buff = new ModelByteBuffer(test_file); - else - buff = new ModelByteBuffer(test_byte_array); - - ModelByteBuffer buff2 = buff.subbuffer(10,21); - if(buff2.getFilePointer() != buff.getFilePointer()) - throw new RuntimeException("buff2.getFilePointer() incorrect!"); - if(buff2.arrayOffset() != 10) - throw new RuntimeException("buff2.arrayOffset() not 10!"); - if(buff2.capacity() != 11) - throw new RuntimeException("buff2.capacity() not 11!"); - } - } - finally - { - tearDown(); - } - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBuffer/SubbufferLongLongBoolean.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelByteBuffer subbuffer(long,long,boolean) method */ - -import java.io.File; -import java.io.FileOutputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class SubbufferLongLongBoolean { - - static float[] testarray; - static byte[] test_byte_array; - static File test_file; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - - static void setUp() throws Exception { - testarray = new float[1024]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - testarray[i] = (float)Math.sin(10*ii*2*Math.PI); - testarray[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - testarray[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - testarray[i] *= 0.3; - } - test_byte_array = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); - test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); - } - - static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); - } - - public static void main(String[] args) throws Exception { - try - { - setUp(); - - for (int i = 0; i < 2; i++) { - ModelByteBuffer buff; - if(i == 0) - buff = new ModelByteBuffer(test_file); - else - buff = new ModelByteBuffer(test_byte_array); - - ModelByteBuffer buff2 = buff.subbuffer(10,21,true); - if(buff2.getRoot() != buff2); - if(buff2.capacity() != 11); - if(i == 0) - { - if(buff2.getFilePointer() != buff.getFilePointer()+10) - throw new RuntimeException("buff2.getFilePointer() incorrect!"); - } - else - { - if(buff2.arrayOffset() != 10) - throw new RuntimeException("buff2.arrayOffset() not 10!"); - } - } - } - finally - { - tearDown(); - } - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBuffer/Unload.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelByteBuffer unload method */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Unload { - - static float[] testarray; - static byte[] test_byte_array; - static File test_file; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - - static void setUp() throws Exception { - testarray = new float[1024]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - testarray[i] = (float)Math.sin(10*ii*2*Math.PI); - testarray[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - testarray[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - testarray[i] *= 0.3; - } - test_byte_array = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); - test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); - } - - static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); - } - - public static void main(String[] args) throws Exception { - try - { - setUp(); - - ModelByteBuffer buff = new ModelByteBuffer(test_file); - buff.load(); - buff.unload(); - if(buff.array() != null) - throw new RuntimeException("buff.array() not null!"); - } - finally - { - tearDown(); - } - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBuffer/WriteTo.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelByteBuffer writeTo method */ - -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class WriteTo { - - static float[] testarray; - static byte[] test_byte_array; - static File test_file; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - - static void setUp() throws Exception { - testarray = new float[1024]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - testarray[i] = (float)Math.sin(10*ii*2*Math.PI); - testarray[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - testarray[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - testarray[i] *= 0.3; - } - test_byte_array = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); - test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); - } - - static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); - } - - public static void main(String[] args) throws Exception { - try - { - setUp(); - - for (int i = 0; i < 2; i++) { - ModelByteBuffer buff; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - if(i == 0) - buff = new ModelByteBuffer(test_file); - else - buff = new ModelByteBuffer(test_byte_array); - buff.writeTo(baos); - byte[] b = baos.toByteArray(); - for (int j = 0; j < b.length; j++) - if(b[i] != test_byte_array[i]) - throw new RuntimeException("baos.toByteArray() incorrect!"); - } - } - finally - { - tearDown(); - } - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBufferWavetable/GetAttenuation.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,97 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelByteBufferWavetable getAttenuation method */ - -import java.io.ByteArrayOutputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class GetAttenuation { - - static float[] testarray; - static byte[] test_byte_array; - static byte[] test_byte_array_8ext; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - static AudioFormat format24 = new AudioFormat(44100, 24, 1, true, false); - static ModelByteBuffer buffer; - static ModelByteBuffer buffer_wave; - static ModelByteBuffer buffer8; - static ModelByteBuffer buffer16_8; - static ModelByteBuffer buffer24; - - static void setUp() throws Exception { - testarray = new float[1024]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - testarray[i] = (float)Math.sin(10*ii*2*Math.PI); - testarray[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - testarray[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - testarray[i] *= 0.3; - } - test_byte_array = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); - buffer = new ModelByteBuffer(test_byte_array); - - byte[] test_byte_array2 = new byte[testarray.length*3]; - buffer24 = new ModelByteBuffer(test_byte_array2); - test_byte_array_8ext = new byte[testarray.length]; - byte[] test_byte_array_8_16 = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format24).toByteArray(testarray, test_byte_array2); - int ix = 0; - int x = 0; - for (int i = 0; i < test_byte_array_8ext.length; i++) { - test_byte_array_8ext[i] = test_byte_array2[ix++]; - test_byte_array_8_16[x++] = test_byte_array2[ix++]; - test_byte_array_8_16[x++] = test_byte_array2[ix++]; - } - buffer16_8 = new ModelByteBuffer(test_byte_array_8_16); - buffer8 = new ModelByteBuffer(test_byte_array_8ext); - - AudioInputStream ais = new AudioInputStream(buffer.getInputStream(), format, testarray.length); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - AudioSystem.write(ais, AudioFileFormat.Type.WAVE, baos); - buffer_wave = new ModelByteBuffer(baos.toByteArray()); - } - - public static void main(String[] args) throws Exception { - - setUp(); - - ModelByteBufferWavetable wavetable = new ModelByteBufferWavetable(buffer,format); - wavetable.setAttenuation(10f); - if(wavetable.getAttenuation() != 10f) - throw new RuntimeException("wavetable.getAttenuation() not 10!"); - wavetable.setAttenuation(20f); - if(wavetable.getAttenuation() != 20f) - throw new RuntimeException("wavetable.getAttenuation() not 20!"); - - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBufferWavetable/GetChannels.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,97 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelByteBufferWavetable getChannels method */ - -import java.io.ByteArrayOutputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class GetChannels { - - static float[] testarray; - static byte[] test_byte_array; - static byte[] test_byte_array_8ext; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - static AudioFormat format24 = new AudioFormat(44100, 24, 1, true, false); - static ModelByteBuffer buffer; - static ModelByteBuffer buffer_wave; - static ModelByteBuffer buffer8; - static ModelByteBuffer buffer16_8; - static ModelByteBuffer buffer24; - - static void setUp() throws Exception { - testarray = new float[1024]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - testarray[i] = (float)Math.sin(10*ii*2*Math.PI); - testarray[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - testarray[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - testarray[i] *= 0.3; - } - test_byte_array = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); - buffer = new ModelByteBuffer(test_byte_array); - - byte[] test_byte_array2 = new byte[testarray.length*3]; - buffer24 = new ModelByteBuffer(test_byte_array2); - test_byte_array_8ext = new byte[testarray.length]; - byte[] test_byte_array_8_16 = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format24).toByteArray(testarray, test_byte_array2); - int ix = 0; - int x = 0; - for (int i = 0; i < test_byte_array_8ext.length; i++) { - test_byte_array_8ext[i] = test_byte_array2[ix++]; - test_byte_array_8_16[x++] = test_byte_array2[ix++]; - test_byte_array_8_16[x++] = test_byte_array2[ix++]; - } - buffer16_8 = new ModelByteBuffer(test_byte_array_8_16); - buffer8 = new ModelByteBuffer(test_byte_array_8ext); - - AudioInputStream ais = new AudioInputStream(buffer.getInputStream(), format, testarray.length); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - AudioSystem.write(ais, AudioFileFormat.Type.WAVE, baos); - buffer_wave = new ModelByteBuffer(baos.toByteArray()); - } - - public static void main(String[] args) throws Exception { - - setUp(); - - AudioFormat format1 = new AudioFormat(44100, 16, 1, true, false); - AudioFormat format2 = new AudioFormat(44100, 16, 2, true, false); - ModelByteBufferWavetable wavetable = new ModelByteBufferWavetable(buffer,format1,10f); - if(wavetable.getChannels() != 1) - throw new RuntimeException("wavetable.getChannels() not 1!"); - wavetable = new ModelByteBufferWavetable(buffer,format2,10f); - if(wavetable.getChannels() != 2) - throw new RuntimeException("wavetable.getChannels() not 2!"); - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBufferWavetable/GetLoopLength.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelByteBufferWavetable getLoopLength method */ - -import java.io.ByteArrayOutputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class GetLoopLength { - - static float[] testarray; - static byte[] test_byte_array; - static byte[] test_byte_array_8ext; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - static AudioFormat format24 = new AudioFormat(44100, 24, 1, true, false); - static ModelByteBuffer buffer; - static ModelByteBuffer buffer_wave; - static ModelByteBuffer buffer8; - static ModelByteBuffer buffer16_8; - static ModelByteBuffer buffer24; - - static void setUp() throws Exception { - testarray = new float[1024]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - testarray[i] = (float)Math.sin(10*ii*2*Math.PI); - testarray[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - testarray[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - testarray[i] *= 0.3; - } - test_byte_array = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); - buffer = new ModelByteBuffer(test_byte_array); - - byte[] test_byte_array2 = new byte[testarray.length*3]; - buffer24 = new ModelByteBuffer(test_byte_array2); - test_byte_array_8ext = new byte[testarray.length]; - byte[] test_byte_array_8_16 = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format24).toByteArray(testarray, test_byte_array2); - int ix = 0; - int x = 0; - for (int i = 0; i < test_byte_array_8ext.length; i++) { - test_byte_array_8ext[i] = test_byte_array2[ix++]; - test_byte_array_8_16[x++] = test_byte_array2[ix++]; - test_byte_array_8_16[x++] = test_byte_array2[ix++]; - } - buffer16_8 = new ModelByteBuffer(test_byte_array_8_16); - buffer8 = new ModelByteBuffer(test_byte_array_8ext); - - AudioInputStream ais = new AudioInputStream(buffer.getInputStream(), format, testarray.length); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - AudioSystem.write(ais, AudioFileFormat.Type.WAVE, baos); - buffer_wave = new ModelByteBuffer(baos.toByteArray()); - } - - public static void main(String[] args) throws Exception { - - setUp(); - - ModelByteBufferWavetable wavetable = new ModelByteBufferWavetable(buffer,format); - wavetable.setLoopLength(10f); - if(wavetable.getLoopLength() != 10f) - throw new RuntimeException("wavetable.getLoopLength() not 10!"); - wavetable.setLoopLength(20f); - if(wavetable.getLoopLength() != 20f) - throw new RuntimeException("wavetable.getLoopLength() not 20!"); - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBufferWavetable/GetLoopStart.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelByteBufferWavetable getLoopStart method */ - -import java.io.ByteArrayOutputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class GetLoopStart { - - static float[] testarray; - static byte[] test_byte_array; - static byte[] test_byte_array_8ext; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - static AudioFormat format24 = new AudioFormat(44100, 24, 1, true, false); - static ModelByteBuffer buffer; - static ModelByteBuffer buffer_wave; - static ModelByteBuffer buffer8; - static ModelByteBuffer buffer16_8; - static ModelByteBuffer buffer24; - - static void setUp() throws Exception { - testarray = new float[1024]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - testarray[i] = (float)Math.sin(10*ii*2*Math.PI); - testarray[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - testarray[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - testarray[i] *= 0.3; - } - test_byte_array = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); - buffer = new ModelByteBuffer(test_byte_array); - - byte[] test_byte_array2 = new byte[testarray.length*3]; - buffer24 = new ModelByteBuffer(test_byte_array2); - test_byte_array_8ext = new byte[testarray.length]; - byte[] test_byte_array_8_16 = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format24).toByteArray(testarray, test_byte_array2); - int ix = 0; - int x = 0; - for (int i = 0; i < test_byte_array_8ext.length; i++) { - test_byte_array_8ext[i] = test_byte_array2[ix++]; - test_byte_array_8_16[x++] = test_byte_array2[ix++]; - test_byte_array_8_16[x++] = test_byte_array2[ix++]; - } - buffer16_8 = new ModelByteBuffer(test_byte_array_8_16); - buffer8 = new ModelByteBuffer(test_byte_array_8ext); - - AudioInputStream ais = new AudioInputStream(buffer.getInputStream(), format, testarray.length); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - AudioSystem.write(ais, AudioFileFormat.Type.WAVE, baos); - buffer_wave = new ModelByteBuffer(baos.toByteArray()); - } - - public static void main(String[] args) throws Exception { - - setUp(); - - ModelByteBufferWavetable wavetable = new ModelByteBufferWavetable(buffer,format); - wavetable.setLoopStart(10f); - if(wavetable.getLoopStart() != 10f) - throw new RuntimeException("wavetable.getLoopStart() not 10!"); - wavetable.setLoopStart(20f); - if(wavetable.getLoopStart() != 20f) - throw new RuntimeException("wavetable.getLoopStart() not 20!"); - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBufferWavetable/GetPitchCorrection.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,97 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelByteBufferWavetable getPitchCorrect method */ - -import java.io.ByteArrayOutputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class GetPitchCorrection { - - static float[] testarray; - static byte[] test_byte_array; - static byte[] test_byte_array_8ext; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - static AudioFormat format24 = new AudioFormat(44100, 24, 1, true, false); - static ModelByteBuffer buffer; - static ModelByteBuffer buffer_wave; - static ModelByteBuffer buffer8; - static ModelByteBuffer buffer16_8; - static ModelByteBuffer buffer24; - - static void setUp() throws Exception { - testarray = new float[1024]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - testarray[i] = (float)Math.sin(10*ii*2*Math.PI); - testarray[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - testarray[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - testarray[i] *= 0.3; - } - test_byte_array = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); - buffer = new ModelByteBuffer(test_byte_array); - - byte[] test_byte_array2 = new byte[testarray.length*3]; - buffer24 = new ModelByteBuffer(test_byte_array2); - test_byte_array_8ext = new byte[testarray.length]; - byte[] test_byte_array_8_16 = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format24).toByteArray(testarray, test_byte_array2); - int ix = 0; - int x = 0; - for (int i = 0; i < test_byte_array_8ext.length; i++) { - test_byte_array_8ext[i] = test_byte_array2[ix++]; - test_byte_array_8_16[x++] = test_byte_array2[ix++]; - test_byte_array_8_16[x++] = test_byte_array2[ix++]; - } - buffer16_8 = new ModelByteBuffer(test_byte_array_8_16); - buffer8 = new ModelByteBuffer(test_byte_array_8ext); - - AudioInputStream ais = new AudioInputStream(buffer.getInputStream(), format, testarray.length); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - AudioSystem.write(ais, AudioFileFormat.Type.WAVE, baos); - buffer_wave = new ModelByteBuffer(baos.toByteArray()); - } - - public static void main(String[] args) throws Exception { - - setUp(); - - ModelByteBufferWavetable wavetable = new ModelByteBufferWavetable(buffer,format); - wavetable.setPitchcorrection(10f); - if(wavetable.getPitchcorrection() != 10f) - throw new RuntimeException("wavetable.getPitchcorrection() not 10!"); - wavetable.setPitchcorrection(20f); - if(wavetable.getPitchcorrection() != 20f) - throw new RuntimeException("wavetable.getPitchcorrection() not 20!"); - - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBufferWavetable/NewModelByteBufferWavetableModelByteBuffer.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelByteBufferWavetable(ModelByteBuffer) method */ - -import java.io.ByteArrayOutputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class NewModelByteBufferWavetableModelByteBuffer { - - static float[] testarray; - static byte[] test_byte_array; - static byte[] test_byte_array_8ext; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - static AudioFormat format24 = new AudioFormat(44100, 24, 1, true, false); - static ModelByteBuffer buffer; - static ModelByteBuffer buffer_wave; - static ModelByteBuffer buffer8; - static ModelByteBuffer buffer16_8; - static ModelByteBuffer buffer24; - - static void setUp() throws Exception { - testarray = new float[1024]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - testarray[i] = (float)Math.sin(10*ii*2*Math.PI); - testarray[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - testarray[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - testarray[i] *= 0.3; - } - test_byte_array = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); - buffer = new ModelByteBuffer(test_byte_array); - - byte[] test_byte_array2 = new byte[testarray.length*3]; - buffer24 = new ModelByteBuffer(test_byte_array2); - test_byte_array_8ext = new byte[testarray.length]; - byte[] test_byte_array_8_16 = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format24).toByteArray(testarray, test_byte_array2); - int ix = 0; - int x = 0; - for (int i = 0; i < test_byte_array_8ext.length; i++) { - test_byte_array_8ext[i] = test_byte_array2[ix++]; - test_byte_array_8_16[x++] = test_byte_array2[ix++]; - test_byte_array_8_16[x++] = test_byte_array2[ix++]; - } - buffer16_8 = new ModelByteBuffer(test_byte_array_8_16); - buffer8 = new ModelByteBuffer(test_byte_array_8ext); - - AudioInputStream ais = new AudioInputStream(buffer.getInputStream(), format, testarray.length); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - AudioSystem.write(ais, AudioFileFormat.Type.WAVE, baos); - buffer_wave = new ModelByteBuffer(baos.toByteArray()); - } - - public static void main(String[] args) throws Exception { - - setUp(); - - ModelByteBufferWavetable wavetable = new ModelByteBufferWavetable(buffer_wave); - if(wavetable.getBuffer() != buffer_wave) - throw new RuntimeException("wavetable.getBuffer() incorrect!"); - if(!wavetable.getFormat().matches(format)) - throw new RuntimeException("wavetable.getFormat() incorrect!"); - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBufferWavetable/NewModelByteBufferWavetableModelByteBufferAudioFormat.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelByteBufferWavetable(ModelByteBuffer, AudioFormat) method */ - -import java.io.ByteArrayOutputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class NewModelByteBufferWavetableModelByteBufferAudioFormat { - - static float[] testarray; - static byte[] test_byte_array; - static byte[] test_byte_array_8ext; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - static AudioFormat format24 = new AudioFormat(44100, 24, 1, true, false); - static ModelByteBuffer buffer; - static ModelByteBuffer buffer_wave; - static ModelByteBuffer buffer8; - static ModelByteBuffer buffer16_8; - static ModelByteBuffer buffer24; - - static void setUp() throws Exception { - testarray = new float[1024]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - testarray[i] = (float)Math.sin(10*ii*2*Math.PI); - testarray[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - testarray[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - testarray[i] *= 0.3; - } - test_byte_array = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); - buffer = new ModelByteBuffer(test_byte_array); - - byte[] test_byte_array2 = new byte[testarray.length*3]; - buffer24 = new ModelByteBuffer(test_byte_array2); - test_byte_array_8ext = new byte[testarray.length]; - byte[] test_byte_array_8_16 = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format24).toByteArray(testarray, test_byte_array2); - int ix = 0; - int x = 0; - for (int i = 0; i < test_byte_array_8ext.length; i++) { - test_byte_array_8ext[i] = test_byte_array2[ix++]; - test_byte_array_8_16[x++] = test_byte_array2[ix++]; - test_byte_array_8_16[x++] = test_byte_array2[ix++]; - } - buffer16_8 = new ModelByteBuffer(test_byte_array_8_16); - buffer8 = new ModelByteBuffer(test_byte_array_8ext); - - AudioInputStream ais = new AudioInputStream(buffer.getInputStream(), format, testarray.length); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - AudioSystem.write(ais, AudioFileFormat.Type.WAVE, baos); - buffer_wave = new ModelByteBuffer(baos.toByteArray()); - } - - public static void main(String[] args) throws Exception { - - setUp(); - - ModelByteBufferWavetable wavetable = new ModelByteBufferWavetable(buffer,format); - if(wavetable.getBuffer() != buffer) - throw new RuntimeException("wavetable.getBuffer() incorrect!"); - if(wavetable.getFormat() != format) - throw new RuntimeException("wavetable.getFormat() incorrect!"); - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBufferWavetable/NewModelByteBufferWavetableModelByteBufferAudioFormatFloat.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelByteBufferWavetable(ModelByteBuffer, AudioFormat) method */ - -import java.io.ByteArrayOutputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class NewModelByteBufferWavetableModelByteBufferAudioFormatFloat { - - static float[] testarray; - static byte[] test_byte_array; - static byte[] test_byte_array_8ext; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - static AudioFormat format24 = new AudioFormat(44100, 24, 1, true, false); - static ModelByteBuffer buffer; - static ModelByteBuffer buffer_wave; - static ModelByteBuffer buffer8; - static ModelByteBuffer buffer16_8; - static ModelByteBuffer buffer24; - - static void setUp() throws Exception { - testarray = new float[1024]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - testarray[i] = (float)Math.sin(10*ii*2*Math.PI); - testarray[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - testarray[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - testarray[i] *= 0.3; - } - test_byte_array = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); - buffer = new ModelByteBuffer(test_byte_array); - - byte[] test_byte_array2 = new byte[testarray.length*3]; - buffer24 = new ModelByteBuffer(test_byte_array2); - test_byte_array_8ext = new byte[testarray.length]; - byte[] test_byte_array_8_16 = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format24).toByteArray(testarray, test_byte_array2); - int ix = 0; - int x = 0; - for (int i = 0; i < test_byte_array_8ext.length; i++) { - test_byte_array_8ext[i] = test_byte_array2[ix++]; - test_byte_array_8_16[x++] = test_byte_array2[ix++]; - test_byte_array_8_16[x++] = test_byte_array2[ix++]; - } - buffer16_8 = new ModelByteBuffer(test_byte_array_8_16); - buffer8 = new ModelByteBuffer(test_byte_array_8ext); - - AudioInputStream ais = new AudioInputStream(buffer.getInputStream(), format, testarray.length); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - AudioSystem.write(ais, AudioFileFormat.Type.WAVE, baos); - buffer_wave = new ModelByteBuffer(baos.toByteArray()); - } - - public static void main(String[] args) throws Exception { - - setUp(); - - ModelByteBufferWavetable wavetable = new ModelByteBufferWavetable(buffer,format); - if(wavetable.getBuffer() != buffer) - throw new RuntimeException("wavetable.getBuffer() incorrect!"); - if(!wavetable.getFormat().matches(format)) - throw new RuntimeException("wavetable.getFormat() incorrect!"); - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBufferWavetable/NewModelByteBufferWavetableModelByteBufferFloat.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelByteBufferWavetable(ModelByteBuffer, AudioFormat, float) method */ - -import java.io.ByteArrayOutputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class NewModelByteBufferWavetableModelByteBufferFloat { - - static float[] testarray; - static byte[] test_byte_array; - static byte[] test_byte_array_8ext; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - static AudioFormat format24 = new AudioFormat(44100, 24, 1, true, false); - static ModelByteBuffer buffer; - static ModelByteBuffer buffer_wave; - static ModelByteBuffer buffer8; - static ModelByteBuffer buffer16_8; - static ModelByteBuffer buffer24; - - static void setUp() throws Exception { - testarray = new float[1024]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - testarray[i] = (float)Math.sin(10*ii*2*Math.PI); - testarray[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - testarray[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - testarray[i] *= 0.3; - } - test_byte_array = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); - buffer = new ModelByteBuffer(test_byte_array); - - byte[] test_byte_array2 = new byte[testarray.length*3]; - buffer24 = new ModelByteBuffer(test_byte_array2); - test_byte_array_8ext = new byte[testarray.length]; - byte[] test_byte_array_8_16 = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format24).toByteArray(testarray, test_byte_array2); - int ix = 0; - int x = 0; - for (int i = 0; i < test_byte_array_8ext.length; i++) { - test_byte_array_8ext[i] = test_byte_array2[ix++]; - test_byte_array_8_16[x++] = test_byte_array2[ix++]; - test_byte_array_8_16[x++] = test_byte_array2[ix++]; - } - buffer16_8 = new ModelByteBuffer(test_byte_array_8_16); - buffer8 = new ModelByteBuffer(test_byte_array_8ext); - - AudioInputStream ais = new AudioInputStream(buffer.getInputStream(), format, testarray.length); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - AudioSystem.write(ais, AudioFileFormat.Type.WAVE, baos); - buffer_wave = new ModelByteBuffer(baos.toByteArray()); - } - - public static void main(String[] args) throws Exception { - - setUp(); - - ModelByteBufferWavetable wavetable = new ModelByteBufferWavetable(buffer,format,10f); - if(wavetable.getBuffer() != buffer) - throw new RuntimeException("wavetable.getBuffer() incorrect!"); - if(!wavetable.getFormat().matches(format)) - throw new RuntimeException("wavetable.getFormat() incorrect!"); - if(wavetable.getPitchcorrection() != 10f) - throw new RuntimeException("wavetable.getPitchcorrection() not 10!"); - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBufferWavetable/Open.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelByteBufferWavetable open method */ - -import java.io.ByteArrayOutputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Open { - - static float[] testarray; - static byte[] test_byte_array; - static byte[] test_byte_array_8ext; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - static AudioFormat format24 = new AudioFormat(44100, 24, 1, true, false); - static ModelByteBuffer buffer; - static ModelByteBuffer buffer_wave; - static ModelByteBuffer buffer8; - static ModelByteBuffer buffer16_8; - static ModelByteBuffer buffer24; - - static void setUp() throws Exception { - testarray = new float[1024]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - testarray[i] = (float)Math.sin(10*ii*2*Math.PI); - testarray[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - testarray[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - testarray[i] *= 0.3; - } - test_byte_array = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); - buffer = new ModelByteBuffer(test_byte_array); - - byte[] test_byte_array2 = new byte[testarray.length*3]; - buffer24 = new ModelByteBuffer(test_byte_array2); - test_byte_array_8ext = new byte[testarray.length]; - byte[] test_byte_array_8_16 = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format24).toByteArray(testarray, test_byte_array2); - int ix = 0; - int x = 0; - for (int i = 0; i < test_byte_array_8ext.length; i++) { - test_byte_array_8ext[i] = test_byte_array2[ix++]; - test_byte_array_8_16[x++] = test_byte_array2[ix++]; - test_byte_array_8_16[x++] = test_byte_array2[ix++]; - } - buffer16_8 = new ModelByteBuffer(test_byte_array_8_16); - buffer8 = new ModelByteBuffer(test_byte_array_8ext); - - AudioInputStream ais = new AudioInputStream(buffer.getInputStream(), format, testarray.length); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - AudioSystem.write(ais, AudioFileFormat.Type.WAVE, baos); - buffer_wave = new ModelByteBuffer(baos.toByteArray()); - } - - public static void main(String[] args) throws Exception { - - setUp(); - - ModelByteBufferWavetable wavetable = new ModelByteBufferWavetable(buffer,format); - if(wavetable.open(44100) != null) - throw new RuntimeException("wavetable.open(44100) doesn't return null!"); - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBufferWavetable/Set8BitExtensionBuffer.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,119 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelByteBufferWavetable set8BitExtensionBuffer method */ - -import java.io.ByteArrayOutputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Set8BitExtensionBuffer { - - static float[] testarray; - static byte[] test_byte_array; - static byte[] test_byte_array_8ext; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - static AudioFormat format24 = new AudioFormat(44100, 24, 1, true, false); - static ModelByteBuffer buffer; - static ModelByteBuffer buffer_wave; - static ModelByteBuffer buffer8; - static ModelByteBuffer buffer16_8; - static ModelByteBuffer buffer24; - - static void setUp() throws Exception { - testarray = new float[1024]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - testarray[i] = (float)Math.sin(10*ii*2*Math.PI); - testarray[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - testarray[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - testarray[i] *= 0.3; - } - test_byte_array = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); - buffer = new ModelByteBuffer(test_byte_array); - - byte[] test_byte_array2 = new byte[testarray.length*3]; - buffer24 = new ModelByteBuffer(test_byte_array2); - test_byte_array_8ext = new byte[testarray.length]; - byte[] test_byte_array_8_16 = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format24).toByteArray(testarray, test_byte_array2); - int ix = 0; - int x = 0; - for (int i = 0; i < test_byte_array_8ext.length; i++) { - test_byte_array_8ext[i] = test_byte_array2[ix++]; - test_byte_array_8_16[x++] = test_byte_array2[ix++]; - test_byte_array_8_16[x++] = test_byte_array2[ix++]; - } - buffer16_8 = new ModelByteBuffer(test_byte_array_8_16); - buffer8 = new ModelByteBuffer(test_byte_array_8ext); - - AudioInputStream ais = new AudioInputStream(buffer.getInputStream(), format, testarray.length); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - AudioSystem.write(ais, AudioFileFormat.Type.WAVE, baos); - buffer_wave = new ModelByteBuffer(baos.toByteArray()); - } - - static float compare(float[] a, float[] b) - { - float ac_error = 0; - int counter = 0; - for (int i = 0; i < a.length; i++) { - ac_error += Math.abs(a[i] - b[i]); - counter++; - } - return ac_error / ((float)counter); - - } - - public static void main(String[] args) throws Exception { - - setUp(); - - ModelByteBufferWavetable wavetable = new ModelByteBufferWavetable(buffer16_8,format,10f); - float[] f1 = new float[testarray.length]; - float[] f2 = new float[testarray.length]; - wavetable.openStream().read(f1); - wavetable.set8BitExtensionBuffer(buffer8); - if(wavetable.get8BitExtensionBuffer() != buffer8) - throw new RuntimeException("wavetable.get8BitExtensionBuffer() incorrect!"); - wavetable.openStream().read(f2); - // f2 should have more accurity than f1, - // about 256 times more, or 8 bits - float spec1 = compare(f1, testarray); - float spec2 = compare(f2, testarray); - if((spec1/spec2) <= 200) - throw new RuntimeException("(spec1/spec2) <= 200!"); - - - } - - - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelByteBufferWavetable/SetLoopType.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelByteBufferWavetable SetLoopType method */ - -import java.io.ByteArrayOutputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class SetLoopType { - - static float[] testarray; - static byte[] test_byte_array; - static byte[] test_byte_array_8ext; - static AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - static AudioFormat format24 = new AudioFormat(44100, 24, 1, true, false); - static ModelByteBuffer buffer; - static ModelByteBuffer buffer_wave; - static ModelByteBuffer buffer8; - static ModelByteBuffer buffer16_8; - static ModelByteBuffer buffer24; - - static void setUp() throws Exception { - testarray = new float[1024]; - for (int i = 0; i < 1024; i++) { - double ii = i / 1024.0; - ii = ii * ii; - testarray[i] = (float)Math.sin(10*ii*2*Math.PI); - testarray[i] += (float)Math.sin(1.731 + 2*ii*2*Math.PI); - testarray[i] += (float)Math.sin(0.231 + 6.3*ii*2*Math.PI); - testarray[i] *= 0.3; - } - test_byte_array = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); - buffer = new ModelByteBuffer(test_byte_array); - - byte[] test_byte_array2 = new byte[testarray.length*3]; - buffer24 = new ModelByteBuffer(test_byte_array2); - test_byte_array_8ext = new byte[testarray.length]; - byte[] test_byte_array_8_16 = new byte[testarray.length*2]; - AudioFloatConverter.getConverter(format24).toByteArray(testarray, test_byte_array2); - int ix = 0; - int x = 0; - for (int i = 0; i < test_byte_array_8ext.length; i++) { - test_byte_array_8ext[i] = test_byte_array2[ix++]; - test_byte_array_8_16[x++] = test_byte_array2[ix++]; - test_byte_array_8_16[x++] = test_byte_array2[ix++]; - } - buffer16_8 = new ModelByteBuffer(test_byte_array_8_16); - buffer8 = new ModelByteBuffer(test_byte_array_8ext); - - AudioInputStream ais = new AudioInputStream(buffer.getInputStream(), format, testarray.length); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - AudioSystem.write(ais, AudioFileFormat.Type.WAVE, baos); - buffer_wave = new ModelByteBuffer(baos.toByteArray()); - } - - public static void main(String[] args) throws Exception { - - setUp(); - - ModelByteBufferWavetable wavetable = new ModelByteBufferWavetable(buffer,format); - wavetable.setLoopType(1); - if(wavetable.getLoopType() != 1) - throw new RuntimeException("wavetable.getLoopType() not 1!"); - wavetable.setLoopType(2); - if(wavetable.getLoopType() != 2) - throw new RuntimeException("wavetable.getLoopType() not 2!"); - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelDestination/NewModelDestination.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelDestination constructor */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class NewModelDestination { - - public static void main(String[] args) throws Exception { - ModelDestination dest = new ModelDestination(); - if(dest.getIdentifier() != ModelDestination.DESTINATION_NONE) - throw new RuntimeException("dest.getIdentifier() is not equals ModelDestination.DESTINATION_NONE!"); - if(!(dest.getTransform() instanceof ModelStandardTransform)) - throw new RuntimeException("dest.getTransform() is not instancoef ModelStandardTransform!"); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelDestination/NewModelDestinationModelIdentifier.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelDestination(ModelIdentifier) constructor */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class NewModelDestinationModelIdentifier { - - public static void main(String[] args) throws Exception { - ModelDestination dest = new ModelDestination(ModelDestination.DESTINATION_EG1_ATTACK); - if(dest.getIdentifier() != ModelDestination.DESTINATION_EG1_ATTACK) - throw new RuntimeException("dest.getIdentifier() is not equals ModelDestination.DESTINATION_EG1_ATTACK!"); - if(!(dest.getTransform() instanceof ModelStandardTransform)) - throw new RuntimeException("dest.getTransform() is not instancoef ModelStandardTransform!"); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelDestination/SetIdentifier.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelByteBufferWavetable setIdentifier(ModelIdentifier) method */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class SetIdentifier { - - public static void main(String[] args) throws Exception { - ModelDestination dest = new ModelDestination(); - dest.setIdentifier(ModelDestination.DESTINATION_EG1_ATTACK); - if(dest.getIdentifier() != ModelDestination.DESTINATION_EG1_ATTACK) - throw new RuntimeException("dest.getIdentifier() is not equals ModelDestination.DESTINATION_EG1_ATTACK!"); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelDestination/SetTransform.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelByteBufferWavetable setTransform(ModelTransform) method */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class SetTransform{ - - public static void main(String[] args) throws Exception { - ModelDestination dest = new ModelDestination(); - ModelStandardTransform newtransform = new ModelStandardTransform(); - dest.setTransform(newtransform); - if(dest.getTransform() != newtransform) - throw new RuntimeException("dest.getTransform() is incorrect!"); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelIdentifier/EqualsObject.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelIdentifier equals method */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class EqualsObject { - - public static void main(String[] args) throws Exception { - ModelIdentifier id = new ModelIdentifier("test","a",1); - ModelIdentifier id2 = new ModelIdentifier("test","a",1); - ModelIdentifier id3 = new ModelIdentifier("test","a",2); - ModelIdentifier id4 = new ModelIdentifier("test","b",1); - ModelIdentifier id5 = new ModelIdentifier("hello","a",1); - if(!id.equals(id2)) - throw new RuntimeException("Compare failed!"); - if(id.equals(id3)) - throw new RuntimeException("Compare failed!"); - if(id.equals(id4)) - throw new RuntimeException("Compare failed!"); - if(id.equals(id5)) - throw new RuntimeException("Compare failed!"); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelIdentifier/NewModelIdentifierString.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelIdentifier(String) constructor */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class NewModelIdentifierString { - - public static void main(String[] args) throws Exception { - ModelIdentifier id = new ModelIdentifier("test"); - if(!id.getObject().equals("test")) - throw new RuntimeException("id.getObject() doesn't return \"test\"!"); - if(id.getVariable() != null) - throw new RuntimeException("id.getVariable() doesn't return null!"); - if(id.getInstance() != 0) - throw new RuntimeException("id.getInstance() doesn't return 0!"); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelIdentifier/NewModelIdentifierStringInt.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelIdentifier(String, integer) constructor */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class NewModelIdentifierStringInt { - - public static void main(String[] args) throws Exception { - ModelIdentifier id = new ModelIdentifier("test",1); - if(!id.getObject().equals("test")) - throw new RuntimeException("id.getObject() doesn't return \"test\"!"); - if(id.getVariable() != null) - throw new RuntimeException("id.getVariable() doesn't return null!"); - if(id.getInstance() != 1) - throw new RuntimeException("id.getInstance() doesn't return 1!"); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelIdentifier/NewModelIdentifierStringString.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelIdentifier(String,String) constructor */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class NewModelIdentifierStringString { - - public static void main(String[] args) throws Exception { - ModelIdentifier id = new ModelIdentifier("test","a"); - if(!id.getObject().equals("test")) - throw new RuntimeException("id.getObject() doesn't return \"test\"!"); - if(!id.getVariable().equals("a")) - throw new RuntimeException("id.getVariable() doesn't return \"a\"!"); - if(id.getInstance() != 0) - throw new RuntimeException("id.getInstance() doesn't return 0!"); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelIdentifier/NewModelIdentifierStringStringInt.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelIdentifier(String,String,int) constructor */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class NewModelIdentifierStringStringInt { - - public static void main(String[] args) throws Exception { - ModelIdentifier id = new ModelIdentifier("test","a",1);; - if(!id.getObject().equals("test")) - throw new RuntimeException("id.getObject() doesn't return \"test\"!"); - if(!id.getVariable().equals("a")) - throw new RuntimeException("id.getVariable() doesn't return \"a\"!"); - if(id.getInstance() != 1) - throw new RuntimeException("id.getInstance() doesn't return 1!"); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelIdentifier/SetInstance.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelIdentifier setInstance method */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class SetInstance { - - public static void main(String[] args) throws Exception { - ModelIdentifier id = new ModelIdentifier("test","a",1); - id.setInstance(2); - if(id.getInstance() != 2) - throw new RuntimeException("id.getInstance() doesn't return 2!"); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelIdentifier/SetObject.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelIdentifier setObject method */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class SetObject { - - public static void main(String[] args) throws Exception { - ModelIdentifier id = new ModelIdentifier("test","a",1); - id.setObject("hello"); - if(!id.getObject().equals("hello")) - throw new RuntimeException("id.getObject() does't return \"hello\"!"); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelIdentifier/SetVariable.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelIdentifier setVariable method */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class SetVariable { - - public static void main(String[] args) throws Exception { - ModelIdentifier id = new ModelIdentifier("test","a",1); - id.setVariable("b"); - if(!id.getVariable().equals("b")) - throw new RuntimeException("id.getVariable() does't return \"b\"!"); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelPerformer/GetOscillators.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelPerformer getOscillators method */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class GetOscillators { - - public static void main(String[] args) throws Exception { - ModelPerformer performer = new ModelPerformer(); - if(performer.getOscillators() == null) - throw new RuntimeException("performer.getOscillators() returned null!"); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelPerformer/SetConnectionBlocks.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelPerformer setConnectionBlocks method */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class SetConnectionBlocks { - - public static void main(String[] args) throws Exception { - ModelPerformer performer = new ModelPerformer(); - List<ModelConnectionBlock> newlist = new ArrayList<ModelConnectionBlock>(); - performer.setConnectionBlocks(newlist); - if(performer.getConnectionBlocks() != newlist) - throw new RuntimeException("performer.getConnectionBlocks() returned incorrect data!"); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelPerformer/SetDefaultConnectionsEnabled.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelPerformer setDefaultConnectionsEnabled method */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class SetDefaultConnectionsEnabled { - - public static void main(String[] args) throws Exception { - ModelPerformer performer = new ModelPerformer(); - performer.setDefaultConnectionsEnabled(true); - if(performer.isDefaultConnectionsEnabled() != true) - throw new RuntimeException("performer.isAddDefaultConnectionsEnabled() didn't return true!"); - performer.setDefaultConnectionsEnabled(false); - if(performer.isDefaultConnectionsEnabled() != false) - throw new RuntimeException("performer.isAddDefaultConnectionsEnabled() didn't return false!"); - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelPerformer/SetExclusiveClass.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelPerformer setExclusiveClass method */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class SetExclusiveClass { - - public static void main(String[] args) throws Exception { - ModelPerformer performer = new ModelPerformer(); - performer.setExclusiveClass(10); - if(performer.getExclusiveClass() != 10) - throw new RuntimeException("performer.getExclusiveClass() didn't return 10!"); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelPerformer/SetKeyFrom.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelPerformer setKeyFrom method */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class SetKeyFrom { - - public static void main(String[] args) throws Exception { - ModelPerformer performer = new ModelPerformer(); - performer.setKeyFrom(10); - if(performer.getKeyFrom() != 10) - throw new RuntimeException("performer.getKeyFrom() didn't return 10!"); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelPerformer/SetKeyTo.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelPerformer setKeyTo method */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class SetKeyTo { - - public static void main(String[] args) throws Exception { - ModelPerformer performer = new ModelPerformer(); - performer.setKeyTo(10); - if(performer.getKeyTo() != 10) - throw new RuntimeException("performer.getKeyTo() didn't return 10!"); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelPerformer/SetName.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelPerformer setName method */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class SetName { - - public static void main(String[] args) throws Exception { - ModelPerformer performer = new ModelPerformer(); - performer.setName("hello"); - if(!performer.getName().equals("hello")) - throw new RuntimeException("performer.getName() didn't return \"hello\"!"); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelPerformer/SetSelfNonExclusive.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelPerformer setSelfNonExclusive method */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class SetSelfNonExclusive { - - public static void main(String[] args) throws Exception { - ModelPerformer performer = new ModelPerformer(); - performer.setSelfNonExclusive(true); - if(performer.isSelfNonExclusive() != true) - throw new RuntimeException("performer.isSelfNonExclusive() didn't return true!"); - performer.setSelfNonExclusive(false); - if(performer.isSelfNonExclusive() != false) - throw new RuntimeException("performer.isSelfNonExclusive() didn't return false!"); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelPerformer/SetVelFrom.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelPerformer setVelFrom method */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class SetVelFrom { - - public static void main(String[] args) throws Exception { - ModelPerformer performer = new ModelPerformer(); - performer.setVelFrom(10); - if(performer.getVelFrom() != 10) - throw new RuntimeException("performer.getVelFrom() didn't return 10!"); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelPerformer/SetVelTo.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelPerformer setVelTo method */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class SetVelTo { - - public static void main(String[] args) throws Exception { - ModelPerformer performer = new ModelPerformer(); - performer.setVelTo(10); - if(performer.getVelTo() != 10) - throw new RuntimeException("performer.getVelTo() didn't return 10!"); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelSource/NewModelSource.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelSource() constructor */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class NewModelSource { - - public static void main(String[] args) throws Exception { - ModelSource src = new ModelSource(); - if(src.getIdentifier() != ModelSource.SOURCE_NONE) - throw new RuntimeException("src.getIdentifier() doesn't return ModelSource.SOURCE_NONE!"); - if(!(src.getTransform() instanceof ModelStandardTransform)) - throw new RuntimeException("src.getTransform() doesn't return object which is instance of ModelStandardTransform!"); - - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelSource/NewModelSourceModelIdentifier.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelSource(ModelIdentifier) constructor */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class NewModelSourceModelIdentifier { - - public static void main(String[] args) throws Exception { - ModelSource src = new ModelSource(ModelSource.SOURCE_NOTEON_KEYNUMBER); - if(src.getIdentifier() != ModelSource.SOURCE_NOTEON_KEYNUMBER) - throw new RuntimeException("src.getIdentifier() doesn't return ModelSource.SOURCE_NOTEON_KEYNUMBER!"); - if(!(src.getTransform() instanceof ModelStandardTransform)) - throw new RuntimeException("src.getTransform() doesn't return object which is instance of ModelStandardTransform!"); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelSource/NewModelSourceModelIdentifierBoolean.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelSource(ModelIdentifier,boolean) constructor */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class NewModelSourceModelIdentifierBoolean { - - public static void main(String[] args) throws Exception { - ModelSource src = new ModelSource(ModelSource.SOURCE_NOTEON_KEYNUMBER,ModelStandardTransform.DIRECTION_MAX2MIN); - if(src.getIdentifier() != ModelSource.SOURCE_NOTEON_KEYNUMBER) - throw new RuntimeException("src.getIdentifier() doesn't return ModelSource.SOURCE_NOTEON_KEYNUMBER!"); - if(!(src.getTransform() instanceof ModelStandardTransform)) - throw new RuntimeException("src.getTransform() doesn't return object which is instance of ModelStandardTransform!"); - ModelStandardTransform trans = (ModelStandardTransform)src.getTransform(); - if(trans.getDirection() != ModelStandardTransform.DIRECTION_MAX2MIN) - throw new RuntimeException("trans.getDirection() doesn't return ModelStandardTransform.DIRECTION_MAX2MIN!"); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelSource/NewModelSourceModelIdentifierBooleanBoolean.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelSource(ModelIdentifier,boolean,boolean) constructor */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class NewModelSourceModelIdentifierBooleanBoolean { - - public static void main(String[] args) throws Exception { - ModelSource src = new ModelSource(ModelSource.SOURCE_NOTEON_KEYNUMBER,ModelStandardTransform.DIRECTION_MAX2MIN,ModelStandardTransform.POLARITY_BIPOLAR); - if(src.getIdentifier() != ModelSource.SOURCE_NOTEON_KEYNUMBER) - throw new RuntimeException("src.getIdentifier() doesn't return ModelSource.SOURCE_NOTEON_KEYNUMBER!"); - if(!(src.getTransform() instanceof ModelStandardTransform)) - throw new RuntimeException("src.getTransform() doesn't return object which is instance of ModelStandardTransform!"); - ModelStandardTransform trans = (ModelStandardTransform)src.getTransform(); - if(trans.getDirection() != ModelStandardTransform.DIRECTION_MAX2MIN) - throw new RuntimeException("trans.getDirection() doesn't return ModelStandardTransform.DIRECTION_MAX2MIN!"); - if(trans.getPolarity() != ModelStandardTransform.POLARITY_BIPOLAR) - throw new RuntimeException("trans.getPolarity() doesn't return ModelStandardTransform.POLARITY_BIPOLAR!"); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelSource/NewModelSourceModelIdentifierBooleanBooleanInt.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelSource(ModelIdentifier,boolean,boolean,int) constructor */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class NewModelSourceModelIdentifierBooleanBooleanInt { - - public static void main(String[] args) throws Exception { - ModelSource src = new ModelSource(ModelSource.SOURCE_NOTEON_KEYNUMBER, - ModelStandardTransform.DIRECTION_MAX2MIN, - ModelStandardTransform.POLARITY_BIPOLAR, - ModelStandardTransform.TRANSFORM_CONCAVE); - if(src.getIdentifier() != ModelSource.SOURCE_NOTEON_KEYNUMBER) - throw new RuntimeException("src.getIdentifier() doesn't return ModelSource.SOURCE_NOTEON_KEYNUMBER!"); - if(!(src.getTransform() instanceof ModelStandardTransform)) - throw new RuntimeException("src.getTransform() doesn't return object which is instance of ModelStandardTransform!"); - ModelStandardTransform trans = (ModelStandardTransform)src.getTransform(); - if(trans.getDirection() != ModelStandardTransform.DIRECTION_MAX2MIN) - throw new RuntimeException("trans.getDirection() doesn't return ModelStandardTransform.DIRECTION_MAX2MIN!"); - if(trans.getPolarity() != ModelStandardTransform.POLARITY_BIPOLAR) - throw new RuntimeException("trans.getPolarity() doesn't return ModelStandardTransform.POLARITY_BIPOLAR!"); - if(trans.getTransform() != ModelStandardTransform.TRANSFORM_CONCAVE) - throw new RuntimeException("trans.getTransform() doesn't return ModelStandardTransform.TRANSFORM_CONCAVE!"); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelSource/NewModelSourceModelIdentifierModelTransform.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelSource(ModelIdentifier,ModelTransform) constructor */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class NewModelSourceModelIdentifierModelTransform { - - public static void main(String[] args) throws Exception { - ModelStandardTransform trans = new ModelStandardTransform(); - ModelSource src = new ModelSource(ModelSource.SOURCE_NOTEON_KEYNUMBER, trans); - if(src.getIdentifier() != ModelSource.SOURCE_NOTEON_KEYNUMBER) - throw new RuntimeException("src.getIdentifier() doesn't return ModelSource.SOURCE_NOTEON_KEYNUMBER!"); - if(src.getTransform() != trans) - throw new RuntimeException("src.getTransform() doesn't return trans!"); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelSource/SetIdentifier.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelSource setIdentifier method */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class SetIdentifier { - - public static void main(String[] args) throws Exception { - ModelSource src = new ModelSource(); - src.setIdentifier(ModelSource.SOURCE_NOTEON_KEYNUMBER); - if(src.getIdentifier() != ModelSource.SOURCE_NOTEON_KEYNUMBER) - throw new RuntimeException("src.getIdentifier() doesn't return ModelSource.SOURCE_NOTEON_KEYNUMBER!"); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelSource/SetTransform.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelSource setTransform method */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class SetTransform { - - public static void main(String[] args) throws Exception { - ModelSource src = new ModelSource(); - ModelStandardTransform trans = new ModelStandardTransform(); - src.setTransform(trans); - if(src.getTransform() != trans) - throw new RuntimeException("src.getTransform() doesn't return trans!"); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelStandardTransform/NewModelStandardTransform.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelStandardTransform constructor */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class NewModelStandardTransform { - - public static void main(String[] args) throws Exception { - ModelStandardTransform transform = new ModelStandardTransform(); - if(transform.getDirection() != ModelStandardTransform.DIRECTION_MIN2MAX) - throw new RuntimeException("transform.getDirection() doesn't return ModelStandardTransform.DIRECTION_MIN2MAX!"); - if(transform.getPolarity() != ModelStandardTransform.POLARITY_UNIPOLAR) - throw new RuntimeException("transform.getPolarity() doesn't return ModelStandardTransform.POLARITY_UNIPOLAR!"); - if(transform.getTransform() != ModelStandardTransform.TRANSFORM_LINEAR) - throw new RuntimeException("transform.getTransform() doesn't return ModelStandardTransform.TRANSFORM_LINEAR!"); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelStandardTransform/NewModelStandardTransformBoolean.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelStandardTransform(boolean) constructor */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class NewModelStandardTransformBoolean { - - public static void main(String[] args) throws Exception { - ModelStandardTransform transform = new ModelStandardTransform(ModelStandardTransform.DIRECTION_MAX2MIN); - if(transform.getDirection() != ModelStandardTransform.DIRECTION_MAX2MIN) - throw new RuntimeException("transform.getDirection() doesn't return ModelStandardTransform.DIRECTION_MAX2MIN!"); - if(transform.getPolarity() != ModelStandardTransform.POLARITY_UNIPOLAR) - throw new RuntimeException("transform.getPolarity() doesn't return ModelStandardTransform.POLARITY_UNIPOLAR!"); - if(transform.getTransform() != ModelStandardTransform.TRANSFORM_LINEAR) - throw new RuntimeException("transform.getTransform() doesn't return ModelStandardTransform.TRANSFORM_LINEAR!"); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelStandardTransform/NewModelStandardTransformBooleanBoolean.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelStandardTransform(boolean,boolean) constructor */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class NewModelStandardTransformBooleanBoolean { - - public static void main(String[] args) throws Exception { - ModelStandardTransform transform = new ModelStandardTransform( - ModelStandardTransform.DIRECTION_MAX2MIN, - ModelStandardTransform.POLARITY_BIPOLAR); - if(transform.getDirection() != ModelStandardTransform.DIRECTION_MAX2MIN) - throw new RuntimeException("transform.getDirection() doesn't return ModelStandardTransform.DIRECTION_MAX2MIN!"); - if(transform.getPolarity() != ModelStandardTransform.POLARITY_BIPOLAR) - throw new RuntimeException("transform.getPolarity() doesn't return ModelStandardTransform.POLARITY_BIPOLAR!"); - if(transform.getTransform() != ModelStandardTransform.TRANSFORM_LINEAR) - throw new RuntimeException("transform.getTransform() doesn't return ModelStandardTransform.TRANSFORM_LINEAR!"); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelStandardTransform/NewModelStandardTransformBooleanBooleanInt.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelStandardTransform(boolean,boolean,int) constructor */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class NewModelStandardTransformBooleanBooleanInt { - - public static void main(String[] args) throws Exception { - ModelStandardTransform transform = new ModelStandardTransform( - ModelStandardTransform.DIRECTION_MAX2MIN, - ModelStandardTransform.POLARITY_BIPOLAR, - ModelStandardTransform.TRANSFORM_CONVEX); - if(transform.getDirection() != ModelStandardTransform.DIRECTION_MAX2MIN) - throw new RuntimeException("transform.getDirection() doesn't return ModelStandardTransform.DIRECTION_MAX2MIN!"); - if(transform.getPolarity() != ModelStandardTransform.POLARITY_BIPOLAR) - throw new RuntimeException("transform.getPolarity() doesn't return ModelStandardTransform.POLARITY_BIPOLAR!"); - if(transform.getTransform() != ModelStandardTransform.TRANSFORM_CONVEX) - throw new RuntimeException("transform.getTransform() doesn't return ModelStandardTransform.TRANSFORM_CONVEX!"); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelStandardTransform/SetDirection.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelStandardTransform setDirection method */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class SetDirection { - - public static void main(String[] args) throws Exception { - ModelStandardTransform transform = new ModelStandardTransform(); - transform.setDirection(ModelStandardTransform.DIRECTION_MAX2MIN); - if(transform.getDirection() != ModelStandardTransform.DIRECTION_MAX2MIN) - throw new RuntimeException("transform.getDirection() doesn't return ModelStandardTransform.DIRECTION_MAX2MIN!"); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelStandardTransform/SetPolarity.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelStandardTransform setPolarity method */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class SetPolarity { - - public static void main(String[] args) throws Exception { - ModelStandardTransform transform = new ModelStandardTransform(); - transform.setPolarity(ModelStandardTransform.POLARITY_BIPOLAR); - if(transform.getPolarity() != ModelStandardTransform.POLARITY_BIPOLAR) - throw new RuntimeException("transform.getPolarity() doesn't return ModelStandardTransform.POLARITY_BIPOLAR!"); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelStandardTransform/SetTransform.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelStandardTransform setTransform method */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class SetTransform { - - - private static boolean checkLinearity(ModelStandardTransform transform) - { - double lastx = 0; - for (int p = 0; p < 2; p++) - for (int d = 0; d < 2; d++) - for (double i = 0; i < 1.0; i+=0.001) { - if(p == 0) - transform.setPolarity(ModelStandardTransform.POLARITY_UNIPOLAR); - else - transform.setPolarity(ModelStandardTransform.POLARITY_BIPOLAR); - if(d == 0) - transform.setDirection(ModelStandardTransform.DIRECTION_MIN2MAX); - else - transform.setDirection(ModelStandardTransform.DIRECTION_MAX2MIN); - double x = transform.transform(i); - if(i == 0) - lastx = x; - else - { - if(lastx - x > 0.2) return false; - lastx = x; - } - } - return true; - } - - - public static void main(String[] args) throws Exception { - ModelStandardTransform transform = new ModelStandardTransform(); - transform.setTransform(ModelStandardTransform.TRANSFORM_CONVEX); - if(transform.getTransform() != ModelStandardTransform.TRANSFORM_CONVEX) - throw new RuntimeException("transform.getTransform() doesn't return ModelStandardTransform.TRANSFORM_CONVEX!"); - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelStandardTransform/TransformAbsolute.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelStandardTransform transform method */ - -import com.sun.media.sound.ModelStandardTransform; - -public class TransformAbsolute { - - private static boolean checkLinearity(ModelStandardTransform transform) - { - double lastx = 0; - for (int p = 0; p < 2; p++) - for (int d = 0; d < 2; d++) - for (double i = 0; i < 1.0; i+=0.001) { - if(p == 0) - transform.setPolarity(ModelStandardTransform.POLARITY_UNIPOLAR); - else - transform.setPolarity(ModelStandardTransform.POLARITY_BIPOLAR); - if(d == 0) - transform.setDirection(ModelStandardTransform.DIRECTION_MIN2MAX); - else - transform.setDirection(ModelStandardTransform.DIRECTION_MAX2MIN); - double x = transform.transform(i); - if(i == 0) - lastx = x; - else - { - if(lastx - x > 0.2) return false; - lastx = x; - } - } - return true; - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - - } - - public static void main(String[] args) throws Exception { - ModelStandardTransform transform = new ModelStandardTransform(); - transform.setTransform(ModelStandardTransform.TRANSFORM_ABSOLUTE); - assertTrue(Math.abs(transform.transform(0.2f) - 0.2f) < 0.0001f); - assertTrue(Math.abs(transform.transform(-0.8f) - 0.8f) < 0.0001f); - assertTrue(checkLinearity(transform)); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelStandardTransform/TransformConcave.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelStandardTransform transform method */ - -import com.sun.media.sound.ModelStandardTransform; - -public class TransformConcave { - - private static boolean checkLinearity(ModelStandardTransform transform) - { - double lastx = 0; - for (int p = 0; p < 2; p++) - for (int d = 0; d < 2; d++) - for (double i = 0; i < 1.0; i+=0.001) { - if(p == 0) - transform.setPolarity(ModelStandardTransform.POLARITY_UNIPOLAR); - else - transform.setPolarity(ModelStandardTransform.POLARITY_BIPOLAR); - if(d == 0) - transform.setDirection(ModelStandardTransform.DIRECTION_MIN2MAX); - else - transform.setDirection(ModelStandardTransform.DIRECTION_MAX2MIN); - double x = transform.transform(i); - if(i == 0) - lastx = x; - else - { - if(lastx - x > 0.2) return false; - lastx = x; - } - } - return true; - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - ModelStandardTransform transform = new ModelStandardTransform(); - transform.setTransform(ModelStandardTransform.TRANSFORM_CONCAVE); - assertTrue(checkLinearity(transform)); - - transform.setDirection(ModelStandardTransform.DIRECTION_MIN2MAX); - transform.setPolarity(ModelStandardTransform.POLARITY_UNIPOLAR); - assertTrue(Math.abs(transform.transform(0.0f) - 0.0f) < 0.0001f); - assertTrue(transform.transform(0.5f) < 0.5f); - assertTrue(Math.abs(transform.transform(1.0f) - 1.0f) < 0.0001f); - - transform.setDirection(ModelStandardTransform.DIRECTION_MAX2MIN); - transform.setPolarity(ModelStandardTransform.POLARITY_UNIPOLAR); - assertTrue(Math.abs(transform.transform(1.0f) - 0.0f) < 0.0001f); - assertTrue(transform.transform(0.5f) < 0.5f); - assertTrue(Math.abs(transform.transform(0.0f) - 1.0f) < 0.0001f); - - transform.setDirection(ModelStandardTransform.DIRECTION_MIN2MAX); - transform.setPolarity(ModelStandardTransform.POLARITY_BIPOLAR); - assertTrue(Math.abs(transform.transform(0.0f) + 1.0f) < 0.0001f); - assertTrue(transform.transform(0.25f) > -0.5f); - assertTrue(Math.abs(transform.transform(0.5f) - 0.0f) < 0.0001f); - assertTrue(transform.transform(0.75f) < 0.5f); - assertTrue(Math.abs(transform.transform(1.0f) - 1.0f) < 0.0001f); - - transform.setDirection(ModelStandardTransform.DIRECTION_MAX2MIN); - transform.setPolarity(ModelStandardTransform.POLARITY_BIPOLAR); - assertTrue(Math.abs(transform.transform(1.0f) + 1.0f) < 0.0001f); - assertTrue(transform.transform(0.75f) > -0.5f); - assertTrue(Math.abs(transform.transform(0.50f) - 0.0f) < 0.0001f); - assertTrue(transform.transform(0.25f) < 0.5f); - assertTrue(Math.abs(transform.transform(0.0f) - 1.0f) < 0.0001f); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelStandardTransform/TransformConvex.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelStandardTransform transform method */ - -import com.sun.media.sound.ModelStandardTransform; - -public class TransformConvex { - - private static boolean checkLinearity(ModelStandardTransform transform) - { - double lastx = 0; - for (int p = 0; p < 2; p++) - for (int d = 0; d < 2; d++) - for (double i = 0; i < 1.0; i+=0.001) { - if(p == 0) - transform.setPolarity(ModelStandardTransform.POLARITY_UNIPOLAR); - else - transform.setPolarity(ModelStandardTransform.POLARITY_BIPOLAR); - if(d == 0) - transform.setDirection(ModelStandardTransform.DIRECTION_MIN2MAX); - else - transform.setDirection(ModelStandardTransform.DIRECTION_MAX2MIN); - double x = transform.transform(i); - if(i == 0) - lastx = x; - else - { - if(lastx - x > 0.2) return false; - lastx = x; - } - } - return true; - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - ModelStandardTransform transform = new ModelStandardTransform(); - transform.setTransform(ModelStandardTransform.TRANSFORM_CONVEX); - assertTrue(checkLinearity(transform)); - - transform.setDirection(ModelStandardTransform.DIRECTION_MIN2MAX); - transform.setPolarity(ModelStandardTransform.POLARITY_UNIPOLAR); - assertTrue(Math.abs(transform.transform(0.0f) - 0.0f) < 0.0001f); - assertTrue(transform.transform(0.5f) > 0.5f); - assertTrue(Math.abs(transform.transform(1.0f) - 1.0f) < 0.0001f); - - transform.setDirection(ModelStandardTransform.DIRECTION_MAX2MIN); - transform.setPolarity(ModelStandardTransform.POLARITY_UNIPOLAR); - assertTrue(Math.abs(transform.transform(1.0f) - 0.0f) < 0.0001f); - assertTrue(transform.transform(0.5f) > 0.5f); - assertTrue(Math.abs(transform.transform(0.0f) - 1.0f) < 0.0001f); - - transform.setDirection(ModelStandardTransform.DIRECTION_MIN2MAX); - transform.setPolarity(ModelStandardTransform.POLARITY_BIPOLAR); - assertTrue(Math.abs(transform.transform(0.0f) + 1.0f) < 0.0001f); - assertTrue(transform.transform(0.25f) < -0.5f); - assertTrue(Math.abs(transform.transform(0.5f) - 0.0f) < 0.0001f); - assertTrue(transform.transform(0.75f) > 0.5f); - assertTrue(Math.abs(transform.transform(1.0f) - 1.0f) < 0.0001f); - - transform.setDirection(ModelStandardTransform.DIRECTION_MAX2MIN); - transform.setPolarity(ModelStandardTransform.POLARITY_BIPOLAR); - assertTrue(Math.abs(transform.transform(1.0f) + 1.0f) < 0.0001f); - assertTrue(transform.transform(0.75f) < -0.5f); - assertTrue(Math.abs(transform.transform(0.50f) - 0.0f) < 0.0001f); - assertTrue(transform.transform(0.25f) > 0.5f); - assertTrue(Math.abs(transform.transform(0.0f) - 1.0f) < 0.0001f); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelStandardTransform/TransformLinear.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelStandardTransform transform method */ - -import com.sun.media.sound.ModelStandardTransform; - -public class TransformLinear { - - private static boolean checkLinearity(ModelStandardTransform transform) - { - double lastx = 0; - for (int p = 0; p < 2; p++) - for (int d = 0; d < 2; d++) - for (double i = 0; i < 1.0; i+=0.001) { - if(p == 0) - transform.setPolarity(ModelStandardTransform.POLARITY_UNIPOLAR); - else - transform.setPolarity(ModelStandardTransform.POLARITY_BIPOLAR); - if(d == 0) - transform.setDirection(ModelStandardTransform.DIRECTION_MIN2MAX); - else - transform.setDirection(ModelStandardTransform.DIRECTION_MAX2MIN); - double x = transform.transform(i); - if(i == 0) - lastx = x; - else - { - if(lastx - x > 0.2) return false; - lastx = x; - } - } - return true; - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - ModelStandardTransform transform = new ModelStandardTransform(); - transform.setTransform(ModelStandardTransform.TRANSFORM_LINEAR); - assertTrue(checkLinearity(transform)); - - transform.setDirection(ModelStandardTransform.DIRECTION_MIN2MAX); - transform.setPolarity(ModelStandardTransform.POLARITY_UNIPOLAR); - assertTrue(Math.abs(transform.transform(0.2f) - 0.2f) < 0.0001f); - assertTrue(Math.abs(transform.transform(0.8f) - 0.8f) < 0.0001f); - - transform.setDirection(ModelStandardTransform.DIRECTION_MAX2MIN); - transform.setPolarity(ModelStandardTransform.POLARITY_UNIPOLAR); - assertTrue(Math.abs(transform.transform(0.2f) - 0.8f) < 0.0001f); - assertTrue(Math.abs(transform.transform(0.8f) - 0.2f) < 0.0001f); - - transform.setDirection(ModelStandardTransform.DIRECTION_MIN2MAX); - transform.setPolarity(ModelStandardTransform.POLARITY_BIPOLAR); - assertTrue(Math.abs(transform.transform(0.2f) - (-0.6f)) < 0.0001f); - assertTrue(Math.abs(transform.transform(0.8f) - (0.6f)) < 0.0001f); - - transform.setDirection(ModelStandardTransform.DIRECTION_MAX2MIN); - transform.setPolarity(ModelStandardTransform.POLARITY_BIPOLAR); - assertTrue(Math.abs(transform.transform(0.2f) - (0.6f)) < 0.0001f); - assertTrue(Math.abs(transform.transform(0.8f) - (-0.6f)) < 0.0001f); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/ModelStandardTransform/TransformSwitch.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test ModelStandardTransform transform method */ - -import com.sun.media.sound.ModelStandardTransform; - -public class TransformSwitch { - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - ModelStandardTransform transform = new ModelStandardTransform(); - transform.setTransform(ModelStandardTransform.TRANSFORM_SWITCH); - - transform.setDirection(ModelStandardTransform.DIRECTION_MIN2MAX); - transform.setPolarity(ModelStandardTransform.POLARITY_UNIPOLAR); - assertTrue(Math.abs(transform.transform(0.2f) - 0.0f) < 0.0001f); - assertTrue(Math.abs(transform.transform(0.8f) - 1.0f) < 0.0001f); - - transform.setDirection(ModelStandardTransform.DIRECTION_MAX2MIN); - transform.setPolarity(ModelStandardTransform.POLARITY_UNIPOLAR); - assertTrue(Math.abs(transform.transform(0.2f) - 1.0f) < 0.0001f); - assertTrue(Math.abs(transform.transform(0.8f) - 0.0f) < 0.0001f); - - transform.setDirection(ModelStandardTransform.DIRECTION_MIN2MAX); - transform.setPolarity(ModelStandardTransform.POLARITY_BIPOLAR); - assertTrue(Math.abs(transform.transform(0.2f) + 1.0f) < 0.0001f); - assertTrue(Math.abs(transform.transform(0.8f) - 1.0f) < 0.0001f); - - transform.setDirection(ModelStandardTransform.DIRECTION_MAX2MIN); - transform.setPolarity(ModelStandardTransform.POLARITY_BIPOLAR); - assertTrue(Math.abs(transform.transform(0.2f) - 1.0f) < 0.0001f); - assertTrue(Math.abs(transform.transform(0.8f) + 1.0f) < 0.0001f); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/RiffReaderWriter/Available.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test RiffReader available method */ - -import java.io.File; -import java.io.FileInputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Available { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - public static void main(String[] args) throws Exception { - RIFFWriter writer = null; - RIFFReader reader = null; - File tempfile = File.createTempFile("test",".riff"); - try - { - writer = new RIFFWriter(tempfile, "TEST"); - RIFFWriter chunk = writer.writeChunk("TSCH"); - chunk.writeByte(10); - writer.close(); - writer = null; - FileInputStream fis = new FileInputStream(tempfile); - reader = new RIFFReader(fis); - RIFFReader readchunk = reader.nextChunk(); - int avail = readchunk.available(); - readchunk.readByte(); - assertEquals(avail - 1,readchunk.available()); - fis.close(); - reader = null; - - - } - finally - { - if(writer != null) - writer.close(); - if(reader != null) - reader.close(); - - if(tempfile.exists()) - if(!tempfile.delete()) - tempfile.deleteOnExit(); - } - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/RiffReaderWriter/Close.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test RiffReader close method */ - -import java.io.File; -import java.io.FileInputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Close { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - public static void main(String[] args) throws Exception { - RIFFWriter writer = null; - RIFFReader reader = null; - File tempfile = File.createTempFile("test",".riff"); - try - { - writer = new RIFFWriter(tempfile, "TEST"); - writer.close(); - writer = null; - FileInputStream fis = new FileInputStream(tempfile); - reader = new RIFFReader(fis); - reader.close(); - reader = null; - - - } - finally - { - if(writer != null) - writer.close(); - if(reader != null) - reader.close(); - - if(tempfile.exists()) - if(!tempfile.delete()) - tempfile.deleteOnExit(); - } - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/RiffReaderWriter/GetFilePointer.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test RiffReader getFilePointer method */ - -import java.io.File; -import java.io.FileInputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class GetFilePointer { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - public static void main(String[] args) throws Exception { - RIFFWriter writer = null; - RIFFReader reader = null; - File tempfile = File.createTempFile("test",".riff"); - try - { - writer = new RIFFWriter(tempfile, "TEST"); - RIFFWriter chunk = writer.writeChunk("TSCH"); - chunk.writeByte(10); - writer.close(); - writer = null; - FileInputStream fis = new FileInputStream(tempfile); - reader = new RIFFReader(fis); - RIFFReader readchunk = reader.nextChunk(); - long p = readchunk.getFilePointer(); - readchunk.readByte(); - assertEquals(p+1,readchunk.getFilePointer()); - fis.close(); - reader = null; - - - } - finally - { - if(writer != null) - writer.close(); - if(reader != null) - reader.close(); - - if(tempfile.exists()) - if(!tempfile.delete()) - tempfile.deleteOnExit(); - } - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/RiffReaderWriter/GetSize.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test RiffReader getSize method */ - -import java.io.File; -import java.io.FileInputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class GetSize { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - public static void main(String[] args) throws Exception { - RIFFWriter writer = null; - RIFFReader reader = null; - File tempfile = File.createTempFile("test",".riff"); - try - { - writer = new RIFFWriter(tempfile, "TEST"); - RIFFWriter chunk = writer.writeChunk("TSCH"); - chunk.writeByte(10); - writer.close(); - writer = null; - FileInputStream fis = new FileInputStream(tempfile); - reader = new RIFFReader(fis); - RIFFReader readchunk = reader.nextChunk(); - assertEquals(readchunk.getSize(), (long)readchunk.available()); - readchunk.readByte(); - fis.close(); - reader = null; - - - } - finally - { - if(writer != null) - writer.close(); - if(reader != null) - reader.close(); - - if(tempfile.exists()) - if(!tempfile.delete()) - tempfile.deleteOnExit(); - } - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/RiffReaderWriter/HasNextChunk.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test RiffReader hasNextChunk method */ - -import java.io.File; -import java.io.FileInputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class HasNextChunk { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean a) throws Exception - { - if(!a) - throw new RuntimeException("assertEquals fails!"); - } - - public static void main(String[] args) throws Exception { - RIFFWriter writer = null; - RIFFReader reader = null; - File tempfile = File.createTempFile("test",".riff"); - try - { - writer = new RIFFWriter(tempfile, "TEST"); - RIFFWriter chunk = writer.writeChunk("TSCH"); - chunk.writeByte(10); - writer.close(); - writer = null; - FileInputStream fis = new FileInputStream(tempfile); - reader = new RIFFReader(fis); - assertTrue(reader.hasNextChunk()); - RIFFReader readchunk = reader.nextChunk(); - readchunk.readByte(); - readchunk.close(); - assertTrue(!reader.hasNextChunk()); - fis.close(); - reader = null; - - - } - finally - { - if(writer != null) - writer.close(); - if(reader != null) - reader.close(); - - if(tempfile.exists()) - if(!tempfile.delete()) - tempfile.deleteOnExit(); - } - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/RiffReaderWriter/Read.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test RiffReader read method */ - -import java.io.File; -import java.io.FileInputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Read { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - public static void main(String[] args) throws Exception { - RIFFWriter writer = null; - RIFFReader reader = null; - File tempfile = File.createTempFile("test",".riff"); - try - { - - writer = new RIFFWriter(tempfile, "TEST"); - RIFFWriter chunk = writer.writeChunk("TSCH"); - chunk.write((byte)33); - writer.close(); - writer = null; - FileInputStream fis = new FileInputStream(tempfile); - reader = new RIFFReader(fis); - assertEquals(reader.getFormat(), "RIFF"); - assertEquals(reader.getType(), "TEST"); - RIFFReader readchunk = reader.nextChunk(); - assertEquals(readchunk.getFormat(), "TSCH"); - assertEquals(readchunk.read(), 33); - fis.close(); - reader = null; - - } - finally - { - if(writer != null) - writer.close(); - if(reader != null) - reader.close(); - - if(tempfile.exists()) - if(!tempfile.delete()) - tempfile.deleteOnExit(); - } - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/RiffReaderWriter/ReadByte.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test RiffReader read(byte) method */ - -import java.io.File; -import java.io.FileInputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class ReadByte { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - public static void main(String[] args) throws Exception { - RIFFWriter writer = null; - RIFFReader reader = null; - File tempfile = File.createTempFile("test",".riff"); - try - { - - writer = new RIFFWriter(tempfile, "TEST"); - RIFFWriter chunk = writer.writeChunk("TSCH"); - chunk.writeByte((byte)33); - writer.close(); - writer = null; - FileInputStream fis = new FileInputStream(tempfile); - reader = new RIFFReader(fis); - assertEquals(reader.getFormat(), "RIFF"); - assertEquals(reader.getType(), "TEST"); - RIFFReader readchunk = reader.nextChunk(); - assertEquals(readchunk.getFormat(), "TSCH"); - assertEquals((int)reader.readByte(), 33); - fis.close(); - reader = null; - - } - finally - { - if(writer != null) - writer.close(); - if(reader != null) - reader.close(); - - if(tempfile.exists()) - if(!tempfile.delete()) - tempfile.deleteOnExit(); - } - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/RiffReaderWriter/ReadByteArrayIntInt.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test RiffReader read(byte[], int, int) method */ - -import java.io.File; -import java.io.FileInputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class ReadByteArrayIntInt { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - public static void main(String[] args) throws Exception { - RIFFWriter writer = null; - RIFFReader reader = null; - File tempfile = File.createTempFile("test",".riff"); - try - { - writer = new RIFFWriter(tempfile, "TEST"); - RIFFWriter chunk = writer.writeChunk("TSCH"); - chunk.write(new byte[] {1,2,3}); - writer.close(); - writer = null; - FileInputStream fis = new FileInputStream(tempfile); - reader = new RIFFReader(fis); - assertEquals(reader.getFormat(), "RIFF"); - assertEquals(reader.getType(), "TEST"); - RIFFReader readchunk = reader.nextChunk(); - assertEquals(readchunk.getFormat(), "TSCH"); - assertEquals(readchunk.read(), 1); - assertEquals(readchunk.read(), 2); - assertEquals(readchunk.read(), 3); - fis.close(); - reader = null; - - - } - finally - { - if(writer != null) - writer.close(); - if(reader != null) - reader.close(); - - if(tempfile.exists()) - if(!tempfile.delete()) - tempfile.deleteOnExit(); - } - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/RiffReaderWriter/ReadInt.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test RiffReader readInt method */ - -import java.io.File; -import java.io.FileInputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class ReadInt { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - public static void main(String[] args) throws Exception { - RIFFWriter writer = null; - RIFFReader reader = null; - File tempfile = File.createTempFile("test",".riff"); - try - { - writer = new RIFFWriter(tempfile, "TEST"); - RIFFWriter chunk = writer.writeChunk("TSCH"); - chunk.writeInt(133); - writer.close(); - writer = null; - FileInputStream fis = new FileInputStream(tempfile); - reader = new RIFFReader(fis); - assertEquals(reader.getFormat(), "RIFF"); - assertEquals(reader.getType(), "TEST"); - RIFFReader readchunk = reader.nextChunk(); - assertEquals(readchunk.getFormat(), "TSCH"); - assertEquals(reader.readInt(), 133); - fis.close(); - reader = null; - - - } - finally - { - if(writer != null) - writer.close(); - if(reader != null) - reader.close(); - - if(tempfile.exists()) - if(!tempfile.delete()) - tempfile.deleteOnExit(); - } - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/RiffReaderWriter/ReadLong.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test RiffReader readLong method */ - -import java.io.File; -import java.io.FileInputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class ReadLong { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - public static void main(String[] args) throws Exception { - RIFFWriter writer = null; - RIFFReader reader = null; - File tempfile = File.createTempFile("test",".riff"); - try - { - writer = new RIFFWriter(tempfile, "TEST"); - RIFFWriter chunk = writer.writeChunk("TSCH"); - chunk.writeLong(133L); - writer.close(); - writer = null; - FileInputStream fis = new FileInputStream(tempfile); - reader = new RIFFReader(fis); - assertEquals(reader.getFormat(), "RIFF"); - assertEquals(reader.getType(), "TEST"); - RIFFReader readchunk = reader.nextChunk(); - assertEquals(readchunk.getFormat(), "TSCH"); - assertEquals(reader.readLong(), 133L); - fis.close(); - reader = null; - - - } - finally - { - if(writer != null) - writer.close(); - if(reader != null) - reader.close(); - - if(tempfile.exists()) - if(!tempfile.delete()) - tempfile.deleteOnExit(); - } - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/RiffReaderWriter/ReadShort.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test RiffReader readShort method */ - -import java.io.File; -import java.io.FileInputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class ReadShort { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - public static void main(String[] args) throws Exception { - RIFFWriter writer = null; - RIFFReader reader = null; - File tempfile = File.createTempFile("test",".riff"); - try - { - writer = new RIFFWriter(tempfile, "TEST"); - RIFFWriter chunk = writer.writeChunk("TSCH"); - chunk.writeShort((short)133); - writer.close(); - writer = null; - FileInputStream fis = new FileInputStream(tempfile); - reader = new RIFFReader(fis); - assertEquals(reader.getFormat(), "RIFF"); - assertEquals(reader.getType(), "TEST"); - RIFFReader readchunk = reader.nextChunk(); - assertEquals(readchunk.getFormat(), "TSCH"); - assertEquals(reader.readShort(), (short)133); - fis.close(); - reader = null; - - - } - finally - { - if(writer != null) - writer.close(); - if(reader != null) - reader.close(); - - if(tempfile.exists()) - if(!tempfile.delete()) - tempfile.deleteOnExit(); - } - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/RiffReaderWriter/ReadString.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test RiffReader readString method */ - -import java.io.File; -import java.io.FileInputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class ReadString { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - public static void main(String[] args) throws Exception { - RIFFWriter writer = null; - RIFFReader reader = null; - File tempfile = File.createTempFile("test",".riff"); - try - { - writer = new RIFFWriter(tempfile, "TEST"); - RIFFWriter chunk = writer.writeChunk("TSCH"); - chunk.writeString("HELLO",5); - writer.close(); - writer = null; - FileInputStream fis = new FileInputStream(tempfile); - reader = new RIFFReader(fis); - assertEquals(reader.getFormat(), "RIFF"); - assertEquals(reader.getType(), "TEST"); - RIFFReader readchunk = reader.nextChunk(); - assertEquals(readchunk.getFormat(), "TSCH"); - assertEquals(reader.readString(5), "HELLO"); - fis.close(); - reader = null; - - - } - finally - { - if(writer != null) - writer.close(); - if(reader != null) - reader.close(); - - if(tempfile.exists()) - if(!tempfile.delete()) - tempfile.deleteOnExit(); - } - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/RiffReaderWriter/ReadUnsignedByte.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test RiffReader readUnsignedByte method */ - -import java.io.File; -import java.io.FileInputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class ReadUnsignedByte { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - public static void main(String[] args) throws Exception { - RIFFWriter writer = null; - RIFFReader reader = null; - File tempfile = File.createTempFile("test",".riff"); - try - { - writer = new RIFFWriter(tempfile, "TEST"); - RIFFWriter chunk = writer.writeChunk("TSCH"); - chunk.writeUnsignedByte(77); - writer.close(); - writer = null; - FileInputStream fis = new FileInputStream(tempfile); - reader = new RIFFReader(fis); - assertEquals(reader.getFormat(), "RIFF"); - assertEquals(reader.getType(), "TEST"); - RIFFReader readchunk = reader.nextChunk(); - assertEquals(readchunk.getFormat(), "TSCH"); - assertEquals(reader.readUnsignedByte(), 77); - fis.close(); - reader = null; - - - } - finally - { - if(writer != null) - writer.close(); - if(reader != null) - reader.close(); - - if(tempfile.exists()) - if(!tempfile.delete()) - tempfile.deleteOnExit(); - } - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/RiffReaderWriter/ReadUnsignedInt.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test RiffReader readUnsignedInt method */ - -import java.io.File; -import java.io.FileInputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class ReadUnsignedInt { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - public static void main(String[] args) throws Exception { - RIFFWriter writer = null; - RIFFReader reader = null; - File tempfile = File.createTempFile("test",".riff"); - try - { - writer = new RIFFWriter(tempfile, "TEST"); - RIFFWriter chunk = writer.writeChunk("TSCH"); - chunk.writeUnsignedInt(55377); - writer.close(); - writer = null; - FileInputStream fis = new FileInputStream(tempfile); - reader = new RIFFReader(fis); - assertEquals(reader.getFormat(), "RIFF"); - assertEquals(reader.getType(), "TEST"); - RIFFReader readchunk = reader.nextChunk(); - assertEquals(readchunk.getFormat(), "TSCH"); - assertEquals(reader.readUnsignedInt(), 55377L); - fis.close(); - reader = null; - - - } - finally - { - if(writer != null) - writer.close(); - if(reader != null) - reader.close(); - - if(tempfile.exists()) - if(!tempfile.delete()) - tempfile.deleteOnExit(); - } - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/RiffReaderWriter/ReadUnsignedShort.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test RiffReader readUnsignedShort method */ - -import java.io.File; -import java.io.FileInputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class ReadUnsignedShort { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - public static void main(String[] args) throws Exception { - RIFFWriter writer = null; - RIFFReader reader = null; - File tempfile = File.createTempFile("test",".riff"); - try - { - writer = new RIFFWriter(tempfile, "TEST"); - RIFFWriter chunk = writer.writeChunk("TSCH"); - chunk.writeUnsignedShort(377); - writer.close(); - writer = null; - FileInputStream fis = new FileInputStream(tempfile); - reader = new RIFFReader(fis); - assertEquals(reader.getFormat(), "RIFF"); - assertEquals(reader.getType(), "TEST"); - RIFFReader readchunk = reader.nextChunk(); - assertEquals(readchunk.getFormat(), "TSCH"); - assertEquals(reader.readUnsignedShort(), 377); - fis.close(); - reader = null; - - - } - finally - { - if(writer != null) - writer.close(); - if(reader != null) - reader.close(); - - if(tempfile.exists()) - if(!tempfile.delete()) - tempfile.deleteOnExit(); - } - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/RiffReaderWriter/Skip.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test RiffReader skip method */ - -import java.io.File; -import java.io.FileInputStream; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Skip { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - public static void main(String[] args) throws Exception { - RIFFWriter writer = null; - RIFFReader reader = null; - File tempfile = File.createTempFile("test",".riff"); - try - { - writer = new RIFFWriter(tempfile, "TEST"); - RIFFWriter chunk = writer.writeChunk("TSCH"); - chunk.write((byte)33); - chunk.write((byte)44); - writer.close(); - writer = null; - FileInputStream fis = new FileInputStream(tempfile); - reader = new RIFFReader(fis); - RIFFReader readchunk = reader.nextChunk(); - reader.skip(1); - assertEquals(readchunk.read(), 44); - fis.close(); - reader = null; - - - } - finally - { - if(writer != null) - writer.close(); - if(reader != null) - reader.close(); - - if(tempfile.exists()) - if(!tempfile.delete()) - tempfile.deleteOnExit(); - } - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/RiffReaderWriter/WriteOutputStream.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test RiffWriter(OutputStream) constructor */ - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.File; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class WriteOutputStream { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - public static void main(String[] args) throws Exception { - RIFFWriter writer = null; - RIFFReader reader = null; - File tempfile = File.createTempFile("test",".riff"); - try - { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - writer = new RIFFWriter(baos, "TEST"); - RIFFWriter chunk = writer.writeChunk("TSCH"); - chunk.write((byte)33); - writer.close(); - writer = null; - ByteArrayInputStream fis = new ByteArrayInputStream(baos.toByteArray()); - reader = new RIFFReader(fis); - assertEquals(reader.getFormat(), "RIFF"); - assertEquals(reader.getType(), "TEST"); - RIFFReader readchunk = reader.nextChunk(); - assertEquals(readchunk.getFormat(), "TSCH"); - assertEquals(readchunk.read(), 33); - fis.close(); - reader = null; - - - } - finally - { - if(writer != null) - writer.close(); - if(reader != null) - reader.close(); - - if(tempfile.exists()) - if(!tempfile.delete()) - tempfile.deleteOnExit(); - } - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SF2SoundbankReader/TestGetSoundbankFile.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SF2SoundbankReader getSoundbank(File) method */ - -import java.io.File; - -import javax.sound.midi.Patch; -import javax.sound.midi.Soundbank; - -import com.sun.media.sound.SF2SoundbankReader; - -public class TestGetSoundbankFile { - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - File file = new File(System.getProperty("test.src", "."), "ding.sf2"); - Soundbank sf2 = new SF2SoundbankReader().getSoundbank(file); - assertTrue(sf2.getInstruments().length == 1); - Patch patch = sf2.getInstruments()[0].getPatch(); - assertTrue(patch.getProgram() == 0); - assertTrue(patch.getBank() == 0); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SF2SoundbankReader/TestGetSoundbankInputStream.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SF2SoundbankReader getSoundbank(InputStream) method */ - -import java.io.BufferedInputStream; -import java.io.File; -import java.io.FileInputStream; - -import javax.sound.midi.Patch; -import javax.sound.midi.Soundbank; - -import com.sun.media.sound.SF2SoundbankReader; - -public class TestGetSoundbankInputStream { - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - File file = new File(System.getProperty("test.src", "."), "ding.sf2"); - FileInputStream fis = new FileInputStream(file); - BufferedInputStream bis = new BufferedInputStream(fis); - try - { - Soundbank sf2 = new SF2SoundbankReader().getSoundbank(bis); - assertTrue(sf2.getInstruments().length == 1); - Patch patch = sf2.getInstruments()[0].getPatch(); - assertTrue(patch.getProgram() == 0); - assertTrue(patch.getBank() == 0); - } - finally - { - bis.close(); - } - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SF2SoundbankReader/TestGetSoundbankInputStream2.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,119 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SF2SoundbankReader getSoundbank(InputStream) method using - very bad InputStream which can only read 1 byte at time */ - -import java.io.BufferedInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; - -import javax.sound.midi.Patch; -import javax.sound.midi.Soundbank; - -import com.sun.media.sound.SF2SoundbankReader; - -public class TestGetSoundbankInputStream2 { - - private static class BadInputStream extends InputStream - { - - InputStream is; - - public BadInputStream(InputStream is) - { - this.is = is; - } - - public int read() throws IOException { - return is.read(); - } - - public int read(byte[] b, int off, int len) throws IOException { - if(len > 1) len = 1; - return is.read(b, off, len); - } - - public int read(byte[] b) throws IOException { - return read(b, 0, b.length); - } - - public long skip(long n) throws IOException { - if(n > 1) n = 1; - return is.skip(n); - } - - public int available() throws IOException { - int avail = is.available(); - if(avail > 1) avail = 1; - return avail; - } - - public void close() throws IOException { - is.close(); - } - - public synchronized void mark(int readlimit) { - is.mark(readlimit); - } - - public boolean markSupported() { - return is.markSupported(); - } - - public synchronized void reset() throws IOException { - is.reset(); - } - - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - File file = new File(System.getProperty("test.src", "."), "ding.sf2"); - FileInputStream fis = new FileInputStream(file); - BufferedInputStream bis = new BufferedInputStream(fis); - try - { - InputStream badis = new BadInputStream(bis); - Soundbank sf2 = new SF2SoundbankReader().getSoundbank(badis); - assertTrue(sf2.getInstruments().length == 1); - Patch patch = sf2.getInstruments()[0].getPatch(); - assertTrue(patch.getProgram() == 0); - assertTrue(patch.getBank() == 0); - } - finally - { - bis.close(); - } - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SF2SoundbankReader/TestGetSoundbankUrl.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SF2SoundbankReader getSoundbank(File) method */ - -import java.io.File; -import java.net.URL; - -import javax.sound.midi.Patch; -import javax.sound.midi.Soundbank; - -import com.sun.media.sound.SF2SoundbankReader; - -public class TestGetSoundbankUrl { - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - File file = new File(System.getProperty("test.src", "."), "ding.sf2"); - URL url = file.toURI().toURL(); - Soundbank sf2 = new SF2SoundbankReader().getSoundbank(url); - assertTrue(sf2.getInstruments().length == 1); - Patch patch = sf2.getInstruments()[0].getPatch(); - assertTrue(patch.getProgram() == 0); - assertTrue(patch.getBank() == 0); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SimpleInstrument/AddModelInstrument.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SimpleInstrument add(ModelInstrument) method */ - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class AddModelInstrument { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - public static void main(String[] args) throws Exception { - - SimpleInstrument instrument = new SimpleInstrument(); - - ModelPerformer[] performers = new ModelPerformer[2]; - - performers[0] = new ModelPerformer(); - performers[0].setExclusiveClass(1); - performers[0].setKeyFrom(36); - performers[0].setKeyTo(48); - performers[0].setVelFrom(16); - performers[0].setVelTo(80); - performers[0].setSelfNonExclusive(true); - performers[0].setDefaultConnectionsEnabled(false); - performers[0].getConnectionBlocks().add(new ModelConnectionBlock()); - performers[0].getOscillators().add(new ModelByteBufferWavetable(new ModelByteBuffer(new byte[] {1,2,3}))); - - performers[1] = new ModelPerformer(); - performers[1].setExclusiveClass(0); - performers[1].setKeyFrom(12); - performers[1].setKeyTo(24); - performers[1].setVelFrom(20); - performers[1].setVelTo(90); - performers[1].setSelfNonExclusive(false); - performers[0].setDefaultConnectionsEnabled(true); - performers[1].getConnectionBlocks().add(new ModelConnectionBlock()); - performers[1].getOscillators().add(new ModelByteBufferWavetable(new ModelByteBuffer(new byte[] {1,2,3}))); - - SimpleInstrument subins = new SimpleInstrument(); - subins.add(performers[0]); - instrument.add(subins); - instrument.add(performers[1]); - ModelPerformer[] performers2 = instrument.getPerformers(); - for (int i = 0; i < performers2.length; i++) { - assertEquals(performers[i].getConnectionBlocks(), performers2[i].getConnectionBlocks()); - assertEquals(performers[i].getExclusiveClass(), performers2[i].getExclusiveClass()); - assertEquals(performers[i].getKeyFrom(), performers2[i].getKeyFrom()); - assertEquals(performers[i].getKeyTo(), performers2[i].getKeyTo()); - assertEquals(performers[i].getVelFrom(), performers2[i].getVelFrom()); - assertEquals(performers[i].getVelTo(), performers2[i].getVelTo()); - assertEquals(performers[i].getOscillators(), performers2[i].getOscillators()); - assertEquals(performers[i].isSelfNonExclusive(), performers2[i].isSelfNonExclusive()); - assertEquals(performers[i].isDefaultConnectionsEnabled(), performers2[i].isDefaultConnectionsEnabled()); - } - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SimpleInstrument/AddModelInstrumentIntInt.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SimpleInstrument add(ModelInstrument,int,int) method */ - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class AddModelInstrumentIntInt { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - public static void main(String[] args) throws Exception { - - SimpleInstrument instrument = new SimpleInstrument(); - - ModelPerformer[] performers = new ModelPerformer[2]; - - performers[0] = new ModelPerformer(); - performers[0].setExclusiveClass(1); - performers[0].setKeyFrom(36); - performers[0].setKeyTo(48); - performers[0].setVelFrom(16); - performers[0].setVelTo(80); - performers[0].setSelfNonExclusive(true); - performers[0].setDefaultConnectionsEnabled(false); - performers[0].getConnectionBlocks().add(new ModelConnectionBlock()); - performers[0].getOscillators().add(new ModelByteBufferWavetable(new ModelByteBuffer(new byte[] {1,2,3}))); - - performers[1] = new ModelPerformer(); - performers[1].setExclusiveClass(0); - performers[1].setKeyFrom(12); - performers[1].setKeyTo(24); - performers[1].setVelFrom(20); - performers[1].setVelTo(90); - performers[1].setSelfNonExclusive(false); - performers[0].setDefaultConnectionsEnabled(true); - performers[1].getConnectionBlocks().add(new ModelConnectionBlock()); - performers[1].getOscillators().add(new ModelByteBufferWavetable(new ModelByteBuffer(new byte[] {1,2,3}))); - - SimpleInstrument subins = new SimpleInstrument(); - subins.add(performers[0]); - instrument.add(subins, 18, 40); - ModelPerformer[] performers2 = instrument.getPerformers(); - for (int i = 0; i < performers2.length; i++) { - assertEquals(performers[i].getConnectionBlocks(), performers2[i].getConnectionBlocks()); - assertEquals(performers[i].getExclusiveClass(), performers2[i].getExclusiveClass()); - if(performers[i].getKeyFrom() < 18) - assertEquals(18, performers2[i].getKeyFrom()); - else - assertEquals(performers[i].getKeyFrom(), performers2[i].getKeyFrom()); - if(performers[i].getKeyTo() > 40) - assertEquals(40, performers2[i].getKeyTo()); - else - assertEquals(performers[i].getKeyTo(), performers2[i].getKeyTo()); - assertEquals(performers[i].getVelFrom(), performers2[i].getVelFrom()); - assertEquals(performers[i].getVelTo(), performers2[i].getVelTo()); - assertEquals(performers[i].getOscillators(), performers2[i].getOscillators()); - assertEquals(performers[i].isSelfNonExclusive(), performers2[i].isSelfNonExclusive()); - assertEquals(performers[i].isDefaultConnectionsEnabled(), performers2[i].isDefaultConnectionsEnabled()); - } - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SimpleInstrument/AddModelInstrumentIntIntIntInt.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,97 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SimpleInstrument add(ModelInstrument,int,int,int,int) method */ - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class AddModelInstrumentIntIntIntInt { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - public static void main(String[] args) throws Exception { - - SimpleInstrument instrument = new SimpleInstrument(); - - ModelPerformer[] performers = new ModelPerformer[2]; - - performers[0] = new ModelPerformer(); - performers[0].setExclusiveClass(1); - performers[0].setKeyFrom(36); - performers[0].setKeyTo(48); - performers[0].setVelFrom(16); - performers[0].setVelTo(80); - performers[0].setSelfNonExclusive(true); - performers[0].setDefaultConnectionsEnabled(false); - performers[0].getConnectionBlocks().add(new ModelConnectionBlock()); - performers[0].getOscillators().add(new ModelByteBufferWavetable(new ModelByteBuffer(new byte[] {1,2,3}))); - - performers[1] = new ModelPerformer(); - performers[1].setExclusiveClass(0); - performers[1].setKeyFrom(12); - performers[1].setKeyTo(24); - performers[1].setVelFrom(20); - performers[1].setVelTo(90); - performers[1].setSelfNonExclusive(false); - performers[0].setDefaultConnectionsEnabled(true); - performers[1].getConnectionBlocks().add(new ModelConnectionBlock()); - performers[1].getOscillators().add(new ModelByteBufferWavetable(new ModelByteBuffer(new byte[] {1,2,3}))); - - SimpleInstrument subins = new SimpleInstrument(); - subins.add(performers[0]); - instrument.add(subins,18,40,20,75); - ModelPerformer[] performers2 = instrument.getPerformers(); - for (int i = 0; i < performers2.length; i++) { - assertEquals(performers[i].getConnectionBlocks(), performers2[i].getConnectionBlocks()); - assertEquals(performers[i].getExclusiveClass(), performers2[i].getExclusiveClass()); - if(performers[i].getKeyFrom() < 18) - assertEquals(18, performers2[i].getKeyFrom()); - else - assertEquals(performers[i].getKeyFrom(), performers2[i].getKeyFrom()); - if(performers[i].getKeyTo() > 40) - assertEquals(40, performers2[i].getKeyTo()); - else - assertEquals(performers[i].getKeyTo(), performers2[i].getKeyTo()); - if(performers[i].getVelFrom() < 20) - assertEquals(20, performers2[i].getVelFrom()); - else - assertEquals(performers[i].getVelFrom(), performers2[i].getVelFrom()); - if(performers[i].getVelTo() > 75) - assertEquals(75, performers2[i].getVelTo()); - else - assertEquals(performers[i].getVelTo(), performers2[i].getVelTo()); - assertEquals(performers[i].getOscillators(), performers2[i].getOscillators()); - assertEquals(performers[i].isSelfNonExclusive(), performers2[i].isSelfNonExclusive()); - assertEquals(performers[i].isDefaultConnectionsEnabled(), performers2[i].isDefaultConnectionsEnabled()); - } - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SimpleInstrument/AddModelInstrumentIntIntIntIntInt.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,97 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SimpleInstrument add(ModelInstrument,int,int,int,int,int) method */ - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class AddModelInstrumentIntIntIntIntInt { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - public static void main(String[] args) throws Exception { - - SimpleInstrument instrument = new SimpleInstrument(); - - ModelPerformer[] performers = new ModelPerformer[2]; - - performers[0] = new ModelPerformer(); - performers[0].setExclusiveClass(1); - performers[0].setKeyFrom(36); - performers[0].setKeyTo(48); - performers[0].setVelFrom(16); - performers[0].setVelTo(80); - performers[0].setSelfNonExclusive(true); - performers[0].setDefaultConnectionsEnabled(false); - performers[0].getConnectionBlocks().add(new ModelConnectionBlock()); - performers[0].getOscillators().add(new ModelByteBufferWavetable(new ModelByteBuffer(new byte[] {1,2,3}))); - - performers[1] = new ModelPerformer(); - performers[1].setExclusiveClass(0); - performers[1].setKeyFrom(12); - performers[1].setKeyTo(24); - performers[1].setVelFrom(20); - performers[1].setVelTo(90); - performers[1].setSelfNonExclusive(false); - performers[0].setDefaultConnectionsEnabled(true); - performers[1].getConnectionBlocks().add(new ModelConnectionBlock()); - performers[1].getOscillators().add(new ModelByteBufferWavetable(new ModelByteBuffer(new byte[] {1,2,3}))); - - SimpleInstrument subins = new SimpleInstrument(); - subins.add(performers[0]); - instrument.add(subins,18,40,20,75,12); - ModelPerformer[] performers2 = instrument.getPerformers(); - for (int i = 0; i < performers2.length; i++) { - assertEquals(performers[i].getConnectionBlocks(), performers2[i].getConnectionBlocks()); - assertEquals(12, performers2[i].getExclusiveClass()); - if(performers[i].getKeyFrom() < 18) - assertEquals(18, performers2[i].getKeyFrom()); - else - assertEquals(performers[i].getKeyFrom(), performers2[i].getKeyFrom()); - if(performers[i].getKeyTo() > 40) - assertEquals(40, performers2[i].getKeyTo()); - else - assertEquals(performers[i].getKeyTo(), performers2[i].getKeyTo()); - if(performers[i].getVelFrom() < 20) - assertEquals(20, performers2[i].getVelFrom()); - else - assertEquals(performers[i].getVelFrom(), performers2[i].getVelFrom()); - if(performers[i].getVelTo() > 75) - assertEquals(75, performers2[i].getVelTo()); - else - assertEquals(performers[i].getVelTo(), performers2[i].getVelTo()); - assertEquals(performers[i].getOscillators(), performers2[i].getOscillators()); - assertEquals(performers[i].isSelfNonExclusive(), performers2[i].isSelfNonExclusive()); - assertEquals(performers[i].isDefaultConnectionsEnabled(), performers2[i].isDefaultConnectionsEnabled()); - } - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SimpleInstrument/AddModelPerformer.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SimpleInstrument add(ModelPerformer) method */ - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class AddModelPerformer { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - public static void main(String[] args) throws Exception { - - SimpleInstrument instrument = new SimpleInstrument(); - - ModelPerformer[] performers = new ModelPerformer[2]; - - performers[0] = new ModelPerformer(); - performers[0].setExclusiveClass(1); - performers[0].setKeyFrom(36); - performers[0].setKeyTo(48); - performers[0].setVelFrom(16); - performers[0].setVelTo(80); - performers[0].setSelfNonExclusive(true); - performers[0].setDefaultConnectionsEnabled(false); - performers[0].getConnectionBlocks().add(new ModelConnectionBlock()); - performers[0].getOscillators().add(new ModelByteBufferWavetable(new ModelByteBuffer(new byte[] {1,2,3}))); - - performers[1] = new ModelPerformer(); - performers[1].setExclusiveClass(0); - performers[1].setKeyFrom(12); - performers[1].setKeyTo(24); - performers[1].setVelFrom(20); - performers[1].setVelTo(90); - performers[1].setSelfNonExclusive(false); - performers[0].setDefaultConnectionsEnabled(true); - performers[1].getConnectionBlocks().add(new ModelConnectionBlock()); - performers[1].getOscillators().add(new ModelByteBufferWavetable(new ModelByteBuffer(new byte[] {1,2,3}))); - - instrument.add(performers[0]); - ModelPerformer[] performers2 = instrument.getPerformers(); - for (int i = 0; i < performers2.length; i++) { - assertEquals(performers[i].getConnectionBlocks(), performers2[i].getConnectionBlocks()); - assertEquals(performers[i].getExclusiveClass(), performers2[i].getExclusiveClass()); - assertEquals(performers[i].getKeyFrom(), performers2[i].getKeyFrom()); - assertEquals(performers[i].getKeyTo(), performers2[i].getKeyTo()); - assertEquals(performers[i].getVelFrom(), performers2[i].getVelFrom()); - assertEquals(performers[i].getVelTo(), performers2[i].getVelTo()); - assertEquals(performers[i].getOscillators(), performers2[i].getOscillators()); - assertEquals(performers[i].isSelfNonExclusive(), performers2[i].isSelfNonExclusive()); - assertEquals(performers[i].isDefaultConnectionsEnabled(), performers2[i].isDefaultConnectionsEnabled()); - } - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SimpleInstrument/AddModelPerformerArray.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SimpleInstrument add(ModelPerformer[]) method */ - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class AddModelPerformerArray { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - public static void main(String[] args) throws Exception { - - SimpleInstrument instrument = new SimpleInstrument(); - - ModelPerformer[] performers = new ModelPerformer[2]; - - performers[0] = new ModelPerformer(); - performers[0].setExclusiveClass(1); - performers[0].setKeyFrom(36); - performers[0].setKeyTo(48); - performers[0].setVelFrom(16); - performers[0].setVelTo(80); - performers[0].setSelfNonExclusive(true); - performers[0].setDefaultConnectionsEnabled(false); - performers[0].getConnectionBlocks().add(new ModelConnectionBlock()); - performers[0].getOscillators().add(new ModelByteBufferWavetable(new ModelByteBuffer(new byte[] {1,2,3}))); - - performers[1] = new ModelPerformer(); - performers[1].setExclusiveClass(0); - performers[1].setKeyFrom(12); - performers[1].setKeyTo(24); - performers[1].setVelFrom(20); - performers[1].setVelTo(90); - performers[1].setSelfNonExclusive(false); - performers[0].setDefaultConnectionsEnabled(true); - performers[1].getConnectionBlocks().add(new ModelConnectionBlock()); - performers[1].getOscillators().add(new ModelByteBufferWavetable(new ModelByteBuffer(new byte[] {1,2,3}))); - - instrument.add(performers); - ModelPerformer[] performers2 = instrument.getPerformers(); - for (int i = 0; i < performers2.length; i++) { - assertEquals(performers[i].getConnectionBlocks(), performers2[i].getConnectionBlocks()); - assertEquals(performers[i].getExclusiveClass(), performers2[i].getExclusiveClass()); - assertEquals(performers[i].getKeyFrom(), performers2[i].getKeyFrom()); - assertEquals(performers[i].getKeyTo(), performers2[i].getKeyTo()); - assertEquals(performers[i].getVelFrom(), performers2[i].getVelFrom()); - assertEquals(performers[i].getVelTo(), performers2[i].getVelTo()); - assertEquals(performers[i].getOscillators(), performers2[i].getOscillators()); - assertEquals(performers[i].isSelfNonExclusive(), performers2[i].isSelfNonExclusive()); - assertEquals(performers[i].isDefaultConnectionsEnabled(), performers2[i].isDefaultConnectionsEnabled()); - } - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SimpleInstrument/AddModelPerformerArrayIntInt.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SimpleInstrument add(ModelPerformer[],int,int) method */ - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class AddModelPerformerArrayIntInt { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - public static void main(String[] args) throws Exception { - - SimpleInstrument instrument = new SimpleInstrument(); - - ModelPerformer[] performers = new ModelPerformer[2]; - - performers[0] = new ModelPerformer(); - performers[0].setExclusiveClass(1); - performers[0].setKeyFrom(36); - performers[0].setKeyTo(48); - performers[0].setVelFrom(16); - performers[0].setVelTo(80); - performers[0].setSelfNonExclusive(true); - performers[0].setDefaultConnectionsEnabled(false); - performers[0].getConnectionBlocks().add(new ModelConnectionBlock()); - performers[0].getOscillators().add(new ModelByteBufferWavetable(new ModelByteBuffer(new byte[] {1,2,3}))); - - performers[1] = new ModelPerformer(); - performers[1].setExclusiveClass(0); - performers[1].setKeyFrom(12); - performers[1].setKeyTo(24); - performers[1].setVelFrom(20); - performers[1].setVelTo(90); - performers[1].setSelfNonExclusive(false); - performers[0].setDefaultConnectionsEnabled(true); - performers[1].getConnectionBlocks().add(new ModelConnectionBlock()); - performers[1].getOscillators().add(new ModelByteBufferWavetable(new ModelByteBuffer(new byte[] {1,2,3}))); - - instrument.add(performers,18,40); - ModelPerformer[] performers2 = instrument.getPerformers(); - for (int i = 0; i < performers2.length; i++) { - assertEquals(performers[i].getConnectionBlocks(), performers2[i].getConnectionBlocks()); - assertEquals(performers[i].getExclusiveClass(), performers2[i].getExclusiveClass()); - if(performers[i].getKeyFrom() < 18) - assertEquals(18, performers2[i].getKeyFrom()); - else - assertEquals(performers[i].getKeyFrom(), performers2[i].getKeyFrom()); - if(performers[i].getKeyTo() > 40) - assertEquals(40, performers2[i].getKeyTo()); - else - assertEquals(performers[i].getKeyTo(), performers2[i].getKeyTo()); - assertEquals(performers[i].getVelFrom(), performers2[i].getVelFrom()); - assertEquals(performers[i].getVelTo(), performers2[i].getVelTo()); - assertEquals(performers[i].getOscillators(), performers2[i].getOscillators()); - assertEquals(performers[i].isSelfNonExclusive(), performers2[i].isSelfNonExclusive()); - assertEquals(performers[i].isDefaultConnectionsEnabled(), performers2[i].isDefaultConnectionsEnabled()); - } - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SimpleInstrument/AddModelPerformerArrayIntIntIntInt.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SimpleInstrument add(ModelPerformer[],int,int,int,int) method */ - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class AddModelPerformerArrayIntIntIntInt { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - public static void main(String[] args) throws Exception { - - SimpleInstrument instrument = new SimpleInstrument(); - - ModelPerformer[] performers = new ModelPerformer[2]; - - performers[0] = new ModelPerformer(); - performers[0].setExclusiveClass(1); - performers[0].setKeyFrom(36); - performers[0].setKeyTo(48); - performers[0].setVelFrom(16); - performers[0].setVelTo(80); - performers[0].setSelfNonExclusive(true); - performers[0].setDefaultConnectionsEnabled(false); - performers[0].getConnectionBlocks().add(new ModelConnectionBlock()); - performers[0].getOscillators().add(new ModelByteBufferWavetable(new ModelByteBuffer(new byte[] {1,2,3}))); - - performers[1] = new ModelPerformer(); - performers[1].setExclusiveClass(0); - performers[1].setKeyFrom(12); - performers[1].setKeyTo(24); - performers[1].setVelFrom(20); - performers[1].setVelTo(90); - performers[1].setSelfNonExclusive(false); - performers[0].setDefaultConnectionsEnabled(true); - performers[1].getConnectionBlocks().add(new ModelConnectionBlock()); - performers[1].getOscillators().add(new ModelByteBufferWavetable(new ModelByteBuffer(new byte[] {1,2,3}))); - - instrument.add(performers,18,40,20,75); - ModelPerformer[] performers2 = instrument.getPerformers(); - for (int i = 0; i < performers2.length; i++) { - assertEquals(performers[i].getConnectionBlocks(), performers2[i].getConnectionBlocks()); - assertEquals(performers[i].getExclusiveClass(), performers2[i].getExclusiveClass()); - if(performers[i].getKeyFrom() < 18) - assertEquals(18, performers2[i].getKeyFrom()); - else - assertEquals(performers[i].getKeyFrom(), performers2[i].getKeyFrom()); - if(performers[i].getKeyTo() > 40) - assertEquals(40, performers2[i].getKeyTo()); - else - assertEquals(performers[i].getKeyTo(), performers2[i].getKeyTo()); - if(performers[i].getVelFrom() < 20) - assertEquals(20, performers2[i].getVelFrom()); - else - assertEquals(performers[i].getVelFrom(), performers2[i].getVelFrom()); - if(performers[i].getVelTo() > 75) - assertEquals(75, performers2[i].getVelTo()); - else - assertEquals(performers[i].getVelTo(), performers2[i].getVelTo()); - assertEquals(performers[i].getOscillators(), performers2[i].getOscillators()); - assertEquals(performers[i].isSelfNonExclusive(), performers2[i].isSelfNonExclusive()); - assertEquals(performers[i].isDefaultConnectionsEnabled(), performers2[i].isDefaultConnectionsEnabled()); - } - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SimpleInstrument/AddModelPerformerArrayIntIntIntIntInt.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SimpleInstrument add(ModelPerformer[],int,int,int,int,int) method */ - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class AddModelPerformerArrayIntIntIntIntInt { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - public static void main(String[] args) throws Exception { - - SimpleInstrument instrument = new SimpleInstrument(); - - ModelPerformer[] performers = new ModelPerformer[2]; - - performers[0] = new ModelPerformer(); - performers[0].setExclusiveClass(1); - performers[0].setKeyFrom(36); - performers[0].setKeyTo(48); - performers[0].setVelFrom(16); - performers[0].setVelTo(80); - performers[0].setSelfNonExclusive(true); - performers[0].setDefaultConnectionsEnabled(false); - performers[0].getConnectionBlocks().add(new ModelConnectionBlock()); - performers[0].getOscillators().add(new ModelByteBufferWavetable(new ModelByteBuffer(new byte[] {1,2,3}))); - - performers[1] = new ModelPerformer(); - performers[1].setExclusiveClass(0); - performers[1].setKeyFrom(12); - performers[1].setKeyTo(24); - performers[1].setVelFrom(20); - performers[1].setVelTo(90); - performers[1].setSelfNonExclusive(false); - performers[0].setDefaultConnectionsEnabled(true); - performers[1].getConnectionBlocks().add(new ModelConnectionBlock()); - performers[1].getOscillators().add(new ModelByteBufferWavetable(new ModelByteBuffer(new byte[] {1,2,3}))); - - instrument.add(performers,18,40,20,75,12); - ModelPerformer[] performers2 = instrument.getPerformers(); - for (int i = 0; i < performers2.length; i++) { - assertEquals(performers[i].getConnectionBlocks(), performers2[i].getConnectionBlocks()); - assertEquals(12, performers2[i].getExclusiveClass()); - if(performers[i].getKeyFrom() < 18) - assertEquals(18, performers2[i].getKeyFrom()); - else - assertEquals(performers[i].getKeyFrom(), performers2[i].getKeyFrom()); - if(performers[i].getKeyTo() > 40) - assertEquals(40, performers2[i].getKeyTo()); - else - assertEquals(performers[i].getKeyTo(), performers2[i].getKeyTo()); - if(performers[i].getVelFrom() < 20) - assertEquals(20, performers2[i].getVelFrom()); - else - assertEquals(performers[i].getVelFrom(), performers2[i].getVelFrom()); - if(performers[i].getVelTo() > 75) - assertEquals(75, performers2[i].getVelTo()); - else - assertEquals(performers[i].getVelTo(), performers2[i].getVelTo()); - assertEquals(performers[i].getOscillators(), performers2[i].getOscillators()); - assertEquals(performers[i].isSelfNonExclusive(), performers2[i].isSelfNonExclusive()); - assertEquals(performers[i].isDefaultConnectionsEnabled(), performers2[i].isDefaultConnectionsEnabled()); - } - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SimpleInstrument/AddModelPerformerIntInt.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SimpleInstrument add(ModelPerformer,int,int) method */ - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class AddModelPerformerIntInt { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - public static void main(String[] args) throws Exception { - - SimpleInstrument instrument = new SimpleInstrument(); - - ModelPerformer[] performers = new ModelPerformer[2]; - - performers[0] = new ModelPerformer(); - performers[0].setExclusiveClass(1); - performers[0].setKeyFrom(36); - performers[0].setKeyTo(48); - performers[0].setVelFrom(16); - performers[0].setVelTo(80); - performers[0].setSelfNonExclusive(true); - performers[0].setDefaultConnectionsEnabled(false); - performers[0].getConnectionBlocks().add(new ModelConnectionBlock()); - performers[0].getOscillators().add(new ModelByteBufferWavetable(new ModelByteBuffer(new byte[] {1,2,3}))); - - performers[1] = new ModelPerformer(); - performers[1].setExclusiveClass(0); - performers[1].setKeyFrom(12); - performers[1].setKeyTo(24); - performers[1].setVelFrom(20); - performers[1].setVelTo(90); - performers[1].setSelfNonExclusive(false); - performers[0].setDefaultConnectionsEnabled(true); - performers[1].getConnectionBlocks().add(new ModelConnectionBlock()); - performers[1].getOscillators().add(new ModelByteBufferWavetable(new ModelByteBuffer(new byte[] {1,2,3}))); - - instrument.add(performers[0],18,40); - ModelPerformer[] performers2 = instrument.getPerformers(); - for (int i = 0; i < performers2.length; i++) { - assertEquals(performers[i].getConnectionBlocks(), performers2[i].getConnectionBlocks()); - assertEquals(performers[i].getExclusiveClass(), performers2[i].getExclusiveClass()); - if(performers[i].getKeyFrom() < 18) - assertEquals(18, performers2[i].getKeyFrom()); - else - assertEquals(performers[i].getKeyFrom(), performers2[i].getKeyFrom()); - if(performers[i].getKeyTo() > 40) - assertEquals(40, performers2[i].getKeyTo()); - else - assertEquals(performers[i].getKeyTo(), performers2[i].getKeyTo()); - assertEquals(performers[i].getVelFrom(), performers2[i].getVelFrom()); - assertEquals(performers[i].getVelTo(), performers2[i].getVelTo()); - assertEquals(performers[i].getOscillators(), performers2[i].getOscillators()); - assertEquals(performers[i].isSelfNonExclusive(), performers2[i].isSelfNonExclusive()); - assertEquals(performers[i].isDefaultConnectionsEnabled(), performers2[i].isDefaultConnectionsEnabled()); - } - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SimpleInstrument/AddModelPerformerIntIntIntInt.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SimpleInstrument add(ModelPerformer,int,int,int,int) method */ - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class AddModelPerformerIntIntIntInt { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - public static void main(String[] args) throws Exception { - - SimpleInstrument instrument = new SimpleInstrument(); - - ModelPerformer[] performers = new ModelPerformer[2]; - - performers[0] = new ModelPerformer(); - performers[0].setExclusiveClass(1); - performers[0].setKeyFrom(36); - performers[0].setKeyTo(48); - performers[0].setVelFrom(16); - performers[0].setVelTo(80); - performers[0].setSelfNonExclusive(true); - performers[0].setDefaultConnectionsEnabled(false); - performers[0].getConnectionBlocks().add(new ModelConnectionBlock()); - performers[0].getOscillators().add(new ModelByteBufferWavetable(new ModelByteBuffer(new byte[] {1,2,3}))); - - performers[1] = new ModelPerformer(); - performers[1].setExclusiveClass(0); - performers[1].setKeyFrom(12); - performers[1].setKeyTo(24); - performers[1].setVelFrom(20); - performers[1].setVelTo(90); - performers[1].setSelfNonExclusive(false); - performers[0].setDefaultConnectionsEnabled(true); - performers[1].getConnectionBlocks().add(new ModelConnectionBlock()); - performers[1].getOscillators().add(new ModelByteBufferWavetable(new ModelByteBuffer(new byte[] {1,2,3}))); - - instrument.add(performers[0],18,40,20,75); - ModelPerformer[] performers2 = instrument.getPerformers(); - for (int i = 0; i < performers2.length; i++) { - assertEquals(performers[i].getConnectionBlocks(), performers2[i].getConnectionBlocks()); - assertEquals(performers[i].getExclusiveClass(), performers2[i].getExclusiveClass()); - if(performers[i].getKeyFrom() < 18) - assertEquals(18, performers2[i].getKeyFrom()); - else - assertEquals(performers[i].getKeyFrom(), performers2[i].getKeyFrom()); - if(performers[i].getKeyTo() > 40) - assertEquals(40, performers2[i].getKeyTo()); - else - assertEquals(performers[i].getKeyTo(), performers2[i].getKeyTo()); - if(performers[i].getVelFrom() < 20) - assertEquals(20, performers2[i].getVelFrom()); - else - assertEquals(performers[i].getVelFrom(), performers2[i].getVelFrom()); - if(performers[i].getVelTo() > 75) - assertEquals(75, performers2[i].getVelTo()); - else - assertEquals(performers[i].getVelTo(), performers2[i].getVelTo()); - assertEquals(performers[i].getOscillators(), performers2[i].getOscillators()); - assertEquals(performers[i].isSelfNonExclusive(), performers2[i].isSelfNonExclusive()); - assertEquals(performers[i].isDefaultConnectionsEnabled(), performers2[i].isDefaultConnectionsEnabled()); - } - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SimpleInstrument/AddModelPerformerIntIntIntIntInt.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SimpleInstrument add(ModelPerformer,int,int,int,int,int) method */ - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class AddModelPerformerIntIntIntIntInt { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - public static void main(String[] args) throws Exception { - - SimpleInstrument instrument = new SimpleInstrument(); - - ModelPerformer[] performers = new ModelPerformer[2]; - - performers[0] = new ModelPerformer(); - performers[0].setExclusiveClass(1); - performers[0].setKeyFrom(36); - performers[0].setKeyTo(48); - performers[0].setVelFrom(16); - performers[0].setVelTo(80); - performers[0].setSelfNonExclusive(true); - performers[0].setDefaultConnectionsEnabled(false); - performers[0].getConnectionBlocks().add(new ModelConnectionBlock()); - performers[0].getOscillators().add(new ModelByteBufferWavetable(new ModelByteBuffer(new byte[] {1,2,3}))); - - performers[1] = new ModelPerformer(); - performers[1].setExclusiveClass(0); - performers[1].setKeyFrom(12); - performers[1].setKeyTo(24); - performers[1].setVelFrom(20); - performers[1].setVelTo(90); - performers[1].setSelfNonExclusive(false); - performers[0].setDefaultConnectionsEnabled(true); - performers[1].getConnectionBlocks().add(new ModelConnectionBlock()); - performers[1].getOscillators().add(new ModelByteBufferWavetable(new ModelByteBuffer(new byte[] {1,2,3}))); - - instrument.add(performers[0],18,40,20,75,12); - ModelPerformer[] performers2 = instrument.getPerformers(); - for (int i = 0; i < performers2.length; i++) { - assertEquals(performers[i].getConnectionBlocks(), performers2[i].getConnectionBlocks()); - assertEquals(12, performers2[i].getExclusiveClass()); - if(performers[i].getKeyFrom() < 18) - assertEquals(18, performers2[i].getKeyFrom()); - else - assertEquals(performers[i].getKeyFrom(), performers2[i].getKeyFrom()); - if(performers[i].getKeyTo() > 40) - assertEquals(40, performers2[i].getKeyTo()); - else - assertEquals(performers[i].getKeyTo(), performers2[i].getKeyTo()); - if(performers[i].getVelFrom() < 20) - assertEquals(20, performers2[i].getVelFrom()); - else - assertEquals(performers[i].getVelFrom(), performers2[i].getVelFrom()); - if(performers[i].getVelTo() > 75) - assertEquals(75, performers2[i].getVelTo()); - else - assertEquals(performers[i].getVelTo(), performers2[i].getVelTo()); - assertEquals(performers[i].getOscillators(), performers2[i].getOscillators()); - assertEquals(performers[i].isSelfNonExclusive(), performers2[i].isSelfNonExclusive()); - assertEquals(performers[i].isDefaultConnectionsEnabled(), performers2[i].isDefaultConnectionsEnabled()); - } - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SimpleInstrument/Clear.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SimpleInstrument clear method */ - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Clear { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - public static void main(String[] args) throws Exception { - - SimpleInstrument instrument = new SimpleInstrument(); - - ModelPerformer[] performers = new ModelPerformer[2]; - - performers[0] = new ModelPerformer(); - performers[0].setExclusiveClass(1); - performers[0].setKeyFrom(36); - performers[0].setKeyTo(48); - performers[0].setVelFrom(16); - performers[0].setVelTo(80); - performers[0].setSelfNonExclusive(true); - performers[0].setDefaultConnectionsEnabled(false); - performers[0].getConnectionBlocks().add(new ModelConnectionBlock()); - performers[0].getOscillators().add(new ModelByteBufferWavetable(new ModelByteBuffer(new byte[] {1,2,3}))); - - performers[1] = new ModelPerformer(); - performers[1].setExclusiveClass(0); - performers[1].setKeyFrom(12); - performers[1].setKeyTo(24); - performers[1].setVelFrom(20); - performers[1].setVelTo(90); - performers[1].setSelfNonExclusive(false); - performers[0].setDefaultConnectionsEnabled(true); - performers[1].getConnectionBlocks().add(new ModelConnectionBlock()); - performers[1].getOscillators().add(new ModelByteBufferWavetable(new ModelByteBuffer(new byte[] {1,2,3}))); - - instrument.add(performers[0]); - instrument.clear(); - assertEquals(instrument.getPerformers().length, 0); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SimpleInstrument/SetName.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SimpleInstrument setName(String) method */ - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class SetName { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - public static void main(String[] args) throws Exception { - - SimpleInstrument instrument = new SimpleInstrument(); - - ModelPerformer[] performers = new ModelPerformer[2]; - - performers[0] = new ModelPerformer(); - performers[0].setExclusiveClass(1); - performers[0].setKeyFrom(36); - performers[0].setKeyTo(48); - performers[0].setVelFrom(16); - performers[0].setVelTo(80); - performers[0].setSelfNonExclusive(true); - performers[0].setDefaultConnectionsEnabled(false); - performers[0].getConnectionBlocks().add(new ModelConnectionBlock()); - performers[0].getOscillators().add(new ModelByteBufferWavetable(new ModelByteBuffer(new byte[] {1,2,3}))); - - performers[1] = new ModelPerformer(); - performers[1].setExclusiveClass(0); - performers[1].setKeyFrom(12); - performers[1].setKeyTo(24); - performers[1].setVelFrom(20); - performers[1].setVelTo(90); - performers[1].setSelfNonExclusive(false); - performers[0].setDefaultConnectionsEnabled(true); - performers[1].getConnectionBlocks().add(new ModelConnectionBlock()); - performers[1].getOscillators().add(new ModelByteBufferWavetable(new ModelByteBuffer(new byte[] {1,2,3}))); - - instrument.setName("hello"); - assertEquals(instrument.getName(), "hello"); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SimpleInstrument/SetPatch.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SimpleInstrument setPatch(Patch) method */ - -import javax.sound.midi.Patch; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class SetPatch { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - public static void main(String[] args) throws Exception { - - SimpleInstrument instrument = new SimpleInstrument(); - - ModelPerformer[] performers = new ModelPerformer[2]; - - performers[0] = new ModelPerformer(); - performers[0].setExclusiveClass(1); - performers[0].setKeyFrom(36); - performers[0].setKeyTo(48); - performers[0].setVelFrom(16); - performers[0].setVelTo(80); - performers[0].setSelfNonExclusive(true); - performers[0].setDefaultConnectionsEnabled(false); - performers[0].getConnectionBlocks().add(new ModelConnectionBlock()); - performers[0].getOscillators().add(new ModelByteBufferWavetable(new ModelByteBuffer(new byte[] {1,2,3}))); - - performers[1] = new ModelPerformer(); - performers[1].setExclusiveClass(0); - performers[1].setKeyFrom(12); - performers[1].setKeyTo(24); - performers[1].setVelFrom(20); - performers[1].setVelTo(90); - performers[1].setSelfNonExclusive(false); - performers[0].setDefaultConnectionsEnabled(true); - performers[1].getConnectionBlocks().add(new ModelConnectionBlock()); - performers[1].getOscillators().add(new ModelByteBufferWavetable(new ModelByteBuffer(new byte[] {1,2,3}))); - - Patch patch = new Patch(0,36); - instrument.setPatch(patch); - assertEquals(instrument.getPatch().getProgram(), patch.getProgram()); - assertEquals(instrument.getPatch().getBank(), patch.getBank()); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SimpleSoundbank/AddInstrument.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SimpleSoundbank addInstrument method */ - -import javax.sound.midi.Patch; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class AddInstrument { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - public static void main(String[] args) throws Exception { - SimpleSoundbank soundbank = new SimpleSoundbank(); - SimpleInstrument ins = new SimpleInstrument(); - ins.setPatch(new Patch(3,7)); - soundbank.addInstrument(ins); - assertEquals(soundbank.getInstruments().length, 1); - assertEquals(soundbank.getInstruments()[0], ins); - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SimpleSoundbank/AddResource.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SimpleSoundbank addResource method */ - -import javax.sound.midi.SoundbankResource; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class AddResource { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - public static void main(String[] args) throws Exception { - SimpleSoundbank soundbank = new SimpleSoundbank(); - SoundbankResource res = new SoundbankResource(soundbank, "test", null) { - public Object getData() { - return null; - }}; - soundbank.addResource(res); - assertEquals(soundbank.getResources().length, 1); - assertEquals(soundbank.getResources()[0], res); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SimpleSoundbank/GetInstrument.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SimpleSoundbank getInstrument method */ - -import javax.sound.midi.Patch; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class GetInstrument { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - public static void main(String[] args) throws Exception { - SimpleSoundbank soundbank = new SimpleSoundbank(); - SimpleInstrument ins = new SimpleInstrument(); - ins.setPatch(new Patch(3,7)); - soundbank.addInstrument(ins); - assertEquals(soundbank.getInstrument(new Patch(3,7)), ins); - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SimpleSoundbank/RemoveInstrument.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SimpleSoundbank removeInstrument method */ - -import javax.sound.midi.Patch; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class RemoveInstrument { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean a) throws Exception - { - if(!a) - throw new RuntimeException("assertEquals fails!"); - } - - public static void main(String[] args) throws Exception { - SimpleSoundbank soundbank = new SimpleSoundbank(); - SimpleInstrument ins = new SimpleInstrument(); - ins.setPatch(new Patch(3,7)); - soundbank.addInstrument(ins); - soundbank.removeInstrument(ins); - assertEquals(soundbank.getInstruments().length, 0); - assertTrue(soundbank.getInstrument(new Patch(3,7)) == null); - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SimpleSoundbank/SetDescription.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SimpleSoundbank setDescription method */ - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class SetDescription { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - public static void main(String[] args) throws Exception { - SimpleSoundbank soundbank = new SimpleSoundbank(); - soundbank.setDescription("hello"); - assertEquals(soundbank.getDescription(), "hello"); - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SimpleSoundbank/SetName.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SimpleSoundbank setName method */ - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class SetName { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - public static void main(String[] args) throws Exception { - SimpleSoundbank soundbank = new SimpleSoundbank(); - soundbank.setName("hello"); - assertEquals(soundbank.getName(), "hello"); - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SimpleSoundbank/SetVendor.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SimpleSoundbank setVendor method */ - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class SetVendor { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - public static void main(String[] args) throws Exception { - SimpleSoundbank soundbank = new SimpleSoundbank(); - soundbank.setVendor("hello"); - assertEquals(soundbank.getVendor(), "hello"); - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SimpleSoundbank/SetVersion.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SimpleSoundbank setVersion method */ - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class SetVersion { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - public static void main(String[] args) throws Exception { - SimpleSoundbank soundbank = new SimpleSoundbank(); - soundbank.setVersion("hello"); - assertEquals(soundbank.getVersion(), "hello"); - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftAudioBuffer/Array.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftAudioBuffer array method */ - -import javax.sound.midi.Patch; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Array { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - AudioFormat frm = new AudioFormat(8000, 8, 1, true, false); - SoftAudioBuffer buff = new SoftAudioBuffer(377, frm); - float[] ar = buff.array(); - assertEquals(ar.length, 377); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftAudioBuffer/Clear.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftAudioBuffer clear method */ - -import javax.sound.midi.Patch; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Clear { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - AudioFormat frm = new AudioFormat(8000, 8, 1, true, false); - SoftAudioBuffer buff = new SoftAudioBuffer(377, frm); - buff.array(); - assertTrue(!buff.isSilent()); - buff.clear(); - assertTrue(buff.isSilent()); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftAudioBuffer/Get.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftAudioBuffer get method */ - -import javax.sound.midi.Patch; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Get { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - AudioFormat frm = new AudioFormat(8000, 16, 1, true, false); - SoftAudioBuffer buff = new SoftAudioBuffer(100, frm); - float[] ar = buff.array(); - for (int i = 0; i < ar.length; i++) { - if(i % 2 == 0) - ar[i] = 1; - if(i % 2 == 0) - ar[i] = -0.5f; - } - - byte[] bbuff = new byte[ar.length*frm.getFrameSize()]; - buff.get(bbuff, 0); - float[] ar2 = new float[ar.length]; - AudioFloatConverter.getConverter(frm).toFloatArray(bbuff, ar2); - - for (int i = 0; i < ar2.length; i++) - if(Math.abs(ar[i] - ar2[i]) > 0.001) - throw new Exception("conversion failure!"); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftAudioBuffer/NewSoftAudioBuffer.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftAudioBuffer constructor */ - -import javax.sound.midi.Patch; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class NewSoftAudioBuffer { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - AudioFormat frm = new AudioFormat(8000, 8, 1, true, false); - SoftAudioBuffer buff = new SoftAudioBuffer(377, frm); - assertEquals(buff.getSize(), 377); - assertEquals(buff.getFormat(), frm); - assertTrue(buff.isSilent()); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftAudioSynthesizer/DummySourceDataLine.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,232 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -import java.util.ArrayList; - -import javax.sound.sampled.AudioFormat; -import javax.sound.sampled.AudioSystem; -import javax.sound.sampled.Control; -import javax.sound.sampled.DataLine; -import javax.sound.sampled.LineListener; -import javax.sound.sampled.LineUnavailableException; -import javax.sound.sampled.SourceDataLine; -import javax.sound.sampled.AudioFormat.Encoding; -import javax.sound.sampled.Control.Type; - -import com.sun.media.sound.AudioFloatConverter; - -/** - * This is a SourceDataLine simulator used for testing SoftSynthesizer - * without using real SourceDataLine / Audio Device. - * - * @author Karl Helgason - */ - -public class DummySourceDataLine implements SourceDataLine { - - private int bufferSize = -1; - - private AudioFormat format = new AudioFormat(44100.0f, 16, 2, true, false); - - private DataLine.Info sourceLineInfo; - - private boolean active = false; - - private long framepos = 0; - - private boolean opened = false; - - private int framesize = 0; - - public DummySourceDataLine() - { - ArrayList<AudioFormat> formats = new ArrayList<AudioFormat>(); - for (int channels = 1; channels <= 2; channels++) { - formats.add(new AudioFormat(Encoding.PCM_SIGNED, - AudioSystem.NOT_SPECIFIED, 8, channels, channels, - AudioSystem.NOT_SPECIFIED, false)); - formats.add(new AudioFormat(Encoding.PCM_UNSIGNED, - AudioSystem.NOT_SPECIFIED, 8, channels, channels, - AudioSystem.NOT_SPECIFIED, false)); - for (int bits = 16; bits < 32; bits += 8) { - formats.add(new AudioFormat(Encoding.PCM_SIGNED, - AudioSystem.NOT_SPECIFIED, bits, channels, channels - * bits / 8, AudioSystem.NOT_SPECIFIED, false)); - formats.add(new AudioFormat(Encoding.PCM_UNSIGNED, - AudioSystem.NOT_SPECIFIED, bits, channels, channels - * bits / 8, AudioSystem.NOT_SPECIFIED, false)); - formats.add(new AudioFormat(Encoding.PCM_SIGNED, - AudioSystem.NOT_SPECIFIED, bits, channels, channels - * bits / 8, AudioSystem.NOT_SPECIFIED, true)); - formats.add(new AudioFormat(Encoding.PCM_UNSIGNED, - AudioSystem.NOT_SPECIFIED, bits, channels, channels - * bits / 8, AudioSystem.NOT_SPECIFIED, true)); - } - formats.add(new AudioFormat(AudioFloatConverter.PCM_FLOAT, - AudioSystem.NOT_SPECIFIED, 32, channels, channels * 4, - AudioSystem.NOT_SPECIFIED, false)); - formats.add(new AudioFormat(AudioFloatConverter.PCM_FLOAT, - AudioSystem.NOT_SPECIFIED, 32, channels, channels * 4, - AudioSystem.NOT_SPECIFIED, true)); - formats.add(new AudioFormat(AudioFloatConverter.PCM_FLOAT, - AudioSystem.NOT_SPECIFIED, 64, channels, channels * 8, - AudioSystem.NOT_SPECIFIED, false)); - formats.add(new AudioFormat(AudioFloatConverter.PCM_FLOAT, - AudioSystem.NOT_SPECIFIED, 64, channels, channels * 8, - AudioSystem.NOT_SPECIFIED, true)); - } - AudioFormat[] formats_array = formats.toArray(new AudioFormat[formats - .size()]); - sourceLineInfo = new DataLine.Info(SourceDataLine.class, - formats_array, AudioSystem.NOT_SPECIFIED, - AudioSystem.NOT_SPECIFIED); - - } - - public void open() throws LineUnavailableException { - open(format); - } - - public void open(AudioFormat format) throws LineUnavailableException { - if (bufferSize == -1) - bufferSize = ((int) (format.getFrameRate() / 2)) - * format.getFrameSize(); - open(format, bufferSize); - } - - public void open(AudioFormat format, int bufferSize) - throws LineUnavailableException { - this.format = format; - this.bufferSize = bufferSize; - this.framesize = format.getFrameSize(); - opened = true; - } - - public boolean isOpen() { - return opened; - } - - public int write(byte[] b, int off, int len) { - if (!isOpen()) - return 0; - if (len % framesize != 0) - throw new IllegalArgumentException( - "Number of bytes does not represent an integral number of sample frames."); - - - int flen = len / framesize; - framepos += flen; - - long time = (long) (flen * (1000.0 / (double) getFormat() - .getSampleRate())); - try { - Thread.sleep(time); - } catch (InterruptedException e) { - e.printStackTrace(); - return 0; - } - - return len; - } - - public int available() { - return 0; - } - - public void drain() { - } - - public void flush() { - } - - public int getBufferSize() { - return bufferSize; - } - - public AudioFormat getFormat() { - return format; - } - - public int getFramePosition() { - return (int) getLongFramePosition(); - } - - public float getLevel() { - return AudioSystem.NOT_SPECIFIED; - } - - public long getLongFramePosition() { - return framepos; - } - - public long getMicrosecondPosition() { - return (long) (getLongFramePosition() * (1000000.0 / (double) getFormat() - .getSampleRate())); - } - - public boolean isActive() { - return active; - } - - public boolean isRunning() { - return active; - } - - public void start() { - active = true; - } - - public void stop() { - active = false; - } - - public void close() { - stop(); - } - - public Control getControl(Type control) { - throw new IllegalArgumentException("Unsupported control type : " - + control); - } - - public Control[] getControls() { - return new Control[0]; - } - - public javax.sound.sampled.Line.Info getLineInfo() { - return sourceLineInfo; - } - - public boolean isControlSupported(Type control) { - return false; - } - - public void addLineListener(LineListener listener) { - } - - public void removeLineListener(LineListener listener) { - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftAudioSynthesizer/GetFormat.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftAudioSynthesizer getFormat method */ - -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class GetFormat { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - AudioSynthesizer synth = new SoftSynthesizer(); - AudioFormat defformat = synth.getFormat(); - assertTrue(defformat != null); - synth.openStream(null, null); - assertTrue(synth.getFormat().toString().equals(defformat.toString())); - synth.close(); - AudioFormat custformat = new AudioFormat(8000, 16, 1, true, false); - synth.openStream(custformat, null); - assertTrue(synth.getFormat().toString().equals(custformat.toString())); - synth.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftAudioSynthesizer/GetPropertyInfo.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftAudioSynthesizer getPropertyInfo method */ - -import javax.sound.midi.Patch; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class GetPropertyInfo { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - AudioSynthesizer synth = new SoftSynthesizer(); - AudioSynthesizerPropertyInfo[] info = synth.getPropertyInfo(null); - assertTrue(info != null); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftAudioSynthesizer/Open.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftAudioSynthesizer open method */ - -import javax.sound.midi.Patch; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Open { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - AudioSynthesizer synth = new SoftSynthesizer(); - SourceDataLine line = new DummySourceDataLine(); //AudioSystem.getSourceDataLine(new AudioFormat(44100, 16, 2, true, false)); - synth.open(line, null); - synth.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftAudioSynthesizer/OpenStream.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftAudioSynthesizer openStream method */ - -import javax.sound.midi.Patch; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class OpenStream { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - AudioSynthesizer synth = new SoftSynthesizer(); - synth.openStream(null, null); - assertTrue(synth.isOpen()); - synth.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftChannel/AllNotesOff.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftChannel allNotesOff method */ - -import javax.sound.midi.*; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class AllNotesOff { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftTestUtils soft = new SoftTestUtils(); - MidiChannel channel = soft.synth.getChannels()[0]; - - channel.noteOn(60, 64); - soft.read(1); - VoiceStatus[] v = soft.synth.getVoiceStatus(); - assertEquals(v[0].note, 60); - assertEquals(v[0].active, true); - channel.allNotesOff(); - soft.read(1); - v = soft.synth.getVoiceStatus(); - assertEquals(v[0].active, false); - - soft.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftChannel/AllSoundOff.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftChannel allSoundOff method */ - -import javax.sound.midi.*; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class AllSoundOff { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftTestUtils soft = new SoftTestUtils(); - MidiChannel channel = soft.synth.getChannels()[0]; - - channel.noteOn(60, 64); - soft.read(1); - VoiceStatus[] v = soft.synth.getVoiceStatus(); - assertEquals(v[0].note, 60); - assertEquals(v[0].active, true); - channel.allSoundOff(); - soft.read(1); - v = soft.synth.getVoiceStatus(); - assertEquals(v[0].active, false); - - soft.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftChannel/ChannelPressure.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftChannel channelPressure method */ - -import javax.sound.midi.*; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class ChannelPressure { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftTestUtils soft = new SoftTestUtils(); - MidiChannel channel = soft.synth.getChannels()[0]; - - channel.setChannelPressure(10); - assertEquals(channel.getChannelPressure(), 10); - channel.setChannelPressure(90); - assertEquals(channel.getChannelPressure(), 90); - - soft.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftChannel/Controller.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftChannel controller method */ - -import javax.sound.midi.*; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Controller { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftTestUtils soft = new SoftTestUtils(); - MidiChannel channel = soft.synth.getChannels()[0]; - - for (int i = 0; i < 128; i++) { - if(i == 0 || i == 32) continue; - channel.controlChange(i, 10); - assertEquals(channel.getController(i), 10); - channel.controlChange(i, 100); - assertEquals(channel.getController(i), 100); - } - - soft.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftChannel/LocalControl.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftChannel localControl method */ - -import javax.sound.midi.*; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class LocalControl { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftTestUtils soft = new SoftTestUtils(); - MidiChannel channel = soft.synth.getChannels()[0]; - - // Local control not supported - // because this is a software synthesizer - // localControl() should always return false - assertEquals(channel.localControl(true), false); - assertEquals(channel.localControl(false), false); - - soft.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftChannel/Mono.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftChannel mono method */ - -import javax.sound.midi.*; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Mono { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftTestUtils soft = new SoftTestUtils(); - MidiChannel channel = soft.synth.getChannels()[0]; - - channel.setMono(true); - assertEquals(channel.getMono(), true); - channel.setMono(false); - assertEquals(channel.getMono(), false); - - soft.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftChannel/Mute.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftChannel mute method */ - -import javax.sound.midi.*; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Mute { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftTestUtils soft = new SoftTestUtils(); - MidiChannel channel = soft.synth.getChannels()[0]; - - channel.setMute(true); - assertEquals(channel.getMute(), true); - channel.setMute(false); - assertEquals(channel.getMute(), false); - - soft.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftChannel/NoteOff.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftChannel noteOff method */ - -import javax.sound.midi.*; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class NoteOff { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftTestUtils soft = new SoftTestUtils(); - MidiChannel channel = soft.synth.getChannels()[0]; - - channel.noteOn(60, 64); - soft.read(1); - VoiceStatus[] v = soft.synth.getVoiceStatus(); - assertEquals(v[0].note, 60); - assertEquals(v[0].active, true); - channel.noteOff(60); - soft.read(1); - v = soft.synth.getVoiceStatus();; - assertEquals(v[0].active, false); - - soft.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftChannel/NoteOff2.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftChannel noteOff method */ - -import javax.sound.midi.*; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class NoteOff2 { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftTestUtils soft = new SoftTestUtils(); - MidiChannel channel = soft.synth.getChannels()[0]; - - channel.noteOn(60, 64); - soft.read(1); - VoiceStatus[] v = soft.synth.getVoiceStatus(); - assertEquals(v[0].note, 60); - assertEquals(v[0].active, true); - channel.noteOff(60); - soft.read(1); - v = soft.synth.getVoiceStatus();; - assertEquals(v[0].active, false); - - soft.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftChannel/NoteOn.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftChannel noteOn method */ - -import javax.sound.midi.*; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class NoteOn { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftTestUtils soft = new SoftTestUtils(); - MidiChannel channel = soft.synth.getChannels()[0]; - - channel.noteOn(60, 64); - soft.read(1); - VoiceStatus[] v = soft.synth.getVoiceStatus(); - assertEquals(v[0].note, 60); - assertEquals(v[0].active, true); - channel.noteOn(60, 0); - soft.read(1); - v = soft.synth.getVoiceStatus(); - assertEquals(v[0].active, false); - - soft.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftChannel/Omni.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftChannel omni method */ - -import javax.sound.midi.*; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Omni { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftTestUtils soft = new SoftTestUtils(); - MidiChannel channel = soft.synth.getChannels()[0]; - - channel.setOmni(true); - // Poly or Omni not supported by GM2 - // getOmni() should always return false - assertEquals(channel.getOmni(), false); - channel.setOmni(false); - assertEquals(channel.getOmni(), false); - - soft.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftChannel/PitchBend.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftChannel pitchBend method */ - -import javax.sound.midi.*; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class PitchBend { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftTestUtils soft = new SoftTestUtils(); - MidiChannel channel = soft.synth.getChannels()[0]; - - channel.setPitchBend(10); - assertEquals(channel.getPitchBend(), 10); - channel.setPitchBend(9000); - assertEquals(channel.getPitchBend(), 9000); - - soft.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftChannel/PolyPressure.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftChannel polyPressure method */ - -import javax.sound.midi.*; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class PolyPressure { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftTestUtils soft = new SoftTestUtils(); - MidiChannel channel = soft.synth.getChannels()[0]; - - for (int i = 0; i < 128; i++) { - channel.setPolyPressure(i, 10); - assertEquals(channel.getPolyPressure(i),10); - channel.setPolyPressure(i, 100); - assertEquals(channel.getPolyPressure(i),100); - } - - soft.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftChannel/ProgramChange.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftChannel programChange method */ - -import javax.sound.midi.*; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class ProgramChange { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftTestUtils soft = new SoftTestUtils(); - MidiChannel channel = soft.synth.getChannels()[0]; - - channel.programChange(36); - assertEquals(channel.getProgram(), 36); - channel.programChange(48); - assertEquals(channel.getProgram(), 48); - - soft.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftChannel/ResetAllControllers.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,132 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftChannel resetAllControllers method */ - -import javax.sound.midi.*; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class ResetAllControllers { - - public static boolean[] dontResetControls = new boolean[128]; - static { - for (int i = 0; i < dontResetControls.length; i++) - dontResetControls[i] = false; - - dontResetControls[0] = true; // Bank Select (MSB) - dontResetControls[32] = true; // Bank Select (LSB) - dontResetControls[7] = true; // Channel Volume (MSB) - dontResetControls[8] = true; // Balance (MSB) - dontResetControls[10] = true; // Pan (MSB) - dontResetControls[11] = true; // Expression (MSB) - dontResetControls[91] = true; // Effects 1 Depth (default: Reverb Send) - dontResetControls[92] = true; // Effects 2 Depth (default: Tremolo Depth) - dontResetControls[93] = true; // Effects 3 Depth (default: Chorus Send) - dontResetControls[94] = true; // Effects 4 Depth (default: Celeste [Detune] Depth) - dontResetControls[95] = true; // Effects 5 Depth (default: Phaser Depth) - dontResetControls[70] = true; // Sound Controller 1 (default: Sound Variation) - dontResetControls[71] = true; // Sound Controller 2 (default: Timbre / Harmonic Quality) - dontResetControls[72] = true; // Sound Controller 3 (default: Release Time) - dontResetControls[73] = true; // Sound Controller 4 (default: Attack Time) - dontResetControls[74] = true; // Sound Controller 5 (default: Brightness) - dontResetControls[75] = true; // Sound Controller 6 (GM2 default: Decay Time) - dontResetControls[76] = true; // Sound Controller 7 (GM2 default: Vibrato Rate) - dontResetControls[77] = true; // Sound Controller 8 (GM2 default: Vibrato Depth) - dontResetControls[78] = true; // Sound Controller 9 (GM2 default: Vibrato Delay) - dontResetControls[79] = true; // Sound Controller 10 (GM2 default: Undefined) - dontResetControls[120] = true; // All Sound Off - dontResetControls[121] = true; // Reset All Controllers - dontResetControls[122] = true; // Local Control On/Off - dontResetControls[123] = true; // All Notes Off - dontResetControls[124] = true; // Omni Mode Off - dontResetControls[125] = true; // Omni Mode On - dontResetControls[126] = true; // Poly Mode Off - dontResetControls[127] = true; // Poly Mode On - - dontResetControls[6] = true; // Data Entry (MSB) - dontResetControls[38] = true; // Data Entry (LSB) - dontResetControls[96] = true; // Data Increment - dontResetControls[97] = true; // Data Decrement - dontResetControls[98] = true; // Non-Registered Parameter Number (LSB) - dontResetControls[99] = true; // Non-Registered Parameter Number(MSB) - dontResetControls[100] = true; // RPN = Null - dontResetControls[101] = true; // RPN = Null - } - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftTestUtils soft = new SoftTestUtils(); - MidiChannel channel = soft.synth.getChannels()[0]; - - // First let all controls contain non-default values - for (int i = 0; i < 128; i++) - channel.setPolyPressure(i, 10); - channel.setChannelPressure(10); - channel.setPitchBend(2192); - for (int i = 0; i < 120; i++) - channel.controlChange(i, 1); - channel.resetAllControllers(); - - // Now check if resetAllControllers did what it was suppose to do - - for (int i = 0; i < 128; i++) - assertEquals(channel.getPolyPressure(i), 0); - assertEquals(channel.getChannelPressure(), 0); - assertEquals(channel.getPitchBend(),8192); - for (int i = 0; i < 120; i++) - if(!dontResetControls[i]) - assertEquals(channel.getController(i), 0); - assertEquals(channel.getController(71), 64); // Filter Resonance - assertEquals(channel.getController(72), 64); // Release Time - assertEquals(channel.getController(73), 64); // Attack Time - assertEquals(channel.getController(74), 64); // Brightness - assertEquals(channel.getController(75), 64); // Decay Time - assertEquals(channel.getController(76), 64); // Vibrato Rate - assertEquals(channel.getController(77), 64); // Vibrato Depth - assertEquals(channel.getController(78), 64); // Vibrato Delay - assertEquals(channel.getController(8), 64); // Balance - assertEquals(channel.getController(11), 127); // Expression - assertEquals(channel.getController(98), 127); // NRPN Null - assertEquals(channel.getController(99), 127); // NRPN Null - assertEquals(channel.getController(100), 127); // RPN = Null - assertEquals(channel.getController(101), 127); // RPN = Null - - soft.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftChannel/SoftTestUtils.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,111 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -import java.io.IOException; - -import javax.sound.midi.*; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class SoftTestUtils { - - public AudioSynthesizer synth = new SoftSynthesizer(); - public AudioInputStream stream; - public byte[] tmpbuffer = new byte[1024]; - - public static SF2Soundbank createTestSoundBank() - { - SF2Soundbank sf2 = new SF2Soundbank(); - AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - float[] data = new float[44100+1000]; - float fr = 440/format.getSampleRate(); - for (int i = 0; i < data.length; i++) - data[i] = (float)Math.sin(i*fr*2*Math.PI); - byte[] bdata = new byte[data.length*format.getFrameSize()]; - AudioFloatConverter.getConverter(format).toByteArray(data, bdata); - SF2Sample sample = new SF2Sample(sf2); - sample.setName("Test Sample"); - sample.setData(bdata); - sample.setStartLoop(500); - sample.setEndLoop(data.length - 500); - sample.setSampleRate((long) format.getSampleRate()); - sample.setOriginalPitch(69); - sf2.addResource(sample); - SF2Layer layer = new SF2Layer(sf2); - layer.setName("Test Layer"); - sf2.addResource(layer); - SF2LayerRegion region = new SF2LayerRegion(); - region.putInteger(SF2Region.GENERATOR_SAMPLEMODES, 1); - region.setSample(sample); - layer.getRegions().add(region); - SF2Instrument ins = new SF2Instrument(sf2); - ins.setName("Test Instrument"); - sf2.addInstrument(ins); - SF2InstrumentRegion insregion = new SF2InstrumentRegion(); - insregion.setLayer(layer); - ins.getRegions().add(insregion); - - return sf2; - } - - public SoftTestUtils() throws Exception { - stream = synth.openStream(null, null); - synth.unloadAllInstruments(synth.getDefaultSoundbank()); - synth.loadAllInstruments(createTestSoundBank()); - } - - public void close() throws Exception { - stream.close(); - stream = null; - synth.close(); - synth = null; - } - - public void read(double seconds) throws IOException - { - int bufflen = - stream.getFormat().getFrameSize() * - (int)(stream.getFormat().getFrameRate() * seconds); - while(bufflen != 0) - { - if(bufflen > 1024) - bufflen -= stream.read(tmpbuffer,0,1024); - else - bufflen -= stream.read(tmpbuffer,0, bufflen); - } - } - - public VoiceStatus findVoice(int channel, int note) { - VoiceStatus[] v = synth.getVoiceStatus(); - for (int k = 0; k < v.length; k++) - if(v[k].active) - if(v[k].channel == channel) - if(v[k].note == note) - return v[k]; - return null; - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftChannel/Solo.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftChannel solo method */ - -import javax.sound.midi.*; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Solo { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftTestUtils soft = new SoftTestUtils(); - MidiChannel channel = soft.synth.getChannels()[0]; - - channel.setSolo(true); - assertEquals(channel.getSolo(), true); - channel.setSolo(false); - assertEquals(channel.getSolo(), false); - - soft.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftCubicResampler/Interpolate.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,113 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftCubicResampler interpolate method */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Interpolate { - - private static float getResamplerTestValue(double i) - { - return (float)Math.sin(i / 10.0); - } - - private static void perfectInterpolation(float[] in_offset, float in_end, - float[] startpitch, float pitchstep, float[] out, int[] out_offset, - int out_end) { - - float pitch = startpitch[0]; - float ix = in_offset[0]; - int ox = out_offset[0]; - float ix_end = in_end; - int ox_end = out_end; - if (pitchstep == 0f) { - while (ix < ix_end && ox < ox_end) { - out[ox++] = getResamplerTestValue(ix); - ix += pitch; - } - } else { - while (ix < ix_end && ox < ox_end) { - out[ox++] = getResamplerTestValue(ix); - ix += pitch; - pitch += pitchstep; - } - } - in_offset[0] = ix; - out_offset[0] = ox; - startpitch[0] = pitch; - - } - - private static float testResampler(SoftAbstractResampler resampler, float p_pitch, float p_pitch2) - { - float[] testbuffer = new float[4096]; - float[] testbuffer2 = new float[1024]; - float[] testbuffer3 = new float[1024]; - for (int i = 0; i < testbuffer.length; i++) - testbuffer[i] = getResamplerTestValue(i); - int pads = resampler.getPadding(); - float pitchstep = (p_pitch2 - p_pitch)/1024f; - int[] out_offset2 = {0}; - int[] out_offset3 = {0}; - resampler.interpolate(testbuffer, new float[] {pads}, testbuffer.length - pads, new float[] {p_pitch}, pitchstep, testbuffer2, out_offset2, testbuffer2.length); - perfectInterpolation(new float[] {pads}, testbuffer.length - pads, new float[] {p_pitch}, pitchstep, testbuffer3, out_offset3, testbuffer3.length); - int out_off = out_offset2[0]; - if(out_offset3[0] < out_off) - out_off = out_offset3[0]; - float ac_error = 0; - int counter = 0; - for (int i = pads; i < out_off; i++) { - ac_error += Math.abs(testbuffer2[i] - testbuffer3[i]); - counter++; - } - return ac_error / ((float)counter); - } - - private static void fail(String error) throws Exception - { - throw new RuntimeException(error); - } - - public static void main(String[] args) throws Exception { - SoftCubicResampler resampler = new SoftCubicResampler(); - float max = testResampler(resampler, 0.3f, 0.3f); - if(max > 0.005) - fail("Interpolation failed, error="+max); - max = testResampler(resampler, 0.3f, 0.01f); - if(max > 0.005) - fail("Interpolation failed, error="+max); - max = testResampler(resampler, 1.0f, 0.00f); - if(max > 0.005) - fail("Interpolation failed, error="+max); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftFilter/TestProcessAudio.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,99 +0,0 @@ -/* - * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftFilter processAudio method */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.Random; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class TestProcessAudio { - - public static void main(String[] args) throws Exception { - AudioFormat format = new AudioFormat(44100, 16, 2, true, false); - SoftAudioBuffer sbuffer = new SoftAudioBuffer(3600, format); - SoftFilter filter = new SoftFilter(format.getSampleRate()); - Random random = new Random(42); - - - for (int t = 0; t <= 6; t++) - { - if(t == 0) filter.setFilterType(SoftFilter.FILTERTYPE_BP12); - if(t == 1) filter.setFilterType(SoftFilter.FILTERTYPE_HP12); - if(t == 2) filter.setFilterType(SoftFilter.FILTERTYPE_HP24); - if(t == 3) filter.setFilterType(SoftFilter.FILTERTYPE_LP12); - if(t == 4) filter.setFilterType(SoftFilter.FILTERTYPE_LP24); - if(t == 5) filter.setFilterType(SoftFilter.FILTERTYPE_LP6); - if(t == 6) filter.setFilterType(SoftFilter.FILTERTYPE_NP12); - - - // Try first by reseting always - for (int f = 1200; f < 3600; f+=100) - for (int r = 0; r <= 30; r+=5) { - filter.reset(); - filter.setResonance(r); - filter.setFrequency(f); - float[] data = sbuffer.array(); - int len = sbuffer.getSize(); - for (int i = 0; i < len; i++) - data[i] = random.nextFloat() - 0.5f; - filter.processAudio(sbuffer); - } - - // Now we skip reseting - // to test how changing frequency and resonance - // affect active filter - for (int f = 100; f < 12800; f+=1200) - for (int r = 0; r <= 30; r+=5) { - filter.setResonance(r); - filter.setFrequency(f); - float[] data = sbuffer.array(); - int len = sbuffer.getSize(); - for (int i = 0; i < len; i++) - data[i] = random.nextFloat() - 0.5f; - filter.processAudio(sbuffer); - } - for (int f = 12800; f >= 100; f-=1200) - for (int r = 30; r >= 0; r-=5) { - filter.setResonance(r); - filter.setFrequency(f); - float[] data = sbuffer.array(); - int len = sbuffer.getSize(); - for (int i = 0; i < len; i++) - data[i] = random.nextFloat() - 0.5f; - filter.processAudio(sbuffer); - } - filter.reset(); - } - - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftLanczosResampler/Interpolate.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,113 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftLanczosResampler interpolate method */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Interpolate { - - private static float getResamplerTestValue(double i) - { - return (float)Math.sin(i / 10.0); - } - - private static void perfectInterpolation(float[] in_offset, float in_end, - float[] startpitch, float pitchstep, float[] out, int[] out_offset, - int out_end) { - - float pitch = startpitch[0]; - float ix = in_offset[0]; - int ox = out_offset[0]; - float ix_end = in_end; - int ox_end = out_end; - if (pitchstep == 0f) { - while (ix < ix_end && ox < ox_end) { - out[ox++] = getResamplerTestValue(ix); - ix += pitch; - } - } else { - while (ix < ix_end && ox < ox_end) { - out[ox++] = getResamplerTestValue(ix); - ix += pitch; - pitch += pitchstep; - } - } - in_offset[0] = ix; - out_offset[0] = ox; - startpitch[0] = pitch; - - } - - private static float testResampler(SoftAbstractResampler resampler, float p_pitch, float p_pitch2) - { - float[] testbuffer = new float[4096]; - float[] testbuffer2 = new float[1024]; - float[] testbuffer3 = new float[1024]; - for (int i = 0; i < testbuffer.length; i++) - testbuffer[i] = getResamplerTestValue(i); - int pads = resampler.getPadding(); - float pitchstep = (p_pitch2 - p_pitch)/1024f; - int[] out_offset2 = {0}; - int[] out_offset3 = {0}; - resampler.interpolate(testbuffer, new float[] {pads}, testbuffer.length - pads, new float[] {p_pitch}, pitchstep, testbuffer2, out_offset2, testbuffer2.length); - perfectInterpolation(new float[] {pads}, testbuffer.length - pads, new float[] {p_pitch}, pitchstep, testbuffer3, out_offset3, testbuffer3.length); - int out_off = out_offset2[0]; - if(out_offset3[0] < out_off) - out_off = out_offset3[0]; - float ac_error = 0; - int counter = 0; - for (int i = pads; i < out_off; i++) { - ac_error += Math.abs(testbuffer2[i] - testbuffer3[i]); - counter++; - } - return ac_error / ((float)counter); - } - - private static void fail(String error) throws Exception - { - throw new RuntimeException(error); - } - - public static void main(String[] args) throws Exception { - SoftLanczosResampler resampler = new SoftLanczosResampler(); - float max = testResampler(resampler, 0.3f, 0.3f); - if(max > 0.01) - fail("Interpolation failed, error="+max); - max = testResampler(resampler, 0.3f, 0.01f); - if(max > 0.01) - fail("Interpolation failed, error="+max); - max = testResampler(resampler, 1.0f, 0.00f); - if(max > 0.01) - fail("Interpolation failed, error="+max); - } -} \ No newline at end of file
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_mix.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftLimiter processAudio method */ - -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class ProcessAudio_replace_mix { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftSynthesizer synth = new SoftSynthesizer(); - synth.openStream(null, null); - - SoftAudioBuffer in1 = new SoftAudioBuffer(250, synth.getFormat()); - SoftAudioBuffer in2 = new SoftAudioBuffer(250, synth.getFormat()); - SoftAudioBuffer out1 = new SoftAudioBuffer(250, synth.getFormat()); - SoftAudioBuffer out2 = new SoftAudioBuffer(250, synth.getFormat()); - - float[] testdata1 = new float[in1.getSize()]; - float[] testdata2 = new float[in2.getSize()]; - float[] n1a = in1.array(); - float[] n2a = in2.array(); - float[] out1a = out1.array(); - float[] out2a = out2.array(); - for (int i = 0; i < n1a.length; i++) { - testdata1[i] = (float)Math.sin(i*0.3)*0.9f; - testdata2[i] = (float)Math.sin(i*0.4)*0.9f; - n1a[i] = testdata1[i]; - n2a[i] = testdata2[i]; - out1a[i] = 1; - out2a[i] = 1; - } - - SoftLimiter limiter = new SoftLimiter(); - limiter.init(44100, 147); - limiter.setMixMode(true); - limiter.setInput(0, in1); - limiter.setInput(1, in2); - limiter.setOutput(0, out1); - limiter.setOutput(1, out2); - limiter.processControlLogic(); - limiter.processAudio(); - limiter.processControlLogic(); - limiter.processAudio(); - // Limiter should delay audio by one buffer, - // and there should almost no different in output v.s. input - for (int i = 0; i < n1a.length; i++) { - if(Math.abs(out1a[i] - testdata1[i] - 1) > 0.00001) - throw new Exception("input != output"); - if(Math.abs(out2a[i] - testdata2[i] - 1) > 0.00001) - throw new Exception("input != output"); - } - - synth.close(); - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_mix_mono.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftLimiter processAudio method */ - -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class ProcessAudio_replace_mix_mono { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftSynthesizer synth = new SoftSynthesizer(); - synth.openStream(new AudioFormat(44100, 16, 1, true, false), null); - - SoftAudioBuffer in1 = new SoftAudioBuffer(250, synth.getFormat()); - SoftAudioBuffer out1 = new SoftAudioBuffer(250, synth.getFormat()); - - float[] testdata1 = new float[in1.getSize()]; - float[] n1a = in1.array(); - float[] out1a = out1.array(); - for (int i = 0; i < n1a.length; i++) { - testdata1[i] = (float)Math.sin(i*0.3)*0.9f; - n1a[i] = testdata1[i]; - out1a[i] = 1; - } - - SoftLimiter limiter = new SoftLimiter(); - limiter.init(44100, 147); - limiter.setMixMode(true); - limiter.setInput(0, in1); - limiter.setOutput(0, out1); - limiter.processControlLogic(); - limiter.processAudio(); - limiter.processControlLogic(); - limiter.processAudio(); - // Limiter should delay audio by one buffer, - // and there should almost no different in output v.s. input - for (int i = 0; i < n1a.length; i++) { - if(Math.abs(out1a[i] - testdata1[i] - 1) > 0.00001) - throw new Exception("input != output"); - } - - synth.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_mix_mono_overdrive.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftLimiter processAudio method */ - - -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class ProcessAudio_replace_mix_mono_overdrive { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftSynthesizer synth = new SoftSynthesizer(); - synth.openStream(new AudioFormat(44100, 16, 1, true, false), null); - - SoftAudioBuffer in1 = new SoftAudioBuffer(250, synth.getFormat()); - SoftAudioBuffer out1 = new SoftAudioBuffer(250, synth.getFormat()); - - float[] testdata1 = new float[in1.getSize()]; - float[] n1a = in1.array(); - float[] out1a = out1.array(); - for (int i = 0; i < n1a.length; i++) { - testdata1[i] = (float)Math.sin(i*0.3)*2.5f; - n1a[i] = testdata1[i]; - out1a[i] = 1; - } - - SoftLimiter limiter = new SoftLimiter(); - limiter.init(44100, 147); - limiter.setMixMode(true); - limiter.setInput(0, in1); - limiter.setOutput(0, out1); - limiter.processControlLogic(); - limiter.processAudio(); - limiter.processControlLogic(); - limiter.processAudio(); - // Limiter should delay audio by one buffer, - // and there should almost no different in output v.s. input - for (int i = 0; i < n1a.length; i++) { - if(Math.abs(out1a[i]-1) > 1.0) - throw new Exception("abs(output)>1"); - } - - synth.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_mix_overdrive.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftLimiter processAudio method */ - -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class ProcessAudio_replace_mix_overdrive { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftSynthesizer synth = new SoftSynthesizer(); - synth.openStream(null, null); - - SoftAudioBuffer in1 = new SoftAudioBuffer(250, synth.getFormat()); - SoftAudioBuffer in2 = new SoftAudioBuffer(250, synth.getFormat()); - SoftAudioBuffer out1 = new SoftAudioBuffer(250, synth.getFormat()); - SoftAudioBuffer out2 = new SoftAudioBuffer(250, synth.getFormat()); - - float[] testdata1 = new float[in1.getSize()]; - float[] testdata2 = new float[in2.getSize()]; - float[] n1a = in1.array(); - float[] n2a = in2.array(); - float[] out1a = out1.array(); - float[] out2a = out2.array(); - for (int i = 0; i < n1a.length; i++) { - testdata1[i] = (float)Math.sin(i*0.3)*2.5f; - testdata2[i] = (float)Math.sin(i*0.4)*2.5f; - n1a[i] = testdata1[i]; - n2a[i] = testdata2[i]; - out1a[i] = 1; - out2a[i] = 1; - } - - SoftLimiter limiter = new SoftLimiter(); - limiter.init(44100, 147); - limiter.setMixMode(true); - limiter.setInput(0, in1); - limiter.setInput(1, in2); - limiter.setOutput(0, out1); - limiter.setOutput(1, out2); - limiter.processControlLogic(); - limiter.processAudio(); - limiter.processControlLogic(); - limiter.processAudio(); - // Limiter should delay audio by one buffer, - // and there should almost no different in output v.s. input - for (int i = 0; i < n1a.length; i++) { - if(Math.abs(out1a[i]-1) > 1.0) - throw new Exception("abs(output)>1"); - if(Math.abs(out2a[i]-1) > 1.0) - throw new Exception("abs(output)>1"); - } - - synth.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_normal.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftLimiter processAudio method */ - -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class ProcessAudio_replace_normal { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftSynthesizer synth = new SoftSynthesizer(); - synth.openStream(null, null); - - SoftAudioBuffer in1 = new SoftAudioBuffer(250, synth.getFormat()); - SoftAudioBuffer in2 = new SoftAudioBuffer(250, synth.getFormat()); - SoftAudioBuffer out1 = new SoftAudioBuffer(250, synth.getFormat()); - SoftAudioBuffer out2 = new SoftAudioBuffer(250, synth.getFormat()); - - float[] testdata1 = new float[in1.getSize()]; - float[] testdata2 = new float[in2.getSize()]; - float[] n1a = in1.array(); - float[] n2a = in2.array(); - float[] out1a = out1.array(); - float[] out2a = out2.array(); - for (int i = 0; i < n1a.length; i++) { - testdata1[i] = (float)Math.sin(i*0.3)*0.9f; - testdata2[i] = (float)Math.sin(i*0.4)*0.9f; - n1a[i] = testdata1[i]; - n2a[i] = testdata2[i]; - out1a[i] = 1; - out2a[i] = 1; - } - - SoftLimiter limiter = new SoftLimiter(); - limiter.init(44100, 147); - limiter.setMixMode(false); - limiter.setInput(0, in1); - limiter.setInput(1, in2); - limiter.setOutput(0, out1); - limiter.setOutput(1, out2); - limiter.processControlLogic(); - limiter.processAudio(); - limiter.processControlLogic(); - limiter.processAudio(); - // Limiter should delay audio by one buffer, - // and there should almost no different in output v.s. input - for (int i = 0; i < n1a.length; i++) { - if(Math.abs(out1a[i] - testdata1[i]) > 0.00001) - throw new Exception("input != output"); - if(Math.abs(out2a[i] - testdata2[i]) > 0.00001) - throw new Exception("input != output"); - } - - synth.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_normal_mono.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftLimiter processAudio method */ - -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class ProcessAudio_replace_normal_mono { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftSynthesizer synth = new SoftSynthesizer(); - synth.openStream(new AudioFormat(44100, 16, 1, true, false), null); - - SoftAudioBuffer in1 = new SoftAudioBuffer(250, synth.getFormat()); - SoftAudioBuffer out1 = new SoftAudioBuffer(250, synth.getFormat()); - - float[] testdata1 = new float[in1.getSize()]; - float[] n1a = in1.array(); - float[] out1a = out1.array(); - for (int i = 0; i < n1a.length; i++) { - testdata1[i] = (float)Math.sin(i*0.3)*0.9f; - n1a[i] = testdata1[i]; - out1a[i] = 1; - } - - SoftLimiter limiter = new SoftLimiter(); - limiter.init(44100, 147); - limiter.setMixMode(false); - limiter.setInput(0, in1); - limiter.setOutput(0, out1); - limiter.processControlLogic(); - limiter.processAudio(); - limiter.processControlLogic(); - limiter.processAudio(); - // Limiter should delay audio by one buffer, - // and there should almost no different in output v.s. input - for (int i = 0; i < n1a.length; i++) { - if(Math.abs(out1a[i] - testdata1[i]) > 0.00001) - throw new Exception("input != output"); - } - - synth.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_overdrive.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftLimiter processAudio method */ - -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class ProcessAudio_replace_overdrive { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftSynthesizer synth = new SoftSynthesizer(); - synth.openStream(null, null); - - SoftAudioBuffer in1 = new SoftAudioBuffer(250, synth.getFormat()); - SoftAudioBuffer in2 = new SoftAudioBuffer(250, synth.getFormat()); - SoftAudioBuffer out1 = new SoftAudioBuffer(250, synth.getFormat()); - SoftAudioBuffer out2 = new SoftAudioBuffer(250, synth.getFormat()); - - float[] testdata1 = new float[in1.getSize()]; - float[] testdata2 = new float[in2.getSize()]; - float[] n1a = in1.array(); - float[] n2a = in2.array(); - float[] out1a = out1.array(); - float[] out2a = out2.array(); - for (int i = 0; i < n1a.length; i++) { - testdata1[i] = (float)Math.sin(i*0.3)*2.5f; - testdata2[i] = (float)Math.sin(i*0.4)*2.5f; - n1a[i] = testdata1[i]; - n2a[i] = testdata2[i]; - out1a[i] = 1; - out2a[i] = 1; - } - - SoftLimiter limiter = new SoftLimiter(); - limiter.init(44100, 147); - limiter.setMixMode(false); - limiter.setInput(0, in1); - limiter.setInput(1, in2); - limiter.setOutput(0, out1); - limiter.setOutput(1, out2); - limiter.processControlLogic(); - limiter.processAudio(); - limiter.processControlLogic(); - limiter.processAudio(); - // Limiter should delay audio by one buffer, - // and there should almost no different in output v.s. input - for (int i = 0; i < n1a.length; i++) { - if(Math.abs(out1a[i]) > 1.0) - throw new Exception("abs(output)>1"); - if(Math.abs(out2a[i]) > 1.0) - throw new Exception("abs(output)>1"); - } - - synth.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_overdrive_mono.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftLimiter processAudio method */ - -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class ProcessAudio_replace_overdrive_mono { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftSynthesizer synth = new SoftSynthesizer(); - synth.openStream(new AudioFormat(44100, 16, 1, true, false), null); - - SoftAudioBuffer in1 = new SoftAudioBuffer(250, synth.getFormat()); - SoftAudioBuffer out1 = new SoftAudioBuffer(250, synth.getFormat()); - - float[] testdata1 = new float[in1.getSize()]; - float[] n1a = in1.array(); - float[] out1a = out1.array(); - for (int i = 0; i < n1a.length; i++) { - testdata1[i] = (float)Math.sin(i*0.3)*2.5f; - n1a[i] = testdata1[i]; - out1a[i] = 1; - } - - SoftLimiter limiter = new SoftLimiter(); - limiter.init(44100, 147); - limiter.setMixMode(false); - limiter.setInput(0, in1); - limiter.setOutput(0, out1); - limiter.processControlLogic(); - limiter.processAudio(); - limiter.processControlLogic(); - limiter.processAudio(); - // Limiter should delay audio by one buffer, - // and there should almost no different in output v.s. input - for (int i = 0; i < n1a.length; i++) { - if(Math.abs(out1a[i]) > 1.0) - throw new Exception("abs(output)>1"); - } - - synth.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftLinearResampler/Interpolate.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,113 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftLinearResampler interpolate method */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Interpolate { - - private static float getResamplerTestValue(double i) - { - return (float)Math.sin(i / 10.0); - } - - private static void perfectInterpolation(float[] in_offset, float in_end, - float[] startpitch, float pitchstep, float[] out, int[] out_offset, - int out_end) { - - float pitch = startpitch[0]; - float ix = in_offset[0]; - int ox = out_offset[0]; - float ix_end = in_end; - int ox_end = out_end; - if (pitchstep == 0f) { - while (ix < ix_end && ox < ox_end) { - out[ox++] = getResamplerTestValue(ix); - ix += pitch; - } - } else { - while (ix < ix_end && ox < ox_end) { - out[ox++] = getResamplerTestValue(ix); - ix += pitch; - pitch += pitchstep; - } - } - in_offset[0] = ix; - out_offset[0] = ox; - startpitch[0] = pitch; - - } - - private static float testResampler(SoftAbstractResampler resampler, float p_pitch, float p_pitch2) - { - float[] testbuffer = new float[4096]; - float[] testbuffer2 = new float[1024]; - float[] testbuffer3 = new float[1024]; - for (int i = 0; i < testbuffer.length; i++) - testbuffer[i] = getResamplerTestValue(i); - int pads = resampler.getPadding(); - float pitchstep = (p_pitch2 - p_pitch)/1024f; - int[] out_offset2 = {0}; - int[] out_offset3 = {0}; - resampler.interpolate(testbuffer, new float[] {pads}, testbuffer.length - pads, new float[] {p_pitch}, pitchstep, testbuffer2, out_offset2, testbuffer2.length); - perfectInterpolation(new float[] {pads}, testbuffer.length - pads, new float[] {p_pitch}, pitchstep, testbuffer3, out_offset3, testbuffer3.length); - int out_off = out_offset2[0]; - if(out_offset3[0] < out_off) - out_off = out_offset3[0]; - float ac_error = 0; - int counter = 0; - for (int i = pads; i < out_off; i++) { - ac_error += Math.abs(testbuffer2[i] - testbuffer3[i]); - counter++; - } - return ac_error / ((float)counter); - } - - private static void fail(String error) throws Exception - { - throw new RuntimeException(error); - } - - public static void main(String[] args) throws Exception { - SoftLinearResampler resampler = new SoftLinearResampler(); - float max = testResampler(resampler, 0.3f, 0.3f); - if(max > 0.001) - fail("Interpolation failed, error="+max); - max = testResampler(resampler, 0.3f, 0.01f); - if(max > 0.001) - fail("Interpolation failed, error="+max); - max = testResampler(resampler, 1.0f, 0.00f); - if(max > 0.001) - fail("Interpolation failed, error="+max); - } -} \ No newline at end of file
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftLinearResampler2/Interpolate.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,113 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftLinearResampler2 interpolate method */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Interpolate { - - private static float getResamplerTestValue(double i) - { - return (float)Math.sin(i / 10.0); - } - - private static void perfectInterpolation(float[] in_offset, float in_end, - float[] startpitch, float pitchstep, float[] out, int[] out_offset, - int out_end) { - - float pitch = startpitch[0]; - float ix = in_offset[0]; - int ox = out_offset[0]; - float ix_end = in_end; - int ox_end = out_end; - if (pitchstep == 0f) { - while (ix < ix_end && ox < ox_end) { - out[ox++] = getResamplerTestValue(ix); - ix += pitch; - } - } else { - while (ix < ix_end && ox < ox_end) { - out[ox++] = getResamplerTestValue(ix); - ix += pitch; - pitch += pitchstep; - } - } - in_offset[0] = ix; - out_offset[0] = ox; - startpitch[0] = pitch; - - } - - private static float testResampler(SoftAbstractResampler resampler, float p_pitch, float p_pitch2) - { - float[] testbuffer = new float[4096]; - float[] testbuffer2 = new float[1024]; - float[] testbuffer3 = new float[1024]; - for (int i = 0; i < testbuffer.length; i++) - testbuffer[i] = getResamplerTestValue(i); - int pads = resampler.getPadding(); - float pitchstep = (p_pitch2 - p_pitch)/1024f; - int[] out_offset2 = {0}; - int[] out_offset3 = {0}; - resampler.interpolate(testbuffer, new float[] {pads}, testbuffer.length - pads, new float[] {p_pitch}, pitchstep, testbuffer2, out_offset2, testbuffer2.length); - perfectInterpolation(new float[] {pads}, testbuffer.length - pads, new float[] {p_pitch}, pitchstep, testbuffer3, out_offset3, testbuffer3.length); - int out_off = out_offset2[0]; - if(out_offset3[0] < out_off) - out_off = out_offset3[0]; - float ac_error = 0; - int counter = 0; - for (int i = pads; i < out_off; i++) { - ac_error += Math.abs(testbuffer2[i] - testbuffer3[i]); - counter++; - } - return ac_error / ((float)counter); - } - - private static void fail(String error) throws Exception - { - throw new RuntimeException(error); - } - - public static void main(String[] args) throws Exception { - SoftLinearResampler2 resampler = new SoftLinearResampler2(); - float max = testResampler(resampler, 0.3f, 0.3f); - if(max > 0.2) - fail("Interpolation failed, error="+max); - max = testResampler(resampler, 0.3f, 0.01f); - if(max > 0.2) - fail("Interpolation failed, error="+max); - max = testResampler(resampler, 1.0f, 0.00f); - if(max > 0.2) - fail("Interpolation failed, error="+max); - } -} \ No newline at end of file
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftLowFrequencyOscillator/TestProcessControlLogic.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,106 +0,0 @@ -/* - * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftLowFrequencyOscillator processControlLogic method */ - -import com.sun.media.sound.AudioSynthesizerPropertyInfo; -import com.sun.media.sound.SoftLowFrequencyOscillator; -import com.sun.media.sound.SoftSynthesizer; - -public class TestProcessControlLogic { - - private static float control_rate = 147f; - private static SoftSynthesizer synth = new SoftSynthesizer(); - private static SoftLowFrequencyOscillator lfo = new SoftLowFrequencyOscillator(); - - private static void testLFO(boolean shared, int instance, float freq, float delay, - float delay2) throws Exception { - SoftLowFrequencyOscillator lfo = - shared?TestProcessControlLogic.lfo:new SoftLowFrequencyOscillator(); - lfo.reset(); - double[] lfo_freq = lfo.get(instance, "freq"); - double[] lfo_delay = lfo.get(instance, "delay"); - double[] lfo_delay2 = lfo.get(instance, "delay2"); - double[] lfo_output = lfo.get(instance, null); - lfo_freq[0] = freq; - lfo_delay[0] = delay; - lfo_delay2[0] = delay2; - lfo.init(synth); - - // For delayCount amount time, the output LFO should be 0.5 - int delayCount = (int) ((Math.pow(2, delay / 1200.0) * control_rate)); - delayCount += (int) ((delay2 * control_rate) / 1000.0); - for (int i = 0; i < delayCount; i++) { - if (Math.abs(0.5 - lfo_output[0]) > 0.000001) - throw new Exception("Incorrect LFO output (" - +"0.5 != "+lfo_output[0]+")!"); - lfo.processControlLogic(); - } - - // After the delay the LFO should start oscillate - // Let make sure output is accurate enough - double p_step = (440.0 / control_rate) - * Math.exp((freq - 6900.0) * (Math.log(2) / 1200.0)); - double p = 0; - for (int i = 0; i < 30; i++) { - p += p_step; - double predicted_output = 0.5 + Math.sin(p * 2 * Math.PI) * 0.5; - if (Math.abs(predicted_output - lfo_output[0]) > 0.001) - throw new Exception("Incorrect LFO output (" - +predicted_output+" != "+lfo_output[0]+")!"); - lfo.processControlLogic(); - } - - } - - public static void main(String[] args) throws Exception { - - // Get default control rate from synthesizer - AudioSynthesizerPropertyInfo[] p = synth.getPropertyInfo(null); - for (int i = 0; i < p.length; i++) { - if (p[i].name.equals("control rate")) { - control_rate = ((Float) p[i].value).floatValue(); - break; - } - } - - // Test LFO under various configurations - for (int instance = 0; instance < 3; instance++) - for (int d1 = -3000; d1 < 0; d1 += 1000) - for (int d2 = 0; d2 < 5000; d2 += 1000) - for (int fr = -1000; fr < 1000; fr += 100) { - testLFO(true, instance, - (fr == -1000) ? Float.NEGATIVE_INFINITY : fr, - (d1 == -3000) ? Float.NEGATIVE_INFINITY : d1, - d2); - testLFO(false, instance, - (fr == -1000) ? Float.NEGATIVE_INFINITY : fr, - (d1 == -3000) ? Float.NEGATIVE_INFINITY : d1, - d2); - } - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftPointResampler/Interpolate.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,113 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftPointResampler interpolate method */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Interpolate { - - private static float getResamplerTestValue(double i) - { - return (float)Math.sin(i / 10.0); - } - - private static void perfectInterpolation(float[] in_offset, float in_end, - float[] startpitch, float pitchstep, float[] out, int[] out_offset, - int out_end) { - - float pitch = startpitch[0]; - float ix = in_offset[0]; - int ox = out_offset[0]; - float ix_end = in_end; - int ox_end = out_end; - if (pitchstep == 0f) { - while (ix < ix_end && ox < ox_end) { - out[ox++] = getResamplerTestValue(ix); - ix += pitch; - } - } else { - while (ix < ix_end && ox < ox_end) { - out[ox++] = getResamplerTestValue(ix); - ix += pitch; - pitch += pitchstep; - } - } - in_offset[0] = ix; - out_offset[0] = ox; - startpitch[0] = pitch; - - } - - private static float testResampler(SoftAbstractResampler resampler, float p_pitch, float p_pitch2) - { - float[] testbuffer = new float[4096]; - float[] testbuffer2 = new float[1024]; - float[] testbuffer3 = new float[1024]; - for (int i = 0; i < testbuffer.length; i++) - testbuffer[i] = getResamplerTestValue(i); - int pads = resampler.getPadding(); - float pitchstep = (p_pitch2 - p_pitch)/1024f; - int[] out_offset2 = {0}; - int[] out_offset3 = {0}; - resampler.interpolate(testbuffer, new float[] {pads}, testbuffer.length - pads, new float[] {p_pitch}, pitchstep, testbuffer2, out_offset2, testbuffer2.length); - perfectInterpolation(new float[] {pads}, testbuffer.length - pads, new float[] {p_pitch}, pitchstep, testbuffer3, out_offset3, testbuffer3.length); - int out_off = out_offset2[0]; - if(out_offset3[0] < out_off) - out_off = out_offset3[0]; - float ac_error = 0; - int counter = 0; - for (int i = pads; i < out_off; i++) { - ac_error += Math.abs(testbuffer2[i] - testbuffer3[i]); - counter++; - } - return ac_error / ((float)counter); - } - - private static void fail(String error) throws Exception - { - throw new RuntimeException(error); - } - - public static void main(String[] args) throws Exception { - SoftPointResampler resampler = new SoftPointResampler(); - float max = testResampler(resampler, 0.3f, 0.3f); - if(max > 0.2) - fail("Interpolation failed, error="+max); - max = testResampler(resampler, 0.3f, 0.01f); - if(max > 0.2) - fail("Interpolation failed, error="+max); - max = testResampler(resampler, 1.0f, 0.00f); - if(max > 0.2) - fail("Interpolation failed, error="+max); - } -} \ No newline at end of file
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftProvider/GetDevice.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftProvider getDevice method */ - -import javax.sound.midi.MidiDevice; -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.sampled.*; -import javax.sound.midi.MidiDevice.Info; - -import com.sun.media.sound.*; - -public class GetDevice { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - - private static class FakeInfo extends Info { - public FakeInfo() { - super("a", "b", "c", "d"); - } - } - - public static void main(String[] args) throws Exception { - SoftProvider provider = new SoftProvider(); - Info[] infos = provider.getDeviceInfo(); - assertTrue(infos.length > 0); - for (int i = 0; i < infos.length; i++) { - assertTrue(infos[i] != null); - MidiDevice d = provider.getDevice(infos[i]); - assertTrue(d instanceof SoftSynthesizer); - } - assertTrue(provider.getDevice(new FakeInfo()) == null); - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftReceiver/Close.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftReceiver close method */ - -import javax.sound.midi.*; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Close { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftTestUtils soft = new SoftTestUtils(); - MidiChannel channel = soft.synth.getChannels()[0]; - Receiver receiver = soft.synth.getReceiver(); - - assertEquals(soft.synth.getReceivers().size(), 1); - receiver.close(); - assertEquals(soft.synth.getReceivers().size(), 0); - - soft.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftReceiver/Send_ActiveSense.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftReceiver send method */ - -import javax.sound.midi.*; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Send_ActiveSense { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void sendActiveSens(Receiver r) throws Exception - { - ShortMessage smsg = new ShortMessage(); - smsg.setMessage(ShortMessage.ACTIVE_SENSING); - r.send(smsg, -1); - } - - public static void main(String[] args) throws Exception { - SoftTestUtils soft = new SoftTestUtils(); - MidiChannel channel = soft.synth.getChannels()[0]; - Receiver receiver = soft.synth.getReceiver(); - - sendActiveSens(receiver); - - // 1. Check if notes are keept active - // if send active sens every 200-300 msec - - sendActiveSens(receiver); - channel.noteOn(60, 64); - assertTrue(soft.findVoice(0,60) != null); - for (int i = 0; i < 10; i++) { - soft.read(0.2); // read 200 msec - sendActiveSens(receiver); - assertTrue(soft.findVoice(0,60) != null); - } - // 2. Now we stop send active sense message - // and the note should be killed off - soft.read(2); - assertTrue(soft.findVoice(0,60) == null); - - - - soft.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftReceiver/Send_AllNotesOff.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftReceiver send method */ - -import javax.sound.midi.*; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Send_AllNotesOff { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftTestUtils soft = new SoftTestUtils(); - MidiChannel channel = soft.synth.getChannels()[0]; - Receiver receiver = soft.synth.getReceiver(); - - channel.noteOn(60, 64); - soft.read(1); - assertTrue(soft.findVoice(0,60) != null); - ShortMessage smsg = new ShortMessage(); - smsg.setMessage(ShortMessage.CONTROL_CHANGE,0, 123,0); - receiver.send(smsg, -1); - soft.read(1); - assertTrue(soft.findVoice(0,60) == null); - - soft.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftReceiver/Send_AllSoundOff.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftReceiver send method */ - -import javax.sound.midi.*; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Send_AllSoundOff { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftTestUtils soft = new SoftTestUtils(); - MidiChannel channel = soft.synth.getChannels()[0]; - Receiver receiver = soft.synth.getReceiver(); - - channel.noteOn(60, 64); - soft.read(1); - assertTrue(soft.findVoice(0,60) != null); - ShortMessage smsg = new ShortMessage(); - smsg.setMessage(ShortMessage.CONTROL_CHANGE,0, 120,0); - receiver.send(smsg, -1); - soft.read(1); - assertTrue(soft.findVoice(0,60) == null); - - soft.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftReceiver/Send_ChannelPressure.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftReceiver send method */ - -import javax.sound.midi.*; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Send_ChannelPressure { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftTestUtils soft = new SoftTestUtils(); - MidiChannel channel = soft.synth.getChannels()[0]; - Receiver receiver = soft.synth.getReceiver(); - - ShortMessage smsg = new ShortMessage(); - smsg.setMessage(ShortMessage.CHANNEL_PRESSURE,0, 10,0); - receiver.send(smsg, -1); - assertEquals(channel.getChannelPressure(), 10); - smsg.setMessage(ShortMessage.CHANNEL_PRESSURE,0, 90,0); - receiver.send(smsg, -1); - assertEquals(channel.getChannelPressure(), 90); - - soft.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftReceiver/Send_Controller.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftReceiver send method */ - -import javax.sound.midi.*; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Send_Controller { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftTestUtils soft = new SoftTestUtils(); - MidiChannel channel = soft.synth.getChannels()[0]; - Receiver receiver = soft.synth.getReceiver(); - - ShortMessage smsg = new ShortMessage(); - for (int i = 0; i < 128; i++) { - if(i == 0 || i == 32) continue; - smsg.setMessage(ShortMessage.CONTROL_CHANGE,0, i,10); - receiver.send(smsg, -1); - assertEquals(channel.getController(i), 10); - smsg.setMessage(ShortMessage.CONTROL_CHANGE,0, i,100); - receiver.send(smsg, -1); - assertEquals(channel.getController(i), 100); - } - - soft.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftReceiver/Send_Mono.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftReceiver send method */ - -import javax.sound.midi.*; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Send_Mono { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftTestUtils soft = new SoftTestUtils(); - MidiChannel channel = soft.synth.getChannels()[0]; - Receiver receiver = soft.synth.getReceiver(); - - ShortMessage smsg = new ShortMessage(); - smsg.setMessage(ShortMessage.CONTROL_CHANGE,0, 126,100); - receiver.send(smsg, -1); - assertEquals(channel.getMono(), false); - smsg.setMessage(ShortMessage.CONTROL_CHANGE,0, 126,1); - receiver.send(smsg, -1); - assertEquals(channel.getMono(), true); - smsg.setMessage(ShortMessage.CONTROL_CHANGE,0, 127,0); - receiver.send(smsg, -1); - assertEquals(channel.getMono(), false); - - // Check if send mono triggers AllNotesOff - channel.noteOn(60, 64); - soft.read(1); - assertTrue(soft.findVoice(0,60) != null); - smsg.setMessage(ShortMessage.CONTROL_CHANGE,0, 127,0); - receiver.send(smsg, -1); - soft.read(1); - assertTrue(soft.findVoice(0,60) == null); - - soft.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftReceiver/Send_NoteOff.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftReceiver send method */ - -import javax.sound.midi.*; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Send_NoteOff { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftTestUtils soft = new SoftTestUtils(); - MidiChannel channel = soft.synth.getChannels()[0]; - Receiver receiver = soft.synth.getReceiver(); - - ShortMessage smsg = new ShortMessage(); - smsg.setMessage(ShortMessage.NOTE_ON,0, 60, 64); - receiver.send(smsg, -1); - soft.read(1); - assertTrue(soft.findVoice(0,60) != null); - smsg.setMessage(ShortMessage.NOTE_OFF,0, 60, 0); - receiver.send(smsg, -1); - soft.read(1); - assertTrue(soft.findVoice(0,60) == null); - - soft.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftReceiver/Send_NoteOn.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftReceiver send method */ - -import javax.sound.midi.*; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Send_NoteOn { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftTestUtils soft = new SoftTestUtils(); - MidiChannel channel = soft.synth.getChannels()[0]; - Receiver receiver = soft.synth.getReceiver(); - - ShortMessage smsg = new ShortMessage(); - smsg.setMessage(ShortMessage.NOTE_ON,0, 60, 64); - receiver.send(smsg, -1); - soft.read(1); - assertTrue(soft.findVoice(0,60) != null); - smsg.setMessage(ShortMessage.NOTE_ON,0, 60, 0); - receiver.send(smsg, -1); - soft.read(1); - assertTrue(soft.findVoice(0,60) == null); - - soft.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftReceiver/Send_NoteOn_AllChannels.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftReceiver send method */ - -import javax.sound.midi.*; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Send_NoteOn_AllChannels { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftTestUtils soft = new SoftTestUtils(); - MidiChannel channel = soft.synth.getChannels()[0]; - Receiver receiver = soft.synth.getReceiver(); - - for (int i = 0; i < 15; i++) { - if(i == 9) i++; - ShortMessage smsg = new ShortMessage(); - smsg.setMessage(ShortMessage.NOTE_ON,i, 60, 64); - receiver.send(smsg, -1); - soft.read(1); - VoiceStatus voice = soft.findVoice(i,60); - assertTrue(voice != null); - smsg.setMessage(ShortMessage.NOTE_ON,i, 60, 0); - receiver.send(smsg, -1); - soft.read(1); - voice = soft.findVoice(i,60); - assertTrue(voice == null); - soft.read(1); - } - - soft.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftReceiver/Send_NoteOn_Delayed.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftReceiver send method */ - -import javax.sound.midi.*; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Send_NoteOn_Delayed { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftTestUtils soft = new SoftTestUtils(); - MidiChannel channel = soft.synth.getChannels()[0]; - Receiver receiver = soft.synth.getReceiver(); - - ShortMessage smsg = new ShortMessage(); - smsg.setMessage(ShortMessage.NOTE_ON,0, 60, 64); - receiver.send(smsg, 2000000); // Delay sending note for 2 sec - soft.read(1); - assertTrue(soft.findVoice(0,60) == null); - soft.read(2); - assertTrue(soft.findVoice(0,60) != null); - smsg.setMessage(ShortMessage.NOTE_ON,0, 60, 0); - receiver.send(smsg, -1); - soft.read(1); - assertTrue(soft.findVoice(0,60) == null); - - soft.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftReceiver/Send_NoteOn_Multiple.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftReceiver send method */ - -import javax.sound.midi.*; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Send_NoteOn_Multiple { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftTestUtils soft = new SoftTestUtils(); - MidiChannel channel = soft.synth.getChannels()[0]; - Receiver receiver = soft.synth.getReceiver(); - - ShortMessage smsg = new ShortMessage(); - smsg.setMessage(ShortMessage.NOTE_ON,0, 60, 64); - receiver.send(smsg, -1); - smsg.setMessage(ShortMessage.NOTE_ON,0, 61, 64); - receiver.send(smsg, -1); - smsg.setMessage(ShortMessage.NOTE_ON,0, 62, 64); - receiver.send(smsg, -1); - soft.read(1); - assertTrue(soft.findVoice(0,60) != null); - assertTrue(soft.findVoice(0,61) != null); - assertTrue(soft.findVoice(0,62) != null); - - smsg.setMessage(ShortMessage.NOTE_ON,0, 60, 0); - receiver.send(smsg, -1); - smsg.setMessage(ShortMessage.NOTE_ON,0, 61, 0); - receiver.send(smsg, -1); - soft.read(1); - assertTrue(soft.findVoice(0,60) == null); - assertTrue(soft.findVoice(0,61) == null); - assertTrue(soft.findVoice(0,62) != null); - - soft.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftReceiver/Send_Omni.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftReceiver send method */ - -import javax.sound.midi.*; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Send_Omni { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftTestUtils soft = new SoftTestUtils(); - MidiChannel channel = soft.synth.getChannels()[0]; - Receiver receiver = soft.synth.getReceiver(); - - ShortMessage smsg = new ShortMessage(); - smsg.setMessage(ShortMessage.CONTROL_CHANGE,0, 125,0); - receiver.send(smsg, -1); - // Poly or Omni not supported by GM2 - // getOmni() should always return false - assertEquals(channel.getOmni(), false); - smsg.setMessage(ShortMessage.CONTROL_CHANGE,0, 124,0); - receiver.send(smsg, -1); - assertEquals(channel.getOmni(), false); - - // Check if send omni triggers AllNotesOff - channel.noteOn(60, 64); - soft.read(1); - assertTrue(soft.findVoice(0,60) != null); - smsg.setMessage(ShortMessage.CONTROL_CHANGE,0, 124,0); - receiver.send(smsg, -1); - soft.read(1); - assertTrue(soft.findVoice(0,60) == null); - - soft.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftReceiver/Send_PitchBend.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftReceiver send method */ - -import javax.sound.midi.*; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Send_PitchBend { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftTestUtils soft = new SoftTestUtils(); - MidiChannel channel = soft.synth.getChannels()[0]; - Receiver receiver = soft.synth.getReceiver(); - - ShortMessage smsg = new ShortMessage(); - smsg.setMessage(ShortMessage.PITCH_BEND,0, 10,0); - receiver.send(smsg, -1); - assertEquals(channel.getPitchBend(), 10); - smsg.setMessage(ShortMessage.PITCH_BEND,0, 9000%128,9000/128); - receiver.send(smsg, -1); - assertEquals(channel.getPitchBend(), 9000); - - soft.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftReceiver/Send_PolyPressure.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftReceiver send method */ - -import javax.sound.midi.*; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Send_PolyPressure { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftTestUtils soft = new SoftTestUtils(); - MidiChannel channel = soft.synth.getChannels()[0]; - Receiver receiver = soft.synth.getReceiver(); - - ShortMessage smsg = new ShortMessage(); - for (int i = 0; i < 128; i++) { - smsg.setMessage(ShortMessage.POLY_PRESSURE,0, i, 10); - receiver.send(smsg, -1); - assertEquals(channel.getPolyPressure(i),10); - smsg.setMessage(ShortMessage.POLY_PRESSURE,0, i, 100); - receiver.send(smsg, -1); - assertEquals(channel.getPolyPressure(i),100); - } - - soft.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftReceiver/Send_ProgramChange.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftReceiver send method */ - -import javax.sound.midi.*; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Send_ProgramChange { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftTestUtils soft = new SoftTestUtils(); - MidiChannel channel = soft.synth.getChannels()[0]; - Receiver receiver = soft.synth.getReceiver(); - - ShortMessage smsg = new ShortMessage(); - smsg.setMessage(ShortMessage.PROGRAM_CHANGE,0, 36,0); - receiver.send(smsg, -1); - assertEquals(channel.getProgram(), 36); - smsg.setMessage(ShortMessage.PROGRAM_CHANGE,0, 48,0); - receiver.send(smsg, -1); - assertEquals(channel.getProgram(), 48); - - soft.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftReceiver/Send_ResetAllControllers.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,136 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftReceiver send method */ - -import javax.sound.midi.*; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Send_ResetAllControllers { - - public static boolean[] dontResetControls = new boolean[128]; - static { - for (int i = 0; i < dontResetControls.length; i++) - dontResetControls[i] = false; - - dontResetControls[0] = true; // Bank Select (MSB) - dontResetControls[32] = true; // Bank Select (LSB) - dontResetControls[7] = true; // Channel Volume (MSB) - dontResetControls[8] = true; // Balance (MSB) - dontResetControls[10] = true; // Pan (MSB) - dontResetControls[11] = true; // Expression (MSB) - dontResetControls[91] = true; // Effects 1 Depth (default: Reverb Send) - dontResetControls[92] = true; // Effects 2 Depth (default: Tremolo Depth) - dontResetControls[93] = true; // Effects 3 Depth (default: Chorus Send) - dontResetControls[94] = true; // Effects 4 Depth (default: Celeste [Detune] Depth) - dontResetControls[95] = true; // Effects 5 Depth (default: Phaser Depth) - dontResetControls[70] = true; // Sound Controller 1 (default: Sound Variation) - dontResetControls[71] = true; // Sound Controller 2 (default: Timbre / Harmonic Quality) - dontResetControls[72] = true; // Sound Controller 3 (default: Release Time) - dontResetControls[73] = true; // Sound Controller 4 (default: Attack Time) - dontResetControls[74] = true; // Sound Controller 5 (default: Brightness) - dontResetControls[75] = true; // Sound Controller 6 (GM2 default: Decay Time) - dontResetControls[76] = true; // Sound Controller 7 (GM2 default: Vibrato Rate) - dontResetControls[77] = true; // Sound Controller 8 (GM2 default: Vibrato Depth) - dontResetControls[78] = true; // Sound Controller 9 (GM2 default: Vibrato Delay) - dontResetControls[79] = true; // Sound Controller 10 (GM2 default: Undefined) - dontResetControls[120] = true; // All Sound Off - dontResetControls[121] = true; // Reset All Controllers - dontResetControls[122] = true; // Local Control On/Off - dontResetControls[123] = true; // All Notes Off - dontResetControls[124] = true; // Omni Mode Off - dontResetControls[125] = true; // Omni Mode On - dontResetControls[126] = true; // Poly Mode Off - dontResetControls[127] = true; // Poly Mode On - - dontResetControls[6] = true; // Data Entry (MSB) - dontResetControls[38] = true; // Data Entry (LSB) - dontResetControls[96] = true; // Data Increment - dontResetControls[97] = true; // Data Decrement - dontResetControls[98] = true; // Non-Registered Parameter Number (LSB) - dontResetControls[99] = true; // Non-Registered Parameter Number(MSB) - dontResetControls[100] = true; // RPN = Null - dontResetControls[101] = true; // RPN = Null - } - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftTestUtils soft = new SoftTestUtils(); - MidiChannel channel = soft.synth.getChannels()[0]; - Receiver receiver = soft.synth.getReceiver(); - - // First let all controls contain non-default values - for (int i = 0; i < 128; i++) - channel.setPolyPressure(i, 10); - channel.setChannelPressure(10); - channel.setPitchBend(2192); - for (int i = 0; i < 120; i++) - channel.controlChange(i, 1); - - ShortMessage smsg = new ShortMessage(); - smsg.setMessage(ShortMessage.CONTROL_CHANGE,0, 121,0); - receiver.send(smsg, -1); - - // Now check if resetAllControllers did what it was suppose to do - - for (int i = 0; i < 128; i++) - assertEquals(channel.getPolyPressure(i), 0); - assertEquals(channel.getChannelPressure(), 0); - assertEquals(channel.getPitchBend(),8192); - for (int i = 0; i < 120; i++) - if(!dontResetControls[i]) - assertEquals(channel.getController(i), 0); - assertEquals(channel.getController(71), 64); // Filter Resonance - assertEquals(channel.getController(72), 64); // Release Time - assertEquals(channel.getController(73), 64); // Attack Time - assertEquals(channel.getController(74), 64); // Brightness - assertEquals(channel.getController(75), 64); // Decay Time - assertEquals(channel.getController(76), 64); // Vibrato Rate - assertEquals(channel.getController(77), 64); // Vibrato Depth - assertEquals(channel.getController(78), 64); // Vibrato Delay - assertEquals(channel.getController(8), 64); // Balance - assertEquals(channel.getController(11), 127); // Expression - assertEquals(channel.getController(98), 127); // NRPN Null - assertEquals(channel.getController(99), 127); // NRPN Null - assertEquals(channel.getController(100), 127); // RPN = Null - assertEquals(channel.getController(101), 127); // RPN = Null - - soft.close(); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftReceiver/SoftTestUtils.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,111 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -import java.io.IOException; - -import javax.sound.midi.*; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class SoftTestUtils { - - public AudioSynthesizer synth = new SoftSynthesizer(); - public AudioInputStream stream; - public byte[] tmpbuffer = new byte[1024]; - - public static SF2Soundbank createTestSoundBank() - { - SF2Soundbank sf2 = new SF2Soundbank(); - AudioFormat format = new AudioFormat(44100, 16, 1, true, false); - float[] data = new float[44100+1000]; - float fr = 440/format.getSampleRate(); - for (int i = 0; i < data.length; i++) - data[i] = (float)Math.sin(i*fr*2*Math.PI); - byte[] bdata = new byte[data.length*format.getFrameSize()]; - AudioFloatConverter.getConverter(format).toByteArray(data, bdata); - SF2Sample sample = new SF2Sample(sf2); - sample.setName("Test Sample"); - sample.setData(bdata); - sample.setStartLoop(500); - sample.setEndLoop(data.length - 500); - sample.setSampleRate((long) format.getSampleRate()); - sample.setOriginalPitch(69); - sf2.addResource(sample); - SF2Layer layer = new SF2Layer(sf2); - layer.setName("Test Layer"); - sf2.addResource(layer); - SF2LayerRegion region = new SF2LayerRegion(); - region.putInteger(SF2Region.GENERATOR_SAMPLEMODES, 1); - region.setSample(sample); - layer.getRegions().add(region); - SF2Instrument ins = new SF2Instrument(sf2); - ins.setName("Test Instrument"); - sf2.addInstrument(ins); - SF2InstrumentRegion insregion = new SF2InstrumentRegion(); - insregion.setLayer(layer); - ins.getRegions().add(insregion); - - return sf2; - } - - public SoftTestUtils() throws Exception { - stream = synth.openStream(null, null); - synth.unloadAllInstruments(synth.getDefaultSoundbank()); - synth.loadAllInstruments(createTestSoundBank()); - } - - public void close() throws Exception { - stream.close(); - stream = null; - synth.close(); - synth = null; - } - - public void read(double seconds) throws IOException - { - int bufflen = - stream.getFormat().getFrameSize() * - (int)(stream.getFormat().getFrameRate() * seconds); - while(bufflen != 0) - { - if(bufflen > 1024) - bufflen -= stream.read(tmpbuffer,0,1024); - else - bufflen -= stream.read(tmpbuffer,0, bufflen); - } - } - - public VoiceStatus findVoice(int channel, int note) { - VoiceStatus[] v = synth.getVoiceStatus(); - for (int k = 0; k < v.length; k++) - if(v[k].active) - if(v[k].channel == channel) - if(v[k].note == note) - return v[k]; - return null; - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftSincResampler/Interpolate.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,113 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftSincResampler interpolate method */ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Interpolate { - - private static float getResamplerTestValue(double i) - { - return (float)Math.sin(i / 10.0); - } - - private static void perfectInterpolation(float[] in_offset, float in_end, - float[] startpitch, float pitchstep, float[] out, int[] out_offset, - int out_end) { - - float pitch = startpitch[0]; - float ix = in_offset[0]; - int ox = out_offset[0]; - float ix_end = in_end; - int ox_end = out_end; - if (pitchstep == 0f) { - while (ix < ix_end && ox < ox_end) { - out[ox++] = getResamplerTestValue(ix); - ix += pitch; - } - } else { - while (ix < ix_end && ox < ox_end) { - out[ox++] = getResamplerTestValue(ix); - ix += pitch; - pitch += pitchstep; - } - } - in_offset[0] = ix; - out_offset[0] = ox; - startpitch[0] = pitch; - - } - - private static float testResampler(SoftAbstractResampler resampler, float p_pitch, float p_pitch2) - { - float[] testbuffer = new float[4096]; - float[] testbuffer2 = new float[1024]; - float[] testbuffer3 = new float[1024]; - for (int i = 0; i < testbuffer.length; i++) - testbuffer[i] = getResamplerTestValue(i); - int pads = resampler.getPadding(); - float pitchstep = (p_pitch2 - p_pitch)/1024f; - int[] out_offset2 = {0}; - int[] out_offset3 = {0}; - resampler.interpolate(testbuffer, new float[] {pads}, testbuffer.length - pads, new float[] {p_pitch}, pitchstep, testbuffer2, out_offset2, testbuffer2.length); - perfectInterpolation(new float[] {pads}, testbuffer.length - pads, new float[] {p_pitch}, pitchstep, testbuffer3, out_offset3, testbuffer3.length); - int out_off = out_offset2[0]; - if(out_offset3[0] < out_off) - out_off = out_offset3[0]; - float ac_error = 0; - int counter = 0; - for (int i = pads; i < out_off; i++) { - ac_error += Math.abs(testbuffer2[i] - testbuffer3[i]); - counter++; - } - return ac_error / ((float)counter); - } - - private static void fail(String error) throws Exception - { - throw new RuntimeException(error); - } - - public static void main(String[] args) throws Exception { - SoftSincResampler resampler = new SoftSincResampler(); - float max = testResampler(resampler, 0.3f, 0.3f); - if(max > 0.0001) - fail("Interpolation failed, error="+max); - max = testResampler(resampler, 0.3f, 0.01f); - if(max > 0.0001) - fail("Interpolation failed, error="+max); - max = testResampler(resampler, 1.0f, 0.00f); - if(max > 0.0001) - fail("Interpolation failed, error="+max); - } -} \ No newline at end of file
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/Close.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftSynthesizer close method */ - -import javax.sound.midi.MidiDevice; -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.sampled.*; -import javax.sound.midi.MidiDevice.Info; - -import com.sun.media.sound.*; - -public class Close { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - AudioSynthesizer synth = new SoftSynthesizer(); - synth.openStream(null, null); - synth.close(); - assertTrue(!synth.isOpen()); - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/DummySourceDataLine.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,232 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -import java.util.ArrayList; - -import javax.sound.sampled.AudioFormat; -import javax.sound.sampled.AudioSystem; -import javax.sound.sampled.Control; -import javax.sound.sampled.DataLine; -import javax.sound.sampled.LineListener; -import javax.sound.sampled.LineUnavailableException; -import javax.sound.sampled.SourceDataLine; -import javax.sound.sampled.AudioFormat.Encoding; -import javax.sound.sampled.Control.Type; - -import com.sun.media.sound.AudioFloatConverter; - -/** - * This is a SourceDataLine simulator used for testing SoftSynthesizer - * without using real SourceDataLine / Audio Device. - * - * @author Karl Helgason - */ - -public class DummySourceDataLine implements SourceDataLine { - - private int bufferSize = -1; - - private AudioFormat format = new AudioFormat(44100.0f, 16, 2, true, false); - - private DataLine.Info sourceLineInfo; - - private boolean active = false; - - private long framepos = 0; - - private boolean opened = false; - - private int framesize = 0; - - public DummySourceDataLine() - { - ArrayList<AudioFormat> formats = new ArrayList<AudioFormat>(); - for (int channels = 1; channels <= 2; channels++) { - formats.add(new AudioFormat(Encoding.PCM_SIGNED, - AudioSystem.NOT_SPECIFIED, 8, channels, channels, - AudioSystem.NOT_SPECIFIED, false)); - formats.add(new AudioFormat(Encoding.PCM_UNSIGNED, - AudioSystem.NOT_SPECIFIED, 8, channels, channels, - AudioSystem.NOT_SPECIFIED, false)); - for (int bits = 16; bits < 32; bits += 8) { - formats.add(new AudioFormat(Encoding.PCM_SIGNED, - AudioSystem.NOT_SPECIFIED, bits, channels, channels - * bits / 8, AudioSystem.NOT_SPECIFIED, false)); - formats.add(new AudioFormat(Encoding.PCM_UNSIGNED, - AudioSystem.NOT_SPECIFIED, bits, channels, channels - * bits / 8, AudioSystem.NOT_SPECIFIED, false)); - formats.add(new AudioFormat(Encoding.PCM_SIGNED, - AudioSystem.NOT_SPECIFIED, bits, channels, channels - * bits / 8, AudioSystem.NOT_SPECIFIED, true)); - formats.add(new AudioFormat(Encoding.PCM_UNSIGNED, - AudioSystem.NOT_SPECIFIED, bits, channels, channels - * bits / 8, AudioSystem.NOT_SPECIFIED, true)); - } - formats.add(new AudioFormat(AudioFloatConverter.PCM_FLOAT, - AudioSystem.NOT_SPECIFIED, 32, channels, channels * 4, - AudioSystem.NOT_SPECIFIED, false)); - formats.add(new AudioFormat(AudioFloatConverter.PCM_FLOAT, - AudioSystem.NOT_SPECIFIED, 32, channels, channels * 4, - AudioSystem.NOT_SPECIFIED, true)); - formats.add(new AudioFormat(AudioFloatConverter.PCM_FLOAT, - AudioSystem.NOT_SPECIFIED, 64, channels, channels * 8, - AudioSystem.NOT_SPECIFIED, false)); - formats.add(new AudioFormat(AudioFloatConverter.PCM_FLOAT, - AudioSystem.NOT_SPECIFIED, 64, channels, channels * 8, - AudioSystem.NOT_SPECIFIED, true)); - } - AudioFormat[] formats_array = formats.toArray(new AudioFormat[formats - .size()]); - sourceLineInfo = new DataLine.Info(SourceDataLine.class, - formats_array, AudioSystem.NOT_SPECIFIED, - AudioSystem.NOT_SPECIFIED); - - } - - public void open() throws LineUnavailableException { - open(format); - } - - public void open(AudioFormat format) throws LineUnavailableException { - if (bufferSize == -1) - bufferSize = ((int) (format.getFrameRate() / 2)) - * format.getFrameSize(); - open(format, bufferSize); - } - - public void open(AudioFormat format, int bufferSize) - throws LineUnavailableException { - this.format = format; - this.bufferSize = bufferSize; - this.framesize = format.getFrameSize(); - opened = true; - } - - public boolean isOpen() { - return opened; - } - - public int write(byte[] b, int off, int len) { - if (!isOpen()) - return 0; - if (len % framesize != 0) - throw new IllegalArgumentException( - "Number of bytes does not represent an integral number of sample frames."); - - - int flen = len / framesize; - framepos += flen; - - long time = (long) (flen * (1000.0 / (double) getFormat() - .getSampleRate())); - try { - Thread.sleep(time); - } catch (InterruptedException e) { - e.printStackTrace(); - return 0; - } - - return len; - } - - public int available() { - return 0; - } - - public void drain() { - } - - public void flush() { - } - - public int getBufferSize() { - return bufferSize; - } - - public AudioFormat getFormat() { - return format; - } - - public int getFramePosition() { - return (int) getLongFramePosition(); - } - - public float getLevel() { - return AudioSystem.NOT_SPECIFIED; - } - - public long getLongFramePosition() { - return framepos; - } - - public long getMicrosecondPosition() { - return (long) (getLongFramePosition() * (1000000.0 / (double) getFormat() - .getSampleRate())); - } - - public boolean isActive() { - return active; - } - - public boolean isRunning() { - return active; - } - - public void start() { - active = true; - } - - public void stop() { - active = false; - } - - public void close() { - stop(); - } - - public Control getControl(Type control) { - throw new IllegalArgumentException("Unsupported control type : " - + control); - } - - public Control[] getControls() { - return new Control[0]; - } - - public javax.sound.sampled.Line.Info getLineInfo() { - return sourceLineInfo; - } - - public boolean isControlSupported(Type control) { - return false; - } - - public void addLineListener(LineListener listener) { - } - - public void removeLineListener(LineListener listener) { - } - -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/GetAvailableInstruments.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftSynthesizer getAvailableInstruments method */ - -import javax.sound.midi.MidiDevice; -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.midi.Soundbank; -import javax.sound.sampled.*; -import javax.sound.midi.MidiDevice.Info; - -import com.sun.media.sound.*; - -public class GetAvailableInstruments { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - AudioSynthesizer synth = new SoftSynthesizer(); - synth.openStream(null, null); - Soundbank defsbk = synth.getDefaultSoundbank(); - if(defsbk != null) - { - assertTrue(defsbk.getInstruments().length == synth.getAvailableInstruments().length); - } - synth.close(); - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/GetChannels.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftSynthesizer getChannels method */ - -import javax.sound.midi.MidiChannel; -import javax.sound.midi.MidiDevice; -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.sampled.*; -import javax.sound.midi.MidiDevice.Info; - -import com.sun.media.sound.*; - -public class GetChannels { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - AudioSynthesizer synth = new SoftSynthesizer(); - synth.openStream(null, null); - assertTrue(synth.getChannels() != null); - assertTrue(synth.getChannels().length == 16); - MidiChannel[] channels = synth.getChannels(); - for (int i = 0; i < channels.length; i++) { - assertTrue(channels[i] != null); - } - synth.close(); - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/GetDefaultSoundbank.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftSynthesizer getDefaultSoundbank method */ - -import javax.sound.midi.MidiDevice; -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.sampled.*; -import javax.sound.midi.MidiDevice.Info; - -import com.sun.media.sound.*; - -public class GetDefaultSoundbank { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - AudioSynthesizer synth = new SoftSynthesizer(); - synth.openStream(null, null); - assertTrue(synth.getDefaultSoundbank() != null); - synth.close(); - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/GetDeviceInfo.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftSynthesizer getDeviceInfo method */ - -import javax.sound.midi.MidiDevice; -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.sampled.*; -import javax.sound.midi.MidiDevice.Info; - -import com.sun.media.sound.*; - -public class GetDeviceInfo { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - AudioSynthesizer synth = new SoftSynthesizer(); - assertTrue(synth.getDeviceInfo() != null); - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/GetLatency.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftSynthesizer getLatency method */ - -import javax.sound.midi.MidiDevice; -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.sampled.*; -import javax.sound.midi.MidiDevice.Info; - -import com.sun.media.sound.*; - -public class GetLatency { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - AudioSynthesizer synth = new SoftSynthesizer(); - synth.open(new DummySourceDataLine(), null); - assertTrue(synth.getLatency() != -1); - synth.close(); - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/GetLoadedInstruments.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftSynthesizer getLoadedInstruments method */ - -import javax.sound.midi.MidiDevice; -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.midi.Soundbank; -import javax.sound.sampled.*; -import javax.sound.midi.MidiDevice.Info; - -import com.sun.media.sound.*; - -public class GetLoadedInstruments { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - AudioSynthesizer synth = new SoftSynthesizer(); - synth.openStream(null, null); - Soundbank defsbk = synth.getDefaultSoundbank(); - if(defsbk != null) - { - synth.unloadAllInstruments(defsbk); - synth.loadAllInstruments(defsbk); - assertTrue(synth.getLoadedInstruments().length != 0); - } - synth.close(); - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/GetMaxPolyphony.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftSynthesizer getMaxPolyphony method */ - -import javax.sound.midi.MidiDevice; -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.sampled.*; -import javax.sound.midi.MidiDevice.Info; - -import com.sun.media.sound.*; - -public class GetMaxPolyphony { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - AudioSynthesizer synth = new SoftSynthesizer(); - synth.openStream(null, null); - assertTrue(synth.getMaxPolyphony() != -1); - synth.close(); - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/GetMaxReceivers.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftSynthesizer getMaxReceivers method */ - -import javax.sound.midi.MidiDevice; -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.sampled.*; -import javax.sound.midi.MidiDevice.Info; - -import com.sun.media.sound.*; - -public class GetMaxReceivers { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - AudioSynthesizer synth = new SoftSynthesizer(); - assertTrue(synth.getMaxReceivers() == -1); - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/GetMaxTransmitters.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftSynthesizer getMaxTransmitters method */ - -import javax.sound.midi.MidiDevice; -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.sampled.*; -import javax.sound.midi.MidiDevice.Info; - -import com.sun.media.sound.*; - -public class GetMaxTransmitters { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - AudioSynthesizer synth = new SoftSynthesizer(); - assertTrue(synth.getMaxTransmitters() == 0); - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/GetMicrosecondPosition.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftSynthesizer getMicrosecondPosition method */ - -import java.io.IOException; - -import javax.sound.midi.MidiDevice; -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.sampled.*; -import javax.sound.midi.MidiDevice.Info; - -import com.sun.media.sound.*; - -public class GetMicrosecondPosition { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - AudioSynthesizer synth = new SoftSynthesizer(); - AudioInputStream stream = synth.openStream(null, null); - assertTrue(synth.getMicrosecondPosition() == 0); - AudioFormat format = stream.getFormat(); - byte[] buff = new byte[((int)format.getFrameRate())*format.getFrameSize()];; - stream.read(buff); - assertTrue(Math.abs(synth.getMicrosecondPosition()-1000000) < 10000); - synth.close(); - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/GetReceiver.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftSynthesizer getReceiver method */ - -import javax.sound.midi.MidiDevice; -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.midi.Receiver; -import javax.sound.sampled.*; -import javax.sound.midi.MidiDevice.Info; - -import com.sun.media.sound.*; - -public class GetReceiver { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - AudioSynthesizer synth = new SoftSynthesizer(); - synth.open(new DummySourceDataLine(), null); - Receiver recv = synth.getReceiver(); - assertTrue(recv != null); - Receiver recv2 = synth.getReceiver(); - assertTrue(recv2 != null); - assertTrue(recv2 != recv); - synth.close(); - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/GetReceiver2.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -/* - * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftSynthesizer getReceiver method */ - -import javax.sound.midi.Receiver; -import javax.sound.midi.ShortMessage; - -import com.sun.media.sound.AudioSynthesizer; -import com.sun.media.sound.SoftSynthesizer; - -public class GetReceiver2 { - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - AudioSynthesizer synth = new SoftSynthesizer(); - Receiver recv = synth.getReceiver(); - assertTrue(recv != null); - ShortMessage sm = new ShortMessage(); - sm.setMessage(ShortMessage.NOTE_OFF, 0, 64, 64); - synth.open(new DummySourceDataLine(), null); - recv.send(sm, -1); - synth.close(); - try - { - recv.send(sm, -1); - throw new RuntimeException("Exception not thrown!"); - } - catch(Exception e) - { - // Just checking if exception is thrown - } - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/GetReceivers.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftSynthesizer getReceivers method */ - -import javax.sound.midi.MidiDevice; -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.midi.Receiver; -import javax.sound.sampled.*; -import javax.sound.midi.MidiDevice.Info; - -import com.sun.media.sound.*; - -public class GetReceivers { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - AudioSynthesizer synth = new SoftSynthesizer(); - synth.open(new DummySourceDataLine(), null); - assertTrue(synth.getReceivers().size() == 0); - Receiver recv = synth.getReceiver(); - assertTrue(synth.getReceivers().size() == 1); - recv.close(); - assertTrue(synth.getReceivers().size() == 0); - synth.close(); - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/GetTransmitter.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftSynthesizer getTransmitter method */ - -import javax.sound.midi.MidiDevice; -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.sampled.*; -import javax.sound.midi.MidiDevice.Info; - -import com.sun.media.sound.*; - -public class GetTransmitter { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - AudioSynthesizer synth = new SoftSynthesizer(); - synth.open(new DummySourceDataLine(), null); - try - { - synth.getTransmitter(); - throw new Exception("MidiUnavailableException not thrown!"); - } catch (MidiUnavailableException e) { - } - synth.close(); - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/GetTransmitters.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftSynthesizer getTransmitters method */ - -import javax.sound.midi.MidiDevice; -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.sampled.*; -import javax.sound.midi.MidiDevice.Info; - -import com.sun.media.sound.*; - -public class GetTransmitters { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - AudioSynthesizer synth = new SoftSynthesizer(); - synth.open(new DummySourceDataLine(), null); - assertTrue(synth.getTransmitters().size() == 0); - synth.close(); - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/GetVoiceStatus.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftSynthesizer getVoiceStatus method */ - -import javax.sound.midi.MidiDevice; -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.midi.VoiceStatus; -import javax.sound.sampled.*; -import javax.sound.midi.MidiDevice.Info; - -import com.sun.media.sound.*; - -public class GetVoiceStatus { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - AudioSynthesizer synth = new SoftSynthesizer(); - synth.openStream(null, null); - VoiceStatus[] v = synth.getVoiceStatus(); - assertTrue(v != null); - assertTrue(synth.getChannels().length != synth.getMaxPolyphony()); - synth.close(); - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/ImplicitOpenClose.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,105 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftSynthesizer implicit open/close using getReceiver. */ - -import java.lang.reflect.Field; - -import javax.sound.midi.MidiDevice; -import javax.sound.midi.MidiSystem; -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.midi.Receiver; -import javax.sound.midi.Synthesizer; -import javax.sound.sampled.*; -import javax.sound.midi.MidiDevice.Info; - -import com.sun.media.sound.*; - -public class ImplicitOpenClose { - - public static void main(String[] args) throws Exception { - Field f = SoftSynthesizer.class.getDeclaredField("testline"); - f.setAccessible(true); - f.set(null, new DummySourceDataLine()); - - Synthesizer synth = new SoftSynthesizer(); - - ReferenceCountingDevice rcd = (ReferenceCountingDevice)synth; - - // Test single open/close cycle - - Receiver recv = rcd.getReceiverReferenceCounting(); - if(!synth.isOpen()) - throw new Exception("Synthesizer not open!"); - recv.close(); - if(synth.isOpen()) - throw new Exception("Synthesizer not closed!"); - - // Test using 2 receiver cycle - - Receiver recv1 = rcd.getReceiverReferenceCounting(); - if(!synth.isOpen()) - throw new Exception("Synthesizer not open!"); - Receiver recv2 = rcd.getReceiverReferenceCounting(); - if(!synth.isOpen()) - throw new Exception("Synthesizer not open!"); - - recv2.close(); - if(!synth.isOpen()) - throw new Exception("Synthesizer was closed!"); - recv1.close(); - if(synth.isOpen()) - throw new Exception("Synthesizer not closed!"); - - // Test for explicit,implicit conflict - - synth.open(); - Receiver recv3 = rcd.getReceiverReferenceCounting(); - if(!synth.isOpen()) - throw new Exception("Synthesizer not open!"); - recv3.close(); - if(!synth.isOpen()) - throw new Exception("Synthesizer was closed!"); - synth.close(); - if(synth.isOpen()) - throw new Exception("Synthesizer not closed!"); - - // Test for implicit,explicit conflict - - recv3 = rcd.getReceiverReferenceCounting(); - synth.open(); - if(!synth.isOpen()) - throw new Exception("Synthesizer not open!"); - recv3.close(); - if(!synth.isOpen()) - throw new Exception("Synthesizer was closed!"); - synth.close(); - if(synth.isOpen()) - throw new Exception("Synthesizer not closed!"); - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/IsOpen.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftSynthesizer isOpen method */ - -import javax.sound.midi.MidiDevice; -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.sampled.*; -import javax.sound.midi.MidiDevice.Info; - -import com.sun.media.sound.*; - -public class IsOpen { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - AudioSynthesizer synth = new SoftSynthesizer(); - synth.openStream(null, null); - assertTrue(synth.isOpen()); - synth.close(); - assertTrue(!synth.isOpen()); - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/IsSoundbankSupported.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftSynthesizer isSoundbankSupported method */ - -import javax.sound.midi.Instrument; -import javax.sound.midi.MidiDevice; -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.midi.Soundbank; -import javax.sound.midi.SoundbankResource; -import javax.sound.sampled.*; -import javax.sound.midi.MidiDevice.Info; - -import com.sun.media.sound.*; - -public class IsSoundbankSupported { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - AudioSynthesizer synth = new SoftSynthesizer(); - synth.openStream(null, null); - SimpleSoundbank sbk = new SimpleSoundbank(); - SimpleInstrument ins = new SimpleInstrument(); - sbk.addInstrument(ins); - assertTrue(synth.isSoundbankSupported(sbk)); - Soundbank dummysbk = new Soundbank() - { - public String getName() { - return null; - } - public String getVersion() { - return null; - } - public String getVendor() { - return null; - } - public String getDescription() { - return null; - } - public SoundbankResource[] getResources() { - return null; - } - public Instrument[] getInstruments() { - Instrument ins = new Instrument(null, null, null, null) - { - public Object getData() { - return null; - } - }; - return new Instrument[] {ins}; - } - public Instrument getInstrument(Patch patch) { - return null; - } - }; - assertTrue(!synth.isSoundbankSupported(dummysbk)); - synth.close(); - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/LoadAllInstruments.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftSynthesizer loadAllInstruments method */ - -import javax.sound.midi.MidiDevice; -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.midi.Soundbank; -import javax.sound.sampled.*; -import javax.sound.midi.MidiDevice.Info; - -import com.sun.media.sound.*; - -public class LoadAllInstruments { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - AudioSynthesizer synth = new SoftSynthesizer(); - synth.openStream(null, null); - Soundbank defsbk = synth.getDefaultSoundbank(); - if(defsbk != null) - { - assertTrue(synth.getLoadedInstruments().length == 0); - synth.unloadAllInstruments(defsbk); - SimpleSoundbank sbk = new SimpleSoundbank(); - SimpleInstrument ins = new SimpleInstrument(); - ins.setPatch(new Patch(0,1)); - sbk.addInstrument(ins); - SimpleInstrument ins2 = new SimpleInstrument(); - ins2.setPatch(new Patch(0,2)); - sbk.addInstrument(ins2); - synth.loadAllInstruments(sbk); - assertTrue(synth.getLoadedInstruments().length == 2); - } - synth.close(); - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/LoadInstrument.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftSynthesizer loadAllInstrument method */ - -import javax.sound.midi.MidiDevice; -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.midi.Soundbank; -import javax.sound.sampled.*; -import javax.sound.midi.MidiDevice.Info; - -import com.sun.media.sound.*; - -public class LoadInstrument { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - AudioSynthesizer synth = new SoftSynthesizer(); - synth.openStream(null, null); - Soundbank defsbk = synth.getDefaultSoundbank(); - if(defsbk != null) - { - assertTrue(synth.getLoadedInstruments().length == 0); - synth.unloadAllInstruments(defsbk); - SimpleSoundbank sbk = new SimpleSoundbank(); - SimpleInstrument ins = new SimpleInstrument(); - ins.setPatch(new Patch(0,1)); - sbk.addInstrument(ins); - SimpleInstrument ins2 = new SimpleInstrument(); - ins2.setPatch(new Patch(0,2)); - sbk.addInstrument(ins2); - synth.loadInstrument(ins2); - assertTrue(synth.getLoadedInstruments().length == 1); - } - synth.close(); - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/LoadInstruments.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftSynthesizer loadAllInstruments method */ - -import javax.sound.midi.MidiDevice; -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.midi.Soundbank; -import javax.sound.sampled.*; -import javax.sound.midi.MidiDevice.Info; - -import com.sun.media.sound.*; - -public class LoadInstruments { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - AudioSynthesizer synth = new SoftSynthesizer(); - synth.openStream(null, null); - Soundbank defsbk = synth.getDefaultSoundbank(); - if(defsbk != null) - { - assertTrue(synth.getLoadedInstruments().length == 0); - synth.unloadAllInstruments(defsbk); - SimpleSoundbank sbk = new SimpleSoundbank(); - SimpleInstrument ins = new SimpleInstrument(); - ins.setPatch(new Patch(0,1)); - sbk.addInstrument(ins); - SimpleInstrument ins2 = new SimpleInstrument(); - ins2.setPatch(new Patch(0,2)); - sbk.addInstrument(ins2); - synth.loadInstruments(sbk, new Patch[] {ins2.getPatch()}); - assertTrue(synth.getLoadedInstruments().length == 1); - } - synth.close(); - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/Open.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftSynthesizer open method */ - -import java.lang.reflect.Field; - -import javax.sound.midi.MidiDevice; -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.sampled.*; -import javax.sound.midi.MidiDevice.Info; - -import com.sun.media.sound.*; - -public class Open { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - Field f = SoftSynthesizer.class.getDeclaredField("testline"); - f.setAccessible(true); - f.set(null, new DummySourceDataLine()); - - AudioSynthesizer synth = new SoftSynthesizer(); - synth.open(); - assertTrue(synth.isOpen()); - synth.close(); - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/OpenStream.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftSynthesizer openStream method */ - -import javax.sound.midi.MidiDevice; -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.sampled.*; -import javax.sound.midi.MidiDevice.Info; - -import com.sun.media.sound.*; - -public class OpenStream { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - AudioSynthesizer synth = new SoftSynthesizer(); - synth.openStream(null, null); - assertTrue(synth.isOpen()); - synth.close(); - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/RemapInstrument.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftSynthesizer remapInstrument method */ - -import javax.sound.midi.Instrument; -import javax.sound.midi.MidiDevice; -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.midi.Soundbank; -import javax.sound.sampled.*; -import javax.sound.midi.MidiDevice.Info; - -import com.sun.media.sound.*; - -public class RemapInstrument { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - AudioSynthesizer synth = new SoftSynthesizer(); - synth.openStream(null, null); - Soundbank defsbk = synth.getDefaultSoundbank(); - if(defsbk != null) - { - Instrument ins0 = defsbk.getInstrument(new Patch(0,0)); - Instrument ins10 = defsbk.getInstrument(new Patch(0,10)); - assertTrue(synth.remapInstrument(ins0, ins10)); - Instrument[] loaded = synth.getLoadedInstruments(); - for (int i = 0; i < loaded.length; i++) { - if(loaded[i].getPatch().getBank() == 0) - if(loaded[i].getPatch().getProgram() == 10) - { - assertEquals(loaded[i].getName(), ins0.getName()); - break; - } - } - - } - synth.close(); - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/TestRender1.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,214 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftSynthesizer simple note rendering in many settings */ - -import java.io.File; -import java.io.FileInputStream; -import java.io.BufferedInputStream; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.HashMap; -import java.util.Map; - -import javax.sound.sampled.*; -import javax.sound.midi.*; - -import com.sun.media.sound.*; - -public class TestRender1 { - - public static double send(Sequence seq, Receiver recv) { - float divtype = seq.getDivisionType(); - assert (seq.getDivisionType() == Sequence.PPQ); - Track[] tracks = seq.getTracks(); - int[] trackspos = new int[tracks.length]; - int mpq = 60000000 / 100; - int seqres = seq.getResolution(); - long lasttick = 0; - long curtime = 0; - while (true) { - MidiEvent selevent = null; - int seltrack = -1; - for (int i = 0; i < tracks.length; i++) { - int trackpos = trackspos[i]; - Track track = tracks[i]; - if (trackpos < track.size()) { - MidiEvent event = track.get(trackpos); - if (selevent == null - || event.getTick() < selevent.getTick()) { - selevent = event; - seltrack = i; - } - } - } - if (seltrack == -1) - break; - trackspos[seltrack]++; - long tick = selevent.getTick(); - if (divtype == Sequence.PPQ) - curtime += ((tick - lasttick) * mpq) / seqres; - else - curtime = (long) ((tick * 1000000.0 * divtype) / seqres); - lasttick = tick; - MidiMessage msg = selevent.getMessage(); - if (msg instanceof MetaMessage) { - if (divtype == Sequence.PPQ) - if (((MetaMessage) msg).getType() == 0x51) { - byte[] data = ((MetaMessage) msg).getData(); - mpq = ((data[0] & 0xff) << 16) - | ((data[1] & 0xff) << 8) | (data[2] & 0xff); - } - } else { - if (recv != null) - recv.send(msg, curtime); - } - } - - return curtime / 1000000.0; - } - - public static void test(AudioFormat format, Map<String, Object> info) - throws Exception { - OutputStream nullout = new OutputStream() { - public void write(int b) throws IOException { - } - - public void write(byte[] b, int off, int len) throws IOException { - } - - public void write(byte[] b) throws IOException { - } - }; - render(nullout, format, info); - } - - public static void render(OutputStream os, AudioFormat format, - Map<String, Object> info) throws Exception { - AudioSynthesizer synth = (AudioSynthesizer) new SoftSynthesizer(); - AudioInputStream stream = synth.openStream(format, info); - Receiver recv = synth.getReceiver(); - Soundbank defsbk = synth.getDefaultSoundbank(); - if (defsbk != null) - synth.unloadAllInstruments(defsbk); - synth.loadAllInstruments(soundbank); - - double totalTime = 5; - send(sequence, recv); - - long len = (long) (stream.getFormat().getFrameRate() * (totalTime + 4)); - stream = new AudioInputStream(stream, stream.getFormat(), len); - - long t = System.currentTimeMillis(); - AudioSystem.write(stream, AudioFileFormat.Type.WAVE, os); - t = System.currentTimeMillis() - t; - stream.close(); - } - - - static Soundbank soundbank; - - static Sequence sequence; - - public static InputStream getInputStream(String filename) throws IOException - { - File file = new File(System.getProperty("test.src", "."), filename); - FileInputStream fis = new FileInputStream(file); - return new BufferedInputStream(fis); - } - - public static void main(String[] args) throws Exception { - - InputStream sb = getInputStream("ding.sf2"); - soundbank = MidiSystem.getSoundbank(sb); - sb.close(); - - InputStream si = getInputStream("expresso.mid"); - sequence = MidiSystem.getSequence(si); - si.close(); - - AudioFormat format; - Map<String, Object> info = new HashMap<String, Object>(); - { - format = new AudioFormat(22050, 16, 2, true, false); - test(format, info); - format = new AudioFormat(44100, 16, 2, true, false); - test(format, info); - } - { - format = new AudioFormat(44100, 8, 2, true, false); - test(format, info); - format = new AudioFormat(44100, 16, 2, true, false); - test(format, info); - format = new AudioFormat(44100, 24, 2, true, false); - test(format, info); - } - { - format = new AudioFormat(44100, 16, 1, true, false); - test(format, info); - format = new AudioFormat(44100, 16, 2, true, false); - test(format, info); - } - { - format = new AudioFormat(44100, 16, 2, true, false); - - info.clear(); - info.put("control rate", 100f); - test(format, info); - info.clear(); - info.put("control rate", 147f); - test(format, info); - - } - { - format = new AudioFormat(44100, 16, 2, true, false); - - info.clear(); - info.put("interpolation", "point"); - test(format, info); - info.clear(); - info.put("interpolation", "linear"); - test(format, info); - info.clear(); - info.put("interpolation", "cubic"); - test(format, info); - } - { - format = new AudioFormat(44100, 16, 2, true, false); - info.clear(); - info.put("max polyphony", 4); - test(format, info); - info.clear(); - info.put("max polyphony", 16); - test(format, info); - info.clear(); - - } - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/UnloadAllInstruments.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftSynthesizer unloadAllInstruments method */ - -import javax.sound.midi.MidiDevice; -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.midi.Soundbank; -import javax.sound.sampled.*; -import javax.sound.midi.MidiDevice.Info; - -import com.sun.media.sound.*; - -public class UnloadAllInstruments { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - AudioSynthesizer synth = new SoftSynthesizer(); - synth.openStream(null, null); - Soundbank defsbk = synth.getDefaultSoundbank(); - if(defsbk != null) - { - assertTrue(synth.getLoadedInstruments().length == 0); - synth.unloadAllInstruments(defsbk); - assertTrue(synth.getAvailableInstruments().length == 0); - synth.loadAllInstruments(defsbk); - assertTrue(synth.getLoadedInstruments().length != 0); - synth.unloadAllInstruments(defsbk); - assertTrue(synth.getLoadedInstruments().length == 0); - } - synth.close(); - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/UnloadInstrument.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftSynthesizer unloadInstrument method */ - -import javax.sound.midi.MidiDevice; -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.midi.Soundbank; -import javax.sound.sampled.*; -import javax.sound.midi.MidiDevice.Info; - -import com.sun.media.sound.*; - -public class UnloadInstrument { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - AudioSynthesizer synth = new SoftSynthesizer(); - synth.openStream(null, null); - Soundbank defsbk = synth.getDefaultSoundbank(); - if(defsbk != null) - { - assertTrue(synth.getLoadedInstruments().length == 0); - synth.unloadAllInstruments(defsbk); - SimpleSoundbank sbk = new SimpleSoundbank(); - SimpleInstrument ins = new SimpleInstrument(); - ins.setPatch(new Patch(0,1)); - sbk.addInstrument(ins); - SimpleInstrument ins2 = new SimpleInstrument(); - ins2.setPatch(new Patch(0,2)); - sbk.addInstrument(ins2); - synth.loadInstrument(ins2); - assertTrue(synth.getLoadedInstruments().length == 1); - synth.unloadInstrument(ins2); - assertTrue(synth.getLoadedInstruments().length == 0); - } - synth.close(); - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftSynthesizer/UnloadInstruments.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftSynthesizer unloadInstruments method */ - -import javax.sound.midi.MidiDevice; -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.midi.Soundbank; -import javax.sound.sampled.*; -import javax.sound.midi.MidiDevice.Info; - -import com.sun.media.sound.*; - -public class UnloadInstruments { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - AudioSynthesizer synth = new SoftSynthesizer(); - synth.openStream(null, null); - Soundbank defsbk = synth.getDefaultSoundbank(); - if(defsbk != null) - { - assertTrue(synth.getLoadedInstruments().length == 0); - synth.unloadAllInstruments(defsbk); - SimpleSoundbank sbk = new SimpleSoundbank(); - SimpleInstrument ins = new SimpleInstrument(); - ins.setPatch(new Patch(0,1)); - sbk.addInstrument(ins); - SimpleInstrument ins2 = new SimpleInstrument(); - ins2.setPatch(new Patch(0,2)); - sbk.addInstrument(ins2); - synth.loadInstrument(ins2); - assertTrue(synth.getLoadedInstruments().length == 1); - synth.unloadInstruments(sbk, new Patch[] {ins2.getPatch()}); - assertTrue(synth.getLoadedInstruments().length == 0); - } - synth.close(); - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftTuning/GetName.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftTuning getName method */ - -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class GetName { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftTuning tuning = new SoftTuning(); - tuning.setName("custom"); - assertEquals(tuning.getName(), "custom"); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftTuning/GetTuning.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftTuning getTuning method */ - -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class GetTuning { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftTuning tuning = new SoftTuning(); - double[] tunings = tuning.getTuning(); - for (int i = 0; i < tunings.length; i++) { - assertTrue(Math.abs(tunings[i]-i*100) < 0.00001); - } - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftTuning/GetTuningInt.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftTuning getTuning(int) method */ - -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class GetTuningInt { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftTuning tuning = new SoftTuning(); - assertTrue(Math.abs(tuning.getTuning(36)-3600) < 0.00001); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftTuning/Load1.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,101 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftTuning load method */ - -import java.io.UnsupportedEncodingException; - -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Load1 { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - // http://www.midi.org/about-midi/tuning.shtml - // 0x01 BULK TUNING DUMP - SoftTuning tuning = new SoftTuning(); - byte[] name; - name = "Testing123 ".getBytes("ascii"); - - int[] msg = new int[24+3*128]; - int[] head = {0xf0,0x7e,0x7f,0x08,0x01,0x00}; - int ox = 0; - for (int i = 0; i < head.length; i++) - msg[ox++] = head[i]; - for (int i = 0; i < name.length; i++) - msg[ox++] = name[i]; - for (int i = 0; i < 128; i++) { - msg[ox++] = i; - msg[ox++] = 64; - msg[ox++] = 0; - } - - // Calc checksum - int x = msg[1] & 0xFF; // 7E - x = x ^ (msg[2] & 0xFF); // <device ID> - x = x ^ (msg[4] & 0xFF); // nn - x = x ^ (msg[5] & 0xFF); // tt - for (int i = 22; i < msg.length - 2; i++) - x = x ^ (msg[i] & 0xFF); - msg[ox++] = (x & 127); - - msg[ox++] = 0xf7; - byte[] bmsg = new byte[msg.length]; - for (int i = 0; i < bmsg.length; i++) - bmsg[i] = (byte)msg[i]; - - tuning.load(bmsg); - assertEquals(tuning.getName(), "Testing123 "); - double[] tunings = tuning.getTuning(); - for (int i = 0; i < tunings.length; i++) - assertTrue(Math.abs(tunings[i]-(i*100 + 50)) < 0.00001); - - // Check if tuning fails if checksum is wrong - /* - msg[msg.length - 2] += 10; - for (int i = 0; i < bmsg.length; i++) - bmsg[i] = (byte)msg[i]; - tuning = new SoftTuning(); - tuning.load(bmsg); - assertTrue(!tuning.getName().equals("Testing123 ")); - */ - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftTuning/Load2.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftTuning load method */ - -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Load2 { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - // http://www.midi.org/about-midi/tuning.shtml - // 0x02 SINGLE NOTE TUNING CHANGE (REAL-TIME) - SoftTuning tuning = new SoftTuning(); - int[] msg = {0xf0,0x7f,0x7f,0x08,0x02,0x10,0x02, - 36,36,64,0, - 40,70,0,0, - 0xf7}; - byte[] bmsg = new byte[msg.length]; - for (int i = 0; i < bmsg.length; i++) - bmsg[i] = (byte)msg[i]; - tuning.load(bmsg); - double[] tunings = tuning.getTuning(); - for (int i = 0; i < tunings.length; i++) { - if(i == 36) - assertTrue(Math.abs(tunings[i]-3650)< 0.00001); - else if(i == 40) - assertTrue(Math.abs(tunings[i]-7000) < 0.00001); - else - assertTrue(Math.abs(tunings[i]-i*100) < 0.00001); - } - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftTuning/Load4.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,104 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftTuning load method */ - -import java.io.UnsupportedEncodingException; - -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Load4 { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - // http://www.midi.org/about-midi/tuning_extens.shtml - // 0x04 KEY-BASED TUNING DUMP - SoftTuning tuning = new SoftTuning(); - byte[] name; - name = "Testing123 ".getBytes("ascii"); - - int[] msg = new int[25+3*128]; - int[] head = {0xf0,0x7e,0x7f,0x08,0x04,0x00,0x00}; - int ox = 0; - for (int i = 0; i < head.length; i++) - msg[ox++] = head[i]; - for (int i = 0; i < name.length; i++) - msg[ox++] = name[i]; - for (int i = 0; i < 128; i++) { - msg[ox++] = i; - msg[ox++] = 64; - msg[ox++] = 0; - } - - // Calc checksum - int x = msg[1] & 0xFF; - for (int i = 2; i < msg.length - 2; i++) - x = x ^ (msg[i] & 0xFF); - msg[ox++] = (x & 127); - - msg[ox++] = 0xf7; - byte[] bmsg = new byte[msg.length]; - for (int i = 0; i < bmsg.length; i++) - bmsg[i] = (byte)msg[i]; - - tuning.load(bmsg); - assertEquals(tuning.getName(), "Testing123 "); - double[] tunings = tuning.getTuning(); - for (int i = 0; i < tunings.length; i++) - assertTrue(Math.abs(tunings[i]-(i*100 + 50)) < 0.00001); - - // Check if tuning fails if checksum is wrong - msg[msg.length - 2] += 10; - for (int i = 0; i < bmsg.length; i++) - bmsg[i] = (byte)msg[i]; - tuning = new SoftTuning(); - tuning.load(bmsg); - assertTrue(!tuning.getName().equals("Testing123 ")); - - // Check if tuning fails if checksum is wrong - msg[msg.length - 2] += 10; - for (int i = 0; i < bmsg.length; i++) - bmsg[i] = (byte)msg[i]; - tuning = new SoftTuning(); - tuning.load(bmsg); - assertTrue(!tuning.getName().equals("Testing123 ")); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftTuning/Load5.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftTuning load method */ - -import java.io.UnsupportedEncodingException; - -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Load5 { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - // http://www.midi.org/about-midi/tuning_extens.shtml - // 0x05 SCALE/OCTAVE TUNING DUMP, 1 byte format - SoftTuning tuning = new SoftTuning(); - - byte[] name; - name = "Testing123 ".getBytes("ascii"); - int[] msg = {0xf0,0x7e,0x7f,0x08,0x05,0,0, - name[0],name[1],name[2],name[3],name[4],name[5],name[6], - name[7],name[8],name[9],name[10],name[11],name[12],name[13], - name[14],name[15], - 5,10,15,20,25,30,35,40,45,50,51,52,0, - 0xf7}; - // Calc checksum - int x = msg[1] & 0xFF; - for (int i = 2; i < msg.length - 2; i++) - x = x ^ (msg[i] & 0xFF); - msg[msg.length-2] = (x & 127); - - int[] oct = {5,10,15,20,25,30,35,40,45,50,51,52}; - byte[] bmsg = new byte[msg.length]; - for (int i = 0; i < bmsg.length; i++) - bmsg[i] = (byte)msg[i]; - tuning.load(bmsg); - double[] tunings = tuning.getTuning(); - for (int i = 0; i < tunings.length; i++) - assertTrue(Math.abs(tunings[i]-(i*100 + (oct[i%12]-64))) < 0.00001); - - // Check if tuning fails if checksum is wrong - msg[msg.length - 2] += 10; - for (int i = 0; i < bmsg.length; i++) - bmsg[i] = (byte)msg[i]; - tuning = new SoftTuning(); - tuning.load(bmsg); - assertTrue(!tuning.getName().equals("Testing123 ")); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftTuning/Load6.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftTuning load method */ - -import java.io.UnsupportedEncodingException; - -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Load6 { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - // http://www.midi.org/about-midi/tuning_extens.shtml - // 0x06 SCALE/OCTAVE TUNING DUMP, 2 byte format - SoftTuning tuning = new SoftTuning(); - - byte[] name; - name = "Testing123 ".getBytes("ascii"); - int[] msg = {0xf0,0x7e,0x7f,0x08,0x06,0,0, - name[0],name[1],name[2],name[3],name[4],name[5],name[6], - name[7],name[8],name[9],name[10],name[11],name[12],name[13], - name[14],name[15], - 5,10,15,20,25,30,35,40,45,50,51,52, - 5,10,15,20,25,30,35,40,45,50,51,52, - 0,0xf7}; - // Calc checksum - int x = msg[1] & 0xFF; - for (int i = 2; i < msg.length - 2; i++) - x = x ^ (msg[i] & 0xFF); - msg[msg.length-2] = (x & 127); - - int[] oct = {5,10,15,20,25,30,35,40,45,50,51,52,5,10,15,20,25,30,35,40,45,50,51,52}; - byte[] bmsg = new byte[msg.length]; - for (int i = 0; i < bmsg.length; i++) - bmsg[i] = (byte)msg[i]; - tuning.load(bmsg); - double[] tunings = tuning.getTuning(); - for (int i = 0; i < tunings.length; i++) - { - double c = (oct[(i%12)*2]*128 + oct[(i%12)*2+1] -8192)*(100.0/8192.0); - assertTrue(Math.abs(tunings[i]-(i*100 + (c))) < 0.00001); - } - - // Check if tuning fails if checksum is wrong - msg[msg.length - 2] += 10; - for (int i = 0; i < bmsg.length; i++) - bmsg[i] = (byte)msg[i]; - tuning = new SoftTuning(); - tuning.load(bmsg); - assertTrue(!tuning.getName().equals("Testing123 ")); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftTuning/Load7.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftTuning load method */ - -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Load7 { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - // http://www.midi.org/about-midi/tuning_extens.shtml - // 0x07 SINGLE NOTE TUNING CHANGE (NON REAL-TIME) (BANK) - SoftTuning tuning = new SoftTuning(); - int[] msg = {0xf0,0x7f,0x7f,0x08,0x07,0x00,0x00,0x02, - 36,36,64,0, - 40,70,0,0, - 0xf7}; - byte[] bmsg = new byte[msg.length]; - for (int i = 0; i < bmsg.length; i++) - bmsg[i] = (byte)msg[i]; - tuning.load(bmsg); - double[] tunings = tuning.getTuning(); - for (int i = 0; i < tunings.length; i++) { - if(i == 36) - assertTrue(Math.abs(tunings[i]-3650)< 0.00001); - else if(i == 40) - assertTrue(Math.abs(tunings[i]-7000) < 0.00001); - else - assertTrue(Math.abs(tunings[i]-i*100) < 0.00001); - } - - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftTuning/Load8.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftTuning load method */ - -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Load8 { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - // http://www.midi.org/about-midi/tuning-scale.shtml - // 0x08 scale/octave tuning 1-byte form (Non Real-Time/REAL-TIME) - SoftTuning tuning = new SoftTuning(); - int[] msg = {0xf0,0x7f,0x7f,0x08,0x08,0x03,0x7f,0x7f, - 5,10,15,20,25,30,35,40,45,50,51,52, - 0xf7}; - int[] oct = {5,10,15,20,25,30,35,40,45,50,51,52}; - byte[] bmsg = new byte[msg.length]; - for (int i = 0; i < bmsg.length; i++) - bmsg[i] = (byte)msg[i]; - tuning.load(bmsg); - double[] tunings = tuning.getTuning(); - for (int i = 0; i < tunings.length; i++) - assertTrue(Math.abs(tunings[i]-(i*100 + (oct[i%12]-64))) < 0.00001); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftTuning/Load9.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftTuning load method */ - -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class Load9 { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - // http://www.midi.org/about-midi/tuning-scale.shtml - // 0x09 scale/octave tuning 2-byte form (Non Real-Time/REAL-TIME) - SoftTuning tuning = new SoftTuning(); - int[] msg = {0xf0,0x7f,0x7f,0x08,0x09,0x03,0x7f,0x7f, - 5,10,15,20,25,30,35,40,45,50,51,52, - 5,10,15,20,25,30,35,40,45,50,51,52, - 0xf7}; - int[] oct = {5,10,15,20,25,30,35,40,45,50,51,52,5,10,15,20,25,30,35,40,45,50,51,52}; - byte[] bmsg = new byte[msg.length]; - for (int i = 0; i < bmsg.length; i++) - bmsg[i] = (byte)msg[i]; - tuning.load(bmsg); - double[] tunings = tuning.getTuning(); - for (int i = 0; i < tunings.length; i++) - { - double c = (oct[(i%12)*2]*128 + oct[(i%12)*2+1] -8192)*(100.0/8192.0); - assertTrue(Math.abs(tunings[i]-(i*100 + (c))) < 0.00001); - } - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftTuning/NewSoftTuning.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftTuning constructor */ - -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class NewSoftTuning { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftTuning tuning = new SoftTuning(); - double[] tunings = tuning.getTuning(); - for (int i = 0; i < tunings.length; i++) { - assertTrue(Math.abs(tunings[i]-i*100) < 0.00001); - } - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftTuning/NewSoftTuningByteArray.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftTuning constructor */ - -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class NewSoftTuningByteArray { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - // RealTime: Scale/Octave tuning in 1-byte format - int[] msg = {0xf0,0x7f,0x7f,0x08,0x08,0x03,0x7f,0x7f, - 5,10,15,20,25,30,35,40,45,50,51,52, - 0xf7}; - int[] oct = {5,10,15,20,25,30,35,40,45,50,51,52}; - byte[] bmsg = new byte[msg.length]; - for (int i = 0; i < bmsg.length; i++) - bmsg[i] = (byte)msg[i]; - SoftTuning tuning = new SoftTuning(bmsg); - double[] tunings = tuning.getTuning(); - for (int i = 0; i < tunings.length; i++) - assertTrue(Math.abs(tunings[i]-(i*100 + (oct[i%12]-64))) < 0.00001); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftTuning/NewSoftTuningPatch.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftTuning constructor */ - -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class NewSoftTuningPatch { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - SoftTuning tuning = new SoftTuning(new Patch(8,32)); - assertEquals(tuning.getPatch().getProgram(), 32); - assertEquals(tuning.getPatch().getBank(), 8); - } -}
--- a/overlays/openjdk/jdk/test/com/sun/media/sound/SoftTuning/NewSoftTuningPatchByteArray.java Wed Apr 28 14:20:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* @test - @summary Test SoftTuning constructor */ - -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Patch; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; - -public class NewSoftTuningPatchByteArray { - - private static void assertEquals(Object a, Object b) throws Exception - { - if(!a.equals(b)) - throw new RuntimeException("assertEquals fails!"); - } - - private static void assertTrue(boolean value) throws Exception - { - if(!value) - throw new RuntimeException("assertTrue fails!"); - } - - public static void main(String[] args) throws Exception { - // RealTime: Scale/Octave tuning in 1-byte format - int[] msg = {0xf0,0x7f,0x7f,0x08,0x08,0x03,0x7f,0x7f, - 5,10,15,20,25,30,35,40,45,50,51,52, - 0xf7}; - int[] oct = {5,10,15,20,25,30,35,40,45,50,51,52}; - byte[] bmsg = new byte[msg.length]; - for (int i = 0; i < bmsg.length; i++) - bmsg[i] = (byte)msg[i]; - SoftTuning tuning = new SoftTuning(new Patch(8,32),bmsg); - double[] tunings = tuning.getTuning(); - for (int i = 0; i < tunings.length; i++) - assertTrue(Math.abs(tunings[i]-(i*100 + (oct[i%12]-64))) < 0.00001); - assertEquals(tuning.getPatch().getProgram(), 32); - assertEquals(tuning.getPatch().getBank(), 8); - } -}