|
|
|
|
|
|
|
|
buffer_length = min_buffer_length; |
|
|
buffer_length = min_buffer_length; |
|
|
|
|
|
|
|
|
// allocate 2 bytes per sample |
|
|
// allocate 2 bytes per sample |
|
|
outbuf_size = (buffer_length * samplerate)/500; |
|
|
|
|
|
|
|
|
// Always round up to the nearest sample and the nearest byte. |
|
|
|
|
|
int millisamples = buffer_length * samplerate; |
|
|
|
|
|
outbuf_size = (millisamples + 1000 - millisamples % 1000) / 500; |
|
|
out_start = (unsigned char *)realloc(outbuf, outbuf_size); |
|
|
out_start = (unsigned char *)realloc(outbuf, outbuf_size); |
|
|
if (out_start == NULL) |
|
|
if (out_start == NULL) |
|
|
return ENOMEM; |
|
|
return ENOMEM; |