[Delphi] .wav in .exe lukt, maar ik wil .mod!

Pagina: 1
Acties:
  • 46 views sinds 30-01-2008

  • Martien
  • Registratie: Juni 2001
  • Nu online
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
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!

@iMartien


  • Martien
  • Registratie: Juni 2001
  • Nu online
kuchkuch*kick*kuchkuch

@iMartien


  • D2k
  • Registratie: Januari 2001
  • Laatst online: 31-08 10:19

D2k

Hoi,
[topic=327241/1/25]
Policy mbt het omhoogschoppen van threads. Wacht minstens 24 uur voor je je topic omhoog schopt. Doe dit dan ook alleen met een zinnige opmerking en dus niet met "Waarom antwoord er nou niemand" nadat je 5 minuten geen antwoord hebt gehad. Sommigen van ons hebben een leven :+

Doet iets met Cloud (MS/IBM)


  • Martien
  • Registratie: Juni 2001
  • Nu online
Op woensdag 20 februari 2002 22:32 schreef D2k het volgende:
Hoi,
[topic=327241/1/25]
[..]
weet je, ik wor soms zo moe van mensen zoals jij..

@iMartien


  • D2k
  • Registratie: Januari 2001
  • Laatst online: 31-08 10:19

D2k

doei dan

Doet iets met Cloud (MS/IBM)


Dit topic is gesloten.