• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Audio类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.gwt.media.client.Audio的典型用法代码示例。如果您正苦于以下问题:Java Audio类的具体用法?Java Audio怎么用?Java Audio使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Audio类属于com.google.gwt.media.client包,在下文中一共展示了Audio类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: TankMovingAnimation

import com.google.gwt.media.client.Audio; //导入依赖的package包/类
public TankMovingAnimation(HTML mapContainer, int startX, int startY, int endX, int endY,
    ImageResource resource, Audio sfx, int tankSize) {
  piece = resource;
  this.startX = startX;
  this.startY = startY;
  this.endX = endX;
  this.endY = endY;
  this.startWidth = tankSize;
  this.startHeight = tankSize;
  sound = sfx;
  cancelled = false;

  panel = new AbsolutePanel();
  moving = new Image(resource);
  moving.setPixelSize(startWidth, startHeight);
  panel.add(moving, startX, startY);
  panel.getElement().getStyle().setOverflow(Overflow.VISIBLE);
  panel.getElement().getStyle().setPosition(Position.RELATIVE);
  mapContainer.getElement().insertFirst(panel.getElement());
}
 
开发者ID:spk83,项目名称:risk,代码行数:21,代码来源:TankMovingAnimation.java


示例2: playAudio

import com.google.gwt.media.client.Audio; //导入依赖的package包/类
/**
 * Play an audio.
 * 
 * @param audio the audio to play, or null if not supported
 */
private void playAudio(Audio audio) {
  if (audio == null) {
    return;
  }

  // Pause current progress.
  audio.pause();

  // Reset the source.
  // TODO(jlabanca): Is cache-control=private making the source unseekable?
  audio.setSrc(audio.getCurrentSrc());

  // Unmute because we muted in createAudioElement.
  audio.play();
}
 
开发者ID:Peergos,项目名称:Peergos,代码行数:21,代码来源:SoundEffects.java


示例3: onModuleLoad

import com.google.gwt.media.client.Audio; //导入依赖的package包/类
public void onModuleLoad() {
    canvas = Canvas.createIfSupported();
    if (canvas == null) {
        Window.alert("Canvas not supported");
        return;
    }
    RootPanel.get("screen").add(canvas);

    CanvasElement el = canvas.getCanvasElement();
    el.setWidth(960);
    el.setHeight(540);

    Context2d ctx = canvas.getContext2d();
    setupContext(ctx);
    ctx.scale(3, 3);

    RootPanel.get().addDomHandler(this, KeyDownEvent.getType());

    font = new Image("images/font.png");
    fontElement = ImageElement.as(font.getElement());

    audio = Audio.createIfSupported();

    game = new Game(this);
    game.pushState(new WelcomeState(game));

    new Timer() {
        @Override
        public void run() {
            game.handleEvent();
            game.update();
            game.draw();
        }
    }.scheduleRepeating(50);
}
 
开发者ID:czak,项目名称:retronix,代码行数:36,代码来源:Application.java


示例4: JsCallsProvider

import com.google.gwt.media.client.Audio; //导入依赖的package包/类
public JsCallsProvider() {

        Audio callBeep = Audio.createIfSupported();
        if (callBeep != null) {
            if (!"".equals(callBeep.canPlayType("audio/ogg;"))) {
                //callBeep.setSrc("assets/sound/tone.ogg");
            } else if (!"".equals(callBeep.canPlayType("audio/mpeg;"))) {
                //callBeep.setSrc("assets/sound/tone.mp3");
            } else {
                // Not Supported
                return;
            }
            callBeep.setLoop(true);
            this.callBeep = callBeep;
        }

        Audio callRingtone = Audio.createIfSupported();
        if (callRingtone != null) {
            if (!"".equals(callRingtone.canPlayType("audio/ogg;"))) {
                //callRingtone.setSrc("assets/sound/ringtone.ogg");
            } else if (!"".equals(callRingtone.canPlayType("audio/mpeg;"))) {
                //callRingtone.setSrc("assets/sound/ringtone.mp3");
            } else {
                // Not Supported
                return;
            }
            callRingtone.setLoop(true);
            this.callRingtone = callRingtone;
        }
    }
 
开发者ID:wex5,项目名称:dangchat-sdk,代码行数:31,代码来源:JsCallsProvider.java


示例5: JsCallsProvider

import com.google.gwt.media.client.Audio; //导入依赖的package包/类
public JsCallsProvider() {

        Audio callBeep = Audio.createIfSupported();
        if (callBeep != null) {
            if (!"".equals(callBeep.canPlayType("audio/ogg;"))) {
                callBeep.setSrc("assets/sound/tone.ogg");
            } else if (!"".equals(callBeep.canPlayType("audio/mpeg;"))) {
                callBeep.setSrc("assets/sound/tone.mp3");
            } else {
                // Not Supported
                return;
            }
            callBeep.setLoop(true);
            this.callBeep = callBeep;
        }

        Audio callRingtone = Audio.createIfSupported();
        if (callRingtone != null) {
            if (!"".equals(callRingtone.canPlayType("audio/ogg;"))) {
                callRingtone.setSrc("assets/sound/ringtone.ogg");
            } else if (!"".equals(callRingtone.canPlayType("audio/mpeg;"))) {
                callRingtone.setSrc("assets/sound/ringtone.mp3");
            } else {
                // Not Supported
                return;
            }
            callRingtone.setLoop(true);
            this.callRingtone = callRingtone;
        }
    }
 
开发者ID:actorapp,项目名称:actor-platform,代码行数:31,代码来源:JsCallsProvider.java


示例6: createAudio1

import com.google.gwt.media.client.Audio; //导入依赖的package包/类
private Widget createAudio1(String auxAud) {
	Audio audio = Audio.createIfSupported();
	if (audio == null) {
		return null;
	}

	audio.load();

	audio.addSource(auxAud);			
	audio.setControls(true);
	return audio;
}
 
开发者ID:WELTEN,项目名称:dojo-ibl,代码行数:13,代码来源:SlideShow.java


示例7: loadDiceAudio

import com.google.gwt.media.client.Audio; //导入依赖的package包/类
private void loadDiceAudio() {
  diceAudio = Audio.createIfSupported();
  if (diceAudio != null) {
    diceAudio.addSource(gameSounds.diceRollMp3().getSafeUri().asString(), AudioElement.TYPE_MP3);
    diceAudio.addSource(gameSounds.diceRollOgg().getSafeUri().asString(), AudioElement.TYPE_OGG);
    diceAudio.addSource(gameSounds.diceRollWav().getSafeUri().asString(), AudioElement.TYPE_WAV);
    diceAudio.load();
  }
}
 
开发者ID:spk83,项目名称:risk,代码行数:10,代码来源:SoundResource.java


示例8: loadDeployAudio

import com.google.gwt.media.client.Audio; //导入依赖的package包/类
private void loadDeployAudio() {
  deployAudio = Audio.createIfSupported();
  if (deployAudio != null) {
    deployAudio.addSource(gameSounds.deployMp3().getSafeUri().asString(), AudioElement.TYPE_MP3);
    deployAudio.addSource(gameSounds.deployOgg().getSafeUri().asString(), AudioElement.TYPE_OGG);
    deployAudio.addSource(gameSounds.deployWav().getSafeUri().asString(), AudioElement.TYPE_WAV);
    deployAudio.load();
  }
}
 
开发者ID:spk83,项目名称:risk,代码行数:10,代码来源:SoundResource.java


示例9: loadAttackAudio

import com.google.gwt.media.client.Audio; //导入依赖的package包/类
private void loadAttackAudio() {
  attackAudio = Audio.createIfSupported();
  if (attackAudio != null) {
    attackAudio.addSource(gameSounds.attackMp3().getSafeUri().asString(), AudioElement.TYPE_MP3);
    attackAudio.addSource(gameSounds.attackOgg().getSafeUri().asString(), AudioElement.TYPE_OGG);
    attackAudio.addSource(gameSounds.attackWav().getSafeUri().asString(), AudioElement.TYPE_WAV);
    attackAudio.load();
  }
}
 
开发者ID:spk83,项目名称:risk,代码行数:10,代码来源:SoundResource.java


示例10: loadCardAudio

import com.google.gwt.media.client.Audio; //导入依赖的package包/类
private void loadCardAudio() {
  cardAudio = Audio.createIfSupported();
  if (cardAudio != null) {
    cardAudio.addSource(gameSounds.cardMp3().getSafeUri().asString(), AudioElement.TYPE_MP3);
    cardAudio.addSource(gameSounds.cardOgg().getSafeUri().asString(), AudioElement.TYPE_OGG);
    cardAudio.addSource(gameSounds.cardWav().getSafeUri().asString(), AudioElement.TYPE_WAV);
    cardAudio.load();
  }
}
 
开发者ID:spk83,项目名称:risk,代码行数:10,代码来源:SoundResource.java


示例11: loadAttackWonAudio

import com.google.gwt.media.client.Audio; //导入依赖的package包/类
private void loadAttackWonAudio() {
  attackWonAudio = Audio.createIfSupported();
  if (attackWonAudio != null) {
    attackWonAudio.addSource(gameSounds.attackWonMp3().getSafeUri().asString(), 
        AudioElement.TYPE_MP3);
    attackWonAudio.addSource(gameSounds.attackWonOgg().getSafeUri().asString(), 
        AudioElement.TYPE_OGG);
    attackWonAudio.addSource(gameSounds.attackWonWav().getSafeUri().asString(), 
        AudioElement.TYPE_WAV);
    attackWonAudio.load();
  }
}
 
开发者ID:spk83,项目名称:risk,代码行数:13,代码来源:SoundResource.java


示例12: loadAttackLostAudio

import com.google.gwt.media.client.Audio; //导入依赖的package包/类
private void loadAttackLostAudio() {
  attackLostAudio = Audio.createIfSupported();
  if (attackLostAudio != null) {
    attackLostAudio.addSource(gameSounds.attackLostMp3().getSafeUri().asString(), 
        AudioElement.TYPE_MP3);
    attackLostAudio.addSource(gameSounds.attackLostOgg().getSafeUri().asString(), 
        AudioElement.TYPE_OGG);
    attackLostAudio.addSource(gameSounds.attackLostWav().getSafeUri().asString(), 
        AudioElement.TYPE_WAV);
    attackLostAudio.load();
  }
}
 
开发者ID:spk83,项目名称:risk,代码行数:13,代码来源:SoundResource.java


示例13: loadGameWonAudio

import com.google.gwt.media.client.Audio; //导入依赖的package包/类
private void loadGameWonAudio() {
  gameWonAudio = Audio.createIfSupported();
  if (gameWonAudio != null) {
    gameWonAudio.addSource(gameSounds.gameWonMp3().getSafeUri().asString(), 
        AudioElement.TYPE_MP3);
    gameWonAudio.addSource(gameSounds.gameWonOgg().getSafeUri().asString(), 
        AudioElement.TYPE_OGG);
    gameWonAudio.addSource(gameSounds.gameWonWav().getSafeUri().asString(), 
        AudioElement.TYPE_WAV);
    gameWonAudio.load();
  }
}
 
开发者ID:spk83,项目名称:risk,代码行数:13,代码来源:SoundResource.java


示例14: loadAddUnitsAudio

import com.google.gwt.media.client.Audio; //导入依赖的package包/类
private void loadAddUnitsAudio() {
  addUnitsAudio = Audio.createIfSupported();
  if (addUnitsAudio != null) {
    addUnitsAudio.addSource(gameSounds.addUnitsMp3().getSafeUri().asString(), 
        AudioElement.TYPE_MP3);
    addUnitsAudio.addSource(gameSounds.addUnitsOgg().getSafeUri().asString(), 
        AudioElement.TYPE_OGG);
    addUnitsAudio.addSource(gameSounds.addUnitsWav().getSafeUri().asString(), 
        AudioElement.TYPE_WAV);
    addUnitsAudio.load();
  }
}
 
开发者ID:spk83,项目名称:risk,代码行数:13,代码来源:SoundResource.java


示例15: SoundManager

import com.google.gwt.media.client.Audio; //导入依赖的package包/类
public SoundManager() {
    for (String soundURL : soundURLs) {
        Audio newAudio = Audio.createIfSupported();
        if (newAudio == null) {
            throw new AlertRuntimeException("Браузер не поддерживает звуки (HTML5 элемент <audio>)");
        }
        newAudio.setPreload(MediaElement.PRELOAD_AUTO);
        newAudio.setSrc("audio/" + soundURL);
        newAudio.setAutoplay(false);
        audios.add(newAudio);
    }
}
 
开发者ID:rkfg,项目名称:ns2gather,代码行数:13,代码来源:SoundManager.java


示例16: playSound

import com.google.gwt.media.client.Audio; //导入依赖的package包/类
public void playSound(NS2Sound sound) {
    Audio audio = getSound(sound);
    if (!audio.isPaused()) {
        stopSound(sound);
    }
    audio.play();
}
 
开发者ID:rkfg,项目名称:ns2gather,代码行数:8,代码来源:SoundManager.java


示例17: createPlayer

import com.google.gwt.media.client.Audio; //导入依赖的package包/类
private void createPlayer() throws AudioException {
    audioPlayer = Audio.createIfSupported();
    if (audioPlayer == null) {
        throw new AudioException("audio not supportered");
    }
    final AudioElement audioElement = audioPlayer.getAudioElement();
    onEndedSetup(audioElement);
}
 
开发者ID:languageininteraction,项目名称:LanguageMemoryApp,代码行数:9,代码来源:AudioPlayer.java


示例18: get

import com.google.gwt.media.client.Audio; //导入依赖的package包/类
/**
 * Get the singleton instance.
 * 
 * @return the singleton instance
 */
public static SoundEffects get() {
  if (instance == null) {
    isSupported = Audio.isSupported();
    instance = new SoundEffects();
  }
  return instance;
}
 
开发者ID:Peergos,项目名称:Peergos,代码行数:13,代码来源:SoundEffects.java


示例19: prefetchError

import com.google.gwt.media.client.Audio; //导入依赖的package包/类
/**
 * Prefetch the error sound.
 */
public void prefetchError() {
  if (isSupported && error == null) {
    error = Audio.createIfSupported();
    error.addSource("audio/error.ogg", AudioElement.TYPE_OGG);
    error.addSource("audio/error.mp3", AudioElement.TYPE_MP3);
    error.addSource("audio/error.wav", AudioElement.TYPE_WAV);
    prefetchAudio(error);
  }
}
 
开发者ID:Peergos,项目名称:Peergos,代码行数:13,代码来源:SoundEffects.java


示例20: doesPlayerNeedsFlash

import com.google.gwt.media.client.Audio; //导入依赖的package包/类
private boolean doesPlayerNeedsFlash(Map<String, String> sources) {
    return ((!mediaChecker.isHtml5Mp3Supported() && !SourceUtil.containsOgg(sources)) || !Audio.isSupported()) && UserAgentChecker.isLocal();
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:4,代码来源:AudioPlayerModuleFactory.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java OrderState类代码示例发布时间:2022-05-22
下一篇:
Java PaletteViewerProvider类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap