1
0
mirror of https://github.com/RPCS3/soundtouch.git synced 2024-11-08 12:02:28 +01:00

Merge pull request 'Expose BPM detector beat position and strength retrieval API via SoundTouchDLL.' (#11) from sagamusix/soundtouch:master into master

Reviewed-on: https://codeberg.org/soundtouch/soundtouch/pulls/11
This commit is contained in:
Olli Parviainen 2023-03-26 17:03:37 +00:00
commit cc24adfc6d
2 changed files with 29 additions and 0 deletions

View File

@ -562,3 +562,21 @@ SOUNDTOUCHDLL_API float __cdecl bpm_getBpm(HANDLE h)
return bpmh->pbpm->getBpm();
}
/// Get beat position arrays. Note: The array includes also really low beat detection values
/// in absence of clear strong beats. Consumer may wish to filter low values away.
/// - "pos" receive array of beat positions
/// - "values" receive array of beat detection strengths
/// - max_num indicates max.size of "pos" and "values" array.
///
/// You can query a suitable array sized by calling this with nullptr in "pos" & "values".
///
/// \return number of beats in the arrays.
SOUNDTOUCHDLL_API int __cdecl bpm_getBeats(HANDLE h, float* pos, float* strength, int count)
{
BPMHANDLE *bpmh = (BPMHANDLE *)h;
if (bpmh->dwMagic != BPMMAGIC) return 0;
return bpmh->pbpm->getBeats(pos, strength, count);
}

View File

@ -225,5 +225,16 @@ SOUNDTOUCHDLL_API void __cdecl bpm_putSamples_i16(HANDLE h,
/// \return Beats-per-minute rate, or zero if detection failed.
SOUNDTOUCHDLL_API float __cdecl bpm_getBpm(HANDLE h);
/// Get beat position arrays. Note: The array includes also really low beat detection values
/// in absence of clear strong beats. Consumer may wish to filter low values away.
/// - "pos" receive array of beat positions
/// - "values" receive array of beat detection strengths
/// - max_num indicates max.size of "pos" and "values" array.
///
/// You can query a suitable array sized by calling this with nullptr in "pos" & "values".
///
/// \return number of beats in the arrays.
SOUNDTOUCHDLL_API int __cdecl bpm_getBeats(HANDLE h, float *pos, float *strength, int count);
#endif // _SoundTouchDLL_h_