com.mle.audio.javasound

JavaSoundPlayer

class JavaSoundPlayer extends IPlayer with JavaSoundPlayerBase with StateAwarePlayer with AutoCloseable with Log

A music player. Plays one media source. To change source, for example to change track, create a new player.

The user needs to provide the media length and size to enable seek functionality. Seeking streams which cannot be reopened is only supported if InputStream.markSupported() of media.stream is true, and even then the support is buggy. markSupported() is true at least for java.io.BufferedInputStreams.

The stream provided in media is not by default closed when the player is closed, but if you wish to do so, subclass this player and override close() accordingly or mix in trait SourceClosing.

See also

UriJavaSoundPlayer

FileJavaSoundPlayer

Linear Supertypes
StateAwarePlayer, JavaSoundPlayerBase, Seekable, Log, RichPlayer, IPlayer, AutoCloseable, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. JavaSoundPlayer
  2. StateAwarePlayer
  3. JavaSoundPlayerBase
  4. Seekable
  5. Log
  6. RichPlayer
  7. IPlayer
  8. AutoCloseable
  9. AnyRef
  10. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new JavaSoundPlayer(stream: InputStream, duration: Duration, size: StorageSize)

  2. new JavaSoundPlayer(media: OneShotStream)(implicit ec: ExecutionContext = ...)

    media

    media info to play

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. def audioLine: SourceDataLine

    Definition Classes
    JavaSoundPlayerJavaSoundPlayerBase
  8. def bytesToTime(bytes: StorageSize): Duration

    Attributes
    protected
    Definition Classes
    Seekable
  9. def cachedMute: Option[Boolean]

    Definition Classes
    JavaSoundPlayerBase
  10. def cachedVolume: Option[Int]

    Definition Classes
    JavaSoundPlayerBase
  11. def canAdjustVolume: Boolean

    Definition Classes
    JavaSoundPlayerBase
  12. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  13. def close(): Unit

    Releases any player resources (input streams, .

    Releases any player resources (input streams, ...). Playback is stopped.

    Definition Classes
    JavaSoundPlayerIPlayer → AutoCloseable
  14. def controlDescriptions: Array[String]

  15. def duration: Duration

    Definition Classes
    Seekable
  16. implicit val ec: ExecutionContext

  17. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  18. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  19. def events: Observable[PlayerState]

    returns

    the current player state and any future states

  20. def externalVolumeValue(internalValue: Float, min: Float, max: Float): Int

    Definition Classes
    JavaSoundPlayerBase
  21. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  22. def gainControl: Option[FloatControl]

    Definition Classes
    JavaSoundPlayerBase
  23. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  24. def hasGainControl: Boolean

    Definition Classes
    JavaSoundPlayerBase
  25. def hasVolumeControl: Boolean

    Definition Classes
    JavaSoundPlayerBase
  26. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  27. def internalVolumeValue(newVolume: Int, min: Float, max: Float): Float

    Definition Classes
    JavaSoundPlayerBase
  28. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  29. var lineData: LineData

    Attributes
    protected
  30. val log: Logger

    Attributes
    protected
    Definition Classes
    Log
  31. val media: OneShotStream

    media info to play

    media info to play

    Definition Classes
    JavaSoundPlayerSeekable
  32. def mute: Boolean

    Definition Classes
    JavaSoundPlayerBaseRichPlayer
  33. def mute(shouldMute: Boolean): Unit

    Mutes/unmutes the player.

    Mutes/unmutes the player.

    Definition Classes
    JavaSoundPlayerBaseIPlayer
  34. def muteControl: Option[BooleanControl]

    Definition Classes
    JavaSoundPlayerBase
  35. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  36. def newLine(source: InputStream, subject: Subject[PlayerState]): LineData

  37. final def notify(): Unit

    Definition Classes
    AnyRef
  38. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  39. def onEndOfMedia(): Unit

    Definition Classes
    JavaSoundPlayerStateAwarePlayer
  40. def onPlaybackException(e: Exception): Unit

  41. def play(): Unit

    Starts or resumes playback, whichever makes sense.

    Starts or resumes playback, whichever makes sense.

    Definition Classes
    JavaSoundPlayerIPlayer
  42. def playbackEvents: Observable[PlaybackEvent]

  43. def position: Duration

    Definition Classes
    JavaSoundPlayerBaseRichPlayer
  44. def reset(): Unit

  45. def resetStream(oldStream: InputStream): InputStream

    Returns a stream of the media reset to its initial read position.

    Returns a stream of the media reset to its initial read position. Helper method for seeking.

    The default implementation merely calls reset() on the InputStream and returns the same instance. If possible, override this method, close and open a new stream instead.

    returns

    a stream of the media reset to its initial read position

    Attributes
    protected
    See also

    BasicJavaSoundPlayer

  46. def seek(pos: Duration): Unit

    Regardless of whether the user seeks backwards or forwards, here is what we do:

    Regardless of whether the user seeks backwards or forwards, here is what we do:

    Reset the stream to its initial position. Skip bytes from the beginning. (Optionally continue playback.)

    The stream needs to support mark so that we can mark the initial position (constructor). Subsequent calls to reset will therefore go to the initial position. Then we can skip the sufficient amount of bytes and arrive at the correct position. Otherwise seeking would just skip bytes forward every time, relative to the current position.

    This can still be spectacularly inaccurate if a VBR file is seeked but that is a secondary problem.

    pos

    position to seek to

    Definition Classes
    JavaSoundPlayerIPlayer
  47. def seekProblem: Option[String]

  48. var startedFromMicros: Long

    Definition Classes
    Seekable
  49. def state: PlayerStates.Value

    Definition Classes
    JavaSoundPlayerStateAwarePlayer
  50. def stop(): Unit

    Pauses playback.

    Pauses playback.

    Definition Classes
    JavaSoundPlayerIPlayer
  51. var stream: InputStream

    Attributes
    protected
  52. def supportsSeek: Boolean

  53. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  54. def timeToBytes(pos: Duration): StorageSize

    Inaccurate.

    Inaccurate. VBR etc.

    Attributes
    protected
    Definition Classes
    Seekable
  55. def timeUpdates: Observable[TimeUpdated]

    A stream of time update events.

    A stream of time update events. Emits the current playback position, then emits at least one event per second provided that the playback position changes. If there is no progress, for example if playback is stopped, no events are emitted.

    returns

    time update events

  56. def toString(): String

    Definition Classes
    AnyRef → Any
  57. def toggleMute(): Unit

    Definition Classes
    JavaSoundPlayerBaseIPlayer
  58. def volume(newVolume: Int): Unit

    Adjusts the volume.

    Adjusts the volume.

    Definition Classes
    JavaSoundPlayerBaseIPlayer
  59. def volume: Int

    Definition Classes
    JavaSoundPlayerBaseRichPlayer
  60. def volumeControl: Option[FloatControl]

    Definition Classes
    JavaSoundPlayerBase
  61. def volume_=(newVolume: Int): Unit

    Definition Classes
    JavaSoundPlayerBase
  62. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  63. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  64. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from StateAwarePlayer

Inherited from JavaSoundPlayerBase

Inherited from Seekable

Inherited from Log

Inherited from RichPlayer

Inherited from IPlayer

Inherited from AutoCloseable

Inherited from AnyRef

Inherited from Any

Ungrouped