BlitzCoder Essentials
•
Home Page
•
About BlitzCoder
•
Contributors
•
Terms of Use
•
Email Us
Main Areas
•
BlitzCoder Chat
•
Discussions
•
Articles/Tutorials
•
Code Database
•
Link Database
•
Showcase Area
•
Worklogs
•
Competitions
Special Areas
•
Undocumented
Other Blitz Sites
•
Blitz Basic Home
•
Blitz Showcase
•
BlitzPlay Library
Forum Login
Username:
Password:
•
Register Now!
BlitzCoder Code Archives Page
Main Codes Page
"Music Player: Reading music files from a directory"
, by grisu
Searches a given directory for music files and stores them for later usage.
Code
; This tiny Code is from my game Cardwar. It searches the given MusicDir$ ; for different file formats and puts the found filenames into the musicfiles$ array, It also returns the total number of songs found. Dim musicfiles$(9999) ; stores all filesnames Global max_music=0 ; stores the total numbers of songfilenames found Global MusicDir$="C:\Music" setdir$=MusicDir$ filecount=0 curdir = ReadDir(setdir$) If Not curdir RuntimeError "Unable to open dir: "+setdir$ Repeat f$=NextFile$(curdir) If f$<>"." And f$<>".." Then If Upper$(Right(f$,4))=".MP3" Or Upper$(Right(f$,4))=".OGG" Or Upper$(Right(f$,3))=".XM" Or Upper$(Right(f$,4))=".WMA" Or Upper$(Right(f$,4))=".WAV" Or Upper$(Right(f$,4))=".MOD" Or Upper$(Right(f$,4))=".S3M" Or Upper$(Right(f$,3))=".IT" Then musicfiles$(filecount)=f$ filecount=filecount+1 EndIf EndIf Until f$="" Or filecount=>9999 CloseDir curdir max_music=filecount
Copyright(c) 2000-2004, BlitzCoder. All Rights Reserved.
Code software created by Krylar's Kreations