News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

winmm.lib

Started by sjums, January 19, 2011, 12:22:22 PM

Previous topic - Next topic

sjums

hello, again, my dears :)

last time i got great help.. this time i think i have a harder question :p

i wan't to set the volume in windows.. but can't fingure out something ^^

So far what I've found out is that i need the lib winmm.lib and invoke the waveOutSetVolume call :) http://msdn.microsoft.com/en-us/library/aa908146.aspx

but how do i get the HWAVEOUT handle to make the call ?

or am I totally wrong on it?

i don't have much code.. but this is what i got :)


.386
.model flat, stdcall
option casemap :none

include \masm32\include\masm32.inc
include \masm32\include\winmm.inc

includelib \masm32\lib\masm32.lib
includelib \masm32\lib\winmm.lib


.data
vol dw 100h,100h
.code
start:

invoke waveOutSetVolume, NULL, addr vol
invoke ExitProcess, 0
end start


oex

You probably dont need it.... NULL should work unless you want to specify a non default device....

   .if rv(waveOutGetVolume, NULL, ADDR oexOldVolume) == MMSYSERR_NOERROR
      invoke waveOutSetVolume, 0, oexVolume
   .endif
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

sjums

NULL doesnt work, with that I mean,it doesn't change the volume

The program assemble and link with no errors and run to end with no crashes, but I'll try with 0 (zero) when I get home :)

Looks like what you did in the example.

Also, it's the master I'm trying to change, so it's. Not some specific device :)

dedndave

Bill Craven gives an example in masm32\examples\bcraven\mvolume

oex

The master volume is different from the wave volume.... Use Dave's example above ^ to manage the master volume....

The wave volume will work on playback of a wave file so long as the DWORD parameter is in the WORD range for right and left speakers.... I dont manually set DWORDs like above but it looks wrong to me....

Is that
vol dw 100h,100h
2 * 256 WORD values?

If so that will barely be audable.... 0FFFFh,0FFFFh is full volume (range 0-65,535)
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

sjums

just to be sure, when you invoke something, the return value will be in the eax register?

Gunner

Yes, majority of the time the return value is in eax.  but it could be in any register really....  you should always check the docs for the function.
~Rob (Gunner)
- IE Zone Editor
- Gunners File Type Editor
http://www.gunnerinc.com

sjums

problem not solved. The solution is in the example dave refers to, but I'm still a bit too noob to fully understand it :)

but thanks for coming with the solution... now i just need to be ready for it :)

dedndave

it's cool
just post the code, as you have it
you can add an attachment to your post below the reply window
it must be a ZIP file - or, at least, it must have a ZIP extension