#include "main.hpp" #include "sound.hpp" #include "memory.hpp" #include #ifdef __DOS__ extern "C" { #include "../judas2/judas.h" }; #endif /******************************************************************************* ** SoundLoadFromFile *******************************************************************************/ void SoundLoadFromFile(Sound* sound, char* filename) { memset(sound, 0, sizeof(Sound)); #ifdef __DOS__ sound->wave = judas_loadwav(filename); ThrowIf(!sound->wave, "Could not load wav file"); #endif } /******************************************************************************* ** SoundPlay *******************************************************************************/ void SoundPlay(Sound* sound, int channelid, int looping) { #ifdef __DOS__ channelid += 1; SAMPLE* sample = (SAMPLE*) sound->wave; if ((judas_channel[channelid].voicemode & VM_LOOP) == 0) { if (looping) sample->voicemode |= VM_LOOP; judas_stopsample(channelid); judas_playsample(sample, channelid, 11025, 64, MIDDLE); } #endif } /******************************************************************************* ** SoundEffect *******************************************************************************/ void SoundEffect(Sound* sound) { static int channel; SoundPlay(sound, channel + 4, 0); channel = (channel + 1) % 8; }