first commit

This commit is contained in:
2021-09-02 22:22:01 +02:00
commit 0ceccb0d5d
6 changed files with 222 additions and 0 deletions

30
tonegen.h Executable file
View File

@@ -0,0 +1,30 @@
#pragma once
#include <SDL2/SDL.h>
#define CHIPTUNE_EFFECT_NONE 0
#define CHIPTUNE_EFFECT_SLIDE 1
#define CHIPTUNE_EFFECT_VIBRATO 2
#define CHIPTUNE_EFFECT_DROP 3
#define CHIPTUNE_EFFECT_FADEIN 4
#define CHIPTUNE_EFFECT_FADEOUT 5
#define CHIPTUNE_INSTRUMENT_SAWTOOTH 0
#define CHIPTUNE_INSTRUMENT_SQUARE 1
#define CHIPTUNE_INSTRUMENT_TRIANGLE 2
#define CHIPTUNE_INSTRUMENT_NOISE 3
class toneGen {
public:
toneGen(const int note_length);
void setup(const uint8_t note, const uint8_t instrument, const uint8_t volume, const uint8_t effect);
void setup(const uint16_t tracker_note);
const int getSamples(const int numSamples, Sint16 *buffer);
private:
uint8_t note, instrument, volume, effect;
float nominal_volume, current_volume;
Sint16 df, old_df, f;
int note_length;
int current_pos;
};