Current Page: NeXtMidas Training Primitives Introduction to DSP Using the Data Class (ctd.)
| The `Data` Class: Casting and uncasting arrays: This is one of the two places where NeXtMidas uses native C code (if available). For large arrays, doing the type conversion/cast in native code is faster. For small arrays, the difference between Java and C code is negligable. A complete Java implementation is available that is automatically used when NeXtMidas runs via WebStart. If you use the methods in the `Data` class, NeXtMidas will automatically choose between the C or Java code, using the fastest option available. If you follow the following rules, your code will work all the time: If you cast an array, you must uncast it. Always cast and uncast within the `process()` method. The `copy` parameter to the cast and uncast methods indicates if a data copy is required. Input array: Use `true` for the cast and `false` for the uncast. Output array: Use `false` for the cast and `true` for the uncast. In/out array: Use `true` for the cast and `true` for the uncast. Setting the `copy` flag to `false` allows NeXtMidas to skip the data copy if doing so would be faster. The docs for the nxm.sys.lib.Data class include multiple examples.