0
0

SO i recently wrote a Mac application that uses the FMOD Ex API to produce an interactive music demo (Xcode project available for download at http://www.twittering.com/twittering/co … 010_v1.zip). in the project, i added the libfmodex.dylib to the Frameworks folder, which worked while compiling/running under Xcode, and added a Run Script to copy the library into the app bundle for standalone release (following the procedure described at http://brockwoolf.com/blog/how-to-use-d … using-fmod).

NOW i’m trying to create a similar demo application using the FMOD Designer API, but am having trouble with the libfmodevent.dylib file. i’m doing the same thing with the Event library that i did with the Ex library, but get the following error (or some variation of such, no matter what i try):

============================
warning: Unable to read symbols for "./libfmodevent.dylib" (file not found).
warning: Unable to read symbols from "libfmodevent.dylib" (not yet mapped into memory).
Program loaded.
run
[Switching to process 10738]
dyld: Library not loaded: ./libfmodevent.dylib
Referenced from: /Users/twittering/Desktop/… pathto …/applicationName
Reason: image not found
Running…
No memory available to program now: unsafe to call malloc
Data Formatters temporarily unavailable, will re-try after a ‘continue’. (Unknown error loading shared library "/Developer/Applications/Xcode.app/Contents/PlugIns/GDBMIDebugging.xcplugin/Contents/Resources/PBGDBIntrospectionSupport.A.dylib")
Cannot access memory at address 0x0

Cannot access memory at address 0x0

libfmodevent.dylib and libfmodex.dylib are sitting next to each other in the Xcode Frameworks folder (and copied into the project folder as well). Also note: i’m able to Make and run the MusicSystem example command line code (which you posted for me at http://52.88.2.202/forum/viewtopic.php?t=12591, thanks!)

Bottom Line:
a) what the heck am i doing wrong!?
b) is libfmodevent.dylib in an Xcode compatible format? (libfmodex.dylib = compiled.mach-o.dylib, right?)
c) anybody got a MusicSystem/EventSystem/Designer API Xcode project i can look at, as example code?

your assistance (which has been excellent in the past) is highly appreciated!

  • pdx
  • You must to post comments
0
0

Hi,

You probably just need to do add the "install_name_tool" step described in the blog post you linked to for libfmodevent.dylib as well.

  • You must to post comments
0
0

i already did that in the Run Script … same result (error)

=======
mkdir "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Frameworks"

cp -f $TARGET_BUILD_DIR/../../libfmodex.dylib "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Frameworks/libfmodex.dylib"
install_name_tool -change ./libfmodex.dylib @loader_path/../Frameworks/libfmodex.dylib "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/MacOS/$PRODUCT_NAME"

cp -f $TARGET_BUILD_DIR/../../libfmodevent.dylib "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Frameworks/libfmodevent.dylib"

install_name_tool -change ./libfmodevent.dylib @loader_path/../Frameworks/libfmodevent.dylib "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/MacOS/$PRODUCT_NAME"

even so, the install_name_tool command is only to make the stand alone app work (copies the library into the Frameworks folder in the application bundle, and directs the app to link to it there) … the library should get linked when placed in the Frameworks folder in the Xcode project, and the app should run in the debugger, even without the script.

that’s how it worked for my rocks2010 demo (and let me tell you, it was quite vexing when the program ran perfectly in Xcode, but NOT when double-clicking the app! took me a minute to figure out i needed that install script)

but libfmodevent.dylib does not seem to be recognized by Xcode as a dynamically linked library, or at least, Xcode gets confused by its presence. as a test, i tried putting the event library into the Frameworks folder of the rocks2010 project, didn’t reference it at all … still get the same (frustratingly cryptic and unhelpful) runtime error.

  • You must to post comments
0
0
  • You must to post comments
0
0

after further research, debugging, and chasing untamed ornithoids without cause, i seem to have sorta kinda figured out what was going on, but i would appreciate any comments you might have on my solution, or suggestions on a better way to go.

it seems like libfmodex.dylib needs to access libfmodevent.dylib, but even when the two libraries are placed side by side in the Xcode Frameworks folder, OR in the application bundle using the Run Script, libfmodex can’t find the other library. SO i added a line to the install_name_tool process to point libfmodex at libfmodevent (as well as to the application itself):

=================

create Frameworks folder in application bundle

mkdir "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Frameworks"

copy the Ex library into Frameworks

cp -f $TARGET_BUILD_DIR/../../../api/lib/libfmodex.dylib "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Frameworks/libfmodex.dylib"

point the app at the Ex library

install_name_tool -change ./libfmodex.dylib @loader_path/../Frameworks/libfmodex.dylib "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/MacOS/$PRODUCT_NAME"

copy the Event library into Frameworks

cp -f $TARGET_BUILD_DIR/../../../api/lib/libfmodevent.dylib "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Frameworks/libfmodevent.dylib"

=> point the Ex library at the Event library <=

install_name_tool -change ./libfmodex.dylib @loader_path/../Frameworks/libfmodex.dylib "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Frameworks/libfmodevent.dylib"

point the app at the Event library too

install_name_tool -change ./libfmodevent.dylib @loader_path/../Frameworks/libfmodevent.dylib "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/MacOS/$PRODUCT_NAME"

this seems to work, though the music cues in my prototype aren’t playing correctly (which is odd, because i copied the code from the command-line version, which mostly does work as expected), but i’m hoping that’s just bugs in my code or Designer layout. we’ll see …

in any case, PLEASE let me know if the Run Script looks OK, or if there’s a better solution to this (rather vexing!) problem … thanks!

  • pdx
  • You must to post comments
0
0

hmm, both my own music cues, and the example music cues, fail in the same odd manner in my Xcode Cocoa app, leading me to suspect that while the script may allow the app to compile/run … it still ain’t the right answer.

what IS the correct solution!?

  • You must to post comments
0
0

Your script is correct. The app needs to be told where both fmodex and fmodevent dylibs are and the fmodevent dylib needs to be told where the fmodex dylib is. This is standard dynamic linking for a Mac application which it appears you have now solved.

As for your music cues, this is an unrelated issue, can you give us some detail about what is going wrong?

  • You must to post comments
0
0

SOLUTION:

My sincere thanks to Mathew, Andrew, Brett, Ben, Chenpo, and Martin for their help getting the Designer / Event interactive music system to work using Xcode on OSX 10.6. In retrospect, the solutions were obvious, but they sure had me going for awhile! If anybody else out there wants to do something similar, here’s a working Xcode project that plays the FMOD interactive music examples:

[url:1mycm0em]http://www.twittering.com/twittering/code/FMOD/musicExampleXcode2.zip[/url:1mycm0em]
(the archive is a little big [18Mb], because the soundbank and libraries are included twice: in the project folder, and in the application bundle)

some points to consider:

a) the Run Script (last build stage, under Targets) [i:1mycm0em]is[/i:1mycm0em] correct, and is required to run the program — even in the debugger. This is because the Event library needs to access the Ex library, and they must be explicitly linked (just putting them next to each other in the Frameworks folder does not work). To simplify the Run Script, I placed the two libraries in the build directory, and copy from there.

b) C++ and relative file pathways don’t play nice in Xcode. SO, to simplify matters, and to produce a self-contained, standalone, application, I put the .fev / .fsb (events, and sound bank) files in the Resource folder of the Xcode project, and access them from the application bundle (MEDIA_PATH = "$application_name.app/Contents/Resources/"), instead of an external "media" folder.

c) to prevent hiccups at loop points, build the sound bank with the "Stream from disk" option.

d) eventsystem->update() must be called continuously. This is absolutely necessary for correct event functionality, yet is easily accomplished by firing off a recurring timer in "awakeFromNib" (I suppose a background RunLoop thread would work as well, but apparently that’s an unnecessary level of complexity, at least for this simple app).

e) the "intensity" slider is only active for the "retrorock" cue.

Questions and comments welcomed, either here on the forum, or at twittering@gmail.com

  • pdx
  • You must to post comments
Showing 7 results
Your Answer

Please first to submit.