Start atlas
This commit is contained in:
19
util/audio.h
19
util/audio.h
@@ -11,9 +11,9 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#define SAMPLE_RATE 44100
|
||||
#define NUM_SYNTH_VOICES 3
|
||||
#define NUM_SYNTH_VOICES 256
|
||||
|
||||
typedef enum {
|
||||
typedef enum Waveform {
|
||||
WAVE_SINE,
|
||||
WAVE_SQUARE,
|
||||
WAVE_SAWTOOTH,
|
||||
@@ -21,19 +21,24 @@ typedef enum {
|
||||
WAVE_NOISE
|
||||
} Waveform;
|
||||
|
||||
typedef struct {
|
||||
uint8_t volume;
|
||||
uint16_t frequency;
|
||||
uint8_t phase;
|
||||
typedef struct SynthVoice {
|
||||
Waveform waveform;
|
||||
uint8_t phase;
|
||||
uint16_t frequency;
|
||||
uint8_t volume;
|
||||
SDL_Rect sourceRect;
|
||||
} SynthVoice;
|
||||
|
||||
typedef struct {
|
||||
typedef struct AudioData {
|
||||
SynthVoice synthVoices[NUM_SYNTH_VOICES];
|
||||
SDL_Rect *playerRect;
|
||||
float maxPanDistance;
|
||||
} AudioData;
|
||||
|
||||
extern AudioData audioData;
|
||||
|
||||
void audio_callback(void *userdata, Uint8 *stream, int len);
|
||||
|
||||
uint16_t getAvailableChannel();
|
||||
|
||||
#endif //RISCB_AUDIO_H
|
||||
|
Reference in New Issue
Block a user