Jump to content
  • Advertisement
Sign in to follow this  
Boder

MOD files in python

This topic is 3801 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

Hi, I'm hoping someone can recommend a way to play module files in python. I'm using Windows and Python-Ogre at the moment. Thanks

Share this post


Link to post
Share on other sites
Advertisement
Thank you very much, it is actually a lot harder to find python libraries than C/C++ libraries I have discovered.

I actually was looking for a FMOD binding, but, you know, with fmod also being float modulus...

Share this post


Link to post
Share on other sites
Shucks, the last release was for Python 2.4

So I might have to suffer an attempt at compiling the CVS for Python 2.5 and the latest FMOD.

If I understand correctly, the pyd file is just a DLL? and it has to be compiled with the same compiler and C runtime library as the "python.exe" I'm using?

What tool do people use for the automagic windows installer that seems like setup.py?

Maybe someone knows a more active library.

Share this post


Link to post
Share on other sites
Definitely not as smooth sailing as I thought with Python. Just can't beat the library support with C++, whereas the python wrappers seem rough around the edges.

Not as big a support group, libraries not as supported, lacking or misplaced features (found one in Python-Ogre).

I can't even get OgreAL to play a .ogg and PySonic was exciting at first until I found it is stuck in 2005.

I might have to switch to C# as it seems to have a bigger community and support. But I was really digging the dynamic typing. Somehow Microsoft succeeded with C#.

Share this post


Link to post
Share on other sites
Well if you went through the trouble to make a python library out of libmodplug i'm pretty sure the open source community would get on board and start maintaining and whatnot, it seems like a pretty important/basic feature for alot of games (i've sorta decided on mod files for filesize and my love of the classic unreal series :-) ) But I guess my point is just that creating wrappers for python can't be terribly hard, and i think it would be worth it in this case.

Share this post


Link to post
Share on other sites
Quote:
Original post by Boder
Definitely not as smooth sailing as I thought with Python. Just can't beat the library support with C++, whereas the python wrappers seem rough around the edges.

Not as big a support group, libraries not as supported, lacking or misplaced features (found one in Python-Ogre).

[...]

I might have to switch to C# as it seems to have a bigger community and support. But I was really digging the dynamic typing. Somehow Microsoft succeeded with C#.


Your findings are true in some way for multimedia libraries, because Microsoft have been able to push things like XNA and DirectX. For other applications, you'll find Python support to be quite mature. Of course, that is probably not much use to you. Obviously C++ is the industry standard and you can't expect the library support in any other language to be comparable, which is a shame.

Quote:
I can't even get OgreAL to play a .ogg and PySonic was exciting at first until I found it is stuck in 2005.


Nobody wanting to play .MOD files should be complaining about being stuck in 2005! :P

Out of interest, what's the syntax for FMOD playing a MOD file in C++?

Share this post


Link to post
Share on other sites
Just a quick cut-and-paste.
//****************************************************************************
// "Those Funny Funguloids!"
// http://funguloids.sourceforge.net
// Copyright (c) 2006-2007, Mika Halttunen
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the
// use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software in a
// product, an acknowledgment in the product documentation would be
// appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
//
//***************************************************************************/


// Play some music
void FMODExSoundSystem::playMusic(const std::string& file) {
if(mSoundDisabled) return;
if(String(file).empty()) return;

LogManager::getSingleton().logMessage("Playing '" + String(file) + "'..");

// Release the previously playing music
if(mMusic && mMusicChannel) {
mMusicChannel->stop();
mMusic->release();
mMusic = 0;
}

// Disable the custom file system
FMOD_RESULT result = mSystem->setFileSystem(0, 0, 0, 0, 2048);
errorCheck(result);

// Load
result = mSystem->createStream(file.c_str(), FMOD_HARDWARE | FMOD_LOOP_OFF | FMOD_2D, 0, &mMusic);
if(errorCheck(result)) {
markBadSong();
playMusic(getNextSong());

// Reset the file system
result = mSystem->setFileSystem(fileOpen, fileClose, fileRead, fileSeek, 2048);
errorCheck(result);
return;
}

// Play
result = mSystem->playSound(FMOD_CHANNEL_FREE, mMusic, false, &mMusicChannel);
errorCheck(result);

// String svol = GameApplication::mGameConfig->getSetting("music_volume", "audio");
String svol = GameApplication::mGameConfig->GetValue("audio", "music_volume", "1.0");
Real vol = StringConverter::parseReal(svol);
mMusicChannel->setVolume(vol);
result = mMusicChannel->setCallback(FMOD_CHANNEL_CALLBACKTYPE_END, endCallBack, 0);
errorCheck(result);

// Reset the file system
result = mSystem->setFileSystem(fileOpen, fileClose, fileRead, fileSeek, 2048);
errorCheck(result);
}

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!