News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

I guess GoAsm woes or the Hp Pavilion

Started by shankle, May 18, 2013, 02:33:39 AM

Previous topic - Next topic

shankle

; Been a long time since I wrote this system and can't for the life of me
; remember how I arrived at the noteC3 thingie.
; Same for the Playnotes.
; This uses the Midi disaster.

; When I wrote this system in Windows 98 32-bit, the sound worked just fine.
; It also worked in Vista 32-bit.
; It also works in Windows 7 32-bit using MASM32 on my Hp Pavilion 64-bit puter.

; THE SOUND WILL NOT work in my converted to GoAsm 32-bit version on
; the 64-bit Pavilion or on a Windows 7 32-bit puter. 
; In the (noteC3) I have no idea how I got the "7f" or the "90".
; The 3rd byte is the pitch of the note. Like "30" represents the note "C"
; 3rd octave. 

; two octave scale C to C
noteC3           dd    007f3090h
noteD3           dd    007f3290h
noteE3           dd    007f3490h
noteF3           dd    007f3590h
noteG3           dd    007f3790h
noteA3           dd    007f3990h
noteB3           dd    007f3b90h
noteC4           dd    007f3c90h
noteD4           dd    007f3e90h
noteE4           dd    007f4090h
noteF4           dd    007f4190h
noteG4           dd    007f4390h
noteA4           dd    007f4590h
noteB4           dd    007f4790h
noteC5           dd    007f4890h

duration         dd   00000226h
lphmo            dd   0
noteX            dd   0
tc               dd   0


; this code is repeated 15 times as I am processing 1 note at a time.
     lea eax,[noteC3] etc.
     mov [noteX],eax             
     invoke PlayNotes, [noteX]                ;Play C3           
     
; other code     

     
PlayNotes:
    FRAME noteX
      invoke midiOutOpen, offset lphmo, -1, NULL, 0, CALLBACK_NULL
     
    ; ecx points to notes
    ; edx points to the duration of the note
      mov ecx,[noteX]
      lea edx,duration                  ; duration of note
      push ecx
      push edx
      invoke midiOutShortMsg, [lphmo],ecx        ; varying notes     
      pop edx
      pop ecx
      push ecx
      push edx         
      invoke GetTickCount   ; get a time reference
      pop edx
      pop ecx
      mov [tc],eax
      mov eax,[edx]
      add [tc],eax
.TimeCount
      push ecx
      push edx
      invoke GetTickCount
      pop edx
      pop ecx
      cmp [tc],eax
       jg <.TimeCount
      invoke midiOutReset, [lphmo]         
      invoke midiOutClose, [lphmo]
      ret
ENDF
     

dedndave

interesting to see midi pay notes from memory
i would like to see the code when you get it working   :P

shankle

Problem solved.
See the same thing in the GoAsm forum.