C# Class MediaPortal.MusicPlayer.BASS.BassAudioEngine

Handles playback of Audio files and Internet streams via the BASS Audio Engine.
Inheritance: MediaPortal.Player.IPlayer
Show file Open project: MediaPortal/MediaPortal-1 Class Usage Examples

Public Properties

Property Type Description
_initialized bool

Public Methods

Method Description
BASS_WASAPI_IsStarted ( ) : bool
BassAudioEngine ( ) : System
CanSeek ( ) : bool

Is Seeking enabled

Dispose ( ) : void

Release the Video Window

DisposeAndCleanUp ( ) : void

Dispose the BASS Audio engine. Free all BASS and Visualisation related resources

FreeBass ( ) : void

Free BASS, when not playing Audio content, as it might cause S/PDIF output stop working

GetChannelData ( int handle, float buffer, int lenght ) : int
GetDataFFT ( float buffer, int lenght ) : int
GetStreamTags ( ) : MediaPortal.TagReader.MusicTag

Returns the Tags of an AV Stream

InitBass ( ) : void

Init BASS, when a Audio file is to be played

NewMixerNeeded ( MediaPortal.MusicPlayer.BASS.MusicStream stream ) : bool

Checks, if a new Mixer would be needed, because of changes in Sample Rate or number of channels

Pause ( ) : void

Pause Playback

Play ( string filePath ) : bool

Starts Playback of the given file

Process ( ) : void

Process Method

RMS ( double &dbLevelL, double &dbLevelR ) : void

Return the dbLevel to be used by a VUMeter

SeekAbsolute ( double dTime ) : void

Seek Absoluet in the Stream

SeekAsolutePercentage ( int iPercentage ) : void

Seek Absolute Percentage

SeekForward ( int ms ) : bool

Seek Forward in the Stream

SeekRelative ( double dTime ) : void

Seek Relative in the Stream

SeekRelativePercentage ( int iPercentage ) : void

Seek Relative Percentage

SeekReverse ( int ms ) : bool

Seek Backwards within the stream

SeekToTimePosition ( int position ) : bool

Seek to a specific position in the stream

Stop ( ) : void

Stopping Playback

SwitchToDefaultPlaybackMode ( ) : void

Switch back to the default Playback Mode, whoch was saved before starting playback of a complete album

SwitchToGaplessPlaybackMode ( ) : void

Switches the Playback to Gapless Used, if playback of a complete Album is started

Private Methods

Method Description
ChannelIsActive ( int handle ) : BASSActive
ChannelPlay ( int handle, bool restart ) : bool
ChannelRemoveLink ( int handle, int chan ) : bool
ChannelSetLink ( int handle, int chan ) : bool
CommandThread ( ) : void
CreateCommandThread ( ) : void
GetCurrentStream ( ) : MediaPortal.MusicPlayer.BASS.MusicStream

Returns the Current Stream

GetSoundDevice ( ) : int

Get the Sound devive as set in the Configuartion

GetWasApiFormats ( ) : void

Detect the supported output formats for WASAPI

GetWasApiSpeakers ( ) : int

WASAPI doesnj't provide a way to ask the driver on the maximum of supported speakers. So we try to enumerate the channels and detect the attached speakers.

HandleBassError ( string methodName ) : void

Displays Information about a BASS Exception

HandleCueFile ( string &filePath, bool endOnly ) : bool

Parse the Cue file. Return a Fake Cue track and adjest the playback position within the file.

HandleSongEnded ( ) : void

Handle Stop of a song

InitAsio ( ) : bool

Initialises the Asio Device

InitDirectSoundDevice ( ) : bool

Initialise the DirectSound Device

InitWasapi ( ) : bool

Initialises the Wasapi Device

Initialize ( ) : void

Initialise the Visualisation Window and Load Decoder/DSP Plugins The BASS engine itself is not initialised at this stage, since it may cause S/PDIF for Movies not working on some systems.

OnAppFormDisposed ( object sender, EventArgs e ) : void

The Main Form is disposed, so dispose the player

OnMusicStreamMessage ( object sender, MediaPortal.MusicPlayer.BASS.MusicStream action ) : void

This Message is sent from a MusicStream

OnNewAction ( MediaPortal.GUI.Library.Action action ) : void
PlayInternal ( string filePath ) : bool

Called to start playback of next files internally, without makinbg use of g_player. This gives us the capability to achieve gapless playback.

SetCueTrackEndPosition ( MediaPortal.MusicPlayer.BASS.MusicStream stream, bool endOnly ) : void

Sets the End Position for the CUE Track

StopCommand ( ) : void
StreamCreate ( int freq, int chans, BASSFlag Flags, STREAMPROC proc, IntPtr user ) : int
StreamFree ( int handle ) : bool

Method Details

BASS_WASAPI_IsStarted() public method

public BASS_WASAPI_IsStarted ( ) : bool
return bool

BassAudioEngine() public method

public BassAudioEngine ( ) : System
return System

CanSeek() public method

Is Seeking enabled
public CanSeek ( ) : bool
return bool

Dispose() public method

Release the Video Window
public Dispose ( ) : void
return void

DisposeAndCleanUp() public method

Dispose the BASS Audio engine. Free all BASS and Visualisation related resources
public DisposeAndCleanUp ( ) : void
return void

FreeBass() public method

Free BASS, when not playing Audio content, as it might cause S/PDIF output stop working
public FreeBass ( ) : void
return void

GetChannelData() public method

public GetChannelData ( int handle, float buffer, int lenght ) : int
handle int
buffer float
lenght int
return int

GetDataFFT() public method

public GetDataFFT ( float buffer, int lenght ) : int
buffer float
lenght int
return int

GetStreamTags() public method

Returns the Tags of an AV Stream
public GetStreamTags ( ) : MediaPortal.TagReader.MusicTag
return MediaPortal.TagReader.MusicTag

InitBass() public method

Init BASS, when a Audio file is to be played
public InitBass ( ) : void
return void

NewMixerNeeded() public method

Checks, if a new Mixer would be needed, because of changes in Sample Rate or number of channels
public NewMixerNeeded ( MediaPortal.MusicPlayer.BASS.MusicStream stream ) : bool
stream MediaPortal.MusicPlayer.BASS.MusicStream
return bool

Pause() public method

Pause Playback
public Pause ( ) : void
return void

Play() public method

Starts Playback of the given file
public Play ( string filePath ) : bool
filePath string
return bool

Process() public method

Process Method
public Process ( ) : void
return void

RMS() public method

Return the dbLevel to be used by a VUMeter
public RMS ( double &dbLevelL, double &dbLevelR ) : void
dbLevelL double
dbLevelR double
return void

SeekAbsolute() public method

Seek Absoluet in the Stream
public SeekAbsolute ( double dTime ) : void
dTime double
return void

SeekAsolutePercentage() public method

Seek Absolute Percentage
public SeekAsolutePercentage ( int iPercentage ) : void
iPercentage int
return void

SeekForward() public method

Seek Forward in the Stream
public SeekForward ( int ms ) : bool
ms int
return bool

SeekRelative() public method

Seek Relative in the Stream
public SeekRelative ( double dTime ) : void
dTime double
return void

SeekRelativePercentage() public method

Seek Relative Percentage
public SeekRelativePercentage ( int iPercentage ) : void
iPercentage int
return void

SeekReverse() public method

Seek Backwards within the stream
public SeekReverse ( int ms ) : bool
ms int
return bool

SeekToTimePosition() public method

Seek to a specific position in the stream
public SeekToTimePosition ( int position ) : bool
position int
return bool

Stop() public method

Stopping Playback
public Stop ( ) : void
return void

SwitchToDefaultPlaybackMode() public method

Switch back to the default Playback Mode, whoch was saved before starting playback of a complete album
public SwitchToDefaultPlaybackMode ( ) : void
return void

SwitchToGaplessPlaybackMode() public method

Switches the Playback to Gapless Used, if playback of a complete Album is started
public SwitchToGaplessPlaybackMode ( ) : void
return void

Property Details

_initialized public static property

public static bool _initialized
return bool