How to play audio in own feature plugin

everything about the current big update and the latest stable branch

Moderator: Moderator

User avatar
marleaux
Posts: 8
Joined: Sat Oct 31, 2009 8:17 am

How to play audio in own feature plugin

Postby marleaux » Sat Oct 31, 2009 9:17 am

Hello!

I'm new to mms (and linux and eclipse and...). I use mms 1.1.1 and wrote my own feature plugin in c++, because I have no idea about python and I need my plugin to run all the time (like weather) to update some information on external events.

Now I want to play the music files of a special folder, using the play_now action.

Unfortunately I was not able to find out how this works. I tried to use Audio:

Code: Select all

Audio *audio = get_class<Audio> (dgettext("mms-audio", "Audio"));


But I'm not able to start playing my files.

Do you have a hint how to "fire" the play_now action on a given folder from my own feature plugin?

Best regards,
marleaux

User avatar
marleaux
Posts: 8
Joined: Sat Oct 31, 2009 8:17 am

Re: How to play audio in own feature plugin

Postby marleaux » Mon Nov 02, 2009 12:21 pm

Hi again,

I didn't find a public method that fitted my needs, so I had to add my own public method to GraphicalAudio. :(

I can fill the files vector with the given folder name and run play_now(). :) That works in general. But of course there are some side effects! If mms is playing audio and I run play_now(), the software crashes - no surprise.

Do you have a hint for me which members of GraphicalAudio I have to care about in which way to "simulate" the Play now event from the menu safely?

Best regards,
marleaux

P.S.: Someone using eclipse with CDT under linux for building mms? I would like to avoid those UI exceptions that come up on every make/install/clean. Fortunately, debugging mms works fine. :)

lorenzodes
master
Posts: 772
Joined: Sun Mar 11, 2007 4:50 pm
Location: move.l 4.w,a6

Re: How to play audio in own feature plugin

Postby lorenzodes » Mon Nov 02, 2009 12:38 pm

marleaux wrote: But of course there are some side effects! If mms is playing audio and I run play_now(), the software crashes - no surprise.


I'd like to see a backtrace of that.
"I’m not frightened of dying, anytime will do, I don’t mind. Why should I be frightened of dying? There’s no reason for it, you gotta go sometime"

User avatar
marleaux
Posts: 8
Joined: Sat Oct 31, 2009 8:17 am

Re: How to play audio in own feature plugin

Postby marleaux » Mon Nov 02, 2009 12:56 pm

lorenzodes wrote:I'd like to see a backtrace of that.


When I'm back home I will see if it's easy to copy/paste the backtrace out of eclipse.

Anyway, I have to take care about the state-members, the internal lists, etc. of Graphical Audio. It's clear that I can not just reset the files vector. ;-)

User avatar
marleaux
Posts: 8
Joined: Sat Oct 31, 2009 8:17 am

Re: How to play audio in own feature plugin

Postby marleaux » Thu Nov 12, 2009 10:35 am

Hi lorenzodes,

sorry for the long delay. I was not patient enough to repeat the crash. But I'm sure that the reason was an illegal read on the files vector.

I got it to run now. I set the files vector to contain the folder I want to play. Then I call play_now(). That works, but when I use the MMS music browser it shows only the folder I was playing with my plugin. The browsing itself does not work anymore.
I need to find out how to restore the original files vector.

I think I will start with creating a local copy and reset the files vector after play_now(). Maybe that will be enough. My goal is to change as less code as possible.

Do you think that the GraphicalAudio plugin will be enhaced in the future to be used by other plugins over a nice small interface?

Best regards,
marleaux

btw: I'm using kdevelop now. It's not perfect but much smarter than eclipse. :wink:


Return to “1.1.x”

Who is online

Users browsing this forum: No registered users and 5 guests