Advertisement

Music (Not Dmusic) volume

Started by January 25, 2000 02:43 PM
5 comments, last by jtecin 24 years, 10 months ago
Okay I am playing midi files using winmm's mciSendString() commands. Here is my function to open the music: void Open_Song(char *songname) { char OpenCommand[80]; MCIERROR test; sprintf(OpenCommand, "open "); strcat(OpenCommand, songname); strcat(OpenCommand, " type sequencer alias song"); test = mciSendString(OpenCommand, 0, 0, 0); if (test == 0) music_enabled = 1; } // end Open_Music Okay, that was just to show what I was talking about. This works fine and so does playing and closing it. However, I would like to know the command for changing the volume (and the volume range). Does anybody know? Any help would be appreciated. Edited by - jtecin on 1/26/00 3:10:20 PM
Did I stump the whole board?
Advertisement
No, it''s just hard to keep up with all the new posts.

The function is midiOutSetVolume().

Mason McCuskey
Spin Studios - home of Quaternion, 2000 GDC Indie Games Fest Finalist!
www.spin-studios.com
Founder, Cuttlefish Industries
The Cuttlefish Engine lets anyone develop great games for iPad, iPhone, Android, WP7, the web, and more!
Thanks for responding. Anyway, could you show me an example of how to use this function? I was wondering what kind and how many parameters it takes, as well as the range on the volume. Thanks.


All MCI MIDI commands are explained in the MSDN help files.

MMRESULT midiOutSetVolume(
HMIDIOUT hmo,
DWORD dwVolume
);

Parameters
hmo
Handle of an open MIDI output device. This parameter can also contain the handle of a MIDI stream, as long as it is cast to HMIDIOUT. This parameter can also be a device identifier.
dwVolume
New volume setting. The low-order word contains the left-channel volume setting, and the high-order word contains the right-channel setting. A value of 0xFFFF represents full volume, and a value of 0x0000 is silence.
If a device does not support both left and right volume control, the low-order word of dwVolume specifies the mono volume level, and the high-order word is ignored.

Return Values
Returns MMSYSERR_NOERROR if successful or an error otherwise. Possible error values include the following:

Value Description
MMSYSERR_INVALHANDLE The specified device handle is invalid.
MMSYSERR_NOMEM The system is unable to allocate or lock memory.
MMSYSERR_NOTSUPPORTED The function is not supported.

if you don''t have it.

Note that this isn''t supported on some cards.

-fel
Previous post was mine, I have no idea why this thing keeps losing my name when I hit the button.

-fel
~ The opinions stated by this individual are the opinions of this individual and not the opinions of her company, any organization she might be part of, her parrot, or anyone else. ~
Advertisement
Okay, thanks.

This topic is closed to new replies.

Advertisement