Skip to content

Commit

Permalink
Drop support for WAVE loop points
Browse files Browse the repository at this point in the history
  • Loading branch information
viciious committed Oct 14, 2019
1 parent 9573326 commit 8d337ba
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 46 deletions.
7 changes: 1 addition & 6 deletions source/snd_qf/snd_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,7 @@ static void S_SoundList_f( void ) {
if( sc ) {
size = sc->length * sc->width * sc->channels;
total += size;
if( sc->loopstart < sc->length ) {
Com_Printf( "L" );
} else {
Com_Printf( " " );
}
Com_Printf( "(%2db) %6i : %s\n", sc->width * 8, size, sfx->name );
Com_Printf( " (%2db) %6i : %s\n", sc->width * 8, size, sfx->name );
} else {
if( sfx->name[0] == '*' ) {
Com_Printf( " placeholder : %s\n", sfx->name );
Expand Down
2 changes: 0 additions & 2 deletions source/snd_qf/snd_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ typedef struct {

typedef struct {
unsigned int length;
unsigned int loopstart;
unsigned int speed; // not needed, because converted on load?
unsigned short channels;
unsigned short width;
Expand Down Expand Up @@ -121,7 +120,6 @@ typedef struct {
int rate;
short width;
short channels;
int loopstart;
int samples;
int dataofs; // chunk starts this many bytes from file start
} wavinfo_t;
Expand Down
31 changes: 1 addition & 30 deletions source/snd_qf/snd_mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@ sfxcache_t *S_LoadSound_Wav( sfx_t *s ) {
sc->channels = info.channels;
sc->width = info.width;
sc->speed = dma.speed;
sc->loopstart = info.loopstart < 0 ? sc->length : info.loopstart * ( (double)sc->length / (double)info.samples );
s->cache = sc;

S_Free( data );
Expand Down Expand Up @@ -345,7 +344,6 @@ wavinfo_t GetWavinfo( const char *name, uint8_t *wav, int wavlength ) {
wavinfo_t info;
int i;
int format;
int samples;

memset( &info, 0, sizeof( info ) );

Expand Down Expand Up @@ -384,25 +382,6 @@ wavinfo_t GetWavinfo( const char *name, uint8_t *wav, int wavlength ) {
data_p += 4 + 2;
info.width = GetLittleShort() / 8;

// get cue chunk
FindChunk( "cue " );
if( data_p ) {
data_p += 32;
info.loopstart = GetLittleLong();

// if the next chunk is a LIST chunk, look for a cue length marker
FindNextChunk( "LIST" );
if( data_p ) {
if( !strncmp( (char *) data_p + 28, "mark", 4 ) ) { // this is not a proper parse, but it works with cooledit...
data_p += 24;
i = GetLittleLong(); // samples in loop
info.samples = info.loopstart + i;
}
}
} else {
info.loopstart = -1;
}

// find data chunk
FindChunk( "data" );
if( !data_p ) {
Expand All @@ -411,15 +390,7 @@ wavinfo_t GetWavinfo( const char *name, uint8_t *wav, int wavlength ) {
}

data_p += 4;
samples = GetLittleLong() / info.width / info.channels;

if( info.samples ) {
if( samples < info.samples ) {
S_Error( "Sound %s has a bad loop length", name ); // FIXME: Medar: Should be ERR_DROP?
}
} else {
info.samples = samples;
}
info.samples = GetLittleLong() / info.width / info.channels;

info.dataofs = data_p - wav;

Expand Down
3 changes: 0 additions & 3 deletions source/snd_qf/snd_mix.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,9 +458,6 @@ int S_PaintChannels( unsigned int endtime, int dumpfile, float gain ) {
if( ch->autosound ) { // autolooping sounds always go back to start
ch->pos = 0;
ch->end = ltime + sc->length;
} else if( sc->loopstart < sc->length ) {
ch->pos = sc->loopstart;
ch->end = ltime + sc->length - ch->pos;
} else { // channel just stopped
ch->sfx = NULL;
}
Expand Down
2 changes: 0 additions & 2 deletions source/snd_qf/snd_music.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,6 @@ static int S_BackgroundTrack_GetWavinfo( const char *name, wavinfo_t *info ) {
trap_FS_Read( &t, sizeof( t ), file );
info->width = LittleShort( t ) / 8;

info->loopstart = 0;

// find data chunk
last_chunk = iff_data;
if( !S_BackgroundTrack_FindNextChunk( "data", &last_chunk, file ) ) {
Expand Down
3 changes: 0 additions & 3 deletions source/snd_qf/snd_ogg.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ sfxcache_t *SNDOGG_Load( sfx_t *s ) {

sc = s->cache = S_Malloc( len + sizeof( sfxcache_t ) );
sc->length = samples;
sc->loopstart = sc->length;
sc->speed = vi->rate;
sc->channels = vi->channels;
sc->width = 2;
Expand Down Expand Up @@ -241,7 +240,6 @@ sfxcache_t *SNDOGG_Load( sfx_t *s ) {

if( sc->speed != dma.speed ) {
sc->length = ResampleSfx( samples, sc->speed, sc->channels, 2, (uint8_t *)buffer, sc->data, s->name );
sc->loopstart = sc->length;
sc->speed = dma.speed;
}

Expand Down Expand Up @@ -333,7 +331,6 @@ bool SNDOGG_OpenTrack( bgTrack_t *track, bool *delay ) {
track->info.width = 2;
track->info.dataofs = 0;
track->info.samples = (int)qov_pcm_total( vf, -1 );
track->info.loopstart = track->info.samples;

return true;

Expand Down

0 comments on commit 8d337ba

Please sign in to comment.