heho, ik kwam op delphi3000.com een geweldig stukje code tegen
namelijk hoe je een .wav file in je exe mee kan nemen... maar ik zou graag gewoon .mod (protracker) files meenemen
deze speel je normaal af met bassmod.dll heb al geprobeert om een mod file in een .res te compilen, dat lukte wel, alleen afspelen lukt niet... hier is de code voor het menemen van een wav
hier heb ik die bassmod vandaan:
http://www.torry.ru/audio.htm
kan iemand mij een endje opweg helpen? het liefst speel ik
dus een .mod file af zonder afhanklijk te zijn van een
dll en een apparte .mod
bvd!
code:
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
| Step 1) Make an SOUNDS.RC file
Use NotePad - it should look like this:
#define WAVE WAVEFILE
SOUND1 WAVE "anysound.wav"
SOUND2 WAVE "anthersound.wav"
SOUND3 WAVE "hello.wav"
Step 2) Compile it into a RES file
Use the program that comes with Delphi - BRCC32.EXE. Use a command line that looks like:
BRCC32.EXE -foSOUND32.RES SOUNDS.RC
You should end up with a file called 'sound32.res'
Step 3) Put it in your program
In the DPR file, put it under the {$R *.RES} line like this:
{$R SOUND32.RES}
Step 4) Put this code in to play an embedded sound
USES MMSYSTEM
Procedure PlayResSound(RESName:String;uFlags:Integer);
var
hResInfo,hRes:Thandle;
lpGlob:Pchar;
Begin
hResInfo:=FindResource(HInstance,PChar(RESName),MAKEINTRESOURCE('WAVEFILE'));
if hResInfo = 0 then
begin
messagebox(0,'Could not find this Resource',PChar(RESName),16);
exit;
end;
hRes:=LoadResource(HInstance,hResinfo);
if hRes = 0 then
begin
messagebox(0,'Could not load this Resource',PChar(RESName),16);
exit;
end;
lpGlob:=LockResource(hRes);
if lpGlob=Nil then
begin
messagebox(0,'Resource bad.',PChar(RESName),16);
exit;
end;
uFlags:=snd_Memory or uFlags;
SndPlaySound(lpGlob,uFlags);
UnlockResource(hRes);
FreeResource(hRes);
End;
Step 5) Call the routine, using the names you gave the sound files in Step (1)
PlayResSound('SOUND1',SND_ASYNC)
Flags are:
SND_ASYNC = Start playing, and don't wait to return
SND_SYNC = Start playing, and wait for the sound to finish
SND_LOOP = Keep looping the sound until another sound is played |
hier heb ik die bassmod vandaan:
http://www.torry.ru/audio.htm
kan iemand mij een endje opweg helpen? het liefst speel ik
dus een .mod file af zonder afhanklijk te zijn van een
dll en een apparte .mod
bvd!