NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 80 81 82 83 84 … 93 Next »
Getting Audio track events

 
  • 0 Vote(s) - 0 Average
Getting Audio track events
Jeff
Offline

Posting Freak

Posts: 1,933
Threads: 69
Joined: Oct 2004
#1
2005-01-05, 02:07 AM
I have been trying to add functionality to my panel to display the currently playing audio track. I am implementing the IEventNotification interface. I receive CurrentAudioTrack events when a new track start up just fine, but I never receive any events to tell me the track is complete. I thought I might get a MusicStopping event, but I don’t. Am I doing something wrong? I know I could poll the PlayList to see if something is still playing, but that seems resource intensive and defeats the whole reason to use events in the first place.

Thanks

Jeff
sub
Online

Administrator

NextPVR HQ, New Zealand
Posts: 106,684
Threads: 767
Joined: Nov 2003
#2
2005-01-05, 02:46 AM
Ok. I've just changed it so it will sent the EventTypes.MusicStopping when it reaches the end of the playlist. Will this meet your needs?
Jeff
Offline

Posting Freak

Posts: 1,933
Threads: 69
Joined: Oct 2004
#3
2005-01-05, 02:52 AM
If this includes a playlist of one song only too then yes, it will be perfect, thanks.

Jeff
sub
Online

Administrator

NextPVR HQ, New Zealand
Posts: 106,684
Threads: 767
Joined: Nov 2003
#4
2005-01-05, 02:54 AM
Yes, even playing one song counts as an internal playlist.
reven
Offline

Posting Freak

Posts: 5,782
Threads: 396
Joined: Sep 2004
#5
2005-01-05, 03:09 AM
jeff ive already made a currently playing song panel which i supplied in the gbpvrme skin, was planning on updating it further just havent got around to it. it displays id3 tags, and the current song position, and uses a simple compare in the needs render method.

planning on adding things like the ability to show the folder image, specify what info is displayed etc.

i only put this on hold since i could get wma/ape file tags, and am still looking for a way to get this information. if you want the source code ill send it to you, its a really simple panel at the moment.
Jeff
Offline

Posting Freak

Posts: 1,933
Threads: 69
Joined: Oct 2004
#6
2005-01-05, 04:34 AM
My original plan was a bit more ambitious. I wanted to squash the functionality of the clock panel and upcoming recordings panel into a single panel to save screen space. I also wanted to cut down on CPU resources (i.e., not scroll through the list of upcoming shows but just display the next one) and I wanted to add some flexibility to the date/time format.

I then decided that I wanted to reuse the panel status line to be able to display steps in the DVD2MPEG process. Then I decided that I wanted to allow the status line to display status about copying files to the archive. Then I decided it would be nice to display to display disk almost full warnings. Then I decided it would be nice to display music track info, and on and on.

At this point I came to the idea that I needed to do two things.

First, I decided that the panel needed to implement a set of queues at different priorities. The panel would cycle through all the status messages in the highest priority queue with messages in it and display them one after another for a configurable amount of time. If a given queue was empty it would look in the next queue down. I have this part working now.

Second, I thought it would be nice to make a plug-in interface for the panel itself so that I could write tiny little panel widgets to display new informational messages. I spent about 2 days of my New Year’s “vacation” banging my head against a wall on this one and then gave up, at least for now.

My interfaces were:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">
public interface IVAPanelWidget
{
IVAPanel Panel {get;set;}

void panelWidgetActivate();
void panelNeedsRenderRequestHandler();
}

public interface IVAPanel
{
void addPanelMessage (string source, string message, int level);
int removePanelMessage (string source, int level);
int removeAllPanelMessages (string source);
int countOfAllPanelMessages (string source);
bool containsPanelMessage (string source, int level);
}
[/QUOTE]

I got the panel to the point where I could load assemblies and find if they implemented my interface, but I could never get Activator.CreateInstance to instantiate an instance of my interface; it always created the whole class. If someone that actually understands how this reflection stuff works (like sub, who uses it with all the plug-in interfaces) can point me to how to make this work that would be great. I was a &quot;real&quot; programmer a decade ago before all the OOP stuff, but now I am just a weekend warrior, so I am a bit over my head.

Jeff
sub
Online

Administrator

NextPVR HQ, New Zealand
Posts: 106,684
Threads: 767
Joined: Nov 2003
#7
2005-01-05, 04:55 AM
Here is a snippet of code from my plugin manager:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> private PluginManager()
{
if (Directory.Exists(SystemConfiguration.getInstance().getInstallLocation() + "\\plugins"))
{
// load plugins
string []pluginFiles = Directory.GetFiles(SystemConfiguration.getInstance().getInstallLocation() + "\\plugins", "*.dll");
foreach (string pluginFile in pluginFiles)
{
try
{
Assembly pluginAssembly;

// load plugin
byte[] rawAssembly = loadFile(pluginFile);

//load plugin symbols if present
string symbolsFile = pluginFile.Substring(0, pluginFile.Length - 3) + "pdb";
if (File.Exists(symbolsFile))
{
byte[] rawAssemblySymbols = loadFile(symbolsFile);
pluginAssembly = AppDomain.CurrentDomain.Load(rawAssembly, rawAssemblySymbols);
}
else
{
pluginAssembly = AppDomain.CurrentDomain.Load(rawAssembly);
}

System.Type []types = pluginAssembly.GetTypes();
foreach (System.Type type in types)
{
if (type.IsPublic)
{
// first look for menu plugins
Type iface = type.GetInterface("GBPVR.Public.IMenuTask");
if(iface != null)
{
try
{
object instance = Activator.CreateInstance(type);
IMenuTask imi = (GBPVR.Public.IMenuTask)instance;
menuPlugins.Add(imi);
menuPluginsByName.Add(imi.getName(), imi);
}
catch (Exception e)
{
Logger.Error("Error initializing menu plugin: " + pluginFile);
Logger.Error(e.Message);
Logger.Error(e.StackTrace);
if (e.InnerException != null)
{
Logger.Error("Inner exception: " + e.InnerException);
Logger.Error(e.InnerException.StackTrace);
}
}
}
....
[/QUOTE]
Jeff
Offline

Posting Freak

Posts: 1,933
Threads: 69
Joined: Oct 2004
#8
2005-01-05, 06:35 AM
I wasn't doing the pluginAssembly = AppDomain.CurrentDomain.Load(rawAssembly); stuff; I was just getting the assembvy using pluginAssembly= Assembly.LoadFrom(filename);

I'd like to try your version to see if that is the difference, but it look slike you are calling your own method loadFile() that I need to.

Thanks for the help

Jeff
sub
Online

Administrator

NextPVR HQ, New Zealand
Posts: 106,684
Threads: 767
Joined: Nov 2003
#9
2005-01-05, 06:49 AM
The dynamic loading by way of a byte array is needed, otherwise paths get in the way (long story...)

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> // Loads the content of a file to a byte array.
static byte[] loadFile(string filename)
{
FileStream fs = new FileStream(filename, FileMode.Open);
byte[] buffer = new byte[(int) fs.Length];
fs.Read(buffer, 0, buffer.Length);
fs.Close();
return buffer;
} [/QUOTE]
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  Extra Events jcole998 1 1,459 2021-03-08, 02:48 PM
Last Post: mvallevand
  Switching Audio Channels spitefulgod 0 2,002 2016-12-15, 08:42 PM
Last Post: spitefulgod
  Touch and http audio url's mvallevand 0 1,411 2013-11-03, 07:05 PM
Last Post: mvallevand
  List of "IEventNotification" events? reven 8 3,362 2012-11-01, 10:56 PM
Last Post: reven
  NMT Video Playback - does it receive start/stop events psycik 8 3,384 2012-07-15, 10:01 PM
Last Post: mvallevand
  Audio Renderers imilne 3 2,211 2011-09-29, 09:08 PM
Last Post: imilne
  MVP accessuble audio idkpmiller 3 2,150 2009-09-25, 11:59 PM
Last Post: idkpmiller
  Responding to keypress events while a video is playing Ommina 7 3,371 2009-06-27, 12:48 AM
Last Post: sub
  BASS - Getting Audio Data for Spectrum Analysis/Display ralphy 3 4,566 2009-02-15, 08:00 AM
Last Post: whurlston
  Not a plugin-exactly, but want to get events... JohnInSJ 13 4,537 2008-06-21, 12:23 PM
Last Post: JohnInSJ

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode