sorta-reaper 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e4708894ccc4183f9e61488260e7e9648e0d4e487914660855634b1680fffd80
4
+ data.tar.gz: a2bbbee2b163a4968e389aa78630fcbc957e364aeef8bc05b7ff2f407d01e0bf
5
+ SHA512:
6
+ metadata.gz: 93e83b9a156de700a88d82912bc23e0b52c7ee8b0cee06507f21431da4d1404326b392d7744a169622db7899e0d21c2021e2b9533cd5fe5c815d91e841e1ac22
7
+ data.tar.gz: b73b7834478da332c92e23cbbf729080f9c61a323222c86aadc44d88c20b7b235b45fe0a71aee5486c3add7b2642280451e6a7d4a47b3a25e3797135bf1aa4e8
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.6
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Layout/LineLength:
13
+ Max: 120
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.1.1
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in sorta-reaper.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "rspec", "~> 3.0"
11
+
12
+ gem "rubocop", "~> 1.21"
13
+
14
+ gem "dry-struct"
15
+ gem "dry-types"
data/Gemfile.lock ADDED
@@ -0,0 +1,81 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ sorta-reaper (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ ast (2.4.2)
10
+ concurrent-ruby (1.1.10)
11
+ diff-lcs (1.5.0)
12
+ dry-configurable (0.15.0)
13
+ concurrent-ruby (~> 1.0)
14
+ dry-core (~> 0.6)
15
+ dry-container (0.9.0)
16
+ concurrent-ruby (~> 1.0)
17
+ dry-configurable (~> 0.13, >= 0.13.0)
18
+ dry-core (0.7.1)
19
+ concurrent-ruby (~> 1.0)
20
+ dry-inflector (0.2.1)
21
+ dry-logic (1.2.0)
22
+ concurrent-ruby (~> 1.0)
23
+ dry-core (~> 0.5, >= 0.5)
24
+ dry-struct (1.4.0)
25
+ dry-core (~> 0.5, >= 0.5)
26
+ dry-types (~> 1.5)
27
+ ice_nine (~> 0.11)
28
+ dry-types (1.5.1)
29
+ concurrent-ruby (~> 1.0)
30
+ dry-container (~> 0.3)
31
+ dry-core (~> 0.5, >= 0.5)
32
+ dry-inflector (~> 0.1, >= 0.1.2)
33
+ dry-logic (~> 1.0, >= 1.0.2)
34
+ ice_nine (0.11.2)
35
+ parallel (1.22.1)
36
+ parser (3.1.2.0)
37
+ ast (~> 2.4.1)
38
+ rainbow (3.1.1)
39
+ rake (13.0.6)
40
+ regexp_parser (2.3.1)
41
+ rexml (3.2.5)
42
+ rspec (3.11.0)
43
+ rspec-core (~> 3.11.0)
44
+ rspec-expectations (~> 3.11.0)
45
+ rspec-mocks (~> 3.11.0)
46
+ rspec-core (3.11.0)
47
+ rspec-support (~> 3.11.0)
48
+ rspec-expectations (3.11.0)
49
+ diff-lcs (>= 1.2.0, < 2.0)
50
+ rspec-support (~> 3.11.0)
51
+ rspec-mocks (3.11.1)
52
+ diff-lcs (>= 1.2.0, < 2.0)
53
+ rspec-support (~> 3.11.0)
54
+ rspec-support (3.11.0)
55
+ rubocop (1.28.2)
56
+ parallel (~> 1.10)
57
+ parser (>= 3.1.0.0)
58
+ rainbow (>= 2.2.2, < 4.0)
59
+ regexp_parser (>= 1.8, < 3.0)
60
+ rexml
61
+ rubocop-ast (>= 1.17.0, < 2.0)
62
+ ruby-progressbar (~> 1.7)
63
+ unicode-display_width (>= 1.4.0, < 3.0)
64
+ rubocop-ast (1.17.0)
65
+ parser (>= 3.1.1.0)
66
+ ruby-progressbar (1.11.0)
67
+ unicode-display_width (2.1.0)
68
+
69
+ PLATFORMS
70
+ x86_64-linux
71
+
72
+ DEPENDENCIES
73
+ dry-struct
74
+ dry-types
75
+ rake (~> 13.0)
76
+ rspec (~> 3.0)
77
+ rubocop (~> 1.21)
78
+ sorta-reaper!
79
+
80
+ BUNDLED WITH
81
+ 2.3.3
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Mihail Odebe
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Sorta::Reaper
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/sorta/reaper`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'sorta-reaper'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install sorta-reaper
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/sorta-reaper.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "sorta/reaper"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../lib/sorta/reaper"
4
+
5
+ item = Sorta::Reaper::Entity::Item.new(position: 0, length: 10)
6
+ track = Sorta::Reaper::Entity::Track.new(name: "generated_track", items: [item])
7
+ project = Sorta::Reaper::Entity::Project.new(tracks: [track])
8
+
9
+ visitor = Sorta::Reaper::Render::Visitor.new
10
+ text = visitor.render(project)
11
+
12
+ File.open(File.join(__dir__, "simple.rpp"), "w") { |f| f.write(text) }
@@ -0,0 +1,18 @@
1
+ <REAPER_PROJECT 0.1 "6.53/win64" 1651778831
2
+ <TRACK {812edd73-2eeb-4906-9f4b-c46b864bf60b}
3
+ NAME "generated_track"
4
+ <ITEM
5
+ POSITION 0
6
+ LENGTH 10
7
+ IGUID "c20e55d4-8976-40ea-a90f-ace17ba4dbe3"
8
+ >
9
+ TRACKID "{812edd73-2eeb-4906-9f4b-c46b864bf60b}"
10
+ >
11
+ <NOTES 0 2
12
+ >
13
+ <RECORD_CFG
14
+ ZXZhdxgAAA==
15
+ >
16
+ <APPLYFX_CFG
17
+ >
18
+ >
@@ -0,0 +1,227 @@
1
+ <REAPER_PROJECT 0.1 "6.53/win64" 1651778831
2
+ <NOTES 0 2
3
+ >
4
+ RIPPLE 0
5
+ GROUPOVERRIDE 0 0 0
6
+ AUTOXFADE 1
7
+ ENVATTACH 0
8
+ POOLEDENVATTACH 0
9
+ MIXERUIFLAGS 11 48
10
+ PEAKGAIN 1
11
+ FEEDBACK 0
12
+ PANLAW 1
13
+ PROJOFFS 0 0 0
14
+ MAXPROJLEN 0 600
15
+ GRID 3199 8 1 8 1 0 0 0
16
+ TIMEMODE 1 5 -1 30 0 0 -1
17
+ VIDEO_CONFIG 0 0 256
18
+ PANMODE 3
19
+ CURSOR 12.5
20
+ ZOOM 100.00000000000011 894 0
21
+ VZOOMEX 6 0
22
+ USE_REC_CFG 0
23
+ RECMODE 1
24
+ SMPTESYNC 0 30 100 40 1000 300 0 0 1 0 0
25
+ LOOP 0
26
+ LOOPGRAN 0 4
27
+ RECORD_PATH "" ""
28
+ <RECORD_CFG
29
+ ZXZhdxgAAA==
30
+ >
31
+ <APPLYFX_CFG
32
+ >
33
+ RENDER_FILE ""
34
+ RENDER_PATTERN ""
35
+ RENDER_FMT 0 2 0
36
+ RENDER_1X 0
37
+ RENDER_RANGE 1 0 0 18 1000
38
+ RENDER_RESAMPLE 3 0 1
39
+ RENDER_ADDTOPROJ 0
40
+ RENDER_STEMS 0
41
+ RENDER_DITHER 0
42
+ TIMELOCKMODE 1
43
+ TEMPOENVLOCKMODE 1
44
+ ITEMMIX 0
45
+ DEFPITCHMODE 589824 0
46
+ TAKELANE 1
47
+ SAMPLERATE 44100 0 0
48
+ <RENDER_CFG
49
+ ZXZhdxgAAA==
50
+ >
51
+ LOCK 1
52
+ <METRONOME 6 2
53
+ VOL 0.25 0.125
54
+ FREQ 800 1600 1
55
+ BEATLEN 4
56
+ SAMPLES "" ""
57
+ PATTERN 2863311530 2863311529
58
+ MULT 1
59
+ >
60
+ GLOBAL_AUTO -1
61
+ TEMPO 120 4 4
62
+ PLAYRATE 1 0 0.25 4
63
+ SELECTION 4 3
64
+ SELECTION2 4 3
65
+ MASTERAUTOMODE 0
66
+ MASTERTRACKHEIGHT 0 0
67
+ MASTERPEAKCOL 16576
68
+ MASTERMUTESOLO 0
69
+ MASTERTRACKVIEW 0 0.6667 0.5 0.5 -1 -1 -1 0 0 0 -1 -1 0
70
+ MASTERHWOUT 0 0 1 0 0 0 0 -1
71
+ MASTER_NCH 2 2
72
+ MASTER_VOLUME 1 0 -1 -1 1
73
+ MASTER_PANMODE 3
74
+ MASTER_FX 1
75
+ MASTER_SEL 0
76
+
77
+ <MASTERPLAYSPEEDENV
78
+ EGUID {337A3EDE-2D65-4692-920C-8CB58FFB464B}
79
+ ACT 0 -1
80
+ VIS 0 1 1
81
+ LANEHEIGHT 0 0
82
+ ARM 0
83
+ DEFSHAPE 0 -1 -1
84
+ >
85
+ <TEMPOENVEX
86
+ EGUID {96B3C71A-036D-46F2-99E9-5EA239C3B389}
87
+ ACT 1 -1
88
+ VIS 1 0 1
89
+ LANEHEIGHT 0 0
90
+ ARM 0
91
+ DEFSHAPE 1 -1 -1
92
+ >
93
+ <PROJBAY
94
+ >
95
+ <TRACK {E582C8D9-3002-4A45-97B7-08B6347ACED3}
96
+ NAME dorojka1
97
+ PEAKCOL 16576
98
+ BEAT -1
99
+ AUTOMODE 0
100
+ VOLPAN 1 0 -1 -1 1
101
+ MUTESOLO 0 0 0
102
+ IPHASE 0
103
+ PLAYOFFS 0 1
104
+ ISBUS 0 0
105
+ BUSCOMP 0 0 0 0 0
106
+ SHOWINMIX 1 0.6667 0.5 1 0.5 -1 -1 -1
107
+ FREEMODE 0
108
+ SEL 0
109
+ REC 0 0 1 0 0 0 0
110
+ VU 2
111
+ TRACKHEIGHT 0 0 0 0 -1 0
112
+ INQ 0 0 0 0.5 100 0 0 100
113
+ NCHAN 2
114
+ FX 1
115
+ TRACKID {E582C8D9-3002-4A45-97B7-08B6347ACED3}
116
+ PERF 0
117
+ MIDIOUT -1
118
+ MAINSEND 1 0
119
+ <ITEM
120
+ POSITION 1.71929551252328
121
+ SNAPOFFS 0
122
+ LENGTH 1
123
+ LOOP 1
124
+ ALLTAKES 0
125
+ FADEIN 1 0 0 1 0 0 0
126
+ FADEOUT 1 0 0 1 0 0 0
127
+ MUTE 0 0
128
+ SEL 0
129
+ IGUID {9A50A0BD-5A41-4132-8F65-47624A4B0840}
130
+ IID 1
131
+ >
132
+ >
133
+
134
+ <TRACK {F33EE5C4-9794-44A9-A437-D9930E5D1FB0}
135
+ NAME dorojka2
136
+ PEAKCOL 16576
137
+ BEAT -1
138
+ AUTOMODE 0
139
+ VOLPAN 1 0 -1 -1 1
140
+ MUTESOLO 0 0 0
141
+ IPHASE 0
142
+ PLAYOFFS 0 1
143
+ ISBUS 0 0
144
+ BUSCOMP 0 0 0 0 0
145
+ SHOWINMIX 1 0.6667 0.5 1 0.5 -1 -1 -1
146
+ FREEMODE 0
147
+ SEL 1
148
+ REC 0 0 1 0 0 0 0
149
+ VU 2
150
+ TRACKHEIGHT 0 0 0 0 -1 0
151
+ INQ 0 0 0 0.5 100 0 0 100
152
+ NCHAN 2
153
+ FX 1
154
+ TRACKID {F33EE5C4-9794-44A9-A437-D9930E5D1FB0}
155
+ PERF 0
156
+ MIDIOUT -1
157
+ MAINSEND 1 0
158
+ <ITEM
159
+ POSITION 3
160
+ SNAPOFFS 0
161
+ LENGTH 8.5
162
+ LOOP 1
163
+ ALLTAKES 0
164
+ FADEIN 1 0 0 1 0 0 0
165
+ FADEOUT 1 0 0 1 0 0 0
166
+ MUTE 0 0
167
+ SEL 0
168
+ IGUID {7920763B-F9A4-4E42-A5A4-48BB596C96B4}
169
+ IID 2
170
+ NAME 09-220503_1522.wav
171
+ VOLPAN 1 0 1 -1
172
+ SOFFS 0
173
+ PLAYRATE 1 1 0 -1 0 0.0025
174
+ CHANMODE 0
175
+ GUID {85A6592F-2881-4A99-A935-1858EDF6E2D7}
176
+ <SOURCE WAVE
177
+ FILE "C:\Users\odebe\Documents\REAPER Media\133\09-220503_1522.wav"
178
+ >
179
+ >
180
+ <ITEM
181
+ POSITION 12.18954408580216
182
+ SNAPOFFS 0
183
+ LENGTH 4
184
+ LOOP 1
185
+ ALLTAKES 0
186
+ FADEIN 1 0 0 1 0 0 0
187
+ FADEOUT 1 0 0 1 0 0 0
188
+ MUTE 0 0
189
+ SEL 0
190
+ IGUID {6FCCF5DC-F7D6-432C-9BDD-7AB5E02A0BDF}
191
+ IID 3
192
+ NAME 09-220503_1522.wav
193
+ VOLPAN 1 0 1 -1
194
+ SOFFS 8.30954408580217
195
+ PLAYRATE 1 1 0 -1 0 0.0025
196
+ CHANMODE 0
197
+ GUID {8A02DBA1-1120-4E52-9C7F-1FCEEBAC1117}
198
+ <SOURCE WAVE
199
+ FILE "C:\Users\odebe\Documents\REAPER Media\133\09-220503_1522.wav"
200
+ >
201
+ >
202
+ <ITEM
203
+ POSITION 18
204
+ SNAPOFFS 0
205
+ LENGTH 3.82433333333333
206
+ LOOP 1
207
+ ALLTAKES 0
208
+ FADEIN 1 0 0 1 0 0 0
209
+ FADEOUT 1 0 0 1 0 0 0
210
+ MUTE 0 0
211
+ SEL 0
212
+ IGUID {D8905B04-5A57-4960-8DB5-E93A467B698F}
213
+ IID 4
214
+ NAME 09-220503_1522.wav
215
+ VOLPAN 1 0 1 -1
216
+ SOFFS 12.5
217
+ PLAYRATE 1 1 0 -1 0 0.0025
218
+ CHANMODE 0
219
+ GUID {9409FCF8-EFFF-4106-99F1-B37BEBF18C35}
220
+ <SOURCE WAVE
221
+ FILE "C:\Users\odebe\Documents\REAPER Media\133\09-220503_1522.wav"
222
+ >
223
+ >
224
+ >
225
+ <EXTENSIONS
226
+ >
227
+ >
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../types"
4
+
5
+ module Sorta
6
+ module Reaper
7
+ module Entity
8
+ class Abstract < Dry::Struct
9
+ Binary = Types::String
10
+
11
+ def visit(visitor)
12
+ visitor.send("visit_#{self.class.name.split("::").last}", self)
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "abstract"
4
+
5
+ module Sorta
6
+ module Reaper
7
+ module Entity
8
+ class ApplyfxCfg < Abstract
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "abstract"
4
+ require 'securerandom'
5
+
6
+ module Sorta
7
+ module Reaper
8
+ module Entity
9
+ class Item < Abstract
10
+ attribute :position, Types::Integer | Types::Float
11
+ attribute :length, Types::Integer | Types::Float
12
+
13
+ attribute :iguid, Types::String.constrained(uuid_v1: true).default { SecureRandom.uuid }
14
+
15
+ # <ITEM
16
+ # POSITION 1.71929551252328
17
+ # SNAPOFFS 0
18
+ # LENGTH 1
19
+ # LOOP 1
20
+ # ALLTAKES 0
21
+ # FADEIN 1 0 0 1 0 0 0
22
+ # FADEOUT 1 0 0 1 0 0 0
23
+ # MUTE 0 0
24
+ # SEL 0
25
+ # IGUID {9A50A0BD-5A41-4132-8F65-47624A4B0840}
26
+ # IID 1
27
+ # >
28
+ # >
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "abstract"
4
+
5
+ module Sorta
6
+ module Reaper
7
+ module Entity
8
+ class Notes < Abstract
9
+ # 0
10
+ attribute :unnamed_1, Types::Integer.default(0)
11
+ # 2
12
+ attribute :unnamed_2, Types::Integer.default(2)
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,132 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "abstract"
4
+
5
+ module Sorta
6
+ module Reaper
7
+ module Entity
8
+ class Project < Abstract
9
+ attribute :proj_ver, Types::Float.default(0.1)
10
+ attribute :daw_ver, Types::String.default("6.53/win64")
11
+ attribute :unnamed_1, Types::Integer.default(1651778831)
12
+
13
+ attribute? :tracks, Types::Array(Track)
14
+
15
+ # not used, but described
16
+
17
+ attribute? :notes, Notes.default { Notes.new }
18
+ attribute? :record_cfg, RecordCfg.default { RecordCfg.new }
19
+ attribute? :applyfx_crg, ApplyfxCfg.default { ApplyfxCfg.new }
20
+
21
+ attribute? :ripple, Types::Integer
22
+ attribute? :groupoverride, Types.Array(Types::Integer)
23
+ attribute? :autoxfade, Types::Integer
24
+ attribute? :envattach, Types::Integer
25
+
26
+ attribute? :pooledenvattach, Types::Integer
27
+ attribute? :mixeruiflags, Types.Array(Types::Integer)
28
+ attribute? :peakgain, Types::Integer
29
+ attribute? :feedback, Types::Integer
30
+
31
+ attribute? :panlaw, Types::Integer
32
+ attribute? :projoffs, Types.Array(Types::Integer)
33
+ attribute? :maxprojlen, Types.Array(Types::Integer)
34
+ attribute? :grid, Types.Array(Types::Integer)
35
+
36
+ attribute? :timemode, Types.Array(Types::Integer)
37
+ attribute? :video_config, Types.Array(Types::Integer)
38
+ attribute? :panmode, Types::Integer
39
+ attribute? :cursor, Types::Float
40
+
41
+ attribute? :zoom, Types.Array(Types::Float | Types::Integer)
42
+ attribute? :vzoomex, Types.Array(Types::Integer)
43
+ attribute? :use_rec_cfg, Types::Integer
44
+ attribute? :recmode, Types::Integer
45
+
46
+ attribute? :smptesync, Types.Array(Types::Integer)
47
+ attribute? :loop, Types::Integer
48
+ attribute? :loopgran, Types.Array(Types::Integer)
49
+ attribute? :record_path, Types.Array(Types::String).constrained(size: 2)
50
+
51
+ attribute? :render_file, Types::String
52
+ attribute? :render_pattern, Types::String
53
+ attribute? :render_fmt, Types.Array(Types::Integer)
54
+ attribute? :render_1x, Types::Integer
55
+ attribute? :render_range, Types.Array(Types::Integer)
56
+ attribute? :render_resample, Types.Array(Types::Integer)
57
+ attribute? :render_addtoproj, Types::Integer
58
+ attribute? :render_stems, Types::Integer
59
+ attribute? :render_dither, Types::Integer
60
+
61
+ attribute? :timelockmode, Types::Integer
62
+ attribute? :tempoenvlockmode, Types::Integer
63
+ attribute? :itemmix, Types::Integer
64
+ attribute? :defpitchmode, Types.Array(Types::Integer)
65
+ attribute? :takelane, Types::Integer
66
+ attribute? :samplerate, Types.Array(Types::Integer)
67
+ attribute? :lock, Types::Integer
68
+
69
+ attribute? :global_auto, Types::Integer
70
+ attribute? :tempo, Types.Array(Types::Integer)
71
+ attribute? :playrate, Types.Array(Types::Float)
72
+ attribute? :selection, Types.Array(Types::Integer)
73
+ attribute? :selection2, Types.Array(Types::Integer)
74
+
75
+ attribute? :masterautomode, Types::Integer
76
+ attribute? :mastertrackheight, Types.Array(Types::Integer)
77
+ attribute? :masterpeackcol, Types::Integer
78
+ attribute? :mastermutesolo, Types::Integer
79
+ attribute? :mastertrackview, Types.Array(Types::Float)
80
+ attribute? :masterhwout, Types.Array(Types::Integer)
81
+ attribute? :master_nch, Types.Array(Types::Integer)
82
+ attribute? :master_volume, Types.Array(Types::Integer)
83
+ attribute? :master_panmode, Types.Array(Types::Integer)
84
+ attribute? :master_fx, Types::Integer
85
+ attribute? :master_sel, Types::Integer
86
+
87
+ # {
88
+ # ripple: 0,
89
+ # groupoverride: [0, 0, 0],
90
+ # autoxfade: 1,
91
+ # envattach: 0,
92
+ # pooledenvattach: 0,
93
+ # mixeruiflags: [11, 48],
94
+ # peakgain: 1,
95
+ # feedback: 0,
96
+ # panlaw: 1,
97
+ # projoffs: [0, 0, 0],
98
+ # maxprojlen: [0, 600],
99
+ # grid: [3199, 8, 1, 8, 1, 0, 0, 0],
100
+ # timemode: [1, 5, -1, 30, 0, 0, -1],
101
+ # video_config: [0, 0, 256],
102
+ # panmode: 3,
103
+ # cursor: 12.5,
104
+ # zoom: [100.00000000000011, 894, 0],
105
+ # vzoomex: [6, 0],
106
+ # use_rec_cfg: 0,
107
+ # recmode: 1,
108
+ # smptesync: [0, 30, 100, 40, 1000, 300, 0, 0, 1, 0, 0],
109
+ # loop: 0,
110
+ # loopgran: [0, 4],
111
+ # record_path: ["", ""],
112
+ # render_file: "",
113
+ # render_pattern: "",
114
+ # render_fmt: [0, 2, 0],
115
+ # render_1x: 0,
116
+ # render_range: [1, 0, 0, 18, 1000],
117
+ # render_resample: [3, 0, 1],
118
+ # render_addtoproj: 0,
119
+ # render_stems: 0,
120
+ # render_dither: 0,
121
+ # timelockmode: 1,
122
+ # tempoenvlockmode: 1,
123
+ # itemmix: 0,
124
+ # defpitchmode: [589824, 0],
125
+ # takelane: 1,
126
+ # samplerate: [44100, 0, 0],
127
+ # lock: 1
128
+ # }
129
+ end
130
+ end
131
+ end
132
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "abstract"
4
+
5
+ module Sorta
6
+ module Reaper
7
+ module Entity
8
+ class RecordCfg < Abstract
9
+ attribute :unnamed_1, Binary.default("ZXZhdxgAAA==")
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "abstract"
4
+ require 'securerandom'
5
+
6
+ module Sorta
7
+ module Reaper
8
+ module Entity
9
+ class Track < Abstract
10
+ attribute :name, Types::String.optional
11
+ attribute :trackid, Types::String.constrained(uuid_v1: true).default { SecureRandom.uuid }
12
+
13
+ attribute? :items, Types::Array(Item)
14
+
15
+ # <TRACK {E582C8D9-3002-4A45-97B7-08B6347ACED3}
16
+ # NAME dorojka1
17
+ # PEAKCOL 16576
18
+ # BEAT -1
19
+ # AUTOMODE 0
20
+ # VOLPAN 1 0 -1 -1 1
21
+ # MUTESOLO 0 0 0
22
+ # IPHASE 0
23
+ # PLAYOFFS 0 1
24
+ # ISBUS 0 0
25
+ # BUSCOMP 0 0 0 0 0
26
+ # SHOWINMIX 1 0.6667 0.5 1 0.5 -1 -1 -1
27
+ # FREEMODE 0
28
+ # SEL 0
29
+ # REC 0 0 1 0 0 0 0
30
+ # VU 2
31
+ # TRACKHEIGHT 0 0 0 0 -1 0
32
+ # INQ 0 0 0 0.5 100 0 0 100
33
+ # NCHAN 2
34
+ # FX 1
35
+ # TRACKID {E582C8D9-3002-4A45-97B7-08B6347ACED3}
36
+ # PERF 0
37
+ # MIDIOUT -1
38
+ # MAINSEND 1 0
39
+ #
40
+ # <ITEM
41
+ # POSITION 1.71929551252328
42
+ # SNAPOFFS 0
43
+ # LENGTH 1
44
+ # LOOP 1
45
+ # ALLTAKES 0
46
+ # FADEIN 1 0 0 1 0 0 0
47
+ # FADEOUT 1 0 0 1 0 0 0
48
+ # MUTE 0 0
49
+ # SEL 0
50
+ # IGUID {9A50A0BD-5A41-4132-8F65-47624A4B0840}
51
+ # IID 1
52
+ # >
53
+ # >
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,20 @@
1
+ module Sorta
2
+ module Reaper
3
+ module Refinements
4
+ module Except
5
+ refine Array do
6
+ # File activesupport/lib/active_support/core_ext/hash/except.rb, line 20
7
+ def except!(*keys)
8
+ keys.each { |key| delete(key) }
9
+ self
10
+ end
11
+
12
+ # File activesupport/lib/active_support/core_ext/hash/except.rb, line 12
13
+ def except(*keys)
14
+ dup.except!(*keys)
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,113 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../entity/abstract"
4
+ require_relative "../refinements"
5
+
6
+ module Sorta
7
+ module Reaper
8
+ module Render
9
+ class Error < Reaper::Error
10
+ end
11
+
12
+ class Visitor
13
+ using Refinements::Except
14
+
15
+ module Errors
16
+ class NotEntity < Render::Error
17
+ end
18
+ end
19
+
20
+ def render(entity)
21
+ raise Errors::NotEntity unless entity.is_a? Entity::Abstract
22
+
23
+ entity.visit(self)
24
+ end
25
+
26
+ def visit_Project(obj)
27
+ strings = []
28
+ strings << "<REAPER_PROJECT #{obj.proj_ver} \"#{obj.daw_ver}\" #{obj.unnamed_1}"
29
+
30
+ attrs = obj.attributes.except(:proj_ver, :daw_ver, :unnamed_1)
31
+ strings << process_attributes(attrs)
32
+
33
+ strings << ">"
34
+ strings.join("\n")
35
+ end
36
+
37
+ def visit_Track(obj)
38
+ strings = []
39
+ strings << "<TRACK {#{obj.trackid}}"
40
+
41
+ attrs = obj.attributes.dup.tap do |h|
42
+ h[:trackid] = "{#{obj.trackid}}"
43
+ end
44
+
45
+ strings << process_attributes(attrs)
46
+
47
+ strings << ">"
48
+ strings.join("\n")
49
+ end
50
+
51
+ def visit_Item(obj)
52
+ strings = []
53
+ strings << "<ITEM "
54
+
55
+ strings << process_attributes(obj.attributes)
56
+
57
+ strings << ">"
58
+ strings.join("\n")
59
+ end
60
+
61
+ def visit_Notes(obj)
62
+ "<NOTES #{obj.unnamed_1} #{obj.unnamed_2}\n>"
63
+ end
64
+
65
+ def visit_RecordCfg(obj)
66
+ "<RECORD_CFG \n#{obj.unnamed_1}\n> "
67
+ end
68
+
69
+ def visit_ApplyfxCfg(_obj)
70
+ "<APPLYFX_CFG\n>"
71
+ end
72
+
73
+ private
74
+
75
+ # Kill me [1]
76
+ def process_attributes(attrs)
77
+ strings = attrs.each_with_object([]) do |(key, value), acc|
78
+ tmp =
79
+ case value
80
+ in Entity::Abstract
81
+ value.visit(self)
82
+ in [Entity::Abstract, *]
83
+ value.map { |v| v.visit(self) }.join("\n")
84
+ else
85
+ "#{key.upcase} #{format_value(value)}"
86
+ end
87
+
88
+ acc << tmp
89
+ end
90
+
91
+ strings.join("\n")
92
+ end
93
+
94
+ # Kill me [2]
95
+ def format_value(val)
96
+ case val
97
+ when Integer, Float
98
+ val
99
+ when String
100
+ "\"#{val}\""
101
+ when Array
102
+ case val
103
+ in [Entity::Abstract, *]
104
+ value.map { |v| v.visit(self) }.join("\n")
105
+ else
106
+ val.join(" ")
107
+ end
108
+ end
109
+ end
110
+ end
111
+ end
112
+ end
113
+ end
@@ -0,0 +1,8 @@
1
+ module Sorta
2
+ module Reaper
3
+ module Types
4
+ include Dry.Types()
5
+ end
6
+ end
7
+ end
8
+
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sorta
4
+ module Reaper
5
+ VERSION = "0.1.0"
6
+ end
7
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'dry-types'
4
+ require 'dry-struct'
5
+
6
+ module Sorta
7
+ module Reaper
8
+ class Error < StandardError; end
9
+ end
10
+ end
11
+
12
+ require_relative "reaper/version"
13
+
14
+ require_relative "reaper/entity/record_cfg"
15
+ require_relative "reaper/entity/applyfx_cfg"
16
+ require_relative "reaper/entity/notes"
17
+ require_relative "reaper/entity/item"
18
+ require_relative "reaper/entity/track"
19
+ require_relative "reaper/entity/project"
20
+
21
+ require_relative 'reaper/render/visitor'
@@ -0,0 +1,6 @@
1
+ module Sorta
2
+ module Reaper
3
+ VERSION: String
4
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
5
+ end
6
+ end
metadata ADDED
@@ -0,0 +1,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sorta-reaper
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Mihail Odebe
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-05-09 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Allow to parse and generate .rpp files from Reaper DAW
14
+ email:
15
+ - derpiranha@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".rspec"
21
+ - ".rubocop.yml"
22
+ - ".ruby-version"
23
+ - Gemfile
24
+ - Gemfile.lock
25
+ - LICENSE.txt
26
+ - README.md
27
+ - Rakefile
28
+ - bin/console
29
+ - bin/setup
30
+ - examples/simple.rb
31
+ - examples/simple.rpp
32
+ - examples/test2.rpp
33
+ - lib/sorta/reaper.rb
34
+ - lib/sorta/reaper/entity/abstract.rb
35
+ - lib/sorta/reaper/entity/applyfx_cfg.rb
36
+ - lib/sorta/reaper/entity/item.rb
37
+ - lib/sorta/reaper/entity/notes.rb
38
+ - lib/sorta/reaper/entity/project.rb
39
+ - lib/sorta/reaper/entity/record_cfg.rb
40
+ - lib/sorta/reaper/entity/track.rb
41
+ - lib/sorta/reaper/refinements.rb
42
+ - lib/sorta/reaper/render/visitor.rb
43
+ - lib/sorta/reaper/types.rb
44
+ - lib/sorta/reaper/version.rb
45
+ - sig/sorta/reaper.rbs
46
+ homepage: https://github.com/sorta-rb/sorta-reaper
47
+ licenses:
48
+ - MIT
49
+ metadata:
50
+ homepage_uri: https://github.com/sorta-rb/sorta-reaper
51
+ source_code_uri: https://github.com/sorta-rb/sorta-reaper
52
+ changelog_uri: https://github.com/sorta-rb/sorta-reaper/commits/main
53
+ post_install_message:
54
+ rdoc_options: []
55
+ require_paths:
56
+ - lib
57
+ required_ruby_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 2.7.1
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ requirements: []
68
+ rubygems_version: 3.3.7
69
+ signing_key:
70
+ specification_version: 4
71
+ summary: Repaer DAW project file parser/generator
72
+ test_files: []