Posts: 285
Threads: 70
Joined: Feb 2005
Can anyone please explain how to get a list of all files. Using Print Dir$(â*.exeâ) displays only one .EXE file, while Print Dir$(â*.*â) shows none.
Also what are we to do with all the files in lib/win32? If these need converting to DLL perhaps that explains why I cannot get any of the files in the example/gfx to run after compiling.
Thanks Gordon
Posts: 285
Threads: 70
Joined: Feb 2005
Just in case everyone is not aware of the fact, fmodtest.bas also plays .MID files - at least the version of FMOD.DLL I dwnloaded does! Gordon
Posts: 3,522
Threads: 189
Joined: Dec 2003
*.a is a special format for FBC, sort of the *.QLB for quickbasic.
It's not used in the EXE version, it's only used when you compile.
After you've compiled it, you need the real DLL, which can be found on the apropriate library site.
For example, SDL ->
www.libsdl.org
For more info read this FAQ:
http://fbtk.qbtk.com/phpBB2/qa.php
You might find
http://fbtk.qbtk.com/phpBB2/qa.php#8 to be interessting.
Happy coding
Posts: 1,272
Threads: 36
Joined: Feb 2003
How to use DIR$:
Code:
PRINT "Here's the first EXE file: " + DIR$("*.exe")
PRINT "and here's the second: " + DIR$("")
PRINT "the third: " + DIR$("")
PRINT
PRINT "Here's the first TXT file: " + DIR$("*.txt")
PRINT "the second TXT file: " + DIR$("")
So basically, you pass a string to start and then "" to continue.
Posts: 3,522
Threads: 189
Joined: Dec 2003
To get all files in a directory:
Code:
t$ = DIR$("*.EXE")
Do while t$ <> ""
Print t$
t$ = DIR$("")
Loop
Posts: 285
Threads: 70
Joined: Feb 2005
Thanks Zire for the Dir$ help. but I think the following is simpler to select a file for FMODTEST.BAS
Gordon
Code:
shell "DIR *.mod /w /o:n"
shell "DIR *.mid /w /o:n"
print : print tab(20);"********** Enter any MOD or MID filename **********"
input File$
screen 12
DefSng A-Z
'$Include: 'fmod.bi'
Declare Sub ErrorQuit (Message$)
Const FALSE = 0
Const MusicFile = ""
Dim Shared Handle As Long
If FSOUND_GetVersion <= FMOD_VERSION Then
ErrorQuit "FMOD version " + STR$(FMOD_VERSION) + " or greater required"
End If
If FSOUND_Init(44100, 32, 0) = FALSE Then
ErrorQuit "Can't initialize FMOD"
End If
Handle = FMUSIC_LoadSong(File$)
If Handle = FALSE Then
ErrorQuit "Can't load music file " + CHR$(34) + MusicFile + CHR$(34)
End if
FMUSIC_PlaySong(Handle)
Print "FMOD test for freeBASIC"
Print "Press any key to quit." : SLEEP 2000
Posts: 294
Threads: 9
Joined: Oct 2002
Posts: 285
Threads: 70
Joined: Feb 2005
Thanks for all you help.
For all those trying to get FB to generate SOUND, here is a method you can use if you have QuickBasic. Hope it has not bee mentioned before recently. Compile the QB program into a PULSE.EXE and copy into the the same Directory as FB. Then compile the FB progam and run. The TIMER delay in the QB program is to prevent Windows closing the program before a SOUND is produced. So if you get no sound because you have a super fast CPU, try increasing the .2 (reads point 2)
Gordon
Code:
REM QuickBasic Tones
P = VAL(COMMAND$)
SOUND P, 1
tim = TIMER
WHILE TIMER < tim + .2
WEND
SYSTEM
REM FB tone test
FOR N = 100 TO 1000 STEP 200
OP$ = "PULSE.EXE "+STR$(N)
SHELL OP$
SLEEP 50
NEXT N
END
Posts: 242
Threads: 29
Joined: Dec 2004
This seems to work:
Code:
#include once "win\winbase.bi"
#inclib "kernel32"
Declare Function Sound Alias "Beep" (ByVal dwFreq As Integer, ByVal dwDuration As Integer) As Integer
sound 100, 200
ature has its way of warning a person away from danger: The distinct black and white coloration on a skunk, the chilling buzz of a rattlesanke, a redneck handing you his beer and saying "Watch this!"
Posts: 285
Threads: 70
Joined: Feb 2005
Thanks Steven,
I rather guessed someone would have found a better way of achieving SOUND instead of my crude method of SHELL to another program.
I wonder if you are able to access the 128 instrument sounds in Windows WINMM.DLL similar to as shown to me on my site with Liberty Basic.
Gordon.