C# Class Symphonary.MidiPlayer

ファイルを表示 Open project: tfreedman/Symphonary Class Usage Examples

Public Properties

Property Type Description
al_CurrentPlayingChannelNotes System.Collections.ArrayList

Public Methods

Method Description
EnterPreviewMode ( EventHandler extHandlePreviewPlayingCompleted ) : void

Configure player for preview mode, stashes settings for which channels are played, detaches event handlers related to gameplay, attaches preview completion event handler

ExitPreviewMode ( EventHandler extHandlePreviewPlayingCompleted ) : void

Resets player configuration from preview mode, restores settings for which channels are played, re-attaches event handlers related to gameplay, detaches preview completion event handler

MidiPlayer ( string s_Filename, ProgressChangedEventHandler extHandleLoadProgressChanged, EventHandler extHandleLoadCompleted, EventHandler extHandleChannelMessagePlayed, EventHandler extHandlePlayingCompleted ) : System

Constructor for the class. Several additional event handlers are hooked up, these are for driving changes in the UI

OnClosedOperations ( ) : void

Disposes some resources when program has closed

OnClosingOperations ( ) : void

Sets the program closing flag value to true. This stops teh player from performing some opertions that may cause an exception when the program is closing

ResumePlaying ( ) : void

Pause playing the MIDI file

StartPlaying ( ) : void

Play the MIDI file

StopPlaying ( ) : void

Stop playing the MIDI file

UnmuteOtherChannels ( ) : void

Unmute all channels other than the persistent channel. The persistent channel is not muted in the first place so this effectively unmutes all channels

Private Methods

Method Description
HandleChannelMessagePlayed ( object sender, Sanford.Multimedia.Midi.ChannelMessageEventArgs e ) : void

Internal event handler for channel message played

HandleChased ( object sender, Sanford.Multimedia.Midi.ChasedEventArgs e ) : void

Internal event handler for channel message chased. Not sure what this does

HandleLoadCompleted ( object sender, AsyncCompletedEventArgs e ) : void

Internal event handler for load completed

HandlePlayingCompleted ( object sender, EventArgs e ) : void

Internal event handler for playing completed. Don't have anything that needed to be done by this yet

HandleStopped ( object sender, Sanford.Multimedia.Midi.StoppedEventArgs e ) : void

Internal event handler for playing stopped

MuteAllChannels ( ) : void

Mutes all channels in the MIDI file. This is used to get rid of "hanging" notes when the MIDI file stops playing

MuteOtherChannels ( ) : void

Mutes all channels except the persistent channel

ReattachExternalPlaybackEventHandles ( ) : void

Used by preview mode

RecoverChannelPlaySettings ( ) : void

Used by preview mode

StashChannelPlaySettings ( ) : void

Used by preview mode

UnHookExternalPlaybackEventHandles ( ) : void

Used by preview mode

Method Details

EnterPreviewMode() public method

Configure player for preview mode, stashes settings for which channels are played, detaches event handlers related to gameplay, attaches preview completion event handler
public EnterPreviewMode ( EventHandler extHandlePreviewPlayingCompleted ) : void
extHandlePreviewPlayingCompleted EventHandler
return void

ExitPreviewMode() public method

Resets player configuration from preview mode, restores settings for which channels are played, re-attaches event handlers related to gameplay, detaches preview completion event handler
public ExitPreviewMode ( EventHandler extHandlePreviewPlayingCompleted ) : void
extHandlePreviewPlayingCompleted EventHandler
return void

MidiPlayer() public method

Constructor for the class. Several additional event handlers are hooked up, these are for driving changes in the UI
public MidiPlayer ( string s_Filename, ProgressChangedEventHandler extHandleLoadProgressChanged, EventHandler extHandleLoadCompleted, EventHandler extHandleChannelMessagePlayed, EventHandler extHandlePlayingCompleted ) : System
s_Filename string directory of the MIDI file to play
extHandleLoadProgressChanged ProgressChangedEventHandler external event handler for load progress changed
extHandleLoadCompleted EventHandler external event handler for load completed
extHandleChannelMessagePlayed EventHandler external event handler for channel message played
extHandlePlayingCompleted EventHandler external event handler for loading completed
return System

OnClosedOperations() public method

Disposes some resources when program has closed
public OnClosedOperations ( ) : void
return void

OnClosingOperations() public method

Sets the program closing flag value to true. This stops teh player from performing some opertions that may cause an exception when the program is closing
public OnClosingOperations ( ) : void
return void

ResumePlaying() public method

Pause playing the MIDI file
public ResumePlaying ( ) : void
return void

StartPlaying() public method

Play the MIDI file
public StartPlaying ( ) : void
return void

StopPlaying() public method

Stop playing the MIDI file
public StopPlaying ( ) : void
return void

UnmuteOtherChannels() public method

Unmute all channels other than the persistent channel. The persistent channel is not muted in the first place so this effectively unmutes all channels
public UnmuteOtherChannels ( ) : void
return void

Property Details

al_CurrentPlayingChannelNotes public_oe property

public ArrayList,System.Collections al_CurrentPlayingChannelNotes
return System.Collections.ArrayList