print("=== TerminalDAW - Version 0.0.1 ===\n")

from ui.app import AppUI
from project import Project, ProjectChannel, AudioChannelChunk
import librosa
import sounddevice
import mp3


if __name__ == "__main__":
    print("Loading project...")
    """test_project = Project(song_length=64,bpm=120)
    
    drum_channel = ProjectChannel(
        test_project,
        name="Drums",
        volume=-5,
        pan=-100
    )
    drum_channel.chunks.append(AudioChannelChunk(
        drum_channel,
        position=0,
        *librosa.load("120 bpm amen break.mp3", mono=False, sr=test_project.sample_rate),
        name="120 bpm amen break.mp3"
    ))
    drum_channel.chunks.append(AudioChannelChunk(
        drum_channel,
        position=1,
        *librosa.load("120 bpm amen break.mp3", mono=False, sr=test_project.sample_rate),
        name="120 bpm amen break.mp3"
    ))
    drum_channel.chunks.append(AudioChannelChunk(
        drum_channel,
        position=2,
        *librosa.load("120 bpm amen break.mp3", mono=False, sr=test_project.sample_rate),
        name="120 bpm amen break.mp3"
    ))
    drum_channel.chunks.append(AudioChannelChunk(
        drum_channel,
        position=3,
        *librosa.load("120 bpm amen break.mp3", mono=False, sr=test_project.sample_rate),
        name="120 bpm amen break.mp3"
    ))
    drum_channel.chunks.append(AudioChannelChunk(
        drum_channel,
        position=4,
        *librosa.load("120 bpm amen break.mp3", mono=False, sr=test_project.sample_rate),
        name="120 bpm amen break.mp3"
    ))
    
    piano_channel = ProjectChannel(
        test_project,
        name="Piano",
        volume=-5,
        pan=100
    )
    piano_channel.chunks.append(AudioChannelChunk(
        piano_channel,
        position=2,
        *librosa.load("piano chords - Bmin 120BPM.wav", mono=False, sr=test_project.sample_rate),
        name="piano chords - Bmin 120BPM.wav"
    ))

    test_project.channels.append(drum_channel)
    test_project.channels.append(piano_channel)
    
    test_project.write_to_file("test_project.tdp")"""
    test_project = Project.from_file("test_project.tdp")
    
    # start the ui
    print("Starting UI...")
    app = AppUI(test_project)
    app.run()