content top

Mci.Error Class

Mci.Error Class

  About Mci.Error Class   Mci.Error class is mainly used for retrieving error messages from Mci functions.   Mci.Error Class Methods   Mci.Error.ManualChecking( bool ManualChecking ) specifies if Giavapps MIDI should store data about detected errors in order that you can then check that data through Mci.Error.* functions. By default this feature is disabled. When this feature is enabled you must always loop through all received data by calling Mci.Error.Count() (usually inside Update() or Coroutine methods). If an application continues sending errors and you are not processing them you may cause a memory leak. (See Code Examples below for more info about how to manual check errors correctly). When this feature is disabled, Giavapps MIDI will stop storing data for errors. You can leave disabled this feature if you are not going to use any of the Mci.Error.* functions. bool ManualChecking: enable (true) or disable (false) manual check.   Mci.Error.Count() returns the amount of detected errors. Use the other Mci.Error.* functions to get info about the messages. When you call this function Giavapps MIDI will free data stored for errors (see Mci.Error.ManualChecking() function for more info).   Mci.Error.String( ulong ErrorIndex ) returns the specified error string. ulong ErrorIndex: zero-based index of the error.   Code Example using System.Collections; using System.Collections.Generic; using UnityEngine; using Giavapps.MIDI; public class CodeExample : MonoBehaviour { private string FileName = "mymidi.mid"; void Awake() { Mci.Initialize();//Initializes Mci Mci.Error.ManualChecking(true);//Enables manual checking of error messages Mci.Sequencer.Open(FileName);//Opens the specified MIDI file into the MCI MIDI Sequencer for playback } void Update() { //Check for error messages ulong errors = Mci.Error.Count(); for(ulong e = 0; e < errors; e++) { Debug.Log(Mci.Error.String(e));//Prints an error message } //Checks if space key is pressed if(Input.GetKeyDown(KeyCode.Space)) { Mci.Command("open \""+FileName+"\" type sequencer alias "+Mci.Alias+"1");//Ops! This causes an error! } } 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...

Read More

Mci.Sequencer.Status Class

Mci.Sequencer.Status Class

  About Mci.Sequencer.Status Class   Mci.Sequencer.Status class is mainly used for retrieving playback informations of MIDI (*.mid) files through Mci functions. You can visit the following link for more info about the MCI command "status": https://msdn.microsoft.com/en-us/library/windows/desktop/dd798683(v=vs.85).aspx   Mci.Sequencer.Status Class Methods   Mci.Sequencer.Status.CurrentTrack( ulong DeviceIndex) executes the MCI command "status current track". This function returns a string with the requested value or an empty string if fails. ulong DeviceIndex: device index.   Mci.Sequencer.Status.DivisionType( ulong DeviceIndex) executes the MCI command "status division type". This function returns a string with the requested value or an empty string if fails. ulong DeviceIndex: device index.   Mci.Sequencer.Status.Length( ulong DeviceIndex) executes the MCI command "status length". This function returns a string with the requested value or an empty string if fails. ulong DeviceIndex: device index.   Mci.Sequencer.Status.LengthTrack( ulong DeviceIndex, string TrackNumber) executes the MCI command "status length track number".This function returns a string with the requested value or an empty string if fails. ulong DeviceIndex: device index. string TrackNumber: track number.   Mci.Sequencer.Status.MediaPresent( ulong DeviceIndex) executes the MCI command "status media present". This function returns a string with the requested value or an empty string if fails. ulong DeviceIndex: device index.   Mci.Sequencer.Status.Mode( ulong DeviceIndex) executes the MCI command "status mode". This function returns a string with the requested value or an empty string if fails. ulong DeviceIndex: device index.   Mci.Sequencer.Status.NumberOfTracks( ulong DeviceIndex) executes the MCI command "status number of tracks". This function returns a string with the requested value or an empty string if fails. ulong DeviceIndex: device index.   Mci.Sequencer.Status.Offset( ulong DeviceIndex) executes the MCI command "status offset". This function returns a string with the requested value or an empty string if fails. ulong DeviceIndex: device index.   Mci.Sequencer.Status.Port( ulong DeviceIndex) executes the MCI command "status port". This function returns a string with the requested value or an empty string if fails. ulong DeviceIndex: device index.   Mci.Sequencer.Status.Position( ulong DeviceIndex) executes the MCI command "status position". This function returns a string with the requested value or an empty string if fails. ulong DeviceIndex: device index.   Mci.Sequencer.Status.PositionTrack( ulong DeviceIndex, string TrackNumber) executes the MCI command "status position track number".This function returns a string with the requested value or an empty string if fails. ulong DeviceIndex: device index. string TrackNumber: track number.   Mci.Sequencer.Status.Ready( ulong DeviceIndex) executes the MCI command "status ready". This function returns a string with the requested value or an empty string if fails. ulong DeviceIndex: device index.   Mci.Sequencer.Status.Slave( ulong DeviceIndex) executes the MCI command "status slave". This function returns a string with the requested value or an empty string if fails. ulong DeviceIndex: device index.   Mci.Sequencer.Status.StartPosition( ulong DeviceIndex) executes the MCI command...

Read More

Mci.Sequencer.Set.Time.Format Class

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...

Read More

Mci.Sequencer.Set Class

Mci.Sequencer.Set Class

  About Mci.Sequencer.Set Class   Mci.Sequencer.Set class is mainly used for setting the tempo 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 Class Methods   Mci.Sequencer.Set.Tempo( ulong DeviceIndex, string Tempo) executes the MCI command "set tempo". For a PPQN-based file, Tempo argument is interpreted as BPM (Beats Per Minute). For a SMPTE-based file, Tempo argument is interpreted as FPS (Frames Per Second). ulong DeviceIndex: device index. string Tempo: tempo of the sequence.   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.Tempo(DeviceIndex, "100");//Sets a different tempo 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 } } 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...

Read More

Mci.Sequencer Class

Mci.Sequencer Class

  About Mci.Sequencer Class   Mci.Sequencer class is mainly used for controlling playback of external MIDI (*.mid) files through Mci functions. You can visit the following link for more info about the MCI commands listed on this page: https://msdn.microsoft.com/en-us/library/windows/desktop/dd743373(v=vs.85).aspx   Mci.Sequencer Class Methods   Mci.Sequencer.Open( string FileName ) executes the MCI command "open". This function opens a device as "type sequencer" and returns a valid DeviceIndex which you can use with all other Mci.* functions or 0 otherwise. string FileName: full path to a MIDI (*.mid) file name.   Mci.Sequencer.IsOpen( ulong DeviceIndex ) returns true if the given device is open and false if not. ulong DeviceIndex: device index.   Mci.Sequencer.OpenCount( ) returns the amount of open devices.   Mci.Sequencer.Close( ulong DeviceIndex ) executes the MCI command"close". This function closes an open device and frees memory occupied. Note that when you call Mci.Deinitialize() function Giavapps MIDI will close all open devices for you automatically. ulong DeviceIndex: device index.   Mci.Sequencer.Play( ulong DeviceIndex ) executes the MCI command "play". ulong DeviceIndex: device index.   Mci.Sequencer.PlayFrom( ulong DeviceIndex, string FromPosition) executes the MCI command "play from position". ulong DeviceIndex: device index. string FromPosition: specifies a starting position for the playback.   Mci.Sequencer.PlayFromTo( ulong DeviceIndex, string FromPosition, string ToPosition) executes the MCI command "play from position to position". ulong DeviceIndex: device index. string FromPosition: specifies a starting position for the playback. string ToPosition: specifies an ending position for the playback.   Mci.Sequencer.Stop( ulong DeviceIndex ) executes the MCI command "stop". ulong DeviceIndex: device index.   Mci.Sequencer.Pause( ulong DeviceIndex ) executes the MCI command "pause". ulong DeviceIndex: device index.   Mci.Sequencer.Seek( ulong DeviceIndex, string ToPosition) executes the MCI command "seek to position". ulong DeviceIndex: device index. string ToPosition: specifies the position to stop the seek.   Mci.Sequencer.SeekToStart( ulong DeviceIndex) executes the MCI command "seek to start". ulong DeviceIndex: device index.   Mci.Sequencer.SeekToEnd( ulong DeviceIndex) executes the MCI command "seek to end". 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 } void Update() { //Checks if space key is pressed if(Input.GetKeyDown(KeyCode.Space)) { Mci.Sequencer.Play(DeviceIndex);//Plays the MIDI file } } 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...

Read More

Mci Class

Mci Class

  About Mci Functions   Mci functions use native Windows API and MCI (Media Control Interface) commands for playing external MIDI (*.mid) files through the default MCI MIDI Sequencer. Note that Giavapps MIDI also includes an extra feature for executing custom MCI commands: you can do a lot more with it! You can check the following link for more info about: https://msdn.microsoft.com/it-it/library/windows/desktop/dd798439(v=vs.85).aspx   About Mci Class   Mci class is mainly used for initializing and deinitializing Mci library but also for sending custom MCI commands.   Mci Class Methods   Mci.Initialize() method initializes Mci library. This function should be called before any other function (usually inside Awake() or Start() methods).   Mci.Deinitialize() method deinitializes Mci library. This function should be called for freeing memory used (usually inside OnApplicationQuit() method).   Mci.Command( string Command ) sends a command string to an MCI device. You can check the following link for a full list of available commands: https://msdn.microsoft.com/en-us/library/windows/desktop/dd743373(v=vs.85).aspx string Command: string that specifies an MCI command string.   Code Example using System.Collections; using System.Collections.Generic; using UnityEngine; using Giavapps.MIDI; public class CodeExample : MonoBehaviour { void Awake() { Mci.Initialize();//Initializes Mci } void Update() { //Other function calls could be here or you can start a Coroutine for best performance! } void OnApplicationQuit() { Mci.Deinitialize();//Deinitializes Mci } }   Mci Class Members   Mci.Alias member contains a string which determines the current alias prefix name used for internal MCI commands. The full alias name used internally is equal to Mci.Alias+DeviceIndex ("midi1" for example). You can leave this value as it is or you can edit it (manually) for using your own custom alias name. Note that if this value is set to an empty string Giavapps MIDI will use the default alias prefix name (which is "midi").   Code Example Debug.Log(“MCI ALIAS: “+Mci.Alias);   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...

Read More
content top