Playing Sound In D3D Menu

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

Crazywink

Hacker
Meme Tier VIP
Dank Tier Donator
Jul 18, 2012
626
4,613
17
Hey guys, I made this quick template so you guys can see how you can play a sound inside your D3D Menu.

Thanks to Fleep for his D3D Template, I just quickly changed the layout and added in the code for the sound to that project. :)

This isn't really a practical D3D Menu for anything, but a simple one so you can see how everything is working. :)

Practical use:
Practical use of this would be to include it with your menu, and every time someone turns an option on/off play the sound.

Code used to make player:
The code is super simple. First we start off including the Winmm library
C++:
#pragma comment( lib, "Winmm.lib" )
Then actually playing the song:
C++:
if(GetAsyncKeyState(VK_RIGHT))
	{
PlaySound("C:\\SoundFile.wav",NULL,SND_SYNC);
}
Very simple stuff. :) You can download the project to see exactly how it's used.


Quick picture of it since people seem to like that :)


crazywink
 

Fleep

Founder
Meme Tier VIP
May 20, 2012
572
11,023
6
Thats really straight forward, Ive never considered doing it for a D3D menu but that seems great.

Fleep
 

Crazywink

Hacker
Meme Tier VIP
Dank Tier Donator
Jul 18, 2012
626
4,613
17
Fleep said:
Thats really straight forward, Ive never considered doing it for a D3D menu but that seems great.

Fleep
Yeah, really simple but adds a nice touch to the menu. :)
 

c5

Kim Kong Trasher
Dank Tier VIP
Dank Tier Donator
Jul 19, 2012
1,187
19,938
76
Yeah, it adds the fancy touch to it, really great contribution. Thanks for sharing :)
 

BlackPitchPL

Coder
Full Member
Nobleman
May 24, 2012
166
783
1
My menu sound :p

sound.cpp
C++:
#include "cSound.h"

#pragma comment(lib, "WinMM.Lib")

void cSound::swav::playsound(LPCSTR sound)
{
	sndPlaySound(sound,SND_ASYNC);
}
void cSound::swav::playsoundmem(LPCSTR sound)
{
	sndPlaySound(sound,SND_ASYNC|SND_MEMORY);
}
sound.h
C++:
#include "stdafx.h"
#include <mmsystem.h>

#pragma once

// Stripped Sound Class kinda pointless for public release since i stripped all the cool functions but more pain to remove lol

class cSound
{
	
public:

	struct smp3
	{
	
	}mp3;

	struct swav
	{
	void playsound(LPCSTR sound);
	void playsoundmem(LPCSTR sound);
	}wav;

};
extern cSound Sound;
stdafx :p
C++:
#pragma once

#define WIN32_LEAN_AND_MEAN
#define WIN32_EXTRA_LEAN

#include <windows.h>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <d3d8.h>
#include <d3dx8.h>
and u need to add some 2 declarers but post are limited to 2000 chars :p
 

Helgon

Newbie
Full Member
Aug 6, 2012
8
254
0
thanks for the snippets, easy but if never done u dont know how :)
 

KaizenLouie

Newbie
Full Member
Nov 15, 2016
11
48
0
I think its a good practice (probably better) to make an example that the resource used will be coming from the project's resource folder/section.

btw, good idea and can be implemented even on non-d3d stuff.
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods