当前位置: 首页>>代码示例>>Java>>正文


Java AudioKey.isStream方法代码示例

本文整理汇总了Java中com.jme3.audio.AudioKey.isStream方法的典型用法代码示例。如果您正苦于以下问题:Java AudioKey.isStream方法的具体用法?Java AudioKey.isStream怎么用?Java AudioKey.isStream使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jme3.audio.AudioKey的用法示例。


在下文中一共展示了AudioKey.isStream方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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

示例2: 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

示例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 = 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


注:本文中的com.jme3.audio.AudioKey.isStream方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。