Sounds - PowerPoint PPT Presentation

About This Presentation
Title:

Sounds

Description:

Sounds Playing Sounds on the Web in Java Sound Applets can play sound clips Audio Files supported: .au .midi .rmf .wave .aiff AudioClip Interface Method Summary ... – PowerPoint PPT presentation

Number of Views:91
Avg rating:3.0/5.0
Slides: 7
Provided by: DanielS108
Category:
Tags: sounds

less

Transcript and Presenter's Notes

Title: Sounds


1
Sounds
  • Playing Sounds on the Web in Java

2
Sound
  • Applets can play sound clips
  • Audio Files supported
  • .au
  • .midi
  • .rmf
  • .wave
  • .aiff

3
AudioClip Interface
  • Method Summary  
  • public void loop()        Starts playing this
    audio clip in a loop.  
  • public void play()           Starts playing this
    audio clip.  
  • public void stop()           Stops playing this
    audio clip.

4
Applet Methods for Audio
  • The applet class contains methods for getting an
    AudioClip object
  •  AudioClip getAudioClip(URL url)
  • Returns the AudioClip object specified by the URL
    argument.
  •  AudioClip getAudioClip(URL url, String name)
  • Returns the AudioClip object specified by the URL
    and name arguments.

5
Using Runnable
  • Implement runnable in the class
  • Get URL of sound
  • Create Thread to play audioStart thread
  • play the sound, then
  • loop or
  • stop thread when done

6
Another Way
  • Create a class extending thread. Constructor has
    audio URL as parameter
  • Its run class plays the audio
  • Create an object of the class
  • Start the object
Write a Comment
User Comments (0)
About PowerShow.com