timeline refactor, bit broken rn

This commit is contained in:
2025-11-09 10:35:21 -05:00
parent 1e35910b0a
commit e2799b1e58
41 changed files with 2034 additions and 1374 deletions

View File

@@ -0,0 +1,26 @@
#include "audio_stream.h"
namespace anm2ed
{
void AudioStream::callback(void* userData, MIX_Mixer* mixer, const SDL_AudioSpec* spec, float* pcm, int samples)
{
auto self = (AudioStream*)userData;
self->stream.insert(self->stream.end(), pcm, pcm + samples);
}
AudioStream::AudioStream(MIX_Mixer* mixer)
{
MIX_GetMixerFormat(mixer, &spec);
}
void AudioStream::capture_begin(MIX_Mixer* mixer)
{
MIX_SetPostMixCallback(mixer, callback, this);
}
void AudioStream::capture_end(MIX_Mixer* mixer)
{
MIX_SetPostMixCallback(mixer, nullptr, this);
stream.clear();
}
}

View File

@@ -0,0 +1,20 @@
#pragma once
#include <SDL3_mixer/SDL_mixer.h>
#include <vector>
namespace anm2ed
{
class AudioStream
{
static void callback(void*, MIX_Mixer*, const SDL_AudioSpec*, float*, int);
public:
std::vector<float> stream{};
SDL_AudioSpec spec{};
AudioStream(MIX_Mixer*);
void capture_begin(MIX_Mixer*);
void capture_end(MIX_Mixer*);
};
}

View File

@@ -153,7 +153,7 @@ namespace anm2ed::resource::icon
<svg viewBox="0 0 24 48" fill="#FFF" xmlns="http://www.w3.org/2000/svg"> <path d="M4 0H20V38L12 48L4 38V0Z"/> </svg>
)";
#define LIST \
#define SVG_LIST \
X(NONE, NONE_DATA, SIZE_SMALL) \
X(FILE, FILE_DATA, SIZE_NORMAL) \
X(FOLDER, FOLDER_DATA, SIZE_NORMAL) \
@@ -195,7 +195,7 @@ namespace anm2ed::resource::icon
enum Type
{
#define X(name, data, size) name,
LIST
SVG_LIST
#undef X
COUNT
};
@@ -209,7 +209,21 @@ namespace anm2ed::resource::icon
const Info ICONS[COUNT] = {
#define X(name, data, size) {data, std::strlen(data) - 1, size},
LIST
SVG_LIST
#undef X
};
constexpr uint8_t PROGRAM[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00,
0x40, 0x00, 0x00, 0x00, 0x40, 0x08, 0x04, 0x00, 0x00, 0x00, 0x00, 0x60, 0xb9, 0x55, 0x00, 0x00, 0x00, 0x09, 0x70,
0x48, 0x59, 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, 0x00,
0x8b, 0x49, 0x44, 0x41, 0x54, 0x68, 0xde, 0xed, 0xd7, 0x3d, 0x0e, 0x80, 0x20, 0x0c, 0x86, 0x61, 0x7b, 0x53, 0x3c,
0x99, 0xbd, 0x69, 0x1d, 0x8c, 0x83, 0x4d, 0xd0, 0x44, 0x29, 0x7f, 0xbe, 0x5d, 0x08, 0x30, 0xf4, 0x19, 0x80, 0x2f,
0xc8, 0xd2, 0xb8, 0x04, 0xc0, 0xb4, 0x80, 0x64, 0xc7, 0xb8, 0xf9, 0x86, 0x02, 0x60, 0x36, 0x80, 0xd9, 0x75, 0xbe,
0xba, 0x7d, 0x00, 0xf3, 0x00, 0x72, 0x8d, 0x7c, 0x83, 0x73, 0x5d, 0xa5, 0xf0, 0x43, 0x04, 0xa0, 0x1a, 0x20, 0xaa,
0x11, 0x80, 0xf1, 0x01, 0x1a, 0x14, 0x5b, 0x00, 0xfa, 0x03, 0x24, 0xbb, 0x0f, 0x93, 0xa7, 0xb0, 0xf9, 0x1c, 0x46,
0x00, 0x00, 0x00, 0xe8, 0x06, 0xa0, 0xa5, 0x3f, 0x2a, 0x99, 0x07, 0x0d, 0x40, 0xbf, 0x80, 0xa8, 0x02, 0x30, 0x0e,
0x40, 0xdf, 0x1e, 0xb2, 0x56, 0xb7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x07, 0x90, 0x86, 0xff, 0x05, 0xd4,
0x2e, 0x00, 0x00, 0x00, 0x34, 0x07, 0xec, 0x94, 0x51, 0xac, 0x41, 0x55, 0x6e, 0xe4, 0x26, 0x00, 0x00, 0x00, 0x00,
0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82};
}

View File

@@ -28,15 +28,9 @@ using namespace glm;
namespace anm2ed::resource
{
bool Texture::is_valid()
{
return id != 0;
}
bool Texture::is_valid() { return id != 0; }
size_t Texture::pixel_size_get()
{
return size.x * size.y * CHANNELS;
}
size_t Texture::pixel_size_get() { return size.x * size.y * CHANNELS; }
void Texture::upload(const uint8_t* data)
{
@@ -66,15 +60,9 @@ namespace anm2ed::resource
if (is_valid()) glDeleteTextures(1, &id);
}
Texture::Texture(const Texture& other)
{
*this = other;
}
Texture::Texture(const Texture& other) { *this = other; }
Texture::Texture(Texture&& other)
{
*this = std::move(other);
}
Texture::Texture(Texture&& other) { *this = std::move(other); }
Texture& Texture::operator=(const Texture& other) // Copy
{

View File

@@ -26,8 +26,8 @@ namespace anm2ed::resource
size_t pixel_size_get();
void upload();
void upload(const uint8_t*);
Texture();
Texture();
~Texture();
Texture(const Texture&);
Texture(Texture&&);