//
//  TSThemeBrowseVM.swift
//  AIRingtone
//
//  Created by 100Years on 2025/3/3.
//

class TSThemeBrowseVM {
    var audioPlayer:TSBusinessAudioPlayer?
    //vc 的 currentIndex 是根据滚动视图平凡变动的,finallyIndex只会在有新值时候产生变动
    var finallyIndex:Int = -1

    
    var finallyIndexChange:(()->Void)?
    
    //return  发生了改变
    func setFinallyIndex(_ currentIndex:Int,ringtone:String?){
        if finallyIndex != currentIndex{
            finallyIndex = currentIndex
            audioPlayer?.stop()
            audioPlayer?.playUrlString( ringtone,loop: true)
            finallyIndexChange?()
        }
    }
}
