Skip to main content
GameDev.net gamedev.net
🔒 Locked

masm midi playback

Started by ErUs Apr 8, 2006 at 10:07 AM 0 replies 1.7k views
Original Post
ErUs
ErUs
i am trying to play a midi from a dll i am writing in masm.

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

      .486                      ; create 32 bit code
      .model flat, stdcall      ; 32 bit memory model
      option casemap :none      ; case sensitive 
      
      .data
Openseq db "open sequencer",0
Loadseq db "open YellowSubmarine.mid alias mymidifile"
Playseq db "play mymidifile",0

Errormsg db "Cant find midi :(",0

      .code
      

;     include files
;     ~~~~~~~~~~~~~
      include \masm32\include\windows.inc
      include \masm32\include\masm32.inc
      include \masm32\include\gdi32.inc
      include \masm32\include\user32.inc
      include \masm32\include\kernel32.inc
      include \masm32\include\Comctl32.inc
      include \masm32\include\comdlg32.inc
      include \masm32\include\shell32.inc
      include \masm32\include\oleaut32.inc
      include \masm32\include\dialogs.inc
      
      include \masm32\include\winmm.inc

      include \masm32\macros\macros.asm     ; the macro file

;     libraries
;     ~~~~~~~~~
      includelib \masm32\lib\masm32.lib
      includelib \masm32\lib\gdi32.lib
      includelib \masm32\lib\user32.lib
      includelib \masm32\lib\kernel32.lib
      includelib \masm32\lib\Comctl32.lib
      includelib \masm32\lib\comdlg32.lib
      includelib \masm32\lib\shell32.lib
      includelib \masm32\lib\oleaut32.lib

      includelib \masm32\lib\winmm.lib

    ; ----------------------------------------
    ; prototypes for local procedures go here
    ; ----------------------------------------

      .data?
        hInstance dd ?

      .code

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

LibMain proc instance:DWORD,reason:DWORD,unused:DWORD 

    .if reason == DLL_PROCESS_ATTACH
      push instance
      pop hInstance
      mov eax, TRUE

    .elseif reason == DLL_PROCESS_DETACH

    .elseif reason == DLL_THREAD_ATTACH

    .elseif reason == DLL_THREAD_DETACH

    .endif

    ret

LibMain endp

TestFunction proc  

    invoke mciSendString,addr Openseq,0,0,0
    invoke mciSendString,addr Loadseq,0,0,0
    invoke mciSendString,addr Playseq,0,0,0
    invoke MessageBox,NULL,addr Errormsg,0,MB_OK
    

    ret
TestFunction endp

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

  comment * -----------------------------------------------------
          You should add the procedures your DLL requires AFTER
          the LibMain procedure. For each procedure that you
          wish to EXPORT you must place its name in the "dll.def"
          file so that the linker will know which procedures to
          put in the EXPORT table in the DLL. Use the following
          syntax AFTER the LIBRARY name on the 1st line.
          LIBRARY dll
          EXPORTS YourProcName
          EXPORTS AnotherProcName
          ------------------------------------------------------- *

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

end LibMain

i see the message box, but i dont hear my midi :(. i know the midi works and its in the right place. please help
-www.freewebs.com/tm1rbrt -> check out my gameboy emulator ( worklog updated regularly )

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.