FMOD and Optimized Compilation

@Work

Member
Licensed User
Hi Erel,

Long time since I've been here! I just got/installed V6 this afternoon and noticed a deficiency in my device that I figured I would create a program for - using the latest version. The app is basically a digital alarm clock that plays a song file when the alarm is triggered. That works fine. The error is when I try to compile the app for the device using the optimized compiler. Attached is a screen shot of the error I received. I have fmod.dll in the Basic4PPC Desktop directory, both FMODDesktop.dll (1.0.2860.24351) and FMODDevice.dll(1.0.2860.24334) in the apps directory.

The Desktop version compiled fine with optimized compiling, but the device version failed. I was able to compile the device version WITHOUT the optimization option checked and it works fine on the device. Did I mess something up here? Or is it maybe a conflict with the V6? Any way, I thought I would post this so you could check it out...

Happy New Year to you and yours!:)
 

Attachments

@Work

Member
Licensed User
Well that fixed one problem, But...

Erel, the fix worked - to the extent that I can create an optimized .exe file. The unoptimized file is 176KB and the optimized file is 48K. Unfortunately, it seems that optimization removed some functionality!? The first problem. The app is frmClock with pnlFace and txtTime imposed on pnlFace. Here's the the start-up code:
B4X:
Sub App_Start
    fmod.New1
    frmClock.Show
    TimeFormat("HH:mm")
    txttime.Text=Time(Now)
    pnlface.Focus
    tmrupdatetime.Enabled=true
End Sub
As you can see, after it loads up, the focus is set to the panel to remove the blinking cursor from txttime.text On the unoptimized version it works perfectly. The optimized version, the focus stays in txttime. The timer only updates txttime.text once per minute - (i.e. Interval=60000) so I wouldn't think that that would be the culprit?

The second problem is that when the alarm time is reached, the unoptimized version plays the selected sound, the optimized version does not. From the Main Help file>Backword Issues:
External libraries (Optimized compiler only) - Objects must have a referenced desktop library.
So I tried adding the FMod.dll as an object to the desktop and I get an error saying 'could not load fmod.dll or one of its dependencies. The Module was expected to contain an assembly manifest.'

Lastly, when the alarm time is reached, a button pops up to shut off the alarm. Again, after the button is pressed, it disappears and the focus is supposed to go back to the panel to keep the blinking cursor out of txttime.

The only thing I changed was the FMODDesktop.dll. Both versions were compiled using the same code, but the optimized one doesn't work properly. So, either I'm not coding this properly, for optimization - or Murphy done got ahold of your optimizing routine! What do you reckon?

Attached is a zip file with everything in the application directory. Includes the source code, OAlarmClock.exe - optimized version and AlarmClock.exe - unoptimized version. Never mind that it can be done cleaner, I just threw this together quick and once I get it working right I'll clean it up!:)
 

@Work

Member
Licensed User
Ummm.... Still not right?

I hate to be the bearer of bad news - but...

The hint about putting a button behind the panel solved that problem, but still no joy with sound playback with the optimized version!:confused:

I replaced the FMOD*.dll's with the contents of the file linked above, recompiled the app and still no joy! So I tried running the app from the designer on the device and it worked fine. Attached is the current changes if you want to test.

Thanks Erel!
 

@Work

Member
Licensed User
OH STUPID ME!!!:sign0161::sign0148::signOops::sign0013:

Here, I've been faithfully updating all the dll's - ON THE DESKTOP,
and completely forgot to update them on the DEVICE!:eek:

I will now crawl back into my hole - after 30 lashes with 4GB SD card...

Thanks Erel!
 
Top