Sha256: b1386a7b3d735bb7ecd6423db8d6baf65964cd753a18316e7a8ae1371b54bdf2

Contents?: true

Size: 1.53 KB

Versions: 8

Compression:

Stored size: 1.53 KB

Contents

# Author::    Eric Crane  (mailto:eric.crane@mac.com)
# Copyright:: Copyright (c) 2020 Eric Crane.  All rights reserved.
#
# Play an audio file (MP3).
#

module Gloo
  module Objs
    class Play < Gloo::Core::Obj

      KEYWORD = 'play'.freeze
      KEYWORD_SHORT = 'play'.freeze

      #
      # The name of the object type.
      #
      def self.typename
        return KEYWORD
      end

      #
      # The short name of the object type.
      #
      def self.short_typename
        return KEYWORD_SHORT
      end

      # ---------------------------------------------------------------------
      #    Messages
      # ---------------------------------------------------------------------

      #
      # Get a list of message names that this object receives.
      #
      def self.messages
        return super + [ 'run' ]
      end

      # Play the audio file.
      def msg_run
        system "afplay #{value}"
      end

      # ---------------------------------------------------------------------
      #    Help
      # ---------------------------------------------------------------------

      #
      # Get help for this object type.
      #
      def self.help
        return <<~TEXT
          PLAY OBJECT TYPE
            NAME: play
            SHORTCUT: play

          DESCRIPTION
            Play an audio file, an MP3 for example.
            The value of the play object is the path to the audio file.

          CHILDREN
            None.

          MESSAGES
            run - Play the audio file.
        TEXT
      end

    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
gloo-0.6.1 lib/gloo/objs/snd/play.rb
gloo-0.6.0 lib/gloo/objs/snd/play.rb
gloo-0.5.4 lib/gloo/objs/snd/play.rb
gloo-0.5.3 lib/gloo/objs/snd/play.rb
gloo-0.5.2 lib/gloo/objs/snd/play.rb
gloo-0.5.1 lib/gloo/objs/snd/play.rb
gloo-0.5.0 lib/gloo/objs/snd/play.rb
gloo-0.4.0 lib/gloo/objs/snd/play.rb