Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dir$ and more GFX
#1
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
Reply
#2
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
Reply
#3
*.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
Reply
#4
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.
Reply
#5
To get all files in a directory:
Code:
t$ = DIR$("*.EXE")
Do while t$ <> ""
       Print t$
       t$ = DIR$("")
Loop
Reply
#6
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
Reply
#7
dir$ information at http://www.hybd.net/~mms/fb/help/current...e.html#dir$
Reply
#8
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
Reply
#9
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!"
Reply
#10
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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)