Skip to content

Commit

Permalink
Just skip sounds for now if not found
Browse files Browse the repository at this point in the history
  • Loading branch information
JonnyPtn committed Sep 26, 2024
1 parent e54775b commit d984131
Showing 1 changed file with 22 additions and 16 deletions.
38 changes: 22 additions & 16 deletions linuxdoom-1.10/i_sound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ import wad;
import argv;
import doomdef;


// Update all 30 millisecs, approx. 30fps synchronized.
// Linux resolution is allegedly 10 millisecs,
// scale is microseconds.
Expand Down Expand Up @@ -356,7 +355,14 @@ void I_SetMusicVolume(int volume) {
// Retrieve the raw data lump index
// for a given SFX name.
//
int I_GetSfxLumpNum(sfxinfo_t *sfx) { return W_GetNumForName(sfx->name); }
int I_GetSfxLumpNum(sfxinfo_t *sfx) {
if (W_CheckNumForName(sfx->name) != -1) {
return W_GetNumForName(sfx->name);
} else {
I_Debug("Failed getting sfx lump number for: {}", sfx->name);
return -1;
}
}

//
// Starting a sound means adding it
Expand Down Expand Up @@ -562,7 +568,7 @@ void I_ShutdownSound(void) {
I_SoundDelTimer();

// Cleaning up -releasing the DSP device.
//close(audio_fd);
// close(audio_fd);

// Done.
return;
Expand All @@ -578,27 +584,27 @@ void I_InitSound() {
// Secure and configure sound device first.
fprintf(stderr, "I_InitSound: ");

//audio_fd = open("/dev/dsp", O_WRONLY);
//if (audio_fd < 0)
// fprintf(stderr, "Could not open /dev/dsp\n");
// audio_fd = open("/dev/dsp", O_WRONLY);
// if (audio_fd < 0)
// fprintf(stderr, "Could not open /dev/dsp\n");

i = 11 | (2 << 16);
//myioctl(audio_fd, SNDCTL_DSP_SETFRAGMENT, &i);
//myioctl(audio_fd, SNDCTL_DSP_RESET, 0);
// myioctl(audio_fd, SNDCTL_DSP_SETFRAGMENT, &i);
// myioctl(audio_fd, SNDCTL_DSP_RESET, 0);

i = SAMPLERATE;

//myioctl(audio_fd, SNDCTL_DSP_SPEED, &i);
// myioctl(audio_fd, SNDCTL_DSP_SPEED, &i);

i = 1;
//myioctl(audio_fd, SNDCTL_DSP_STEREO, &i);
// myioctl(audio_fd, SNDCTL_DSP_STEREO, &i);

//myioctl(audio_fd, SNDCTL_DSP_GETFMTS, &i);
// myioctl(audio_fd, SNDCTL_DSP_GETFMTS, &i);

//if (i &= AFMT_S16_LE)
//myioctl(audio_fd, SNDCTL_DSP_SETFMT, &i);
//else
//fprintf(stderr, "Could not play signed 16 data\n");
// if (i &= AFMT_S16_LE)
// myioctl(audio_fd, SNDCTL_DSP_SETFMT, &i);
// else
// fprintf(stderr, "Could not play signed 16 data\n");

fprintf(stderr, " configured audio device\n");

Expand All @@ -609,7 +615,7 @@ void I_InitSound() {
// Alias? Example is the chaingun sound linked to pistol.
if (!S_sfx[i].link) {
// Load data from WAD file.
//S_sfx[i].data = getsfx(S_sfx[i].name, &lengths[i]);
// S_sfx[i].data = getsfx(S_sfx[i].name, &lengths[i]);
} else {
// Previously loaded already?
S_sfx[i].data = S_sfx[i].link->data;
Expand Down

0 comments on commit d984131

Please sign in to comment.