CFugue
CFugueLib.h
Go to the documentation of this file.
1 /*
2  This is part of CFugue, a C++ Runtime for MIDI Score Programming
3  Copyright (C) 2009 Gopalakrishna Palem
4 
5  For links to further information, or to contact the author,
6  see <http://cfugue.sourceforge.net/>.
7 
8  $LastChangedDate: 2013-12-18 11:08:15 +0530 (Wed, 18 Dec 2013) $
9  $Rev: 200 $
10  $LastChangedBy: krishnapg $
11 */
12 
13 #ifndef __MUSICNOTE_LIB_H__EBEE094C_FF6E_43a1_A6CE_D619564F9C6A__
14 #define __MUSICNOTE_LIB_H__EBEE094C_FF6E_43a1_A6CE_D619564F9C6A__
15 
16 /** @file CFugueLib.h
17  * \brief Main header file for accessing the CFugue Library
18  */
19 
20 /// <Summary>
21 /// This header file can be included directly in your project or through
22 /// CFugueDll.h of the CFugueDll project. If included directly, this
23 /// will be built directly as a satic library. If included through CFugueDll.h
24 /// this will use dllImports through MUSICNOTELIB_API
25 /// </Summary>
26 #ifndef MUSICNOTELIB_API
27 #define MUSICNOTELIB_API
28 #endif // MUSICNOTELIB_API
29 
30 #include "Player.h"
31 #include "MidiDevice.h"
32 
33 #if defined WIN32 || defined _WIN32
34 #define STDCALL __stdcall
35 #else
36 #define STDCALL //__attribute__((stdcall))
37 #endif
38 
39 namespace CFugue /// The C++ Midi Music Programming Library, by Cenacle Research
40 {
41 typedef void (STDCALL *LPFNTRACEPROC)(void* pUserData, const TCHAR* szTraceMsg);
42 typedef void (STDCALL *LPFNERRORPROC)(void* pUserData, long lErrCode, const TCHAR* szErrorMsg, const TCHAR* szToken);
43 
44 extern "C"
45 {
46  MUSICNOTELIB_API typedef void MStringPlayer;
47 
48  MUSICNOTELIB_API void* GetCarnaticMusicNoteReader();
49 
50  /// <Summary>
51  /// Creates a MusicString Player object.
52  /// </Summary>
54 
55  /// <Summary>
56  /// Plays Music string notes on the default MIDI Output device with the default Timer Resolution.
57  /// Use PlayMusicStringWithOpts() to use custom values.
58  /// @param szMusicNotes the Music string to be played on the MIDI output device
59  /// @return True if the notes were played successfully, False otherwise
60  /// </Summary>
61  MUSICNOTELIB_API bool PlayMusicString(const TCHAR* szMusicNotes);
62 
63  /// <Summary>
64  /// Same as PlayMusicString() except that this method accepts Callbacks.
65  /// The Trace and Error callbacks will be used during the Parse of the Music Notes.
66  /// @param szMusicNotes the Music string to be played on the MIDI output device
67  /// @param traceCallbackProc the Callback to used to report Trace messages
68  /// @param errorCallbackProc the Callback to used to report Error messages
69  /// @param pUserData any user supplied data that should be sent to the Callback
70  /// @return True if the notes were played successfully, False otherwise
71  /// </Summary>
72  MUSICNOTELIB_API bool PlayMusicStringCB(const TCHAR* szMusicNotes,
73  LPFNTRACEPROC traceCallbackProc,
74  LPFNERRORPROC errorCallbackProc,
75  void* pUserData);
76 
77  /// <Summary>
78  /// Plays Music string notes on the given MIDI Output device using the given Timer Resolution.
79  /// Use PlayMusicString() to use default values.
80  /// @param szMusicNotes the Music notes to be played
81  /// @param nMidiOutPortID the device ID of the MIDI output port to be used for the play
82  /// @param nTimerResMS preferred MIDI timer resolution, in MilliSeconds
83  /// @return True if Play was successful, False otherwise
84  /// </Summary>
85  MUSICNOTELIB_API bool PlayMusicStringWithOpts(const TCHAR* szMusicNotes, int nMidiOutPortID, unsigned int nTimerResMS);
86 
87  /// <Summary>
88  /// Same as PlayMusicStringWithOpts() except that this method accepts Callbacks.
89  /// The Trace and Error callbacks will be used during the Parse of the Music Notes.
90  /// @param szMusicNotes the Music notes to be played
91  /// @param nMidiOutPortID the device ID of the MIDI output port to be used for the play
92  /// @param nTimerResMS preferred MIDI timer resolution, in MilliSeconds
93  /// @param traceCallbackProc the Callback to used to report Trace messages
94  /// @param errorCallbackProc the Callback to used to report Error messages
95  /// @param pUserData any user supplied data that should be sent to the Callback
96  /// @return True if Play was successful, False otherwise
97  /// </Summary>
98  MUSICNOTELIB_API bool PlayMusicStringWithOptsCB(const TCHAR* szMusicNotes,
99  int nMidiOutPortID,
100  unsigned int nTimerResMS,
101  LPFNTRACEPROC traceCallbackProc,
102  LPFNERRORPROC errorCallbackProc,
103  void* pUserData);
104  /// <Summary>
105  /// Save the given MusicString content into a MIDI output file
106  /// @param szMusicNotes Music Notes to be converted to MIDI output
107  /// @param szOutputFilePath path of the MIDI output file
108  /// @return True if the the content was saved successfully, False otherwise
109  /// </Summary>
110  MUSICNOTELIB_API bool SaveAsMidiFile(const TCHAR* szMusicNotes, const char* szOutputFilePath);
111 
112  //MUSICNOTELIB_API typedef void (*ParseErrorProc)(const CFugue::CParser*, CFugue::CParser::ErrorEventHandlerArgs* pEvArgs);
113  //MUSICNOTELIB_API typedef void (*ParseTraceProc)(const CFugue::CParser*, CFugue::CParser::TraceEventHandlerArgs* pEvArgs);
114 
115  MUSICNOTELIB_API void Parse(const TCHAR* szNotes, LPFNTRACEPROC traceCallbackProc, void* pUserData);
116 
117 } // extern "C"
118 
119 
120 
121 } // namespace CFugue
122 
123 #endif // __MUSICNOTE_LIB_H__EBEE094C_FF6E_43a1_A6CE_D619564F9C6A__
MUSICNOTELIB_API bool PlayMusicString(const TCHAR *szMusicNotes)
Definition: CFugueLib.cpp:68
MUSICNOTELIB_API MStringPlayer * CreateMusicStringPlayer()
Definition: CFugueLib.cpp:46
#define MUSICNOTELIB_API
Definition: CFugueLib.h:27
MUSICNOTELIB_API bool PlayMusicStringWithOpts(const TCHAR *szMusicNotes, int nMidiOutPortID, unsigned int nTimerResMS)
Definition: CFugueLib.cpp:90
MUSICNOTELIB_API bool PlayMusicStringCB(const TCHAR *szMusicNotes, LPFNTRACEPROC traceCallbackProc, LPFNERRORPROC errorCallbackProc, void *pUserData)
Definition: CFugueLib.cpp:73
MUSICNOTELIB_API bool PlayMusicStringWithOptsCB(const TCHAR *szMusicNotes, int nMidiOutPortID, unsigned int nTimerResMS, LPFNTRACEPROC traceCallbackProc, LPFNERRORPROC errorCallbackProc, void *pUserData)
Definition: CFugueLib.cpp:96
MUSICNOTELIB_API bool SaveAsMidiFile(const TCHAR *szMusicNotes, const char *szOutputFilePath)
Definition: CFugueLib.cpp:51

CFugue, the C++ Music Programming Library © Copyright 2009 Cenacle Research India Private Limited Gopalakrishna Palem