Mci.Sequencer.Set.Time.Format Class

 

About Mci.Sequencer.Set.Time.Format Class

 

Mci.Sequencer.Set.Time.Format class is mainly used for setting the time format of MIDI (*.mid) files through Mci functions.

You can visit the following link for more info about the MCI command "set":

https://msdn.microsoft.com/en-us/library/windows/desktop/dd798661(v=vs.85).aspx

 

Mci.Sequencer.Set.Time.Format Class Methods

 

Mci.Sequencer.Set.Time.Format.Milliseconds( ulong DeviceIndex) executes the MCI command "set time format milliseconds".

ulong DeviceIndex: device index.

 

Mci.Sequencer.Set.Time.Format.SMPTE( ulong DeviceIndex, string FPS) executes the MCI command "set time format SMPTE fps".

ulong DeviceIndex: device index.
string FPS: frames per second.

 

Mci.Sequencer.Set.Time.Format.SMPTE30Drop( ulong DeviceIndex) executes the MCI command "set time format SMPTE 30 drop".

ulong DeviceIndex: device index.

 

Mci.Sequencer.Set.Time.Format.SongPointer( ulong DeviceIndex) executes the MCI command "set time format song pointer".

ulong DeviceIndex: device index.

 

Code Example

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Giavapps.MIDI;

public class CodeExample : MonoBehaviour
{

private string FileName = "mymidi.mid";
private ulong DeviceIndex;

void Awake()
{
Mci.Initialize();//Initializes Mci
DeviceIndex = Mci.Sequencer.Open(FileName);//Opens the specified MIDI file into the MCI MIDI Sequencer for playback
Mci.Sequencer.Set.Time.Format.Milliseconds(DeviceIndex);//Sets a different time format for the MIDI file
}

void Update()
{

//Checks if space key is pressed
if(Input.GetKeyDown(KeyCode.Space))
{
Mci.Sequencer.Play(DeviceIndex);//Plays the MIDI file
}

//Checks if return key is pressed
if(Input.GetKeyDown(KeyCode.Return))
{
Debug.Log("POSITION: "+Mci.Sequencer.Status.Position(DeviceIndex));//shows the current playback position in the time format previously specified
}

}

void OnApplicationQuit()
{
Mci.Deinitialize();//Deinitializes Mci
}

}

 

I am Luigi Piscopo, also known as DJ GiDeejay / Producer / Remixer in the music world. I am a Producer with a lot of experience in photo editing, video editing, audio editing, graphic design, web design, programming and promotion.

Comments are closed.