本文整理汇总了Java中com.jme3.audio.AudioKey类的典型用法代码示例。如果您正苦于以下问题:Java AudioKey类的具体用法?Java AudioKey怎么用?Java AudioKey使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AudioKey类属于com.jme3.audio包,在下文中一共展示了AudioKey类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: processOpen
import com.jme3.audio.AudioKey; //导入依赖的package包/类
/**
* Open this audio data in the audio viewer.
*/
@FXThread
protected void processOpen() {
final AudioKey element = getPropertyValue();
if (element == null) return;
final String assetPath = element.getName();
if (StringUtils.isEmpty(assetPath)) return;
final Path assetFile = Paths.get(assetPath);
final Path realFile = notNull(getRealFile(assetFile));
if (!Files.exists(realFile)) return;
final RequestedOpenFileEvent event = new RequestedOpenFileEvent();
event.setFile(realFile);
FX_EVENT_MANAGER.notify(event);
}
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:22,代码来源:AudioKeyPropertyControl.java
示例2: process
import com.jme3.audio.AudioKey; //导入依赖的package包/类
@Override
@FXThread
protected void process() {
super.process();
final AudioTreeNode audioModelNode = (AudioTreeNode) getNode();
final AudioNode audioNode = audioModelNode.getElement();
final AssetManager assetManager = EDITOR.getAssetManager();
EXECUTOR_MANAGER.addJMETask(() -> {
final AudioKey audioKey = AudioNodeUtils.getAudioKey(audioNode);
final AudioData audioData = assetManager.loadAudio(audioKey);
AudioNodeUtils.updateData(audioNode, audioData, audioKey);
audioNode.play();
});
}
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:21,代码来源:PlayAudioNodeAction.java
示例3: load
import com.jme3.audio.AudioKey; //导入依赖的package包/类
public Object load(AssetInfo info) throws IOException {
if (!(info.getKey() instanceof AudioKey)){
throw new IllegalArgumentException("Audio assets must be loaded using an AudioKey");
}
AudioKey key = (AudioKey) info.getKey();
boolean readStream = key.isStream();
boolean streamCache = key.useStreamCache();
InputStream in = null;
try {
in = info.openStream();
AudioData data = load(in, readStream, streamCache);
if (data instanceof AudioStream){
// audio streams must remain open
in = null;
}
return data;
} finally {
if (in != null){
in.close();
}
}
}
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:26,代码来源:OGGLoader.java
示例4: load
import com.jme3.audio.AudioKey; //导入依赖的package包/类
public Object load(AssetInfo info) throws IOException {
AudioData data;
InputStream inputStream = null;
try {
inputStream = info.openStream();
data = load(inputStream, ((AudioKey)info.getKey()).isStream());
if (data instanceof AudioStream){
inputStream = null;
}
return data;
} finally {
if (inputStream != null){
inputStream.close();
}
}
}
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:17,代码来源:WAVLoader.java
示例5: loadImpl
import com.jme3.audio.AudioKey; //导入依赖的package包/类
/**
* Load the audio data.
*
* @param audioData the audio data.
* @param audioKey the audio key.
*/
@JMEThread
private void loadImpl(@NotNull final AudioData audioData, @NotNull final AudioKey audioKey) {
removeAudioNode();
setAudioData(audioData);
setAudioKey(audioKey);
final Node stateNode = getStateNode();
final AudioNode audioNode = new AudioNode(audioData, audioKey);
audioNode.setPositional(false);
stateNode.attachChild(audioNode);
setAudioNode(audioNode);
}
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:21,代码来源:AudioViewer3DState.java
示例6: AudioKeyPropertyControl
import com.jme3.audio.AudioKey; //导入依赖的package包/类
public AudioKeyPropertyControl(@Nullable final AudioKey element, @NotNull final String paramName,
@NotNull final C changeConsumer) {
super(element, paramName, changeConsumer);
setOnDragOver(this::handleDragOverEvent);
setOnDragDropped(this::handleDragDroppedEvent);
setOnDragExited(this::handleDragExitedEvent);
}
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:8,代码来源:AudioKeyPropertyControl.java
示例7: addAudioData
import com.jme3.audio.AudioKey; //导入依赖的package包/类
/**
* Add the new audio data.
*
* @param file the audio file.
*/
@FXThread
private void addAudioData(@NotNull final Path file) {
final Path assetFile = notNull(getAssetFile(file));
final AudioKey audioKey = new AudioKey(toAssetPath(assetFile));
changed(audioKey, getPropertyValue());
setIgnoreListener(true);
try {
reload();
} finally {
setIgnoreListener(false);
}
}
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:20,代码来源:AudioKeyPropertyControl.java
示例8: reload
import com.jme3.audio.AudioKey; //导入依赖的package包/类
@Override
@FXThread
protected void reload() {
final AudioKey element = getPropertyValue();
final Label audioKeyLabel = getAudioKeyLabel();
audioKeyLabel.setText(element == null || StringUtils.isEmpty(element.getName()) ? NO_AUDIO : element.getName());
}
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:8,代码来源:AudioKeyPropertyControl.java
示例9: openFile
import com.jme3.audio.AudioKey; //导入依赖的package包/类
@Override
@FXThread
public void openFile(@NotNull final Path file) {
super.openFile(file);
final Path assetFile = notNull(EditorUtil.getAssetFile(file));
final String assetPath = EditorUtil.toAssetPath(assetFile);
final AudioKey audioKey = new AudioKey(assetPath);
final AssetManager assetManager = EDITOR.getAssetManager();
final AudioData audioData = assetManager.loadAudio(audioKey);
final float duration = audioData.getDuration();
final int bitsPerSample = audioData.getBitsPerSample();
final int channels = audioData.getChannels();
final AudioData.DataType dataType = audioData.getDataType();
final int sampleRate = audioData.getSampleRate();
final AudioViewer3DState editorAppState = getEditorAppState();
editorAppState.load(audioData, audioKey);
getChannelsField().setText(String.valueOf(channels));
getDurationField().setText(String.valueOf(duration));
getDataTypeField().setText(String.valueOf(dataType));
getSampleRateField().setText(String.valueOf(sampleRate));
getBitsPerSampleField().setText(String.valueOf(bitsPerSample));
}
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:28,代码来源:AudioViewerEditor.java
示例10: updateData
import com.jme3.audio.AudioKey; //导入依赖的package包/类
/**
* Update audio data for an audio node.
*
* @param audioNode the audio node.
* @param audioData the audio data.
* @param audioKey the audio key.
*/
@JMEThread
public static void updateData(@NotNull final AudioNode audioNode, @Nullable final AudioData audioData,
@Nullable final AudioKey audioKey) {
try {
AUDIO_DATA_FIELD.set(audioNode, audioData);
AUDIO_KEY_FIELD.set(audioNode, audioKey);
} catch (final IllegalAccessException e) {
throw new RuntimeException(e);
}
}
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:18,代码来源:AudioNodeUtils.java
示例11: getAudioKey
import com.jme3.audio.AudioKey; //导入依赖的package包/类
/**
* Get an audio key from the audio node.
*
* @param audioNode the audio node.
* @return the audio key.
*/
@Nullable
@FromAnyThread
public static AudioKey getAudioKey(@NotNull final AudioNode audioNode) {
try {
return (AudioKey) AUDIO_KEY_FIELD.get(audioNode);
} catch (final IllegalAccessException e) {
throw new RuntimeException(e);
}
}
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:16,代码来源:AudioNodeUtils.java
示例12: load
import com.jme3.audio.AudioKey; //导入依赖的package包/类
public Object load(AssetInfo info) throws IOException {
InputStream in=info.openStream();
try{
FlacAudioFileReader audio_file_reader=new FlacAudioFileReader();
AudioInputStream audio_input_stream=audio_file_reader.getAudioInputStream(in);
AudioFormat sourceFormat=audio_input_stream.getFormat();
AudioFormat targetFormat = new AudioFormat(
AudioFormat.Encoding.PCM_SIGNED,
(int)(sourceFormat.getSampleRate()),
sourceFormat.getSampleSizeInBits(),
sourceFormat.getChannels(),
sourceFormat.getChannels() * (sourceFormat.getSampleSizeInBits() / 8),
(int)(sourceFormat.getSampleRate()),
sourceFormat.isBigEndian());
FlacFormatConversionProvider flacCoverter = new FlacFormatConversionProvider();
audio_input_stream = flacCoverter.getAudioInputStream(targetFormat, audio_input_stream);
return ((AudioKey)info.getKey()).isStream()
?toJMEAudioStream(audio_input_stream)
:toJMEAudioBuffer(audio_input_stream);
}catch(Exception e){
e.printStackTrace();
}finally{
in.close();
}
return null;
}
开发者ID:riccardobl,项目名称:jme3-plugin-flac-loader,代码行数:34,代码来源:FLACLoader.java
示例13: deleteAudioData
import com.jme3.audio.AudioKey; //导入依赖的package包/类
@Override
public void deleteAudioData(AudioData ad) {
if (ad instanceof AndroidAudioData) {
AndroidAudioData audioData = (AndroidAudioData) ad;
if (audioData.getAssetKey() instanceof AudioKey) {
AudioKey assetKey = (AudioKey) audioData.getAssetKey();
if (assetKey.isStream()) {
for (AudioNode src : musicPlaying.keySet()) {
if (src.getAudioData() == ad) {
MediaPlayer mp = musicPlaying.get(src);
mp.stop();
mp.release();
musicPlaying.remove(src);
src.setStatus(Status.Stopped);
src.setChannel(-1);
break;
}
}
} else {
if (audioData.getId() > 0) {
soundPool.unload(audioData.getId());
}
audioData.setId(0);
}
}
} else {
throw new IllegalArgumentException("AudioData is not of type AndroidAudioData in deleteAudioData");
}
}
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:31,代码来源:AndroidAudioRenderer.java
示例14: getAudioKey
import com.jme3.audio.AudioKey; //导入依赖的package包/类
/**
* @return the audio key.
*/
@JMEThread
private @NotNull AudioKey getAudioKey() {
return notNull(audioKey);
}
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:8,代码来源:AudioViewer3DState.java
示例15: setAudioKey
import com.jme3.audio.AudioKey; //导入依赖的package包/类
/**
* @param audioKey the audio key.
*/
@JMEThread
private void setAudioKey(@NotNull final AudioKey audioKey) {
this.audioKey = audioKey;
}
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:8,代码来源:AudioViewer3DState.java
示例16: load
import com.jme3.audio.AudioKey; //导入依赖的package包/类
public Object load(AssetInfo info) throws IOException {
if (!(info.getKey() instanceof AudioKey)){
throw new IllegalArgumentException("Audio assets must be loaded using an AudioKey");
}
AudioKey key = (AudioKey) info.getKey();
boolean readStream = key.isStream();
boolean streamCache = key.useStreamCache();
InputStream in = info.openStream();
if (readStream && streamCache){
oggStream = new CachedOggStream(in);
}else{
oggStream = new UncachedOggStream(in);
}
Collection<LogicalOggStream> streams = oggStream.getLogicalStreams();
loStream = streams.iterator().next();
// if (loStream == null){
// throw new IOException("OGG File does not contain vorbis audio stream");
// }
vorbisStream = new VorbisStream(loStream);
streamHdr = vorbisStream.getIdentificationHeader();
// commentHdr = vorbisStream.getCommentHeader();
if (!readStream){
AudioBuffer audioBuffer = new AudioBuffer();
audioBuffer.setupFormat(streamHdr.getChannels(), 16, streamHdr.getSampleRate());
audioBuffer.updateData(readToBuffer());
return audioBuffer;
}else{
AudioStream audioStream = new AudioStream();
audioStream.setupFormat(streamHdr.getChannels(), 16, streamHdr.getSampleRate());
// might return -1 if unknown
float streamDuration = computeStreamDuration();
audioStream.updateData(readToStream(), streamDuration);
return audioStream;
}
}
开发者ID:mleoking,项目名称:PhET,代码行数:44,代码来源:OGGLoader.java
示例17: load
import com.jme3.audio.AudioKey; //导入依赖的package包/类
public Object load(AssetInfo info) throws IOException {
this.in = new LittleEndien(info.openStream());
int sig = in.readInt();
if (sig != i_RIFF)
throw new IOException("File is not a WAVE file");
// skip size
in.readInt();
if (in.readInt() != i_WAVE)
throw new IOException("WAVE File does not contain audio");
readStream = ((AudioKey)info.getKey()).isStream();
if (readStream){
audioStream = new AudioStream();
audioData = audioStream;
}else{
audioBuffer = new AudioBuffer();
audioData = audioBuffer;
}
while (true) {
int type = in.readInt();
int len = in.readInt();
switch (type) {
case i_fmt:
readFormatChunk(len);
break;
case i_data:
// Compute duration based on data chunk size
duration = len / bytesPerSec;
if (readStream) {
readDataChunkForStream(len);
} else {
readDataChunkForBuffer(len);
}
return audioData;
default:
int skipped = in.skipBytes(len);
if (skipped <= 0) {
return null;
}
break;
}
}
}
开发者ID:mleoking,项目名称:PhET,代码行数:51,代码来源:WAVLoader.java
示例18: loadAudio
import com.jme3.audio.AudioKey; //导入依赖的package包/类
public AudioData loadAudio(AudioKey key){
return (AudioData) loadAsset(key);
}
开发者ID:mleoking,项目名称:PhET,代码行数:4,代码来源:DesktopAssetManager.java
示例19: loadAudio
import com.jme3.audio.AudioKey; //导入依赖的package包/类
public AudioData loadAudio(AudioKey key) {
return new MockAudioData();
}
开发者ID:samynk,项目名称:DArtE,代码行数:4,代码来源:MockAssetManager.java
示例20: loadAudio
import com.jme3.audio.AudioKey; //导入依赖的package包/类
@Override
public AudioData loadAudio(AudioKey key) {return wraps.loadAudio(key);}
开发者ID:GSam,项目名称:Game-Project,代码行数:3,代码来源:GameTest.java
注:本文中的com.jme3.audio.AudioKey类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论