Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[C++] Is there a way to change the speaker volume?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
talkerzero
Grandmaster Cheater
Reputation: 1

Joined: 24 Jul 2008
Posts: 560
Location: California

PostPosted: Mon Feb 09, 2009 3:21 pm    Post subject: [C++] Is there a way to change the speaker volume? Reply with quote

Regardless of how much coding must be done, is it possible to change the speaker volume with C++? Drivers, etc.?

If so, example please? Smile
Back to top
View user's profile Send private message Visit poster's website
Noz3001
I'm a spammer
Reputation: 26

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Mon Feb 09, 2009 3:32 pm    Post subject: Reply with quote

http://msdn.microsoft.com/en-us/library/ms713762(VS.85).aspx

Maybe this?
Back to top
View user's profile Send private message MSN Messenger
talkerzero
Grandmaster Cheater
Reputation: 1

Joined: 24 Jul 2008
Posts: 560
Location: California

PostPosted: Mon Feb 09, 2009 4:01 pm    Post subject: Reply with quote

I have XP, so.. yeah. Sad

But using noz3001's reply, here's the test code I'm using:

Code:
#include <windows.h>

int main(){
   for(;;){
      while(!GetAsyncKeyState(VK_F12))
         Sleep(100);
      while(GetAsyncKeyState(VK_F12))
         Sleep(10);
      waveOutSetVolume(0, 0);
   }
}


I'm getting this error:
Code:
main.obj : error LNK2019: unresolved external symbol __imp__waveOutSetVolume@8 referenced in function _main


Help?
Back to top
View user's profile Send private message Visit poster's website
talkerzero
Grandmaster Cheater
Reputation: 1

Joined: 24 Jul 2008
Posts: 560
Location: California

PostPosted: Mon Feb 09, 2009 6:48 pm    Post subject: Reply with quote

Thanks, got it working. Now I want to play a sound. I'm using..

Code:
PlaySound("beat.wav", 0, SND_FILENAME | SND_LOOP);


It keeps returning 0 and nothing happens. "beat.wav" exists in the same directory as my program. Help?
Back to top
View user's profile Send private message Visit poster's website
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Mon Feb 09, 2009 6:50 pm    Post subject: Reply with quote

talker0 wrote:
Thanks, got it working. Now I want to play a sound. I'm using..

Code:
PlaySound("beat.wav", 0, SND_FILENAME | SND_LOOP);


It keeps returning 0 and nothing happens. "beat.wav" exists in the same directory as my program. Help?


Try adding the full path and see if it works.
Back to top
View user's profile Send private message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Mon Feb 09, 2009 6:54 pm    Post subject: Reply with quote

How are you running your program.

Because if you run via F5 (Run&Debug) I believe it uses the directory where all the source files are located. Full path would work or put the file in both the Debug/Release folder and source folder to see if it works then.

_________________
Back to top
View user's profile Send private message
talkerzero
Grandmaster Cheater
Reputation: 1

Joined: 24 Jul 2008
Posts: 560
Location: California

PostPosted: Mon Feb 09, 2009 6:58 pm    Post subject: Reply with quote

I've changed my settings to build the program on my desktop. I'm building it then running it manually. My WAV file is also on my desktop. I read somewhere that I need to import (or something like that) winmm.lib. Help? I already have #pragma comment(lib, "winmm.lib") at the top, and typed in "winmm.lib" in Project Properties >> Linker >> Input >> Additional Dependencies. PlaySound still returning 0. Any ideas?
Back to top
View user's profile Send private message Visit poster's website
talkerzero
Grandmaster Cheater
Reputation: 1

Joined: 24 Jul 2008
Posts: 560
Location: California

PostPosted: Mon Feb 09, 2009 7:06 pm    Post subject: Reply with quote

Hmm.. interesting. Now it's returning 1, but nothing's playing. My speaker's on, I've also set the volume back at 0xFFFF. Sad
Back to top
View user's profile Send private message Visit poster's website
talkerzero
Grandmaster Cheater
Reputation: 1

Joined: 24 Jul 2008
Posts: 560
Location: California

PostPosted: Mon Feb 09, 2009 7:20 pm    Post subject: Reply with quote

I think it's ultimately a problem with my computer and sound.. I can never listen to the sound on YouTube either. Ever since a couple years ago.. something happened. Sad
Back to top
View user's profile Send private message Visit poster's website
BanMe
Master Cheater
Reputation: 0

Joined: 29 Nov 2005
Posts: 375
Location: Farmington NH, USA

PostPosted: Mon Feb 09, 2009 7:48 pm    Post subject: Reply with quote

check Control Panel ->Computer Management->Device Manager

if u see a ' Exclamation ' in the list goto your manufacturers website and download the drivers..

if not then i would suggest reinstalling your audio driver Wink

if this fails try VirtualSound Very Happy

regards BanMe

_________________
don't +rep me..i do not wish to have "status" or "recognition" from you or anyone.. thank you.
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites