I am working on a GTK Midi player (timidgtk.sourc eforge.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." 2 2159
In article <sv5Hg.9848$cQ. 2837@trndny07>,
Poly-poly man <py***********@ gmail.comwrote:
>I am working on a GTK Midi player (timidgtk.sourc eforge.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.progr ammer 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)
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.sourc eforge.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.progr ammer 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." This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 according to user's
actions.
Thanks in advance.
Sal
|
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 0 Oct 28 - 0:11
/home/ovenbird02/app/db2/das/bin/db2fmd -i db2as -m
/home/ovenbird02/app/db2/das/lib/libdb2dasgcf.a
So I have entered DB2STOP and DB2ADMIN STOP - and still the above two
|
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 single executable being run
from the fork. The problem I am having now is that if I call a shell
scripts, then lets say calls "xterm &", after the timeout has occurred,
I kill the shell script, but the xterm is still running... I cannot seem
to kill...
|
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 shut down
the "black box" that is program A and B/C will still stay up.
How can I achieve the desired behavior?
Thanks,
|
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. My aproach was to use:
urllib.urlretrieve("ULR","FILENAME")
It is fine! But how to stop the retrieving? Because it is a constant
stream of data there is no natural end. So I thought I use
treading.Thread to do it:
| |
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 design-blunder, if not a 100-year sleep. It prevents
|
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() # This thread is expected to finish within a second
|
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 recently
explained it to a friend of mine and at that time decided to see if I
could replicate it in C#. I have created an application that, to me at
least, mimics what fork would/should do on *nix/bsd systems. I know
that fork spawns a new...
|
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 process I launch with
execv the pppd to connect an embedded system to internet.
The problem is that pppd fails.
I have made two test program just to discard bugs (my
applications is really big) and the result is that when
I call execv from a...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| | |