CSequencer class and Midi Player sample

The simple CD player dialog 


CSequencer

The CSequencer class is the second piece of my MCI wrapper class hierachy after CCdAudio. Unfortunately, It is not well documented yet.

Class Constants

	Time formats for SetTimeFormat()
	FormatMilliseconds
	FormatSmpte24
	FormatSmpte25
	FormatSmpte30
	FormatSmpte30drop
	FormatSongPtr

	Specific status items for GetStatus()
	StatusCurrentTrack
	StatusDivisionType
	StatusLength
	StatusMaster
	StatusOffset
	StatusPort
	StatusPosition
	StatusSlave;
	StatusStart
	StatusTempo
	
	Specific info items for GetInfo()
	InfoCopyright
	InfoFile
	InfoName

	Constants for SetPort()
	SeqNone
	MidiMapper

	Constants for SetMaster() and SetSlave()
	SeqSmpte
	SeqMidi

	Constats for SetSlave()
	SeqFile

	Values returned by GetStatus(StatusDivisionType)
	DivPpqn
	DivSmpte24
	DivSmpte25
	DivSmpte30
	DivSmpte30drop

Member Functions

	Open/Save
	DWORD Open(LPCSTR lpszFileName, BOOL bShareable = FALSE);
	DWORD Save(LPCSTR lpszFileName);
	
	Play/Stop/Pause
	DWORD Play(BOOL bAsync = TRUE);
	DWORD Play(DWORD dwFrom, DWORD dwTo, BOOL bAsync = TRUE);
	DWORD Stop();		
	DWORD Pause();
	DWORD Resume();

	Seek
	DWORD Seek(DWORD dwTo, BOOL bAsync = FALSE);
	DWORD SeekToStart(BOOL bAsync = FALSE);
	DWORD SeekToEnd(BOOL bAsync = FALSE);

	Device status items
	DWORD GetSongLength(DWORD dwTrack);
	DWORD GetNumberOfTracks();		
	DWORD GetCurrentTrack();
	DWORD GetCurrentPos();
	DWORD GetStartPos();
	DWORD GetPort();
	DWORD GetTempo();
	DWORD GetOffset();
	DWORD GetMaster();
	DWORD GetSlave();
	BOOL IsReady();
	
	Track info
	DWORD GetTrackPos(DWORD dwTrack);
	DWORD GetTrackLength(DWORD dwTrack);
	
	Get/Set time format
	DWORD GetTimeFormat();
	DWORD SetTimeFormat(DWORD dwTimeFormat);

	Set
	DWORD SetTempo(DWORD dwTempo);
	DWORD SetPort(DWORD dwPort);
	DWORD SetOffset(DWORD dwOffset);
	DWORD SetMaster(DWORD dwSynchType);
	DWORD SetSlave(DWORD dwSynchType);

Author's note

This is a work in progress: I 'm continuously working to improve it. I'll be grateful to you if you mail me your comments, advice, or bug apparition reports!.

Download source - 68 KB



Comments

  • WAV or MP3 to MIDI converter?

    Posted by Legacy on 02/12/2004 12:00am

    Originally posted by: Evy

    Hi, Im doing a project of an audio converter which is convert WAV and MP3 format to MIDI format. I have difficulty on coding for:
    - read midi,wav,mp3 files in Visual C++,
    - mp3 decode in Visual C++,
    and also some difficulty to understand on the format file of WAV,MIDI and MP3. Does anyone has the algorithm of how the converter works? Can someone help me? Thank you.

    Reply
  • How to convert SMF file to text ?

    Posted by Legacy on 01/18/2004 12:00am

    Originally posted by: frengky

    thx u before, may i get the source code of converting SMF file to text, better in delphi OS,
    thx u

    Reply
  • Downloading Midi Sequence Source Code

    Posted by Legacy on 04/22/2003 12:00am

    Originally posted by: Bruce Stay

    I am trying to download the midi sequencer source code and my browser hangs up. I don't know if it's your web site or not. I need the source code and would like to resolve this problem.
    

    Reply
  • Want wave to midi file conversion source code

    Posted by Legacy on 02/26/2003 12:00am

    Originally posted by: Jaspher

    I am Jaspher from India. I do a project "Wave to midi Conversion". 
    
    A wave file is convert to a midi file and live conversion (play a guitar and sound is stored in .wav and convert .mid then play the .mid file.
    So please help to do this project.

    • I am doing a project as same as yours, Help me .

      Posted by winbets on 10/28/2004 09:20am

      Hi , I am doing a project as same as yours, build a programe to convert wave to midi . Help me ,please .

      Reply
    Reply
  • How we can change the port into serial port interface

    Posted by Legacy on 12/06/2001 12:00am

    Originally posted by: Paulus Adi Nugraha

    I just try your program, it's a good program though
    But I have a question in the above, could we change
    the port into serial port because I want to port your program to WinCE apllication. It seems I get stuck now.
    but any help would be appreciate.

    Thanks in advance.
    Paul

    Reply
  • how to change midi trans (c->c# or g->f#,...)while playing midi

    Posted by Legacy on 03/13/2001 12:00am

    Originally posted by: vietfuong

    how to change midi trans (c->c# or g->f#,...)while playing midi

    Reply
  • informatin

    Posted by Legacy on 01/18/2001 12:00am

    Originally posted by: nehal

    please provied me the basic information  on the programming used in the electronic keyboards, organs and digital piano.
    
    

    i want to be a programmer in this field.

    Reply
  • MCIERR_DEVICE_OPEN Bug and Repeating midi solution

    Posted by Legacy on 12/05/1999 12:00am

    Originally posted by: Sung-woo Jo

    1. Repeating Midi Solution
    
    

    Someone say it's ok by setting a timmer..
    But It's not efficient..
    So .. Add follow Code
    LONG CYourPlayerXX::OnMciNotify(UINT wFlags, LONG lDevId)
    {
    switch(wFlags)
    {
    case MCI_NOTIFY_SUCCESSFUL:
    m_Sequencer.SeekToStart();
    m_Sequencer.Play();
    break;


    2. MCIERR_DEVICE_OPEN Bug

    And This class is so cool,
    But ouppcy 'Midi Device' after it close.
    So U must add this code..

    CSequencer::~CSequencer()
    {
    MCI_GENERIC_PARMS parms;
    parms.dwCallback = (DWORD)m_hMainWnd;

    mciSendCommand(m_wDeviceID, MCI_CLOSE, 0, (DWORD) (LPMCI_GENERIC_PARMS) &parms);
    }

    Reply
  • Receiving SysEx

    Posted by Legacy on 11/07/1999 12:00am

    Originally posted by: Michael Aumer

    Hi, your class helped me a lot. Are you experienced in receiving SysEx-data ? How should the midi-callback-function look like due to receiving Sysex ? Thanks a lot in advance.
    
    

    Mike

    Reply
  • Question

    Posted by Legacy on 08/09/1999 12:00am

    Originally posted by: John Shively

    Hello,

    Sorry, I did not have a chance to review your code. However, I was wondering have you ever heard of a book called. "C programming for MIDI" If yes, is this a good book? Or is it out dated, now that win 95/98 has alot of MIDI functions. Do you know where I can find a copy?

    Sincerely
    John

    Reply
  • Loading, Please Wait ...

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • As all sorts of data becomes available for storage, analysis and retrieval - so called 'Big Data' - there are potentially huge benefits, but equally huge challenges...
  • The agile organization needs knowledge to act on, quickly and effectively. Though many organizations are clamouring for "Big Data", not nearly as many know what to do with it...
  • Cloud-based integration solutions can be confusing. Adding to the confusion are the multiple ways IT departments can deliver such integration...

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date