com.mle.audio.javasound

JavaSoundPlayer

Related Docs: object JavaSoundPlayer | package javasound

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, readWriteBufferSize: StorageSize)

  2. new JavaSoundPlayer(media: OneShotStream, readWriteBufferSize: StorageSize = DEFAULT_RW_BUFFER_SIZE)(implicit ec: ExecutionContext = ...)

    media

    media info to play

Value Members

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

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

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

    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  5. def audioLine: SourceDataLine

    Definition Classes
    JavaSoundPlayerJavaSoundPlayerBase
  6. val bufferSize: Int

  7. def bytesToTime(bytes: StorageSize): Duration

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

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

    Definition Classes
    JavaSoundPlayerBase
  10. def canAdjustVolume: Boolean

    Definition Classes
    JavaSoundPlayerBase
  11. def clone(): AnyRef

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

    Releases any player resources (input streams, ...).

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

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

  14. def duration: Duration

    Definition Classes
    Seekable
  15. implicit val ec: ExecutionContext

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

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

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

    returns

    the current player state and any future states

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

    Definition Classes
    JavaSoundPlayerBase
  20. def finalize(): Unit

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

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

    Definition Classes
    AnyRef → Any
  23. def hasGainControl: Boolean

    Definition Classes
    JavaSoundPlayerBase
  24. def hasVolumeControl: Boolean

    Definition Classes
    JavaSoundPlayerBase
  25. def hashCode(): Int

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

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

    Definition Classes
    Any
  28. var lineData: LineData

    Attributes
    protected
  29. val log: Logger

    Attributes
    protected
    Definition Classes
    Log
  30. val media: OneShotStream

    media info to play

    media info to play

    Definition Classes
    JavaSoundPlayerSeekable
  31. def mute: Boolean

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

    Mutes/unmutes the player.

    Mutes/unmutes the player.

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

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

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

  36. final def notify(): Unit

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

    Definition Classes
    AnyRef
  38. def onEndOfMedia(): Unit

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

  40. def play(): Unit

    Starts or resumes playback, whichever makes sense.

    Starts or resumes playback, whichever makes sense.

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

  42. def position: Duration

    Definition Classes
    JavaSoundPlayerBaseRichPlayer
  43. def reset(): Unit

  44. 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

  45. 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
  46. def seekProblem: Option[String]

  47. var startedFromMicros: Long

    Definition Classes
    Seekable
  48. def state: PlayerStates.Value

    Definition Classes
    JavaSoundPlayerStateAwarePlayer
  49. def stop(): Unit

    Pauses playback.

    Pauses playback.

    Definition Classes
    JavaSoundPlayerIPlayer
  50. var stream: InputStream

    Attributes
    protected
  51. def supportsSeek: Boolean

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

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

    Inaccurate.

    Inaccurate. VBR etc.

    Attributes
    protected
    Definition Classes
    Seekable
  54. 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

  55. def toString(): String

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

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

    Adjusts the volume.

    Adjusts the volume.

    Definition Classes
    JavaSoundPlayerBaseIPlayer
  58. def volume: Int

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

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

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  63. 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