tribusonz-2 / rb_wave

Wave library for Ruby
MIT License
0 stars 0 forks source link

Should PCM data types be variable? #5

Open tribusonz-2 opened 2 months ago

tribusonz-2 commented 2 months ago

The type of PCM data is the C language double type in this implementation, but the float type is also often used in DSP programming. So, should the type be made variable like the vector class in C++? In this case, the developer has to be careful when coding memory management. For example, if we were to implement a PCM class in C++, well then we would use allocation as shown below.

C++ Allocation for PCM class:
[number of sampling frequency, size=(sizeof(void))][number of sample length, size=(sizeof(void))][information of the specified type, size=(sizeof(void)][Samples(start of pointer), size=(specified allocation amount<c-type>)][(end of pointer)]

However, the standard type for most built-in libraries is the double type, and there are not many libraries for the float type. Services may be affected, such as some functions that can only be used with double type arrays.