473,231 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,231 software developers and data experts.

Stop an SDL_sound stream, or possibly kill the fork?

I am working on a GTK Midi player (timidgtk.sourceforge.net). As you can
see, it's just a timidity frontend.

With version 0.03, I'm trying to devel it to use SDL_sound to play the
midis. First off, is there a better library for this?
Right now I'm writing a test program to play on console, just so that I can
narrow problems down very quickly. I have a "sound.c" (basically playsound
from SDL_sound, but without a lot of features. I added functions to
initialize (call {SDL, Sound}_init, and the same on exit.) In "test.c" (the
frontend that I link in to sound), I init the stream, fork out, one process
waits for a key then calls the exit functions, the other plays the midi
using the sound function. When I run it, it starts playing, and when I
press a key, it goes back to command line, however, it keeps playing. Only
when I run 'killall myfork' (myfork being the name of the program) does it
stop. I'd like a quick way to stop the music, preferably something
SDL-friendly. If not, tell me how to kill it :)

tia,
poly-p man

I'll give you the source to either source if you need it.
--
There's no place like ~
Help!! I'm being Nibbled to death by cats!!!
"Cardboard is the scourge of humanity, but oh, so very tasty."
Aug 23 '06 #1
2 2122
In article <sv5Hg.9848$cQ.2837@trndny07>,
Poly-poly man <py***********@gmail.comwrote:
>I am working on a GTK Midi player (timidgtk.sourceforge.net). As you can
see, it's just a timidity frontend.
>With version 0.03, I'm trying to devel it to use SDL_sound to play the
midis. First off, is there a better library for this?
The C language doesn't know anything about sound, let alone sound
on whatever platform you are using. I suggest that you check
in a newsgroup more specific to your platform.

>In "test.c" (the
frontend that I link in to sound), I init the stream, fork out, one process
waits for a key then calls the exit functions, the other plays the midi
using the sound function. When I run it, it starts playing, and when I
press a key, it goes back to command line, however, it keeps playing. Only
when I run 'killall myfork' (myfork being the name of the program) does it
stop. I'd like a quick way to stop the music, preferably something
SDL-friendly. If not, tell me how to kill it :)
fork() is not defined by the C standard, and operates differently
in different operating systems.

In all operating systems that I have looked at, fork() itself returns
different values to the parent (the process that continues executing)
and the child (the new process), and the value returned to the parent
is an identifier of the child. If the child is the one that is set
to play the sound, then when the parent decides that enough is
enough, the parent can use a system-dependant mechanism for killing
the child. One mechanism that is common is to send the child a signal
telling it to quit; a fairly typical name for the operating system
call to do this is kill() .

comp.unix.programmer is a much better venue to discuss fork() and
kill(), if your target platform happens to be Unix compatible.
--
"law -- it's a commodity"
-- Andrew Ryan (The Globe and Mail, 2005/11/26)
Aug 23 '06 #2
Walter Roberson wrote:
In article <sv5Hg.9848$cQ.2837@trndny07>,
Poly-poly man <py***********@gmail.comwrote:
>>I am working on a GTK Midi player (timidgtk.sourceforge.net). As you can
see, it's just a timidity frontend.
>>With version 0.03, I'm trying to devel it to use SDL_sound to play the
midis. First off, is there a better library for this?

The C language doesn't know anything about sound, let alone sound
on whatever platform you are using. I suggest that you check
in a newsgroup more specific to your platform.

>>In "test.c" (the
frontend that I link in to sound), I init the stream, fork out, one
process waits for a key then calls the exit functions, the other plays the
midi using the sound function. When I run it, it starts playing, and when
I press a key, it goes back to command line, however, it keeps playing.
Only when I run 'killall myfork' (myfork being the name of the program)
does it stop. I'd like a quick way to stop the music, preferably something
SDL-friendly. If not, tell me how to kill it :)

fork() is not defined by the C standard, and operates differently
in different operating systems.

In all operating systems that I have looked at, fork() itself returns
different values to the parent (the process that continues executing)
and the child (the new process), and the value returned to the parent
is an identifier of the child. If the child is the one that is set
to play the sound, then when the parent decides that enough is
enough, the parent can use a system-dependant mechanism for killing
the child. One mechanism that is common is to send the child a signal
telling it to quit; a fairly typical name for the operating system
call to do this is kill() .

comp.unix.programmer is a much better venue to discuss fork() and
kill(), if your target platform happens to be Unix compatible.
I meant to say that I didn't know if this was the right ng :) I'm
programming in c under linux, with the SDL_sound library, and
c.o.l.anything hates it if you post with programming questions.

poly-p man
--
There's no place like ~
Help!! I'm being Nibbled to death by cats!!!
"Cardboard is the scourge of humanity, but oh, so very tasty."
Aug 23 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: shyren | last post by:
Hi All, I have a php program which calls a c++ program using exec. However when user presses stop button in the browser or closes it this program keeps on running on the server. How can I stop it...
1
by: stash | last post by:
When I stop all DB2 services on our Unix box - I still can see the following two DB2 processes running: root 20410 1 0 Oct 28 - 4:16 /usr/opt/db2_08_01/bin/db2fmcd db2as 21780 ...
1
by: Alexander N. Spitzer | last post by:
I am trying to write a program that will fork a process, and execute the given task... the catch is that if it runs too long, I want to clean it up. this seemed pretty straight forward with a...
4
by: kmkz | last post by:
Hi, I have a program A that forks off two other programs, B and C. I need B and C to both terminate if A is closed, but by using the subprocess.call() method this seems to not be the case; I can...
0
by: Dirk Zimmermann | last post by:
Hi, I like to do the following: Via http I get a stream of data and I like to store this data with a python program. So what I need is to start the downloading and to stop it after a given time....
4
by: Helge Jensen | last post by:
In C# 2.0 System.IO.Stream is declared as: public class Stream: ..., IDisposable { ... public void Dispose(); public void Dispose(bool); IDisposable.Dispose(); } Which must be a...
51
by: Hans | last post by:
Hi all, Is there a way that the program that created and started a thread also stops it. (My usage is a time-out). E.g. thread = threading.Thread(target=Loop.testLoop) thread.start() ...
5
by: JoeW | last post by:
Now before I go into detail I just want to say that this is purely for my own benefit and has no real world usage. I remember way back when the tool for *nix systems called forkbomb was created. I...
3
by: CMorgan | last post by:
Hi everybody, I am experiencing an annoying problem with fork() and execv(). In my program I need to launch the "pppd" from a thread, so, I create a new process with fork and then in the child...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.