LibreOffice Module slideshow (master) 1
Public Member Functions | Private Member Functions | Private Attributes | List of all members
slideshow::internal::SoundPlayer Class Reference

Little class that plays a sound from a URL. More...

#include <soundplayer.hxx>

Inheritance diagram for slideshow::internal::SoundPlayer:
[legend]
Collaboration diagram for slideshow::internal::SoundPlayer:
[legend]

Public Member Functions

static ::std::shared_ptr< SoundPlayercreate (EventMultiplexer &rEventMultiplexer, const OUString &rSoundURL, const css::uno::Reference< css::uno::XComponentContext > &rComponentContext, MediaFileManager &rMediaFileManager)
 Create a sound player object. More...
 
virtual ~SoundPlayer () override
 
double getDuration () const
 Query duration of sound playback. More...
 
bool startPlayback ()
 
bool stopPlayback ()
 
bool isPlaying () const
 
void setPlaybackLoop (bool bLoop)
 
virtual bool handlePause (bool bPauseShow) override
 Handle the event. More...
 
virtual void dispose () override
 Dispose all object references. More...
 
virtual bool handlePause (bool bPauseShow)=0
 Handle the event. More...
 
- Public Member Functions inherited from slideshow::internal::Disposable
virtual ~Disposable ()
 
virtual void dispose ()=0
 Dispose all object references. More...
 

Private Member Functions

 SoundPlayer (EventMultiplexer &rEventMultiplexer, const OUString &rSoundURL, const css::uno::Reference< css::uno::XComponentContext > &rComponentContext, MediaFileManager &rMediaFileManager)
 

Private Attributes

EventMultiplexermrEventMultiplexer
 
::std::shared_ptr< SoundPlayermThis
 
::std::shared_ptr<::avmedia::MediaTempFilempMediaTempFile
 
css::uno::Reference< css::media::XPlayer > mxPlayer
 

Additional Inherited Members

- Protected Member Functions inherited from slideshow::internal::PauseEventHandler
 ~PauseEventHandler ()
 

Detailed Description

Little class that plays a sound from a URL.

TODO: Must be explicitly disposed (as long as enable_shared_ptr_from_this isn't available)!

Definition at line 47 of file soundplayer.hxx.

Constructor & Destructor Documentation

◆ ~SoundPlayer()

slideshow::internal::SoundPlayer::~SoundPlayer ( )
overridevirtual

Definition at line 121 of file soundplayer.cxx.

References dispose(), and TOOLS_WARN_EXCEPTION.

◆ SoundPlayer()

slideshow::internal::SoundPlayer::SoundPlayer ( EventMultiplexer rEventMultiplexer,
const OUString &  rSoundURL,
const css::uno::Reference< css::uno::XComponentContext > &  rComponentContext,
MediaFileManager rMediaFileManager 
)
private

Member Function Documentation

◆ create()

std::shared_ptr< SoundPlayer > slideshow::internal::SoundPlayer::create ( EventMultiplexer rEventMultiplexer,
const OUString &  rSoundURL,
const css::uno::Reference< css::uno::XComponentContext > &  rComponentContext,
MediaFileManager rMediaFileManager 
)

Create a sound player object.

Parameters
rSoundURLURL to a sound file.
rComponentContextReference to a component context, used to create the needed services
Exceptions
css::lang::NoSupportException,ifthe sound file is invalid, or not supported by the player service.

Definition at line 42 of file soundplayer.cxx.

References slideshow::internal::EventMultiplexer::addPauseHandler(), and SoundPlayer().

Referenced by slideshow::internal::AnimationAudioNode::createPlayer().

◆ dispose()

void slideshow::internal::SoundPlayer::dispose ( )
overridevirtual

Dispose all object references.

An implementor of this method must first call dispose() on any of its external references, and release them after that.

Implements slideshow::internal::Disposable.

Definition at line 63 of file soundplayer.cxx.

References mrEventMultiplexer, mThis, mxPlayer, and slideshow::internal::EventMultiplexer::removePauseHandler().

Referenced by ~SoundPlayer().

◆ getDuration()

double slideshow::internal::SoundPlayer::getDuration ( ) const

Query duration of sound playback.

If the sound is already playing, this method returns the remaining playback time.

Returns
the playback duration in seconds.

Definition at line 132 of file soundplayer.cxx.

References mxPlayer.

◆ handlePause()

bool slideshow::internal::SoundPlayer::handlePause ( bool  bPauseShow)
overridevirtual

Handle the event.

Parameters
bPauseShowWhen true, the show is paused. When false, the show is started again
Returns
true, if this handler has successfully processed the pause event. When this method returns false, possibly other, less prioritized handlers are called, too.

Implements slideshow::internal::PauseEventHandler.

Definition at line 58 of file soundplayer.cxx.

References startPlayback(), and stopPlayback().

◆ isPlaying()

bool slideshow::internal::SoundPlayer::isPlaying ( ) const

Definition at line 171 of file soundplayer.cxx.

References mxPlayer.

◆ setPlaybackLoop()

void slideshow::internal::SoundPlayer::setPlaybackLoop ( bool  bLoop)

Definition at line 165 of file soundplayer.cxx.

References mxPlayer.

◆ startPlayback()

bool slideshow::internal::SoundPlayer::startPlayback ( )

Definition at line 145 of file soundplayer.cxx.

References mxPlayer.

Referenced by handlePause().

◆ stopPlayback()

bool slideshow::internal::SoundPlayer::stopPlayback ( )

Definition at line 157 of file soundplayer.cxx.

References mxPlayer.

Referenced by handlePause().

Member Data Documentation

◆ mpMediaTempFile

::std::shared_ptr<::avmedia::MediaTempFile> slideshow::internal::SoundPlayer::mpMediaTempFile
private

Definition at line 105 of file soundplayer.hxx.

Referenced by SoundPlayer().

◆ mrEventMultiplexer

EventMultiplexer& slideshow::internal::SoundPlayer::mrEventMultiplexer
private

Definition at line 100 of file soundplayer.hxx.

Referenced by dispose().

◆ mThis

::std::shared_ptr<SoundPlayer> slideshow::internal::SoundPlayer::mThis
private

Definition at line 103 of file soundplayer.hxx.

Referenced by dispose().

◆ mxPlayer

css::uno::Reference< css::media::XPlayer > slideshow::internal::SoundPlayer::mxPlayer
private

The documentation for this class was generated from the following files: