Skip to content

Commit 8624c92

Browse files
committed
Removed old functions to convert Float PCM to 8, 16, and 32 bit PCM
1 parent 73f87cf commit 8624c92

File tree

2 files changed

+0
-43
lines changed

2 files changed

+0
-43
lines changed

source/twr-c/audio.c

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -38,42 +38,3 @@ long twr_audio_play_range_sync_ex(long node_id, long start_sample, long end_samp
3838

3939
return twr_audio_play_range_sync_sample_rate(node_id, start_sample, end_sample, fields->loop, fields->sample_rate, fields->volume, fields->pan);
4040
}
41-
42-
float* twr_convert_8_bit_pcm(char* pcm, long pcm_len) {
43-
const float MAX_8 = 127.0;
44-
const float MIN_8 = -128.0;
45-
46-
float* ret = (float*)malloc(sizeof(float) * pcm_len);
47-
48-
for (long i = 0; i < pcm_len; i++) {
49-
ret[i] = pcm[i] > 0 ? pcm[i]/MAX_8 : pcm[i]/MIN_8;
50-
}
51-
52-
return ret;
53-
}
54-
55-
float* twr_convert_16_bit_pcm(short* pcm, long pcm_len) {
56-
const float MAX_16 = 32767.0;
57-
const float MIN_16 = -32768.0;
58-
59-
float* ret = (float*)malloc(sizeof(float) * pcm_len);
60-
61-
for (long i = 0; i < pcm_len; i++) {
62-
ret[i] = pcm[i] > 0 ? pcm[i]/MAX_16 : pcm[i]/MIN_16;
63-
}
64-
65-
return ret;
66-
}
67-
68-
float* twr_convert_32_bit_pcm(long* pcm, long pcm_len) {
69-
const float MAX_32 = 2147483647.0;
70-
const float MIN_32 = -2147483648.0;
71-
72-
float* ret = (float*)malloc(sizeof(float) * pcm_len);
73-
74-
for (long i = 0; i < pcm_len; i++) {
75-
ret[i] = pcm[i] > 0 ? pcm[i]/MAX_32 : pcm[i]/MIN_32;
76-
}
77-
78-
return ret;
79-
}

source/twr-c/twr-audio.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,6 @@ struct AudioMetadata {
6464
__attribute__((import_name("twrAudioGetMetadata"))) void twr_audio_get_metadata(long node_id, struct AudioMetadata* metadata);
6565

6666

67-
float* twr_convert_8_bit_pcm(char* pcm, long pcm_len);
68-
float* twr_convert_16_bit_pcm(short* pcm, long pcm_len);
69-
float* twr_convert_32_bit_pcm(long* pcm, long pcm_len);
70-
7167
#ifdef __cplusplus
7268
}
7369
#endif

0 commit comments

Comments
 (0)