nice refactors, now way cleaner to work with!

This commit is contained in:
2026-04-07 17:20:42 +02:00
parent 966c15cffb
commit bdc58f5b48
17 changed files with 61 additions and 31 deletions

9
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,9 @@
{
"makefile.launchConfigurations": [
{
"cwd": "/home/sebastian/Documents/e36",
"binaryPath": "/home/sebastian/Documents/e36/e36",
"binaryArgs": []
}
]
}

View File

@@ -1,16 +1,35 @@
# Makefile
CC = gcc CC = gcc
CFLAGS = -Wall -O2 CFLAGS = -Wall -O2 -Iinclude -Ithird_party
LDFLAGS = -lm LDFLAGS = -lm
SRCDIR = src
BUILDDIR = build
TARGET = e36 TARGET = e36
SRCS = main.c sstv.c robot36.c image.c wav.c martin.c scottie.c
OBJS = $(SRCS:.c=.o) SRCS = \
$(SRCDIR)/main.c \
$(SRCDIR)/encoder/image.c \
$(SRCDIR)/encoder/sstv.c \
$(SRCDIR)/encoder/modes/martin.c \
$(SRCDIR)/encoder/modes/robot36.c \
$(SRCDIR)/encoder/modes/scottie.c \
$(SRCDIR)/sound/wav.c
OBJS = $(patsubst $(SRCDIR)/%.c,$(BUILDDIR)/%.o,$(SRCS))
.PHONY: all clean dirs
all: dirs $(TARGET)
dirs:
mkdir -p $(BUILDDIR)/encoder/modes $(BUILDDIR)/sound
$(TARGET): $(OBJS) $(TARGET): $(OBJS)
$(CC) $(OBJS) -o $(TARGET) $(LDFLAGS) $(CC) $(OBJS) -o $@ $(LDFLAGS)
%.o: %.c $(BUILDDIR)/%.o: $(SRCDIR)/%.c
$(CC) $(CFLAGS) -c $< -o $@ $(CC) $(CFLAGS) -c $< -o $@
clean: clean:
rm -f $(TARGET) $(OBJS) rm -rf $(BUILDDIR) $(TARGET)

View File

@@ -1,7 +1,7 @@
#ifndef MARTIN_H #ifndef MARTIN_H
#define MARTIN_H #define MARTIN_H
#include "wav.h" #include "sound/wav.h"
#include <stdint.h> #include <stdint.h>
typedef struct { typedef struct {

View File

@@ -1,7 +1,7 @@
#ifndef ROBOT36_H #ifndef ROBOT36_H
#define ROBOT36_H #define ROBOT36_H
#include "wav.h" #include "sound/wav.h"
#include <stdint.h> #include <stdint.h>
#define ROBOT36_WIDTH 320 #define ROBOT36_WIDTH 320

View File

@@ -1,7 +1,7 @@
#ifndef SCOTTIE_H #ifndef SCOTTIE_H
#define SCOTTIE_H #define SCOTTIE_H
#include "wav.h" #include "sound/wav.h"
#include <stdint.h> #include <stdint.h>
typedef struct { typedef struct {

View File

@@ -1,7 +1,7 @@
#ifndef SSTV_H #ifndef SSTV_H
#define SSTV_H #define SSTV_H
#include "wav.h" #include "sound/wav.h"
#include <stdint.h> #include <stdint.h>
void sstv_tone(wav_t *wav, double freq, double duration_ms); void sstv_tone(wav_t *wav, double freq, double duration_ms);

View File

@@ -1,6 +1,6 @@
#define STB_IMAGE_IMPLEMENTATION #define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h" #include "../../third_party/stb_image.h"
#include "image.h" #include "../../include/encoder/image.h"
#include <stdlib.h> #include <stdlib.h>
int image_load(image_t *img, const char *filename) { int image_load(image_t *img, const char *filename) {

View File

@@ -1,7 +1,8 @@
#include "martin.h" // martin.c - includes look shit, but this has to be like this
#include "image.h" #include "encoder/modes/martin.h"
#include "sstv.h" #include "encoder/image.h"
#include "wav.h" #include "encoder/sstv.h"
#include "sound/wav.h"
#include <stdint.h> #include <stdint.h>
const martin_mode_t MARTIN_M1 = { const martin_mode_t MARTIN_M1 = {

View File

@@ -1,5 +1,5 @@
#include "robot36.h" #include "encoder/modes/robot36.h"
#include "sstv.h" #include "encoder/sstv.h"
#include <stdint.h> #include <stdint.h>
// From Dayton Paper Appendix B - ITU BT.601 // From Dayton Paper Appendix B - ITU BT.601

View File

@@ -1,7 +1,8 @@
#include "scottie.h" #include "encoder/modes/scottie.h"
#include "image.h" #include "encoder/image.h"
#include "sstv.h" #include "encoder/sstv.h"
#include "wav.h" #include "sound/wav.h"
#include <stdint.h> #include <stdint.h>
const scottie_mode_t SCOTTIE_S1 = { const scottie_mode_t SCOTTIE_S1 = {

View File

@@ -1,7 +1,7 @@
#include "sstv.h" #include "sound/wav.h"
#include "image.h" #include "encoder/sstv.h"
#include "robot36.h" #include "encoder/image.h"
#include "wav.h" #include "encoder/modes/robot36.h"
#include <math.h> #include <math.h>
#include <stdint.h> #include <stdint.h>

View File

@@ -1,6 +1,6 @@
#include "sstv.h" #include "encoder/modes/martin.h"
#include "martin.h" #include "encoder/modes/scottie.h"
#include "scottie.h" #include "encoder/sstv.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>

View File

@@ -1,4 +1,4 @@
#include "wav.h" #include "sound/wav.h"
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>