Skip to content

Commit

Permalink
Apply Julian's changes to improve a1's mixing
Browse files Browse the repository at this point in the history
  • Loading branch information
RobDangerous committed Aug 5, 2024
1 parent 7d82ee8 commit bd8e264
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Sources/kinc/audio1/a1unit.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

struct kinc_a1_channel {
kinc_a1_sound_t *sound;
float position;
double position;
bool loop;
volatile float volume;
float pitch;
Expand Down
4 changes: 2 additions & 2 deletions Sources/kinc/audio1/audio.c.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ static kinc_a1_channel_t channels[CHANNEL_COUNT];
static kinc_a1_stream_channel_t streamchannels[CHANNEL_COUNT];
static kinc_internal_video_channel_t videos[CHANNEL_COUNT];

static float sampleLinear(int16_t *data, float position) {
static float sampleLinear(int16_t *data, double position) {
int pos1 = (int)position;
int pos2 = (int)(position + 1);
float sample1 = data[pos1] / 32767.0f;
float sample2 = data[pos2] / 32767.0f;
float a = position - pos1;
float a = (float)(position - pos1);
return sample1 * (1 - a) + sample2 * a;
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/kinc/audio1/sound.c.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ kinc_a1_sound_t *kinc_a1_sound_create(const char *filename) {
kinc_affirm(false);
}
}
sound->sample_rate_pos = 44100 / (float)sound->samples_per_second;
sound->sample_rate_pos = kinc_a2_samples_per_second() / (float)sound->samples_per_second;
free(data);

return sound;
Expand Down

0 comments on commit bd8e264

Please sign in to comment.