const bass = require('../old/basswrapper').basswrapper;
let basslib = new bass();
let rootPath=require('app-root-path');
let path=require('path');

let song = rootPath.path + '/test.mp3';

basslib.BASS_Init(-1, 44100, basslib.BASS_DEVICE_STEREO);


// basslib.BASS_ChannelPlay(chan, 0);


let mixer = basslib.BASS_Mixer_StreamCreate(44100, 2, basslib.BASS_SAMPLE_DEFAULT);
let chan = basslib.BASS_StreamCreateFile(false, song, 0, 0, basslib.BASS_STREAM_DECODE | basslib.BASS_SAMPLE_FLOAT);
let ok = basslib.BASS_Mixer_StreamAddChannel(mixer, chan, basslib.BASS_SAMPLE_DEFAULT);
basslib.BASS_ChannelPlay(mixer, 0);
let Pos20SecondsBytePos=basslib.BASS_ChannelSeconds2Bytes(chan,5);
basslib.BASS_ChannelSetSync(chan,basslib.BASS_SYNC_POS,Pos20SecondsBytePos,(handle,channel,data,user)=>{
    console.log("position reached to 5 secs")
});
setInterval(()=> {},1000);