internet-sampler 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 057d9cfc69ff0e8c56471323e9393c591970f618
4
- data.tar.gz: 86018e23643b20116d7b4d76de0a86578bace964
3
+ metadata.gz: dabbef663dd14d117ece8eee8cca51b3c25d41be
4
+ data.tar.gz: ba5383d40b0dca7da1270fb1e611ad45e62bd0c3
5
5
  SHA512:
6
- metadata.gz: d751c23dbb1e8f2c5255af0f1e0480cb0c1bfba4f2536a83a5cdf87b24be238d85ac2d12efebf6ad1e18fed57182ba571259806c83467160376589edf310fbbb
7
- data.tar.gz: 8721e77cd6203226eb546e14d82b7f06360e237a27e339a71ed8b487b94b143f79eed517bf864727b19a446ff78981a04fa1d4b36e996efa8accee262aef5888
6
+ metadata.gz: de894d12d4a6c0cbbb9e1ea1a46ef7bc0229ca8160e8e11aab5d5464884905463a2c56ee335268e8288155bea1f2f6b3af9a8263a8de6215d6c9566a2bdd17ed
7
+ data.tar.gz: 27d4263c458a0aea34a040aceca4b70be813003bb99717b20a62a91eb99b848497dfa3109f036f1e0224763533815c096ae55ed3d1b48308390c79c245dbeba6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- internet-sampler (0.2.1)
4
+ internet-sampler (0.2.2)
5
5
  redis
6
6
  sinatra (~> 1.4)
7
7
  sinatra-contrib (~> 1.4)
data/README.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # INTERNET SAMPLER
2
2
 
3
+ Internet Sampler is:
4
+
5
+ - A Sampler as a Service
6
+ - Realtive Collaborative Sampler Imprementation
7
+
3
8
  ## Up and running
4
9
 
5
10
  1. install ruby, bundler and redis
@@ -7,6 +12,25 @@
7
12
  1. `bundle install --path vendor/bundle`
8
13
  1. `bundle exec rackup`
9
14
 
15
+ OR
16
+
17
+ ```
18
+ $ gem install internet-sampler
19
+ $ internet-sampler -t SLUG_OF_SAMPLE:/path/to/sample.mp3 -t SLUG_FOR_ANOTHER_SMAPLE:/path/2/sound.mp3
20
+ ```
21
+
22
+ Note that path to sample is URL, not the filepath in your machine.
23
+
24
+ You know there is `--help` like this:
25
+
26
+ ```
27
+ Usage: internet-sampler [options]
28
+ -p, --port port port to listen (default is 9292)
29
+ -b, --bind host host to bind (default is localhost)
30
+ -e, --environment env environment to run (production, test or development; default is development)
31
+ -t, --track slug:url sample sound to serve (note that `url' is not path to file but URL to serve)
32
+ ```
33
+
10
34
  [see blog post about this app (in Japanese)](http://polamjag.hatenablog.jp/entry/2015/05/15/044314)
11
35
 
12
36
  ## REST API
data/app/public/main.css CHANGED
@@ -31,17 +31,19 @@ h1 {
31
31
 
32
32
  .play-container {
33
33
  display: block;
34
+ background-color: rgba(111, 133, 141, 0.84);;
35
+ border-radius: 3px;
36
+ padding-bottom: 14px;
34
37
  }
35
38
 
36
39
  .play {
37
40
  display: inline-block;
38
- width: 200px;
39
- height: 200px;
41
+ width: 150px;
42
+ height: 150px;
40
43
  cursor: pointer;
41
44
  vertical-align: top;
42
45
 
43
- margin-right: 14px;
44
- margin-bottom: 14px;
46
+ margin: 14px 0 0 14px;
45
47
  padding: 14px;
46
48
 
47
49
  text-align: center;
@@ -77,7 +79,7 @@ h1 {
77
79
  }
78
80
 
79
81
  .play .count {
80
- font-size: 3em;
82
+ font-size: 2em;
81
83
  }
82
84
 
83
85
  .checkbox-wrapper {
data/app/public/main.js CHANGED
@@ -6,6 +6,8 @@ window.onload = (function(){
6
6
 
7
7
  var ws = new WebSocket(ws_url);
8
8
 
9
+ var tracksCount = $('.play').size();
10
+
9
11
  var play = function(slug, count) {
10
12
  if (document.getElementById('checkbox-play-on-device').checked) {
11
13
  var $target = $(".play[data-track=" + slug + "] audio")[0];
@@ -46,9 +48,8 @@ window.onload = (function(){
46
48
  }
47
49
  };
48
50
 
49
- var evname = ('ontouchstart' in document) ? 'touchstart' : 'mousedown';
50
- $('.play').on(evname, function(f){
51
- var tg = f.currentTarget.getAttribute('data-track');
51
+ var playByPad = function(padNode) {
52
+ var tg = padNode.getAttribute('data-track');
52
53
  ws.send(
53
54
  JSON.stringify({
54
55
  slug: tg,
@@ -56,5 +57,16 @@ window.onload = (function(){
56
57
  })
57
58
  );
58
59
  show('Sent: ' + tg);
60
+ };
61
+
62
+ var evname = ('ontouchstart' in document) ? 'touchstart' : 'mousedown';
63
+ $('.play').on(evname, function(f){
64
+ playByPad(f.currentTarget);
59
65
  });
66
+ window.addEventListener('keydown', function(e) {
67
+ var keyCodeIndex = e.keyCode - 51;
68
+ if (keyCodeIndex < tracksCount - 1) {
69
+ playByPad($('.play').get(keyCodeIndex));
70
+ }
71
+ }, true);
60
72
  });
data/config.ru CHANGED
@@ -1,15 +1,3 @@
1
1
  require 'internet-sampler'
2
2
 
3
- InternetSampler::Application.run_with_sampler_options!(
4
- {
5
- tracks: [
6
- { slug: 'エモい', path: '/mp3/emoi.mp3' },
7
- { slug: '最高', path: '/mp3/saiko.mp3' },
8
- { slug: '銅鑼', path: '/mp3/Gong-266566.mp3' },
9
- { slug: 'Frontliner', path: '/mp3/frontliner-fsharp-kick.mp3' },
10
- ]
11
- },
12
- {}
13
- )
14
-
15
- # run InternetSampler::Application
3
+ run InternetSampler::Application
@@ -1,3 +1,3 @@
1
1
  module InternetSampler
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: internet-sampler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - polamjag
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-12-14 00:00:00.000000000 Z
11
+ date: 2015-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra