Author Topic: implement new audio plugin  (Read 62103 times)

archived

  • Hello, I'm new here
  • Posts: 0
    • View Profile
implement new audio plugin
« on: August 14, 2006, 03:23:18 pm »
Hi,

  What would be the difficulty in implementing a plugin for a commandline audio player ie: aplayer or mplayer?  Could it be done with the gsd or would it need to be written in C++ with the dce framework?  Or would it be something that could be done by modifing the slimserver plugin?  I ask as I'm wanting to use my pluto cores' internal soundcard as an audio source for whole house zoned audio (wired in ceiling speakers running to central amps and in wall volume controls)
Any help or pointers would be great.  I'm good with perl and have looked at ruby and they seem not too different.  My C++ skills on the otherhand aren't too good

Thanks,
Jason

archived

  • Hello, I'm new here
  • Posts: 0
    • View Profile
implement new audio plugin
« Reply #1 on: August 14, 2006, 04:52:07 pm »
If you just want a DCE Device that can respond to the 'play media' command, that's trivial.  You could do it in GSD (ie Ruby).

However, if you want it to be integrated so follow-me works, floorplans, and it shares the same catalog of media, then you need to create a plugin which implements the 'MediaHandler' class and registers with Media_Plugin.  The plugin must be in C++ since it's loaded into the router's memory space.  It's not complicated for a C++ guy; DCEGen does 90% of the work automatically and builds the class and everything on it's own.

The actual media player itself could still be in Ruby, but without that media plugin you won't have the advanced features.

archived

  • Hello, I'm new here
  • Posts: 0
    • View Profile
implement new audio plugin
« Reply #2 on: August 22, 2006, 09:44:42 pm »
Thanks,  Looks like I'm wanting to write a plugin.  Can you point me to any docs, tutorials or examples?  I'm not sure I fully understand the architecture.  I see in the source that a lot of the devices have both a plugin and a device.  Does the plugin comunicate with the device which in turn controls whatever hardware or software?  I'm going to write the plugin to support mplayer as it supports Jack natively which will allow for zone sync and mixing and matching of audio throughout the house.  This also means I'll have to come up with some way of controlling Jack (anouther plugin I'm sure :) ) Once I add a second zone to the house.  I think I can get something usefull running in short order given enough docs.

Thanks again,
Jason

archived

  • Hello, I'm new here
  • Posts: 0
    • View Profile
implement new audio plugin
« Reply #3 on: August 24, 2006, 12:26:39 pm »
Hi to all,

back from vacation (at last)...  

I've worked a bit on this idea of having multiple soundcards (or using multichannel card as separate stereo channels) and I decided that IMHO best way is to have xine audio only device (since xine player is supported under pluto, this could happen with only few additional parameters).

I've done some initial test and it worked ok - I got into trouble when such player would be integrated with xine plugin (cause it didn't now how to treat it) - so it could become audio player for certain audio zone or room and be visible and controlable from Orbiters....

I've described my changes and initial code in :

http://plutohome.com/support/mantis/view.php?id=1515

After that, Pluto guy informed me that Xine player will be ceveloped in this way, so xine player will be able to be used as audio only device so one could run multiple instances... Since then I've waited for new release and right now I'd be happy if Pluto guys could give some more info on this development. As I said, xine player code is easy to modifiy, the problem lies in media plugin and proper handling of 3rd party audio players....

I'm also interested in your ideas reagarding mplayer&Jack. My idea for quite some time is that decent whole house audio mixing/routing could be implemented in linux software... Can you post more info ?

HTH,

regards,

Rob.

archived

  • Hello, I'm new here
  • Posts: 0
    • View Profile
implement new audio plugin
« Reply #4 on: August 24, 2006, 03:12:38 pm »
Hi,

  No prob with more info.  I'd love to get something moving on this.  I recently installed my first audio zone (speakers, volume and wiring) so I've begun to start implementing the software.  I've read your previous posts about this but couldn't do any testing at the time.  Anyway what I'm looking at is:  mplayer has native jack support, so no prob there.  It's just a matter of writing a plugin for mplayer with support for connectiong to whatever jack connections have been setup for each zone or adding an additional connection to an existing mplayer instance to have synced music in multiple zones.  Currently I'm using an sb live so I'll max out at 2 zones (4 mono channels, 2 stereo).  Eventually I'm looking at maudio hardware to handle all 8 planned zones.  Mplayer and Jack are already capable of this, so all thats needed would be a plugin for mplayer, and an admin gui to configure jack.  I'm not too good with C++, but with some books, google and some decent dce device howto/tutorial/documentation I'm more than willing to give this a try.  I think that about sums it up.  If you have any more questions or ideas/suggestions let me know.

Thanks,
Jason

archived

  • Hello, I'm new here
  • Posts: 0
    • View Profile
implement new audio plugin
« Reply #5 on: August 25, 2006, 04:34:57 pm »
Quote from: "tinia"
Since then I've waited for new release and right now I'd be happy if Pluto guys could give some more info on this development.


:( I am sorry to say this, but this functionality is still under development and 2.0.40 release doesn't include audio-only capable Xine_Player.

archived

  • Hello, I'm new here
  • Posts: 0
    • View Profile
implement new audio plugin
« Reply #6 on: September 27, 2006, 10:18:07 pm »
Hello all,
  It's been over a month and no helpfull responses to my plight :(  Perhapse something a little easier then...  A plugin for JACK.  All I need it to do is start jackd with some commandline options.  I'll even be ok with hardcoded options for the first iteration.  Just need to start and make sure it's always running, and I'll worry about configureing later.  Would like to write this in C++ as a plugin, but if there is an easier/better/more appropriate way to do it then let me know.  Otherwise writing a plugin in C++ documentation would be really helpfull.  Even more helpfull would be a sort of hello world plugin tutorial.  A step by step document that walks a new plugin developer through writing a simple plugin that prints 'hello world' somewhere and logs it to the log file.  Just an idea

Thanks,
Jason

archived

  • Hello, I'm new here
  • Posts: 0
    • View Profile
implement new audio plugin
« Reply #7 on: September 28, 2006, 08:32:51 am »
Hi,

I'm sorry for your feeelings. This is something we're all going through...

I've done changes to Xine player to become audio player twice. I also thought of doing it with Alsaplayer, which also wouldn't be too hard (only downside is that alsaplayer is close to being dead project). My Xine_Audio_Player even worked ok in a proof of concept stage (I remember that slight changes in volume control were on to do list).

The problem lies somewhere else. Even if you write 3rd party audio player, the problem is that currently Pluto doesn't support 3rd party players and it won't appear on Orbiters, so you cannot control it. Dirty workaround I did was to create dummy new MD and then use it's Xine Player ID to run my player. But since MDs are now detected for being in on/off state I'm not sure if this still works... Other way would be to somehow create dummy squeezebox player (they are automatically detected and get new audio room immediately)....

This is what I know about this situation. If you decide to write plugin, I'd be thrilled to read docs about it...

Regards,

Rob.

archived

  • Hello, I'm new here
  • Posts: 0
    • View Profile
implement new audio plugin
« Reply #8 on: September 29, 2006, 06:45:19 pm »
OK, so I'm trying to create a device template for Jack.  Can anyone help out?  I've read through the docs but still don't really have any idea.  I want to run this:
  /usr/bin/jackd -R -dalsa -djack40 -r48000 -p1024 -n2 -P -o4
with '-djack40' being configurable in the device settings.  So far I've created a template under 'Sound Cards < Peripherals' and added '#74 Alsa Output Device(string)' under data with jack40 as the default value.  How do I link the two together?  Is this something that can only be done with GSD or C++?  Or can I do it in the command line option with a variable?  If someone could point me in a direction that would be helpfull.

Thanks,
Jason

archived

  • Hello, I'm new here
  • Posts: 0
    • View Profile
implement new audio plugin
« Reply #9 on: September 29, 2006, 10:56:35 pm »
Quote from: "jspeckman"
OK, so I'm trying to create a device template for Jack.  Can anyone help out?  I've read through the docs but still don't really have any idea.  I want to run this:
  /usr/bin/jackd -R -dalsa -djack40 -r48000 -p1024 -n2 -P -o4
with '-djack40' being configurable in the device settings.  So far I've created a template under 'Sound Cards < Peripherals' and added '#74 Alsa Output Device(string)' under data with jack40 as the default value.  How do I link the two together?  Is this something that can only be done with GSD or C++?  Or can I do it in the command line option with a variable?  If someone could point me in a direction that would be helpfull.

Thanks,
Jason

If you just need to run some binary - there is command line entry where binary is specified. But Pluto adds several parameters to that (like ID and dcerouter) - see Xine_Player template for example...

Also it will run it under screen... But there is nothing preventing you from writing script, that will read those data from database and run jackd. You could also do this in c++ (motion wrapper is example of DCE device that first reads parameters from database and then runs another binary 'motion') . Maybe it is close to what you need...

If you need to act dinamically upon events then you have to connect to DCERouter as proper device and communicate with it....

I'm interested in your work with jackd. I'm still thinking about whole house audio switching/mixing app only in software, but I'm not sure if jack is the right app for that... Although Pluto has many features in this direction...

HTH,

regards,

Rob.

archived

  • Hello, I'm new here
  • Posts: 0
    • View Profile
implement new audio plugin
« Reply #10 on: September 30, 2006, 04:12:04 am »
tinia,
  Thanks for the pointer to the motion_wrapper.  I think that's close to what I've been looking for.  I post more when I either have something running or run into more problems :).

Jason

archived

  • Hello, I'm new here
  • Posts: 0
    • View Profile
implement new audio plugin
« Reply #11 on: October 12, 2006, 06:01:32 am »
Ok, run into a problem.  Here's what I get when I try to build the code that DCEGen creates without any modifications just to test:

dcerouter_3516:/usr/src/Pluto/trunk/src/Jack_Wrapper$ make
Computing dependencies for ../Gen_Devices/Jack_WrapperBase.cpp done
Computing dependencies for Jack_Wrapper.cpp done
Computing dependencies for Main.cpp done
type 'make bin', 'make so' or 'make all'
dcerouter_3516:/usr/src/Pluto/trunk/src/Jack_Wrapper$ make all
g++ -c -I.. -I../DCE -I/usr/include/mysql -D_DEVEL_DEFINES  -Wall -fPIC -ggdb3  Main.cpp -o Main.o
In file included from Jack_Wrapper.h:7,
                 from Main.cpp:2:
../Gen_Devices/Jack_WrapperBase.h: In constructor `
   DCE::Jack_Wrapper_Event::Jack_Wrapper_Event(int, std::basic_string<char,
   std::char_traits<char>, std::allocator<char> >, bool)':
../Gen_Devices/Jack_WrapperBase.h:35: error: `DEVICETEMPLATE_Jack_Wrapper_CONST
   ' undeclared (first use this function)
../Gen_Devices/Jack_WrapperBase.h:35: error: (Each undeclared identifier is
   reported only once for each function it appears in.)
../Gen_Devices/Jack_WrapperBase.h: In member function `bool
   DCE::Jack_Wrapper_Data::Get_Realtime_Priority()':
../Gen_Devices/Jack_WrapperBase.h:94: error: `
   DEVICEDATA_Realtime_Priority_CONST' undeclared (first use this function)
../Gen_Devices/Jack_WrapperBase.h: In member function `int
   DCE::Jack_Wrapper_Data::Get_Output_Channels()':
../Gen_Devices/Jack_WrapperBase.h:102: error: `DEVICEDATA_Output_Channels_CONST
   ' undeclared (first use this function)
make: *** [Main.o] Error 1


What am I missing or doing wrong?

Thanks,
Jason

archived

  • Hello, I'm new here
  • Posts: 0
    • View Profile
implement new audio plugin
« Reply #12 on: October 12, 2006, 07:55:20 am »
Hi,

I did those things long time ago, so I'm writting from my memory. I think I had similar problems. I think the problem is that your added template is not yet in regular Pluto tree from which code is generated.  So also coresponding entries in other files are missing (like CONST_....)

I don't exactly remember how this was fixed, but anyway, maybe there is now better solution to this. One I can remember is that you check in your template into regular Pluto distro and then svn check in and you'll have new proper files - but will also need to recompile dependencies before compiling your work....

I'd contact support and please post your procedure on Wiki, so others will benefit...

HTH,

Rob.

archived

  • Hello, I'm new here
  • Posts: 0
    • View Profile
implement new audio plugin
« Reply #13 on: October 19, 2006, 04:39:48 pm »
Just an update, I sent off a message to support last week, but have not heard anything yet.

Jason

archived

  • Hello, I'm new here
  • Posts: 0
    • View Profile
implement new audio plugin
« Reply #14 on: October 25, 2006, 03:07:02 am »
Jason,
Sorry for the delayed reply. The reason of build failure is the following: you have created new Template, but didn't regenerated the headers that define constants for other parts of system. Please do the following:

1) build the program Pluto/trunk/src/sql2cpp _or_ install the package pluto-sql2cpp

2) cd Pluto/trunk/src

3) backup current contents of the generated headers:
cp -r pluto_main pluto_main.backup

4) cd sql2cpp  (note that it must contain the sources of sql2cpp from SVN - it will require template files for operation)

5) run ./sql2cpp _or_ /usr/pluto/bin/sql2cpp -- depending on way in step-1
this will regenerate required headers with constants using current contents of `pluto_main` database (which I assume contain also your changes)

6) try again to build your Jack_Wrapper application

if you are interested in changes in generated headers, you may compare pluto_main and pluto_main.backup folders contents

Kirill