I understand now (I think), but my code gives an error:
Dim sound2 As Long
Dim channel As Long
Dim dspPitch As Long
Dim sgPitchVal As Single
Dim exinfo As FMOD_CREATESOUNDEXINFO
Private Sub Form_Load()
Dim result As FMOD_RESULT
Dim version As Long
' Global settings result = FMOD_System_Create(System) ERRCHECK (result) result = FMOD_System_GetVersion(System, version) ERRCHECK (result) If version <> FMOD_VERSION Then MsgBox "Error! You are using an old version of FMOD " & version & ". " & _ "This program requires " & FMOD_VERSION End If result = FMOD_System_Init(System, 32, 16, FMOD_INIT_NORMAL, 0) ERRCHECK (result) result = FMOD_System_CreateSound(System, "../../examples/media/jaguar.wav", FMOD_SOFTWARE, exinfo, sound2) ERRCHECK (result) result = FMOD_System_CreateDSPByType(System, FMOD_DSP_TYPE_PITCHSHIFT, dspPitch) sgPitchVal = 1.5 result = FMOD_DSP_SetParameter(dspPitch, FMOD_DSP_PITCHSHIFT_PITCH, sgPitchVal) result = FMOD_System_PlaySound(System, FMOD_CHANNEL_FREE, sound2, 0, channel) result = FMOD_Channel_AddDSP(channel, dspPitch) ERRCHECK (result)
When I try to set the paramter dor the DSP it gives an division by zero message. I have also tried to move the setparameter to after the adddsp with the same result.
When using the GetParameterInfo on the dsp (result = FMOD_DSP_GetParameterInfo(dspPitch, FMOD_DSP_PITCHSHIFT_PITCH, stmp1(0), stmp2(0), stmp3(0), 255, sg1, sg2)) it returns:
Frequency center. 20.0 to 22000.0. Default = 8000.0.
I found the bug. The bug is in the bas file with the enumerations.
You have forgotten to include the HIGHPASS enum so that the PITH enum gets the wrong enum.
A word of advise….Always number the enums with a value then this things are less likely
What is this dsp variable ?
And how do I set the actual pitch shift ?
David[/quote:1pa92kr6]dsp is a variable that contains the handle of the pitch shift DSP unit. Kind of like how hDCs and hWnds work in VB.
I’m pretty sure you would set the pitch shift by using the DSP property APIs.
- Janus answered 12 years ago
Please login first to submit.