33 lines
980 B
C++
Executable File
33 lines
980 B
C++
Executable File
#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();
|
|
void setNoteLength(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;
|
|
float vibrato_counter;
|
|
};
|