YoYoGames / GMEXT-FMOD

Repository for GameMaker's FMOD Extension
Apache License 2.0
52 stars 2 forks source link

Unable to obtain FFT Spectrum data, unsure if user-error or app bug #4

Closed BPzeBanshee closed 6 months ago

BPzeBanshee commented 6 months ago

Description

I'm having difficulty attempting to use the FFT DSP, more specifically the buffer results from fmod_dsp_get_parameter_data.

I think I've got the DSP hooked up correctly as I'm able to obtain the dominant frequency value, but it isn't clear to me what kind of buffer data I'm supposed to be getting back from fmod_dsp_get_parameter_data(dsp_fft,FMOD_DSP_FFT.SPECTRUMDATA,fft_buffer) and the data is not changing when I call it consecutively, irrespective of if I clear the buffer and/or seek to start. In addition, saving the buffer gives an empty file unless I pre-fill the buffer with 255, then call the FMOD function, then save, and the FMOD function will not work for the first few frames of song playing (presumably due to some kind of internal buffer fill itself).

According to the documentation here, the buffer should be filled with the equivalent of a struct containing two ints and at least one array of floats, but I'm getting garbage values back. They don't make sense when being viewed as floats, and there's no u8 value in the entire buffer that would indicate usage of the ext_buffer functions according to the FMOD_Definitions script.

Relevant project files: compiler.txt FMOD-GMEXT Test.zip

Expected Change

No response

Steps To Reproduce

  1. Start GameMaker
  2. Start project
  3. (optional) hit Space to save buffer to file and view in hex editor

How reliably can you recreate this issue using your steps above?

Always

Which version of GameMaker are you reporting this issue for?

Monthly

Which platform(s) are you seeing the problem on?

Windows

Compiler Log File

Sample .yyz File

DiasFranciscoA commented 6 months ago

Upon examining the implementation and your demo project, and after consulting the FMOD documentation, it appears you're attempting to use features that are not supported. According to the manual and release notes, the Plugin API is currently not supported.

We will look into this further...

BPzeBanshee commented 6 months ago

I'm not sure I understand. How is the FFT DSP (which is part of FMOD Core) a plugin, compared to FMOD_DSP_TYPE_VSTPLUGIN, FMOD_DSP_TYPE_WINAMPPLUGIN or the FMOD Studio plugin features?

DiasFranciscoA commented 6 months ago

This should be not fixed on the version that just got released (v0.0.2) In regards to how the data is stored in the buffer if you look at the site information as you suggested:

image

you can read the data as follows:

image

BPzeBanshee commented 6 months ago

Thank you @DiasFranciscoA , with this update and the example you provided I was able to get it going. :)