- This wiki is out of date, use the continuation of this wiki instead
Load song
From FenixWiki
(Difference between revisions)
Revision as of 13:52, 22 April 2007 (edit) Woody (Talk | contribs) ← Previous diff |
Current revision (20:06, 12 January 2008) (edit) (undo) Sandman (Talk | contribs) m (→Example) |
||
(7 intermediate revisions not shown.) | |||
Line 1: | Line 1: | ||
[[Category:functions]] | [[Category:functions]] | ||
+ | [[Category:sound]] | ||
- | '''INT''' load_song ( <'''STRING''' | + | ==Definition== |
+ | '''INT''' load_song ( <'''STRING''' filename> ) | ||
- | Loads a song for later use with [[play_song]]. | + | Loads a song for later use with [[play_song]](). |
+ | |||
+ | There are multiple [[filetypes]] you can load using this [[function]]. Included are: | ||
+ | * OGG Vorbis (.ogg). Good quality for [[song]]s and doesn't take too much space (it's similar to *.mp3). | ||
+ | * MIDI (.mid). Takes very low space, but it's limited to samples of the soundcard. | ||
+ | * Modules (.xm, .it, .s3m, .mod). Like MIDI, but Modules also contain the samples themselves. | ||
+ | |||
+ | == Parameters == | ||
+ | {| | ||
+ | | '''STRING''' filename || - The music file to be loaded, including a possible path. | ||
+ | |} | ||
+ | |||
+ | == Returns == | ||
+ | '''INT''' : [[SongID]] | ||
+ | {| | ||
+ | | -1 || - Could not load music file (errormessage in console). | ||
+ | |- | ||
+ | | >=0 || - The SongID. | ||
+ | |} | ||
+ | |||
+ | == Example == | ||
+ | <pre> | ||
+ | Program example; | ||
+ | Private | ||
+ | int song; | ||
+ | Begin | ||
+ | song = load_song("my_song.ogg"); | ||
+ | play_song(song,0); | ||
+ | Repeat | ||
+ | frame; | ||
+ | Until(key(_ESC)) | ||
+ | OnExit | ||
+ | unload_song(song); | ||
+ | End | ||
+ | </pre> | ||
+ | Used in example: [[play_song]](), [[key]](), [[unload_song]]() | ||
+ | |||
+ | {{Funcbox | ||
+ | | category=Sound | ||
+ | }} |
Current revision
Contents |
[edit] Definition
INT load_song ( <STRING filename> )
Loads a song for later use with play_song().
There are multiple filetypes you can load using this function. Included are:
- OGG Vorbis (.ogg). Good quality for songs and doesn't take too much space (it's similar to *.mp3).
- MIDI (.mid). Takes very low space, but it's limited to samples of the soundcard.
- Modules (.xm, .it, .s3m, .mod). Like MIDI, but Modules also contain the samples themselves.
[edit] Parameters
STRING filename | - The music file to be loaded, including a possible path. |
[edit] Returns
INT : SongID
-1 | - Could not load music file (errormessage in console). |
>=0 | - The SongID. |
[edit] Example
Program example; Private int song; Begin song = load_song("my_song.ogg"); play_song(song,0); Repeat frame; Until(key(_ESC)) OnExit unload_song(song); End
Used in example: play_song(), key(), unload_song()
Sound Functions | |
• Is_playing_song() • Load_song() • Load_wav() • Pause_song() • Play_song() • Play_wav() • Resume_song() • Set_song_volume() • Unload_song() • |