mirror of
https://github.com/ggerganov/ggwave.git
synced 2026-02-07 09:18:01 +08:00
c, python : add option to query encode size
This commit is contained in:
@@ -49,7 +49,8 @@ int ggwave_encode(
|
||||
int dataSize,
|
||||
ggwave_TxProtocolId txProtocolId,
|
||||
int volume,
|
||||
char * outputBuffer) {
|
||||
char * outputBuffer,
|
||||
int query) {
|
||||
GGWave * ggWave = (GGWave *) g_instances[instance];
|
||||
|
||||
if (ggWave == nullptr) {
|
||||
@@ -62,6 +63,14 @@ int ggwave_encode(
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (query != 0) {
|
||||
if (query == 1) {
|
||||
return ggWave->encodeSize_bytes();
|
||||
}
|
||||
|
||||
return ggWave->encodeSize_samples();
|
||||
}
|
||||
|
||||
int nSamples = 0;
|
||||
|
||||
GGWave::CBWaveformOut cbWaveformOut = [&](const void * data, uint32_t nBytes) {
|
||||
|
||||
Reference in New Issue
Block a user