Hello, I am completely new to fmod.
I want to write an application in c# that plays an mp3 file.
The user shall be able to do the following things:
pause the mp3file
seek 1s back or forward to the position when the mp3file was paused
For people who already know fmod this will be a piece of cake. Can anybody please tell me the code examples for this. If you are willing to do it, but you write only in C++, then I’ll also accept this.
If no one has time enough to help me like I want it the most, can you please tell me some sites which will teach me to do this on my own? Google hasn’t helped me much in this regard. Thansk a lot.
- maximilian.schaller asked 9 years ago
I assume C# doesn’t work differently from C++. I’m not a hero with setting up libraries, but normally you can copy the header files into the "include" folder of your development environment (in your case, Visual Studio I suppose). The dll can go in your system32 folder in Windows to make it available to the entire computer, or just put it in the project map for each project you create.
Once again, I am not much less of a noob than you are, but this is my advice. Good luck. 😉
Go to the place where vc# express has been installed. Probably C:\Program Files\blabla or something. Find a folder called "include" and put all the header files there. Put the dll in your system32 folder in the WINDOWS folder. That’s how I do it. Hope it works.
[/code:1ko4arm3]To create and play the mp3
[code:1ko4arm3]Channel::setPaused()[/code:1ko4arm3]To pause the mp3
Channel::setPosition()[/code:1ko4arm3]To figure out where you are in the mp3, and to seek to different locations.
- Dogbert answered 9 years ago
Examine the playsound example to figure out how to actually play a sound. You might find it confusing at first, depending on your programming experience, but will find out it’s extremely easy. The FMOD Ex documentation file is amazingly clear so I advise you to read through it (the introduction is a must) and use it a lot!
If you come across problems, please post your code and let us know!
I’m reading "THE BASICS" tutorial, and it mentioned that there’s a difference when handling small or large mp3 files. I want to work with files which have a duration of ~ 3 hours. What specific function have I to use, if I want to use the seek function combined with the ability to play the file immediately again after I used the seek functionality?
First off, I have never worked with streams before, so my advice may not be flawless, but I’ll give it a shot. Also, I am working with the C API rather than the C++ API, so I might make a mistake there as well.
When you use files that are so incredibly large, you won’t want to load the entire file into your system’s memory. In this case, it’s better to use a Stream, which only uses a small portion of your system’s memory at a time. However, I quote the FMOD Ex documentation of Channel::setPosition:
Note that if you are calling this function on a stream, it has to possibly reflush its buffer to get zero latency playback when it resumes playing, therefore it could potentially cause a stall or take a small amount of time to do this. [/i:29jqsr49]
So, here’s what I think you’re gonna want to do:
* Create a System (just like in the examples)
* Use Channel::setPosition on the Channel object the createStream method has provided you to alter the position.
* Use Channel::setPaused to pause the Channel.
If you get that to work a bit, adding other features will turn out easy. The documentation of FMOED Ex is really awesome. Also, take a look at the playstream example!
Please login first to submit.