Data.hs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. {-# LANGUAGE TemplateHaskell #-}
  2. module Hypsibius.Data where
  3. import Data.Sequence (Seq)
  4. import qualified Data.Sequence as S
  5. import Data.Text (Text)
  6. import Data.Word (Word8)
  7. import Lens.Family2.TH
  8. data Oscillator
  9. = OscSine
  10. | OscSquare
  11. deriving (Eq, Show)
  12. data Instrument = Instrument
  13. { _instrSource :: Oscillator
  14. } deriving (Eq, Show)
  15. $(makeLenses ''Instrument)
  16. newtype InstrRef = InstrRef { _fromInstrRef :: Int }
  17. deriving (Eq, Show)
  18. $(makeLenses ''InstrRef)
  19. data Note = Note
  20. { _noteCents :: Double
  21. , _noteAppearance :: Text
  22. } deriving (Eq, Show)
  23. $(makeLenses ''Note)
  24. newtype NoteRef = NoteRef { _fromNoteRef :: Int }
  25. deriving (Eq, Show)
  26. $(makeLenses ''NoteRef)
  27. data Scale = Scale
  28. { _scaleName :: Text
  29. , _scaleTotalCents :: Double
  30. , _scaleNotes :: Seq Note
  31. } deriving (Eq, Show)
  32. $(makeLenses ''Scale)
  33. data Event = Event
  34. deriving (Eq, Show)
  35. data Track = Track
  36. {
  37. } deriving (Eq, Show)
  38. data Beats
  39. = BeatsSimple Word8
  40. | BeatsAdditive [Word8]
  41. | BeatsFractional Word8 Word8
  42. deriving (Eq, Show)
  43. $(makeTraversals ''Beats)
  44. data Signature = Signature
  45. { _sigPerBar :: Beats
  46. , _sigBeatUnit :: Word8
  47. } deriving (Eq, Show)
  48. $(makeLenses ''Signature)
  49. data Song = Song
  50. { _songScale :: Scale
  51. , _songTracks :: Seq Track
  52. } deriving (Eq, Show)
  53. $(makeLenses ''Song)