aboutsummaryrefslogtreecommitdiff
path: root/source/soundux.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/soundux.h')
-rw-r--r--source/soundux.h79
1 files changed, 37 insertions, 42 deletions
diff --git a/source/soundux.h b/source/soundux.h
index 45c177e..411e334 100644
--- a/source/soundux.h
+++ b/source/soundux.h
@@ -21,7 +21,6 @@ enum { MODE_NONE = SOUND_SILENT, MODE_ADSR, MODE_RELEASE = SOUND_RELEASE,
#define ENVELOPE_SHIFT 7
#define MAX_VOLUME 127
#define VOLUME_SHIFT 7
-#define VOL_DIV 128
#define SOUND_DECODE_LENGTH 16
#define NUM_CHANNELS 8
@@ -33,11 +32,11 @@ enum { MODE_NONE = SOUND_SILENT, MODE_ADSR, MODE_RELEASE = SOUND_RELEASE,
typedef struct
{
- int sound_fd;
- int sound_switch;
- int playback_rate;
- int buffer_size;
- bool encoded;
+ int sound_fd;
+ int sound_switch;
+ int playback_rate;
+ int buffer_size;
+ bool encoded;
int32_t samples_mixed_so_far;
int32_t play_position;
uint32_t err_counter;
@@ -46,63 +45,62 @@ typedef struct
SoundStatus so;
-
typedef struct
{
- int state;
- int type;
- int16_t volume_left;
- int16_t volume_right;
+ int state;
+ int type;
+ int16_t volume_left;
+ int16_t volume_right;
uint32_t hertz;
uint32_t frequency;
uint32_t count;
- bool loop;
- int envx;
- int16_t left_vol_level;
- int16_t right_vol_level;
- int16_t envx_target;
+ bool loop;
+ int envx;
+ int16_t left_vol_level;
+ int16_t right_vol_level;
+ int16_t envx_target;
uint32_t env_error;
uint32_t erate;
- int direction;
+ int direction;
uint32_t attack_rate;
uint32_t decay_rate;
uint32_t sustain_rate;
uint32_t release_rate;
uint32_t sustain_level;
- int16_t sample;
- int16_t decoded [16];
- int16_t previous16 [2];
+ int16_t sample;
+ int16_t decoded [16];
+ int16_t previous16 [2];
int16_t* block;
uint16_t sample_number;
- bool last_block;
- bool needs_decode;
+ bool last_block;
+ bool needs_decode;
uint32_t block_pointer;
uint32_t sample_pointer;
- int* echo_buf_ptr;
- int mode;
- int32_t envxx;
- int16_t next_sample;
- int32_t interpolate;
- int32_t previous [2];
+ int* echo_buf_ptr;
+ int mode;
+ int32_t envxx;
+ int16_t next_sample;
+ int32_t interpolate;
+ int32_t previous [2];
// Just incase they are needed in the future, for snapshot compatibility.
uint32_t dummy [8];
} Channel;
typedef struct
{
- int echo_enable;
- int echo_feedback; /* range is -128 .. 127 */
- int echo_ptr;
- int echo_buffer_size;
- int echo_write_enabled;
- int echo_channel_enable;
- int pitch_mod;
+ int echo_enable;
+ int echo_feedback; /* range is -128 .. 127 */
+ int echo_ptr;
+ int echo_buffer_size;
+ int echo_write_enabled;
+ int echo_channel_enable;
+ int pitch_mod;
// Just incase they are needed in the future, for snapshot compatibility.
uint32_t dummy [3];
- Channel channels [NUM_CHANNELS];
- int16_t master_volume [2]; /* range is -128 .. 127 */
- int16_t echo_volume [2]; /* range is -128 .. 127 */
- int noise_hertz;
+ Channel channels [NUM_CHANNELS];
+ int16_t master_volume [2]; /* range is -128 .. 127 */
+ int16_t echo_volume [2]; /* range is -128 .. 127 */
+ int noise_hertz;
} SSoundData;
SSoundData SoundData;
@@ -123,7 +121,6 @@ void S9xSetSoundKeyOff(int channel);
void S9xSetSoundDecayMode(int channel);
void S9xSetSoundAttachMode(int channel);
void S9xSoundStartEnvelope(Channel*);
-void S9xSetSoundSample(int channel, uint16_t sample_number);
void S9xSetEchoFeedback(int echo_feedback);
void S9xSetEchoEnable(uint8_t byte);
void S9xSetEchoDelay(int byte);
@@ -133,7 +130,6 @@ void S9xSetFrequencyModulationEnable(uint8_t byte);
void S9xSetEnvelopeRate(int channel, uint32_t rate, int direction,
int target);
bool S9xSetSoundMode(int channel, int mode);
-int S9xGetEnvelopeHeight(int channel);
void S9xResetSound(bool full);
void S9xFixSoundAfterSnapshotLoad();
void S9xPlaybackSoundSetting(int channel);
@@ -142,7 +138,6 @@ void S9xFixEnvelope(int channel, uint8_t gain, uint8_t adsr1, uint8_t adsr2);
void S9xStartSample(int channel);
void S9xMixSamples(uint8_t* buffer, int sample_count);
-void S9xMixSamplesO(uint8_t* buffer, int sample_count, int byte_offset);
bool S9xOpenSoundDevice(int, bool, int);
void S9xSetPlaybackRate(uint32_t rate);
#endif