Problem with PlaySound()

Hey all , i need help with playsound , i cant make 3 songs from 1 -3 to play in background one at the time.
One starts , plays until end,ends and then another starts.
I come up across if i made 3 separate playsound functions , jsut one from the other MUSIC3() starts and finishes and thats it i want to play all 3 in background so i could play my game.


tried putting them in void and etc...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
01 include <iostream>  

02 #include <ctime>  

03 #include <string>  

04    

05 using namespace std;  

06    

07 #include "Windows.h"  

08    

09 #include <MMSystem>  

10    

11 void MUSIC1()  

12 {  

13    

14 PlaySound(TEXT("Soundtrack2.wav"), NULL , SND_ASYNC && SND_LOOP );  

15    

16 }  

17 void MUSIC2()  

18 {  

19    

20 PlaySound(TEXT("iskarpa2.wav"), NULL ,  SND_ASYNC && SND_LOOP );  

21    

22    

23 }  

24 void MUSIC3()  

25 {  

26    

27 PlaySound(TEXT("iskarpa.wav"), NULL , SND_ASYNC && SND_LOOP );  

28    

29    

30 }  

31 int main()      

32 {  

33        

34     MUSIC1();   // first  

35        

36     MUSIC2();  // second  

37    

38    MUSIC3();  // third  

You're using && incorrectly. See:

https://msdn.microsoft.com/en-us/library/windows/desktop/dd743680%28v=vs.85%29.aspx

how to combine the flags correctly:

PlaySound(TEXT("MyAppSound"), NULL, SND_ALIAS | SND_APPLICATION); // Note the use of |
Topic archived. No new replies allowed.