I can so far find Nothing whatsoever that will allow me to easily play a wav sound in a console app in linux. It's like I have to create my own audio player to play a half second clip of a cat meowing. Does anyone have any experience? I'd really appreciate it.
I already utilized the forum search feature to find that article, that's why i posted a new topic. That topic deals with windows programming. I am talking about linux programming.
I dont think you can use the "System" command in linux. I'm pretty sure its a windows only command.
But what i think i would do is just piggy back off of another program (linux does this all the time) and is what i think vegaseat is refering to. I'd install a program like mpg123 (basic mp3 player) and "exec" the program with the "-q" (quiet) option. I know its not a wav file but mp3's are just better anyway.
>I dont think you can use the "System" command in linux.
I don't know about the "System" command, but the system function is standard C, declared in stdlib.h.
That is exactly what I ended up doing. The system call does work in linux. I don't see why it wouldn't as I think it is standard ANSI. However, on my system at least, the system function is in iostream. Maybe it is in both? Anyway the program is call esdplay. so a call to it would look like system("esdplay cat.wav");
While this works and I eventually resorted to it. I think it's cheating. For now, I'm going to leave it as is but in the future, I will use OpenAL which if you didn't figure it out from the name is the audio equivalent to openGL. Thanks for your suggestions everyone.
I stand corrected on the "system" function in C. Yeah i just looked it up to make sure. I just realized why i thought that. Not a C or C++ programmer anymore so its been a while since i've written much in it.
As far as feeling like its cheating, I understand why you would feel that way but keep in mind, at least from a linux stand point, using other programs to accomplish a small part of your program is a good idea. It helps keep programs smaller and creation of programs faster. Plus its nice not having to recreate the wheel everytime you need one.
I understand how it is probably better to just use the system command instead of doing it all myself. I'm not sure why it bothers me so much but it really does. It seems like a failure. The system call also makes it unportable by default.
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.