|
-
Oct 24th, 2002, 08:43 PM
#1
Thread Starter
Sleep mode
little function
Code:
Function DXSound_Init(Hwnd As Long) As Boolean
Set ds = dx.DirectSoundCreate(vbNullString)
ds.SetCooperativeLevel Hwnd, DSSCL_PRIORITY
DXSound_Init = True
End Function
guys I don't what's wrong with me !!!!
basically what does the last line of code mean ?
I've seen a lot of func. act like this
DXSound_Init = True
a mean why the function returns true ?(why not false)
*thanx for your time*
-
Oct 25th, 2002, 12:18 AM
#2
PowerPoster
That function returns a boolean. It has to either be true or false.
Usually you will have more code than that if your returning a variable. True should signal success of some kind in the function. False would be returned if something in the function failed. This one you gave us for an example might as well have been a Sub.
One more reason I would do this, is for something like this:
MyFunction(DXSound_Init(Hwnd))
Where you want to pass in a bool variable to MyFunction and want to perform the DXSound_Init function first. This would take care of two at once...in a way.
-
Oct 25th, 2002, 05:30 AM
#3
Thread Starter
Sleep mode
one more question
Code:
Function DXSound_LoadSound(SoundFileName As String) As DirectSoundBuffer
Dim dsBuf As DSBUFFERDESC
Dim dsBuffer As DirectSoundBuffer
Dim WF As WAVEFORMATEX
dsBuf.lFlags = DSBCAPS_CTRLVOLUME Or PS_CTRLFREQUENCY
Set dsBuffer = ds.CreateSoundBufferFromFile(SoundFileName, dsBuf, WF)
Set DXSound_LoadSound = dsBuffer
End Function
now how about "DirectSoundBuffer" is that the returning value ??
(some told me this set the properities of the function , I don't know really )
thanx dude
-
Oct 25th, 2002, 10:54 AM
#4
Thread Starter
Sleep mode
guys , help plz
-
Oct 25th, 2002, 11:11 AM
#5
PowerPoster
I think that DirectSoundBuffer is an object that is in the DX library. Either that, or an enumeration of somekind. I have never messed with DX before, so I am probably wrong.
-
Oct 25th, 2002, 12:38 PM
#6
Thread Starter
Sleep mode
thanx hellswraith for your replay
well , DirectSoundBuffer is an object in the DS(DirectSound) library.Anyhow , I'm not asking about where is it located .
The function works with or without using the variable "DirectSoundBuffer" , So why it's used ??
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|