[Top Page][All Pages][Recent Changes]

Edit History:Diff

Changes of MusicVillage:MIDIループ再生 between Epoch and 2008/01/14 17:03:27 JST

  • + added lines
  • - deleted lines

Return to the edit history

+ * MusicVillageとは
+ RPGツクール2000などに準拠したMIDIを、継ぎ目なしでループ再生できるDLLです。
+ 
+ * 配布元
+ http://sky_dreamer.at.infoseek.co.jp/softwares/mv.htm
+ 
+ * 最新のバージョン
+ 2.6(2008/01/14現在)
+ 
+ * 注意点
+ float型変数を利用するので、変換モジュールを利用する必要がある。下記URLを参考。
+ http://sprocket.babyblue.jp/html/hsp_koneta3.htm#tofloat
+ 
+ * ヘッダファイル
+  // MVillage.as
+  #uselib "MVillage.dll"
+  ;#func MusicVillageInitialize "MusicVillageInitialize"
+  #func MVOpenDevice "MVOpenDevice" int, int
+  #func MVCloseDevice "MVCloseDevice"
+  #func MVLoadMusic "MVLoadMusic" sptr
+  #func MVPlayMusic "MVPlayMusic"
+  #func MVStopMusic "MVStopMusic"
+  #func MVWaitMusic "MVWaitMusic"
+  #func MVRestartMusic "MVRestartMusic"
+  #func MVGetStatus "MVGetStatus" int
+  #func MVSendSysEx "MVSendSysEx" int, int
+  #func MVSeek "MVSeek" int
+  #func MVOpenSound "MVOpenSound" int, int, sptr
+  #func MVCloseSound "MVCloseSound" int
+  #func MVPlaySound "MVPlaySound" int, int
+  #func MVStopSound "MVStopSound" int
+  #func MVWaitSound "MVWaitSound" int
+  #func MVRestartSound "MVRestartSound" int
+  #func MVSetCaps "MVSetCaps" int, int
+  #func MVGetCaps "MVGetCaps" int, int
+  #func MVGetVersion "MVGetVersion" int
+  #func MVGetIcon "MVGetIcon" int
+  #func MVGetErrorString "MVGetErrorString" int, var, int
+  #func MVChooseDeviceDialog "MVChooseDeviceDialog" int
+  
+  //  MusicVillage constant values
+  #define MV_SYSEX_GM					0		//  Reset by GM system
+  #define MV_SYSEX_GS					-1		//  Reset by GS system
+  #define MV_SYSEX_XG					-2		//  Reset by XG system
+  #define MV_NO_SINGLE				-1		//  Not use single instrument
+  #define MV_MAX_STRING				0x80
+  #define MV_INVALID_DEVICE_ID		-2
+  #define MV_MIN_TEMPO				0.25
+  #define MV_MAX_TEMPO				2.00
+  #define MV_MIN_INSTRUMENT			0
+  #define MV_MAX_INSTRUMENT			127
+  #define MV_MIN_FADE_TIME			1000
+  #define MV_MAX_FADE_TIME			10000
+  #define MV_DEFAULT_TIMEOUT			1000
+  #define MV_MIN_TIMEOUT				100
+  #define MV_MAX_TIMEOUT				1000
+  #define MV_MIN_VOLUME				0
+  #define MV_MAX_VOLUME				100
+  
+  //  Constant error values - there will be returned by the function calling.
+  #define MVERR_NOERROR				0
+  #define MVERR_SUCCESS				MVERR_NOERROR
+  #define MVERR_RETURNOK				MVERR_NOERROR
+  #define MVERR_LACKMEMORY			10
+  #define MVERR_SYSTEMERROR			11
+  #define MVERR_INITIALIZE			12
+  #define MVERR_RETURNCANCEL			13
+  #define MVERR_LOAD_STRING			14
+  #define MVERR_FAILED_SET_TIMER		19
+  #define MVERR_FILE_OPEN				20
+  #define MVERR_FILE_INVALID_FORMAT	21
+  #define MVERR_FILE_NOT_PCM			22
+  #define MVERR_UNSUPPORTED_FORMAT	29
+  #define MVERR_DEVICE_OPENED			30
+  #define MVERR_DEVICE_CLOSED			31
+  #define MVERR_DEVICE_NO_ENTRY		32
+  #define MVERR_DEVICE_INVALID_NUMBER	33
+  #define MVERR_DEVICE_CANNOT_OPEN	34
+  #define MVERR_WAVE_DEVICE_NO_ENTRY	35
+  #define MVERR_NOW_PLAYING			40
+  #define MVERR_NOT_PLAYING			41
+  #define MVERR_TIMEOUT				42
+  #define MVERR_INVALID_COMMAND		43
+  #define MVERR_INVALID_STATE			44
+  #define MVERR_INVALID_HANDLE		45
+  #define MVERR_INVALID_PARAMETER		46
+  #define MVERR_INVALID_CAPS			47
+  #define MVERR_NOBUFFERONMEMORY		48
+  #define MVERR_INVALID_CALL_INTERVAL	49
+  #define MVERR_NOW_FADINGOUT			50
+  #define MVERR_NOW_FADINGIN			51
+  #define MVERR_FILE_TOO_LARGE		52
+  
+  //  Types of MusicVillage capabilities
+  #define	MVCAPS_ACTIONFLAG			0		//  For more information, see MVAF_*
+  #define	MVCAPS_CALLBACKPTR			1
+  #define	MVCAPS_USERPARAM			2
+  #define	MVCAPS_TEMPO				3
+  #define	MVCAPS_FADEOUT				4		//	Set fade out, and Get command returns true or false of being fade out.
+  #define	MVCAPS_FADEIN				5		//  Set fade in, and Get command returns true or false of being fade in.
+  #define	MVCAPS_SINGLE				6
+  #define	MVCAPS_TIMEOUT				7
+  #define	MVCAPS_SHORTMSG				8		//  Send a short message to device through this function, and get a last message sent.
+  #define	MVCAPS_VOLUME				9		//  Set and get muster volume
+  
+  //  Callback messages / sent in dwMsg params	//  Params
+  #define MVMSG_DEVICE_OPENERROR		0xFF		//  (LONG)DeviceNumber
+  #define MVMSG_DEVICE_OPEN			0x00		//  (LONG)DeviceNumber
+  #define MVMSG_DEVICE_CLOSE			0x01		//  NULL
+  #define MVMSG_LOAD_FILE				0x02		//  (LPCSTR)lpFileName
+  #define MVMSG_PLAY					0x03		//  NULL
+  #define MVMSG_STOP					0x04		//  NULL
+  #define MVMSG_WAIT					0x05		//  NULL
+  #define MVMSG_RESTART				0x06		//  (DWORD)Restart Point
+  #define MVMSG_LOOP					0x07		//  NULL
+  #define MVMSG_FADEOUT				0x08		//  NULL
+  #define MVMSG_FADEIN				0x09		//  NULL
+  
+  //  Constant values of state in MusicVillage
+  #define MVS_EMPTY					-1		//  Device has not opened.
+  #define MVS_NOMSG					0		//  Device has opened, but music data has not read.
+  #define MVS_PLAYING					1
+  #define MVS_WAIT					2
+  #define MVS_STOP					3
+  
+  //  Flags of MVCAPS_ACTIONFLAG
+  #define MVAF_GMRESET				0x0001	//  --------
+  #define MVAF_GSRESET				0x0002	//  Cannot exclusive.
+  #define MVAF_XGRESET				0x0004	//  --------
+  #define MVAF_NOSENDSYSEX			0x0010
+  
+  //  Flags for CDDLG struct in dwFlags member
+  //    NOTE: Under 7 bits are masks to access to the member
+  #define CDDF_HWNDPARENT				0x0001
+  #define CDDF_DEVICENAME				0x0002
+  #define CDDF_HOOKPROC				0x0004
+  //    NOTE: Upper 8 bits are flags of actions
+  #define CDDF_RESERVED				0x0100
+  #define CDDF_INITIALIZE_DEVICE		0x0200
+  #define CDDF_HIDEMIDIMAPPER			0x0400
+  #define CDDF_ACTIVEUPDATE			0x0800
+  
+  //  Play back flags for Wave sound.
+  #define PBO_PLAYBACK				0x80000000		//  This flag is used in MusicVillage. A Client application don't have to use this.
+  #define PBO_USE_LOOP_BEGIN			0x00000001		//  Enable the chunk 'LPBn'
+  #define PBO_USE_LOOP_END			0x00000002		//  Enable the chunk 'LBEd'
+  #define PBO_LOOP					0x00000004		//  Sound is repeated when the playing finishes.
+  
+  // macro
+  #define ctype DLLVERSION_MAJOR(%1)			(((%1) & 0xFF000000) >> 24)
+  #define ctype DLLVERSION_MINOR(%1)			(((%1) & 0x00FF0000) >> 16)
+  #define ctype DLLVERSION_BUILD(%1)			(((%1) & 0x0000FFFF) >>  0)
+