SetSoundVolume
-
- Posts: 220
- Joined: 23 Jan 2012, 17:07
- Location: Round Rock, TX
SetSoundVolume
I used SoundVolume() to check the volume setting in my NXT and the result came back as 1, which is what I specified in the NXT menu system. However, when I play a file it is loud. How can I control the volume? The file was one of the "standard" system files, like "! Attention.rso". SetSoundVolume(1) seemed to have no affect.
McSummation aka James
http://www.mcsummation.com/Mindstorms/
http://www.mcsummation.com/Mindstorms/
Re: SetSoundVolume
Not an expert, but a quick trawl though the 'net indicates that you might have to use this (taken from John Hansen's NXC Guide) -
PlayFileEx(filename, volume, bLoop) Function
Play the specified sound file (.rso) or a melody file (.rmd). The filename may be any
valid string expression. Volume should be a number from 0 (silent) to 4 (loudest).
bLoop is a boolean value indicating whether to repeatedly play the file.
PlayFileEx("startup.rso", 3, true);
I think PlayFile just sends the file to the speaker at full volume.
PlayFileEx(filename, volume, bLoop) Function
Play the specified sound file (.rso) or a melody file (.rmd). The filename may be any
valid string expression. Volume should be a number from 0 (silent) to 4 (loudest).
bLoop is a boolean value indicating whether to repeatedly play the file.
PlayFileEx("startup.rso", 3, true);
I think PlayFile just sends the file to the speaker at full volume.
A sophistical rhetorician, inebriated with the exuberance of his own verbosity, and gifted with an egotistical imagination that can at all times command an interminable and inconsistent series of arguments to malign an opponent and to glorify himself.
Re: SetSoundVolume
Hello,
In NXCDefs.h you find:
so PlayTone and PlayFile always play at volume 4. Read the volume via SoundVolume() and use PlayFileEx instead of PlayFile.
Bye marvin
In NXCDefs.h you find:
Code: Select all
#define PlayTone(_f, _d) PlayToneEx(_f, _d, 4, 0)
#define PlayFile(_f) PlayFileEx(_f, 4, 0)
Bye marvin
Bye Marvin
- "I think you ought to know I'm feeling very depressed." - (Android Marvin in "The Hitchhiker's Guide to the Galaxy" by Douglas Adams, 1978)
- "I think you ought to know I'm feeling very depressed." - (Android Marvin in "The Hitchhiker's Guide to the Galaxy" by Douglas Adams, 1978)
-
- Posts: 220
- Joined: 23 Jan 2012, 17:07
- Location: Round Rock, TX
Re: SetSoundVolume
Ofttimes I amaze myself with my ability to look at a line next to the one I should be looking at and not see the correct line.
Thank both of you.
Thank both of you.
McSummation aka James
http://www.mcsummation.com/Mindstorms/
http://www.mcsummation.com/Mindstorms/
Re: SetSoundVolume
don't worry, it's the aging...
;)
;)
Who is online
Users browsing this forum: No registered users and 2 guests