module Cmd.Repl.LTala where
import qualified Cmd.Cmd as Cmd
import qualified Cmd.Edit as Edit
import qualified Cmd.ModifyEvents as ModifyEvents
import qualified Cmd.Repl.LEvent as LEvent
import qualified Cmd.Repl.LRuler as LRuler
import qualified Cmd.Ruler.Tala as Tala
import qualified Cmd.Selection as Selection
import qualified Ui.Events as Events
import qualified Ui.Meter.Meter as Meter
chatusram_to_tisram :: Cmd.CmdL ()
chatusram_to_tisram :: CmdL ()
chatusram_to_tisram = do
(BlockId
block_id, [TrackNum]
_, [TrackId]
_, Range
range) <- forall (m :: * -> *).
M m =>
m (BlockId, [TrackNum], [TrackId], Range)
Selection.tracks
let (Duration
start, Duration
end) = Range -> (Duration, Duration)
Events.range_times Range
range
forall (m :: * -> *). M m => Track m -> m ()
ModifyEvents.selection forall a b. (a -> b) -> a -> b
$
forall (m :: * -> *). Monad m => (Event -> Event) -> Track m
ModifyEvents.event forall a b. (a -> b) -> a -> b
$ Duration -> Duration -> Event -> Event
LEvent.stretch_event Duration
start (Duration
2forall a. Fractional a => a -> a -> a
/Duration
3)
let dur :: Duration
dur = (Duration
end forall a. Num a => a -> a -> a
- Duration
start) forall a. Num a => a -> a -> a
* (Duration
2forall a. Fractional a => a -> a -> a
/Duration
3)
forall (m :: * -> *). M m => m Modify -> m [RulerId]
LRuler.local forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *). M m => (Meter -> Meter) -> m Modify
LRuler.modify_selected forall a b. (a -> b) -> a -> b
$
Duration -> Duration -> [MSection] -> Meter -> Meter
LRuler.replace_range Duration
start (Duration
start forall a. Num a => a -> a -> a
+ Duration
dur) forall a b. (a -> b) -> a -> b
$
Meter -> [MSection]
Meter.meter_sections (Tala -> TrackNum -> Duration -> Duration -> Meter
Tala.make_until Tala
Tala.adi_tala TrackNum
3 Duration
1 Duration
dur)
forall (m :: * -> *).
M m =>
BlockId -> Duration -> Duration -> m ()
Edit.delete_block_time BlockId
block_id (Duration
start forall a. Num a => a -> a -> a
+ Duration
dur) (Duration
end forall a. Num a => a -> a -> a
- (Duration
startforall a. Num a => a -> a -> a
+Duration
dur))
chatis :: Tala.Avartanams -> Tala.Nadai -> Meter.Meter
chatis :: TrackNum -> TrackNum -> Meter
chatis TrackNum
avartanams TrackNum
nadai =
Tala -> TrackNum -> Duration -> TrackNum -> TrackNum -> Meter
Tala.make Tala
Tala.adi_tala TrackNum
nadai (Duration
6forall a. Fractional a => a -> a -> a
/Duration
8) TrackNum
avartanams TrackNum
1