so I decided for learning purpuses, I'm not going to use the audite gem for
now and want try to use mpg123 directly (since audite uses it as well. so
far I can open a song but when i exit the program the song keeps playing
since mpg123 is still running. so first question, anyone have any ideas how
to exit mpg123 when the ruby script exits? second, I made a stop function
but that's not working either. I get a no method error, but as far as I can
tell I shouldn't (I know I'm doing something wrong though) here's the code:
def open_song
  fork do
    $SONG = %x(mpg123 -q floyd_wish.mp3)
  end
end

def kill_song
  $SONG.kill
end

menu_choice = nil
until [0].include?(menu_choice)
  menu_choice = gets.chomp.to_i
  case menu_choice
  when 1
    open_song
  when 2
    kill_song
  else
    puts "error"
  end
end


now before anyone says it, I know that's really bad code (with the global
variables and whatnot), I'm just trying to get a song to play and stop
before i beautify it lol. but I get the no method error when I select 2
(kill_song). as far as I understand when i call fork it creates a new
thread so $SONG should be a  new thread and therefore should respond to
kill right?

On Sat, Nov 19, 2016 at 3:07 PM, Micky Scandal <mickyscandal / gmail.com>
wrote:

> I'm looking through the (not very good) documentation for Audite. so far
> I'm liking what I'm seeing. it looks like this is exactly what I'm trying
> to make here (methods/classes for controlling mpg123) so at least for nowI
> think I'm close to set! thanks again guys!
>
> one last thing though, I haven't lost hope on using SDL yet though, I just
> need some better documentation, tutorials or someone willing to go through
> and explain a few things. so if ANYONE can help or knows someone who might
> be willing to I would GREATLY appreciate it! Like I've mentioned before,
> this current project is just a stepping stone to eventually creating a
> softsynth (software synthesizer), and I'm pretty sure I'm going to have to
> use SDL for that.
>
> alright, one last time... thank you everyone for all the help! hopefully
> I'll be able to report back with some real results soon! lol.
>
> On Sat, Nov 19, 2016 at 2:47 PM, Micky Scandal <mickyscandal / gmail.com>
> wrote:
>
>> Thomas, thanks for that info. I didn't realize shoes supports
>> audio/video. I thought it was just a GUI toolkit. I'll definitely be
>> looking into that and might even use it at some point, but for now I'm
>> actually specifically trying to create a command line player, but really
>> good to know, I'll definitely have uses for that. thanks again
>>
>> On Sat, Nov 19, 2016 at 2:03 PM, Micky Scandal <mickyscandal / gmail.com>
>> wrote:
>>
>>> Thank you Peter! I don't know how I missed that when I was going through
>>> rubygems.org! That looks like it could be exactly what I'm looking for
>>> I will get it installed and tested out a little bit and report back. Thanks
>>> again!
>>>
>>> On Nov 19, 2016 1:59 PM, "Peter Hickman" <peterhickman386 / googlemail.com>
>>> wrote:
>>>
>>>> It's been a while since I did any SDL but this looks like a good place
>>>> to start to play audio on linux (maybe OSX)
>>>>
>>>> https://github.com/georgi/audite
>>>>
>>>> or if you are comfortable with reading C then this example
>>>>
>>>> https://gist.github.com/cdave1/10563386
>>>>
>>>> would probably be easy to translate
>>>>
>>>> 
>>>>
>>>>
>>>> Unsubscribe: <mailto:ruby-talk-request / ruby-lang.org
>>>> ?subject=unsubscribe>
>>>> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
>>>>
>>>>
>>
>
(supressed text/html)
Unsubscribe: <mailto:ruby-talk-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>