Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.

Eric Poitras

FMod and FMUSIC??

This topic is 5656 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hey, I''ve been trying to load, play and loop a midi file with FMUSIC. My understanding of this is if you use a midi file you have to call the SetLooping function before the PlaySong function but I still doesn''t loop, it would help a lot if I had an simple example showing off looping with FMUSIC. I checked the examples that came with FMOD but it didn''t give anything simple to work with. Any help would be helpful. Thanks. All that is necessary for the triumph of evil is that good men do nothing. -Edmund Burke

Share this post

Link to post
Share on other sites
I scraped some code out of my Music class, which is based on FMOD:

Music = FMUSIC_LoadSong("file.mid");
//... wait a few seconds and listen ;)

Music = NULL;

"My basic needs in life are food, love and a C++ compiler"
[Project AlterNova] [Novanet]

Share this post

Link to post
Share on other sites
From the documentation:
Sets looping mode for midi and mod files.

signed char F_API FMUSIC_SetLooping(
signed char looping

mod Pointer to the song.

looping Set to TRUE to make it loop forever, or FALSE to only have it play once.

Return Value
On success, TRUE is returned.
On failure, FALSE is returned.

Defaults to TRUE. To disable looping you must call this function using FALSE as the parameter.
For midi files this only takes effect before FMUSIC_PlaySong is called. For mod files this
can be called at any time including during playback.

Share this post

Link to post
Share on other sites
My god! I''m sorry but I don''t know about other programmers but I do look at documentation before posting anything, I know what the function does and what not, I read it like 10 times. I do what it says, call SetLooping before the PlaySong function for midi files... I thought I said that in my first post. Anyway, If anyone actually ever used FMOD before, please post. All the idiots that think they can solve my problem with stuff I already know please do not post.

Thank You.

Share this post

Link to post
Share on other sites
Have you checked the return value of SetLooping? If it is FALSE, then maybe the current midi-song doesn''t support looping... of course, this doesn''t help you very much, so maybe I should shut up?

Share this post

Link to post
Share on other sites
If you pick up a tracker like ModPlug tracker (my personal choice) you could import your MIDI, and export it as a .XM (which FMOD can also play). Provided you''re not looking to switch looping on and off dynamically, you can add a ''Pattern Break'' command at the end of the music, causing it to loop without even needing to call SetLooping().

The big advantage is that it''s data-driven - your composer can set loop points exactly where they''re needed without changing values in code at all.

TBH, there are many, many better alternatives to MIDI (XM is only one of them). The Amiga MOD formats (MOD, IT, XM, S3M, and all relatives) support things like embedded samples (so you''re not restricted to MIDI instruments), effects, and callback commands - drop a Zxx command into your song, and your program can set up a callback to be called when it''s hit (with the ''xx'' value passed in).

Try The ModArchive for some examples of what can be achieved.. having been composing solid for the past two days in XM, I can vouch for it''s power over MIDI

- saving pigs from untimely fates, and when he''s not doing that, runs The Binary Refinery.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!