From f923a3824561c6cf200c638e3d44d1cbf4adf7d8 Mon Sep 17 00:00:00 2001 From: Arturs Artamonovs Date: Sun, 5 Jan 2025 10:07:35 +0000 Subject: Waterfall: drawing from file initial implementatiom, visual version concept is ready --- Radio/Utils/WaterfallFile/main.swift | 113 +++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 Radio/Utils/WaterfallFile/main.swift (limited to 'Radio/Utils/WaterfallFile/main.swift') diff --git a/Radio/Utils/WaterfallFile/main.swift b/Radio/Utils/WaterfallFile/main.swift new file mode 100644 index 0000000..cf72d56 --- /dev/null +++ b/Radio/Utils/WaterfallFile/main.swift @@ -0,0 +1,113 @@ +// +// main.swift +// WaterfallFile +// +// Created by Jacky Jack on 23/12/2024. +// + +import Foundation +import Accelerate + +print("Read binary file") + +let input_filename="rtlsdr_100M_m.cu8" + + +//get data from u8 file +let dir = getCurrentExecutableDir() +let filemgr = FileManager.default + +if !filemgr.fileExists(atPath: input_filename) { + print("Cant find file \(input_filename)") + exit(0) +} + +let fileHandle: FileHandle? = FileHandle(forReadingAtPath: dir+"/"+input_filename) +var i8_arr:[Int8]? = nil +if let file = fileHandle { + file.seek(toFileOffset: 0) + do { + if let databuf = try file.readToEnd() { + + print("read \(databuf.count) \(databuf) bytes") + //let temp_arr = [Int8](databuf) + i8_arr = [Int8](repeating: 0, count: databuf.count) + + for i in 0..