Jelajahi Sumber

crude track naming

woelper 4 tahun lalu
induk
melakukan
1381cb2793
6 mengubah file dengan 249 tambahan dan 64 penghapusan
  1. 17 17
      Cargo.lock
  2. 39 39
      patterns/cold sweat.pat
  3. 159 0
      patterns/when the levee breaks.pat
  4. 5 5
      sampler.ini
  5. 26 0
      src/base.rs
  6. 3 3
      src/main.rs

+ 17 - 17
Cargo.lock

@@ -79,9 +79,9 @@ checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"
 
 [[package]]
 name = "backtrace"
-version = "0.3.44"
+version = "0.3.45"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e4036b9bf40f3cf16aba72a3d65e8a520fc4bafcdc7079aea8f848c58c5b5536"
+checksum = "ad235dabf00f36301792cfe82499880ba54c6486be094d1047b02bacb67c14e8"
 dependencies = [
  "backtrace-sys",
  "cfg-if",
@@ -91,9 +91,9 @@ dependencies = [
 
 [[package]]
 name = "backtrace-sys"
-version = "0.1.32"
+version = "0.1.33"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5d6575f128516de27e3ce99689419835fce9643a9b215a14d2b5b685be018491"
+checksum = "e17b52e737c40a7d75abca20b29a19a0eb7ba9fc72c5a72dd282a0a3c2c0dc35"
 dependencies = [
  "cc",
  "libc",
@@ -112,7 +112,7 @@ dependencies = [
  "lazy_static",
  "peeking_take_while",
  "proc-macro2 1.0.9",
- "quote 1.0.2",
+ "quote 1.0.3",
  "regex",
  "rustc-hash",
  "shlex",
@@ -395,9 +395,9 @@ dependencies = [
 
 [[package]]
 name = "failure"
-version = "0.1.6"
+version = "0.1.7"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f8273f13c977665c5db7eb2b99ae520952fe5ac831ae4cd09d80c4c7042b5ed9"
+checksum = "b8529c2421efa3066a5cbd8063d2244603824daccb6936b079010bb2aa89464b"
 dependencies = [
  "backtrace",
  "failure_derive",
@@ -405,12 +405,12 @@ dependencies = [
 
 [[package]]
 name = "failure_derive"
-version = "0.1.6"
+version = "0.1.7"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0bc225b78e0391e4b8683440bf2e63c2deeeb2ce5189eab46e2b68c6d3725d08"
+checksum = "030a733c8287d6213886dd487564ff5c8f6aae10278b3588ed177f9d18f8d231"
 dependencies = [
  "proc-macro2 1.0.9",
- "quote 1.0.2",
+ "quote 1.0.3",
  "syn",
  "synstructure",
 ]
@@ -1085,9 +1085,9 @@ dependencies = [
 
 [[package]]
 name = "quote"
-version = "1.0.2"
+version = "1.0.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
+checksum = "2bdc6c187c65bca4260c9011c9e3132efe4909da44726bad24cf7572ae338d7f"
 dependencies = [
  "proc-macro2 1.0.9",
 ]
@@ -1145,9 +1145,9 @@ dependencies = [
 
 [[package]]
 name = "regex-syntax"
-version = "0.6.15"
+version = "0.6.16"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7246cd0a0a6ec2239a5405b2b16e3f404fa0dcc6d28f5f5b877bf80e33e0f294"
+checksum = "1132f845907680735a84409c3bebc64d1364a5683ffbce899550cd09d5eaefc1"
 
 [[package]]
 name = "rodio"
@@ -1281,7 +1281,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "128f9e303a5a29922045a830221b8f78ec74a5f544944f3d5984f8ec3895ef64"
 dependencies = [
  "proc-macro2 1.0.9",
- "quote 1.0.2",
+ "quote 1.0.3",
  "syn",
 ]
 
@@ -1377,7 +1377,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "123bd9499cfb380418d509322d7a6d52e5315f064fe4b3ad18a53d6b92c07859"
 dependencies = [
  "proc-macro2 1.0.9",
- "quote 1.0.2",
+ "quote 1.0.3",
  "unicode-xid 0.2.0",
 ]
 
@@ -1388,7 +1388,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545"
 dependencies = [
  "proc-macro2 1.0.9",
- "quote 1.0.2",
+ "quote 1.0.3",
  "syn",
  "unicode-xid 0.2.0",
 ]

+ 39 - 39
patterns/cold sweat.pat

@@ -1,13 +1,13 @@
 {
   "name": "cold sweat",
   "repeat": 1,
-  "bpm": 416,
+  "bpm": 384,
   "xsize": 16,
   "ysize": 3,
   "sounds": {
-    "8,2": {
-      "name": "ride_bell2.wav",
-      "location": "media\\cc0\\ride_bell2.wav",
+    "7,1": {
+      "name": "snare_jungle.wav",
+      "location": "media\\cc0\\snare_jungle.wav",
       "volume": 1.0,
       "roll": 0,
       "rollrate": 0,
@@ -15,9 +15,9 @@
       "active": false,
       "speed": 1.0
     },
-    "14,2": {
-      "name": "ride_bell2.wav",
-      "location": "media\\cc0\\ride_bell2.wav",
+    "12,1": {
+      "name": "snare_jungle.wav",
+      "location": "media\\cc0\\snare_jungle.wav",
       "volume": 1.0,
       "roll": 0,
       "rollrate": 0,
@@ -25,9 +25,9 @@
       "active": false,
       "speed": 1.0
     },
-    "0,2": {
-      "name": "ride_bell2.wav",
-      "location": "media\\cc0\\ride_bell2.wav",
+    "10,0": {
+      "name": "kick_rough.wav",
+      "location": "media\\cc0\\kick_rough.wav",
       "volume": 1.0,
       "roll": 0,
       "rollrate": 0,
@@ -35,9 +35,9 @@
       "active": false,
       "speed": 1.0
     },
-    "15,1": {
-      "name": "snare_jungle.wav",
-      "location": "media\\cc0\\snare_jungle.wav",
+    "8,0": {
+      "name": "kick_rough.wav",
+      "location": "media\\cc0\\kick_rough.wav",
       "volume": 1.0,
       "roll": 0,
       "rollrate": 0,
@@ -47,7 +47,7 @@
     },
     "4,2": {
       "name": "ride_bell2.wav",
-      "location": "media\\cc0\\ride_bell2.wav",
+      "location": "media\\cc0\\ride_bell.wav",
       "volume": 1.0,
       "roll": 0,
       "rollrate": 0,
@@ -55,7 +55,7 @@
       "active": false,
       "speed": 1.0
     },
-    "12,1": {
+    "15,1": {
       "name": "snare_jungle.wav",
       "location": "media\\cc0\\snare_jungle.wav",
       "volume": 1.0,
@@ -65,9 +65,9 @@
       "active": false,
       "speed": 1.0
     },
-    "10,2": {
+    "0,2": {
       "name": "ride_bell2.wav",
-      "location": "media\\cc0\\ride_bell2.wav",
+      "location": "media\\cc0\\ride_bell.wav",
       "volume": 1.0,
       "roll": 0,
       "rollrate": 0,
@@ -75,19 +75,9 @@
       "active": false,
       "speed": 1.0
     },
-    "6,2": {
+    "12,2": {
       "name": "ride_bell2.wav",
-      "location": "media\\cc0\\ride_bell2.wav",
-      "volume": 1.0,
-      "roll": 0,
-      "rollrate": 0,
-      "trim": 0.0,
-      "active": false,
-      "speed": 1.0
-    },
-    "10,0": {
-      "name": "kick_rough.wav",
-      "location": "media\\cc0\\kick_rough.wav",
+      "location": "media\\cc0\\ride_bell.wav",
       "volume": 1.0,
       "roll": 0,
       "rollrate": 0,
@@ -97,7 +87,7 @@
     },
     "2,2": {
       "name": "ride_bell2.wav",
-      "location": "media\\cc0\\ride_bell2.wav",
+      "location": "media\\cc0\\ride_bell.wav",
       "volume": 1.0,
       "roll": 0,
       "rollrate": 0,
@@ -115,9 +105,9 @@
       "active": false,
       "speed": 1.0
     },
-    "12,2": {
+    "6,2": {
       "name": "ride_bell2.wav",
-      "location": "media\\cc0\\ride_bell2.wav",
+      "location": "media\\cc0\\ride_bell.wav",
       "volume": 1.0,
       "roll": 0,
       "rollrate": 0,
@@ -125,7 +115,7 @@
       "active": false,
       "speed": 1.0
     },
-    "7,1": {
+    "4,1": {
       "name": "snare_jungle.wav",
       "location": "media\\cc0\\snare_jungle.wav",
       "volume": 1.0,
@@ -135,9 +125,9 @@
       "active": false,
       "speed": 1.0
     },
-    "8,0": {
-      "name": "kick_rough.wav",
-      "location": "media\\cc0\\kick_rough.wav",
+    "8,2": {
+      "name": "ride_bell2.wav",
+      "location": "media\\cc0\\ride_bell.wav",
       "volume": 1.0,
       "roll": 0,
       "rollrate": 0,
@@ -145,9 +135,19 @@
       "active": false,
       "speed": 1.0
     },
-    "4,1": {
-      "name": "snare_jungle.wav",
-      "location": "media\\cc0\\snare_jungle.wav",
+    "14,2": {
+      "name": "ride_bell2.wav",
+      "location": "media\\cc0\\ride_bell.wav",
+      "volume": 1.0,
+      "roll": 0,
+      "rollrate": 0,
+      "trim": 0.0,
+      "active": false,
+      "speed": 1.0
+    },
+    "10,2": {
+      "name": "ride_bell2.wav",
+      "location": "media\\cc0\\ride_bell.wav",
       "volume": 1.0,
       "roll": 0,
       "rollrate": 0,

+ 159 - 0
patterns/when the levee breaks.pat

@@ -0,0 +1,159 @@
+{
+  "name": "when the levee breaks",
+  "repeat": 1,
+  "bpm": 396,
+  "xsize": 16,
+  "ysize": 3,
+  "sounds": {
+    "0,0": {
+      "name": "kick_rough.wav",
+      "location": "media\\cc0\\kick_rough.wav",
+      "volume": 1.0,
+      "roll": 0,
+      "rollrate": 0,
+      "trim": 0.0,
+      "active": false,
+      "speed": 1.0
+    },
+    "8,2": {
+      "name": "hihiat_real.wav",
+      "location": "media\\cc0\\hihiat_real.wav",
+      "volume": 1.0,
+      "roll": 0,
+      "rollrate": 0,
+      "trim": 0.0,
+      "active": false,
+      "speed": 1.0
+    },
+    "2,2": {
+      "name": "hihiat_real.wav",
+      "location": "media\\cc0\\hihiat_real.wav",
+      "volume": 1.0,
+      "roll": 0,
+      "rollrate": 0,
+      "trim": 0.0,
+      "active": false,
+      "speed": 1.0
+    },
+    "11,0": {
+      "name": "kick_rough.wav",
+      "location": "media\\cc0\\kick_rough.wav",
+      "volume": 1.0,
+      "roll": 0,
+      "rollrate": 0,
+      "trim": 0.0,
+      "active": false,
+      "speed": 1.0
+    },
+    "10,2": {
+      "name": "hihiat_real.wav",
+      "location": "media\\cc0\\hihiat_real.wav",
+      "volume": 1.0,
+      "roll": 0,
+      "rollrate": 0,
+      "trim": 0.0,
+      "active": false,
+      "speed": 1.0
+    },
+    "0,2": {
+      "name": "hihiat_real.wav",
+      "location": "media\\cc0\\hihiat_real.wav",
+      "volume": 1.0,
+      "roll": 0,
+      "rollrate": 0,
+      "trim": 0.0,
+      "active": false,
+      "speed": 1.0
+    },
+    "7,0": {
+      "name": "kick_rough.wav",
+      "location": "media\\cc0\\kick_rough.wav",
+      "volume": 1.0,
+      "roll": 0,
+      "rollrate": 0,
+      "trim": 0.0,
+      "active": false,
+      "speed": 1.0
+    },
+    "4,1": {
+      "name": "snare_deep.wav",
+      "location": "media\\cc0\\snare_deep.wav",
+      "volume": 1.0,
+      "roll": 0,
+      "rollrate": 0,
+      "trim": 0.0,
+      "active": false,
+      "speed": 1.0
+    },
+    "1,0": {
+      "name": "kick_rough.wav",
+      "location": "media\\cc0\\kick_rough.wav",
+      "volume": 1.0,
+      "roll": 0,
+      "rollrate": 0,
+      "trim": 0.0,
+      "active": false,
+      "speed": 1.0
+    },
+    "12,2": {
+      "name": "hihiat_real.wav",
+      "location": "media\\cc0\\hihiat_real.wav",
+      "volume": 1.0,
+      "roll": 0,
+      "rollrate": 0,
+      "trim": 0.0,
+      "active": false,
+      "speed": 1.0
+    },
+    "6,2": {
+      "name": "hihiat_real.wav",
+      "location": "media\\cc0\\hihiat_real.wav",
+      "volume": 1.0,
+      "roll": 0,
+      "rollrate": 0,
+      "trim": 0.0,
+      "active": false,
+      "speed": 1.0
+    },
+    "4,2": {
+      "name": "hihiat_real.wav",
+      "location": "media\\cc0\\hihiat_real.wav",
+      "volume": 1.0,
+      "roll": 0,
+      "rollrate": 0,
+      "trim": 0.0,
+      "active": false,
+      "speed": 1.0
+    },
+    "10,0": {
+      "name": "kick_rough.wav",
+      "location": "media\\cc0\\kick_rough.wav",
+      "volume": 1.0,
+      "roll": 0,
+      "rollrate": 0,
+      "trim": 0.0,
+      "active": false,
+      "speed": 1.0
+    },
+    "14,2": {
+      "name": "hihiat_real.wav",
+      "location": "media\\cc0\\hihiat_real.wav",
+      "volume": 1.0,
+      "roll": 0,
+      "rollrate": 0,
+      "trim": 0.0,
+      "active": false,
+      "speed": 1.0
+    },
+    "12,1": {
+      "name": "snare_deep.wav",
+      "location": "media\\cc0\\snare_deep.wav",
+      "volume": 1.0,
+      "roll": 0,
+      "rollrate": 0,
+      "trim": 0.0,
+      "active": false,
+      "speed": 1.0
+    }
+  }
+}

+ 5 - 5
sampler.ini

@@ -34,17 +34,17 @@ Size=290,149
 Collapsed=0
 
 [Window][tracks]
-Pos=70,525
+Pos=50,438
 Size=300,100
-Collapsed=1
+Collapsed=0
 
 [Window][pattern]
-Pos=8,157
+Pos=30,177
 Size=684,283
 Collapsed=0
 
 [Window][patterns]
-Pos=437,13
-Size=324,186
+Pos=467,10
+Size=324,183
 Collapsed=0
 

+ 26 - 0
src/base.rs

@@ -195,7 +195,33 @@ impl Pattern {
             }
         
         }
+    }
+
+    pub fn name_from_row(&self, row: usize) -> String {
+        let mut names: HashMap<String, usize> = HashMap::new();
 
+        for x in 0..self.xsize {
+            if let Some(snd) = self.sounds.get(&(x, row)) {
+                match names.get_mut(&snd.name) {
+                    Some(v) => *v += 1,
+                    None => {names.insert(snd.name.clone(), 1);},
+                }
+        }
+        
+        }
+        let mut count_vec: Vec<_> = names.iter().collect();
+        count_vec.sort_by(|a, b| b.1.cmp(a.1));
+        // dbg!(&count_vec);
+        let mut s = count_vec.get(0).unwrap_or(&(&"              ".to_string(), &3)).0.clone()
+        .replace("a", "")
+        .replace("e", "")
+        .replace("i", "")
+        .replace("a", "")
+        .replace(".wav", "")
+        .replace(".aif", "")
+        .replace("u", "");
+        s.truncate(8);
+        s
     }
 
     pub fn clear_sounds(&mut self, row: usize) {

+ 3 - 3
src/main.rs

@@ -182,7 +182,7 @@ fn main() {
                 
                 ui.drag_int(im_str!("bpm"), &mut active_pattern.bpm).build();
 
-                ui.text(im_str!("loc   "));
+                ui.text(im_str!("loc     "));
                 for x in 0..active_pattern.xsize {
                     ui.same_line(0.0);
                     ui.button(&im_str!("{}", x+1), [button_size, button_size]);
@@ -190,7 +190,7 @@ fn main() {
                 
 
                 for y in 0..active_pattern.ysize {
-                    ui.text(im_str!("row {:02}", y));
+                    ui.text(im_str!("{}", active_pattern.name_from_row(y)));
                     for x in 0..active_pattern.xsize {
                         let label = match &active_pattern.sounds.get(&(x,y)) {
                             Some(_s) => "X",
@@ -203,7 +203,7 @@ fn main() {
                             pattern_row = y;
                             match &active_sound {
                                 Some(snd) => {active_pattern.sounds.insert((x,y),  snd.clone());},
-                                None => ()
+                                None => {active_pattern.sounds.remove(&(x,y));}
                             }
                         }