diff options
author | 2010-01-15 09:05:00 +0100 | |
---|---|---|
committer | 2010-01-15 09:05:00 +0100 | |
commit | 8982489c9bf060bc3b4a9d7513db247269be46eb (patch) | |
tree | 5826823ca58ffd88146823988f88f0655bc8ebc3 /cgme.c | |
parent | 18dd6046040c7a27113f2425d87fa275eb4b8a64 (diff) |
gme: use gme_track_ended instead of detecting silence
Diffstat (limited to 'cgme.c')
-rw-r--r-- | cgme.c | 19 |
1 files changed, 2 insertions, 17 deletions
@@ -28,7 +28,6 @@ typedef struct { DB_fileinfo_t info; Music_Emu *emu; int reallength; - int nzerosamples; uint32_t cgme_voicemask; float duration; // of current song } gme_info_t; @@ -56,7 +55,6 @@ cgme_init (DB_playItem_t *it) { _info->samplerate = samplerate; info->duration = deadbeef->pl_get_item_duration (it); info->reallength = inf.length; - info->nzerosamples = 0; _info->readpos = 0; return _info; } @@ -87,21 +85,8 @@ cgme_read (DB_fileinfo_t *_info, char *bytes, int size) { } _info->readpos += t; if (info->reallength == -1) { - // check if whole buffer is zeroes - int i; - for (i = 0; i < size; i++) { - if (bytes[i]) { - break; - } - } - if (i == size) { - info->nzerosamples += size / 4; - if (info->nzerosamples > _info->samplerate * 4) { - return 0; - } - } - else { - info->nzerosamples = 0; + if (gme_track_ended (info->emu)) { + return 0; } } return size; |