0
0

Hi,
Has anyone else had this error message using XP and Delphi 7 ?
It only happens When I set the border of the form to ‘borderstyle=none’ in
the form properties, the prog locks up and so will Delphi 7?? if I set it to anything else such has a dialog it’s fine and fmod plays with the Spectrum and stuff. This only seems to happen in XP, in win98 SE if works fine with
a border or without??

Thank

Leo

  • You must to post comments
0
0

have you tried running the program with the debugger turned on? try stepping through the program with f7 to find the troublesome function. i have just tried the fmod testbed in d7 enterprise with no porblems

  • You must to post comments
0
0

Thanks,
Birty for the reply, it seems the fault lies in the following line

OscBuffer[Count] := StrToInt(FormatFloat(‘0’,(Data[Count-1]*118)));

or even this way

OscBuffer[Count]:=Trunc(Data[Count]*118);

The confusing part is that both work when I set the border style to any
apart from ‘none’ then the error occurs.

Leo

  • You must to post comments
0
0

whta is data? a larger code section might help

  • You must to post comments
0
0

Birty,
Data is an array of floats returned by the call back routine for
the spectrum. See below. This routine was given on fmods forum some time back and works well, until you remove the borders on a form. Then
the NaN error occurs, but only in XP though? I’m begining to think that
this is a fault within XP and not fmod or Delphi 7. Although I need to test
a compiled version on a different OS system. i.e. 98 SE. I’ll get back on that one.

Thanks again for your interest

Leo

function TForm1.MyFilterCallback(OriginalBuffer,NewBuffer:Pointer;Length,Param:Integer):Pointer;
var Count:Integer;
Data :PSingleArray;
begin
NewBuffer := OriginalBuffer;
OscBlockCount := FSOUND_DSP_GetBufferLengthTotal DIV 2; // Half The Buffer length
Data := PSingleArray(NewBuffer); // Convert the Pointer to an Array of Floats
SetLength(OscBuffer,OscBlockCount);
For Count := 0 to OscBlockCount -1 do
Begin
OscBuffer[Count] := StrToInt(FormatFloat(‘0’,Data^[Count-1] / 512)); // Half the value
end;
Result := NewBuffer; // Return the buffer to the chain, very important!
end;

  • You must to post comments
0
0

i have a feeling that somehow you are accessing past the end of the array. if you send your code to alanDOTbirtlesATdslDOTpipexDOTcom then i will have a look at it for you

  • You must to post comments
0
0

Birty,
I’ve just tested the app. in the 98 SE environment with no borders
to the form, this seems to work with no NaN error at all. Although I’m
still only using Fmod 3.6 at the moment.
Yeah you could be right in accessing the float arrays but then this would also be true with the border to the form being enabled? I’ll send a working beta copy to your mail
address above, perhaps you could try it on your system for me if you would.

As to sending the code I will if you wish, but then to get it to work on your system you might need to have DelphiX installed on your system as I’m
using the DirectX in this to write the Spectrum and Oscillascope displays and the update is done from within a directX timer.

In trying to debug this error I’ve also turned off/Remed out a lot of the functional stuff within the app mainly the FX stuff althougth things like the
graphic equalizer,Frequency change, echo stuff and volume remain working.

Thanks again I do appreciate your interest

regards Leo

  • You must to post comments
0
0

i already have delphix so no problem there, have you tried running the program with out the xp manifest as this may be causing the problem (if it works on 98 which ignores the manifest)

  • You must to post comments
0
0

Hi again,

Well got the ‘NaN’ error sorted ! 😀 and yes it was within the
callback routine as I thought. Read the link below which will
explain why the ‘ Not A Number ‘ occurs. 8)

http://community.borland.com/article/0, … 16,00.html

It’s just a quick fix at the moment which checks for the NaN
condition then skips over it I’m sure I could clean it up further
anyway here’s the callback routine adjusted for the NaN if
anyone’s interested.


            //   CallBack routine for the DSP buffer  !  //

function TForm1.MyFilterCallback(OriginalBuffer,NewBuffer:Pointer;ALength,Param:Integer):Pointer;
var Count:Integer;
Data :PSingleArray;
begin
NewBuffer := OriginalBuffer;
OscBlockCount := FSOUND_DSP_GetBufferLengthTotal DIV 2; // Half The Buffer length
Data := PSingleArray(NewBuffer); // Convert the Pointer to an Array of Floats
SetLength(OscBuffer,OscBlockCount);
For Count := 0 to OscBlockCount -1 do
Begin
Begin
// ***********************************************************

  ///      STOP THE ERROR WITH BOARDERS IN XP ! ( a work around )

  if isNaN(Data^[Count]/512)=false then  // Stop the 'Not A Number' !
  OscBuffer[Count]:=trunc(Data^[Count]/512);
  end;
  //OscBuffer[Count] := StrToInt(FormatFloat('0',Data^[Count] / 512));  // Half the value

// ***********************************************************
end;
Result := NewBuffer; // Return the buffer to the chain, very important!
end;

Leo

  • You must to post comments
0
0

The problem is you are reading past the end of the buffer…and it shouldnt be “DIV 2” should be “DIV 4” because “Singles” are 4 bytes long, not 2…try that out and removing the IsNan

  • You must to post comments
0
0

XMinioNX,
Spot on ! Did as you said and it’s works, Thank you.
Still would like to know the reason why the error only happened
when the form’s boarders are set to none in XP.

Birty did suggest that the problem lay in accessing passed the
float buffer.

I Appreciate both yours and Birty’s inputs into this code problem.

Big Thanks

Leo

  • You must to post comments
Showing 10 results
Your Answer

Please first to submit.