/// <summary> /// Plays given song /// </summary> /// <param name="song">the song to be played</param> public void playCurrSong(Song song) { ISound sound = engine.Play2D(song.getPath()); sound.Volume = window.getVolume(); sound.setSoundStopEventReceiver(this); //set stop handler song.setSound(new Sound(sound)); }
/// <summary> /// Plays given song /// </summary> /// <param name="song">The song to be played</param> public void playCurrSong(Song song) { //Create the stream and play it using a channel int stream = Bass.BASS_StreamCreateFile(song.getPath(), 0, 0, BASSFlag.BASS_DEFAULT | BASSFlag.BASS_STREAM_AUTOFREE); Bass.BASS_ChannelPlay(stream, false); //Set up the syncer, and update the song and the volume Bass.BASS_ChannelSetSync(stream, BASSSync.BASS_SYNC_END | BASSSync.BASS_SYNC_MIXTIME, 0, syncer, IntPtr.Zero); song.setSound(new Sound(stream)); Bass.BASS_SetVolume(window.getVolume()); }