April 20, 2024, 06:34:11 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


IDE Bug? NOT!!!

Started by MikeHart, November 27, 2006, 06:11:48 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MikeHart

November 27, 2006, 06:11:48 AM Last Edit: November 27, 2006, 06:48:34 AM by MikeHart
Hi Paul,

I'm converting the MozartIBP soundpak to EB. I can compile things fine. But one thing is strange.
When I press execute/Compile and execute or Make executable with running it directly I get the attached error.

It is caused inside this code:

$include "audiere.inc"
$include "mozart.inc"

$undeclare mzLoadMusic
global mzLoadMusic

global pSampleSourceObject
COMREF pSampleSourceObject

global pOutputStreamObject
COMREF pOutputStreamObject

extern pAudioDeviceObject:comref

declare mzLoadMusic(fname:string, opt loop = true:int),pointer

sub mzLoadMusic(fname:string, opt loop = true:int),pointer
def mzObject:pointer
if pAudioDeviceObject = 0 then mzInit()
'Create the sample source object

pSampleSourceObject = AdrOpenSampleSource(fname,FF_AUTODETECT)
IF pSampleSourceObject = 0
ÂÃ,  ÂÃ,  MESSAGEBOX(0,"Error mzLoadMusic->AdrOpenSampleSource","ERROR",@MB_ICONSTOP|@MB_OK)
return 0
ENDIF
SET_INTERFACE pSampleSourceObject,SampleSource
'MESSAGEBOX(0,"mzLoadMusic 1","Info",@MB_OK)
pOutputStreamObject = AdrOpenSound(pAudioDeviceObject,pSampleSourceObject,FF_AUTODETECT)
IF pOutputStreamObject = 0
ÂÃ,  ÂÃ,  MESSAGEBOX(0,"Error mzLoadMusic->AdrOpenSound","ERROR",@MB_ICONSTOP|@MB_OK)
ÂÃ,  ÂÃ,  return 0
ENDIF
SET_INTERFACE pOutputStreamObject,OutputStream
pOutputStreamObject->setRepeat(loop)
pOutputStreamObject->ref()

mzObject = new(mozartObj,1)
if mzObject = 0 then return 0
#<mozartObj>mzObject.typ = 0
ÂÃ,  ÂÃ,  #<mozartObj>mzObject.multi = 0
#<mozartObj>mzObject.loop = loop
#<mozartObj>mzObject.pOutputStreamObject = pOutputStreamObject
#<mozartObj>mzObject.pSoundEffectObject = 0
#<mozartObj>mzObject.filename = fname
return mzObject
endsub

If I run the executeable directly from the explorer it runs fine. Maybe a wrong path set from the IDE?
Or do I have to declare interfaces differently?

EDIT: When I just copy the IBP created libs over then It works fine from inside the IDE too.

Cheers
Michael

Ionic Wind Support Team

How are you specifying the path to the sound file?

Ionic Wind Support Team

MikeHart

autodefine "off"
pointer song1
mzInit()
song1 = mzLoadMusic("miketest.ogg")
mzPlay(song1)
MESSAGEBOX(0,"Press OK to stop the song","Info")
mzFree(song1)
mzClose()

Ionic Wind Support Team

Don't depend on a relative path.

song1 = mzLoadMusic(GetStartPath() + "miketest.ogg")

The IDE can change the current directory while compiling.  Usually its the resource compiler that does it which I have reported to the author.  But it's always a good idea to use GetStartPath() anyway ;)

Paul.
Ionic Wind Support Team

MikeHart

Mmmh, I put GETSTARTPATH in front of the filename and then it works all the time. But I noticed one thing.

1. I freshly start EBDEV.
2. Load in the source (without getstartpath) above. Compile and Run from inside the IDE works fine.
3. Load in the project and compile it.
4. Recreate the import library for the audiere.dll
5. Close project
6. Compile and Run the sample from inside the IDE then doesn't work.

Seems to me that a path is set differently compairing the IBP IDE with the new one. But that's ok, someone just has to know.

Ionic Wind Support Team

I will look into forcing the current directory to the one the executable is in on executing.  Beleive there is a member of the ShellExecuteA structure that allows that.

Many things are different then Pro.  Thanks for reporting this one ;)
Ionic Wind Support Team