File: sound.rb

package info (click to toggle)
mikutter 4.1.3%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 9,260 kB
  • sloc: ruby: 20,126; sh: 183; makefile: 19
file content (23 lines) | stat: -rw-r--r-- 725 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# # -*- coding: utf-8 -*-

Plugin.create :sound do
  Sound = Struct.new(:slug, :name, :play)

  # サウンドDSL
  defdsl :defsound do |slug, name, &play|
    filter_sound_servers do |servers|
      [servers + [Sound.new(slug, name, play)]] end end

  on_play_sound do |filename|
    use_sound_server = UserConfig[:sound_server]
    Plugin.filtering(:sound_servers, []).first.each{ |value|
      if not(use_sound_server) or use_sound_server == value.slug
        value.play.call(filename)
        break end } end

  settings _("サウンド") do
    select _("サウンドの再生方法"), :sound_server do
      Plugin.filtering(:sound_servers, []).first.each{ |value|
        option value.slug, value.name } end end

end