I'm an almost complete noob when it comes to programming. I did write a few simple pascal programs about 10 years ago at school, thats about it.
What I hope to achieve is (hopefully) not that complex, but I'm not sure where to start learning. My reason for wanting to learn is this: I really love MOC (music on console) but I ended up wanting a GUI player which still worked without the mouse. Every one I tried just isnt a patch on MOC, IMO, or just has one or other feature that doesnt work without a mouse. So it occurred to me, I have the source code for all these GUI players and the source for MOC, perhaps I can "modify" MOC and create a GUI version, or alternatively write some kind of front end to MOC.
So far, I have had a go with Glade and Anjuta IDE, but my knowledge of C being almost nonexistent is making things tough. I'm probably trying to do it wrong anyway, my thought was to create a GUI in glade and make it call functions from the moc source... :?:
So I need a crash course in C programming with Glade (I think?) and I'm not sure what the best way to proceed is.
Any tips on how best to learn? I ask here because you all seem to be the most knowledgable group I can think of
I think you meant The C Programming Language. Thats the only c book. i found that things make sense when i read these kinds of books twice. First time just read through it. Second time read through it while setting in front of a computer and trying stuff out as i go along.
Nope, I meant Programming In C (Third Edition). That's the book I have and its awesome. I have not read The C Programming Language, but I have heard equally good things about it.
its the only c book ;-p
I'm not trying to discourage you, but the idea of Frankensteining all that C source into your own custom GUI music player is likely to cause nothing but hours of frustration. C is a great language for system programming, but for most application software it's far too low level and for most beginners it's far too dangerous (it lets you do bad things that can kill your app in dozens of intersting and extremely hard to debug ways).
What I would suggest is that you first off break the problem in half. Use a client/server approach. The server does all the low-level heavy lifting of decoding/decompressing the music files and sending them to your audio subsystem. Something like Music Player Daemon (MPD) is perfect for the server part and is specifically designed to be controlled by a separate client program.
Then all you have to do is write the GUI client of your dreams. For that I would recommend something like Python plus the GUI library of your choosing (Qt, GTK, wxWidgets, etc. all have nice Python bindings). Python is a far easier beginner language than C and can do much more work with much less code. You'll spend less time mucking around looking for memory leaks and invalid pointer references and more time actually making your GUI do useful work Oh, and there just happens to be a Python MPD client library so the task of communicating with the server gets even easier.
hmmm, thanks for that Kopsis. I started learning python a while back but with no real reason to use it it kinda fell by the wayside. One question though, am I going to end up with a less efficient program? the reason I ask is that I'm running it on a fairly slow machine which has a diskless root. MOC has given me the best performance of any player on it so far, eg when the playlist gets big.
One question though, am I going to end up with a less efficient program?
I can't really answer that one. I'm told that MPD handles large playlists efficiently, but I've personally never tried it on low end hardware or with really large lists. My "slow" machine is a 1.6GHz Thinkpad with 512MB RAM and my biggest playlist is only about 700 tracks.
Now, if your concern is that Python will result in a less efficient GUI than C, keep in mind that much of the work is being done in the GUI libraries (GTK+ or Qt) and not the application code. Those are the same regardless of the language used for the app. The design of the app will have a much greater impact on performance than the language. Even hand coded assembly language can't overcome the limitations of poorly designed/chosen algorithms and data structures