Class: TStandardMIDIFile

Declaration: MIDISequence.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

TMIDISequence

Inherited By:

None.

Purpose:

Reads, writes, and creates standard MIDI files as per MMA 1.0 specification, formats 0 and 1. Transforms the file to the base class representation for use by TMIDIPlayer.

Allocate on the heap or the stack. Normally allocated on the heap so that TMIDIPlayer can adopt the file.

Deriving Classes:

Derive to handle additional file formats.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Member Function: TStandardMIDIFile::TStandardMIDIFile

  1. TStandardMIDIFile ()
  2. TStandardMIDIFile (const TFileSystemEntity & theFile, MOpenFile :: EPermissionsForMe forMe =MOpenFile :: kRead, MOpenFile :: EPermissionsForOthers forOthers =MOpenFile :: kAllowRead)
  3. TStandardMIDIFile (const TFileSystemEntity &, Resolution ticksPerQuarterNote, MOpenFile :: EPermissionsForMe forMe =MOpenFile :: kRead, MOpenFile :: EPermissionsForOthers forOthers =MOpenFile :: kAllowRead)
  4. TStandardMIDIFile (const TFileSystemEntity &, Resolution framesPerSecond, Resolution ticksPerFrame, MOpenFile :: EPermissionsForMe forMe =MOpenFile :: kRead, MOpenFile :: EPermissionsForOthers forOthers =MOpenFile :: kAllowRead)
  5. TStandardMIDIFile (const TStandardMIDIFile &)

Interface Category:

API.

Purpose:

  1. Default constructor. Default constructors are provided only for assignment and in-streaming. Default-constructed objects are not valid and should not be copied or streamed themselves.
  2. Constructor to open or create any MIDI file.
  3. Constructor to create or open a metrical MIDI file.
  4. Constructor to create or open an SMPTE MIDI file.
  5. Copy constructor.

Calling Context:

  1. Called by the stream-in operators and to create an empty object.
  2. Call this function directly.
  3. Call this function directly.
  4. Call this function directly.
  5. Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws TMIDIException::kEmptyFile if the file exists but has no data. Throws TMIDIException::kExpectedHeaderChunk if the file exists without a header chunk. Throws TMIDIException::kUnsupportedFileFormat if the format is not format 0 or format 1. Throws TMIDIException::kUnkownEvent if an event type is not known. Throws TMIDIException::kUnknownSMPTEFormat if the SMPTE format is not recognized.

Concurrency:

Not multithread safe.

Other Considerations:

Note: The file system entity parameter used in constructing objects of this class contains an absolute pathname. When streamed, objects will continue to reference a file on the machine of origin.

Member Function: TStandardMIDIFile::~TStandardMIDIFile

virtual ~ TStandardMIDIFile ()

Interface Category:

API.

Purpose:

Destructor. Writes the file if it's writable and SetModified has been called.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TStandardMIDIFile::operator=

TStandardMIDIFile & operator =(const TStandardMIDIFile &)

Interface Category:

API.

Purpose:

Assignment operator.

Calling Context:

Call this function directly.

Parameters:

Return Value:

A non-const reference to the left-hand side object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TStandardMIDIFile::SetModified

virtual void SetModified (bool)

Interface Category:

API.

Purpose:

Sets the status to modified such that a writable file is written upon destruction (the saveless model).

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TStandardMIDIFile::IsModified

virtual bool IsModified () const

Interface Category:

API.

Purpose:

Queries whether SetModified has been called.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns the last value of the call to SetModified.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TStandardMIDIFile::GetFileFormat

virtual EFileFormat GetFileFormat () const

Interface Category:

API.

Purpose:

Gets the file format of the standard MIDI file.

Calling Context:

Call this function directly.

Parameters:

Return Value:

The file format.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TStandardMIDIFile::GetNumberOfTracks

virtual TrackNumber GetNumberOfTracks () const

Interface Category:

API.

Purpose:

Gets the number of tracks in the standard MIDI file.

Calling Context:

Call this function directly.

Parameters:

Return Value:

The number of tracks.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TStandardMIDIFile::GetDivision

virtual Division GetDivision () const

Interface Category:

API.

Purpose:

Gets the file division of the standard MIDI file.

Calling Context:

Call this function directly.

Parameters:

Return Value:

The file division.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TStandardMIDIFile::operator>>=

virtual TStream & operator >>=(TStream & toWhere) const

Interface Category:

API.

Purpose:

Stream-out operator.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns a reference to the stream the object streams itself out to.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TStandardMIDIFile::operator<<=

virtual TStream & operator <<= (TStream & fromWhere)

Interface Category:

API.

Purpose:

Stream-in operator.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns a reference to the stream the object streams itself in from.

Exceptions:

Throws TInvalidVersionError if the versions don't match.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TStandardMIDIFile::Hash

virtual long Hash () const

Interface Category:

API.

Purpose:

Determines a hash value for collections.

Calling Context:

Called by collections.

Parameters:

Return Value:

The hash value.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TStandardMIDIFile::IsEqual

virtual bool IsEqual (const MCollectible *) const

Interface Category:

API.

Purpose:

Determines if this is equal to another object.

Calling Context:

Called by collections and directly.

Parameters:

Return Value:

Returns true if the objects refer to the same file and contents.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.