shinyaohtani / eudora_sound

Play that good old sound
MIT License
1 stars 0 forks source link

Play sounds on other than mac. #10

Open shinyaohtani opened 4 years ago

shinyaohtani commented 4 years ago

Current code is:

"/usr/bin/env afplay #{File.expand_path(__dir__ + '/Eudora-1.aiff &')}"

afplay is a command line tool from Apple Inc.

shinyaohtani commented 4 years ago

I thought a gem "audio-playback" is available! But I found that it was not easy to install. It depends on two libraries:

shinyaohtani commented 4 years ago

https://stackoverflow.com/a/13586108/2666657

  require 'rbconfig'

  def os
    @os ||= (
      host_os = RbConfig::CONFIG['host_os']
      case host_os
      when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
        :windows
      when /darwin|mac os/
        :macosx
      when /linux/
        :linux
      when /solaris|bsd/
        :unix
      else
        raise Error::WebDriverError, "unknown os: #{host_os.inspect}"
      end
    )
  end