looper/playlist.hpp

39 lines
1 KiB
C++
Raw Permalink Normal View History

2024-12-08 11:00:17 -08:00
#pragma once
#include <filesystem>
#include <vector>
#define LOOP_FOREVER (-1)
namespace fs = std::filesystem;
struct PlaylistEntry {
double speed;
double tempo;
double pitch;
int loops;
int stream_idx;
fs::path path;
};
class Playlist {
friend class LooperXspfReaderCallback;
std::vector<PlaylistEntry> entries;
fs::path path;
using vec = std::vector<PlaylistEntry>;
using iterator = vec::iterator;
using const_iterator = vec::const_iterator;
using reverse_iterator = vec::reverse_iterator;
using const_reverse_iterator = vec::const_reverse_iterator;
public:
void save(fs::path output_file);
inline PlaylistEntry &operator[](int idx) {
return entries[idx];
}
iterator begin();
iterator end();
const_iterator cbegin();
const_iterator cend();
reverse_iterator rbegin();
reverse_iterator rend();
const_reverse_iterator crbegin();
const_reverse_iterator crend();
Playlist(fs::path input_file);
Playlist() = default;
};