[linux-audio-dev] LADSPA: unions vs pointers .. more issues

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: [linux-audio-dev] LADSPA: unions vs pointers .. more issues
From: Benno Senoner (sbenno_AT_gardena.net)
Date: Sat Mar 25 2000 - 20:07:42 EET


Hi,
just another thought about unions:

when using the union example:
typedef union {
                       float float32;
                       double float64;
                        .. (insert your foobar datatype <=16bytes here)
                       char pad[16];
                     } LADSPA_Data;

if you access to a value
with

variable.float32 = 123

and you want to turn your plugin code from float32 to float64
you have to change all types from .float32 to float64

while in the pointer case

---
float *float_ptr;
float_ptr=(float *)&psPortRangeHints[SDL_DELAY_LENGTH].HintDescriptor
* float_ptr  = LADSPA_HINT_BOUNDED_BELOW | LADSPA_HINT_BOUNDED_ABOVE;
---

you only have to typedef use typedefs ( typedef float float_type) instead of using the float datatype directy. So with a simple change of the typedef you have the 64bit-float plugin.

Anyway I don't see the substition of float32 to float64 as a big deal, since unions make the code much simpler, and the performance is not compromised. My first version will therefore use the union construct.

Benno.


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Sat Mar 25 2000 - 21:49:33 EET