gapless playback (1 Viewer)

grubi

Portal Pro
June 16, 2007
1,216
80
127.0.0.1
Home Country
Germany Germany
Hi,
Nice, don't have much time to test things now, guess hw can look @ see if it's possible to make this gapless, gapless.
Tried to set fadin to 0ms & it's better but misses a fraction of a beat ;)

Regards
Roy

What I also found on testing it that you also have the gaps when simply playing an audio CD.
That is really annoying and is really a pain for audiophile ears if you are listening to a cd
which has no gaps at all like clubmixes or live albums.

grubi.
 

hwahrmann

Development Group
  • Team MediaPortal
  • September 15, 2004
    4,633
    2,457
    Vienna, Austria
    Home Country
    Austria Austria
    Grubi,

    i fully understand your problem.
    Yes it is relativeley easy to fix, since i've introduced the mixing support a while back.

    i may be able to reduce the gap a bit more, but due to the player architecture we currently have, i might not suceed completely.
    since the Bass audio engine is invoked by the playlist player, which invokes the next song only after the first has ended. so i most probably need to play with some sort of Crossfading to reach some sort of gapless playback.

    The biggest problem however is that we're in a feature freeze currently, so that we can release 0.2.3.
    The changes would be a bit too dramatical and could break other things, which i simply don't want to.

    So after the freeze is over, i'll have a look into that.
    Promised.
     

    grubi

    Portal Pro
    June 16, 2007
    1,216
    80
    127.0.0.1
    Home Country
    Germany Germany
    Grubi,

    i fully understand your problem.
    Yes it is relativeley easy to fix, since i've introduced the mixing support a while back.

    i may be able to reduce the gap a bit more, but due to the player architecture we currently have, i might not suceed completely.
    since the Bass audio engine is invoked by the playlist player, which invokes the next song only after the first has ended. so i most probably need to play with some sort of Crossfading to reach some sort of gapless playback.

    The biggest problem however is that we're in a feature freeze currently, so that we can release 0.2.3.
    The changes would be a bit too dramatical and could break other things, which i simply don't want to.

    So after the freeze is over, i'll have a look into that.
    Promised.

    Hi hwahrmann,

    I think a feature freeze is a good thing to get 0.2.3 to the level of reliability it needs for a stable release. Esp. in the
    recent past we saw that new features were breaking existing code.

    The amount of changes necessary also prevent me from giving it a try at the moment (the effect on exisiting code is more complex as it seems in the first moment).

    From what I have seen so far gapless should be possible with the current architecture as it is possible to crossfade two songs at the moment without a gap. I have taken a deeper look at the Play method however I still did not find where and when it is triggered exactly. I would assume this happens by a callback of the BASS engine when the end of the currently running track is reached (nearly reached?). What is necessary for gapless is to use the BASS_Mixer interface which I saw is already used at least when upmixing or ASIO is involved. Important is to use the BASS_MIXER_NORAMPIN flag on the BASS_Mixer_StreamAddChannel call which was introduced exactly for the gapless issue. Following is a code snipped which is from the BASS devs for achieving gapless playback. I have not checked it, however I will do so from within a test app and see if it leads to really gapless playback.

    Regards,
    grubi.

    mixer=BASS_Mixer_StreamCreate(44100, 2, BASS_MIXER_END); // create mixer
    BASS_ChannelSetSync(mixer, BASS_SYNC_END|BASS_SYNC_MIXTIME, 0, EndSync, 0); // set sync for end

    source=BASS_StreamCreateFile(...,BASS_STREAM_DECODE|BASS_SAMPLE_FLOAT); // open 1st source
    BASS_Mixer_StreamAddChannel(mixer, source, BASS_STREAM_AUTOFREE); // plug it in (and auto-free it when it ends)

    BASS_ChannelPlay(mixer, FALSE); // start playing

    ...

    void CALLBACK EndSync(HSYNC handle, DWORD channel, DWORD data, DWORD user)
    {
    if (!more_sources) return;
    source=BASS_StreamCreateFile(...,BASS_STREAM_DECODE|BASS_SAMPLE_FLOAT); // open next source
    BASS_Mixer_StreamAddChannel(mixer, source, BASS_STREAM_AUTOFREE|BASS_MIXER_NORAMPIN); // plug it in
    BASS_ChannelSetPosition(mixer, 0); // reset the mixer
    }
     

    Users who are viewing this thread

    Top Bottom