Music and sound

This commit is contained in:
2023-01-15 15:53:50 +00:00
parent b8f67a8f9e
commit 2731d01bc1
10 changed files with 62 additions and 57 deletions

View File

@@ -118,7 +118,6 @@ void print_devices()
void sound_init()
{
PaError err = Pa_Initialize();
check_pa_err(err);
@@ -151,18 +150,20 @@ void audio_close()
//Mix_CloseAudio();
}
struct wav make_sound(const char *wav)
static struct wav mwav;
struct wav *make_sound(const char *wav)
{
struct wav mwav;
mwav.data = drwav_open_file_and_read_pcm_frames_s16("sounds/alert.wav", &mwav.ch, &mwav.samplerate, &mwav.frames, NULL);
mwav.data = drwav_open_file_and_read_pcm_frames_s16(wav, &mwav.ch, &mwav.samplerate, &mwav.frames, NULL);
if (mwav.samplerate != SAMPLERATE) {
YughInfo("Changing samplerate of %s.", wav);
mwav = change_samplerate(mwav, 48000);
}
mwav.gain = 1.f;
return mwav;
return &mwav;
}
struct soundstream *soundstream_make()