monkey-libmikmod, a module player library

Monkey Forums/User Modules/monkey-libmikmod, a module player library

Risc(Posted 2012) [#1]
Hi!
I've created a Monkey module for libmikmod (http://mikmod.shlomifish.org)

You can find the Bitbucket repository here: https://bitbucket.org/r1sc/monkey-libmikmod

Edit: Currently only GLFW and stdcpp is supported. Android and iOS is probably possible but requires a ported library.

/Risc


Nobuyuki(Posted 2013) [#2]
Cool, man.

I'm interested in checking this out, although I kinda prefer libmodplug to libmikmod for accuracy..... Anyway, I tried running the code and it seemed to do the job well after following your installation instructions, except it doesn't seem to build in Release mode on the GLFW target. Debug mode builds fine, but when trying Release mode, I get the following error:


Build started 3/11/2013 11:25:51 PM.
Project "C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\MonkeyGame.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
Building solution configuration "Release|win32".
Project "C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\MonkeyGame.sln" (1) is building "C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\MonkeyGame.vcxproj" (2) on node 1 (default targets).
InitializeBuildStatus:
Touching "C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\build\Release\MonkeyGame.unsuccessfulbuild".
ClCompile:
All outputs are up-to-date.
c:\Program Files\Microsoft Visual Studio 10.0\VC\bin\CL.exe /c /I"../bdwgc/libatomic_ops-1.2/src" /I../bdwgc/include /I../stb /I../openal/include /I../glfw/include /I../glfw/lib /I../glfw/lib/win32 /Zi /nologo /W0 /WX- /O2 /Oi /Oy- /GL /D WIN32 /D NDEBUG /D _WINDOWS /D _MBCS /Gm- /EHa /MT /GS /Gy- /fp:precise /Zc:wchar_t /Zc:forScope /Fo"C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\build\Release\\" /Fd"C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\build\Release\vc100.pdb" /Gd /TP /analyze- /errorReport:queue ..\main.cpp /bigobj
main.cpp
Link:
c:\Program Files\Microsoft Visual Studio 10.0\VC\bin\link.exe /ERRORREPORT:QUEUE /OUT:"C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\Release\MonkeyGame.exe" /INCREMENTAL:NO /NOLOGO /LIBPATH:../openal/libs/Win32 opengl32.lib glu32.lib openal32.lib Ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /ManifestFile:"C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\build\Release\MonkeyGame.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /PDB:"C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\Release\MonkeyGame.pdb" /SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF /LTCG /TLBID:1 /ENTRY:"mainCRTStartup" /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\Release\MonkeyGame.lib" /MACHINE:X86 "C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\build\Release\enable.obj"
"C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\build\Release\fullscreen.obj"
"C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\build\Release\glext.obj"
"C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\build\Release\image.obj"
"C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\build\Release\init.obj"
"C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\build\Release\input.obj"
"C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\build\Release\joystick.obj"
"C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\build\Release\stream.obj"
"C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\build\Release\tga.obj"
"C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\build\Release\thread.obj"
"C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\build\Release\time.obj"
"C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\build\Release\win32_dllmain.obj"
"C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\build\Release\win32_enable.obj"
"C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\build\Release\win32_fullscreen.obj"
"C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\build\Release\win32_glext.obj"
"C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\build\Release\win32_init.obj"
"C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\build\Release\win32_joystick.obj"
"C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\build\Release\win32_thread.obj"
"C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\build\Release\win32_time.obj"
"C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\build\Release\win32_window.obj"
"C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\build\Release\window.obj"
"C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\build\Release\main.obj"
"C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\build\Release\stb_image.obj"
"C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\build\Release\stb_vorbis.obj"
libcmtd.lib(dbgheap.obj) : error LNK2005: __heap_alloc already defined in LIBCMT.lib(malloc.obj) [C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\MonkeyGame.vcxproj]
libcmtd.lib(dbgheap.obj) : error LNK2005: __recalloc already defined in LIBCMT.lib(recalloc.obj) [C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\MonkeyGame.vcxproj]
libcmtd.lib(dbgheap.obj) : error LNK2005: __msize already defined in LIBCMT.lib(msize.obj) [C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\MonkeyGame.vcxproj]
libcmtd.lib(isctype.obj) : error LNK2005: __isctype_l already defined in LIBCMT.lib(isctype.obj) [C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\MonkeyGame.vcxproj]
libcmtd.lib(isctype.obj) : error LNK2005: __isctype already defined in LIBCMT.lib(isctype.obj) [C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\MonkeyGame.vcxproj]
libcmtd.lib(dbghook.obj) : error LNK2005: __crt_debugger_hook already defined in LIBCMT.lib(dbghook.obj) [C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\MonkeyGame.vcxproj]
LIBCMT.lib(crt0init.obj) : warning LNK4098: defaultlib 'libcmtd.lib' conflicts with use of other libs; use /NODEFAULTLIB:library [C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\MonkeyGame.vcxproj]
C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\Release\MonkeyGame.exe : fatal error LNK1169: one or more multiply defined symbols found [C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\MonkeyGame.vcxproj]
Done Building Project "C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\MonkeyGame.vcxproj" (default targets) -- FAILED.
Done Building Project "C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\MonkeyGame.sln" (default targets) -- FAILED.

Build FAILED.

"C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\MonkeyGame.sln" (default target) (1) ->
"C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\MonkeyGame.vcxproj" (default target) (2) ->
(Link target) ->
LIBCMT.lib(crt0init.obj) : warning LNK4098: defaultlib 'libcmtd.lib' conflicts with use of other libs; use /NODEFAULTLIB:library [C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\MonkeyGame.vcxproj]


"C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\MonkeyGame.sln" (default target) (1) ->
"C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\MonkeyGame.vcxproj" (default target) (2) ->
(Link target) ->
libcmtd.lib(dbgheap.obj) : error LNK2005: __heap_alloc already defined in LIBCMT.lib(malloc.obj) [C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\MonkeyGame.vcxproj]
libcmtd.lib(dbgheap.obj) : error LNK2005: __recalloc already defined in LIBCMT.lib(recalloc.obj) [C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\MonkeyGame.vcxproj]
libcmtd.lib(dbgheap.obj) : error LNK2005: __msize already defined in LIBCMT.lib(msize.obj) [C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\MonkeyGame.vcxproj]
libcmtd.lib(isctype.obj) : error LNK2005: __isctype_l already defined in LIBCMT.lib(isctype.obj) [C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\MonkeyGame.vcxproj]
libcmtd.lib(isctype.obj) : error LNK2005: __isctype already defined in LIBCMT.lib(isctype.obj) [C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\MonkeyGame.vcxproj]
libcmtd.lib(dbghook.obj) : error LNK2005: __crt_debugger_hook already defined in LIBCMT.lib(dbghook.obj) [C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\MonkeyGame.vcxproj]
C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\Release\MonkeyGame.exe : fatal error LNK1169: one or more multiply defined symbols found [C:\Documents and Settings\Jim\Desktop\asdf\mikmod_test.build\glfw\vc2010\MonkeyGame.vcxproj]

1 Warning(s)
7 Error(s)

Time Elapsed 00:00:04.59
TRANS FAILED: TRANS Failed to execute 'C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /p:Configuration=Release;Platform="win32" MonkeyGame.sln', return code=1
Abnormal program termination. Exit code: -1



No good, right? Since mikmod's being distributed in this project as a static lib, I have no idea what's going on here, but I'm guessing the linker doesn't like something that's included in there and conflicts with the optimizations that are supposed to be made on release build...


Risc(Posted 2013) [#3]
Weird. I suppose you tried to clean the project first right?
Also, I should mention that I haven't tried to build this on the latest versions of Monkey. I don't remember exactly but I think it built fine on v66.


Raz(Posted 2013) [#4]
Oh fantastic :)

I'm not in a position to look myself right now, but Risc, are you able to tell me if I can use this module to change the playback frequency of a module? I'm looking at the docs and it seems to mention Voice Frequency a lot, I'm not sure if that's the same thing

Thanks
:)


Nobuyuki(Posted 2013) [#5]

Weird. I suppose you tried to clean the project first right?
Also, I should mention that I haven't tried to build this on the latest versions of Monkey. I don't remember exactly but I think it built fine on v66.



Of course. I tried it on v66b. Perhaps the conflict is in stb_vorbis? That wasn't always a part of the glfw target. The issue seems to have to do with the fact that the Release build performs certain optimizations which try to static-link code which I guess there is a duplicate implementation of (in mikmod.lib, maybe?)


caffeinekid(Posted 2013) [#6]
Copied here from the Android section:-

The person who made AndModPlug very kindly took a look at the Monkey problem but he says it probably needs someone more familiar with the language and its ins and outs.

It would be a fantastic boon to the language to have tracker/module support I think - inbuilt would be idea but a wrapper for this stuff would work too.

I used to love the fact that mods could be loaded and played in Blitz and Blitz3D.

Anyway the AndModPlug creator has put together some great notes if anyone wants to give this a go - maybe this shouldn't be in the android forum but in a more general place if it's ported/wrapped hopefully it can be made to work for more than just one platform.

Take a look at the notes and information (and source) here:-

https://sites.google.com/a/peculiar-games.com/monkeymodplug/

Hopefully Risc or someone else might be able to get this working, if you guys want to give it a go.


Nobuyuki(Posted 2013) [#7]
thanks buddy. I was actually planning on using andmodplug in some capacity as a starting point for that target. When I get more free time, I'll have to take a look at it...