-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting started #3
Comments
If you don't have anything already playing audio then you can do this. First add the NAudio.dll (from the lib folder) as a reference in your project, and also make sure the NAudioDriver has been included in as well. you code will look like this
If you look at the WindowsTest project it will give you an idea of how to set it up. If you aren't on windows, or need to play the audio via another method then you will need to write a write a "driver" check the Wiki on how to do that. |
Hi tried wiki example and it works great for saving wav files but I would like to play it direcly from my speakers so I tried MikMod player;
player = new MikMod();
player.Init<NAudio>(); (the line error is at)
Module mod = null;
mod = player.LoadModule("Music1.mod");
if (mod != null)
{
player.Play(mod);
// Depending on the driver you might need to call update
// if update is not need calling update will not break anything
// Please note that some mods can loop indefiniatly so might never end.
while (player.IsPlaying())
{
player.Update();
}
//player.Stop();
// Calling unload will clear out any loaded samples and the mod data.
// Its fine to then load another module after unloading one.
//player.UnLoadModule(mod);
}
else
{
// Failed to load the mod
if (player.HasError)
{
Console.WriteLine("Failed to load mod for reason:");
}
} but I get also tried your example but I stil get this error I've included NAudio.dll and SharpMikNAudio.dll (not sure what is the diference between SharpMikNAudio.dll and SharpMik.dll but if I can't include both Thanks for Anwsering and Best Regards |
NAudio.dll is a audio playing library for C# (https://github.com/naudio/NAudio) Try changing the code to this
I really need to find some time to tidy the wiki and the codebase up. |
works like a charm thank you PS: not sure why while (player.IsPlaying())
{
player.Update();
} is needed (because my WinForm does open if its there |
Great to hear it worked. The player.update() is needed for some of the audio drivers as you need to push data to them (the write to wav driver for example). Others like the NAudio Driver (or XNA driver) pull the data when they need it. So yeah in this instance it wasn't needed. As the core of the library is just a module decoder, its then up to the audio drivers to do something with that processed byte array. I hope that makes sense. |
Thanks again Thanks for Anwsering and Best Regards |
after you load the mod you can set the wrap flag.
and the mod should repeat from its set repeat point or the start if its not been set. |
Hi do you think you could tell me simply how to play a mod or s3m file with this library
I've tried like this
but when I run the program I can't hear anything
Thanks for Anwsering and Best Regards
The text was updated successfully, but these errors were encountered: