MP BASS Engine won't play "incomplete" songs properly (1 Viewer)

seco

Retired Team Member
  • Premium Supporter
  • August 7, 2007
    1,575
    1,239
    Home Country
    Finland Finland
    Hello,

    I am writing a plugin where I download an audio file (MP3 or OGG) to disk.

    I'd like to start the playback of the song after, let's say 10% of the song has been saved to disk. I have tried following by using Bass Engine of MediaPortal, when 10% of the file has been saved (and the download continues writing to file):

    PHP:
    BassMusicPlayer.Player.InitBass();
    BassMusicPlayer.Player.Play(filename);

    However, this is working incorrectly. The MP Bass Engine only plays 10% of the song and then stops. If I do following:

    PHP:
    Bass.BASS_Init(-1, 96000, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero);        
    Bass.BASS_ChannelPlay(Bass.BASS_StreamCreateFile(filename, 0, 0, BASSFlag.BASS_DEFAULT), false);

    I get the wanted result, song is played completely while downloading keeps writing to the file.

    Does any of the developers have any idea why MP Bass Engine behaves like this and what part of BASS settings might be the cause?


    MediaPortal Version: 1.1.0
    MediaPortal Skin: StreamedMP
    Windows Version: Windows 7 32-bit
    CPU Type: Intel E8200 2.66GHz
    HDD: OCZ Core SSD 32GB
    Memory: Kingston 4GB 800MHz
    Motherboard: Asus P5E-VM HDMI
    Video Card: ATI Radeon HD4850
    Video Card Driver: Catalyst 10.7
    Sound Card: Onboard
    Sound Card AC3: Coaxial Out
    Sound Card Driver:
    1. TV Card: FireDTV
    1. TV Card Type: DVB-C
    1. TV Card Driver: 5.6
    2. TV Card:
    2. TV Card Type:
    2. TV Card Driver:
    3. TV Card:
    3. TV Card Type:
    3. TV Card Driver:
    4. TV Card:
    4. TV Card Type:
    4. TV Card Driver:
    MPEG2 Video Codec: Cyberlink PDVD 10
    MPEG2 Audio Codec: ffdshow
    h.264 Video Codec: Cyberlink PDVD 10
    Satelite/CableTV Provider: TTV Tampere, Finland
    HTPC Case: Antec Fusion 2
    Cooling: Stock
    Power Supply: Antec 430W
    Remote: Logitech diNovo Mini / FireDTV Remote
    TV: Toshiba 46ZF355
    TV - HTPC Connection: HDMI
     

    hwahrmann

    Development Group
  • Team MediaPortal
  • September 15, 2004
    4,633
    2,457
    Vienna, Austria
    Home Country
    Austria Austria
    When using the MediaPlayer Player functionality, using your first example, we look at the length of the file, which is currently only 10% of it.
    And we set a Fade Out. This is needed, so that we are able to start the nextr song from the playlist, once the first one ends.

    This is not what you want to achieve with your plugin anyhow.
    So instead of using the MP Player framework, you should use the code from your second example.
     

    seco

    Retired Team Member
  • Premium Supporter
  • August 7, 2007
    1,575
    1,239
    Home Country
    Finland Finland
    • Thread starter
    • Moderator
    • #3
    Ok thanks, I will make my own Player implementation then using BASS directly.
     

    tourettes

    Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    When using the MediaPlayer Player functionality, using your first example, we look at the length of the file, which is currently only 10% of it.
    And we set a Fade Out. This is needed, so that we are able to start the nextr song from the playlist, once the first one ends.

    Just wondering couldn't we update the fade out on file system events (new data written)? Of course we shouldn't change that behavior for MP1, but just wondering will it be possible to update that fade out position dynamically.
     

    seco

    Retired Team Member
  • Premium Supporter
  • August 7, 2007
    1,575
    1,239
    Home Country
    Finland Finland
    • Thread starter
    • Moderator
    • #5
    When using the MediaPlayer Player functionality, using your first example, we look at the length of the file, which is currently only 10% of it.
    And we set a Fade Out. This is needed, so that we are able to start the nextr song from the playlist, once the first one ends.

    Just wondering couldn't we update the fade out on file system events (new data written)? Of course we shouldn't change that behavior for MP1, but just wondering will it be possible to update that fade out position dynamically.

    So it's the Fade Out feature which requires the length and that is why it won't work in my case?

    Of course I would have like to use MP's Bass Engine, but if support for my case cannot be added I can live with my own BASS player implementation.
     

    hwahrmann

    Development Group
  • Team MediaPortal
  • September 15, 2004
    4,633
    2,457
    Vienna, Austria
    Home Country
    Austria Austria
    Sorry, should have been more precisly.
    In fact it has nothing to do with Fading out.

    When starting a song, we find out the length of the song, so that once it ends, we could set the Fade out point. (If no Fade Out is used, then we're "fading" out exactly at the end of the song).
    we simply need to find the end point of the song, so that we are able to start the next song.

    And we only have 10% of the song available, so that is, where we stop playback, even if more data is there.
    therefor you need to use a non-playlist oriented playback in your plugin
     

    seco

    Retired Team Member
  • Premium Supporter
  • August 7, 2007
    1,575
    1,239
    Home Country
    Finland Finland
    • Thread starter
    • Moderator
    • #7
    I'm not sure why the endpoint is needed for starting the next song or what you mean by non-playlist oriented playback...

    Anyway, yesterday I implemented my own player (which uses "normal" playlist) so that I hook to playback end event and move to next track on playlist when this event fires, everything is working fine :)
     

    hwahrmann

    Development Group
  • Team MediaPortal
  • September 15, 2004
    4,633
    2,457
    Vienna, Austria
    Home Country
    Austria Austria
    Because we need support for Crossfading, i cannot hook to the Playback end event itself.
    Instead of that we find out the length of the song and set our own playback end, which is "Length of song" - "Seconds to Fade".
    In your case we don#t have the full song length, only the first 10%, so this is why we terminate there.

    Glad to hear that it works now for you. Let me know, when your plugin is ready.
     

    Users who are viewing this thread

    Top Bottom