0
0

Hi,
Anyone help with this, since upgrading to 3.73 my scope and spectrum
seems not to work now, access violation !

The callback routine works fine in Fmod 3.6 although I got the EQ stuff
working it’s just the scope and spectrum thats not, well the scopes displaying but no data ? When selecting the spectrum it just returns
an access violation ??

Anyway heres the init and callback code any help would be appreciated 😀

// The init stuff
FMOD_Load(nil);

{ Check version numbers }
if FMOD_VERSION > FSOUND_GetVersion then
begin
Application.MessageBox(PChar(Format(‘API version %3.2f is newer than DLL version %3.2f’, [FMOD_VERSION, FSOUND_GetVersion])), ‘Version mismatch’, MB_OK or MB_ICONERROR);
Halt;
end;

{ Initialize FSOUND }
try
if not FSOUND_SetOutput(FSOUND_OUTPUT_DSOUND) then
raise Exception.Create(‘FSOUND_SetOutput failed’);
if not FSOUND_SetDriver(0) then
raise Exception.Create(‘FSOUND_SetDriver failed’);
//if not FSOUND_SetMixer(FSOUND_MIXER_QUALITY_AUTODETECT) then
// raise Exception.Create(‘FSOUND_SetMixer failed’);
if not FSOUND_SetHWND(Handle) then
raise Exception.Create(‘FSOUND_SetHWND failed’);
if not FSOUND_SetBufferSize(256)then
raise Exception.Create(‘Buffer Size error’);
except
Application.MessageBox(FMOD_ErrorString(FSOUND_GetError), ‘Initialization’, MB_OK or MB_ICONHAND);
raise;
end;
//FSOUND_Init(22050, 32,FSOUND_ENABLEFX or FSOUND_INIT_GLOBALFOCUS ) then
if not FSOUND_Init(22050, 128, FSOUND_INIT_ENABLESYSTEMCHANNELFX or FSOUND_INIT_GLOBALFOCUS or FSOUND_NORMAL) then
begin
Application.MessageBox(FMOD_ErrorString(FSOUND_GetError), ‘FSOUND_Init’, MB_OK or MB_ICONHAND);
Halt;
end;

// The CallBack routine

function TForm1.MyFilterCallback(OriginalBuffer,NewBuffer:Pointer;ALength,Param:Integer):Pointer;
var Count:Integer;
Data :PSingleArray;
begin
NewBuffer := OriginalBuffer;
OscBlockCount := FSOUND_DSP_GetBufferLengthTotal DIV 4; // 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]:=trunc(Data^[Count]/512);
end;
Result := NewBuffer; // Return the buffer to the chain, very important!
end;

Cheers Leo

  • You must to post comments
0
0

Maybe you are still using the 3.6 units, the difference is that 3.7 uses STDCALL callbacks and the old one another one.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.