ImageVerifierCode 换一换
格式:PDF , 页数:16 ,大小:360.10KB ,
资源ID:230487      下载积分:15 金币
验证码下载
登录下载
邮箱/手机:
验证码: 获取验证码
温馨提示:
支付成功后,系统会自动生成账号(用户名为邮箱或者手机号,密码是验证码),方便下次登录下载和查询订单;
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

开通VIP
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.zixin.com.cn/docdown/230487.html】到电脑端继续下载(重复下载【60天内】不扣币)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  
声明  |  会员权益     获赠5币     写作写作

1、填表:    下载求助     索取发票    退款申请
2、咨信平台为文档C2C交易模式,即用户上传的文档直接被用户下载,收益归上传人(含作者)所有;本站仅是提供信息存储空间和展示预览,仅对用户上传内容的表现方式做保护处理,对上载内容不做任何修改或编辑。所展示的作品文档包括内容和图片全部来源于网络用户和作者上传投稿,我们不确定上传用户享有完全著作权,根据《信息网络传播权保护条例》,如果侵犯了您的版权、权益或隐私,请联系我们,核实后会尽快下架及时删除,并可随时和客服了解处理情况,尊重保护知识产权我们共同努力。
3、文档的总页数、文档格式和文档大小以系统显示为准(内容中显示的页数不一定正确),网站客服只以系统显示的页数、文件格式、文档大小作为仲裁依据,平台无法对文档的真实性、完整性、权威性、准确性、专业性及其观点立场做任何保证或承诺,下载前须认真查看,确认无误后再购买,务必慎重购买;若有违法违纪将进行移交司法处理,若涉侵权平台将进行基本处罚并下架。
4、本站所有内容均由用户上传,付费前请自行鉴别,如您付费,意味着您已接受本站规则且自行承担风险,本站不进行额外附加服务,虚拟产品一经售出概不退款(未进行购买下载可退充值款),文档一经付费(服务费)、不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
5、如你看到网页展示的文档有www.zixin.com.cn水印,是因预览和防盗链等技术需要对页面进行转换压缩成图而已,我们并不对上传的文档进行任何编辑或修改,文档下载后都不会有水印标识(原文档上传前个别存留的除外),下载后原文更清晰;试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓;PPT和DOC文档可被视为“模板”,允许上传人保留章节、目录结构的情况下删减部份的内容;PDF文档不管是原文档转换或图片扫描而得,本站不作要求视为允许,下载前自行私信或留言给上传者【曲****】。
6、本文档所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用;网站提供的党政主题相关内容(国旗、国徽、党徽--等)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
7、本文档遇到问题,请及时私信或留言给本站上传会员【曲****】,需本站解决可联系【 微信客服】、【 QQ客服】,若有其他问题请点击或扫码反馈【 服务填表】;文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“【 版权申诉】”(推荐),意见反馈和侵权处理邮箱:1219186828@qq.com;也可以拔打客服电话:4008-655-100;投诉/维权电话:4009-655-100。

注意事项

本文(vb简谱播放代码.pdf)为本站上传会员【曲****】主动上传,咨信网仅是提供信息存储空间和展示预览,仅对用户上传内容的表现方式做保护处理,对上载内容不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知咨信网(发送邮件至1219186828@qq.com、拔打电话4008-655-100或【 微信客服】、【 QQ客服】),核实后会尽快下架及时删除,并可随时和客服了解处理情况,尊重保护知识产权我们共同努力。
温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载【60天内】不扣币。 服务填表

vb简谱播放代码.pdf

1、Option ExplicitConst INVALID NOTE=-1 Code for keyboard keys that we don,thandleDim numDevices As Long number of midi output devicesDim curDevice As Long current midi deviceDim hmidi As Long midi output handleDim rc As Long return codeDim midimsg As Long midi output message bufferDim channel As Integ

2、er midi output channelDim volume As Integer midi volumeDim baseNote As Integer the first note on our piano”Private Declare Sub Sleep Lib kernel32(ByVai dwMilliseconds As Long)Set the value for the starting note of the pianoPrivate Sub base_Click()Dim s As StringDim i As Integers=InputBox(Enter the n

3、ew base note for the keyboard(0-111)”,“Base note”,CStr(baseNote)If IsNumeric(s)Theni=CInt(s)If(i=0 And i 112)Then baseNote=iEnd IfEnd IfEnd SubSelect the midi output channelPrivate Sub chan_Click(Index As Integer)chan(channel).Checked=Falsechannel=Indexchan(channel).Checked=TrueEnd SubPrivate Sub Co

4、mmand1 Click()Dim s As StringDim i As Integers=Textl.TextFor i=1 To Len(s)Select Case Mid(s,i,1)Case LLabel2.Caption=ZCall StartNote(0)Sleep 300Call StopNote(0)c cCase SLabel2.Caption=SCall StartNote(1)Sleep 200Call StopNote(1)Case X”Label2.Caption=XCall StartNote(2)Sleep 300Call StopNote(2)Case DLa

5、bel2.Caption=DCall StartNote(3)Sleep 300Call StopNote(3)c 小Case CLabel2.Caption=CCall StartNote(4)Sleep 300 Call StopNote(4)Case VLabel2.Caption=VCall StartNote(5)Sleep 300Call StopNote(5)c 八Case GLabel2.Caption=GCall StartNote(6)Sleep 300Call StopNote(6)Case B”Labe12.Caption=BCall StartNote(7)Sleep

6、 300Call StopNote(7)Case H”Label2.Caption=HCall StartNote(8)Sleep 300Call StopNote(8)Case N”Label2.Caption=NCall StartNote(9)Sleep 300Call StopNote(9)Case J”Label2.Caption=JCall StartNote(10)Sleep 300Call StopNote(10)Case MLabel2.Caption=MCall StartNote(11)Sleep 300Call StopNote(11)CaseLabel2.Captio

7、n=铸?Call StartNote(12)Sleep 300Call StopNote(12)Case L”Label2.Caption=LCall StartNote(13)Sleep 300Call StopNote(13)Case.Label2.Caption=Call StartNote(14)Sleep 300Call StopNote(14)Case;Label2.Caption=铐?Call StartNote(15)Sleep 300Call StopNote(15)Case VLabel2.Caption=/Call StartNote(16)Sleep 300Call S

8、topNote(16)Case-Label2.Caption=一Call StopNote(0)Sleep 300Call StopNote(0)End SelectNextEnd Sub Open the midi device selected in the menu.The menu index equals the midi device number+1.Private Sub device_Click(Index As Integer)device(curDevice+1).Checked=False device(Index).Checked=True curDevice=Ind

9、ex-1 rc=midiOutClose(hmidi)rc=midiOutOpen(hmidi,curDevice,0,0,0)If(rc 0)ThenMsgBox“Couldnt open midi out,rc=&rc End If End SubIf user presses a keyboard key,start the corresponding midi note Private Sub FormKeyDown(KeyCode As Integer,Shift As Integer)StartNote NoteFromKey(KeyCode)End SubIf user lift

10、s a keyboard key,stop the corresponding midi note Private Sub Form_KeyUp(KeyCode As Integer,Shift As Integer)StopNote NoteFromKey(KeyCode)End SubPrivate Sub Form Load()Dim i As LongDim caps As MIDIOUTCAPSSet the first device as midi mapper device(0).Caption=MIDI Mapper”device(0).Visible=True device(

11、0).Enabled=True Get the rest of the midi devices numDevices=midiOutGetNumDevs()For i=0 To(numDevices-1)midiOutGetDevCaps i,caps,Len(caps)device(i+1).Caption=caps.szPname device(i+1).Visible=True device(i+1).Enabled=TrueNextSelect the MIDI Mapper as the default devicedevice_Click(0)Set the default ch

12、annel channel=0chan(channel).Checked=True Set the base note baseNote=60Set volume range volume=127 vol.Min=127 vol.Max=0 vol.Value=volumeEnd SubPrivate Sub Form_Unload(Cancel As Integer)Close current midi device rc=midiOutClose(hmidi)End SubStart a note when user click on itPrivate Sub key_MouseDown

13、(Index As Integer,Button As Integer,Shift As Integer,X As Single,Y As Single)StartNote(Index)End SubStop the note when user lifts the mouse buttonPrivate Sub key_MouseUp(Index As Integer,Button As Integer,Shift As Integer,X As Single,Y As Single)StopNote(Index)End SubPress the button and send midi s

14、tart event Private Sub StartNote(Index As Integer)If(Index=INVALID_NOTE)Then Exit SubEnd IfIf(key(Index).Value=1)Then Exit SubEnd Ifkey(Index).Value=1midimsg=&H90+(baseNote+Index)*&H100)+(volume*&H10000)+channel midiOutShortMsg hmidi,midimsg End SubRaise the button and send midi stop eventPrivate Su

15、b StopNote(Index As Integer)If(Index=INVALID_NOTE)Then Exit SubEnd Ifkey(Index).Value=0midimsg=&H80+(baseNote+Index)*&H100)+channel midiOutShortMsg hmidi,midimsgEnd SubGet the note corresponding to a keyboard keyPrivate Function NoteFromKey(key As Integer)NoteFromKey=INVALID_NOTE Select Case key Cas

16、e vbKeyZNoteFromKey=0Case vbKeySNoteFromKey=1Case vbKeyXNoteFromKey=2Case vbKeyDNoteFromKey=3Case vbKeyCNoteFromKey=4Case vbKeyVNoteFromKey=5Case vbKeyGNoteFromKey=6Case vbKeyBNoteFromKey=7Case vbKeyHNoteFromKey=8Case vbKeyNNoteFromKey=9Case vbKeyJNoteFromKey=10Case vbKeyMNoteFromKey=11 Case 188 com

17、maNoteFromKey=12Case vbKeyLNoteFromKey=13Case 190 periodNoteFromKey=14Case 186 semicolonNoteFromKey=15Case 191 forward slash NoteFromKey=16End SelectEnd FunctionSet the volumePrivate Sub vol_Change()volume=vol.ValueEnd SubPrivate Sub TimerITimer()Dim i As IntegerRandomizei=Rnd*12Select Case iCase 0L

18、abel2.Caption=ZCall StartNote(0)Sleep 500Call StopNote(0)Case 1Label2.Caption=SCall StartNote(1)Sleep 500Call StopNote(1)Case 2Label2.Caption=XCall StartNote(2)Sleep 500Call StopNote(2)Case 3Label2.Caption=DCall StartNote(3)Sleep 500Call StopNote(3)Case 4Label2.Caption=CCall StartNote(4)Sleep 500Cal

19、l StopNote(4)Case 5Label2.Caption=VCall StartNote(5)Sleep 500Call StopNote(5)Case 6Label2.Caption=BCall StartNote(6)Sleep 500Call StopNote(6)Case 7Label2.Caption=GCall StartNote(7)Sleep 500Call StopNote(7)Case 8Labe 12.Caption=Call StartNote(8)Sleep 500Call StopNote(8)Case 9Label2.Caption=NCall Star

20、tNote(9)Sleep 500Call StopNote(9)Case 10Label2.Caption=JCall StartNote(10)Sleep 500Call StopNote(10)Case 11Label2.Caption=MCall StartNote(11)Sleep 500Call StopNote(11)End SelectEnd SubThis is a complete piano application u can contact me at Option ExplicitPublic Const MAXPNAMELEN=32 Maximum product

21、name length Error values for functions used in this sample.See the function for more informationPublic Const MMSYSERR_BASE=0Public Const MMSYSERR_BADDEVICEID=(MMSYSERR_BASE+2)device IDout of rangePublic Const MMSYSERR_INVALPARAM=(MMSYSERR_BASE+11)invalidparameter passedPublic Const MMSYSERR_NODRIVER

22、=(MMSYSERR_BASE+6)no devicedriver presentPublic Const MMSYSERR_NOMEM=(MMSYSERR_BASE+7)memoryallocation errorPublic Const MMSYSERR_INVALHANDLE=(MMSYSERR_BASE+5)devicehandle is invalidPublic Const MIDIERR_BASE=64Public Const MIDIERR_STILLPLAYING=(MIDIERR_BASE+1)still something playingPublic Const MIDI

23、ERR_NOTREADY=(MIDIERR_BASE+3)hardwareis still busyPublic Const MIDIERR_BADOPENMODE=(MIDIERR_BASE+6)operationunsupported w/open mode 5 User-defined variable the stores information about the MIDI output device.Type MIDIOUTCAPSwMid As Integer Manufacturer identifier of thedevice driver for the MIDI out

24、put device For a list of identifiers,seethe Manufacturer Indentifier topic in theMultimedia Reference of thePlatform SDK.wPid As Integer Product Identifier Product ofthe MIDI output device.For a list of product identifiers,see the Product Identifiers topic in the MultimediaReference of the Platform

25、SDK.vDriverVersion As Long Version number of the devicedriver for the MIDI output device.The high-order byte is the major version number,and the low-order byte isthe minor version number.szPname As String*MAXPNAMELEN Product name in a null-terminated string.wTechnology As Integer One of the followin

26、g thatdescribes the MIDI output device:MOD_FMSYNTH-The device is anFM synthesizer.MOD_MAPPER-The device is theMicrosoft MIDI mapper.MOD_MIDIPORT-The device is a MIDI hardware port.MOD_SQSYNTH-The device is asquare wave synthesizer.MOD_SYNTH-The device is a synthesizer.wVoices As Integer Number of vo

27、ices supported byan internal synthesizer device.If thedevice is a port,this member is not meaningful and is set to 0.wNotes As Integer Maximum number of simultaneousnotes that can be played by an internal synthesizer device.If the device is a port,this member is not meaningfuland is set to 0.wChanne

28、lMask As Integer Channels that an internalsynthesizer device responds to,where the least significant bit refers to channel 0 and the most significant bit to channel 15.Port devices that transmit on all channels set this member to OxFFFF.dwSupport As Long One of the following describesthe optional fu

29、nctionality supported bythe device:MIDICAPS_CACHE-Supportspatch caching.MIDICAPS_LRVOLUME-Supportsseparate left and right volume control.MIDICAPS_STREAM-Providesdirect support for the midiStreamOut function.MIDICAPS_VOLUME-Supportsvolume control.If a device supports volume changes,the MIDICAPS_VOLUM

30、E flag will be set for the dwSupport member.If a device supports separate volume changes on the left and right channels,both the MIDICAPS_VOLUME and theMIDICAPS_LRVOLUME flags will be set for this member.End TypeDeclare Function midiOutGetNumDevs Lib winmni()As IntegerThis function retrieves the num

31、ber of MIDI output devices present in the system.The function returns the number of MIDI output devices.A zero return value meansthere are no MIDI devices in the system.Declare Function midiOutGetDevCaps Lib winmm.dll Alias“midiOutGetDevCapsA”(ByVai uDevicelD As Long,IpCaps As MIDIOUTCAPS,ByVai uSiz

32、e As Long)As LongThis function queries a specified MIDI output device to determine its capabilities.The function requires the following parameters;uDevicelD-unsigned integer variable identifying of the MIDIoutput device.Thedevice identifier specified by this parametervaries from zero to one less tha

33、n the number of devices present.Thisparameter can also be a properly cast device handle.IpMidiOutCaps-address of a MIDIOUTCAPS structure.This structure is filled with information about the capabilities of the device.cbMidiOutCaps-the size,in bytes,of the MIDIOUTCAPS structure.Use the Lenfunction wit

34、h the MIDIOUTCAPS variable as the argument to get this value.The function returns MMSYSERR_NOERROR if successful or one of thefollowing error values:MMSYSERR_BADDEVICEIDrange.MMSYSERR_INVALPARAM invalid.MMSYSERR_NODRIVER MMSYSERR_NOMEM string description.The specified device identifier is out ofThe

35、specified pointer or structure isThe driver is not installed.The system is unable to load mapperDeclare Function midiOutClose Lib“winmm.dll(ByVai hMidiOut As Long)As Long The function closes the specified MIDI output device.The function requires ahandle to the MIDI output device.If the function is s

36、uccessful,the handle is nolonger valid after the call to this function.A successful function call returnsMMSYSERR_NOERROR.A failure returns one of the following:MIDIERR_STILLPLAYING MMSYSERR_INVALHANDLE MMSYSERR_NOMEMBuffers are still in the queue.The specified device handle is invalid.The system is

37、 unable to load mapper string description.Declare Function midiOutOpen Lib winmm.dll”(IphMidiOut As Long,ByVai uDevicelD As Long,ByVai dwCallback As Long,ByVai dwlnstance As Long,ByVai dwFlags As Long)As Long The function opens a MIDI output device for playback.The function requires thefollowing par

38、ametersIphmo-is filled with adevice.The handleother MIDI output uDevicelD-is to be opened.dwCal1back-handle,a thread thread called during to the progress of set this value to 0.Address of an HMIDIOUT handle.This locationhandle identifying the opened MIDI outputis used to identify the device in calls

39、 tofunctions.Identifier of the MIDI output device thatAddress of a calIback function,an eventidentifier,or a handle of a window orMIDI playback to process messages related the playback.If no calIback is desired,dwCallbacklnstance-User instance data passed to the callback.Set this value to 0.dwFlags-

40、CalIback flag for opening the device.Set this value to 0.The function returns MMSYSERR_NOERROR if successful or one of the following error values:MIDIERR_N0DEVICE-No MIDI port was found.This error occursonly when the mapper is opened.MMSYSERR_ALLOCATED-The specified resource is already allocated.MMS

41、YSERR BADDEVICEID-The specified device identifier is out ofrange.MMSYSERR_INVALPARAM-The specified pointer or structure is invalid.MMSYSERR_NOMEM-The system is unable to allocate or lockmemory.Declare Function midiOutShortMsg Lib“winmm.dll”(ByVai hMidiOut As Long,ByVai dwMsg As Long)As LongThis func

42、tion sends a short MIDI message to the specified MIDI output device.The functionrequires the handle to the MIDI output device and a message is packed into a doubleword value with the first byte of the message in the low-order byte.See the code sample forhow to create this value.The function returns MMSYSERR_NOERROR if successful or one of the following error values:MIDIERR_BADOPENMODE-The application sent a message without a status byte to a stream handle.MIDIERR_NOTREADY-The hardware is busy with other data.MMSYSERR_INVALHANDLE-The specified device handle is invalid.

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        获赠5币

©2010-2024 宁波自信网络信息技术有限公司  版权所有

客服电话:4008-655-100  投诉/维权电话:4009-655-100

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :gzh.png    weibo.png    LOFTER.png 

客服