Sha256: 76509e6c1e93a9a53340356e90fc2974ccc30f29d32333703196f0a57e009ee1

Contents?: true

Size: 978 Bytes

Versions: 2

Compression:

Stored size: 978 Bytes

Contents

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

module GlooLang
  module Objs
    class Play < GlooLang::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

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gloo-lang-0.9.4 lib/gloo_lang/objs/snd/play.rb
gloo-lang-0.9.3 lib/gloo_lang/objs/snd/play.rb